@vellumai/web 0.10.5 → 0.10.6-dev.202607062043.72bc40b

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 (271) hide show
  1. package/dist/assets/{AnimatePresence-uY0BR2n2.js → AnimatePresence-BfOY8V3r.js} +1 -1
  2. package/dist/assets/{BundleConfirmPage-BEQyQVeN.js → BundleConfirmPage-DtbTBD3c.js} +1 -1
  3. package/dist/assets/a2a-invite-Cx_1aeti.js +1 -0
  4. package/dist/assets/{about-page-Ck4iLq7E.js → about-page-5s4Penpj.js} +1 -1
  5. package/dist/assets/{account-page-B4_qrJXM.js → account-page-DHGiHznC.js} +1 -1
  6. package/dist/assets/{account-shell-PzFH1_ZC.js → account-shell-Dr8Tx6Bj.js} +1 -1
  7. package/dist/assets/acp-run-detail-panel-Qyhv1xf5.js +5 -0
  8. package/dist/assets/{add-credits-modal-BnXqKqkz.js → add-credits-modal-C5VbmTcp.js} +1 -1
  9. package/dist/assets/advanced-page-Dj6n8jY9.js +1 -0
  10. package/dist/assets/ai-page-BBTf2xm0.js +1 -0
  11. package/dist/assets/{animated-avatar-CEC1DGcI.js → animated-avatar-BQThabuh.js} +1 -1
  12. package/dist/assets/{api-1X5EQzNF.js → api-Cmvks7oV.js} +1 -1
  13. package/dist/assets/api-key-screen-BPMLt-ig.js +1 -0
  14. package/dist/assets/{archive-page-DZ_8uaQt.js → archive-page-DkXDHprB.js} +1 -1
  15. package/dist/assets/assistant-api-Dlwk8jYW.js +1 -0
  16. package/dist/assets/assistant-feature-flag-store-CMcVRahr.js +1 -0
  17. package/dist/assets/{assistant-identity-store-cODRsfVo.js → assistant-identity-store-DP4B8mmA.js} +1 -1
  18. package/dist/assets/{assistant-status-panel-D-XT9dcW.js → assistant-status-panel-CBfzD39-.js} +1 -1
  19. package/dist/assets/{auth-store-B1y6dgYQ.js → auth-store-CaqwDbc2.js} +2 -2
  20. package/dist/assets/background-task-detail-panel-v2jrb3D8.js +1 -0
  21. package/dist/assets/billing-page-BT_jl52e.js +3 -0
  22. package/dist/assets/{bookmarks-page-DmPcHyC_.js → bookmarks-page-CirWxky8.js} +1 -1
  23. package/dist/assets/{browser-DM38C5zq.js → browser-CMMlaSIg.js} +2 -2
  24. package/dist/assets/{build-state-B-RL-LxH.js → build-state-DluIkwjA.js} +1 -1
  25. package/dist/assets/{capture-error-BG-GkiMq.js → capture-error-8raDoxFL.js} +1 -1
  26. package/dist/assets/channels-page-route-CdHUDMpl.js +1 -0
  27. package/dist/assets/{client-feature-flag-store-CHA6YxVq.js → client-feature-flag-store-D3f7L4rr.js} +1 -1
  28. package/dist/assets/clipboard-copy-cZENPJ25.js +1 -0
  29. package/dist/assets/{command-palette-DkJaPl6x.js → command-palette-DaMqoMAU.js} +1 -1
  30. package/dist/assets/{command-palette-window-page-v-j032zP.js → command-palette-window-page-CCfj5vRJ.js} +1 -1
  31. package/dist/assets/{community-page-BZ9IruGQ.js → community-page-CvyczMAv.js} +1 -1
  32. package/dist/assets/connect-page-CgjtbH-6.js +1 -0
  33. package/dist/assets/consent-controls-ClSTeIJN.js +1 -0
  34. package/dist/assets/contacts-gateway-BWK_Flr2.js +1 -0
  35. package/dist/assets/contacts-page-route-CzEFRbTr.js +1 -0
  36. package/dist/assets/{conversation-list-fetchers-COStMaVO.js → conversation-list-fetchers-D5PpdmFr.js} +1 -1
  37. package/dist/assets/{danger-zone-redirect-page-DK4QwO4q.js → danger-zone-redirect-page-Bgdd63rE.js} +1 -1
  38. package/dist/assets/debug-page-D6GP_Z5j.js +4 -0
  39. package/dist/assets/{deploy-dialogs-Cbti_xsn.js → deploy-dialogs-B0iFcrdl.js} +1 -1
  40. package/dist/assets/{detail-card-EsA9SOvZ.js → detail-card-Cluf3jp-.js} +1 -1
  41. package/dist/assets/{detail-panel-stop-button-BHEQd627.js → detail-panel-stop-button-DLbL8892.js} +1 -1
  42. package/dist/assets/{detail-shell-CPp3KhI8.js → detail-shell-D2zdREi6.js} +3 -3
  43. package/dist/assets/developer-page-CEgxPJOk.js +1 -0
  44. package/dist/assets/devices-page-BcOwAQUP.js +1 -0
  45. package/dist/assets/{diagnostics-BAjanSbk.js → diagnostics-BQUtALh-.js} +1 -1
  46. package/dist/assets/{dictation-overlay-page-BHrUGwJK.js → dictation-overlay-page-BomOWu6L.js} +1 -1
  47. package/dist/assets/{document-viewer-page-CnFgbOqH.js → document-viewer-page-DO-B_dW5.js} +1 -1
  48. package/dist/assets/{earn-credits-modal-DOIDaArW.js → earn-credits-modal-DDaMKLf-.js} +1 -1
  49. package/dist/assets/{emails-page-B0bc-Gj2.js → emails-page-Bnt_LFm8.js} +1 -1
  50. package/dist/assets/esm-B8gIEdvE.js +2 -0
  51. package/dist/assets/esm-BcBBRdDZ.js +2 -0
  52. package/dist/assets/esm-CCflKMxE.js +1 -0
  53. package/dist/assets/{esm-O9mDOR47.js → esm-CfmiUZwH.js} +2 -2
  54. package/dist/assets/esm-DMBBFg8b.js +2 -0
  55. package/dist/assets/esm-r--N6GwW.js +2 -0
  56. package/dist/assets/{feature-flag-catalog-qaNLg85h.js → feature-flag-catalog-CRFA909Q.js} +1 -1
  57. package/dist/assets/{file-editor-Bm5LJXwA.js → file-editor-t2f74PYI.js} +1 -1
  58. package/dist/assets/general-page-wh73abP3.js +1 -0
  59. package/dist/assets/{hatching-screen-CENPVFoZ.js → hatching-screen-DXNQq401.js} +1 -1
  60. package/dist/assets/{home-page-route-mQBcsrfW.js → home-page-route-6rqg7fsW.js} +1 -1
  61. package/dist/assets/{hosting-screen-I6v4dE5d.js → hosting-screen-D9Dt-Lbd.js} +1 -1
  62. package/dist/assets/identity-page-route-DOxLfy_2.js +1 -0
  63. package/dist/assets/index-BSIVErIA.js +129 -0
  64. package/dist/assets/index-DMbjaeZr.css +2 -0
  65. package/dist/assets/{inspect-page-BIEfENnw.js → inspect-page-DOgX8jAG.js} +4 -4
  66. package/dist/assets/{install-lYdVLxh2.js → install-2WiFSq28.js} +1 -1
  67. package/dist/assets/integrations-page-BenORfam.js +1 -0
  68. package/dist/assets/intelligence-layout-Bn3HkMCN.js +1 -0
  69. package/dist/assets/{keyboard-shortcuts-page-H4mn2-og.js → keyboard-shortcuts-page-627U5sIh.js} +1 -1
  70. package/dist/assets/{library-detail-page-DTbtqnJW.js → library-detail-page-Cci82R9o.js} +1 -1
  71. package/dist/assets/{library-page-CtniKYuA.js → library-page-dhpEyoQO.js} +1 -1
  72. package/dist/assets/{login-flow-DB9qs18f.js → login-flow-Dx0xk9R9.js} +1 -1
  73. package/dist/assets/{login-page-CA6jFCFt.js → login-page-Cc84hgIn.js} +1 -1
  74. package/dist/assets/logout-page-6JCH9cLO.js +1 -0
  75. package/dist/assets/logs-layout-DM0r291-.js +1 -0
  76. package/dist/assets/{memory-router-playground-page-BhFJ0lwa.js → memory-router-playground-page-DamRxxJH.js} +1 -1
  77. package/dist/assets/{messages-ChEiS3wF.js → messages-Doco46Z6.js} +1 -1
  78. package/dist/assets/{metric-card-UcIagS0r.js → metric-card-C7AqAAbh.js} +1 -1
  79. package/dist/assets/{mobile-sidebar-drawer-BA9ERuJ7.js → mobile-sidebar-drawer-Kv3iEA8X.js} +1 -1
  80. package/dist/assets/mutation-error-CD6N6L8e.js +1 -0
  81. package/dist/assets/{native-biometric-BK6_QtW5.js → native-biometric-C5AdTx4r.js} +1 -1
  82. package/dist/assets/{native-file-DIJL6af-.js → native-file-Boive9Pb.js} +2 -2
  83. package/dist/assets/{notifications-page-BSwHh8Mx.js → notifications-page-Dq024L7o.js} +1 -1
  84. package/dist/assets/{oauth-complete-page-KFGDIl3q.js → oauth-complete-page-DE4mo9I9.js} +1 -1
  85. package/dist/assets/{oauth-popup-complete-page-C9FKG9VY.js → oauth-popup-complete-page-DU9KIPzI.js} +1 -1
  86. package/dist/assets/onboarding-step-layout-CEt9JOpN.js +1 -0
  87. package/dist/assets/{page-shell-WuVNE2W8.js → page-shell-CFZ6E1HW.js} +1 -1
  88. package/dist/assets/{pairing-page-CT45DoH8.js → pairing-page-BVMyErSR.js} +1 -1
  89. package/dist/assets/{password-reset-page-T_0pamrF.js → password-reset-page-Cj87HBNh.js} +1 -1
  90. package/dist/assets/{platform-detection-Ceodt3Hu.js → platform-detection-B1WOWEur.js} +1 -1
  91. package/dist/assets/{platform-loopback-page-BXnADBto.js → platform-loopback-page-Bdk9boDd.js} +1 -1
  92. package/dist/assets/{plugin-detail-page-3mf9oR80.js → plugin-detail-page-Cxsa-hPJ.js} +1 -1
  93. package/dist/assets/plugins-page-D7ePZDGE.js +1 -0
  94. package/dist/assets/plugins-surface-DRbxJPYn.js +1 -0
  95. package/dist/assets/plus-CzwTg9D8.js +1 -0
  96. package/dist/assets/prechat-route-DeeZQ6gD.js +1 -0
  97. package/dist/assets/{prefs-Ds__U7Hi.js → prefs-702C0uZJ.js} +1 -1
  98. package/dist/assets/{privacy-page-CLJnEPBh.js → privacy-page-CINbUwOT.js} +1 -1
  99. package/dist/assets/{privacy-screen-DWLF6KuW.js → privacy-screen-BjTMIoHH.js} +1 -1
  100. package/dist/assets/{provider-callback-page-UAlBgfqn.js → provider-callback-page-DKBubRTx.js} +1 -1
  101. package/dist/assets/provider-key-BPLaV5Em.js +1 -0
  102. package/dist/assets/{provider-signup-page-B1fLCCUD.js → provider-signup-page-wT3s0VK4.js} +1 -1
  103. package/dist/assets/{quick-input-page-CyO-UVOQ.js → quick-input-page-BfOelFNh.js} +1 -1
  104. package/dist/assets/{react-query.gen-BwkZCSTW.js → react-query.gen-Bxy9zjSn.js} +1 -1
  105. package/dist/assets/react-query.gen-DflHuu0a.js +1 -0
  106. package/dist/assets/research-mock-page-Dxdzg4sq.js +1 -0
  107. package/dist/assets/research-onboarding-route-Ba_quArg.js +61 -0
  108. package/dist/assets/{resize-errors-D1myE8D_.js → resize-errors-CN02qg8O.js} +1 -1
  109. package/dist/assets/{review-terms-screen-BqGwop2y.js → review-terms-screen-DGneW8ir.js} +1 -1
  110. package/dist/assets/{routes-C6gxiCrz.js → routes-CCywyokq.js} +1 -1
  111. package/dist/assets/{schedules-D_sclJNA.js → schedules-BMcRnOLI.js} +1 -1
  112. package/dist/assets/sdk.gen-4wHSMlYm.js +6 -0
  113. package/dist/assets/{sdk.gen-zA5ns5LT.js → sdk.gen-B3Z8klU-.js} +1 -1
  114. package/dist/assets/{sdk.gen-DmWuY0SL.js → sdk.gen-DIozkrVG.js} +1 -1
  115. package/dist/assets/select-assistant-screen-DbFq-Wgk.js +1 -0
  116. package/dist/assets/{settings-layout-D_5HXQhT.js → settings-layout-BluT8WQX.js} +1 -1
  117. package/dist/assets/{share-feedback-modal-B3axmWXR.js → share-feedback-modal-Dw9dSybU.js} +1 -1
  118. package/dist/assets/{sidebar-tree-DM30_BN8.js → sidebar-tree-g2IOurb9.js} +1 -1
  119. package/dist/assets/{signup-page-DlqG9kP3.js → signup-page-BUV5knUi.js} +1 -1
  120. package/dist/assets/{signup-shell-DMX1tgqB.js → signup-shell-kEMwXhkp.js} +1 -1
  121. package/dist/assets/skills-page-g9-Ez8GQ.js +1 -0
  122. package/dist/assets/{sound-manager-45n1b-Bl.js → sound-manager-DtzFjWmP.js} +1 -1
  123. package/dist/assets/{sounds-page-DC_yF186.js → sounds-page-CmHIosxa.js} +1 -1
  124. package/dist/assets/{src-SCpl1O1B.js → src-CUycEQpW.js} +4 -4
  125. package/dist/assets/subagent-detail-panel-BcJssvr3.js +4 -0
  126. package/dist/assets/{subagent-store-DWKZ9Yt3.js → subagent-store-CvUWqyR1.js} +1 -1
  127. package/dist/assets/{system-events-page-CMXtS3Lt.js → system-events-page-CiJW6MG8.js} +1 -1
  128. package/dist/assets/{system-events-redirect-page-C16Xg1C_.js → system-events-redirect-page--ohB61bh.js} +1 -1
  129. package/dist/assets/{tiptap-document-editor-BILtD2S2.js → tiptap-document-editor-D8CqrErD.js} +1 -1
  130. package/dist/assets/toast-B0OiPFFj.js +1 -0
  131. package/dist/assets/{tool-detail-panel-CG9Wp2NK.js → tool-detail-panel-BABKKn03.js} +1 -1
  132. package/dist/assets/{trace-page-k0cYj2Bt.js → trace-page-BCe3Hc4w.js} +1 -1
  133. package/dist/assets/{upgrade-cancel-page-KGY9H9Mg.js → upgrade-cancel-page-ScrkyQLY.js} +1 -1
  134. package/dist/assets/{upgrade-success-page-9MHgGZFb.js → upgrade-success-page-l5kyOkA5.js} +1 -1
  135. package/dist/assets/{usage-page-CVI5PvbA.js → usage-page-DsE_wrs7.js} +1 -1
  136. package/dist/assets/{use-bus-subscription-BNaztnO7.js → use-bus-subscription-Cv9Js5_J.js} +1 -1
  137. package/dist/assets/use-is-org-ready-Di8rWXQx.js +1 -0
  138. package/dist/assets/use-onboarding-login-1PgWYE2l.js +1 -0
  139. package/dist/assets/{use-reduced-motion-BG6r0Z46.js → use-reduced-motion-CvBcOxwR.js} +1 -1
  140. package/dist/assets/use-setup-channel-param-CeLco10G.js +9 -0
  141. package/dist/assets/{use-skill-categories-nKUbiuQn.js → use-skill-categories-RgCbbH2S.js} +1 -1
  142. package/dist/assets/{utils-P-AuKiE9.js → utils-ChLzMd8R.js} +1 -1
  143. package/dist/assets/{viewer-store-BR99G-Ii.js → viewer-store-D7cH9LQF.js} +1 -1
  144. package/dist/assets/{voice-page-ChYDqNwz.js → voice-page-D4P_LFG-.js} +1 -1
  145. package/dist/assets/{weather-forecast-display-DaU-H5wf.js → weather-forecast-display-DFkyed5P.js} +1 -1
  146. package/dist/assets/{web-lNls6p99.js → web-BgIxGC0T.js} +1 -1
  147. package/dist/assets/{web-YggPvEM4.js → web-CN0yVdyP.js} +1 -1
  148. package/dist/assets/{web-DGDlV45i.js → web-CWOTYcgT.js} +1 -1
  149. package/dist/assets/{web-DFw1Yfb1.js → web-Co1ZXchx.js} +1 -1
  150. package/dist/assets/{web-GWxiW7or.js → web-DVcz1sgn.js} +1 -1
  151. package/dist/assets/{web-b9SjJqdc.js → web-JttC73Ef.js} +1 -1
  152. package/dist/assets/{web-CxyEb7Lp.js → web-sbNRIHhu.js} +1 -1
  153. package/dist/assets/{welcome-screen-1tj61zH7.js → welcome-screen-B4eMC09Z.js} +1 -1
  154. package/dist/assets/{workflow-detail-panel-Di63Av9t.js → workflow-detail-panel-RdJrrsBW.js} +1 -1
  155. package/dist/assets/workspace-page-VEQMOhmR.js +1 -0
  156. package/dist/index.html +89 -86
  157. package/package.json +1 -1
  158. package/dist/assets/acp-run-detail-panel-ZJb9mPFf.js +0 -5
  159. package/dist/assets/advanced-page-BsF8JW-4.js +0 -1
  160. package/dist/assets/ai-page-BNaD9M7D.js +0 -1
  161. package/dist/assets/api-key-screen-DiW5rDSM.js +0 -1
  162. package/dist/assets/assistant-api-B17nD3D6.js +0 -1
  163. package/dist/assets/assistant-feature-flag-store-Btrsn1VW.js +0 -6
  164. package/dist/assets/background-task-detail-panel-DRBcuGts.js +0 -1
  165. package/dist/assets/billing-page-Rw3ECU55.js +0 -3
  166. package/dist/assets/connect-page-iwfq05E5.js +0 -1
  167. package/dist/assets/consent-controls-BzFFpG2p.js +0 -1
  168. package/dist/assets/contacts-gateway-BDJYh797.js +0 -1
  169. package/dist/assets/contacts-page-route-iggE95MQ.js +0 -9
  170. package/dist/assets/debug-page-DhYoaQMd.js +0 -4
  171. package/dist/assets/developer-page-D0Ttwt5o.js +0 -1
  172. package/dist/assets/devices-page-CkA_1aNA.js +0 -1
  173. package/dist/assets/esm--RA963YO.js +0 -2
  174. package/dist/assets/esm-BSRBg0oR.js +0 -2
  175. package/dist/assets/esm-CJ8uY1wn.js +0 -2
  176. package/dist/assets/esm-DTj81fJQ.js +0 -1
  177. package/dist/assets/esm-cB02a8J9.js +0 -2
  178. package/dist/assets/general-page-Df1AoP_V.js +0 -1
  179. package/dist/assets/identity-page-route-DlM3U1hC.js +0 -1
  180. package/dist/assets/index-B-S-gNKm.js +0 -131
  181. package/dist/assets/index-Ceh6erpc.css +0 -2
  182. package/dist/assets/integrations-page-BBZ2VFVI.js +0 -1
  183. package/dist/assets/intelligence-layout-zqIx7Q-I.js +0 -1
  184. package/dist/assets/logout-page-BbQCJKwL.js +0 -1
  185. package/dist/assets/logs-layout-xXeY2t6B.js +0 -1
  186. package/dist/assets/mutation-error-Iab5I7oz.js +0 -1
  187. package/dist/assets/plugins-page-H6DAm3HM.js +0 -1
  188. package/dist/assets/plugins-surface-gCrqfOas.js +0 -1
  189. package/dist/assets/prechat-route-BfQPMYu8.js +0 -1
  190. package/dist/assets/provider-key-Ba5Bw5MO.js +0 -1
  191. package/dist/assets/react-query.gen-gQ1_8EHv.js +0 -1
  192. package/dist/assets/research-mock-page-5ewHxOuJ.js +0 -1
  193. package/dist/assets/research-onboarding-route-RxDDgsKx.js +0 -61
  194. package/dist/assets/select-assistant-screen-BfhDJw-S.js +0 -1
  195. package/dist/assets/skills-page-C303uEzv.js +0 -1
  196. package/dist/assets/subagent-detail-panel-B69kOmY_.js +0 -4
  197. package/dist/assets/toast-sdJJ6aTV.js +0 -1
  198. package/dist/assets/use-is-org-ready-BviznO9P.js +0 -1
  199. package/dist/assets/use-onboarding-login-Da1r3M06.js +0 -1
  200. package/dist/assets/workspace-page-C5nupXN6.js +0 -1
  201. /package/dist/assets/{api-errors-DPruG7q9.js → api-errors-CPc5p2r9.js} +0 -0
  202. /package/dist/assets/{app-info-DJQFoVxX.js → app-info-BpODMRSH.js} +0 -0
  203. /package/dist/assets/{avatar-bundled-components-w37NPF4o.js → avatar-bundled-components-CKzuwg7P.js} +0 -0
  204. /package/dist/assets/{avatar-svg-compositor-CNy1XmWD.js → avatar-svg-compositor-ByqPxbZy.js} +0 -0
  205. /package/dist/assets/{build.umd-4R02MPXx.js → build.umd-C1HTyyY-.js} +0 -0
  206. /package/dist/assets/{by-tool-use-id-index-Dbdu-8Kf.js → by-tool-use-id-index-DJ7loqSY.js} +0 -0
  207. /package/dist/assets/{chat-rA5AbKPD.js → chat-DIbdgBG9.js} +0 -0
  208. /package/dist/assets/{client-identity-KGlckm6M.js → client-identity-DiDHLoNp.js} +0 -0
  209. /package/dist/assets/{client.gen-DU1JkKSB.js → client.gen-CbVuiseX.js} +0 -0
  210. /package/dist/assets/{client.gen-BHupOCJH.js → client.gen-nWvCdeJb.js} +0 -0
  211. /package/dist/assets/{cloud-off-rAv4OHmv.js → cloud-off-fMC5iwVY.js} +0 -0
  212. /package/dist/assets/{code-aMX9iMYa.js → code-BhoMjTYO.js} +0 -0
  213. /package/dist/assets/{composer-focus-n921WsjZ.js → composer-focus-DsTW3NPv.js} +0 -0
  214. /package/dist/assets/{conversation-selection-CNssqGbG.js → conversation-selection-C5YNfBdw.js} +0 -0
  215. /package/dist/assets/{conversation-store-B8D6wE18.js → conversation-store-BheNrWpL.js} +0 -0
  216. /package/dist/assets/{cpu-CiHv3fhs.js → cpu-D1r7PLan.js} +0 -0
  217. /package/dist/assets/{credit-card-BKRB1ZIi.js → credit-card-BwN95biV.js} +0 -0
  218. /package/dist/assets/{definitions-BughTGuV.js → definitions-BDDZxWCi.js} +0 -0
  219. /package/dist/assets/{dist-Ztj3rqLK.js → dist-CNEsSZUe.js} +0 -0
  220. /package/dist/assets/{domain-field-DYwuCpup.js → domain-field-CNW1t3OC.js} +0 -0
  221. /package/dist/assets/{edit-chat-session-DcCgw5Qy.js → edit-chat-session-CRDRHSHi.js} +0 -0
  222. /package/dist/assets/{effective-timezone-B99h9zr7.js → effective-timezone-DrYGH2Lb.js} +0 -0
  223. /package/dist/assets/{emoji-catalog-data-D8lRMt3A.js → emoji-catalog-data-BMOaskWd.js} +0 -0
  224. /package/dist/assets/{environment-store-CnVyTyZ7.js → environment-store-BId3OxJc.js} +0 -0
  225. /package/dist/assets/{event-bus-B3E3w-q2.js → event-bus-ULoEgfFr.js} +0 -0
  226. /package/dist/assets/{external-link-RJkZLlff.js → external-link-BgOnp59e.js} +0 -0
  227. /package/dist/assets/{file-text-ClqzuFsu.js → file-text-D4wmdFsJ.js} +0 -0
  228. /package/dist/assets/{format-BDkwdD2m.js → format-BYTv9IbI.js} +0 -0
  229. /package/dist/assets/{format-date-D4tzd1DT.js → format-date-BczUbfC1.js} +0 -0
  230. /package/dist/assets/{format-file-size-BflZ4oxc.js → format-file-size-DzVEncaw.js} +0 -0
  231. /package/dist/assets/{globe-D3P5sSKJ.js → globe-CRuerXYx.js} +0 -0
  232. /package/dist/assets/{haptics-BE_0g4mc.js → haptics-BEkpS-vX.js} +0 -0
  233. /package/dist/assets/{hard-drive-CZEg1Cqc.js → hard-drive-DsJ64Fuu.js} +0 -0
  234. /package/dist/assets/{impersonate-version-flag-DyVWQf97.js → impersonate-version-flag-BpzPjXeb.js} +0 -0
  235. /package/dist/assets/{info-ciQS_i3y.js → info-C9uyv2bI.js} +0 -0
  236. /package/dist/assets/{lib-BNGjysgr.js → lib-CqaNetx-.js} +0 -0
  237. /package/dist/assets/{link-2-r_QPxX18.js → link-2-BIp7l4R9.js} +0 -0
  238. /package/dist/assets/{llm-dimension-8g-Go8uq.js → llm-dimension-BJn_qWpX.js} +0 -0
  239. /package/dist/assets/{loader-circle-BFRVtR3K.js → loader-circle-BITX1qOw.js} +0 -0
  240. /package/dist/assets/{log-in-CEw63CGU.js → log-in-BCOweEUO.js} +0 -0
  241. /package/dist/assets/{minimize-2-dKm10qRD.js → minimize-2-BQKYHW0m.js} +0 -0
  242. /package/dist/assets/{misc-CFzLzLPH.js → misc-sQPqzyNB.js} +0 -0
  243. /package/dist/assets/{monitor-CXU19mVX.js → monitor-xGqXetuk.js} +0 -0
  244. /package/dist/assets/{moon-CKINz50a.js → moon-rIyEhhAK.js} +0 -0
  245. /package/dist/assets/{native-deep-link-C2-dXaz_.js → native-deep-link-ph1k7q0n.js} +0 -0
  246. /package/dist/assets/{pdf-B-YWzK66.js → pdf-Cn87r_RS.js} +0 -0
  247. /package/dist/assets/{pencil-B90pDI55.js → pencil-CtYlsDsm.js} +0 -0
  248. /package/dist/assets/{prechat-RG0Q0UrS.js → prechat-BzdosDIx.js} +0 -0
  249. /package/dist/assets/{prechat-names-NPlBAwCy.js → prechat-names-B-q5SxbD.js} +0 -0
  250. /package/dist/assets/{proxy-BgtfAoJj.js → proxy-CS0_Z81S.js} +0 -0
  251. /package/dist/assets/{public-asset-C2P77n3W.js → public-asset-DvnrpAnR.js} +0 -0
  252. /package/dist/assets/{refresh-cw-Dui3Ymsb.js → refresh-cw-Dlu2vgR6.js} +0 -0
  253. /package/dist/assets/{remote-gateway-session-BigLiDPm.js → remote-gateway-session-C2xcV9Z_.js} +0 -0
  254. /package/dist/assets/{repeat-nCGBxntG.js → repeat-MDHTMmlC.js} +0 -0
  255. /package/dist/assets/{return-to-yMLvlnXN.js → return-to-DnS1UWHr.js} +0 -0
  256. /package/dist/assets/{save-BpAesNEP.js → save-C03NWAqR.js} +0 -0
  257. /package/dist/assets/{semver-0cyB3qXO.js → semver-DMpUdXpu.js} +0 -0
  258. /package/dist/assets/{setting-row-BGQgDyhv.js → setting-row-B1EhtSHO.js} +0 -0
  259. /package/dist/assets/{sparkles-Bla177ar.js → sparkles-Bkcjn8HQ.js} +0 -0
  260. /package/dist/assets/{status-badge-pill-j3ke1d9o.js → status-badge-pill-Dezqkwfk.js} +0 -0
  261. /package/dist/assets/{step-indicator-dots-Bc6X141I.js → step-indicator-dots-DlFQI26Q.js} +0 -0
  262. /package/dist/assets/{triangle-alert-C3aHZq1F.js → triangle-alert-BcZY_IvR.js} +0 -0
  263. /package/dist/assets/{typed-storage-DjORmu8t.js → typed-storage-BGMPjrzL.js} +0 -0
  264. /package/dist/assets/{usage-window-B-YOzKJi.js → usage-window-CrO69GPD.js} +0 -0
  265. /package/dist/assets/{use-active-assistant-id-BVzVN4_g.js → use-active-assistant-id-D3XOqMaa.js} +0 -0
  266. /package/dist/assets/{use-is-mobile-jACt_z2d.js → use-is-mobile-Cqknxs2C.js} +0 -0
  267. /package/dist/assets/{user-plus-COoYKnWs.js → user-plus-D30zPuGV.js} +0 -0
  268. /package/dist/assets/{workflow-status-ByHycBJ_.js → workflow-status-DVrSB2xx.js} +0 -0
  269. /package/dist/assets/{x-DxL-bCuT.js → x-B0gfyRAR.js} +0 -0
  270. /package/dist/assets/{xterm-B8LaLTHh.js → xterm-B_47DrXx.js} +0 -0
  271. /package/dist/assets/{xterm-addon-fit--RE59D-m.js → xterm-addon-fit-uIqVCvrf.js} +0 -0
@@ -1 +0,0 @@
1
- import{r as e}from"./chunk-jRWAZmH_.js";import{B as t,F as ee,G as n,H as r,I as i,J as a,K as o,L as s,P as te,R as c,U as l,V as u,W as ne,X as re,Y as ie,q as d,z as f}from"./local-mode-CgrENuVf.js";function p(e){return re(ee,e)}function ae(e){return ie(te,e)}var oe=i([`end_turn`,`max_tokens`,`max_turn_requests`,`refusal`,`cancelled`]),se=l({type:u(`acp_session_completed`),acpSessionId:o(),stopReason:oe}).strict(),ce=l({type:u(`acp_session_error`),acpSessionId:o(),error:o()}).strict(),le=l({type:u(`acp_session_spawned`),acpSessionId:o(),agent:o(),parentConversationId:o(),parentToolUseId:o().optional(),task:o().optional()}).strict(),ue=i([`agent_message_chunk`,`agent_thought_chunk`,`user_message_chunk`,`tool_call`,`tool_call_update`,`plan`]),de=l({type:u(`acp_session_update`),acpSessionId:o(),updateType:ue,content:o().optional(),toolCallId:o().optional(),toolTitle:o().optional(),toolKind:o().optional(),toolStatus:o().optional(),rawInput:a().optional(),rawOutput:a().optional(),locations:c(l({path:o(),line:r().optional()})).optional(),messageId:o().optional(),seq:r().optional()}).strict(),fe=l({type:u(`acp_session_usage`),acpSessionId:o(),usedTokens:r(),contextSize:r(),inputTokens:r().optional(),outputTokens:r().optional(),costAmount:r().optional(),costCurrency:o().optional()}).strict(),pe=i([`idle`,`thinking`,`streaming`,`tool_running`,`awaiting_confirmation`]),me=i([`assistant_turn`,`user_turn`,`global`]),he=i([`message_dequeued`,`thinking_delta`,`first_text_delta`,`tool_use_start`,`preview_start`,`tool_result_received`,`confirmation_requested`,`confirmation_resolved`,`context_compacting`,`message_complete`,`generation_cancelled`,`error_terminal`]),ge=l({type:u(`assistant_activity_state`),conversationId:o(),activityVersion:r(),phase:pe,anchor:me,reason:he,requestId:o().optional(),statusText:o().optional()}),_e=l({type:u(`assistant_text_delta`),text:o(),messageId:o().optional(),conversationId:o().optional()}),ve=l({type:u(`assistant_thinking_delta`),thinking:o(),messageId:o().optional(),conversationId:o().optional(),timestampMs:r().optional()}),ye=l({type:u(`assistant_turn_start`),messageId:o(),conversationId:o().optional()}),m=l({type:u(`avatar_updated`),avatarPath:o()}),h=l({type:u(`background_tool_completed`),id:o(),conversationId:o(),status:i([`completed`,`failed`,`cancelled`]),exitCode:r().nullable().optional(),output:o().optional(),completedAt:r()}),g=l({type:u(`background_tool_started`),id:o(),toolName:o(),conversationId:o(),command:o(),startedAt:r()}),_=l({type:u(`compaction_circuit_closed`),conversationId:o()}),v=l({type:u(`compaction_circuit_open`),conversationId:o(),reason:u(`3_consecutive_failures`),openUntil:r()}),y=l({label:o(),description:o(),pattern:o()}),b=l({label:o(),scope:o()}),x=l({label:o(),scope:o()}),S=l({filePath:o(),oldContent:o(),newContent:o(),isNewFile:f()}),C=i([`allow_once`,`allow_always`,`reject_once`,`reject_always`]),w=l({optionId:o(),name:o(),kind:C}),T=i([`sandbox`,`host`]),E=l({type:u(`confirmation_request`),requestId:o(),toolName:o(),input:n(o(),a()),riskLevel:o(),riskReason:o().optional(),isContainerized:f().optional(),executionTarget:T.optional(),allowlistOptions:c(y),scopeOptions:c(b),directoryScopeOptions:c(x).optional(),diff:S.optional(),conversationId:o().optional(),persistentDecisionsAllowed:f().optional(),toolUseId:o().optional(),acpToolKind:o().optional(),acpOptions:c(w).optional()}),D=l({type:u(`contact_request`),requestId:o(),channel:o().optional(),placeholder:o().optional(),label:o().optional(),description:o().optional(),role:o().optional()}),O=i([`PROVIDER_NETWORK`,`PROVIDER_RATE_LIMIT`,`MANAGED_USAGE_LIMIT`,`PROVIDER_OVERLOADED`,`PROVIDER_API`,`IMAGE_TOO_LARGE`,`PROVIDER_BILLING`,`PROVIDER_ORDERING`,`PROVIDER_WEB_SEARCH`,`PROVIDER_NOT_CONFIGURED`,`PROVIDER_INVALID_KEY`,`MANAGED_KEY_INVALID`,`CONTEXT_TOO_LARGE`,`BUDGET_YIELD_UNRECOVERED`,`MAX_TOKENS_REACHED`,`CONVERSATION_ABORTED`,`CONVERSATION_PROCESSING_FAILED`,`DISK_SPACE_CRITICAL`,`UNKNOWN`]),k=l({type:u(`conversation_error`),conversationId:o(),code:O,userMessage:o(),retryable:f(),debugDetails:o().optional(),errorCategory:o().optional(),connectionName:o().optional(),profileName:o().optional()}),A=i([`created`,`renamed`,`deleted`,`reordered`,`seen_changed`]),j=l({type:u(`conversation_list_invalidated`),reason:A}),M=i([`memory_v3`]),N=l({type:u(`conversation_notice`),conversationId:o(),source:M,code:O,userMessage:o(),errorCategory:o().optional()}),P=l({type:u(`conversation_title_updated`),conversationId:o(),title:o()}),F=i([`disabled`,`ok`,`warning`,`critical`,`unknown`]),I=i([`agent-turns`,`background-work`,`remote-ingress`]),L=l({enabled:f(),state:F,locked:f(),acknowledged:f(),overrideActive:f(),effectivelyLocked:f(),lockId:o().nullable(),usagePercent:r().nullable(),thresholdPercent:r(),path:o().nullable(),lastCheckedAt:o().nullable(),blockedCapabilities:c(I),error:o().nullable()}),R=l({type:u(`disk_pressure_status_changed`),status:L}),be=l({id:o(),surfaceId:o(),author:o(),content:o(),anchorStart:r().optional(),anchorEnd:r().optional(),anchorText:o().optional(),parentCommentId:o().optional(),status:o(),createdAt:r(),updatedAt:r()}),z=l({type:u(`document_comment_created`),conversationId:o(),surfaceId:o(),comment:be}),xe=l({type:u(`document_comment_deleted`),conversationId:o(),surfaceId:o(),commentId:o()}),Se=l({type:u(`document_comment_reopened`),conversationId:o(),surfaceId:o(),commentId:o()}),Ce=l({type:u(`document_comment_resolved`),conversationId:o(),surfaceId:o(),commentId:o(),resolvedBy:o()}),we=l({type:u(`document_editor_update`),conversationId:o(),surfaceId:o(),markdown:o(),mode:o()}),Te=l({type:u(`error`),message:o(),code:o().optional(),category:o().optional(),errorCategory:o().optional(),requestId:o().optional(),conversationId:o().optional()}),Ee=l({type:u(`generation_cancelled`),conversationId:o().optional()}),B=l({id:o().optional(),filename:o(),mimeType:o(),data:o(),sourceType:i([`sandbox_file`,`host_file`,`tool_block`]).optional(),sizeBytes:r().optional(),thumbnailData:o().optional(),fileBacked:f().optional(),filePath:o().optional()}),De=l({type:u(`generation_handoff`),conversationId:o().optional(),requestId:o().optional(),queuedCount:r(),messageId:o().optional(),attachments:c(B).optional(),attachmentWarnings:c(o()).optional()}),Oe=l({type:u(`home_feed_updated`),updatedAt:o(),newItemCount:r()}),ke=l({type:u(`identity_changed`),name:o(),role:o(),personality:o(),emoji:o(),home:o()}),Ae=i([`approved`,`rejected`,`answered`,`cancelled`,`superseded`]),je=l({type:u(`interaction_resolved`),requestId:o(),conversationId:o(),state:Ae,kind:o()}),Me=l({type:u(`message_complete`),messageId:o().optional(),conversationId:o().optional(),source:i([`main`,`aux`]).optional(),attachments:c(B).optional(),attachmentWarnings:c(o()).optional()}),Ne=l({type:u(`message_dequeued`),conversationId:o(),requestId:o()}),Pe=l({type:u(`message_queued`),conversationId:o(),requestId:o(),position:r()}),Fe=l({type:u(`message_queued_deleted`),conversationId:o(),requestId:o()}),Ie=l({type:u(`message_request_complete`),conversationId:o(),requestId:o(),runStillActive:f().optional()}),Le=l({type:u(`navigate_settings`),tab:o()}),Re=l({type:u(`notification_intent`),sourceEventName:o(),title:o(),body:o(),deliveryId:o().optional(),deepLinkMetadata:n(o(),a()).optional(),targetGuardianPrincipalId:o().optional(),silent:f().optional()}),ze=l({type:u(`open_panel`),panelType:o(),data:n(o(),a()).optional(),conversationId:o().optional()}),Be=l({type:u(`open_url`),url:o().min(1),title:o().optional(),conversationId:o().optional()}),V=l({id:o(),label:o(),description:o().optional()}),H=l({id:o(),question:o(),description:o().optional(),options:c(V),freeTextPlaceholder:o().optional()}),Ve=l({type:u(`question_request`),requestId:o(),questions:c(H),question:o(),description:o().optional(),options:c(V),freeTextPlaceholder:o().optional(),conversationId:o().optional(),toolUseId:o().optional()}),He=l({type:u(`relationship_state_updated`),updatedAt:o()}),Ue=l({type:u(`secret_request`),requestId:o(),service:o(),field:o(),label:o(),description:o().optional(),placeholder:o().optional(),conversationId:o().optional(),purpose:o().optional(),allowedTools:c(o()).optional(),allowedDomains:c(o()).optional(),allowOneTimeSend:f().optional()}),We=l({type:o(),content:o().optional(),text:o().optional(),result:o().optional(),input:n(o(),a()).optional(),toolName:o().optional(),isError:f().optional(),toolUseId:o().optional()}).passthrough(),Ge=l({type:u(`subagent_event`),conversationId:o(),subagentId:o(),event:We}).strict(),Ke=l({type:u(`subagent_spawned`),subagentId:o(),parentConversationId:o(),label:o(),objective:o(),isFork:f().optional(),parentToolUseId:o().optional()}).strict(),U=i([`pending`,`running`,`awaiting_input`,`completed`,`failed`,`aborted`,`interrupted`]),W=l({inputTokens:r(),outputTokens:r(),estimatedCost:r()}).strict(),qe=l({type:u(`subagent_status_changed`),subagentId:o(),status:U,error:o().optional(),usage:W.optional()}).strict(),Je=l({type:u(`sync_changed`),tags:c(o().min(1)).min(1),originClientId:o().min(1).optional()}),Ye=i([`tool_start`,`tool_complete`,`status`]),Xe=l({type:u(`tool_output_chunk`),chunk:o(),conversationId:o().optional(),toolUseId:o().optional(),subType:Ye.optional(),subToolName:o().optional(),subToolInput:o().optional(),subToolIsError:f().optional(),subToolId:o().optional(),messageId:o().optional()}),Ze=l({pattern:o(),label:o()}),Qe=i([`anthropic-native`,`brave`,`perplexity`,`tavily`,`firecrawl`]),$e=i([`default`,`firecrawl`]),et=l({rank:r(),title:o(),url:o(),domain:o(),faviconUrl:o().optional(),snippet:o().optional(),age:o().optional(),score:r().optional()}),tt=l({query:o(),provider:Qe,resultCount:r(),durationMs:r(),results:c(et),errorMessage:o().optional()}),nt=l({url:o(),finalUrl:o(),provider:$e.optional(),status:r(),contentType:o().optional(),byteCount:r(),charCount:r(),truncated:f(),title:o().optional(),domain:o(),faviconUrl:o().optional(),redirectCount:r(),durationMs:r(),errorMessage:o().optional(),mayRequireJavaScript:f().optional()}),G=l({webSearch:tt.optional(),webFetch:nt.optional()}),rt=l({type:u(`tool_result`),toolName:o(),result:o(),isError:f().optional(),diff:S.optional(),status:o().optional(),conversationId:o().optional(),imageData:o().optional(),imageDataList:c(o()).optional(),toolUseId:o().optional(),messageId:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),matchedTrustRuleId:o().optional(),isContainerized:f().optional(),riskScopeOptions:c(Ze).optional(),riskAllowlistOptions:c(y).optional(),riskDirectoryScopeOptions:c(x).optional(),approvalMode:o().optional(),approvalReason:o().optional(),riskThreshold:o().optional(),activityMetadata:G.optional(),completedAt:r().optional()}),it=l({type:u(`tool_use_preview_start`),toolUseId:o(),toolName:o(),conversationId:o().optional(),messageId:o().optional(),previewStartedAt:r().optional()}),at=l({type:u(`tool_use_start`),toolName:o(),input:n(o(),a()),toolUseId:o().optional(),messageId:o().optional(),conversationId:o().optional(),startedAt:r().optional(),previewStartedAt:r().optional()}),ot=i([`request_received`,`request_queued`,`request_dequeued`,`llm_call_started`,`llm_call_finished`,`assistant_message`,`tool_started`,`tool_permission_requested`,`tool_permission_decided`,`tool_finished`,`tool_failed`,`generation_handoff`,`message_complete`,`generation_cancelled`,`request_error`,`tool_profiling_summary`]),st=i([`info`,`success`,`warning`,`error`]),ct=l({type:u(`trace_event`),eventId:o(),conversationId:o(),requestId:o().optional(),timestampMs:r(),sequence:r(),kind:ot,status:st.optional(),summary:o(),attributes:n(o(),d([o(),r(),f(),s()])).optional()}),lt=l({type:u(`ui_surface_complete`),conversationId:o(),surfaceId:o(),summary:o(),submittedData:n(o(),a()).optional()}),ut=l({type:u(`ui_surface_dismiss`),conversationId:o(),surfaceId:o()}),dt=l({id:o(),label:o(),style:i([`primary`,`secondary`,`destructive`]).optional(),data:n(o(),a()).optional()}),ft=l({type:u(`ui_surface_show`),conversationId:o(),surfaceId:o(),surfaceType:o(),title:o().optional(),data:n(o(),a()),actions:c(dt).optional(),display:i([`inline`,`panel`]).optional(),messageId:o().optional(),persistent:f().optional(),toolCallId:o().optional()}),pt=l({type:u(`ui_surface_update`),conversationId:o(),surfaceId:o(),data:n(o(),a())}),K=l({type:u(`usage_progress`),conversationId:o(),inputTokens:r(),outputTokens:r(),estimatedCost:r(),model:o()}),mt=l({type:u(`usage_update`),conversationId:o(),inputTokens:r(),outputTokens:r(),cacheCreationInputTokens:r().optional(),cacheReadInputTokens:r().optional(),totalInputTokens:r(),totalOutputTokens:r(),estimatedCost:r(),model:o(),contextWindowTokens:r().optional(),contextWindowMaxTokens:r().optional()}),ht=l({type:u(`user_message_echo`),text:o(),conversationId:o().optional(),messageId:o().optional(),requestId:o().optional(),clientMessageId:o().optional()}).strict(),q=i([`running`,`completed`,`failed`,`aborted`,`cap_exceeded`,`interrupted`]),gt=l({type:u(`workflow_completed`),runId:o(),conversationId:o().optional(),status:q,agentsSpawned:r(),inputTokens:r(),outputTokens:r(),summary:o().optional()}).strict(),_t=l({type:u(`workflow_leaf_finished`),runId:o(),conversationId:o(),seq:r().int(),status:i([`completed`,`failed`]),label:o().optional(),inputTokens:r().optional(),outputTokens:r().optional(),resultSummary:o().optional()}).strict(),vt=l({type:u(`workflow_leaf_started`),runId:o(),conversationId:o(),seq:r().int(),label:o().optional(),phase:o().optional(),promptSummary:o().optional()}).strict(),yt=l({type:u(`workflow_progress`),runId:o(),conversationId:o().optional(),agentsSpawned:r(),phase:o().optional(),label:o().optional(),message:o().optional()}).strict(),bt=l({type:u(`workflow_started`),runId:o(),conversationId:o(),toolUseId:o().optional(),label:o().optional()}).strict(),xt=`syntheticAgentErrorMessage`,St=`compactionAgent`,Ct=3e4,wt=l({cursorInTextField:f().optional().describe(`Whether the cursor is in an editable text field when dictation started`)}).passthrough().describe(`Dictation context (app name, window title, bundle ID, cursor state, selected text)`),Tt=l({transcription:o().describe(`Raw speech transcription`),context:wt,profileId:o().describe(`Optional dictation profile ID`).optional()}),J=l({id:o(),filename:o(),mimeType:o(),sizeBytes:r(),kind:o(),data:o().optional(),thumbnailData:o().optional(),fileBacked:f().optional()}),Et=l({pattern:o(),label:o()}),Dt=l({label:o(),description:o(),pattern:o()}),Ot=l({scope:o(),label:o()}),kt=l({requestId:o(),title:o().optional(),description:o().optional(),toolName:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),input:n(o(),a()).optional(),allowlistOptions:c(y).optional(),scopeOptions:c(b).optional(),directoryScopeOptions:c(x).optional(),persistentDecisionsAllowed:f().optional()}),At=l({requestId:o(),entries:c(H)}),jt=i([`approved`,`denied`,`timed_out`]),Y=l({id:o().optional(),name:o(),input:n(o(),a()),result:o().optional(),isError:f().optional(),imageData:o().optional(),imageDataList:c(o()).optional(),startedAt:r().optional(),previewStartedAt:r().optional(),completedAt:r().optional(),confirmationDecision:jt.optional(),confirmationLabel:o().optional(),riskLevel:o().optional(),riskReason:o().optional(),matchedTrustRuleId:o().optional(),autoApproved:f().optional(),approvalMode:o().optional(),approvalReason:o().optional(),riskThreshold:o().optional(),riskScopeOptions:c(Et).optional(),riskAllowlistOptions:c(Dt).optional(),riskDirectoryScopeOptions:c(Ot).optional(),activityMetadata:G.optional(),scopeOptions:c(b).optional(),pendingConfirmation:kt.optional(),pendingQuestion:At.optional()}),Mt=l({id:o(),label:o(),style:o().optional(),data:n(o(),a()).optional()}),X=l({surfaceId:o(),surfaceType:o(),title:o().optional(),data:n(o(),a()),actions:c(Mt).optional(),display:o().optional(),persistent:f().optional(),completed:f().optional(),completionSummary:o().optional(),toolCallId:o().optional()}),Nt=l({subagentId:o(),label:o(),status:o(),error:o().optional(),conversationId:o().optional(),objective:o().optional()}),Pt=l({acpSessionId:o(),agent:o().optional()}),Ft=l({id:o(),toolName:o(),conversationId:o(),command:o(),startedAt:r(),status:i([`completed`,`failed`,`cancelled`]),exitCode:r().nullable(),output:o(),completedAt:r()}),It=l({appUrl:o().optional(),webUrl:o().optional()}),Lt=l({emoji:o(),op:i([`added`,`removed`]),actorDisplayName:o().optional(),targetChannelTs:o()}),Rt=l({channelId:o(),channelName:o().optional(),channelTs:o(),threadTs:o().optional(),sender:l({displayName:o().optional(),externalUserId:o().optional()}).optional(),messageLink:It.optional(),threadLink:It.optional(),eventKind:i([`message`,`reaction`]).optional(),reaction:Lt.optional()}),zt=l({type:u(`text`),text:o()}),Bt=l({type:u(`thinking`),thinking:o(),startedAt:r().optional(),completedAt:r().optional()}),Vt=l({type:u(`tool_use`),toolCall:Y}),Ht=l({type:u(`surface`),surface:X}),Ut=l({type:u(`attachment`),attachment:J}),Wt=t(`type`,[zt,Bt,Vt,Ht,Ut]),Gt=l({id:o(),mergedMessageIds:c(o()).optional(),clientMessageId:o().optional(),role:i([`user`,`assistant`]),content:o().meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Flat plain-text body (joined text segments).`}).optional(),timestamp:o(),attachments:c(J),toolCalls:c(Y).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the tool_use variant). Flat list of tool calls.`}).optional(),surfaces:c(X).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks (the surface variant). Flat list of surfaces.`}).optional(),textSegments:c(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Text segments split by tool-call boundaries.`}).optional(),thinkingSegments:c(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Reasoning text extracted from thinking blocks.`}).optional(),contentOrder:c(o()).meta({deprecated:!0,description:`Deprecated: superseded by contentBlocks. Positional "<type>:<index>" content ordering (e.g. "text:0", "thinking:1").`}).optional(),contentBlocks:c(Wt).optional(),subagentNotification:Nt.optional(),acpNotification:Pt.optional(),backgroundEventNotification:f().optional(),backgroundToolCompletion:Ft.optional(),slackMessage:Rt.optional(),queueStatus:i([`queued`,`processing`]).optional(),queuePosition:r().optional()}),Kt=l({status:L}),qt=u(`notification`),Jt=i([`new`,`seen`,`acted_on`,`dismissed`]),Yt=i([`low`,`medium`,`high`,`critical`]),Xt=i([`security`,`scheduling`,`background`,`email`,`system`]),Zt=i([`heartbeat`,`memory_consolidation`,`schedule`,`auto_analysis`,`user`,`other`]),Qt=l({id:o(),label:o(),prompt:o()}),$t=i([`emailDraft`,`documentPreview`,`permissionChat`,`paymentAuth`,`toolPermission`,`updatesList`]),en=l({kind:$t}),tn=l({id:o(),type:qt,priority:r().int().min(0).max(100),title:o().optional(),summary:o(),timestamp:o(),status:Jt.default(`new`),expiresAt:o().optional(),actions:c(Qt).optional(),urgency:Yt.optional(),conversationId:o().optional(),detailPanel:en.optional(),category:Xt.optional(),noteworthy:f().optional(),fromAssistant:f().optional(),metadata:n(o(),a()).optional(),sourceType:Zt.optional(),sourceKey:o().optional(),sourceLabel:o().optional(),createdAt:o()}),nn=i([`deterministic`,`assistant`]),rn=l({id:o(),label:o(),icon:o().optional(),prompt:o(),source:nn}),an=l({greeting:o(),timeAwayLabel:o(),newCount:r().int().min(0)}),on=l({items:c(tn),updatedAt:o(),contextBanner:an,suggestedPrompts:c(rn)}),sn=l({id:o(),category:i([`voice`,`world`,`priorities`]),text:o(),confidence:i([`strong`,`uncertain`]),source:i([`onboarding`,`inferred`])}),cn=l({id:o(),name:o(),description:o(),tier:i([`unlocked`,`next-up`,`earned`]),gate:o(),unlockHint:o().optional(),ctaLabel:o().optional()}),ln=l({version:u(1),assistantId:o(),tier:d([u(1),u(2),u(3),u(4)]),progressPercent:r(),facts:c(sn),capabilities:c(cn),conversationCount:r(),hatchedDate:o(),assistantName:o(),userName:o().optional(),updatedAt:o()}),un=l({key:o(),label:o(),ms:r()}),dn=l({phases:c(un),ttftMs:r().nullish(),totalToFirstTokenMs:r().nullish(),providerDurationMs:r().nullish(),firstTokenKind:i([`thinking`,`text`]).nullish()}),fn=l({provider:o().nullish(),model:o().nullish(),status:o().nullish(),inputTokens:r().nullish(),outputTokens:r().nullish(),cacheCreationInputTokens:r().nullish(),cacheReadInputTokens:r().nullish(),stopReason:o().nullish(),requestMessageCount:r().nullish(),requestToolCount:r().nullish(),responseMessageCount:r().nullish(),responseToolCallCount:r().nullish(),responsePreview:o().nullish(),toolCallNames:c(o()).nullish(),estimatedCostUsd:r().nullish(),durationMs:r().nullish()}),Z=l({kind:o(),label:o().nullish(),role:o().nullish(),text:o().nullish(),toolName:o().nullish(),data:a().optional(),language:o().nullish()}),pn=l({name:o().nullish(),message:o().nullish(),code:o().nullish(),provider:o().nullish(),statusCode:r().nullish(),retryAfterMs:r().nullish(),apiErrorCode:o().nullish(),apiErrorType:o().nullish(),apiErrorParam:o().nullish(),requestId:o().nullish()}),mn=l({id:o(),createdAt:r(),requestPayload:s(),responsePayload:s(),provider:o().nullish(),summary:fn.nullish(),requestSections:c(Z).nullish(),responseSections:c(Z).nullish(),agentLoopExitReason:o().nullish(),callSite:o().nullish(),error:pn.nullish(),latency:dn.nullish()}),hn=l({nodeId:o(),score:r(),semanticSimilarity:r(),recencyBoost:r(),type:o().optional()}),gn=l({reason:o(),semanticUnavailable:f(),fallbackSources:c(o())}),_n=l({enabled:f(),degraded:f(),provider:o().nullable(),model:o().nullable(),degradation:gn.nullable(),semanticHits:r().nullish(),mergedCount:r().nullish(),selectedCount:r().nullish(),tier1Count:r().nullish(),tier2Count:r().nullish(),hybridSearchLatencyMs:r().nullish(),sparseVectorUsed:f().nullish(),injectedTokens:r().nullish(),latencyMs:r().nullish(),topCandidates:c(hn),injectedText:o().nullable(),reason:o().nullable(),queryContext:o().nullable()}),vn=l({slug:o(),finalActivation:r(),ownActivation:r(),priorActivation:r(),simUser:r(),simAssistant:r(),simNow:r(),simUserRerankBoost:r().optional(),simAssistantRerankBoost:r().optional(),inRerankPool:f().optional(),spreadContribution:r(),source:o(),status:o()}),yn=l({d:r(),c_user:r(),c_assistant:r(),c_now:r(),k:r(),hops:r(),top_k:r(),epsilon:r()}),bn=l({turn:r(),mode:o(),concepts:c(vn),config:yn}),Q=l({slug:o(),source:o(),pinned:f(),sectionOrdinal:r().nullable().optional(),sectionHeading:o().nullable().optional()}),xn=l({turn:r(),live:f(),selections:c(Q),injectedText:o()}),Sn=l({messageId:o().nullish(),conversationKey:o().nullish(),conversationId:o().nullish(),conversationKind:o(),conversationTotalEstimatedCostUsd:r().nullish(),logs:c(mn),memoryRecall:_n.nullable(),memoryV2Activation:bn.nullable(),memoryV3Selection:xn.nullish()}),Cn=l({type:o(),content:o(),toolName:o().optional(),isError:f().optional(),messageId:o().optional(),toolUseId:o().optional(),input:n(o(),a()).optional()}),wn=l({subagentId:o(),objective:o().optional(),status:U.optional(),usage:W.optional(),events:c(Cn)}),Tn=l({seq:r().int(),kind:i([`agent`,`workflow`]),label:o().optional(),phase:o().optional(),promptSummary:o().optional(),status:o(),resultSummary:o().optional(),inputTokens:r().optional(),outputTokens:r().optional(),createdAt:r().nullable()}),En=l({runId:o(),status:q.optional(),agentsSpawned:r().optional(),inputTokens:r().optional(),outputTokens:r().optional(),phase:o().optional(),leaves:c(Tn)}),Dn=l({title:o().optional(),subtitle:o().optional(),body:o().optional(),metadata:c(l({label:p(),value:p()})).optional(),template:o().optional(),templateData:n(o(),a()).optional()}),On=ne(e=>{let t=(typeof e==`string`?e.split(`,`):Array.isArray(e)?e:[]).map(e=>typeof e==`string`||typeof e==`number`?String(e).trim():``).filter(e=>e.length>0);return t.length>0?t:void 0},c(o()).optional()),kn=l({prompt:p().optional(),acceptedTypes:On,maxFiles:ae().int().positive().optional().catch(void 0),maxSizeBytes:ae().positive().optional().catch(void 0)}),An=e({ACPOptionKindSchema:()=>C,ACPOptionSchema:()=>w,AcpSessionCompletedEventSchema:()=>se,AcpSessionErrorEventSchema:()=>ce,AcpSessionSpawnedEventSchema:()=>le,AcpSessionUpdateEventSchema:()=>de,AcpSessionUpdateTypeSchema:()=>ue,AcpSessionUsageEventSchema:()=>fe,AcpStopReasonSchema:()=>oe,AllowlistOptionSchema:()=>y,AssistantActivityAnchorSchema:()=>me,AssistantActivityPhaseSchema:()=>pe,AssistantActivityReasonSchema:()=>he,AssistantActivityStateEventSchema:()=>ge,AssistantEventEnvelopeSchema:()=>jn,AssistantEventSchema:()=>$,AssistantOutboundAttachmentSchema:()=>B,AssistantTextDeltaEventSchema:()=>_e,AssistantThinkingDeltaEventSchema:()=>ve,AssistantTurnStartEventSchema:()=>ye,AvatarUpdatedEventSchema:()=>m,BackgroundToolCompletedEventSchema:()=>h,BackgroundToolStartedEventSchema:()=>g,CALL_SITE_COMPACTION_AGENT:()=>St,CALL_SITE_SYNTHETIC_AGENT_ERROR_MESSAGE:()=>xt,CapabilitySchema:()=>cn,CardSurfaceDataSchema:()=>Dn,CompactionCircuitClosedEventSchema:()=>_,CompactionCircuitOpenEventSchema:()=>v,ConfirmationDiffSchema:()=>S,ConfirmationExecutionTargetSchema:()=>T,ConfirmationRequestEventSchema:()=>E,ContactRequestEventSchema:()=>D,ContextBannerSchema:()=>an,ConversationAttachmentBlockSchema:()=>Ut,ConversationContentBlockSchema:()=>Wt,ConversationErrorCodeSchema:()=>O,ConversationErrorEventSchema:()=>k,ConversationListInvalidatedEventSchema:()=>j,ConversationListInvalidatedReasonSchema:()=>A,ConversationMessageAttachmentSchema:()=>J,ConversationMessageSchema:()=>Gt,ConversationMessageSurfaceSchema:()=>X,ConversationMessageToolCallSchema:()=>Y,ConversationNoticeEventSchema:()=>N,ConversationNoticeSourceSchema:()=>M,ConversationSlackMessageSchema:()=>Rt,ConversationSubagentNotificationSchema:()=>Nt,ConversationSurfaceBlockSchema:()=>Ht,ConversationTextBlockSchema:()=>zt,ConversationThinkingBlockSchema:()=>Bt,ConversationTitleUpdatedEventSchema:()=>P,ConversationToolUseBlockSchema:()=>Vt,DEFAULT_TOOL_EXECUTION_TIMEOUT_SEC:()=>120,DictationContextSchema:()=>wt,DictationRequestSchema:()=>Tt,DirectoryScopeOptionSchema:()=>x,DiskPressureBlockedCapabilitySchema:()=>I,DiskPressureStateSchema:()=>F,DiskPressureStatusChangedEventSchema:()=>R,DiskPressureStatusResponseSchema:()=>Kt,DiskPressureStatusSchema:()=>L,DocumentCommentCreatedEventSchema:()=>z,DocumentCommentDeletedEventSchema:()=>xe,DocumentCommentReopenedEventSchema:()=>Se,DocumentCommentResolvedEventSchema:()=>Ce,DocumentEditorUpdateEventSchema:()=>we,ErrorEventSchema:()=>Te,FactSchema:()=>sn,FeedActionSchema:()=>Qt,FeedItemCategorySchema:()=>Xt,FeedItemDetailPanelKindSchema:()=>$t,FeedItemDetailPanelSchema:()=>en,FeedItemSchema:()=>tn,FeedItemSourceTypeSchema:()=>Zt,FeedItemStatusSchema:()=>Jt,FeedItemTypeSchema:()=>qt,FeedItemUrgencySchema:()=>Yt,FileUploadSurfaceDataSchema:()=>kn,GenerationCancelledEventSchema:()=>Ee,GenerationHandoffEventSchema:()=>De,HomeFeedResponseSchema:()=>on,HomeFeedUpdatedEventSchema:()=>Oe,IdentityChangedEventSchema:()=>ke,InteractionResolutionStateSchema:()=>Ae,InteractionResolvedEventSchema:()=>je,LLMCallErrorSchema:()=>pn,LLMCallSummarySchema:()=>fn,LLMContextSectionSchema:()=>Z,LLMRequestLogEntrySchema:()=>mn,LatencyBreakdownSchema:()=>dn,LatencyPhaseSchema:()=>un,LlmContextResponseSchema:()=>Sn,MemoryCandidateSchema:()=>hn,MemoryDegradationSchema:()=>gn,MemoryRecallLogSchema:()=>_n,MemoryV2ActivationLogSchema:()=>bn,MemoryV2ConceptRowSchema:()=>vn,MemoryV2ConfigSnapshotSchema:()=>yn,MemoryV3SelectionLogSchema:()=>xn,MemoryV3SelectionRowSchema:()=>Q,MessageCompleteEventSchema:()=>Me,MessageDequeuedEventSchema:()=>Ne,MessageQueuedDeletedEventSchema:()=>Fe,MessageQueuedEventSchema:()=>Pe,MessageRequestCompleteEventSchema:()=>Ie,NavigateSettingsEventSchema:()=>Le,NotificationIntentEventSchema:()=>Re,OpenPanelEventSchema:()=>ze,OpenUrlEventSchema:()=>Be,PendingToolConfirmationSchema:()=>kt,QuestionEntrySchema:()=>H,QuestionOptionSchema:()=>V,QuestionRequestEventSchema:()=>Ve,RelationshipStateSchema:()=>ln,RelationshipStateUpdatedEventSchema:()=>He,RiskScopeOptionSchema:()=>Ze,SSE_REPLAY_RING_AGE_LIMIT_MS:()=>Ct,SSE_REPLAY_RING_COUNT_LIMIT:()=>200,ScopeOptionSchema:()=>b,SecretRequestEventSchema:()=>Ue,SubagentDetailEventSchema:()=>Cn,SubagentDetailResponseSchema:()=>wn,SubagentEventEventSchema:()=>Ge,SubagentInnerEventSchema:()=>We,SubagentSpawnedEventSchema:()=>Ke,SubagentStatusChangedEventSchema:()=>qe,SubagentStatusSchema:()=>U,SubagentUsageStatsSchema:()=>W,SuggestedPromptSchema:()=>rn,SuggestedPromptSourceSchema:()=>nn,SurfaceActionSchema:()=>dt,SyncChangedEventSchema:()=>Je,ToolActivityMetadataSchema:()=>G,ToolOutputChunkEventSchema:()=>Xe,ToolOutputChunkSubTypeSchema:()=>Ye,ToolResultEventSchema:()=>rt,ToolUsePreviewStartEventSchema:()=>it,ToolUseStartEventSchema:()=>at,TraceEventKindSchema:()=>ot,TraceEventSchema:()=>ct,TraceEventStatusSchema:()=>st,UISurfaceCompleteEventSchema:()=>lt,UISurfaceDismissEventSchema:()=>ut,UISurfaceShowEventSchema:()=>ft,UISurfaceUpdateEventSchema:()=>pt,UsageProgressEventSchema:()=>K,UsageUpdateEventSchema:()=>mt,UserMessageEchoEventSchema:()=>ht,WebFetchMetadataSchema:()=>nt,WebSearchMetadataSchema:()=>tt,WebSearchProviderIdSchema:()=>Qe,WebSearchResultItemSchema:()=>et,WorkflowCompletedEventSchema:()=>gt,WorkflowJournalResponseSchema:()=>En,WorkflowLeafFinishedEventSchema:()=>_t,WorkflowLeafSchema:()=>Tn,WorkflowLeafStartedEventSchema:()=>vt,WorkflowProgressEventSchema:()=>yt,WorkflowRunStatusSchema:()=>q,WorkflowStartedEventSchema:()=>bt}),$=t(`type`,[se,ce,le,de,fe,ge,_e,ve,ye,m,h,g,_,v,E,D,k,j,N,P,R,z,xe,Se,Ce,we,Te,Ee,De,Oe,ke,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,Ge,Ke,qe,Je,Xe,rt,it,at,ct,lt,ut,ft,pt,K,mt,ht,gt,_t,vt,yt,bt]),jn=l({id:o(),conversationId:o().optional(),seq:r().int().optional(),emittedAt:o(),message:$});export{kn as a,Kt as c,xt as d,K as f,Dn as i,Ct as l,$ as n,En as o,An as r,wn as s,jn as t,St as u};
@@ -1,6 +0,0 @@
1
- import{n as e}from"./toast-sdJJ6aTV.js";import{n as t,t as n}from"./create-selectors-BE0_e_Ed.js";import{c as r,n as i,s as a,t as o,u as s}from"./feature-flag-catalog-qaNLg85h.js";var c={bodySerializer:e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString():t)};Object.entries({$body_:`body`,$headers_:`headers`,$path_:`path`,$query_:`query`});function l({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:r,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:o,sseMaxRetryDelay:s,sseSleepFn:c,url:l,...u}){let d,f=c??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let c=a??3e3,p=0,m=u.signal??new AbortController().signal;for(;!m.aborted;){p++;let a=u.headers instanceof Headers?u.headers:new Headers(u.headers);d!==void 0&&a.set(`Last-Event-ID`,d);try{let t={redirect:`follow`,...u,body:u.serializedBody,headers:a,signal:m},o=new Request(l,t);e&&(o=await e(l,t));let s=await(u.fetch??globalThis.fetch)(o);if(!s.ok)throw Error(`SSE failed: ${s.status} ${s.statusText}`);if(!s.body)throw Error(`No body in SSE response`);let f=s.body.pipeThrough(new TextDecoderStream).getReader(),p=``,h=()=>{try{f.cancel()}catch{}};m.addEventListener(`abort`,h);try{for(;;){let{done:e,value:t}=await f.read();if(e)break;p+=t,p=p.replace(/\r\n?/g,`
2
- `);let a=p.split(`
3
-
4
- `);p=a.pop()??``;for(let e of a){let t=e.split(`
5
- `),a=[],o;for(let e of t)if(e.startsWith(`data:`))a.push(e.replace(/^data:\s*/,``));else if(e.startsWith(`event:`))o=e.replace(/^event:\s*/,``);else if(e.startsWith(`id:`))d=e.replace(/^id:\s*/,``);else if(e.startsWith(`retry:`)){let t=Number.parseInt(e.replace(/^retry:\s*/,``),10);Number.isNaN(t)||(c=t)}let s,l=!1;if(a.length){let e=a.join(`
6
- `);try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:o,id:d,retry:c}),a.length&&(yield s)}}}finally{m.removeEventListener(`abort`,h),f.releaseLock()}break}catch(e){if(t?.(e),o!==void 0&&p>=o)break;await f(Math.min(c*2**(p-1),s??3e4))}}}()}}var u=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},d=e=>{switch(e){case`form`:return`,`;case`pipeDelimited`:return`|`;case`spaceDelimited`:return`%20`;default:return`,`}},f=e=>{switch(e){case`label`:return`.`;case`matrix`:return`;`;case`simple`:return`,`;default:return`&`}},p=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){let t=(e?i:i.map(e=>encodeURIComponent(e))).join(d(r));switch(r){case`label`:return`.${t}`;case`matrix`:return`;${n}=${t}`;case`simple`:return t;default:return`${n}=${t}`}}let a=u(r),o=i.map(t=>r===`label`||r===`simple`?e?t:encodeURIComponent(t):m({allowReserved:e,name:n,value:t})).join(a);return r===`label`||r===`matrix`?a+o:o},m=({allowReserved:e,name:t,value:n})=>{if(n==null)return``;if(typeof n==`object`)throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},h=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if(r!==`deepObject`&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});let a=t.join(`,`);switch(r){case`form`:return`${n}=${a}`;case`label`:return`.${a}`;case`matrix`:return`;${n}=${a}`;default:return a}}let o=f(r),s=Object.entries(i).map(([t,i])=>m({allowReserved:e,name:r===`deepObject`?`${n}[${t}]`:t,value:i})).join(o);return r===`label`||r===`matrix`?o+s:s},g=/\{[^{}]+\}/g,_=({path:e,url:t})=>{let n=t,r=t.match(g);if(r)for(let t of r){let r=!1,i=t.substring(1,t.length-1),a=`simple`;i.endsWith(`*`)&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(`.`)?(i=i.substring(1),a=`label`):i.startsWith(`;`)&&(i=i.substring(1),a=`matrix`);let o=e[i];if(o==null)continue;if(Array.isArray(o)){n=n.replace(t,p({explode:r,name:i,style:a,value:o}));continue}if(typeof o==`object`){n=n.replace(t,h({explode:r,name:i,style:a,value:o,valueOnly:!0}));continue}if(a===`matrix`){n=n.replace(t,`;${m({name:i,value:o})}`);continue}let s=encodeURIComponent(a===`label`?`.${o}`:o);n=n.replace(t,s)}return n},v=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=i.startsWith(`/`)?i:`/${i}`,o=(e??``)+a;t&&(o=_({path:t,url:o}));let s=n?r(n):``;return s.startsWith(`?`)&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function y(e){let t=e.body!==void 0;if(t&&e.bodySerializer)return`serializedBody`in e?e.serializedBody!==void 0&&e.serializedBody!==``?e.serializedBody:null:e.body===``?null:e.body;if(t)return e.body}var b=async(e,t)=>{let n=typeof t==`function`?await t(e):t;if(n)return e.scheme===`bearer`?`Bearer ${n}`:e.scheme===`basic`?`Basic ${btoa(n)}`:n},x=({parameters:e={},...t}={})=>n=>{let r=[];if(n&&typeof n==`object`)for(let i in n){let a=n[i];if(a==null)continue;let o=e[i]||t;if(Array.isArray(a)){let e=p({allowReserved:o.allowReserved,explode:!0,name:i,style:`form`,value:a,...o.array});e&&r.push(e)}else if(typeof a==`object`){let e=h({allowReserved:o.allowReserved,explode:!0,name:i,style:`deepObject`,value:a,...o.object});e&&r.push(e)}else{let e=m({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join(`&`)},S=e=>{if(!e)return`stream`;let t=e.split(`;`)[0]?.trim();if(t){if(t.startsWith(`application/json`)||t.endsWith(`+json`))return`json`;if(t===`multipart/form-data`)return`formData`;if([`application/`,`audio/`,`image/`,`video/`].some(e=>t.startsWith(e)))return`blob`;if(t.startsWith(`text/`))return`text`}},C=(e,t)=>t?!!(e.headers.has(t)||e.query?.[t]||e.headers.get(`Cookie`)?.includes(`${t}=`)):!1,w=async({security:e,...t})=>{for(let n of e){if(C(t,n.name))continue;let e=await b(n,t.auth);if(!e)continue;let r=n.name??`Authorization`;switch(n.in){case`query`:t.query||={},t.query[r]=e;break;case`cookie`:t.headers.append(`Cookie`,`${r}=${e}`);break;default:t.headers.set(r,e);break}}},T=e=>v({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer==`function`?e.querySerializer:x(e.querySerializer),url:e.url}),E=(e,t)=>{let n={...e,...t};return n.baseUrl?.endsWith(`/`)&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=O(e.headers,t.headers),n},D=e=>{let t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},O=(...e)=>{let t=new Headers;for(let n of e){if(!n)continue;let e=n instanceof Headers?D(n):Object.entries(n);for(let[n,r]of e)if(r===null)t.delete(n);else if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.set(n,typeof r==`object`?JSON.stringify(r):r)}return t},k=class{fns=[];clear(){this.fns=[]}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){let t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e==`number`?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}},A=()=>({error:new k,request:new k,response:new k}),j=x({allowReserved:!1,array:{explode:!0,style:`form`},object:{explode:!0,style:`deepObject`}}),M={"Content-Type":`application/json`},N=(e={})=>({...c,headers:M,parseAs:`auto`,querySerializer:j,...e}),P=((e={})=>{let t=E(N(),e),n=()=>({...t}),r=e=>(t=E(t,e),n()),i=A(),a=async e=>{let n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:O(t.headers,e.headers),serializedBody:void 0};n.security&&await w({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body!==void 0&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),(n.body===void 0||n.serializedBody===``)&&n.headers.delete(`Content-Type`);let r=n;return{opts:r,url:T(r)}},o=async e=>{let n=e.throwOnError??t.throwOnError,r=e.responseStyle??t.responseStyle,o,s;try{let{opts:t,url:n}=await a(e),r={redirect:`follow`,...t,body:y(t)};o=new Request(n,r);for(let e of i.request.fns)e&&(o=await e(o,t));let c=t.fetch;s=await c(o);for(let e of i.response.fns)e&&(s=await e(s,o,t));let l={request:o,response:s};if(s.ok){let e=(t.parseAs===`auto`?S(s.headers.get(`Content-Type`)):t.parseAs)??`json`;if(s.status===204||s.headers.get(`Content-Length`)===`0`){let n;switch(e){case`arrayBuffer`:case`blob`:case`text`:n=await s[e]();break;case`formData`:n=new FormData;break;case`stream`:n=s.body;break;default:n={};break}return t.responseStyle===`data`?n:{data:n,...l}}let n;switch(e){case`arrayBuffer`:case`blob`:case`formData`:case`text`:n=await s[e]();break;case`json`:{let e=await s.text();n=e?JSON.parse(e):{};break}case`stream`:return t.responseStyle===`data`?s.body:{data:s.body,...l}}return e===`json`&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),t.responseStyle===`data`?n:{data:n,...l}}let u=await s.text(),d;try{d=JSON.parse(u)}catch{}throw d??u}catch(t){let a=t;for(let t of i.error.fns)t&&(a=await t(a,s,o,e));if(a||={},n)throw a;return r===`data`?void 0:{error:a,request:o,response:s}}},s=e=>t=>o({...t,method:e}),c=e=>async t=>{let{opts:n,url:r}=await a(t);return l({...n,body:n.body,method:e,onRequest:async(e,t)=>{let r=new Request(e,t);for(let e of i.request.fns)e&&(r=await e(r,n));return r},serializedBody:y(n),url:r})};return{buildUrl:e=>T({...t,...e}),connect:s(`CONNECT`),delete:s(`DELETE`),get:s(`GET`),getConfig:n,head:s(`HEAD`),interceptors:i,options:s(`OPTIONS`),patch:s(`PATCH`),post:s(`POST`),put:s(`PUT`),request:o,setConfig:r,sse:{connect:c(`CONNECT`),delete:c(`DELETE`),get:c(`GET`),head:c(`HEAD`),options:c(`OPTIONS`),patch:c(`PATCH`),post:c(`POST`),put:c(`PUT`),trace:c(`TRACE`)},trace:s(`TRACE`)}})(N()),F=e=>(e.client??P).get({url:`/v1/assistants/{assistant_id}/feature-flags`,...e}),I=e=>(e.client??P).patch({url:`/v1/assistants/{assistant_id}/feature-flags/{flag_key}`,...e,headers:{"Content-Type":`application/json`,...e.headers}}),L={...o},R={...i},z=0,B={};function V(e={}){L={...o,...e};for(let e of Object.keys(B))delete B[e]}function H(e={}){R={...i,...e}}function U(){V(),H()}var W=a(`assistant`);function G(e){return L[e]??o[e]??!1}function K(e){return R[e]??i[e]??``}var q=n(t()(t=>{let n=t;return{...o,...W.bool,hasHydrated:!1,stringFlags:{...i,...W.str},setFlags:e=>t(t=>{V(e);let n={...e,...W.bool};return Object.keys(n).some(e=>n[e]!==t[e])?n:t}),setFlag:(n,i,a)=>{let o=++z,c=()=>{if(B[n]!==o)return;delete B[n];let a=G(n);t(e=>e[n]===i?{[n]:a}:e),e.error(`Couldn't update "${r(n)?.label??n}" — change reverted.`)},l=s(n);!a||!l||(B[n]=o,I({path:{assistant_id:a,flag_key:l},body:{enabled:i},throwOnError:!1}).then(e=>{e.response?.ok?(L[n]=i,B[n]===o&&delete B[n]):c()}).catch(c),t({[n]:W.bool[n]??i}))},markHydrated:()=>t({hasHydrated:!0}),resetForAssistantSwitch:()=>{U(),t({...o,...W.bool,hasHydrated:!1}),n({stringFlags:{...i,...W.str}})},setStringFlags:e=>n(t=>{H(e);let n={...e,...W.str},r=t.stringFlags;return Object.keys(n).some(e=>n[e]!==r[e])?{stringFlags:n}:t}),setStringFlag:(t,i,a)=>{let o=++z,c=()=>{if(B[t]!==o)return;delete B[t];let a=K(t);n(e=>e.stringFlags[t]===i?{stringFlags:{...e.stringFlags,[t]:a}}:e),e.error(`Couldn't update "${r(t)?.label??t}" — change reverted.`)},l=s(t);!a||!l||(B[t]=o,I({path:{assistant_id:a,flag_key:l},body:{enabled:i},throwOnError:!1}).then(e=>{e.response?.ok?(R[t]=i,B[t]===o&&delete B[t]):c()}).catch(c),n(e=>({stringFlags:{...e.stringFlags,[t]:W.str[t]??i}})))}}}));export{F as n,P as r,q as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-BG-GkiMq.js";import{t as n}from"./react-DJZBPgpf.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-BscuIPxA.js";import"./src-SCpl1O1B.js";import{t as a}from"./detail-shell-CPp3KhI8.js";import{Bt as o,Lt as s,Rt as c,ot as l,st as u,zt as d}from"./index-B-S-gNKm.js";import{t as f}from"./status-badge-pill-j3ke1d9o.js";import{t as p}from"./detail-panel-stop-button-BHEQd627.js";import{CodeBlock as m,SectionLabel as h}from"./tool-detail-panel-CG9Wp2NK.js";var g=e(n(),1),_=r();function v({status:e}){return(0,_.jsx)(f,{color:s(e),label:c(e)})}function y({entry:e,onClose:n}){let r=o(e.status),s=!r,c=s&&e.output!==void 0&&e.output!==``,f=s&&e.exitCode!=null,[y,b]=(0,g.useState)(!1),x=(0,g.useCallback)(()=>{b(!0),l(e.id).catch(e=>{b(!1),t(e,{context:`BackgroundTaskDetailPanel.stop`})})},[e.id]);return(0,_.jsxs)(a,{Glyph:u(e.toolName),title:d(e.status),headerTrailing:(0,_.jsx)(v,{status:e.status}),headerActions:r?(0,_.jsx)(p,{onStop:x,ariaLabel:`Stop command`,disabled:y}):void 0,closeVariant:`outlined`,closeLabel:`Close task detail`,onClose:n,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(h,{children:`Command`}),(0,_.jsx)(m,{text:e.command})]}),c&&(0,_.jsxs)(`div`,{className:`mt-5`,children:[(0,_.jsx)(h,{children:`Output`}),(0,_.jsx)(m,{text:e.output})]}),f&&(0,_.jsxs)(i,{variant:`body-small-default`,as:`p`,className:`mt-2 text-[var(--content-tertiary)]`,children:[`Exit code: `,e.exitCode]})]})}export{y as BackgroundTaskDetailPanel};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-file-DIJL6af-.js","assets/chunk-jRWAZmH_.js","assets/preload-helper-BewR0kVT.js","assets/dist-Ztj3rqLK.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-jRWAZmH_.js";import{t as n}from"./capture-error-BG-GkiMq.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./button-D-AX8Voo.js";import{t as a}from"./preload-helper-BewR0kVT.js";import{d as o,h as s,r 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"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./typography-BscuIPxA.js";import{t as m}from"./card-BibIM9x3.js";import{t as h}from"./dropdown-ChWAdhLG.js";import{t as g}from"./confirm-dialog-bfBx6UYv.js";import{t as _}from"./notice-CqRgVmeL.js";import{t as v}from"./tag-CW6WC4fE.js";import{t as y}from"./input-D4W4p0pZ.js";import{t as b}from"./toggle-X_kQW5my.js";import{n as x,t as S}from"./stat-square-8mff1dLC.js";import{t as C}from"./modal-BNAVT2FK.js";import{n as w}from"./toast-sdJJ6aTV.js";import{t as T}from"./createLucideIcon-BlMXrA59.js";import{t as E}from"./arrow-left-CP-EhDNF.js";import{t as D}from"./check-D6WkI0gF.js";import{t as O}from"./circle-alert-DvNg50UK.js";import{t as k}from"./circle-check-DzlJxj_M.js";import{t as A}from"./cpu-CiHv3fhs.js";import{t as j}from"./credit-card-BKRB1ZIi.js";import{n as M,t as N}from"./domain-field-DYwuCpup.js";import{t as P}from"./external-link-RJkZLlff.js";import{t as F}from"./file-text-ClqzuFsu.js";import{t as I}from"./hard-drive-CZEg1Cqc.js";import{t as L}from"./info-ciQS_i3y.js";import{t as R}from"./loader-circle-BFRVtR3K.js";import{a as ee,c as te,i as ne,n as z,r as B,t as V}from"./resize-errors-D1myE8D_.js";import{t as re}from"./triangle-alert-C3aHZq1F.js";import{ot as ie,st as H}from"./sdk.gen-DmWuY0SL.js";import{a as U}from"./routes-C6gxiCrz.js";import{n as ae}from"./use-is-mobile-jACt_z2d.js";import{t as oe}from"./effective-timezone-B99h9zr7.js";import{$ as se,B as W,Ct as ce,G as le,H as G,J as ue,K as de,O as fe,Q as pe,R as me,St as he,U as ge,V as _e,W as ve,X as ye,Y as be,Z as xe,bt as Se,c as Ce,et as we,ht as Te,it as Ee,nt as De,ot as Oe,q as ke,r as K,rt as Ae,st as je,tt as Me,y as Ne,z as Pe}from"./react-query.gen-gQ1_8EHv.js";import{n as Fe,t as Ie}from"./browser-DM38C5zq.js";import{An as Le,Fr as Re,Ma as ze,Nr as Be,Pr as Ve,Vi as He,da as Ue,fa as We,si as Ge,ua as Ke,ui as qe,x as Je}from"./index-B-S-gNKm.js";import{t as Ye}from"./add-credits-modal-BnXqKqkz.js";import{t as Xe}from"./format-date-D4tzd1DT.js";import{a as Ze,n as Qe,t as $e}from"./llm-dimension-8g-Go8uq.js";import{r as et,t as tt}from"./usage-window-B-YOzKJi.js";import{t as nt}from"./environment-store-CnVyTyZ7.js";var rt=T(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),it=T(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),at=T(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),ot=T(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),st=T(`tree-palm`,[[`path`,{d:`M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4`,key:`foxbe7`}],[`path`,{d:`M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3`,key:`18arnh`}],[`path`,{d:`M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35`,key:`ywahnh`}],[`path`,{d:`M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14`,key:`ft0feo`}]]),q=e(r(),1),J=f();function ct({onBack:e}){let t=o(),{data:n}=u(K()),r=n?.name||`your assistant`;return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(ellipse 60% 50% at 50% 38%, color-mix(in oklab, var(--system-positive-strong) 14%, transparent), transparent)`},"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`relative mb-5 flex items-center justify-center`,style:{animation:`welcome-reveal 600ms ease-out both`},children:[(0,J.jsx)(`div`,{className:`absolute h-24 w-24 rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--system-positive-strong) 18%, transparent), transparent 70%)`,animation:`welcome-crown-glow 3s ease-in-out infinite`},"aria-hidden":`true`}),(0,J.jsx)(`div`,{className:`absolute h-16 w-16 rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--system-positive-strong) 12%, transparent), transparent 70%)`,animation:`welcome-crown-glow 3s ease-in-out infinite 0.5s`},"aria-hidden":`true`}),(0,J.jsx)(at,{className:`relative h-8 w-8 text-[var(--system-positive-strong)]`,strokeWidth:1.5,"aria-hidden":`true`})]}),(0,J.jsx)(`h1`,{className:`relative mb-2 text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`28px`,lineHeight:1,fontWeight:400,animation:`welcome-reveal 600ms ease-out 150ms both`},children:`You're all set`}),(0,J.jsx)(`p`,{className:`relative mb-6 max-w-[320px] text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`welcome-reveal 600ms ease-out 300ms both`},children:`Your assistant just got a serious upgrade.`}),(0,J.jsx)(`div`,{style:{animation:`welcome-reveal 600ms ease-out 450ms both`},children:(0,J.jsxs)(i,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>t(U.assistant,{replace:!0}),children:[`Return to `,r]})}),(0,J.jsx)(`div`,{className:`absolute bottom-4 left-4`,children:(0,J.jsx)(i,{variant:`ghost`,"data-testid":`onboarding-complete-back`,onClick:e,leftIcon:(0,J.jsx)(E,{className:`h-4 w-4`}),children:`Back`})})]})}function lt({current:e,total:t=2}){return(0,J.jsx)(`div`,{className:`flex items-center justify-center gap-1.5`,children:Array.from({length:t},(t,n)=>(0,J.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-300`,style:{width:n===e?20:6,backgroundColor:n<=e?`var(--content-default)`:`var(--border-element)`}},n))})}function ut({icon:e,tone:t=`positive`}){let n=t===`positive`?`--system-positive-strong`:t===`warning`?`--system-mid-strong`:`--system-negative-strong`;return(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(${n}) 12%, transparent)`},children:(0,J.jsx)(e,{className:`h-5 w-5`,style:{color:`var(${n})`},"aria-hidden":`true`})})}var dt=1e3,ft=1e4;function pt(e){return ne[e]??ne.medium}var mt=[`machine_size`,`subdomain`,`non_field_errors`],ht={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`};function gt(e,t){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=ht[t.error];if(e)return e}for(let e of mt){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}function _t({onBack:e,onExit:t}){let n=l(),r=nt.use.emailRootDomain(),{data:a}=u(K()),o=a?.id,{data:s}=u({...Ce({path:{assistant_id:o??``}}),enabled:!!o}),c=s?.results?.[0],[f,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(`hi`),[v,y]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!v){if(c){m(c.subdomain),y(!0);return}!a?.handle||f||(m(a.handle),y(!0))}},[a?.handle,c,v,f]);let[b,x]=(0,q.useState)(null),[S,w]=(0,q.useState)(!1),T=d(xe()),D=!!c||S,O=T.isPending||S;return(0,q.useEffect)(()=>{if(!S)return;let e=setTimeout(t,800);return()=>clearTimeout(e)},[S,t]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C.Body,{className:`min-h-[320px] space-y-5 pt-10 pb-4`,style:{animation:`onboarding-step-in 350ms ease-out`},children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 pb-2 text-center`,children:[(0,J.jsx)(ut,{icon:He}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(p,{variant:`title-small`,as:`h1`,children:`Assistant email`}),(0,J.jsx)(p,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Set up an email address for your assistant.`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(p,{variant:`body-small-default`,as:`label`,className:`text-[var(--content-secondary)]`,children:`Email address`}),(0,J.jsx)(N,{subdomain:f,autoFocus:!0,onSubdomainChange:e=>{m(e),b&&x(null)},domainSuffix:r,disabled:O,error:b,locked:D,lockedMessage:`This domain has been set and cannot be changed.`,prefix:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`input`,{value:h,onChange:e=>g(e.target.value.toLowerCase().trim()),disabled:O||D,readOnly:D,placeholder:`hi`,"aria-label":`Email username`,size:Math.max(h.length,2),className:`h-full w-0 min-w-[2ch] flex-none bg-transparent pl-3 pr-1.5 text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none disabled:cursor-not-allowed disabled:opacity-60`,style:{width:`${Math.max(h.length,2)+1.5}ch`}}),(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--content-secondary)]`,children:`@`})]})})]}),!D&&(0,J.jsxs)(_,{tone:`info`,children:[(0,J.jsx)(`span`,{className:`font-mono`,children:f||`<subdomain>`}),` will also become your assistant's public handle. You won't be able to change it once set.`]}),S?(0,J.jsx)(_,{tone:`success`,children:`Domain set — redirecting…`}):null]}),(0,J.jsxs)(C.Footer,{className:`relative items-center justify-between`,children:[(0,J.jsx)(i,{variant:`ghost`,"data-testid":`onboarding-domain-back`,disabled:O,onClick:e,leftIcon:(0,J.jsx)(E,{className:`h-4 w-4`}),children:`Back`}),(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 flex justify-center`,children:(0,J.jsx)(lt,{current:0})}),(0,J.jsx)(`div`,{className:`flex items-center gap-2`,children:D?(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:t,children:`Continue`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{variant:`ghost`,"data-testid":`onboarding-domain-skip`,disabled:O,onClick:()=>{O||T.mutate({body:{skipped:!0}},{onSuccess:t,onError:()=>t()})},children:`Do later`}),(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!f||O,onClick:()=>{O||!f||T.mutate({body:{subdomain:f,...h?{email_username:h}:{}}},{onSuccess:()=>{x(null),w(!0),n.invalidateQueries({queryKey:Ne()})},onError:e=>{x(gt(e,`Couldn't register that subdomain. Try a different one.`))}})},children:`Set domain`})]})})]})]})}function vt({onGoToBilling:e}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(ut,{icon:O,tone:`negative`}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(p,{variant:`title-small`,as:`h1`,children:`Couldn't reach billing`}),(0,J.jsx)(p,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`We hit a problem checking your subscription. Your upgrade may still be processing — return to billing to refresh.`})]}),(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:`Go to billing`})]})}function yt({message:e,onRetry:t,onGoToBilling:n}){return(0,J.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(ut,{icon:O,tone:`warning`}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(p,{variant:`title-small`,as:`h1`,children:`Taking longer than expected`}),(0,J.jsx)(p,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:e})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 pt-2`,children:[(0,J.jsx)(i,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:n,children:`Go to billing`}),(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:t,children:`Try again`})]})]})}function bt({title:e,body:t}){return(0,J.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsxs)(`div`,{className:`relative flex h-11 w-11 items-center justify-center`,children:[(0,J.jsx)(`div`,{className:`absolute h-14 w-14 rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-positive-strong) 10%, transparent)`,animation:`onboarding-glow 2.4s ease-in-out infinite`},"aria-hidden":`true`}),(0,J.jsx)(`div`,{className:`absolute h-9 w-9 rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-positive-strong) 8%, transparent)`,animation:`onboarding-glow 2.4s ease-in-out infinite 0.4s`},"aria-hidden":`true`}),(0,J.jsx)(R,{className:`relative h-5 w-5 animate-spin text-[var(--system-positive-strong)]`,"aria-hidden":`true`})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(p,{variant:`title-small`,as:`h1`,children:e}),(0,J.jsx)(p,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:t})]})]})}function xt({icon:e,label:t,from:n,fromDetail:r,to:i,toDetail:a}){return(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,J.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,style:{backgroundColor:`color-mix(in oklab, var(--system-positive-strong) 10%, transparent)`},children:(0,J.jsx)(e,{className:`h-4 w-4 text-[var(--system-positive-strong)]`})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:t}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)] line-through`,children:n}),r&&(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)] line-through`,children:r})]}),(0,J.jsx)(ze,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-default)]`,children:i}),a&&(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:a})]})]})]})]})}function St({storageGib:e,maxTier:t,onBack:n,onAdvance:r,dotIndex:a,dotTotal:o}){let{data:s}=u(K()),c=s?.machine_size||`small`,l=s?.provisioned_storage_gib??null,f=pt(t),m=f.length>0?f[f.length-1]:c,h=m!==c,g=e!=null&&(l==null||l<e),[v,y]=(0,q.useState)(null),b=d(fe());return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(C.Body,{className:`min-h-[320px] space-y-5 pt-10 pb-4`,style:{animation:`onboarding-step-in 350ms ease-out`},children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 pb-2 text-center`,children:[(0,J.jsx)(ut,{icon:A}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(p,{variant:`title-small`,as:`h1`,children:`Your assistant's new resources`}),(0,J.jsx)(p,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:`Your assistant will go offline briefly while it resizes.`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[h&&(0,J.jsx)(xt,{icon:A,label:`Machine`,from:B[c],fromDetail:z[c],to:B[m],toDetail:z[m]}),g&&(0,J.jsx)(xt,{icon:I,label:`Storage`,from:l==null?`—`:`${l} GiB`,to:`${e} GiB`}),!h&&!g&&(0,J.jsx)(_,{tone:`neutral`,children:`Your assistant is already running at the maximum size for your plan.`})]}),v?(0,J.jsx)(_,{tone:`error`,children:v}):null]}),(0,J.jsxs)(C.Footer,{className:`relative items-center justify-between`,children:[(0,J.jsx)(i,{variant:`ghost`,"data-testid":`onboarding-setup-back`,disabled:b.isPending,onClick:n,leftIcon:(0,J.jsx)(E,{className:`h-4 w-4`}),children:`Back`}),(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 flex justify-center`,children:(0,J.jsx)(lt,{current:a,total:o})}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(i,{variant:`ghost`,"data-testid":`onboarding-setup-skip`,disabled:b.isPending,onClick:r,children:`Do later`}),(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-setup-continue`,disabled:b.isPending||!s?.id,onClick:()=>{b.isPending||!s?.id||b.mutate({path:{id:s.id},body:{machine_size:m,...e==null?{}:{storage_gib:e}}},{onSuccess:()=>{y(null),r()},onError:e=>{y(gt(e,`Couldn't apply changes. Please try again.`))}})},children:`Apply & Restart`})]})]})]})}function Ct({onContinue:e,continueDisabled:t=!1}){return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 text-center`,children:[(0,J.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,style:{background:`radial-gradient(ellipse 60% 50% at 50% 38%, color-mix(in oklab, var(--system-positive-strong) 14%, transparent), transparent)`},"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`relative mb-5 flex items-center justify-center`,style:{animation:`welcome-reveal 600ms ease-out both`},children:[(0,J.jsx)(`div`,{className:`absolute h-24 w-24 rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--system-positive-strong) 18%, transparent), transparent 70%)`,animation:`welcome-crown-glow 3s ease-in-out infinite`},"aria-hidden":`true`}),(0,J.jsx)(`div`,{className:`absolute h-16 w-16 rounded-full`,style:{background:`radial-gradient(circle, color-mix(in oklab, var(--system-positive-strong) 12%, transparent), transparent 70%)`,animation:`welcome-crown-glow 3s ease-in-out infinite 0.5s`},"aria-hidden":`true`}),(0,J.jsx)(M,{className:`relative h-8 w-8 text-[var(--system-positive-strong)]`,strokeWidth:1.5,"aria-hidden":`true`})]}),(0,J.jsx)(`h1`,{className:`relative mb-2 text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`28px`,lineHeight:1,fontWeight:400,animation:`welcome-reveal 600ms ease-out 150ms both`},children:`Welcome to Pro`}),(0,J.jsx)(`p`,{className:`relative mb-6 max-w-[320px] text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`welcome-reveal 600ms ease-out 300ms both`},children:`More compute, more storage, and more features. Let's set everything up.`}),(0,J.jsx)(`div`,{style:{animation:`welcome-reveal 600ms ease-out 450ms both`},children:(0,J.jsx)(i,{variant:`primary`,"data-testid":`onboarding-welcome-continue`,disabled:t,onClick:e,children:`Get started`})}),(0,J.jsx)(`p`,{className:`relative mt-6 max-w-[320px] text-body-small-default text-[var(--content-tertiary)]`,style:{animation:`welcome-reveal 600ms ease-out 600ms both`},children:`This quick setup gets your Pro features ready to go. You can close it anytime and turn these features on later from Settings.`})]})}function wt({open:e,onClose:t}){let n=l(),[r,i]=(0,q.useState)(`confirm-pro`),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(0);(0,q.useEffect)(()=>{e&&(n.invalidateQueries({queryKey:Me()}),n.invalidateQueries({queryKey:se()}))},[e,n]);let d=(0,q.useCallback)(()=>{o(!1),c(e=>e+1),n.invalidateQueries({queryKey:Me()})},[n]),f=u({...we(),refetchInterval:e=>e.state.data?.plan_id===`pro`||a?!1:dt,refetchIntervalInBackground:!1,enabled:e&&r===`confirm-pro`});(0,q.useEffect)(()=>{if(!e||r!==`confirm-pro`)return;let t=setTimeout(()=>o(!0),ft);return()=>clearTimeout(t)},[e,r,s]),(0,q.useEffect)(()=>{r===`confirm-pro`&&f.data?.plan_id===`pro`&&i(`welcome`)},[r,f.data?.plan_id]);let p=u({...pe(),enabled:e&&r!==`confirm-pro`});u({...K(),enabled:e});let m=p.data?.domain_setup_available,h=(0,q.useCallback)(()=>{i(m===!1?`setup`:`domain`)},[m]),g=(0,q.useCallback)(()=>{i(m===!1?`welcome`:`domain`)},[m]),_=r===`welcome`;return(0,J.jsx)(C.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,J.jsx)(C.Content,{size:`md`,hideCloseButton:!_,dismissOnOverlayClick:!_,onEscapeKeyDown:_?e=>e.preventDefault():void 0,onInteractOutside:_?e=>e.preventDefault():void 0,className:`overflow-hidden`,children:v()})});function v(){if(r===`confirm-pro`)return f.isError?(0,J.jsx)(vt,{onGoToBilling:t}):a?(0,J.jsx)(yt,{message:`We're still confirming your upgrade.`,onRetry:d,onGoToBilling:t}):(0,J.jsx)(bt,{title:`Finalizing your upgrade…`,body:`This usually takes a few seconds.`});if(r===`welcome`)return p.isError?(0,J.jsx)(vt,{onGoToBilling:t}):(0,J.jsx)(Ct,{onContinue:h,continueDisabled:p.isPending||p.isFetching});if(r===`domain`)return(0,J.jsx)(_t,{onBack:()=>i(`welcome`),onExit:()=>i(`setup`)});if(r===`setup`){if(p.isError)return(0,J.jsx)(vt,{onGoToBilling:t});let e=p.data?.max_machine_tier??null,n=m!==!1;return(0,J.jsx)(St,{storageGib:p.data?.selected_storage_gib??null,maxTier:e,onBack:g,onAdvance:()=>i(`complete`),dotIndex:+!!n,dotTotal:n?2:1})}return r===`complete`?(0,J.jsx)(ct,{onBack:()=>i(`setup`)}):null}}var Tt=`billing-portal-return-snapshot`;function Et(e){try{sessionStorage.removeItem(Tt),sessionStorage.setItem(Tt,JSON.stringify(e))}catch{}}function Dt(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Tt);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function Ot(){try{sessionStorage.removeItem(Tt)}catch{}}function kt(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function At(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function jt(e){return e?e.cancel_at??e.current_period_end??null:null}function Mt(e){let t=l();return(0,q.useEffect)(()=>Fe(()=>{t.invalidateQueries(we())}),[t]),he({onSuccess:t=>{e&&Et(e),Ie(t.portal_url)},onError:()=>{w.error(`Couldn't open the billing portal. Please try again.`,{id:`billing-portal-session-error`})}})}function Nt(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function Y(e){return`${Nt(e)}/mo`}function Pt(e){return`${e>0?`+`:`−`}${Nt(Math.abs(e))}/mo`}var Ft={medium:`Medium`,large:`Large`,xl:`XL`};function It(e){return e.disabled===!0}function Lt({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let c=(0,q.useMemo)(()=>e.map(e=>{let t=Ft[e.tier]??e.label,n=o==null?`+${Y(e.price_cents)}`:e.price_cents===o?`(${Y(e.price_cents)}, current)`:Pt(e.price_cents-o);return{value:e.tier,label:`${t} ${n}`,disabled:It(e)}}),[e,o]),l=(0,q.useMemo)(()=>t.map(e=>{let t=s==null?`+${Y(e.price_cents)}`:e.price_cents===s?`(${Y(e.price_cents)}, current)`:Pt(e.price_cents-s);return{value:e.tier,label:`${e.storage_gib} GiB ${t}`,disabled:It(e)}}),[t,s]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(p,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Machine`}),(0,J.jsx)(`span`,{title:`Determines the CPU and memory allocated to your assistant`,children:(0,J.jsx)(L,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(h,{"aria-label":`Machine tier`,placeholder:`Select a machine tier`,value:n??``,onChange:i,options:c})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(p,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Storage`}),(0,J.jsx)(`span`,{title:`Persistent disk space for your assistant's files and data`,children:(0,J.jsx)(L,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(h,{"aria-label":`Storage tier`,placeholder:`Select a storage tier`,value:r??``,onChange:a,options:l})]})]})}var Rt=new Set([`active`,`trialing`,`past_due`]),zt=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`non_field_errors`];function Bt(e,t){if(e&&typeof e==`object`){for(let t of zt)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function Vt(e,t){let n=e.filter(e=>!It(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Ht(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Ut(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Wt({open:e,onCancel:t,onConfirm:n,confirming:r,lostFeatures:a}){return(0,J.jsx)(C.Root,{open:e,onOpenChange:e=>{!e&&!r&&t()},children:(0,J.jsxs)(C.Content,{size:`md`,hideCloseButton:!0,children:[(0,J.jsx)(C.Header,{children:(0,J.jsx)(C.Title,{icon:re,children:`Downgrade to Base?`})}),(0,J.jsxs)(C.Body,{children:[(0,J.jsx)(p,{as:`p`,variant:`body-medium-default`,className:`text-(--content-secondary)`,children:`Downgrading removes the following Pro features:`}),(0,J.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:a.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(p,{as:`span`,variant:`body-medium-default`,children:e})},e))})]}),(0,J.jsxs)(C.Footer,{children:[(0,J.jsx)(i,{variant:`outlined`,onClick:t,disabled:r,children:`Keep Pro`}),(0,J.jsx)(i,{variant:`danger`,onClick:n,disabled:r,"data-testid":`confirm-downgrade-button`,children:`Confirm Downgrade`})]})]})})}var Gt=`__none__`;function Kt(e){return`${e.label} — ${Y(e.price_cents)}`}function qt({creditTiers:e,selectedCreditTier:t,onCreditTierChange:n,disabled:r=!1}){let i=(0,q.useMemo)(()=>[{value:Gt,label:`No credit bundle — ${Y(0)}`},...e.map(e=>({value:e.tier,label:Kt(e)}))],[e]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(p,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Credit bundle`}),(0,J.jsx)(`span`,{title:`A monthly allotment of credits added to your Pro Plan subscription`,children:(0,J.jsx)(L,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(h,{"aria-label":`Credit bundle`,placeholder:`Select a credit bundle`,disabled:r,value:t??Gt,onChange:e=>n(e===Gt?null:e),options:i})]})}function Jt({features:e,variant:t,header:n,maxInline:r=3}){return t===`inline`?(0,J.jsx)(J.Fragment,{children:e.slice(0,r).join(`, `)}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[n&&(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-secondary)]`,children:n}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,J.jsx)(k,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,J.jsx)(p,{as:`span`,variant:`body-medium-default`,children:e})]},e))})]})}function Yt({plan:e,isCurrent:t,onPro:n,cancelAtPeriodEnd:r,isCanceled:a,cancelDate:o,formatGraceDate:s,proTierChangeMode:c,creditTiersEnabled:l,creditTiers:u,displayCreditTier:d,onCreditTierChange:f,selectedMachineTier:h,selectedStorageTier:g,onMachineTierChange:y,onStorageTierChange:b,machineTiersForPicker:x,storageTiersForPicker:S,currentMachinePrice:C,currentStoragePrice:w,currentCreditPriceUnknown:T,proCurrentTotalCents:E,proLiveTotalCents:D,proTotalDelta:O,onboardingLoading:k,tierChangePending:A,machineChanged:j,storageChanged:N,creditChanged:P,tierChangeError:F,upgradePending:I,portalPending:ee,onUpgrade:te,onApplyTierChange:ne,onDowngradeClick:z,onKeepPlan:B}){let V=e.id===`pro`,re=e.id===`base`,ie=V&&n&&r&&!a,H=V&&(!t||t&&c),U=V&&t&&c;return(0,J.jsxs)(m,{padding:`lg`,className:`flex flex-col bg-[var(--surface-base)]`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-[var(--border-base)] bg-[var(--surface-lift)]`,children:V?(0,J.jsx)(M,{className:`h-5 w-5 text-[var(--content-default)]`}):(0,J.jsx)(st,{className:`h-5 w-5 text-[var(--content-default)]`})}),(0,J.jsxs)(`div`,{className:`flex min-h-6 items-center gap-2`,children:[(0,J.jsx)(p,{as:`h3`,variant:`title-small`,children:e.name}),t&&(0,J.jsx)(v,{tone:`positive`,children:`Current`})]}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`-mt-2 text-[var(--content-tertiary)]`,children:re?`All you need for a capable assistant`:`More features, more compute, more storage`}),ie&&o&&(0,J.jsxs)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--system-mid-strong)]`,"data-testid":`modal-cancels-on`,children:[`Your plan ends on `,s(o)]}),(0,J.jsx)(`hr`,{className:`border-t border-[var(--border-base)]`}),(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:re?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(p,{as:`p`,variant:`title-medium`,children:`Free`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:`Forever`})]}):t&&!(H&&D!=null)&&(E==null||T)?k?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),(0,J.jsx)(p,{as:`span`,variant:`body-medium-lighter`,children:`Loading your plan...`})]}):(0,J.jsx)(p,{as:`p`,variant:`body-medium-lighter`,className:`text-[var(--content-tertiary)]`,"data-testid":`modal-pro-price-unavailable`,children:`Current plan pricing unavailable`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(p,{as:`p`,variant:`title-medium`,"data-testid":`modal-pro-price`,children:H&&D!=null?(0,J.jsxs)(J.Fragment,{children:[Y(D),O!=null&&O!==0&&(0,J.jsxs)(`span`,{className:`ml-1 text-[var(--content-tertiary)]`,children:[`(`,Pt(O),`)`]})]}):E==null?e.id===`pro`?`From ${Y(e.base_price_cents+Ut(e.machine_tiers)+Ut(e.storage_tiers))}`:null:`Currently ${Y(E)}`}),H&&O!=null&&O!==0&&(0,J.jsx)(`span`,{title:`Your Pro Plan subscription will change from ${Y(E)} to ${Y(D)}.`,children:(0,J.jsx)(L,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),e.id===`pro`&&(0,J.jsxs)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,"data-testid":`modal-pro-base-fee`,children:[Nt(e.base_price_cents),` base fee`]})]})}),(0,J.jsx)(Jt,{features:e.included_features,variant:`checklist`}),V&&!l&&(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,"data-testid":`modal-credits-not-included`,children:`*Credits not included`})]}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-1 flex-col justify-end gap-4`,children:[!t&&V&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`hr`,{className:`border-t border-[var(--border-base)]`}),l&&(0,J.jsx)(qt,{creditTiers:u,selectedCreditTier:d,onCreditTierChange:f,disabled:I}),(0,J.jsx)(Lt,{machineTiers:x,storageTiers:S,selectedMachineTier:h,selectedStorageTier:g,onMachineTierChange:y,onStorageTierChange:b}),(0,J.jsx)(i,{variant:`primary`,className:`w-full`,onClick:te,disabled:I||!h||!g,"data-testid":`modal-upgrade-to-pro-button`,children:`Upgrade to Pro`})]}),U&&(k?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),(0,J.jsx)(p,{as:`span`,variant:`body-medium-lighter`,children:`Loading your plan...`})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`hr`,{className:`border-t border-[var(--border-base)]`}),l&&(0,J.jsx)(qt,{creditTiers:u,selectedCreditTier:d,onCreditTierChange:f,disabled:A}),(0,J.jsx)(Lt,{machineTiers:x,storageTiers:S,selectedMachineTier:h,selectedStorageTier:g,onMachineTierChange:y,onStorageTierChange:b,currentMachinePriceCents:C,currentStoragePriceCents:w}),F&&(0,J.jsx)(_,{tone:`error`,children:F}),(0,J.jsx)(i,{variant:`primary`,className:`w-full`,onClick:ne,disabled:A||!j&&!N&&!P,"data-testid":`modal-change-tier-button`,children:`Update Plan`})]})),!t&&re&&n&&!r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`hr`,{className:`border-t border-[var(--border-base)]`}),(0,J.jsx)(i,{variant:`outlined`,className:`w-full`,onClick:z,disabled:ee,"data-testid":`modal-downgrade-to-base-button`,children:`Downgrade to Base`})]}),ie&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`hr`,{className:`border-t border-[var(--border-base)]`}),(0,J.jsx)(i,{variant:`outlined`,className:`w-full`,onClick:B,disabled:ee,"data-testid":`modal-keep-plan-button`,children:`Keep your Plan`})]})]})]})}function Xt({open:e,onClose:t,onTierUpgraded:n}){let r=l(),a=u(de()),o=u(we()),s=d(De()),c=d(be()),f=d(ye()),m=d(ue()),h=Mt(kt(o.data)),[g,v]=(0,q.useState)(`plans`),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(null),[T,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(void 0);(0,q.useEffect)(()=>Fe(()=>{r.invalidateQueries({queryKey:Me()}),r.invalidateQueries({queryKey:ke()}),r.invalidateQueries({queryKey:se()}),t()}),[r,t]);let A=o.data?.plan_id,j=A===`pro`,M=u({...pe(),enabled:j}),N=M.data?.max_machine_tier??null,P=M.data?.selected_storage_tier??null,F=M.data?.selected_storage_gib??null,I=o.data?.cancel_at_period_end===!0||!!o.data?.cancel_at,L=o.data?.status===`canceled`,ee=jt(o.data),te=o.data?.status,ne=te!=null&&Rt.has(te),z=j&&ne&&!I&&!L,B=a.data?.plans.find(e=>e.id===`pro`),V=B?.credit_tiers??[],ie=V.length>0,H=o.data?.selected_credit_tier??null,U=e=>V.find(t=>t.tier===e)?.price_cents??0,ae=U(H),oe=H!=null&&!V.some(e=>e.tier===H),W=O===void 0?H:O,ce=U(W),le=B?.machine_tiers??[],G=z&&F!=null?(B?.storage_tiers??[]).map(e=>e.storage_gib<F?{...e,disabled:!0}:e):B?.storage_tiers??[];(0,q.useEffect)(()=>{if(!e){S(null),D(null),k(void 0);return}if(B){if(z){if(N==null||P==null)return;S(e=>Vt(le,e??N)),D(e=>Vt(G,e??P)),k(e=>Ht(V,e,H));return}S(e=>Vt(B.machine_tiers,e)),D(e=>Vt(B.storage_tiers,e)),k(e=>Ht(V,e,null))}},[e,B,z,N,P,H]);let fe=a.data?.plans.find(e=>e.id===`base`),me=new Set(fe?.included_features??[]),he=(B?.included_features??[]).filter(e=>!me.has(e)),ge=()=>{if(!s.isPending){if(!x||!T){w.error(`Pick a machine and storage tier to continue.`,{id:`pro-upgrade-error`});return}s.mutate({body:{target_plan_id:`pro`,confirm:!0,machine_tier:x,storage_tier:T,credit_tier:W}},{onSuccess:e=>{if(e.checkout_url){Ie(e.checkout_url);return}if(e.status===`no_op`){w.info(`You're already on Pro.`,{id:`pro-upgrade`}),t();return}w.error(e.message??`Failed to start upgrade. Please try again.`,{id:`pro-upgrade-error`})},onError:e=>{w.error(Bt(e,`Failed to start upgrade. Please try again.`),{id:`pro-upgrade-error`})}})}},_e=()=>{h.isPending||(v(`plans`),h.mutate({}))},ve=()=>{r.invalidateQueries({queryKey:Me()}),r.invalidateQueries({queryKey:se()}),r.invalidateQueries({queryKey:ke()})},xe=c.isPending||f.isPending||m.isPending,Se=x!=null&&x!==N,Ce=T!=null&&T!==P,Te=ie&&O!==void 0&&O!==H,Ee=e=>le.find(t=>t.tier===e)?.price_cents??null,Oe=e=>G.find(t=>t.tier===e)?.price_cents??null,K=Ee(x),Ae=Oe(T),je=Ee(N),Ne=Oe(P),Pe=Se&&K!=null&&je!=null&&K<je,Le=()=>{if(xe)return;let e=[];Se&&x&&e.push(new Promise(e=>{c.mutate({body:{machine_tier:x}},{onSuccess:()=>e({dimension:`machine`,ok:!0}),onError:t=>e({dimension:`machine`,ok:!1,error:t})})})),Ce&&T&&e.push(new Promise(e=>{f.mutate({body:{storage_tier:T}},{onSuccess:()=>e({dimension:`storage`,ok:!0}),onError:t=>e({dimension:`storage`,ok:!1,error:t})})})),Te&&e.push(new Promise(e=>{m.mutate({body:{credit_tier:W}},{onSuccess:()=>e({dimension:`credit`,ok:!0}),onError:t=>e({dimension:`credit`,ok:!1,error:t})})})),Promise.all(e).then(e=>{ve();let r=e.some(e=>e.ok&&e.dimension===`storage`),i=e.some(e=>e.ok&&e.dimension===`machine`)&&!Pe,a=(r||i)&&!!n,o=e.filter(e=>!e.ok);if(o.length>0){let e=o.map(e=>Bt(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);w.error(e,{id:`pro-tier-change-error`}),a&&(t(),n());return}a?(t(),n()):w.success(Te&&!Se&&!Ce?`Credit bundle updated.`:`Plan updated.`,{id:`pro-tier-change`})})},Re=()=>{if(!xe){if(Pe){b(!0);return}Le()}},ze=()=>{b(!1),Le()},Be=e=>K!=null&&Ae!=null?e.base_price_cents+K+Ae+ce:null,Ve=e=>je!=null&&Ne!=null?e.base_price_cents+je+Ne+ae:null,He=c.isError||f.isError||m.isError?Bt(c.error??f.error??m.error,`Failed to update plan. Please try again.`):null,Ue=a.isLoading||o.isLoading,We=a.isError||o.isError||!a.data||!o.data;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(C.Root,{open:e,onOpenChange:e=>{e||(v(`plans`),t())},children:(0,J.jsx)(C.Content,{size:g===`plans`?`lg`:`md`,children:g===`downgrade-confirm`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(C.Header,{children:(0,J.jsx)(C.Title,{icon:re,children:`Downgrade to Base?`})}),(0,J.jsxs)(C.Body,{children:[(0,J.jsx)(p,{as:`p`,variant:`body-medium-default`,className:`text-(--content-secondary)`,children:`Downgrading removes the following Pro features:`}),(0,J.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:he.map(e=>(0,J.jsx)(`li`,{children:(0,J.jsx)(p,{as:`span`,variant:`body-medium-default`,children:e})},e))})]}),(0,J.jsxs)(C.Footer,{children:[(0,J.jsx)(i,{variant:`ghost`,onClick:()=>v(`plans`),disabled:h.isPending,leftIcon:(0,J.jsx)(E,{className:`h-4 w-4`}),children:`Back`}),(0,J.jsx)(i,{variant:`danger`,onClick:_e,disabled:h.isPending,"data-testid":`confirm-downgrade-button`,children:`Confirm Downgrade`})]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(C.Header,{children:(0,J.jsx)(C.Title,{className:`sr-only`,children:`Upgrade Plan`})}),(0,J.jsx)(C.Body,{children:Ue?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),(0,J.jsx)(p,{as:`span`,variant:`body-medium-lighter`,children:`Loading plans...`})]}):We?(0,J.jsx)(_,{tone:`error`,children:`Failed to load plans. Please try again later.`}):(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`space-y-2 pb-2 pt-4 text-center`,children:[(0,J.jsx)(p,{as:`p`,variant:`title-medium`,children:`Your Assistant, Your Way`}),(0,J.jsx)(p,{as:`p`,variant:`body-medium-lighter`,className:`text-[var(--content-secondary)]`,children:`Choose the plan that works best for you and your assistant.`})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:a.data.plans.map(e=>{let t=e.id===A,n=e.id===`pro`&&B?Be(B):null,r=e.id===`pro`&&B?Ve(B):null;return(0,J.jsx)(Yt,{plan:e,isCurrent:t,onPro:j,cancelAtPeriodEnd:I,isCanceled:L,cancelDate:ee,formatGraceDate:At,proTierChangeMode:z,creditTiersEnabled:ie,creditTiers:V,displayCreditTier:W,onCreditTierChange:k,selectedMachineTier:x,selectedStorageTier:T,onMachineTierChange:S,onStorageTierChange:D,machineTiersForPicker:le,storageTiersForPicker:G,currentMachinePrice:je,currentStoragePrice:Ne,currentCreditPriceUnknown:oe,proCurrentTotalCents:r,proLiveTotalCents:n,proTotalDelta:n!=null&&r!=null?n-r:null,onboardingLoading:M.isLoading,tierChangePending:xe,machineChanged:Se,storageChanged:Ce,creditChanged:Te,tierChangeError:He,upgradePending:s.isPending,portalPending:h.isPending,onUpgrade:ge,onApplyTierChange:Re,onDowngradeClick:()=>v(`downgrade-confirm`),onKeepPlan:()=>h.mutate({})},e.id)})})]})}),(0,J.jsxs)(C.Footer,{className:`relative items-center`,children:[(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`pointer-events-none absolute inset-x-0 text-center text-[var(--content-tertiary)]`,children:(0,J.jsx)(`span`,{className:`pointer-events-auto`,children:`You can change or cancel your plan at any time from billing settings.`})}),(0,J.jsx)(`div`,{className:`ml-auto`,children:(0,J.jsx)(i,{variant:`outlined`,onClick:t,"data-testid":`modal-cancel-button`,children:`Cancel`})})]})]})})}),(0,J.jsx)(Wt,{open:y,onCancel:()=>b(!1),onConfirm:ze,confirming:xe,lostFeatures:[`Reduced CPU and memory for your assistant — it will resize to the smaller compute profile.`]})]})}var Zt={visa:`Visa`,mastercard:`Mastercard`,amex:`Amex`,discover:`Discover`,diners:`Diners Club`,jcb:`JCB`,unionpay:`UnionPay`};function Qt(e){return Zt[e.toLowerCase()]??e}function $t(e,t){return`${Qt(e??`card`)} •••• ${t??`????`}`}function en({open:e,confirming:t,onCancel:n,onConfirm:r}){return(0,J.jsx)(g,{open:e,title:`Disable automatic top-ups?`,message:`Auto top-ups will stop. Any saved payment method stays on file.`,confirmLabel:t?`Disabling…`:`Disable`,cancelLabel:`Keep enabled`,destructive:!0,onConfirm:r,onCancel:n})}var tn={threshold_usd:`100`,amount_usd:`10`,monthly_cap_usd:``};function nn(e){if(e===``||e===`-`)return e;let t=parseFloat(e);return Number.isFinite(t)?String(Math.trunc(t)):``}function rn(e){let t={},n=parseFloat(e.threshold_usd),r=parseFloat(e.amount_usd);if((!Number.isFinite(r)||r<10||r>500)&&(t.amount_usd=`Must be between $10 and $500`),(!Number.isFinite(n)||n<1||n>100)&&(t.threshold_usd=`Must be between $1 and $100`),e.monthly_cap_usd!==``){let n=parseFloat(e.monthly_cap_usd);!Number.isFinite(n)||n<25||n>1e4?t.monthly_cap_usd=`Must be between $25 and $10,000`:Number.isFinite(r)&&n<r&&(t.monthly_cap_usd=`Must be at least the top-up amount`)}return t}function an(e,t,n,r){if(n[e])return n[e];if(r)return t[e]}function on({initialValues:e=tn,submitting:t,serverErrors:n,onSave:r,onCancel:a}){let[o,s]=(0,q.useState)(e),[c,l]=(0,q.useState)({threshold_usd:!1,amount_usd:!1,monthly_cap_usd:!1}),u=rn(o),d=e=>t=>{s(n=>({...n,[e]:t.target.value}))},f=e=>()=>{l(t=>({...t,[e]:!0})),s(t=>({...t,[e]:nn(t[e])}))},p=e=>an(e,u,n,c[e]);return(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,J.jsx)(`div`,{className:`min-w-[10rem] flex-1`,children:(0,J.jsx)(y,{type:`number`,step:`1`,label:`Auto-Reload when balance below`,value:o.threshold_usd,onChange:d(`threshold_usd`),onBlur:f(`threshold_usd`),errorText:p(`threshold_usd`),"data-testid":`auto-top-up-threshold-input`,fullWidth:!0})}),(0,J.jsx)(`div`,{className:`min-w-[10rem] flex-1`,children:(0,J.jsx)(y,{type:`number`,step:`1`,label:`Add amount when auto reloading`,value:o.amount_usd,onChange:d(`amount_usd`),onBlur:f(`amount_usd`),errorText:p(`amount_usd`),"data-testid":`auto-top-up-amount-input`,fullWidth:!0})}),(0,J.jsx)(`div`,{className:`min-w-[10rem] flex-1`,children:(0,J.jsx)(y,{type:`number`,step:`1`,label:`Monthly spending cap`,helperText:`Pauses auto top-ups for the rest of the month once spending reaches this amount. Manual purchases also count toward the total. Leave empty for no limit.`,value:o.monthly_cap_usd,onChange:d(`monthly_cap_usd`),onBlur:f(`monthly_cap_usd`),errorText:p(`monthly_cap_usd`),"data-testid":`auto-top-up-cap-input`,fullWidth:!0})}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-[18px]`,children:[(0,J.jsx)(i,{variant:`outlined`,onClick:a,disabled:t,children:`Cancel`}),(0,J.jsx)(i,{variant:`primary`,onClick:()=>{l({threshold_usd:!0,amount_usd:!0,monthly_cap_usd:!0});let e={threshold_usd:nn(o.threshold_usd),amount_usd:nn(o.amount_usd),monthly_cap_usd:nn(o.monthly_cap_usd)};s(e);let t=rn(e);if(Object.keys(t).length!==0)return;let n=e=>e===``?``:`${parseInt(e,10)}.00`;r({threshold_usd:n(e.threshold_usd),amount_usd:n(e.amount_usd),monthly_cap_usd:e.monthly_cap_usd===``?``:n(e.monthly_cap_usd)})},disabled:t,"data-testid":`auto-top-up-save-button`,children:`Save`})]})]})})}function sn(e){if(!e)return``;let t=parseFloat(e);return Number.isFinite(t)?String(Math.trunc(t)):``}function cn(e){if(!e)return`$0`;let t=parseFloat(e);if(!Number.isFinite(t))return`$0`;let n=Math.abs(t).toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2}),r=n.endsWith(`.00`)?n.slice(0,-3):n;return t<0?`-$${r}`:`$${r}`}var ln={enabled:!1,threshold_usd:null,amount_usd:null,monthly_cap_usd:null,has_payment_method:!1,payment_method_brand:null,payment_method_last4:null,stripe_payment_method_updated_at:null,last_charge_at:null,last_failure_at:null,last_failure_reason:null,disabled_due_to_repeated_failures:!1,paused_until:null,current_month_credits_purchased_usd:`0.00`,current_month_charged_usd:`0.00`,next_trigger_amount_usd:null,stubbed:!1};function un(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))Array.isArray(r)&&typeof r[0]==`string`&&(t[n]=r[0]);return t}function dn(e){let{brand:t,last4:n}=e;return!t&&!n?null:n?`Charged to ${$t(t,n)}`:`Charged to ${Qt(t??`card`)}`}function fn(){let e=l(),t=u(W()),n=d(ve()),r=d(me()),[a,o]=(0,q.useState)(`view`),[s,c]=(0,q.useState)(!1),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1);if((0,q.useEffect)(()=>{m&&t.data?.has_payment_method&&h(!1)},[m,t.data?.has_payment_method]),t.isLoading)return(0,J.jsx)(`div`,{"data-testid":`auto-top-up-card`,children:(0,J.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`})});if(t.isError||!t.data)return(0,J.jsx)(`div`,{"data-testid":`auto-top-up-card`,children:(0,J.jsx)(_,{tone:`error`,children:`Failed to load auto top-up configuration.`})});let g=t.data,v=g.enabled===!0,y=g.disabled_due_to_repeated_failures===!0&&!v,x=()=>{n.reset(),r.reset(),o(`form`)},S=()=>{o(`view`),c(!1)},C=()=>{r.reset(),p(!1)},w=t=>{n.mutate({body:{enabled:!0,threshold_usd:t.threshold_usd,amount_usd:t.amount_usd,monthly_cap_usd:t.monthly_cap_usd===``?null:t.monthly_cap_usd}},{onSuccess:t=>{G(e,void 0,e=>({...t,payment_method_brand:e?.payment_method_brand??null,payment_method_last4:e?.payment_method_last4??null})),e.invalidateQueries({queryKey:_e()}),S()}})},T=()=>{r.mutate({},{onSuccess:()=>{G(e,void 0,e=>({...ln,has_payment_method:e?.has_payment_method??!1,payment_method_brand:e?.payment_method_brand??null,payment_method_last4:e?.payment_method_last4??null,stripe_payment_method_updated_at:e?.stripe_payment_method_updated_at??null})),p(!1),o(`view`),c(!1)}})},E=e=>{if(e&&!v){if(!g.has_payment_method||y){h(!0);return}h(!1),c(!0),x();return}if(!e&&!v&&s){S();return}!e&&v&&p(!0)},D=a===`form`,O=un(n.error),k=n.isError&&Object.keys(O).length===0,A=v||s,j=dn({brand:g.payment_method_brand,last4:g.payment_method_last4});return(0,J.jsxs)(`div`,{"data-testid":`auto-top-up-card`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,J.jsx)(b,{checked:A,onChange:E,label:`Enable Auto-Reload`}),v&&!D&&(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsxs)(`div`,{className:`text-right`,children:[(0,J.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,"data-testid":`auto-top-up-summary`,children:[`Add `,cn(g.amount_usd),` when the balance falls under `,cn(g.threshold_usd)]}),g.monthly_cap_usd!=null&&(0,J.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,"data-testid":`auto-top-up-cap-progress`,children:[cn(g.current_month_credits_purchased_usd),` of`,` `,cn(g.monthly_cap_usd),` this month`]})]}),(0,J.jsx)(i,{variant:`outlined`,onClick:x,"data-testid":`auto-top-up-edit-button`,children:`Adjust`})]})]}),y&&(0,J.jsx)(_,{tone:`warning`,className:`mt-3`,"data-testid":`auto-top-up-declined-cutoff`,children:`We paused automatic reloads after several declined payments. Add a new payment method below to turn auto-reload back on.`}),(0,J.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-in-out`,style:{gridTemplateRows:m&&!y?`1fr`:`0fr`},children:(0,J.jsx)(`div`,{className:`overflow-hidden`,children:(0,J.jsx)(_,{tone:`warning`,className:`mt-3`,children:`You must first add a Payment Method before you can enable automatic credit reloads.`})})}),k&&(0,J.jsx)(_,{tone:`error`,className:`mt-4`,"data-testid":`auto-top-up-update-error`,children:`Failed to save automatic top-ups. Please try again.`}),r.isError&&(0,J.jsx)(_,{tone:`error`,className:`mt-4`,"data-testid":`auto-top-up-disable-error`,children:`Failed to disable automatic top-ups. Please try again.`}),D&&(0,J.jsx)(on,{initialValues:v?{threshold_usd:sn(g.threshold_usd),amount_usd:sn(g.amount_usd),monthly_cap_usd:sn(g.monthly_cap_usd)}:void 0,submitting:n.isPending,serverErrors:O,onCancel:S,onSave:w}),v&&!g.has_payment_method&&(0,J.jsx)(_,{tone:`warning`,className:`mt-3`,"data-testid":`auto-top-up-no-pm`,children:`You must add a Payment Method.`}),v&&g.has_payment_method&&(0,J.jsx)(`p`,{className:`mt-3 text-body-small-default text-[var(--content-tertiary)]`,"data-testid":`auto-top-up-saved-pm`,children:j??`Charged to a saved card`}),(v||D)&&(0,J.jsx)(_,{tone:`info`,className:`mt-4`,children:`If you're too close to your monthly limit, the auto-reload will only top up to that limit.`}),(0,J.jsx)(en,{open:f,confirming:r.isPending,onCancel:C,onConfirm:T})]})}var pn=2e3;function mn(e){let t=parseFloat(e);if(Number.isNaN(t))return`0`;let n=Math.abs(t).toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2}),r=n.endsWith(`.00`)?n.slice(0,-3):n;return t<0?`-${r}`:r}function hn(){let e=l(),{data:t,isLoading:n,isError:r}=u(Ae()),a=t??null,[o,s]=(0,q.useState)(!1),c=(0,q.useRef)(0),d=(0,q.useRef)(null),f=ce({onSuccess:()=>{e.invalidateQueries({queryKey:Ee()})},onError:()=>{c.current<3&&(d.current=setTimeout(()=>{f.reset()},pn))}});(0,q.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let h=f.mutate;(0,q.useEffect)(()=>{a&&a.settled_balance===`0.00`&&a.pending_compute===`0.00`&&a.effective_balance===`0.00`&&c.current<3&&!f.isPending&&!f.isError&&!f.isSuccess&&(c.current+=1,h({}))},[a,f.isPending,f.isError,f.isSuccess,h]);let g=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(p,{as:`h2`,variant:`title-medium`,className:`text-[var(--content-default)]`,children:`Credit Balance`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`mt-2 text-[var(--content-tertiary)]`,children:`An overview of your credit balance and pending charges.`})]}),(0,J.jsx)(i,{variant:`primary`,onClick:()=>s(!0),disabled:n||!a,"data-testid":`add-credits-button`,children:`Add Credits`})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(m,{padding:`md`,children:[g,n?(0,J.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),`Loading billing summary...`]}):r?(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(_,{tone:`error`,children:`Failed to load billing summary. Please try again later.`})}):a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`mt-4`,children:(()=>{if(!a)return null;let e=parseFloat(a.effective_balance)<0,t=parseFloat(a.settled_balance)<0,n=parseFloat(a.pending_compute)<0;return(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsx)(S,{icon:(0,J.jsx)(We,{className:`h-4 w-4`,"aria-hidden":!0}),value:(0,J.jsx)(`span`,{"data-testid":`effective-balance`,children:mn(a.effective_balance)}),label:`Balance`,tone:e?`negative`:`default`}),(0,J.jsx)(S,{icon:(0,J.jsx)(rt,{className:`h-4 w-4`,"aria-hidden":!0}),value:(0,J.jsx)(`span`,{"data-testid":`settled-balance`,children:mn(a.settled_balance)}),label:`Settled Balance`,tone:t?`negative`:`default`}),(0,J.jsx)(S,{icon:(0,J.jsx)(it,{className:`h-4 w-4`,"aria-hidden":!0}),value:(0,J.jsx)(`span`,{"data-testid":`pending-charges`,children:mn(a.pending_compute)}),label:a.is_degraded?`Pending Usage (estimated)`:`Pending Usage`,tone:a.is_degraded?`muted`:n?`negative`:`default`})]})})()}),a.is_degraded&&(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(_,{tone:`warning`,children:`Pending charges could not be calculated. The balance shown may be incomplete.`})})]}):(0,J.jsx)(`p`,{className:`mt-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No billing information available.`}),(0,J.jsx)(`div`,{className:`mt-6 border-t border-[var(--border-base)] pt-6`,children:(0,J.jsx)(fn,{})})]}),(0,J.jsx)(Ye,{open:o,onOpenChange:s})]})}var gn=1e3,_n=15e3,vn=3e3,yn=45e3,bn=`billing-portal-return`;function xn(e,t){if(!e)return{kind:`info`,message:`Subscription updated.`};let n=e.cancel_at_period_end||!!e.cancel_at,r=t.cancel_at_period_end||!!t.cancel_at;return!n&&r?{kind:`info`,message:`Pro plan canceled. You'll have access until ${t.cancel_at?At(t.cancel_at):`the end of your billing period`}.`}:n&&!r?{kind:`success`,message:`Pro plan reactivated.`}:{kind:`info`,message:`Subscription updated.`}}function Sn(){let[e]=s(),t=o(),n=l(),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]),(0,q.useEffect)(()=>{if(e.get(`portal_return`)!==`true`)return;let i={current:!1},a=Dt(),o=we(),s=Me(),c=Date.now();async function l(){await n.invalidateQueries({queryKey:s});let e=await n.fetchQuery(o);return{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at}}async function u(){let e=await l();for(;!i.current&&a&&e.cancel_at_period_end===a.cancel_at_period_end&&e.cancel_at===a.cancel_at&&Date.now()-c<_n&&(await new Promise(e=>setTimeout(e,gn)),!i.current);)e=await l();return e}return(async()=>{try{let e=await u();if(i.current)return;let{kind:t,message:n}=xn(a,e);t===`success`?w.success(n,{id:bn}):w.info(n,{id:bn})}catch{if(i.current)return;w.info(`Subscription updated.`,{id:bn})}finally{if(!i.current){Ot(),t(U.settings.billing,{replace:!0});let e=Date.now();r.current!==null&&clearInterval(r.current),r.current=setInterval(()=>{if(Date.now()-e>=yn){r.current!==null&&(clearInterval(r.current),r.current=null);return}l().catch(e=>{console.error(`billing poll error:`,e)})},vn)}}})(),()=>{i.current=!0}},[e,t,n]),null}var Cn=[7,30,90].map(e=>({value:`${e}`,label:`Last ${e} days`}));function wn(e,t=oe()){let{fromDate:n,toDate:r}=tt(e,t);return{from:n,to:r}}function Tn(e,t){let n=new Date(e),r=new Date(t);return Math.round((r.getTime()-n.getTime())/864e5)+1}function En({from:e,to:t}){let n=Tn(e,t);return n===7?7:n===90?90:30}function Dn({value:e,onChange:t}){let n=Le(),r=(0,q.useMemo)(()=>`${En(e)}`,[e]);return(0,J.jsx)(h,{options:Cn,value:r,onChange:e=>{let r=Number(e);t(wn(r,n),r)},"aria-label":`Date range`})}var On={strokeDasharray:`3 3`,stroke:`var(--border-subtle)`,strokeOpacity:.4},kn={fontSize:12,fill:`var(--content-tertiary)`},An={stroke:`var(--border-subtle)`,strokeOpacity:.4},jn=[`#3b82f6`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`,`#ec4899`,`#84cc16`];function Mn({item:e}){return(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5 text-[13px] text-[var(--content-default)]`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,J.jsx)(`span`,{children:e.label}),(0,J.jsx)(`span`,{className:`ml-auto tabular-nums`,children:e.value})]})}function Nn({active:e,payload:t,hoveredKey:n,label:r,labelMap:i,colorMap:a,formatValue:o,showTotal:s,formatLabel:c}){if(!e||!t?.length)return null;let l=t.filter(e=>e.value!=null&&e.dataKey!=null).map(e=>({key:String(e.dataKey),label:i[String(e.dataKey)]??String(e.dataKey),value:o(Number(e.value)),color:a[String(e.dataKey)]??`#6b7280`,numericValue:Number(e.value)})).sort((e,t)=>e.numericValue===t.numericValue?e.label.localeCompare(t.label):t.numericValue-e.numericValue),u=n?l.find(e=>e.key===n):null,d=u?l.filter(e=>e.key!==n):l,f=l.reduce((e,t)=>e+t.numericValue,0);return(0,J.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-overlay)] px-3.5 py-2.5 shadow-[var(--shadow-popover)]`,children:[(0,J.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-[var(--content-secondary)]`,children:(c??et)(String(r))}),u&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Mn,{item:u}),d.length>0&&(0,J.jsx)(`div`,{className:`my-1.5 border-t border-[var(--border-subtle)]`})]}),d.map(e=>(0,J.jsx)(Mn,{item:e},e.key)),s&&(0,J.jsx)(`div`,{className:`mt-1 flex items-center gap-2 border-t border-[var(--border-subtle)] pt-1.5 text-[13px] font-semibold text-[var(--content-default)]`,children:(0,J.jsxs)(`span`,{children:[`Total: `,o(f)]})})]})}function Pn(e,t){let[n,r]=e,[i,a]=t,o=r-n||1;return e=>i+(e-n)/o*(a-i)}function Fn(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t,r;return r=n<=1?1:n<=2?2:n<=2.5?2.5:n<=5?5:10,r*t}function In(e){if(e>=1)return+!Number.isInteger(e);let t=e/10**Math.floor(Math.log10(e)),n=Math.abs(t-2.5)<.01;return Math.ceil(-Math.log10(e))+ +!!n}function Ln(e,t){let n=Math.max(0,...e),r=t?.tickCount??5;return n===0?t?.integerOnly?r:1:t?.integerOnly?Math.max(1,Math.ceil(n/r))*r:Fn(n/r)*r}function Rn(e,t){if(e===0)return[0];let n=e/t,r=10**(n>=1?0:Math.ceil(-Math.log10(n))+2),i=[];for(let e=0;e<=t;e++)i.push(Math.round(n*e*r)/r);return i}function zn(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return[`M${e},${t+a}`,`A${a},${a} 0 0 1 ${e+a},${t}`,`H${e+n-a}`,`A${a},${a} 0 0 1 ${e+n},${t+a}`,`V${t+r}`,`H${e}`,`Z`].join(``)}function Bn(e,t){if(e<=0)return[];if(t)return e<=3?Array.from({length:e},(e,t)=>t):[0,Math.floor(e/2),e-1];let n=Math.max(1,Math.ceil(e/Math.min(e,12))),r=[];for(let t=0;t<e;t+=n)r.push(t);return r[r.length-1]!==e-1&&r.push(e-1),r}var Vn=40,Hn={fontSize:11,fill:`var(--content-tertiary)`},Un={runtime_proxy_api:`#3b82f6`,oauth_proxy:`#f59e0b`};function Wn(e,t){return Un[e]??jn[t%jn.length]??`#6b7280`}function Gn(e,t){let n=new Set,r={};for(let t of e)for(let e of t.groups)n.add(e.group_key),r[e.group_key]=e.group_label;return{data:e.map(e=>{let n={date:e.date};for(let r of e.groups)n[r.group_key]=t===`spend`?parseFloat(r.total_usd):r.event_count;return n}),stackKeys:Array.from(n),labelMap:r}}function Kn({stackKeys:e,labelMap:t}){return(0,J.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-5 gap-y-1 pt-3 text-body-small-default`,children:e.map((e,n)=>(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-sm`,style:{backgroundColor:Wn(e,n)}}),(0,J.jsx)(`span`,{className:`text-[var(--content-quiet)]`,children:t[e]??e})]},e))})}var qn=350,Jn={top:8,right:4,bottom:32,left:0},Yn=.2,Xn=5,Zn=12,Qn=200;function $n({buckets:e,metric:t,onBarClick:n}){let r=ae(),i=(0,q.useRef)(null),[a,o]=(0,q.useState)(0);(0,q.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&o(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let{data:s,stackKeys:c,labelMap:l}=(0,q.useMemo)(()=>Gn(e,t),[e,t]),u=(0,q.useMemo)(()=>{let e={};for(let t=0;t<c.length;t++)e[c[t]]=Wn(c[t],t);return e},[c]),d=(0,q.useCallback)(e=>t===`spend`?`$${e.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2})}`:e.toLocaleString(`en-US`),[t]),[f,p]=(0,q.useState)(null),m=r?Vn:56,h=r?Hn:kn,g=Jn.left+m,_=Math.max(0,a-g-Jn.right),v=Jn.top,y=qn-Jn.top-Jn.bottom,b=(0,q.useMemo)(()=>s.map(e=>c.reduce((t,n)=>t+(Number(e[n])||0),0)),[s,c]),x=t===`events`,S=(0,q.useMemo)(()=>Ln(b,{integerOnly:x,tickCount:Xn}),[b,x]),C=(0,q.useMemo)(()=>Rn(S,Xn),[S]),w=(0,q.useCallback)(e=>{if(t===`spend`){if(e===0)return`$0`;let t=S/Xn,n=Math.max(t<1?2:0,In(t));return`$${e.toLocaleString(`en-US`,{minimumFractionDigits:n,maximumFractionDigits:n})}`}return e.toLocaleString(`en-US`)},[t,S]),T=(0,q.useMemo)(()=>Pn([0,S],[v+y,v]),[S,v,y]),E=s.length,D=E>0?_/E:0,O=D*(1-Yn),k=(D-O)/2,A=(0,q.useMemo)(()=>Bn(E,r),[E,r]),j=c.length===0,M=j?[]:s.map((e,t)=>{let n=g+t*D+k,r=0;return{di:t,x:n,segments:c.map((t,i)=>{let a=Number(e[t])||0,o=r;r+=a;let s=T(r),l=T(o)-s,u=i===c.length-1;return{key:t,val:a,x:n,y:s,h:l,color:Wn(t,i),isLast:u}})}}),N=(e,t,n)=>{let r=i.current?.getBoundingClientRect();r&&p({x:e.clientX-r.left,y:e.clientY-r.top,datumIndex:t,hoveredKey:n})},P=()=>p(null),F=e=>{n&&n(e)},I=f?c.filter(e=>(Number(s[f.datumIndex]?.[e])||0)>0).map(e=>({dataKey:e,value:Number(s[f.datumIndex]?.[e])||0})):[],L={left:f?Math.max(0,Math.min(f.x+Zn,a-Qn)):0,top:f?f.y-Zn:0,visibility:f?`visible`:`hidden`};return(0,J.jsxs)(`div`,{onMouseDown:e=>e.preventDefault(),children:[(0,J.jsx)(`div`,{ref:i,className:`relative w-full`,style:{height:qn},children:j?(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center text-body-medium-lighter text-[var(--content-faint)]`,children:`No usage data for this period`}):a>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`svg`,{width:a,height:qn,className:`block`,children:[C.map(e=>(0,J.jsx)(`line`,{x1:g,x2:g+_,y1:T(e),y2:T(e),stroke:On.stroke,strokeOpacity:On.strokeOpacity,strokeDasharray:On.strokeDasharray},e)),(0,J.jsx)(`line`,{x1:g,x2:g+_,y1:v+y,y2:v+y,stroke:An.stroke,strokeOpacity:An.strokeOpacity}),C.map(e=>(0,J.jsx)(`text`,{x:g-8,y:T(e),textAnchor:`end`,dominantBaseline:`middle`,fontSize:h.fontSize,fill:h.fill,children:w(e)},e)),A.map(e=>{let t=s[e];return t?(0,J.jsx)(`text`,{x:g+e*D+D/2,y:v+y+20,textAnchor:`middle`,fontSize:h.fontSize,fill:h.fill,children:et(String(t.date))},e):null}),M.map(({di:e,segments:t})=>t.map(t=>{if(t.h<=0)return null;let r=f?.hoveredKey&&f.hoveredKey!==t.key?.4:1,i={key:`${e}-${t.key}`,fill:t.color,opacity:r,cursor:n?`pointer`:void 0,onMouseMove:n=>N(n,e,t.key),onMouseLeave:P,onClick:()=>F(t.key)};return t.isLast?(0,J.jsx)(`path`,{...i,d:zn(t.x,t.y,O,t.h,3)}):(0,J.jsx)(`rect`,{...i,x:t.x,y:t.y,width:O,height:t.h})}))]}),(0,J.jsx)(`div`,{className:`pointer-events-none absolute z-[1] max-w-[calc(100vw-32px)] -translate-y-full`,style:L,children:(0,J.jsx)(Nn,{active:!!f,payload:I,hoveredKey:f?.hoveredKey??void 0,label:f?String(s[f.datumIndex]?.date):``,labelMap:l,colorMap:u,formatValue:d})})]}):null}),!j&&(0,J.jsx)(Kn,{stackKeys:c,labelMap:l})]})}function er(e=oe()){return wn(30,e)}function tr(e){if(e)return e.usageSource===`oauth_proxy`?`oauth_provider`:Ze(e.llmDimension??`model`)}function nr(e,t=oe()){return{from:e.dateRange.from,to:e.dateRange.to,tz:t,...e.drilldown?{usage_source:e.drilldown.usageSource,group_by:tr(e.drilldown)}:{}}}function rr(e,t=oe()){return{from:e.dateRange.from,to:e.dateRange.to,tz:t,...e.drilldown?{usage_source:e.drilldown.usageSource}:{}}}function ir(e){let t=Le(),n=u(Oe({query:nr(e,t)})),r=u(je({query:rr(e,t)}));return{series:n.data,totals:r.data,isLoading:n.isLoading||r.isLoading,isError:n.isError||r.isError}}var ar=[{value:`spend`,label:`Spend ($)`},{value:`events`,label:`Events`}];function or(e){if(e===void 0)return`—`;let t=parseFloat(e);return Number.isNaN(t)?`$0.00`:`$${t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2})}`}function sr(e){return e===void 0?`—`:e.toLocaleString(`en-US`)}function cr(){let e=Le(),[t,n]=(0,q.useState)(30),[r,i]=(0,q.useState)(()=>er(e)),a=(0,q.useMemo)(()=>t===null?r:wn(t,e),[t,r,e]),o=(e,t)=>{n(t),i(e)},[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(`spend`),{series:d,totals:f,isLoading:h,isError:g}=ir({dateRange:a,setDateRange:e=>{n(null),i(e)},drilldown:s,setDrilldown:c}),_=s?void 0:e=>{let t={runtime_proxy_api:`runtime_proxy`,oauth_proxy:`oauth_proxy`}[e];t&&c({usageSource:t,...t===`runtime_proxy`?{llmDimension:$e}:{}})};return(0,J.jsx)(m,{padding:`md`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(p,{as:`h2`,variant:`title-medium`,className:`text-[var(--content-default)]`,children:`Credit Usage`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`mt-2 text-[var(--content-tertiary)]`,children:`Overview of your spending habits.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 [&_[role=combobox]]:h-8 [&_[role=radio]]:h-7`,children:[(0,J.jsx)(Dn,{value:a,onChange:o}),(0,J.jsx)(`div`,{className:`w-44`,children:(0,J.jsx)(x,{items:ar,value:l,onChange:u,ariaLabel:`Chart metric`})})]})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:[(0,J.jsx)(S,{icon:(0,J.jsx)(We,{className:`h-4 w-4`,"aria-hidden":!0}),value:h?(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):or(f?.total_usd),label:`Spend`}),(0,J.jsx)(S,{icon:(0,J.jsx)(ot,{className:`h-4 w-4`,"aria-hidden":!0}),value:h?(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):sr(f?.event_count),label:`Events`})]}),s&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsxs)(`button`,{className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)]`,onClick:()=>c(null),children:[(0,J.jsx)(E,{className:`h-3.5 w-3.5`}),(0,J.jsx)(`span`,{children:`Back to all usage`}),(0,J.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:`/`}),(0,J.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:s.usageSource===`runtime_proxy`?`LLM Spend`:`OAuth Spend`})]})}),s.usageSource===`runtime_proxy`&&(0,J.jsx)(`div`,{className:`w-56`,children:(0,J.jsx)(x,{items:Qe,value:s.llmDimension??`model`,onChange:e=>c({usageSource:`runtime_proxy`,llmDimension:e}),ariaLabel:`LLM spend dimension`})})]}),h?(0,J.jsx)(`div`,{className:`flex h-[345px] items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,J.jsx)(R,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):g?(0,J.jsx)(`div`,{className:`flex h-[345px] items-center justify-center rounded-xl bg-[var(--surface-base)] text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Failed to load usage data.`}):d?(0,J.jsx)(`div`,{className:`rounded-xl bg-[var(--surface-base)] p-3`,children:(0,J.jsx)($n,{buckets:d.buckets,metric:l,onBarClick:_})}):null]})})}function lr(){let{data:e}=u(we()),t=Mt((0,q.useMemo)(()=>kt(e),[e]));if(!e||e.plan_id!==`pro`||e.status===`canceled`||!e.cancel_at_period_end&&!e.cancel_at)return null;let n=jt(e);return n?(0,J.jsx)(_,{tone:`info`,title:`Your Pro plan will end on ${At(n)}.`,actions:(0,J.jsx)(i,{variant:`outlined`,size:`compact`,onClick:()=>t.mutate({}),disabled:t.isPending,leftIcon:t.isPending?(0,J.jsx)(R,{className:`animate-spin`}):void 0,"data-testid":`grace-period-reactivate-button`,children:`Reactivate`}),"data-testid":`grace-period-banner`,children:`You'll keep Pro features until then.`}):null}var ur=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),dr=t(((e,t)=>{var n=ur();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),X=e(t(((e,t)=>{t.exports=dr()()}))(),1);function fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fr(Object(n),!0).forEach(function(t){hr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mr(e){"@babel/helpers - typeof";return mr=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},mr(e)}function hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gr(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function _r(e,t){if(e==null)return{};var n=gr(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vr(e,t){return yr(e)||br(e,t)||xr(e,t)||Cr()}function yr(e){if(Array.isArray(e))return e}function br(e,t){var n=e&&(typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`]);if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function xr(e,t){if(e){if(typeof e==`string`)return Sr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sr(e,t)}}function Sr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Cr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Z=function(e,t,n){var r=!!n,i=q.useRef(n);q.useEffect(function(){i.current=n},[n]),q.useEffect(function(){if(!r||!e)return function(){};var n=function(){i.current&&i.current.apply(i,arguments)};return e.on(t,n),function(){e.off(t,n)}},[r,t,e,i])},wr=function(e){var t=q.useRef(e);return q.useEffect(function(){t.current=e},[e]),t.current},Tr=function(e){return e!==null&&mr(e)===`object`},Er=function(e){return Tr(e)&&typeof e.then==`function`},Dr=function(e){return Tr(e)&&typeof e.elements==`function`&&typeof e.createToken==`function`&&typeof e.createPaymentMethod==`function`&&typeof e.confirmCardPayment==`function`},Or=`[object Object]`,kr=function e(t,n){if(!Tr(t)||!Tr(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var i=Object.prototype.toString.call(t)===Or;if(i!==(Object.prototype.toString.call(n)===Or))return!1;if(!i&&!r)return t===n;var a=Object.keys(t),o=Object.keys(n);if(a.length!==o.length)return!1;for(var s={},c=0;c<a.length;c+=1)s[a[c]]=!0;for(var l=0;l<o.length;l+=1)s[o[l]]=!0;var u=Object.keys(s);if(u.length!==a.length)return!1;var d=t,f=n;return u.every(function(t){return e(d[t],f[t])})},Ar=function(e,t,n){return Tr(e)?Object.keys(e).reduce(function(r,i){var a=!Tr(t)||!kr(e[i],t[i]);return n.includes(i)?(a&&console.warn(`Unsupported prop change: options.${i} is not a mutable property.`),r):a?pr(pr({},r||{}),{},hr({},i,e[i])):r},null):null},jr="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Mr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(e===null||Dr(e))return e;throw Error(t)},Nr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(Er(e))return{tag:`async`,stripePromise:Promise.resolve(e).then(function(e){return Mr(e,t)})};var n=Mr(e,t);return n===null?{tag:`empty`}:{tag:`sync`,stripe:n}},Pr=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:`react-stripe-js`,version:`6.4.0`}),e.registerAppInfo({name:`react-stripe-js`,version:`6.4.0`,url:`https://stripe.com/docs/stripe-js/react`}))},Fr=q.createContext(null);Fr.displayName=`ElementsContext`;var Ir=function(e,t){if(!e)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an <Elements> provider.`);return e},Lr=function(e){var t=e.stripe,n=e.options,r=e.children,i=q.useMemo(function(){return Nr(t)},[t]),a=vr(q.useState(function(){return{stripe:i.tag===`sync`?i.stripe:null,elements:i.tag===`sync`?i.stripe.elements(n):null}}),2),o=a[0],s=a[1];q.useEffect(function(){var e=!0,t=function(e){s(function(t){return t.stripe?t:{stripe:e,elements:e.elements(n)}})};return i.tag===`async`&&!o.stripe?i.stripePromise.then(function(n){n&&e&&t(n)}):i.tag===`sync`&&!o.stripe&&t(i.stripe),function(){e=!1}},[i,o,n]);var c=wr(t);q.useEffect(function(){c!==null&&c!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[c,t]);var l=wr(n);return q.useEffect(function(){if(o.elements){var e=Ar(n,l,[`clientSecret`,`fonts`]);e&&o.elements.update(e)}},[n,l,o.elements]),q.useEffect(function(){Pr(o.stripe)},[o.stripe]),q.createElement(Fr.Provider,{value:o},r)};Lr.propTypes={stripe:X.default.any,options:X.default.object};var Rr=function(e){return Ir(q.useContext(Fr),e)},zr=function(e){var t=e.children;return t(Rr(`mounts <ElementsConsumer>`))};zr.propTypes={children:X.default.func.isRequired};var Br=q.createContext(null);Br.displayName=`CheckoutContext`;var Vr=function(e){var t=q.useContext(Br),n=q.useContext(Fr);if(t){if(n)throw Error(`You cannot wrap the part of your app that ${e} in both a checkout provider and <Elements> provider.`);return t}else return Ir(n,e)},Hr=[`mode`],Ur=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},Q=function(e,t,n){var r=`${Ur(e)}Element`,i=t?function(e){Vr(`mounts <${r}>`);var t=e.id,n=e.className;return q.createElement(`div`,{id:t,className:n})}:function(t){var n=t.id,i=t.className,a=t.options,o=a===void 0?{}:a,s=t.onBlur,c=t.onFocus,l=t.onReady,u=t.onChange,d=t.onEscape,f=t.onClick,p=t.onLoadError,m=t.onLoaderStart,h=t.onNetworksChange,g=t.onConfirm,_=t.onCancel,v=t.onShippingAddressChange,y=t.onShippingRateChange,b=t.onSavedPaymentMethodRemove,x=t.onSavedPaymentMethodUpdate,S=t.onAvailablePaymentMethodsChange,C=Vr(`mounts <${r}>`),w=`elements`in C?C.elements:null,T=`checkoutState`in C?C.checkoutState:null,E=T?.type===`success`||T?.type===`loading`?T.sdk:null,D=vr(q.useState(null),2),O=D[0],k=D[1],A=q.useRef(null),j=q.useRef(null);Z(O,`blur`,s),Z(O,`focus`,c),Z(O,`escape`,d),Z(O,`click`,f),Z(O,`loaderror`,p),Z(O,`loaderstart`,m),Z(O,`networkschange`,h),Z(O,`confirm`,g),Z(O,`cancel`,_),Z(O,`shippingaddresschange`,v),Z(O,`shippingratechange`,y),Z(O,`savedpaymentmethodremove`,b),Z(O,`savedpaymentmethodupdate`,x),Z(O,`availablepaymentmethodschange`,S),Z(O,`change`,u);var M;l&&(M=e===`expressCheckout`?l:function(){l(O)}),Z(O,`ready`,M),q.useLayoutEffect(function(){if(A.current===null&&j.current!==null&&(w||E)){var t=null;if(E){var n=E,i=E;switch(e){case`paymentForm`:t=i.createForm(o);break;case`payment`:t=n.createPaymentElement(o);break;case`address`:if(`mode`in o){var a=o.mode,s=_r(o,Hr);if(a===`shipping`)t=n.createShippingAddressElement(s);else if(a===`billing`)t=n.createBillingAddressElement(s);else throw Error(`Invalid options.mode. mode must be 'billing' or 'shipping'.`)}else throw Error(`You must supply options.mode. mode must be 'billing' or 'shipping'.`);break;case`expressCheckout`:t=n.createExpressCheckoutElement(o);break;case`currencySelector`:t=E.createCurrencySelectorElement();break;case`taxId`:t=n.createTaxIdElement(o);break;case`contactDetails`:t=n.createContactDetailsElement();break;default:throw Error(`<${r}> is not supported inside a checkout provider. Use an <Elements> provider instead.`)}}else w&&(t=w.create(e,o));A.current=t,k(t),t&&t.mount(j.current)}},[w,E,o]);var N=wr(o);return q.useEffect(function(){if(A.current){var e=Ar(o,N,[`paymentRequest`]);e&&`update`in A.current&&A.current.update(e)}},[o,N]),q.useLayoutEffect(function(){return function(){if(A.current&&typeof A.current.destroy==`function`)try{A.current.destroy(),A.current=null}catch{}}},[]),q.createElement(`div`,{id:n,className:i,ref:j})};return i.propTypes={id:X.default.string,className:X.default.string,onChange:X.default.func,onBlur:X.default.func,onFocus:X.default.func,onReady:X.default.func,onEscape:X.default.func,onClick:X.default.func,onLoadError:X.default.func,onLoaderStart:X.default.func,onNetworksChange:X.default.func,onConfirm:X.default.func,onCancel:X.default.func,onShippingAddressChange:X.default.func,onShippingRateChange:X.default.func,onSavedPaymentMethodRemove:X.default.func,onSavedPaymentMethodUpdate:X.default.func,onAvailablePaymentMethodsChange:X.default.func,options:X.default.object},i.displayName=r,i.__elementType=e,i},$=typeof window>`u`,Wr=q.createContext(null);Wr.displayName=`EmbeddedCheckoutProviderContext`,Q(`auBankAccount`,$),Q(`card`,$),Q(`cardNumber`,$),Q(`cardExpiry`,$),Q(`cardCvc`,$),Q(`iban`,$),Q(`payment`,$),Q(`expressCheckout`,$),Q(`paymentRequestButton`,$),Q(`linkAuthentication`,$),Q(`contactDetails`,$),Q(`address`,$),Q(`shippingAddress`,$),Q(`paymentMethodMessaging`,$),Q(`taxId`,$),Q(`issuingCardNumberDisplay`,$),Q(`issuingCardCvcDisplay`,$),Q(`issuingCardExpiryDisplay`,$),Q(`issuingCardPinDisplay`,$),Q(`issuingCardCopyButton`,$);var Gr=`dahlia`,Kr=`https://js.stripe.com`,qr=`${Kr}/${Gr}/stripe.js`,Jr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Yr=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Xr=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,Zr=function(e){return Jr.test(e)||Yr.test(e)},Qr=function(){for(var e=document.querySelectorAll(`script[src^="${Kr}"]`),t=0;t<e.length;t++){var n=e[t];if(Zr(n.src))return n}return null},$r=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${qr}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},ei=null,ti=null,ni=null,ri=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},ii=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},ai=function(e){return ei===null?(ei=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(Xr),window.Stripe){t(window.Stripe);return}try{var r=Qr();if(r&&e)console.warn(Xr);else if(!r)r=$r(e);else if(r&&ni!==null&&ti!==null){var i;r.removeEventListener(`load`,ni),r.removeEventListener(`error`,ti),(i=r.parentNode)==null||i.removeChild(r),r=$r(e)}ni=ii(t,n),ti=ri(n),r.addEventListener(`load`,ni),r.addEventListener(`error`,ti)}catch(e){n(e);return}}),ei.catch(function(e){return ei=null,Promise.reject(e)})):ei},oi,si=!1,ci=function(){return oi||(oi=ai(null).catch(function(e){return oi=null,Promise.reject(e)}),oi)};Promise.resolve().then(function(){return ci()}).catch(function(e){si||console.warn(e)});function li(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)?{theme:`night`}:{theme:`stripe`}}function ui({open:e,onClose:t,onSavedOptimistic:n}){let r=d(ge()),{mutate:i,reset:a}=r;return(0,q.useEffect)(()=>{e||a()},[e,i,a]),(0,q.useMemo)(()=>li(),[r.data?.client_secret??null]),(0,J.jsx)(C.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(C.Content,{size:`sm`,children:[(0,J.jsx)(C.Header,{children:(0,J.jsx)(C.Title,{children:`Save Payment Method`})}),(0,J.jsx)(C.Body,{className:`min-h-[260px]`,children:(0,J.jsx)(di,{})})]})})}function di(){return(0,q.useEffect)(()=>{console.warn(`[AutoTopUpPaymentMethodModal] VITE_STRIPE_PUBLISHABLE_KEY is not set; the payment-method modal cannot mount Stripe Elements.`)},[]),(0,J.jsx)(_,{tone:`error`,children:`Payment method setup is currently unavailable. Please try again later.`})}function fi(){return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(p,{as:`h2`,variant:`title-medium`,className:`text-[var(--content-default)]`,children:`Payment Method`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`mt-2 text-[var(--content-tertiary)]`,children:`This is the payment method that will be used for automated credit reloads.`})]})}function pi(){let e=l(),t=u(W()),[n,r]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1),s=d(Pe()),c=async()=>{let t=Date.now(),n=e=>e?.stripe_payment_method_updated_at??null,r=n(e.getQueryData(_e()));try{await e.invalidateQueries({queryKey:_e()})}catch{}for(;Date.now()-t<2e4;){try{let t=await e.fetchQuery(W());if(t.has_payment_method&&n(t)!==r)return}catch{}await new Promise(e=>setTimeout(e,1500))}};if(t.isLoading)return(0,J.jsxs)(m,{padding:`md`,children:[(0,J.jsx)(fi,{}),(0,J.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),`Loading…`]})]});if(t.isError||!t.data)return(0,J.jsxs)(m,{padding:`md`,children:[(0,J.jsx)(fi,{}),(0,J.jsx)(`div`,{className:`mt-4`,children:(0,J.jsx)(_,{tone:`error`,children:`Failed to load payment method.`})})]});let f=t.data,h=Qt(f.payment_method_brand??`card`),v=f.payment_method_last4;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(m,{padding:`md`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(fi,{}),f.has_payment_method?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-[var(--surface-base)] px-2 py-1.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-6 shrink-0 items-center justify-center text-[var(--content-emphasised)]`,children:(0,J.jsx)(j,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(p,{variant:`body-medium-default`,as:`span`,children:h}),v?(0,J.jsxs)(p,{variant:`body-small-default`,as:`div`,className:`text-[var(--content-tertiary)]`,children:[`Ending in `,v]}):null]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(i,{variant:`ghost`,onClick:()=>r(!0),children:`Change`}),(0,J.jsx)(i,{variant:`ghost`,onClick:()=>o(!0),disabled:a||s.isPending,leftIcon:(0,J.jsx)(qe,{className:`h-3.5 w-3.5`}),children:`Remove`})]})]}):(0,J.jsx)(i,{className:`self-start`,onClick:()=>r(!0),children:`Add Card`})]})}),(0,J.jsx)(g,{open:a,title:`Remove payment method?`,message:`Removing your payment method will disable automatic top-ups. You can re-enable them after adding a new payment method.`,confirmLabel:s.isPending?`Removing…`:`Remove`,cancelLabel:`Keep`,destructive:!0,onConfirm:()=>{s.isPending||s.mutate({},{onSuccess:()=>{G(e,void 0,e=>e?{...e,enabled:!1,has_payment_method:!1,payment_method_brand:null,payment_method_last4:null}:ln),o(!1)},onError:()=>{w.error(`Failed to remove payment method. Please try again.`),o(!1)}})},onCancel:()=>{s.isPending||o(!1)}}),(0,J.jsx)(ui,{open:n,onClose:()=>r(!1),onSavedOptimistic:c})]})}var mi={invoices:[]};function hi(e){switch(e){case`paid`:return`positive`;case`open`:return`warning`;case`uncollectible`:return`negative`;default:return`neutral`}}function gi(e,t){let n=t.toUpperCase();try{let t=new Intl.NumberFormat(void 0,{style:`currency`,currency:n}),r=t.resolvedOptions().maximumFractionDigits??2;return t.format(e/10**r)}catch{return`${(e/100).toFixed(2)} ${n}`}}function _i(e){return Xe(new Date(e*1e3),{alwaysShowYear:!0})}function vi(e){let t=document.createElement(`a`);t.href=e,t.target=`_blank`,t.rel=`noopener noreferrer`,document.body.appendChild(t),t.click(),t.remove()}function yi({open:e,onOpenChange:t}){let[r,o]=(0,q.useState)(!1),s=u({queryKey:le(),enabled:e,queryFn:async({signal:e})=>{let{data:t,response:n}=await H({throwOnError:!1,signal:e});if(n?.status===404)return mi;if(!n?.ok||!t)throw Error(`Failed to load invoices (${n?.status??`network error`})`);return t}}),c=s.data?.invoices??[],l=c.some(e=>e.invoice_pdf!=null);async function d(){o(!0);try{let{data:e,response:t}=await ie({throwOnError:!1,parseAs:`blob`});if(!t?.ok||!(e instanceof Blob))throw Error(`Failed to download invoices (${t?.status??`network error`})`);let{saveFile:n}=await a(async()=>{let{saveFile:e}=await import(`./native-file-DIJL6af-.js`).then(e=>e.t);return{saveFile:e}},__vite__mapDeps([0,1,2,3]));await n(e,`invoices.zip`)}catch(e){n(e,{context:`download_all_invoices`}),w.error(`Failed to download invoices.`)}finally{o(!1)}}return(0,J.jsx)(C.Root,{open:e,onOpenChange:t,children:(0,J.jsxs)(C.Content,{size:`lg`,children:[(0,J.jsxs)(C.Header,{children:[(0,J.jsx)(C.Title,{icon:F,children:`Invoices`}),(0,J.jsx)(C.Description,{children:`Your billing history. Open an invoice for full details or download it as a PDF.`})]}),(0,J.jsx)(C.Body,{children:s.isLoading?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),(0,J.jsx)(p,{as:`span`,variant:`body-small-default`,children:`Loading invoices...`})]}):s.isError?(0,J.jsx)(_,{tone:`error`,children:`Failed to load invoices.`}):c.length===0?(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`py-6 text-center text-[var(--content-tertiary)]`,"data-testid":`invoices-empty`,children:`No Invoices Found`}):(0,J.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:c.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-3 py-3`,"data-testid":`invoice-row`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(p,{variant:`body-medium-default`,as:`span`,className:`text-[var(--content-default)]`,children:e.number??`Invoice`}),e.status&&(0,J.jsx)(v,{tone:hi(e.status),children:e.status})]}),(0,J.jsxs)(p,{variant:`body-small-default`,as:`div`,className:`text-[var(--content-tertiary)]`,children:[_i(e.created),` ·`,` `,gi(e.amount_due,e.currency)]})]}),e.hosted_invoice_url&&(0,J.jsx)(i,{asChild:!0,variant:`ghost`,size:`compact`,leftIcon:(0,J.jsx)(P,{}),children:(0,J.jsx)(`a`,{href:e.hosted_invoice_url,target:`_blank`,rel:`noopener noreferrer`,children:`View`})}),e.invoice_pdf&&(0,J.jsx)(i,{variant:`ghost`,size:`compact`,iconOnly:(0,J.jsx)(Ke,{}),"aria-label":`Download invoice PDF`,onClick:()=>vi(e.invoice_pdf)})]},e.id))})}),(0,J.jsxs)(C.Footer,{children:[l&&(0,J.jsx)(i,{variant:`outlined`,leftIcon:r?(0,J.jsx)(R,{className:`animate-spin`}):(0,J.jsx)(Ke,{}),disabled:r,onClick:d,children:`Download all`}),(0,J.jsx)(C.Close,{asChild:!0,children:(0,J.jsx)(i,{variant:`primary`,children:`Done`})})]})]})})}var bi={pro:{icon:M,actionLabel:`Manage`,actionVariant:`outlined`,actionTestId:`plan-card-manage-button`,showsRenewal:!0},base:{icon:st,actionLabel:`Upgrade to Pro`,actionVariant:`primary`,actionTestId:`plan-card-upgrade-button`,showsRenewal:!1}},xi=bi.base;function Si(){return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(p,{as:`h2`,variant:`title-medium`,className:`text-[var(--content-default)]`,children:`Plan`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`mt-2 text-[var(--content-tertiary)]`,children:`Manage which Vellum plan you're on.`})]})}function Ci({onManage:e}){let[t,n]=(0,q.useState)(!1),r=u(we()),a=u(de());if(r.isLoading||a.isLoading)return(0,J.jsxs)(m,{padding:`md`,children:[(0,J.jsx)(Si,{}),(0,J.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),(0,J.jsx)(p,{as:`span`,variant:`body-small-default`,children:`Loading plan...`})]})]});let o=r.data,s=a.data?.plans,c=s?.find(e=>e.id===o?.plan_id);if(r.isError||a.isError||!o||!s||!c)return(0,J.jsx)(_,{tone:`error`,children:`Failed to load plan.`});let l=bi[c.id]??xi,d=l.icon,f=c.name??c.id,h=l.showsRenewal&&(o.cancel_at_period_end===!0||!!o.cancel_at),g=o.status===`canceled`,v=jt(o),y=l.showsRenewal&&!h&&!g&&o.current_period_end,b=l.showsRenewal&&h&&!g&&v,x=c.id===`pro`?c:void 0,S=o.selected_credit_tier??null,C=S==null?void 0:x?.credit_tiers,w=C?.find(e=>e.tier===S),T=w?`${w.label} (${Y(w.price_cents)})`:C?.length?S:null;return(0,J.jsxs)(m,{padding:`lg`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsx)(Si,{}),(0,J.jsx)(i,{variant:`outlined`,leftIcon:(0,J.jsx)(F,{}),onClick:()=>n(!0),"data-testid":`plan-card-invoices-button`,children:`Invoices`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)]`,children:(0,J.jsx)(d,{className:`h-4 w-4 text-[var(--content-default)]`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,J.jsx)(p,{variant:`body-medium-default`,as:`div`,"data-testid":`plan-card-name`,children:f}),(0,J.jsx)(p,{variant:`body-small-default`,as:`div`,className:`leading-snug text-[var(--content-tertiary)]`,children:(0,J.jsx)(Jt,{features:c.included_features,variant:`inline`})})]}),(0,J.jsx)(i,{variant:l.actionVariant,onClick:e,"data-testid":l.actionTestId,children:l.actionLabel})]}),T&&(0,J.jsxs)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,"data-testid":`plan-card-credit-bundle`,children:[`Monthly credits: `,T]}),y&&(0,J.jsxs)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,"data-testid":`plan-card-renews`,children:[`Renews on `,At(o.current_period_end),`.`]}),b&&(0,J.jsxs)(p,{as:`p`,variant:`body-small-default`,className:`text-[var(--system-mid-strong)]`,"data-testid":`plan-card-cancels`,children:[`Your plan ends on `,At(v),`.`]})]}),(0,J.jsx)(yi,{open:t,onOpenChange:n})]})}var wi=`settings-referral-panel`;function Ti(e){return e.replace(/\.00$/,``)}function Ei(){let{data:e,isLoading:t,isError:n}=u(Te()),[r,a]=(0,q.useState)(!1),o=(0,q.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{a(!0),w.success(`Copied to clipboard!`),setTimeout(()=>a(!1),2e3)})},[]),s=e?.is_eligible_for_credits===!1,c=s?`Invite friends to Vellum. You'll start earning referral credits once you've purchased credits or upgraded to Pro.`:e?`Share Vellum with friends - you'll each earn ${Ti(e.referrer_credit_amount)} credits when they sign up, up to ${Ti(e.earning_cap)} total.`:`Share Vellum with friends and earn credits for every signup.`;return(0,J.jsx)(m,{padding:`md`,id:wi,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(p,{as:`h2`,variant:`title-medium`,className:`text-[var(--content-default)]`,children:`Earn Free Credits`}),(0,J.jsx)(p,{as:`p`,variant:`body-small-default`,className:`mt-2 text-[var(--content-tertiary)]`,children:c})]}),s&&(0,J.jsx)(_,{tone:`info`,children:`You're not currently earning referral credits. Buy credits or upgrade to Pro to start earning — your invite link still works in the meantime.`}),t?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),`Loading...`]}):n||!e?(0,J.jsx)(_,{tone:`error`,children:`Failed to load referral information.`}):(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-[200px] flex-1 items-center gap-1.5 rounded-lg bg-[var(--surface-base)] px-2 py-1.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-6 shrink-0 items-center justify-center text-[var(--content-emphasised)]`,children:(0,J.jsx)(We,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(`span`,{className:`flex items-baseline gap-1 text-body-medium-default`,children:[(0,J.jsx)(`span`,{children:Ti(e.total_earned)}),(0,J.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Credits Earned`})]})]}),(0,J.jsxs)(`div`,{className:`flex min-w-[200px] flex-1 items-center gap-1.5 rounded-lg bg-[var(--surface-base)] px-2 py-1.5`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`flex h-6 w-6 shrink-0 items-center justify-center text-[var(--content-emphasised)]`,children:(0,J.jsx)(Ge,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(`span`,{className:`flex items-baseline gap-1 text-body-medium-default`,children:[(0,J.jsx)(`span`,{children:e.referred_count}),(0,J.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Friends Referred`})]})]}),(0,J.jsx)(i,{variant:`outlined`,onClick:()=>o(e.referral_url),leftIcon:r?(0,J.jsx)(D,{className:`h-3.5 w-3.5`}):(0,J.jsx)(Ue,{className:`h-3.5 w-3.5`}),"data-testid":`referral-copy-button`,children:r?`Copied!`:`Copy Share Link`})]})]})})}function Di({icon:e,label:t,from:n,to:r}){return(0,J.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,J.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,style:{backgroundColor:`color-mix(in oklab, var(--system-positive-strong) 10%, transparent)`},children:(0,J.jsx)(e,{className:`h-4 w-4 text-[var(--system-positive-strong)]`})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:t}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)] line-through`,children:n}),(0,J.jsx)(ze,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`}),(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-default)]`,children:r})]})]})]})}function Oi({open:e,onClose:t}){let n=u({...K(),enabled:e}),r=u({...pe(),enabled:e}),a=n.data,o=a?.machine_size||`small`,s=a?.provisioned_storage_gib??null,c=r.data?.max_machine_tier??null,l=r.data?.selected_storage_gib??null,d=ee(c),f=d.length>0?d[d.length-1]:o,p=f!==o,m=l!=null&&(s==null||s<l),h=p||m,[g,v]=(0,q.useState)(null),y=Se({onSuccess:()=>{w.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),v(null),t()},onError:e=>{v(V(e,`Failed to resize assistant. Please try again.`))}}),b=y.isPending,x=n.isLoading||r.isLoading;return(0,J.jsx)(C.Root,{open:e,onOpenChange:e=>{e||(v(null),t())},children:(0,J.jsxs)(C.Content,{size:`sm`,children:[(0,J.jsxs)(C.Header,{children:[(0,J.jsx)(C.Title,{icon:te,children:`Plan Updated`}),(0,J.jsx)(C.Description,{children:`Your new resources are ready. Apply them now to resize your assistant — it will briefly restart.`})]}),(0,J.jsxs)(C.Body,{children:[x?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,J.jsx)(R,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):h?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[p&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Di,{icon:A,label:`Machine`,from:B[o],to:B[f]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-lg bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:`CPU`}),(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-default)]`,children:z[f].split(`,`)[0].trim()})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-lg bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,J.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:`Memory`}),(0,J.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-default)]`,children:z[f].split(`,`)[1].trim()})]})]})]}),m&&(0,J.jsx)(Di,{icon:I,label:`Storage`,from:s==null?`—`:`${s} GiB`,to:`${l} GiB`})]}):(0,J.jsx)(_,{tone:`neutral`,children:`Your assistant is already running at the maximum size for your plan.`}),g&&(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(_,{tone:`error`,children:g})})]}),(0,J.jsxs)(C.Footer,{children:[(0,J.jsx)(i,{variant:`ghost`,onClick:()=>{v(null),t()},children:`Do Later`}),(0,J.jsx)(i,{disabled:x||!h||b||!a?.id,leftIcon:b?(0,J.jsx)(R,{className:`animate-spin`}):void 0,onClick:()=>{if(!a?.id)return;v(null);let e={};p&&(e.machine_size=f),m&&l!=null&&(e.storage_gib=l),y.mutate({path:{id:a.id},body:e})},children:g?`Retry`:`Apply & Restart`})]})]})})}function ki(){let[e]=s(),t=o(),n=l();return(0,q.useEffect)(()=>{let r=e.get(`billing_status`);r&&(r===`success`?(w.success(`Payment received! Your credit balance will update shortly.`,{id:`billing-status`}),n.invalidateQueries({queryKey:Ae().queryKey})):r===`cancel`&&w.info(`Checkout was cancelled. No credits were added.`,{id:`billing-status`}),t(U.settings.billing,{replace:!0}))},[e,t,n]),null}function Ai(){let e=Re({platformHostedOnly:!0}),t=Re(),n=Be(),r=Ve(),[i,a]=s(),[o,l]=(0,q.useState)(!1),u=(0,q.useCallback)(()=>l(!0),[]),d=(0,q.useCallback)(()=>l(!1),[]),[f,p]=(0,q.useState)(!1),m=(0,q.useCallback)(()=>p(!0),[]);(0,q.useEffect)(()=>{i.has(`adjust_plan`)&&(l(!0),a(e=>{let t=new URLSearchParams(e);return t.delete(`adjust_plan`),t},{replace:!0}))},[i,a]);let h=i.has(`session_id`),g=(0,q.useCallback)(()=>{a(e=>{let t=new URLSearchParams(e);return t.delete(`session_id`),t},{replace:!0})},[a]);if(t===`gated`)return(0,J.jsx)(c,{replace:!0,to:U.settings.general});if(t===`disabled`)return(0,J.jsx)(`div`,{className:`space-y-4`,children:(0,J.jsx)(Je,{children:`Log in to the Vellum platform to manage billing and usage.`})});if(r)return(0,J.jsx)(`div`,{className:`space-y-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,J.jsx)(R,{className:`h-4 w-4 animate-spin`}),`Loading billing…`]})});let v=n;return!n&&e!==`gated`?(0,J.jsx)(`div`,{className:`space-y-4`,children:(0,J.jsx)(_,{tone:`warning`,children:`Billing isn't available for the current assistant state.`})}):(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(q.Suspense,{fallback:null,children:[(0,J.jsx)(ki,{}),(0,J.jsx)(Sn,{})]}),v&&(0,J.jsx)(lr,{}),v&&(0,J.jsx)(Ci,{onManage:u}),v&&(0,J.jsx)(Xt,{open:o,onClose:d,onTierUpgraded:m}),(0,J.jsx)(pi,{}),(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(hn,{})}),(0,J.jsx)(Ei,{}),(0,J.jsx)(cr,{}),v&&(0,J.jsx)(wt,{open:h,onClose:g}),v&&(0,J.jsx)(Oi,{open:f,onClose:()=>p(!1)})]})}export{Ai as BillingPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D-AX8Voo.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./typography-BscuIPxA.js";import{t as l}from"./card-BibIM9x3.js";import{n as u}from"./toast-sdJJ6aTV.js";import{t as d}from"./link-2-r_QPxX18.js";import{t as f}from"./loader-circle-BFRVtR3K.js";import{t as p}from"./triangle-alert-C3aHZq1F.js";import{a as m}from"./routes-C6gxiCrz.js";import{t as h}from"./use-active-assistant-id-BVzVN4_g.js";import{n as g,o as _}from"./contacts-gateway-BDJYh797.js";var v=e(t(),1),y=s();function b(e){let t=e[0];return typeof t==`object`&&!!t&&t._id===`contactsGet`}function x(e,t){switch(e){case`expired`:case`not_found`:return`This invite link has expired or already been used.`;case`already_redeemed_by_other`:return`This invite has already been claimed by someone else.`;case`sender_not_found`:return`The sender's assistant could not be found.`;case`not_platform_managed`:return`A2A invite links are only supported for platform-hosted assistants.`;default:return t||`Something went wrong. Please try again.`}}function S(){return(0,y.jsx)(C,{assistantId:h()})}function C({assistantId:e}){let t=r(),s=a(),[h]=i(),S=(0,v.useMemo)(()=>_(h),[h]),C=o({mutationFn:()=>{if(!S)throw Error(`Invalid invite link`);return g(e,{senderAssistantId:S.senderAssistantId,token:S.token})},onSuccess:e=>{e.success&&(s.invalidateQueries({predicate:e=>b(e.queryKey)}),e.alreadyConnected?u(`Already connected`):u(`Connected!`),t(m.contacts.root))}}),w=(0,v.useCallback)(()=>{t(m.contacts.root)},[t]),T=(0,v.useCallback)(()=>{C.mutate()},[C]),E=(0,v.useMemo)(()=>C.isError?C.error instanceof Error?C.error.message:`Something went wrong. Please try again.`:C.data&&!C.data.success?x(C.data.errorCode,C.data.error):null,[C.isError,C.error,C.data]);return S?(0,y.jsx)(`div`,{className:`flex min-h-full items-center justify-center p-6`,children:(0,y.jsx)(l,{className:`w-full max-w-md`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(d,{className:`h-6 w-6`,style:{color:`var(--content-secondary)`}}),(0,y.jsx)(c,{variant:`title-small`,children:`Connect assistants`})]}),(0,y.jsx)(c,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:`Accepting this link will create a trusted A2A connection between your assistant and the sender's.`}),E&&(0,y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md p-3`,style:{backgroundColor:`var(--surface-negative-subtle)`,color:`var(--system-negative-strong)`},children:[(0,y.jsx)(p,{className:`h-4 w-4 shrink-0`}),(0,y.jsx)(c,{variant:`body-small-default`,children:E})]}),(0,y.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,y.jsx)(n,{variant:`primary`,onClick:T,disabled:C.isPending,children:C.isPending?(0,y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(f,{className:`h-4 w-4 animate-spin`}),`Connecting…`]}):`Connect`}),(0,y.jsx)(n,{variant:`outlined`,onClick:w,disabled:C.isPending,children:`Cancel`})]})]})})}):(0,y.jsx)(`div`,{className:`flex min-h-full items-center justify-center p-6`,children:(0,y.jsx)(l,{className:`w-full max-w-md`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(p,{className:`h-6 w-6`,style:{color:`var(--system-negative-strong)`}}),(0,y.jsx)(c,{variant:`title-small`,children:`Invalid invite link`})]}),(0,y.jsx)(c,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:`The link you followed is missing required parameters and cannot be used.`}),(0,y.jsx)(`div`,{className:`flex gap-2 pt-2`,children:(0,y.jsx)(n,{variant:`primary`,onClick:w,children:`Go to Contacts`})})]})})})}export{S as ConnectPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-CVSDxk6A.js";import{t}from"./card-BibIM9x3.js";import{t as n}from"./checkbox-ueHEk2G-.js";import{a as r,i}from"./routes-C6gxiCrz.js";import{t as a}from"./setting-row-BGQgDyhv.js";var o=e(),s=[`[&_button[data-state=checked]]:bg-[var(--primary-base)]`,`[&_svg]:text-[var(--content-inset)]`,`[&_button[data-state=unchecked]]:bg-[var(--surface-base)]`,`[&_button[data-state=unchecked]]:border-[var(--border-element)]`].join(` `),c=`mb-2.5 ml-1 text-body-small-default font-medium uppercase tracking-wider text-[var(--content-tertiary)]`,l={privacy:{href:r.docs.legal.privacyPolicy,text:`Privacy and AI Data Sharing Policy`,aria:`I agree to the Privacy and AI Data Sharing Policy`},tos:{href:r.docs.legal.termsOfUse,text:`Terms of Service`,aria:`I agree to the Terms of Service`}};function u({kind:e,checked:t,onChange:r}){let a=l[e];return(0,o.jsx)(n,{checked:t,onCheckedChange:e=>r(e===!0),label:(0,o.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,o.jsx)(`a`,{href:i(a.href),target:`_blank`,rel:`noreferrer`,className:`underline`,children:a.text})]}),"aria-label":a.aria,className:s})}function d(){return(0,o.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function f({notes:e}){return!e||e.length===0?null:(0,o.jsxs)(`div`,{className:`rounded-r-md border-l-2 border-[var(--content-secondary)] bg-[var(--surface-base)] py-3 pl-3.5 pr-3.5`,children:[(0,o.jsx)(`p`,{className:`text-body-small-default font-medium text-[var(--content-secondary)]`,children:`What's changed`}),e.length===1?(0,o.jsx)(`p`,{className:`mt-1.5 text-body-medium-lighter text-[var(--content-default)]`,children:e[0]}):(0,o.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1.5`,children:e.map(e=>(0,o.jsxs)(`li`,{className:`flex gap-2.5 text-body-medium-lighter text-[var(--content-default)]`,children:[(0,o.jsx)(`span`,{"aria-hidden":!0,className:`mt-[0.5em] h-1 w-1 flex-none rounded-full bg-[var(--content-tertiary)]`}),(0,o.jsx)(`span`,{children:e})]},e))})]})}function p({electron:e,showAnalytics:n=!0,showDiagnostics:r=!0,shareAnalytics:i,shareDiagnostics:s,onShareAnalyticsChange:l,onShareDiagnosticsChange:u,className:f,style:p}){return(0,o.jsxs)(`section`,{className:f,style:p,children:[(0,o.jsx)(`p`,{className:c,children:`Privacy preferences`}),(0,o.jsx)(t,{padding:e?`sm`:`md`,className:`w-full`,children:(0,o.jsxs)(`div`,{className:`flex flex-col ${e?`gap-3`:`gap-4`}`,children:[n&&(0,o.jsx)(a,{label:`Share Analytics`,helperText:`Send aggregated product usage data`,checked:i,onChange:l}),n&&r&&(0,o.jsx)(d,{}),r&&(0,o.jsx)(a,{label:`Share Diagnostics`,helperText:`Send crash reports, conversation traces, and session replay data`,checked:s,onChange:u})]})})]})}function m({electron:e,showPrivacy:n=!0,showTos:r=!0,privacyConsent:i,tosAccepted:a,onPrivacyChange:s,onTosChange:l,privacyNotes:d,tosNotes:p,className:m,style:h}){return(0,o.jsxs)(`section`,{className:m,style:h,children:[(0,o.jsx)(`p`,{className:c,children:`Agreements`}),(0,o.jsx)(t,{padding:e?`sm`:`md`,className:`w-full`,children:(0,o.jsxs)(`div`,{className:`flex flex-col ${e?`gap-3.5`:`gap-4`}`,children:[n&&(0,o.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,o.jsx)(f,{notes:d}),(0,o.jsx)(u,{kind:`privacy`,checked:i,onChange:s})]}),r&&(0,o.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,o.jsx)(f,{notes:p}),(0,o.jsx)(u,{kind:`tos`,checked:a,onChange:l})]})]})})]})}export{p as n,m as t};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./api-errors-DPruG7q9.js";import{t as r}from"./client.gen-BHupOCJH.js";import{a as i}from"./routes-C6gxiCrz.js";function a(e){let t=typeof window<`u`?window.location.origin:``,n=new URLSearchParams({senderAssistantId:e.senderAssistantId,token:e.token});return`${t}${i.connect}?${n.toString()}`}function o(e){let t=e.get(`senderAssistantId`)?.trim(),n=e.get(`token`)?.trim();return!t||!n?null:{senderAssistantId:t,token:n}}async function s(i,a){let{data:o,error:s,response:c}=await r.post({url:`/v1/assistants/{assistant_id}/contacts/`,path:{assistant_id:i},body:a,headers:{"Content-Type":`application/json`},throwOnError:!1});if(e(c,s,`Failed to save contact`),!c.ok||!o?.contact)throw new n(c.status,t(s,c,`Failed to save contact`));return o.contact}async function c(i,a){let{error:o,response:s}=await r.delete({url:`/v1/assistants/{assistant_id}/contacts/{contact_id}/`,path:{assistant_id:i,contact_id:a},throwOnError:!1});if(e(s,o,`Failed to delete contact`),!s.ok&&s.status!==204)throw new n(s.status,t(o,s,`Failed to delete contact`))}async function l(i,a){let{error:o,response:s}=await r.post({url:`/v1/assistants/{assistant_id}/contact-channels/{channel_id}/verify/`,path:{assistant_id:i,channel_id:a},throwOnError:!1});if(e(s,o,`Failed to verify channel`),!s.ok)throw new n(s.status,t(o,s,`Failed to verify channel`))}async function u(i,a){let{data:o,error:s,response:c}=await r.post({url:`/v1/assistants/{assistant_id}/a2a/invites/redeem/`,path:{assistant_id:i},body:{sender_assistant_id:a.senderAssistantId,token:a.token},headers:{"Content-Type":`application/json`},throwOnError:!1});if(e(c,s,`Failed to redeem A2A invite`),!c.ok)throw new n(c.status,t(s,c,`Failed to redeem A2A invite`));return{success:o?.success??!0,alreadyConnected:o?.already_connected,error:o?.error,errorCode:o?.error_code}}export{a,l as i,u as n,o,s as r,c as t};
@@ -1,9 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D-AX8Voo.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./useMutation-Lj4VunQV.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./typography-BscuIPxA.js";import{t as u}from"./card-BibIM9x3.js";import{t as d}from"./dropdown-ChWAdhLG.js";import{t as f}from"./panel-item-Q1g7DFJw.js";import{t as p}from"./confirm-dialog-bfBx6UYv.js";import{t as m}from"./tag-CW6WC4fE.js";import{t as h}from"./input-D4W4p0pZ.js";import{t as g}from"./modal-BNAVT2FK.js";import{n as _}from"./toast-sdJJ6aTV.js";import{t as v}from"./createLucideIcon-BlMXrA59.js";import{t as y}from"./arrow-left-CP-EhDNF.js";import{t as b}from"./check-D6WkI0gF.js";import{t as x}from"./chevron-right-B6vEpVY0.js";import{t as S}from"./link-2-r_QPxX18.js";import{t as C}from"./loader-circle-BFRVtR3K.js";import{t as w}from"./pencil-B90pDI55.js";import{t as T}from"./user-plus-COoYKnWs.js";import{Bt as E,C as D,Gt as O,Kt as k,Wt as A,qt as ee}from"./sdk.gen-zA5ns5LT.js";import{B as te,H as ne,Nt as re,Pt as ie,U as ae,V as oe,_ as se,a as ce,o as le,s as ue,v as de,y as j}from"./react-query.gen-BwkZCSTW.js";import{n as M,r as fe,t as N}from"./api-errors-DPruG7q9.js";import{t as P}from"./client.gen-BHupOCJH.js";import{a as F}from"./routes-C6gxiCrz.js";import{t as pe}from"./assistant-identity-store-cODRsfVo.js";import{n as me}from"./viewer-store-BR99G-Ii.js";import{t as I}from"./conversation-store-B8D6wE18.js";import{t as he}from"./assistant-feature-flag-store-Btrsn1VW.js";import{t as ge}from"./conversation-selection-CNssqGbG.js";import{t as _e}from"./public-asset-C2P77n3W.js";import{Aa as ve,Ea as L,Ft as ye,Li as be,Ni as xe,Oa as Se,Pt as Ce,Si as R,Vi as z,a as we,da as B,ea as V,i as Te,ki as H,xi as U}from"./index-B-S-gNKm.js";import{t as Ee}from"./use-active-assistant-id-BVzVN4_g.js";import{n as De,t as Oe}from"./mobile-sidebar-drawer-BA9ERuJ7.js";import{t as W}from"./detail-card-EsA9SOvZ.js";import{a as ke,i as Ae,r as je,t as Me}from"./contacts-gateway-BDJYh797.js";import{t as G}from"./mutation-error-Iab5I7oz.js";var K=v(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ne=v(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Pe=v(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),q=e(t(),1),J=c();function Y({role:e,contactType:t}){let{label:n,tone:r}=X(e,t);return(0,J.jsx)(m,{tone:r,children:n})}function X(e,t){switch(e){case`guardian`:return{label:`Guardian`,tone:`positive`};case`assistant`:return{label:`Assistant`,tone:`negative`};default:return t===`assistant`?{label:`Assistant`,tone:`negative`}:{label:`Human`,tone:`warning`}}}function Z({onClick:e}){return(0,J.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:(0,J.jsx)(S,{className:`h-3.5 w-3.5`}),onClick:e,children:`Share Connection Link`})}function Fe({assistantName:e,connected:t=!1,children:n}){return(0,J.jsx)(`div`,{className:`pl-7`,children:(0,J.jsxs)(u.Root,{children:[(0,J.jsx)(u.Header,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`img`,{src:_e(`/images/integrations/slack.svg`),alt:``,className:`size-8 rounded-lg bg-[var(--surface-sunken)] p-1`}),(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(l,{as:`span`,variant:`body-medium-default`,children:t?`Slack settings`:`Slack setup`}),t?(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,J.jsx)(`span`,{className:`size-2 rounded-full bg-[var(--system-positive-strong)]`}),`Connected as `,e]}):null]})]})}),(0,J.jsx)(u.Body,{children:n})]})})}var Ie=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],Le=new Set([`platform`,`a2a`]),Re=new Set([`vellum`,`whatsapp`]);function ze(e){return Re.has(e)}var Be={no_one:`No one`,guardian_only:`Only you`,trusted_contacts:`Verified contacts`,any_contact:`Any contact`,strangers:`Strangers`},Ve={no_one:`Hard-deny every inbound message on this channel.`,guardian_only:`Only messages sent by you are admitted.`,trusted_contacts:`Admit verified contacts and the guardian; deny everyone else.`,any_contact:`Admit any matched contact (verified or pending) and the guardian.`,strangers:`Admit everyone, including unrecognised senders.`},He=Ie.map(e=>({value:e,label:Be[e],tooltip:Ve[e]})),Ue={no_one:{title:`Block all messages?`,message:`Setting this channel to “No one” hard-denies every inbound message — including messages from you.
2
-
3
- You can reverse this at any time.`,confirmLabel:`Block all`,destructive:!0},any_contact:{title:`Allow any contact?`,message:`“Any contact” admits every matched contact in this channel — including pending, unverified ones — not just your verified contacts.
4
-
5
- Best for channels consisting of only people you already trust.`,confirmLabel:`Allow any contact`},strangers:{title:`Allow strangers?`,message:`Are you sure you want to allow strangers to contact your assistant through this channel?
6
-
7
- Doing so could cost you money and open you up to security and privacy vulnerabilities.
8
-
9
- Enable with extreme caution.`,confirmLabel:`Allow strangers`,destructive:!0}},We={slack:{label:`Slack`,Icon:V,disconnectMessage:`This clears the stored Slack bot and app tokens for this assistant. You can reconnect later.`},telegram:{label:`Telegram`,Icon:U,disconnectMessage:`This clears the stored Telegram bot token for this assistant. You can reconnect later.`},phone:{label:`Phone Calling`,Icon:xe,disconnectMessage:`This clears the stored Twilio credentials for this assistant. You can reconnect later.`}};function Ge({assistantName:e,channels:t,pendingChannelKey:n=null,slackThreadMode:r,slackThreadModePending:i=!1,channelPolicies:a,policySavingKey:o=null,policiesLoading:s=!1,policiesError:c=!1,onChannelPolicyChange:l,onSetup:u,onDisconnect:d,onSaveTelegramToken:f,onSaveSlackConfig:m,slackSaveStatus:h,slackSaveError:g,onSlackThreadModeChange:_,onSaveTwilioCredentials:v,onGenerateInviteLink:y,initialExpandedChannel:b=null}){let x=e.trim()||`your assistant`,[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(()=>b?new Set([b]):new Set),[E,D]=(0,q.useState)(null),O=S?We[S]:null,k=E?Ue[E.policy]:null,A=(e,t)=>{if(Ue[t]){D({channelKey:e,policy:t});return}l?.(e,t)},ee=e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)(W,{title:`${x} (Your Assistant)`,accessory:(0,J.jsx)(Y,{role:`assistant`}),compactAccessory:!0}),(0,J.jsx)(W,{title:`Channels`,subtitle:`Manage where ${x} can be reached.`,children:(0,J.jsx)(`div`,{className:`flex flex-col`,children:t.map((t,p)=>(0,J.jsxs)(`div`,{children:[p>0?(0,J.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}):null,(0,J.jsx)(Ke,{channel:t,assistantName:e,pending:n===t.key,expanded:w.has(t.key),onToggleExpand:()=>ee(t.key),onSetup:t.key===`slack`?()=>{T(e=>{let n=new Set(e);return n.add(t.key),n})}:u?()=>u(t.key):void 0,onDisconnect:d?()=>C(t.key):void 0,onSaveTelegramToken:f,onSaveSlackConfig:m,slackSaveStatus:h,slackSaveError:g,slackThreadMode:r,slackThreadModePending:i,onSlackThreadModeChange:_,onSaveTwilioCredentials:v,policy:a?.[t.key],policySaving:o===t.key,policyLoading:s,policyError:c,onPolicyChange:l?e=>A(t.key,e):void 0})]},t.key))})}),y?(0,J.jsx)(Z,{onClick:y}):null,(0,J.jsx)(p,{open:S!==null,title:`Disconnect ${O?.label??``}?`,message:O?.disconnectMessage??``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{S&&d&&d(S),C(null)},onCancel:()=>C(null)}),(0,J.jsx)(p,{open:E!==null,title:k?.title??``,message:k?.message??``,confirmLabel:k?.confirmLabel??`Confirm`,destructive:k?.destructive??!1,onConfirm:()=>{E&&l?.(E.channelKey,E.policy),D(null)},onCancel:()=>D(null)})]})}function Ke({channel:e,assistantName:t,pending:r,expanded:i,onToggleExpand:a,onSetup:o,onDisconnect:s,onSaveTelegramToken:c,onSaveSlackConfig:l,slackSaveStatus:u,slackSaveError:d,slackThreadMode:f,slackThreadModePending:p=!1,onSlackThreadModeChange:m,onSaveTwilioCredentials:h,policy:g,policySaving:_=!1,policyLoading:v=!1,policyError:y=!1,onPolicyChange:b}){let S=We[e.key],C=e.status===`ready`;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-center`,onClick:a,style:{color:`var(--content-secondary)`},children:i?(0,J.jsx)(Se,{className:`h-4 w-4`}):(0,J.jsx)(x,{className:`h-4 w-4`})}),(0,J.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:S.label}),e.address?(0,J.jsx)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.address}):null,(0,J.jsx)(`div`,{className:`ml-auto flex items-center gap-2`,children:C?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),`Connected`]}),(0,J.jsx)(n,{type:`button`,variant:`danger`,onClick:s,disabled:!s||r,children:r?`Disconnecting…`:`Disconnect`})]}):(0,J.jsx)(n,{type:`button`,variant:`outlined`,onClick:o,disabled:!o||r,children:r?`Opening…`:`Set up`})})]}),i?(0,J.jsxs)(`div`,{className:C?`flex flex-col gap-4`:void 0,children:[C&&b?(0,J.jsx)(qe,{policy:g,saving:_,loading:v,error:y,onChange:b}):null,e.key===`telegram`?(0,J.jsx)(Q,{onSave:c}):null,e.key===`slack`?(0,J.jsx)(Fe,{assistantName:t,connected:C,children:(0,J.jsx)(we,{assistantName:t,connected:C,onSave:l,saveStatus:u,saveError:d,threadMode:f,threadModePending:p,onThreadModeChange:m})}):null,e.key===`phone`?(0,J.jsx)(Je,{onSave:h}):null]}):null]})}function qe({policy:e,saving:t=!1,loading:n=!1,error:r=!1,onChange:i}){let a=e??`trusted_contacts`;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 pl-7`,children:[(0,J.jsx)(l,{as:`span`,variant:`body-small-emphasised`,className:`text-[color:var(--content-secondary)]`,children:`Who Can Reach`}),n?(0,J.jsx)(l,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:`Loading…`}):r?(0,J.jsx)(l,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-negative)]`,children:`Couldn’t load this setting. Try reopening this page.`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{style:{maxWidth:280},children:(0,J.jsx)(d,{value:a,onChange:i,options:He,disabled:t,"aria-label":`Channel trust floor`})}),(0,J.jsx)(l,{as:`span`,variant:`body-small-default`,className:`text-[color:var(--content-tertiary)]`,children:Ve[a]})]})]})}function Q({onSave:e}){let[t,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t.trim().length>0&&!i;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 pl-7`,children:[(0,J.jsx)(h,{label:`Bot Token`,type:`password`,value:t,onChange:e=>r(e.target.value),placeholder:`Paste your Telegram bot token`,disabled:i,fullWidth:!0}),o?(0,J.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:o}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!c)){a(!0),s(null);try{await e(t.trim()),r(``)}catch(e){s(e instanceof Error?e.message:`Failed to save`)}finally{a(!1)}}},disabled:!c,children:i?`Saving…`:`Save`})})]})}function Je({onSave:e}){let[t,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),u=t.trim().length>0&&i.trim().length>0&&!o;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 pl-7`,children:[(0,J.jsx)(h,{label:`Account SID`,type:`text`,value:t,onChange:e=>r(e.target.value),placeholder:`ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,disabled:o,fullWidth:!0}),(0,J.jsx)(h,{label:`Auth Token`,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:`Twilio auth token`,disabled:o,fullWidth:!0}),c?(0,J.jsx)(`p`,{className:`text-label-small`,style:{color:`var(--content-negative)`},children:c}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(n,{type:`button`,onClick:async()=>{if(!(!e||!u)){s(!0),l(null);try{await e(t.trim(),i.trim()),r(``),a(``)}catch(e){l(e instanceof Error?e.message:`Failed to save`)}finally{s(!1)}}},disabled:!u,children:o?`Saving…`:`Save`})})]})}var Ye=new Set([`telegram`,`phone`,`vellum`,`whatsapp`,`slack`,`email`,`platform`,`a2a`]);function $(e){return Ye.has(e)}function Xe(e,t){return e.id===`a2a`?t&&t.status!==`revoked`?{kind:`connected`}:{kind:`setup`}:t?.status===`verified`||t?.status===`active`&&t?.verifiedAt!=null?{kind:`verified`}:t?.status===`blocked`?{kind:`none`}:t&&t.status!==`revoked`?{kind:`unverified`}:{kind:`setup`}}function Ze(e,t,n){let r=[],i=new Set;if(e)for(let t of e)t.id===`a2a`&&!n||(r.push(t),i.add(t.id));for(let e of t)e.status===`revoked`||i.has(e.type)||e.type===`a2a`&&!n||$(e.type)&&(r.push({id:e.type,label:e.type.charAt(0).toUpperCase()+e.type.slice(1),subtitle:``,icon:`help-circle`,supportsVerification:!1,setupMessages:{guardian:``,contact:``}}),i.add(e.type));return r}function Qe({name:e,className:t,style:n}){switch(e){case`bot`:return(0,J.jsx)(ve,{className:t,style:n});case`hash`:return(0,J.jsx)(V,{className:t,style:n});case`send`:return(0,J.jsx)(U,{className:t,style:n});case`phone`:return(0,J.jsx)(xe,{className:t,style:n});case`mail`:return(0,J.jsx)(z,{className:t,style:n});case`message-square`:return(0,J.jsx)(be,{className:t,style:n});default:return(0,J.jsx)(K,{className:t,style:n})}}function $e({contactChannels:e,availableChannels:t,a2aEnabled:n,setupLabel:r=`Invite`,verifyLoading:i,verifySubject:a=`self`,onSetupChannel:o,onVerifyChannel:s,onRevokeChannel:c}){let[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),m=new Map;for(let t of e)t.status!==`revoked`&&(m.has(t.type)||m.set(t.type,t));return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`flex flex-col`,children:Ze(t,e,n).map((e,t)=>{let n=m.get(e.id);return(0,J.jsxs)(`div`,{children:[t>0&&(0,J.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),(0,J.jsx)(et,{info:e,existing:n,setupLabel:r,verifyLoading:i,onSetup:o?()=>o(e.id):void 0,onVerify:s&&e.supportsVerification?()=>u(e):void 0,onRevoke:c&&n?()=>f({channelId:n.id,channel:e}):void 0})]},e.id)})}),l&&(0,J.jsx)(p,{open:!0,title:`Verify ${l.label}`,message:a===`contact`?`This will mark this contact's ${l.label} channel as verified. Your assistant will recognize them when they reach out from it.`:`This will mark your ${l.label} channel as verified. Your assistant will recognize you when you reach out from it.`,confirmLabel:`Verify`,onConfirm:()=>{l&&(s?.(l.id),u(null))},onCancel:()=>u(null)}),d&&(0,J.jsx)(p,{open:!0,title:`Revoke ${d.channel.label}`,message:`This will disconnect the verified channel. The contact will need to re-verify to use this channel again.`,confirmLabel:`Revoke`,destructive:!0,onConfirm:()=>{c?.(d.channelId,d.channel.id),f(null)},onCancel:()=>f(null)})]})}function et({info:e,existing:t,setupLabel:r,verifyLoading:i,onSetup:a,onVerify:o,onRevoke:s}){let c=Xe(e,t);return(0,J.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,J.jsx)(Qe,{name:e.icon,className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,J.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),t?.address?(0,J.jsx)(`span`,{className:`truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.address}):null,(0,J.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:c.kind===`connected`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),`Connected`]}),s?(0,J.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):c.kind===`verified`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 h-8 px-2.5 rounded-md whitespace-nowrap select-none text-body-small-emphasised leading-none bg-[var(--content-default)] text-[var(--surface-base)]`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),`Verified`]}),s?(0,J.jsx)(n,{variant:`danger`,onClick:s,children:`Revoke`}):null]}):c.kind===`unverified`?(0,J.jsx)(n,{variant:`outlined`,onClick:o,disabled:!o||i,children:i?`Verifying…`:`Verify`}):c.kind===`setup`?e.id===`a2a`?null:(0,J.jsx)(n,{variant:`outlined`,onClick:a,disabled:!a,children:r}):null})]})}function tt(e){return(0,J.jsx)(nt,{...e},e.contact.id)}function nt({contact:e,savePending:t,deletePending:r,verifyPending:i,mergePending:a=!1,canMerge:o=!1,availableChannels:s,a2aEnabled:c,onSave:l,onDelete:u,onMerge:d,onSetupChannel:f,onVerifyChannel:m,onRevokeChannel:g}){let _=e.displayName===`New Contact`,[v,y]=(0,q.useState)(_?``:e.displayName),[b,x]=(0,q.useState)(e.notes??``),[S,C]=(0,q.useState)(!1),w=v.trim(),T=b.trim(),E=_?``:e.displayName,D=e.notes??``,O=w!==E||T!==D,k=w.length>0&&O&&!t&&!r,A=_&&e.channels.length===0&&e.interactionCount===0,ee=w||e.displayName,te=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)(W,{title:ee,accessory:(0,J.jsx)(Y,{role:e.role,contactType:e.contactType}),compactAccessory:!0,subtitle:te,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(h,{label:`Name`,type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Give this human a name`,autoFocus:_,disabled:t||r,fullWidth:!0}),(0,J.jsx)(h,{label:`Notes`,type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:`Optional notes about the human which AI will take into account`,disabled:t||r,fullWidth:!0}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(n,{type:`button`,onClick:()=>l({displayName:w,notes:T}),disabled:!k,children:t?`Saving…`:`Save`}),d?(0,J.jsx)(n,{type:`button`,variant:`outlined`,onClick:d,disabled:!o||A||O||a||t||r,title:o?A?`Save this contact before merging`:O?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:a?`Merging…`:`Merge…`}):null,(0,J.jsx)(n,{type:`button`,variant:`danger`,onClick:()=>{A?u():C(!0)},disabled:r,children:r?`Deleting…`:`Delete Contact`})]})]})}),(0,J.jsx)(W,{title:`Channels`,subtitle:`Once verified, your assistant will recognize this contact when they message from these channels.`,children:(0,J.jsx)($e,{contactChannels:e.channels,availableChannels:s,a2aEnabled:c,verifyLoading:i,verifySubject:`contact`,onSetupChannel:f,onVerifyChannel:m,onRevokeChannel:g})}),(0,J.jsx)(p,{open:S,title:`Delete ${e.displayName}?`,message:`This will permanently delete this contact and all their channels. This action cannot be undone.`,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>{C(!1),u()},onCancel:()=>C(!1)})]})}function rt(e){return(0,J.jsx)(it,{...e},`${e.survivor.id}:${e.open?`open`:`closed`}`)}function it({open:e,survivor:t,candidates:r,pending:i,errorMessage:a,onMerge:o,onClose:s}){let[c,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{d&&!r.some(e=>e.id===d)&&f(null)},[r,d]);let p=(0,q.useMemo)(()=>{let e=c.trim().toLowerCase();return e?r.filter(t=>t.displayName.toLowerCase().includes(e)):r},[r,c]),m=d?r.find(e=>e.id===d)??null:null,h=lt(t);return(0,J.jsx)(g.Root,{open:e,onOpenChange:e=>{!e&&!i&&s()},children:(0,J.jsxs)(g.Content,{size:`md`,children:[(0,J.jsxs)(g.Header,{children:[(0,J.jsx)(g.Title,{icon:Pe,children:m?`Merge "${m.displayName}" into ${h}?`:`Merge another contact into ${h}`}),(0,J.jsx)(g.Description,{children:m?`Channels and notes from the merged contact will move over. The merged contact will be deleted.`:`The contact you pick will be deleted. Its channels and notes will be added to this one.`})]}),(0,J.jsxs)(g.Body,{className:`flex flex-col gap-3`,children:[m?(0,J.jsx)(st,{survivor:t,donor:m}):r.length===0?(0,J.jsx)(ct,{}):(0,J.jsx)(at,{search:c,onSearch:u,candidates:p,onPick:f}),a?(0,J.jsx)(l,{as:`p`,variant:`body-small-default`,className:`text-(--system-negative-strong)`,role:`alert`,children:a}):null]}),(0,J.jsx)(g.Footer,{children:m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n,{variant:`outlined`,onClick:()=>f(null),disabled:i,leftIcon:(0,J.jsx)(y,{"aria-hidden":!0}),children:`Back`}),(0,J.jsx)(n,{variant:`danger`,onClick:()=>o(m.id),disabled:i,children:i?`Merging…`:`Merge`})]}):(0,J.jsx)(n,{variant:`outlined`,onClick:s,disabled:i,children:`Cancel`})})]})})}function at({search:e,onSearch:t,candidates:n,onPick:r}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(h,{type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:`Search contacts`,leftIcon:(0,J.jsx)(R,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}),(0,J.jsx)(`div`,{className:`flex max-h-[320px] min-h-[120px] flex-col gap-1 overflow-y-auto`,role:`listbox`,"aria-label":`Select a contact to merge`,children:n.length===0?(0,J.jsx)(l,{as:`p`,variant:`body-small-default`,className:`px-3 py-4 text-center text-(--content-tertiary)`,children:`No matching contacts`}):n.map(e=>(0,J.jsx)(ot,{contact:e,onPick:()=>r(e.id)},e.id))})]})}function ot({contact:e,onPick:t}){let n=pt(e).join(` | `)||void 0;return(0,J.jsx)(f,{asChild:!0,label:``,children:(0,J.jsx)(`button`,{type:`button`,onClick:t,role:`option`,"aria-selected":`false`,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e.displayName}),n?(0,J.jsx)(`span`,{className:`truncate text-body-small-default text-(--content-tertiary)`,children:n}):null]})})})}function st({survivor:e,donor:t}){let n=lt(e),{moved:r,duplicates:i}=ft(e,t);return(0,J.jsxs)(`ul`,{className:`flex flex-col gap-2 text-body-medium-lighter text-(--content-secondary)`,children:[(0,J.jsxs)(`li`,{children:[(0,J.jsxs)(`span`,{className:`text-(--content-default)`,children:[`“`,t.displayName,`”`]}),` `,`will be deleted.`]}),(0,J.jsx)(`li`,{children:r.length===0?`No new channels will move to ${n}.`:`${r.length} channel${r.length===1?``:`s`} will move to ${n}: ${r.map(e=>dt(e.type)).join(`, `)}.`}),i.length>0?(0,J.jsxs)(`li`,{className:`text-(--content-tertiary)`,children:[i.length,` duplicate channel`,i.length===1?``:`s`,` already on `,n,` `,`(skipped).`]}):null,t.notes?(0,J.jsx)(`li`,{children:`Notes from the merged contact will be appended.`}):null,(0,J.jsx)(`li`,{className:`text-(--content-tertiary)`,children:`This cannot be undone.`})]})}function ct(){return(0,J.jsx)(l,{as:`p`,variant:`body-medium-lighter`,className:`px-3 py-6 text-center text-(--content-tertiary)`,children:`No other contacts available to merge.`})}function lt(e){return e.role===`guardian`?!e.displayName||e.displayName.startsWith(`vellum-principal-`)?`you`:`${e.displayName} (you)`:e.displayName||`this contact`}var ut={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`};function dt(e){return ut[e.toLowerCase()]??e}function ft(e,t){let n=[],r=[];for(let i of t.channels)i.status!==`revoked`&&(e.channels.some(e=>e.type===i.type&&e.address.toLowerCase()===i.address.toLowerCase())?r.push(i):n.push(i));return{moved:n,duplicates:r}}function pt(e){let t=new Set,n=[];for(let r of e.channels){if(r.status===`revoked`)continue;let e=r.type.toLowerCase();t.has(e)||(t.add(e),n.push(ut[e]??r.type))}return n}function mt({loading:e,guardian:t,assistantName:r,regularContacts:i,selection:a,onSelect:o,onAddContact:s,addingContact:c=!1}){let[l,d]=(0,q.useState)(``),f=l.trim()?i.filter(e=>e.displayName.toLowerCase().includes(l.trim().toLowerCase())):i;return(0,J.jsx)(u.Root,{className:`flex h-full flex-col overflow-hidden`,children:(0,J.jsxs)(u.Body,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:`Entries`}),(0,J.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:c?(0,J.jsx)(C,{className:`animate-spin`,"aria-hidden":!0}):(0,J.jsx)(H,{"aria-hidden":!0}),onClick:s,disabled:c,"aria-label":`Add contact`,tintColor:`var(--content-secondary)`})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t?(0,J.jsx)(ht,{name:t.displayName?`${t.displayName} (You)`:`You`,role:t.role,channelTypes:t.channelTypes,selected:a?.kind===`contact`&&a.contactId===t.id,onClick:()=>o({kind:`contact`,contactId:t.id}),trailingIcon:`pencil`}):null,(0,J.jsx)(ht,{name:r?.trim()||`Your Assistant`,role:`assistant`,selected:a?.kind===`assistant`,onClick:()=>o({kind:`assistant`}),trailingIcon:`more`})]}),(0,J.jsx)(`div`,{className:`border-t`,style:{borderColor:`var(--border-base)`}}),i.length>0?(0,J.jsx)(h,{type:`text`,value:l,onChange:e=>d(e.target.value),placeholder:`Search Contacts`,leftIcon:(0,J.jsx)(R,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0}):null,i.length>0?(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto flex flex-col gap-1`,children:[f.map(e=>(0,J.jsx)(ht,{name:e.displayName,role:e.role,contactType:e.contactType,channelTypes:e.channelTypes,selected:a?.kind===`contact`&&a.contactId===e.id,onClick:()=>o({kind:`contact`,contactId:e.id}),trailingIcon:`more`},e.id)),f.length===0?(0,J.jsx)(`p`,{className:`px-3 py-4 text-center text-body-small-default`,style:{color:`var(--content-tertiary)`},children:`No matching contacts`}):null]}):e?null:(0,J.jsx)(n,{type:`button`,variant:`ghost`,onClick:s,disabled:c,tintColor:`var(--primary-base)`,leftIcon:c?(0,J.jsx)(C,{className:`animate-spin`,"aria-hidden":!0}):(0,J.jsx)(T,{"aria-hidden":!0}),children:`Add Contact`})]})})}function ht({name:e,role:t,contactType:n,channelTypes:r,selected:i,onClick:a,trailingIcon:o}){let s=r&&r.length>0?r.join(` | `):void 0;return(0,J.jsx)(f,{asChild:!0,active:i,label:``,trailingAction:o===`pencil`?(0,J.jsx)(w,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):o===`more`?(0,J.jsx)(Ne,{className:`h-3.5 w-3.5`,"aria-hidden":!0}):void 0,children:(0,J.jsxs)(`button`,{type:`button`,onClick:a,className:`flex h-auto w-full items-center gap-2 rounded-[6px] px-[8px] py-2 text-left`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`span`,{className:`truncate text-body-medium-default`,children:e}),s?(0,J.jsx)(`span`,{className:`truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},children:s}):null]}),(0,J.jsx)(`span`,{className:`shrink-0`,children:(0,J.jsx)(Y,{role:t,contactType:n})})]})})}function gt(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function _t({open:e,assistantId:t,onClose:r}){let[i,a]=(0,q.useState)(!1),o=(0,q.useRef)(null),c=(0,q.useRef)(!1),u=s({...te({path:{assistant_id:t}})}),d=(0,q.useRef)(u.mutate);(0,q.useLayoutEffect)(()=>{d.current=u.mutate});let f=(0,q.useRef)(u.reset);(0,q.useLayoutEffect)(()=>{f.current=u.reset}),(0,q.useEffect)(()=>{e&&!c.current&&d.current({path:{assistant_id:t}}),c.current=e},[e,t]),(0,q.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let p=(0,q.useCallback)(()=>{f.current(),a(!1),o.current&&=(clearTimeout(o.current),null),r()},[r]),m=(0,q.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),2e3)})},[]),_=u.isSuccess&&u.data.token?ke({senderAssistantId:t,token:u.data.token}):``;return(0,J.jsx)(g.Root,{open:e,onOpenChange:e=>{e||p()},children:(0,J.jsxs)(g.Content,{size:`sm`,children:[(0,J.jsx)(g.Header,{children:(0,J.jsx)(g.Title,{children:`Share Connection Link`})}),(0,J.jsx)(g.Body,{children:u.isPending?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,J.jsx)(C,{className:`h-4 w-4 animate-spin`}),`Creating invite link…`]}):u.isError?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:`Failed to create invite link. Make sure A2A is enabled for your assistant.`}),(0,J.jsx)(n,{variant:`outlined`,onClick:()=>u.mutate({path:{assistant_id:t}}),children:`Try Again`})]}):u.isSuccess?(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsx)(l,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:`Share this link with another assistant owner to establish a connection.`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(h,{type:`text`,readOnly:!0,value:_,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>m(_),"aria-label":`Copy invite link`,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-[var(--border-base)] hover:bg-[var(--surface-hover)]`,children:i?(0,J.jsx)(b,{className:`h-4 w-4`}):(0,J.jsx)(B,{className:`h-4 w-4`})})]}),u.data.expiresAt!=null&&(0,J.jsx)(l,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:gt(u.data.expiresAt)})]}):null}),(0,J.jsx)(g.Footer,{children:(0,J.jsx)(n,{variant:`outlined`,onClick:p,children:`Done`})})]})})}function vt(e){return(0,J.jsx)(yt,{...e},e.contact.id)}function yt({contact:e,savePending:t,verifyPending:r,mergePending:i=!1,canMerge:a=!1,availableChannels:o,a2aEnabled:s,onSave:c,onMerge:l,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f,onGenerateInviteLink:p}){let m=e.displayName.startsWith(`vellum-principal-`),g=m?``:e.displayName,[_,v]=(0,q.useState)(g),[y,b]=(0,q.useState)(e.notes??``),x=_.trim(),S=y.trim(),C=x!==g.trim()||S!==(e.notes??``).trim(),w=C&&!t,T=`${e.interactionCount} interaction${e.interactionCount===1?``:`s`}`;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsx)(W,{title:m?`You`:`${e.displayName} (You)`,accessory:(0,J.jsx)(Y,{role:`guardian`}),compactAccessory:!0,subtitle:T,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(h,{label:`Name`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Your name`,disabled:t,fullWidth:!0}),(0,J.jsx)(h,{label:`Notes`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`Notes about yourself which AI will take into account`,disabled:t,fullWidth:!0}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(n,{variant:`primary`,onClick:()=>c({displayName:x||e.displayName,notes:S}),disabled:!w,children:t?`Saving…`:`Save`}),l?(0,J.jsx)(n,{variant:`outlined`,onClick:l,disabled:!a||C||i||t,title:a?C?`Save your changes before merging`:void 0:`No other contacts available to merge`,children:i?`Merging…`:`Merge…`}):null]})]})}),(0,J.jsx)(W,{title:`Channels`,subtitle:`Once verified, your assistant will recognize you when you message from these channels.`,children:(0,J.jsx)($e,{contactChannels:e.channels,availableChannels:o,a2aEnabled:s,setupLabel:`Verify me`,verifyLoading:r,onSetupChannel:u,onVerifyChannel:d,onRevokeChannel:f})}),p?(0,J.jsx)(Z,{onClick:p}):null]})}function bt(e){return typeof e==`string`&&Ie.includes(e)}function xt(e){return Le.has(e)}async function St(e){let{data:t,error:n,response:r}=await P.get({url:`/v1/assistants/{assistant_id}/channel-admission-policy/`,path:{assistant_id:e},throwOnError:!1});if(M(r,n,`Failed to load channel policies.`),!r.ok)throw new N(r.status,fe(n,r,`Failed to load channel policies.`));return(t?.policies??[]).filter(e=>!xt(e.channelType)&&!ze(e.channelType)).map(e=>({...e,policy:bt(e.policy)?e.policy:`trusted_contacts`}))}async function Ct(e,t,n,r){if(xt(t))throw new N(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await P.put({url:`/v1/assistants/{assistant_id}/channel-admission-policy/{channel_type}`,path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},headers:{"Content-Type":`application/json`},throwOnError:!1});if(M(o,a,`Failed to save channel policy.`),!o.ok)throw new N(o.status,fe(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new N(500,`Gateway returned no policy in response.`);return i.policy}function wt(e){let t=a(),n=he.use.channelTrustFloors(),r=(0,q.useMemo)(()=>[`channel-admission-policy`,e],[e]),i=o({queryKey:r,queryFn:()=>St(e),enabled:n}),c=(0,q.useMemo)(()=>{let e={};for(let t of i.data??[])ye(t.channelType)&&(e[t.channelType]=t.policy);return e},[i.data]),l=s({mutationFn:({channelKey:t,policy:n})=>Ct(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:r}),onError:G(`Failed to save channel policy`)}),u=(0,q.useCallback)((e,t)=>{l.mutate({channelKey:e,policy:t})},[l]);return n?{policies:c,savingKey:l.isPending?l.variables?.channelKey??null:null,isLoading:i.isPending,isError:i.isError,onChange:u}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var Tt=[{id:`slack`,label:`Slack`,subtitle:`Message your assistant from Slack`,icon:`hash`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Slack. Can you help me set that up?`,contact:`I'd like to verify a contact's Slack identity. Can you walk me through it?`}},{id:`telegram`,label:`Telegram`,subtitle:`Message your assistant from Telegram`,icon:`send`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian on Telegram. Can you help me set that up?`,contact:`I'd like to verify a contact's Telegram identity. Can you walk me through it?`}},{id:`phone`,label:`Phone Calling`,subtitle:`Call or text your assistant via phone`,icon:`phone`,supportsVerification:!0,setupMessages:{guardian:`I'd like to verify my identity as your guardian for phone calls. Can you help me set that up?`,contact:`I'd like to verify a contact's phone number. Can you help me set that up?`}}],Et={slack:`I want to reach you on Slack. Let's set it up.`,telegram:`I want to reach you on Telegram. Let's set it up.`,phone:`I want to be able to call you. Let's set you up with a phone number.`},Dt=15e3,Ot=[];function kt({assistantId:e,onStartSetupConversation:t}){let n=he.use.a2aChannel(),r=pe.use.name(),c=a(),[l,u]=i(),d=l.get(`setup`),f=d&&ye(d)?d:null;(0,q.useEffect)(()=>{f&&u(e=>(e.delete(`setup`),e),{replace:!0})},[f,u]);let[p,m]=(0,q.useState)({kind:`assistant`}),[h,g]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),S=r??`your assistant`,C=(0,q.useMemo)(()=>({path:{assistant_id:e}}),[e]),w=de(C),T=(0,q.useMemo)(()=>({path:{assistant_id:e}}),[e]),te=ue(T),M=o({...se(C),enabled:!!e,select:e=>e.contacts}),fe=o({...le(T),enabled:!!e,refetchInterval:Dt,select:e=>e.snapshots}),N=o({...ce({path:{assistant_id:e}}),enabled:!!e,queryFn:async({signal:t})=>{let{data:n,error:r,response:i}=await D({path:{assistant_id:e},signal:t,throwOnError:!1});if(!i||i.status===404)return{channels:Tt};if(!i.ok)throw r??Error(`Failed to fetch channel availability`);return n},select:e=>e.channels}).data??Ot,P=M.data,F=(0,q.useMemo)(()=>P?.find(e=>e.role===`guardian`)??null,[P]),me=(0,q.useMemo)(()=>P?.filter(e=>e.role!==`guardian`)??[],[P]),I=(0,q.useMemo)(()=>p.kind===`contact`?P?.find(e=>e.id===p.contactId)??null:null,[P,p]),ge=fe.data??[],_e=(0,q.useMemo)(()=>!P||!I?[]:P.filter(e=>e.id!==I.id&&e.role!==`guardian`),[P,I]),ve=_e.length>0,L=(0,q.useRef)(!!f);(0,q.useEffect)(()=>{L.current||F&&(L.current=!0,m({kind:`contact`,contactId:F.id}))},[F]);let be=(0,q.useMemo)(()=>jt(ge),[ge]),xe=be.some(e=>e.key===`slack`&&e.status===`ready`),Se=(0,q.useMemo)(()=>({path:{assistant_id:e}}),[e]),Ce=o({...oe(Se),enabled:xe,select:e=>e.threadMode}).data,R=wt(e),z=(0,q.useCallback)(()=>c.invalidateQueries({queryKey:w}),[c,w]),we=(0,q.useCallback)(()=>c.invalidateQueries({queryKey:te}),[c,te]),B=s({mutationFn:()=>je(e,{displayName:`New Contact`}),onMutate:async()=>{await c.cancelQueries({queryKey:w})},onSuccess:e=>{j(c,C,t=>t?{...t,contacts:[...t.contacts,e]}:void 0),m({kind:`contact`,contactId:e.id})},onError:G(`Failed to create contact`),onSettled:()=>z()}),V=s({mutationFn:t=>Me(e,t),onSuccess:(e,t)=>{j(c,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==t)}:void 0),m({kind:`assistant`})},onError:G(`Failed to delete contact`),onSettled:()=>z()}),H=s({mutationFn:({contactId:t,patch:n})=>je(e,{id:t,displayName:n.displayName,notes:n.notes}),onSuccess:e=>{j(c,C,t=>t?{...t,contacts:t.contacts.map(t=>t.id===e.id?e:t)}:void 0)},onError:G(`Failed to save contact`),onSettled:()=>z()}),U=ie({onMutate:async()=>{await c.cancelQueries({queryKey:w})},onSuccess:(e,t)=>{let n=e.contact,r=t.body.mergeId;n&&(j(c,C,e=>e?{...e,contacts:e.contacts.filter(e=>e.id!==r).map(e=>e.id===n.id?n:e)}:void 0),m({kind:`contact`,contactId:n.id})),x(!1),_.success(`Contacts merged`)},onSettled:()=>z()}),Ee=(0,q.useCallback)(e=>{m(e),y(!1),x(!1),U.reset()},[U]),W=(0,q.useCallback)(()=>{U.reset(),x(!0)},[U]),ke=(0,q.useCallback)(()=>{U.isPending||(x(!1),U.reset())},[U]),K=s({mutationFn:async t=>{let n={path:{assistant_id:e},throwOnError:!0};t===`slack`?await E(n):t===`telegram`?await A(n):t===`phone`&&await k(n)},onSettled:()=>we()}),Ne=re({onSuccess:()=>z()}),Pe=(0,q.useCallback)((t,n)=>{Ne.mutate({path:{assistant_id:e,contactChannelId:t},body:{status:`revoked`}})},[Ne,e]),Y=s({mutationFn:t=>O({path:{assistant_id:e},body:{botToken:t},throwOnError:!0}),onSettled:()=>we()}),X=Te({assistantId:e}),Z=s({...ae(),onSuccess:()=>{c.invalidateQueries({queryKey:ne(Se)})}}),Fe=s({mutationFn:({accountSid:t,authToken:n})=>ee({path:{assistant_id:e},body:{accountSid:t,authToken:n},throwOnError:!0}),onSettled:()=>we()}),Ie=(0,q.useCallback)(async e=>{await Y.mutateAsync(e)},[Y]),Le=(0,q.useCallback)((e,t)=>{X.mutate({botToken:e,appToken:t})},[X]),Re=(0,q.useCallback)(t=>{Z.mutate({path:{assistant_id:e},body:{threadMode:t}})},[Z,e]),ze=(0,q.useCallback)(async(e,t)=>{await Fe.mutateAsync({accountSid:e,authToken:t})},[Fe]),Be=(0,q.useCallback)(()=>{B.isPending||B.mutate()},[B]),Ve=(0,q.useCallback)(()=>{g(!0)},[]),He=(0,q.useCallback)(()=>{g(!1),z()},[z]),Ue=(0,q.useCallback)(e=>{t&&t(Et[e])},[t]),We=(0,q.useCallback)(e=>{K.mutate(e)},[K]),Ke=(0,q.useCallback)(e=>{if(!t)return;let n=N.find(t=>t.id===e)?.setupMessages.contact;n&&t(n)},[N,t]),qe=(0,q.useCallback)(e=>{if(!t)return;let n=N.find(t=>t.id===e)?.setupMessages.guardian;n&&t(n)},[N,t]),Q=s({mutationFn:t=>Ae(e,t.channelId),onSuccess:()=>z(),onError:G(`Failed to verify channel`)}),Je=(0,q.useCallback)(e=>{if(!I)return;let t=I.channels.find(t=>t.type===e&&t.status!==`revoked`);t&&Q.mutate({channelId:t.id})},[I,Q]),Ye=V.isPending?V.variables:null,$=(0,q.useMemo)(()=>I?H.isPending&&H.variables?.contactId===I.id?{...I,displayName:H.variables.patch.displayName,notes:H.variables.patch.notes}:I:null,[I,H.isPending,H.variables]),Xe={loading:M.isLoading,assistantName:S,guardian:F?{id:F.id,displayName:F.displayName.startsWith(`vellum-principal-`)?``:F.displayName,role:F.role,channelTypes:Pt(F.channels,n)}:null,regularContacts:me.filter(e=>e.id!==Ye).map(e=>({id:e.id,displayName:e.displayName,role:e.role,contactType:e.contactType,channelTypes:Pt(e.channels,n)})),selection:p,onAddContact:Be,addingContact:B.isPending};return(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden sm:flex-row sm:gap-6`,children:[(0,J.jsx)(`div`,{className:`flex items-center sm:hidden`,children:(0,J.jsx)(De,{onClick:()=>y(!0)})}),(0,J.jsx)(Oe,{open:v,onClose:()=>y(!1),title:`Contacts`,children:(0,J.jsx)(mt,{...Xe,onSelect:Ee})}),(0,J.jsx)(`aside`,{className:`hidden min-h-0 w-[320px] shrink-0 overflow-y-auto self-stretch sm:block`,children:(0,J.jsx)(mt,{...Xe,onSelect:Ee})}),(0,J.jsx)(`section`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:p.kind===`assistant`||p.kind===`contact`&&p.contactId===Ye?(0,J.jsx)(Ge,{assistantName:S,channels:be,pendingChannelKey:K.isPending?K.variables??null:null,slackThreadMode:Ce,slackThreadModePending:Z.isPending,channelPolicies:R.policies,policySavingKey:R.savingKey,policiesLoading:R.isLoading,policiesError:R.isError,onChannelPolicyChange:R.onChange,onSetup:t?Ue:void 0,onDisconnect:We,onSaveTelegramToken:Ie,onSaveSlackConfig:Le,slackSaveStatus:X.status,slackSaveError:X.error?.message??null,onSlackThreadModeChange:Re,onSaveTwilioCredentials:ze,onGenerateInviteLink:n?Ve:void 0,initialExpandedChannel:f}):$?$.role===`guardian`?(0,J.jsx)(vt,{contact:$,savePending:H.isPending,verifyPending:Q.isPending,mergePending:U.isPending,canMerge:ve,availableChannels:N,a2aEnabled:n,onSave:e=>{H.mutate({contactId:$.id,patch:e})},onMerge:W,onSetupChannel:t?qe:void 0,onVerifyChannel:Je,onRevokeChannel:Pe,onGenerateInviteLink:n?Ve:void 0}):(0,J.jsx)(tt,{contact:$,savePending:H.isPending,deletePending:V.isPending,verifyPending:Q.isPending,mergePending:U.isPending,canMerge:ve,availableChannels:N,a2aEnabled:n,onSave:e=>{H.mutate({contactId:$.id,patch:e})},onDelete:()=>{V.mutate($.id)},onMerge:W,onSetupChannel:t?Ke:void 0,onVerifyChannel:Je,onRevokeChannel:Pe}):(0,J.jsx)(At,{})}),I?(0,J.jsx)(rt,{open:b,survivor:I,candidates:_e,pending:U.isPending,errorMessage:U.error instanceof Error?U.error.message:U.error?`Failed to merge contacts`:null,onMerge:t=>U.mutate({path:{assistant_id:e},body:{keepId:I.id,mergeId:t}}),onClose:ke}):null,(0,J.jsx)(_t,{open:h,assistantId:e,onClose:He})]})}function At(){return(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center py-16`,children:(0,J.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a contact`})})}function jt(e){let t=new Map;for(let n of e)t.set(n.channel,n);return Ce.map(e=>{let n=t.get(e);return{key:e,status:Mt(n),address:n?.channelHandle??void 0}})}function Mt(e){return e?e.ready||e.setupStatus===`ready`?`ready`:e.setupStatus===`incomplete`?`incomplete`:`not_configured`:`not_configured`}var Nt={slack:`Slack`,telegram:`Telegram`,phone:`Phone`,email:`Email`,whatsapp:`WhatsApp`,a2a:`A2A`};function Pt(e,t){let n=new Set,r=[];for(let i of e){if(i.status===`revoked`)continue;let e=i.type.toLowerCase();n.has(e)||e===`a2a`&&!t||(n.add(e),r.push(Nt[e]??i.type))}return r}function Ft(){let e=r(),t=Ee();return(0,J.jsx)(kt,{assistantId:t,onStartSetupConversation:t=>{me.getState().setMainView(`chat`);let n=ge();I.getState().setActiveConversationId(n),e(`${F.conversation(n)}?prompt=${encodeURIComponent(t)}`)}},t)}export{Ft as ContactsPageRoute};