@vellumai/web 0.12.7 → 0.12.9

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 (328) hide show
  1. package/dist/assets/{a2a-invite-CYkZ2bwB.js → a2a-invite-C4885wc_.js} +1 -1
  2. package/dist/assets/{about-page-CDf8_c83.js → about-page-OhJ1Y0_b.js} +1 -1
  3. package/dist/assets/{account-page-DYgu7ene.js → account-page-Bd7a2i5_.js} +1 -1
  4. package/dist/assets/{account-shell-Cxi1v479.js → account-shell-RM4hokh5.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel--S5Mrgwf.js → acp-run-detail-panel-CCLk2KCU.js} +1 -1
  6. package/dist/assets/{activation-list-route-fUUXXrqq.js → activation-list-route-DzBmo7MF.js} +1 -1
  7. package/dist/assets/{activity-redirect-page-Dday27zi.js → activity-redirect-page-aalRz3ru.js} +1 -1
  8. package/dist/assets/{activity-steps-panel-BnCTZLXH.js → activity-steps-panel-MY7LyILM.js} +1 -1
  9. package/dist/assets/add-credits-modal-C65Z6nbb.js +1 -0
  10. package/dist/assets/{add-credits-modal-BPRQXrJL.js → add-credits-modal-DYXqJVrA.js} +1 -1
  11. package/dist/assets/{ai-page-BmPw_Cbb.js → ai-page-Bv8MHKwy.js} +1 -1
  12. package/dist/assets/{all-chats-page-route-XyYPy--V.js → all-chats-page-route-BC4cJbn9.js} +1 -1
  13. package/dist/assets/{android-billing-handoff-CvgyuFs9.js → android-billing-handoff-DkztgMMX.js} +1 -1
  14. package/dist/assets/{animated-stat-square-gKVZj83m.js → animated-stat-square-DfspueEE.js} +1 -1
  15. package/dist/assets/{api-key-screen-B3eNGHTQ.js → api-key-screen-DMYrX3xq.js} +1 -1
  16. package/dist/assets/{app-KRIEMzuO.js → app-BEoekemj.js} +21 -19
  17. package/dist/assets/{app-info-BS5SWiPy.js → app-info-JELjTeSr.js} +1 -1
  18. package/dist/assets/{archive-redirect-page-B_JVRF8z.js → archive-redirect-page-CDu9_cSE.js} +1 -1
  19. package/dist/assets/{assistant-handle-modal-cqAXFvU4.js → assistant-handle-modal-B9aYt_fz.js} +1 -1
  20. package/dist/assets/{assistant-inbox-page-route-BmMCSNYC.js → assistant-inbox-page-route-BlKCkLjN.js} +1 -1
  21. package/dist/assets/{assistant-status-panel-5KKU97Nr.js → assistant-status-panel-Ib811iyR.js} +1 -1
  22. package/dist/assets/auth-store-BNRELUI-.js +1 -0
  23. package/dist/assets/{auth-welcome-screen-CK9ayr5r.js → auth-welcome-screen-CnpHRdVh.js} +1 -1
  24. package/dist/assets/avatar-bundled-components-CA2b3Qbn.js +1 -0
  25. package/dist/assets/{avatar-random-B0PlMwfP.js → avatar-random-Bqs0WRXW.js} +2 -2
  26. package/dist/assets/{await-org-header-settled-DCrUbt__.js → await-org-header-settled-Bka_Fh2i.js} +1 -1
  27. package/dist/assets/{background-task-detail-panel-ByZEhdsg.js → background-task-detail-panel-pwmuvBdb.js} +1 -1
  28. package/dist/assets/{billing-page-CYKuyCF5.js → billing-page-CQDe4wC9.js} +3 -3
  29. package/dist/assets/{billing-redirect-page-t6TNZq6q.js → billing-redirect-page-CgxuQ6OG.js} +1 -1
  30. package/dist/assets/{bookmarks-page-DkomjdJQ.js → bookmarks-page-BVSEx2HM.js} +1 -1
  31. package/dist/assets/{bundle-confirm-page-BRqor1bF.js → bundle-confirm-page-DxLUosoE.js} +1 -1
  32. package/dist/assets/{channel-transcript-panel-BZPmdLEj.js → channel-transcript-panel-AnyjZw-p.js} +1 -1
  33. package/dist/assets/{channels-page-route-CtttpYll.js → channels-page-route-CoXHj9DC.js} +1 -1
  34. package/dist/assets/{chat-info-panel-DQumRkcF.js → chat-info-panel-oNSMH-Rg.js} +1 -1
  35. package/dist/assets/{checkout-continuation-DDjhky4Y.js → checkout-continuation-ZsRm--tW.js} +1 -1
  36. package/dist/assets/{checkout-page-CDYYh4ze.js → checkout-page-Cbc1Yxhk.js} +1 -1
  37. package/dist/assets/checkout-return-target-DMexYntq.js +1 -0
  38. package/dist/assets/{command-palette-BUFKVA4Z.js → command-palette-D98tgb3c.js} +1 -1
  39. package/dist/assets/{command-palette-window-page-C0dY_FbH.js → command-palette-window-page-BwYCB4uz.js} +1 -1
  40. package/dist/assets/command-palette-xFt9p-Zp.js +1 -0
  41. package/dist/assets/{community-page-DDVVXFKB.js → community-page-C_t6hJx9.js} +1 -1
  42. package/dist/assets/{companion-accent-obJ7TDkU.js → companion-accent-DHN8mSGN.js} +1 -1
  43. package/dist/assets/{companion-dock-zones-page-CUZsYl_W.js → companion-dock-zones-page-yp3BLs-9.js} +1 -1
  44. package/dist/assets/{companion-layout-Cl8T5Bfs.js → companion-layout-DUIauyGx.js} +1 -1
  45. package/dist/assets/{companion-popover-Duq3If7x.js → companion-popover-CEltebX7.js} +1 -1
  46. package/dist/assets/{companion-popover-page-8OaaN-qP.js → companion-popover-page-NrLfgW85.js} +1 -1
  47. package/dist/assets/{companion-surface-DzxGavvE.js → companion-surface-CEpWVTaQ.js} +1 -1
  48. package/dist/assets/{companion-surface-page-BI1DVG0L.js → companion-surface-page-Dfs9lnVq.js} +1 -1
  49. package/dist/assets/{companion-tour-entry-D35urSvp.js → companion-tour-entry-CEdPrBsl.js} +1 -1
  50. package/dist/assets/{companion-watch-frame-page-chC7gmAI.js → companion-watch-frame-page-XbdyXdlU.js} +1 -1
  51. package/dist/assets/{connect-page-Cx7ACmXt.js → connect-page-DvwqAL21.js} +1 -1
  52. package/dist/assets/{consent-controls-B8KluMR-.js → consent-controls-CSns_4iB.js} +1 -1
  53. package/dist/assets/{contacts-gateway-DJQtU5it.js → contacts-gateway-DL44TLR9.js} +1 -1
  54. package/dist/assets/{contacts-page-route-g0cBfSRU.js → contacts-page-route-BIASFsPk.js} +1 -1
  55. package/dist/assets/{copy-button-Bwu12tAq.js → copy-button-benjZQNN.js} +1 -1
  56. package/dist/assets/{credential-entry-page-CrMmjA4m.js → credential-entry-page-fH4FNFwY.js} +1 -1
  57. package/dist/assets/{credentials-page-DXegpKuT.js → credentials-page-BgsUXMw4.js} +1 -1
  58. package/dist/assets/{csv-preview-BUNDraKQ.js → csv-preview-CBVZAL8V.js} +1 -1
  59. package/dist/assets/{danger-zone-redirect-page-Dju7UyCP.js → danger-zone-redirect-page-rAqyukS8.js} +1 -1
  60. package/dist/assets/debug-page-s3VnB3Jn.js +4 -0
  61. package/dist/assets/{deploy-dialogs-CKv9kQor.js → deploy-dialogs-BwKeOiNO.js} +1 -1
  62. package/dist/assets/deploy-dialogs-CKFVL9lA.js +1 -0
  63. package/dist/assets/{desktop-preview-content-BwMNHlWb.js → desktop-preview-content-DyhOQZfU.js} +2 -2
  64. package/dist/assets/{desktop-status-CCzewHXe.js → desktop-status-rhE91WHU.js} +1 -1
  65. package/dist/assets/{desktop-viewer-DBH1IT5s.js → desktop-viewer-DnRXsZHE.js} +1 -1
  66. package/dist/assets/{detail-card-C53pHjsM.js → detail-card-DdL-TwEw.js} +1 -1
  67. package/dist/assets/{detail-panel-stop-button-t_VDZYtt.js → detail-panel-stop-button-9gdxgBZq.js} +1 -1
  68. package/dist/assets/{detail-primitives-BHVQRcGw.js → detail-primitives-DbHxZutJ.js} +1 -1
  69. package/dist/assets/{developer-page-CKcDBScK.js → developer-page-CLDXmpgw.js} +1 -1
  70. package/dist/assets/{devices-redirect-page-BEyGhbmn.js → devices-redirect-page-DTriAmul.js} +1 -1
  71. package/dist/assets/{dictation-overlay-page-DpanSK5-.js → dictation-overlay-page-8oynsdBm.js} +1 -1
  72. package/dist/assets/document-load-Dd9T9sVB.js +1 -0
  73. package/dist/assets/{document-load-B5HpKq-W.js → document-load-DdRg4kwv.js} +1 -1
  74. package/dist/assets/{document-viewer-page-4Z_VnjKZ.js → document-viewer-page-DwqleCG5.js} +1 -1
  75. package/dist/assets/{emails-page-DyrcXFet.js → emails-page-d48Qo5TY.js} +1 -1
  76. package/dist/assets/esm-BMVS8Ywz.js +2 -0
  77. package/dist/assets/esm-Bm61i-L4.js +1 -0
  78. package/dist/assets/esm-CUO0AHtA.js +2 -0
  79. package/dist/assets/esm-Ci2CqtrR.js +2 -0
  80. package/dist/assets/esm-DM-kxKqE.js +1 -0
  81. package/dist/assets/esm-PJP6gQUq.js +2 -0
  82. package/dist/assets/{esm-DFoZ6rpj.js → esm-YJgArrZn.js} +1 -1
  83. package/dist/assets/esm-ZDwTeYcs.js +2 -0
  84. package/dist/assets/{esm-COgrn4oo.js → esm-oFf4cNn1.js} +2 -2
  85. package/dist/assets/{esm-DPwp_tyY.js → esm-xHo3DTmi.js} +1 -1
  86. package/dist/assets/{file-diff-view-DqA1_0h3.js → file-diff-view-A52sCKKz.js} +1 -1
  87. package/dist/assets/{file-view-mode-DPofWJnz.js → file-view-mode-DqXCmgGD.js} +1 -1
  88. package/dist/assets/general-page-Y55ICpxV.js +2 -0
  89. package/dist/assets/{hatching-screen-C5fid3Mi.js → hatching-screen-BCrEhJki.js} +1 -1
  90. package/dist/assets/{hosting-screen-BTxmBl_3.js → hosting-screen-DrbGcUwu.js} +1 -1
  91. package/dist/assets/{identity-page-route-DSyT39Yq.js → identity-page-route-PW0b8HfB.js} +1 -1
  92. package/dist/assets/{inspect-page-WDA56TDM.js → inspect-page-DsB1BUwJ.js} +3 -3
  93. package/dist/assets/{integrations-page-7jff5YRS.js → integrations-page-phceinc7.js} +1 -1
  94. package/dist/assets/{intelligence-layout-DOOxr8TM.js → intelligence-layout-ClXPJOlz.js} +1 -1
  95. package/dist/assets/intelligence-layout-slots-store-jzhqxk-F.js +1 -0
  96. package/dist/assets/{keyboard-shortcuts-redirect-page-0f4iR9cK.js → keyboard-shortcuts-redirect-page-CZG9PbfD.js} +1 -1
  97. package/dist/assets/{latest-assistant-text-C5TlzsjF.js → latest-assistant-text-CfRyVmjf.js} +1 -1
  98. package/dist/assets/{library-detail-page-CXu1dzI8.js → library-detail-page-DB03TRkW.js} +1 -1
  99. package/dist/assets/{library-page-BdtUHlv5.js → library-page-SCpSNw8r.js} +1 -1
  100. package/dist/assets/local-mode-C-TKP5UT.js +1 -0
  101. package/dist/assets/{login-page-BYz-IJwG.js → login-page-DlzYKg__.js} +1 -1
  102. package/dist/assets/{logout-page-CA2Gb3fM.js → logout-page-DNJegpBL.js} +1 -1
  103. package/dist/assets/{logs-layout-BgviygkY.js → logs-layout-BYnI6Won.js} +1 -1
  104. package/dist/assets/managed-export-B8hZl8fK.js +1 -0
  105. package/dist/assets/{markdown-preview-CBXcCZg7.js → markdown-preview-BOAf9rHZ.js} +1 -1
  106. package/dist/assets/{media-preview-CTjI28Y4.js → media-preview-CiWddeik.js} +1 -1
  107. package/dist/assets/{memory-page-route-Od3Muhow.js → memory-page-route-DAe7cXOM.js} +1 -1
  108. package/dist/assets/{memory-router-playground-page-D8do5kDw.js → memory-router-playground-page-B6RLB6SJ.js} +1 -1
  109. package/dist/assets/{message-files-panel-CnyA6dJL.js → message-files-panel-D8Cvtzm7.js} +1 -1
  110. package/dist/assets/mutation-error-C2MukXLE.js +1 -0
  111. package/dist/assets/native-attachment-pickers-DMi3o2P3.js +1 -0
  112. package/dist/assets/native-file-Dcnehsuk.js +1 -0
  113. package/dist/assets/{notifications-page-CICwZV_j.js → notifications-page-B6BaoRe4.js} +1 -1
  114. package/dist/assets/{oauth-complete-page-HYAqM-h3.js → oauth-complete-page-C8RguTIe.js} +1 -1
  115. package/dist/assets/{oauth-popup-complete-page-0Nnhyx6m.js → oauth-popup-complete-page-9mkrWQG1.js} +1 -1
  116. package/dist/assets/paired-platform-identity-RQOjYmiL.js +1 -0
  117. package/dist/assets/{pairing-page-CbPjyGMx.js → pairing-page-BoIDiN07.js} +1 -1
  118. package/dist/assets/password-reset-page-CMKwr9QD.js +1 -0
  119. package/dist/assets/{pdf-file-preview-CfJUarVV.js → pdf-file-preview-BdmWkRby.js} +1 -1
  120. package/dist/assets/{peeking-eyes-C3X1d6Jj.js → peeking-eyes-GhtIN21V.js} +1 -1
  121. package/dist/assets/{permission-guide-page-DgNjuyxd.js → permission-guide-page-D4XS94Lj.js} +1 -1
  122. package/dist/assets/{permission-setup-C4VdQwwz.js → permission-setup-BKUZnWJQ.js} +1 -1
  123. package/dist/assets/{personality-page-BEzNdxON.js → personality-page-B7hhb6bJ.js} +1 -1
  124. package/dist/assets/{personality-page-ILl8FXFu.js → personality-page-DbSLfV_N.js} +1 -1
  125. package/dist/assets/{personality-sliders-PxNPuK2H.js → personality-sliders-DahfpXIK.js} +1 -1
  126. package/dist/assets/{plans-page-CI3FmLNs.js → plans-page-Q2u7IYdx.js} +1 -1
  127. package/dist/assets/{platform-loopback-page-DM2A9sb6.js → platform-loopback-page-Gsgl1-C1.js} +1 -1
  128. package/dist/assets/{plugin-detail-page-Cj6u283V.js → plugin-detail-page-CwTxMfPK.js} +1 -1
  129. package/dist/assets/{plugins-page-D7_NjR08.js → plugins-page-BeceTGDE.js} +1 -1
  130. package/dist/assets/plugins-surface-DRWOFcBb.js +1 -0
  131. package/dist/assets/{preview-error-B2MuMDf7.js → preview-error-Bsw56ZjR.js} +1 -1
  132. package/dist/assets/privacy-page-C0L5u1-E.js +1 -0
  133. package/dist/assets/{privacy-screen-BnqXrWj-.js → privacy-screen-q5pYNYHV.js} +1 -1
  134. package/dist/assets/{profile-card-BJ45rF7O.js → profile-card-ORX8JyeJ.js} +1 -1
  135. package/dist/assets/{provider-callback-page-CNNhqRdO.js → provider-callback-page-Bh4aARKp.js} +1 -1
  136. package/dist/assets/{provider-key-CqD-hAxF.js → provider-key-DhHj1MSM.js} +1 -1
  137. package/dist/assets/{provider-signup-page-BEBgiI0J.js → provider-signup-page-BZcyuRq8.js} +1 -1
  138. package/dist/assets/{quick-input-page-ZC5y6AKn.js → quick-input-page-B0vdeXBp.js} +1 -1
  139. package/dist/assets/referral-modal-0tLKuYzN.js +1 -0
  140. package/dist/assets/{referral-modal-B5zxNJBt.js → referral-modal-BgoEpFmG.js} +1 -1
  141. package/dist/assets/{rehype-katex-DWUGzNKD.js → rehype-katex-CwfN9TOG.js} +1 -1
  142. package/dist/assets/{research-mock-page-B3giO94y.js → research-mock-page-oXOlmOna.js} +1 -1
  143. package/dist/assets/{research-onboarding-route-Dim74aoQ.js → research-onboarding-route-q3lZEjxC.js} +1 -1
  144. package/dist/assets/{review-terms-screen-CIYiUq4M.js → review-terms-screen-LCDdoz6t.js} +1 -1
  145. package/dist/assets/routes-1ENCqxlq.js +1 -0
  146. package/dist/assets/{schedules-J3G9N-px.js → schedules-RwCneOYe.js} +1 -1
  147. package/dist/assets/{schedules-page-Cnl8mEzJ.js → schedules-page-D2HxxCQz.js} +1 -1
  148. package/dist/assets/{security-redirect-page-BEtWQiAG.js → security-redirect-page-BdOwkxkl.js} +1 -1
  149. package/dist/assets/{select-assistant-screen-BHvcUbOb.js → select-assistant-screen-B1NbmvWZ.js} +1 -1
  150. package/dist/assets/{self-hosted-servers-Bn0mvFIm.js → self-hosted-servers-Dn5AaPCS.js} +1 -1
  151. package/dist/assets/{service-form-controls-DaeZPEiA.js → service-form-controls-Bn1R361b.js} +1 -1
  152. package/dist/assets/{setting-row-DPTW9jvI.js → setting-row-CaxliRhN.js} +1 -1
  153. package/dist/assets/{settings-Bh67VJVe.js → settings-CPmDyMN-.js} +4 -2
  154. package/dist/assets/{settings-k5uhZfPH.js → settings-DFXVH_HE.js} +4 -2
  155. package/dist/assets/{settings-ClEDqshB.js → settings-DydJJiwS.js} +4 -2
  156. package/dist/assets/settings-divider-DipomhZT.js +1 -0
  157. package/dist/assets/{settings-layout-DEmxtBd4.js → settings-layout-C7CQeAi8.js} +1 -1
  158. package/dist/assets/{settings-DDU54LDK.js → settings-w04_tItH.js} +4 -2
  159. package/dist/assets/share-feedback-modal-CrOSSoWU.js +1 -0
  160. package/dist/assets/{share-feedback-modal-Du_F68zS.js → share-feedback-modal-W3JhVF1c.js} +2 -2
  161. package/dist/assets/{sidebar-tree-D43H3cb8.js → sidebar-tree-CtDTchuN.js} +1 -1
  162. package/dist/assets/{signup-page-BiV-Kq2O.js → signup-page-BgVg1-Cz.js} +1 -1
  163. package/dist/assets/{signup-shell-BbFj5txC.js → signup-shell-rqZZKQs9.js} +1 -1
  164. package/dist/assets/{skill-detail-page-CNTwONYG.js → skill-detail-page-DVceqbB8.js} +1 -1
  165. package/dist/assets/{skill-detail-panel-Duoeqpk6.js → skill-detail-panel-D0MQeUNt.js} +1 -1
  166. package/dist/assets/{skill-removal-dialog-DcbMCW1X.js → skill-removal-dialog-CKyIY15v.js} +1 -1
  167. package/dist/assets/{skills-page-DeEyocII.js → skills-page-BNFEhwCh.js} +1 -1
  168. package/dist/assets/{sounds-page-CYqyUiLI.js → sounds-page-D-1xB2X0.js} +1 -1
  169. package/dist/assets/{start-screen-C4ocEh6e.js → start-screen-BfdqRCiG.js} +1 -1
  170. package/dist/assets/{step-detail-header-C0_Bji0I.js → step-detail-header-LQsSbC2J.js} +1 -1
  171. package/dist/assets/{stt-language-picker-modal-Dw_dzvcQ.js → stt-language-picker-modal-CU8T9AvB.js} +1 -1
  172. package/dist/assets/{subagent-detail-panel-DqFckc_d.js → subagent-detail-panel-CBnRBOPg.js} +1 -1
  173. package/dist/assets/{superpowers-page-kjcwHwaR.js → superpowers-page-DabWyYFo.js} +1 -1
  174. package/dist/assets/{system-events-page-C0Nrrv_n.js → system-events-page-BO75f0oo.js} +1 -1
  175. package/dist/assets/{system-events-redirect-page-DR4dTzmZ.js → system-events-redirect-page-DTc8VcbG.js} +1 -1
  176. package/dist/assets/{tabular-grid-9asraGxC.js → tabular-grid-TnP0G_0N.js} +1 -1
  177. package/dist/assets/teleport-gateway-client-BY9KVOT2.js +1 -0
  178. package/dist/assets/{text-preview-C6jKP_-h.js → text-preview-ClaaOGkz.js} +1 -1
  179. package/dist/assets/{theme-stage-page-BCd5ZTdW.js → theme-stage-page-CDguIcG0.js} +1 -1
  180. package/dist/assets/{tiptap-document-editor-BCrbYYDo.js → tiptap-document-editor-C6mVckqJ.js} +1 -1
  181. package/dist/assets/{tool-detail-panel-nu-dK5jf.js → tool-detail-panel-CQ-R1S2x.js} +1 -1
  182. package/dist/assets/tool-detail-panel-D2UjNK8Q.js +1 -0
  183. package/dist/assets/{trait-cycle-row-CPRGog-6.js → trait-cycle-row-Dw9MgLO3.js} +1 -1
  184. package/dist/assets/{upgrade-cancel-page-BiU2HQZG.js → upgrade-cancel-page-BMNn9Xs4.js} +1 -1
  185. package/dist/assets/{upgrade-success-page-BCvxSNPT.js → upgrade-success-page-6A6LKBWV.js} +1 -1
  186. package/dist/assets/{usage-redirect-page-A2FxznAL.js → usage-redirect-page-DuL6faM2.js} +1 -1
  187. package/dist/assets/{use-app-delete-Bd9ibG9z.js → use-app-delete-CzP_P0YE.js} +1 -1
  188. package/dist/assets/{use-assistant-identity-details-BPVOfzxy.js → use-assistant-identity-details-C3ihvjLl.js} +1 -1
  189. package/dist/assets/{use-channel-trust-floors-BkkxL6wd.js → use-channel-trust-floors-ENV3m3Vx.js} +1 -1
  190. package/dist/assets/{use-checkout-dismiss-refresh-DYmiO0wT.js → use-checkout-dismiss-refresh-Db6rZnu3.js} +1 -1
  191. package/dist/assets/{use-edge-swipe-back-B2Kt4500.js → use-edge-swipe-back-zSNP4R0a.js} +1 -1
  192. package/dist/assets/{use-hotkey-recorder-Dngc9P3v.js → use-hotkey-recorder-DZfuD-Wf.js} +1 -1
  193. package/dist/assets/{use-invite-link-dialog-Dqkj_T4s.js → use-invite-link-dialog-D8vtY1q5.js} +1 -1
  194. package/dist/assets/{use-plugins-list-DJlgCfb-.js → use-plugins-list-Bfr06IMK.js} +1 -1
  195. package/dist/assets/{use-return-to-short-circuit-CrgMpIk2.js → use-return-to-short-circuit-C0-TwAO7.js} +1 -1
  196. package/dist/assets/{use-side-list-room-CttXRA29.js → use-side-list-room-CDaRUxpt.js} +1 -1
  197. package/dist/assets/{use-skill-actions-BhUkfXmL.js → use-skill-actions-BvJl4cE_.js} +1 -1
  198. package/dist/assets/{use-skill-detail-files-JWSwpirW.js → use-skill-detail-files-upPaF1Ti.js} +1 -1
  199. package/dist/assets/use-supports-credentials-settings-BmKvWH5p.js +1 -0
  200. package/dist/assets/{vendor-DLH51Vjf.js → vendor-cVd2QlFV.js} +2 -2
  201. package/dist/assets/{voice-page-CN-XVbya.js → voice-page-CyiYN5gw.js} +1 -1
  202. package/dist/assets/{wake-detail-panel-BN6Np2AU.js → wake-detail-panel-Ca8kOmoN.js} +1 -1
  203. package/dist/assets/{weather-forecast-display-Dg7Tug8o.js → weather-forecast-display-C5WJSVZN.js} +1 -1
  204. package/dist/assets/{web-C2Y5uOI1.js → web-4gtEtmAK.js} +1 -1
  205. package/dist/assets/{web-BmoVVmPZ.js → web-B2la00zR.js} +1 -1
  206. package/dist/assets/{web-D0qh5Vlp.js → web-BD6n-X3I.js} +1 -1
  207. package/dist/assets/{web-BlKAJber.js → web-BDmJP5H5.js} +1 -1
  208. package/dist/assets/{web-D5UHHnMG.js → web-Bb3-M0eN.js} +1 -1
  209. package/dist/assets/{web-Xy5dhNHF.js → web-Co3fdUhk.js} +1 -1
  210. package/dist/assets/{web-CAi9YePi.js → web-DUEEDTea.js} +1 -1
  211. package/dist/assets/{web-vcW3se1t.js → web-FCPcWxlK.js} +1 -1
  212. package/dist/assets/{web-DZvE04fg.js → web-p3qShnRq.js} +1 -1
  213. package/dist/assets/welcome-screen-BoF2bJeJ.js +1 -0
  214. package/dist/assets/{workflow-detail-panel-Bo3bUe-w.js → workflow-detail-panel-BWjagS_I.js} +1 -1
  215. package/dist/assets/{workspace-page-yTSdnWq3.js → workspace-page-BwYluW9Z.js} +1 -1
  216. package/dist/assets/{xlsx-preview-C7vk2tgm.js → xlsx-preview-D7-VqTY7.js} +1 -1
  217. package/dist/index.html +2 -2
  218. package/package.json +1 -1
  219. package/dist/assets/add-credits-modal-htqAQMX6.js +0 -1
  220. package/dist/assets/auth-store-CUfwxB8-.js +0 -1
  221. package/dist/assets/avatar-bundled-components-BQa_U1xg.js +0 -1
  222. package/dist/assets/checkout-return-target-B6Qnd5vl.js +0 -1
  223. package/dist/assets/command-palette-CYJg3gK4.js +0 -1
  224. package/dist/assets/debug-page-Cu82bP9V.js +0 -4
  225. package/dist/assets/deploy-dialogs-B1_w7Ez-.js +0 -1
  226. package/dist/assets/document-load-DHdbQvKt.js +0 -1
  227. package/dist/assets/esm-5n5jSt3e.js +0 -2
  228. package/dist/assets/esm-B5HvNA2f.js +0 -1
  229. package/dist/assets/esm-BVAuvmyr.js +0 -2
  230. package/dist/assets/esm-CIgMNIdz.js +0 -1
  231. package/dist/assets/esm-CvOYazPQ.js +0 -2
  232. package/dist/assets/esm-DetZupO7.js +0 -2
  233. package/dist/assets/esm-DpDUzGbk.js +0 -2
  234. package/dist/assets/general-page-B5G4H9NJ.js +0 -2
  235. package/dist/assets/intelligence-layout-slots-store-BvTIV21o.js +0 -1
  236. package/dist/assets/local-mode-C-1-fXwg.js +0 -1
  237. package/dist/assets/mutation-error--JEZBa3Q.js +0 -1
  238. package/dist/assets/native-attachment-pickers-BAxJDXTk.js +0 -1
  239. package/dist/assets/native-file-BlJDG-CS.js +0 -1
  240. package/dist/assets/paired-platform-identity-BN7Zkoo1.js +0 -1
  241. package/dist/assets/password-reset-page-j1R5YVAm.js +0 -1
  242. package/dist/assets/plugins-surface-ClVSBf-s.js +0 -1
  243. package/dist/assets/privacy-page-B2g1Pqqs.js +0 -1
  244. package/dist/assets/referral-modal-BUgtMC2a.js +0 -1
  245. package/dist/assets/routes-zhZ8T_Wu.js +0 -1
  246. package/dist/assets/share-feedback-modal-C2fAj8NH.js +0 -1
  247. package/dist/assets/teleport-gateway-client-B8e53i-5.js +0 -1
  248. package/dist/assets/tool-detail-panel-BM_9qtZ-.js +0 -1
  249. package/dist/assets/use-supports-credentials-settings-fg3eXgQy.js +0 -1
  250. package/dist/assets/welcome-screen-B1WHzW0q.js +0 -1
  251. /package/dist/assets/{account-BkxBMG9Z.js → account-BlV1qOTL.js} +0 -0
  252. /package/dist/assets/{account-OIF2BHH7.js → account-Yhb7EPiE.js} +0 -0
  253. /package/dist/assets/{account-D5JdUO7K.js → account-iXFebGNX.js} +0 -0
  254. /package/dist/assets/{account-DYG79724.js → account-zbO2wvfB.js} +0 -0
  255. /package/dist/assets/{activation-Dd7eAIHs.js → activation-BBxBYSHn.js} +0 -0
  256. /package/dist/assets/{activation-tasks-rViOqW7C.js → activation-BpktogSQ.js} +0 -0
  257. /package/dist/assets/{activation-C91KPzrh.js → activation-CflM_LQ5.js} +0 -0
  258. /package/dist/assets/{activation-ReimSfhn.js → activation-Daef_l1I.js} +0 -0
  259. /package/dist/assets/{activation-tasks-wtMwJ0EV.js → activation-tasks-CV_7HKqY.js} +0 -0
  260. /package/dist/assets/{activation-yoBQ36AY.js → activation-tasks-CumTmEGs.js} +0 -0
  261. /package/dist/assets/{activation-tasks-efxGWsFw.js → activation-tasks-ayYeMiiM.js} +0 -0
  262. /package/dist/assets/{activation-tasks-D4dorV2v.js → activation-tasks-cUwRl0aM.js} +0 -0
  263. /package/dist/assets/{assistant-inbox-CAvCHzi9.js → assistant-inbox-BTOw7wfJ.js} +0 -0
  264. /package/dist/assets/{assistant-inbox-qWeVmA1L.js → assistant-inbox-CrSow2BT.js} +0 -0
  265. /package/dist/assets/{assistant-inbox-DslyrhIn.js → assistant-inbox-DFWc70zr.js} +0 -0
  266. /package/dist/assets/{assistant-inbox-CQdSXLLi.js → assistant-inbox-Yf62pQhK.js} +0 -0
  267. /package/dist/assets/{build.umd-B0ATW5UM.js → build.umd-DYhQfml1.js} +0 -0
  268. /package/dist/assets/{channels-Cz7YAOIH.js → channels-CgD67LT0.js} +0 -0
  269. /package/dist/assets/{channels-BMnoL5SH.js → channels-DeTGbiPP.js} +0 -0
  270. /package/dist/assets/{channels-vNXfvsPT.js → channels-DmpyD-3T.js} +0 -0
  271. /package/dist/assets/{channels-CsbKXJZc.js → channels-DuQeNaoa.js} +0 -0
  272. /package/dist/assets/{chat-DSN9cMJf.js → chat--ZmD-zey.js} +0 -0
  273. /package/dist/assets/{chat-bnp2gG3L.js → chat-Ck0pUgkI.js} +0 -0
  274. /package/dist/assets/{chat-BgW0N2Gb.js → chat-D6epoOzw.js} +0 -0
  275. /package/dist/assets/{chat-BE3uio8d.js → chat-D7C62t6i.js} +0 -0
  276. /package/dist/assets/{common-LOT1T5DR.js → common-BE18Mx30.js} +0 -0
  277. /package/dist/assets/{common-IoqtSg0p.js → common-Csoou9wq.js} +0 -0
  278. /package/dist/assets/{common-kmi6H4cg.js → common-Da7fmzzI.js} +0 -0
  279. /package/dist/assets/{common-BdQfnACd.js → common-Du9wm05t.js} +0 -0
  280. /package/dist/assets/{contacts-BTmOfEVL.js → contacts-Caqw0Sif.js} +0 -0
  281. /package/dist/assets/{contacts-Cxz-DyYF.js → contacts-Co__1ikw.js} +0 -0
  282. /package/dist/assets/{contacts-DgC-8PHB.js → contacts-DD_eTIfs.js} +0 -0
  283. /package/dist/assets/{contacts-mijLgegD.js → contacts-DK2Vo7jK.js} +0 -0
  284. /package/dist/assets/{credential-requests-CmFaXPwz.js → credential-requests-BGJaT5P8.js} +0 -0
  285. /package/dist/assets/{credential-requests-gl4lfjL4.js → credential-requests-CLJKvy8_.js} +0 -0
  286. /package/dist/assets/{credential-requests-D3J3i5oa.js → credential-requests-CY3rhP-v.js} +0 -0
  287. /package/dist/assets/{credential-requests-h908NRpv.js → credential-requests-K_K5QYWo.js} +0 -0
  288. /package/dist/assets/{definitions-BUCExH-9.js → definitions-BlPXXV5t.js} +0 -0
  289. /package/dist/assets/{definitions-DpZNNWA7.js → definitions-LeNf6LcI.js} +0 -0
  290. /package/dist/assets/{home-D4Knhe9B.js → home-Ciwnqb-0.js} +0 -0
  291. /package/dist/assets/{home-BI-fzzA0.js → home-D9CyYzwt.js} +0 -0
  292. /package/dist/assets/{home-BZGFmZ0D.js → home-DRimDXb8.js} +0 -0
  293. /package/dist/assets/{home-CM9kRnjx.js → home-FBlk-Kn_.js} +0 -0
  294. /package/dist/assets/{intelligence-DFW_P1Fv.js → intelligence-CxgptCMO.js} +0 -0
  295. /package/dist/assets/{intelligence-DXMdwG0t.js → intelligence-DNvhgTjL.js} +0 -0
  296. /package/dist/assets/{intelligence-B6UWzaf0.js → intelligence-leUjdPLY.js} +0 -0
  297. /package/dist/assets/{intelligence-DaVJutXG.js → intelligence-xPDdEiiN.js} +0 -0
  298. /package/dist/assets/{library-Dv9w5D8Z.js → library-DyYHQ0GO.js} +0 -0
  299. /package/dist/assets/{library-CFGvGWZt.js → library-EaBsKALT.js} +0 -0
  300. /package/dist/assets/{library-CmSFUt9r.js → library-Hu58bAic.js} +0 -0
  301. /package/dist/assets/{library-D26ezl8B.js → library-JzJCLakz.js} +0 -0
  302. /package/dist/assets/{logs-BJTGRcSn.js → logs-Bz1qUaJ9.js} +0 -0
  303. /package/dist/assets/{logs-BpX8Zuzb.js → logs-CZofq5k0.js} +0 -0
  304. /package/dist/assets/{logs-5jFWrQRx.js → logs-DWYxin7R.js} +0 -0
  305. /package/dist/assets/{logs-BPrpYBp7.js → logs-g4hcj_Po.js} +0 -0
  306. /package/dist/assets/{onboarding-B9_JitSg.js → onboarding-B8Kqi3lF.js} +0 -0
  307. /package/dist/assets/{onboarding-cBGAfB74.js → onboarding-BmTUYcow.js} +0 -0
  308. /package/dist/assets/{onboarding-BrS1fcVE.js → onboarding-Cg2xtY6u.js} +0 -0
  309. /package/dist/assets/{onboarding-Cx2yoeE5.js → onboarding-CudNVueP.js} +0 -0
  310. /package/dist/assets/{pdf-_tTrkaWt.js → pdf-D787RoTm.js} +0 -0
  311. /package/dist/assets/{remote-web-DkzrBzGi.js → remote-web-B48hBzZQ.js} +0 -0
  312. /package/dist/assets/{remote-web-42kFkA33.js → remote-web-BWB9gusD.js} +0 -0
  313. /package/dist/assets/{remote-web-DFX945w2.js → remote-web-Dir5X2Uc.js} +0 -0
  314. /package/dist/assets/{remote-web-CFPdQIeJ.js → remote-web-DoH8uPma.js} +0 -0
  315. /package/dist/assets/{schedules-CGU7CKaM.js → schedules-BWTSjt7H.js} +0 -0
  316. /package/dist/assets/{schedules-JnprnWDo.js → schedules-CWPFs_Xm.js} +0 -0
  317. /package/dist/assets/{schedules-J687h0Fh.js → schedules-DrYrmkfN.js} +0 -0
  318. /package/dist/assets/{schedules-Bk7XGnqS.js → schedules-Oj3x1jCN.js} +0 -0
  319. /package/dist/assets/{terminal-Cxm0NKaj.js → terminal-0PGnTYRE.js} +0 -0
  320. /package/dist/assets/{terminal-BV6xg9ZA.js → terminal-BxOTNQdO.js} +0 -0
  321. /package/dist/assets/{terminal-CYHsl1AH.js → terminal-CTNk9Vx-.js} +0 -0
  322. /package/dist/assets/{terminal-BjOF3LBT.js → terminal-DMbjaLiG.js} +0 -0
  323. /package/dist/assets/{workspace-C-huZiu_.js → workspace-7FfNfyOX.js} +0 -0
  324. /package/dist/assets/{workspace-Bcvg2VfS.js → workspace-ALDzNPUC.js} +0 -0
  325. /package/dist/assets/{workspace-P8HaFDdu.js → workspace-DrLe-8Lj.js} +0 -0
  326. /package/dist/assets/{workspace-BscXtFFU.js → workspace-Dxoo5uUn.js} +0 -0
  327. /package/dist/assets/{xterm-Pyzkt_-B.js → xterm-6q1BGEu_.js} +0 -0
  328. /package/dist/assets/{xterm-addon-fit-HaY_WHvm.js → xterm-addon-fit-DARdNMYD.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,AS as n,A_ as r,BC as i,Br as a,Ci as o,EC as s,FC as c,Gc as l,Hr as u,Hy as d,Iy as f,Jm as p,Kc as m,Km as h,Ky as g,LS as _,OC as v,PC as y,Pi as b,Qm as x,Qu as S,Ry as C,SS as w,UC as T,Ur as E,Vr as D,W as O,WC as k,Wy as A,Xu as j,Ym as M,Zc as N,Zf as P,Zu as F,_h as I,am as ee,bh as te,bi as ne,eC as L,ew as re,gC as R,hC as z,iC as B,im as ie,iw as ae,mC as oe,nm as se,om as ce,qd as le,qm as ue,rm as V,rw as de,sm as fe,tu as pe,tw as H,vi as me,xS as he,yi as ge,zC as U}from"./app-KRIEMzuO.js";import{$n as W,E as G,Xn as K,er as _e,nr as q}from"./vendor-DLH51Vjf.js";import{_ as ve,d as ye,f as be,t as xe,x as Se}from"./react-B9IgSVeK.js";import{$r as Ce,A as we,At as Te,D as J,Ji as Y,Lt as Ee,Pt as De,Ya as Oe,Yn as ke,Zr as Ae,a as je,dr as Me,ft as Ne,gt as Pe,i as Fe,li as Ie,qi as Le,vt as Re,za as ze}from"./icons-C0wyat6T.js";import{a as Be,n as Ve,r as He,u as Ue}from"./use-plugins-list-DJlgCfb-.js";var We=Oe(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ge=[`productivity`,`communication`,`meetings`,`sales`,`marketing`,`finance`,`commerce`,`engineering`,`knowledge`,`recruiting`],Ke=new Set(Ge);function qe(e){return typeof e==`string`&&Ke.has(e)}var X=e(Se(),1),Z=xe(),Je={"mcp-oauth":We,"mcp-manual":We,"managed-oauth":Ne,"own-oauth":Me};function Ye(e){let{t}=G(`settings`);return(0,X.useCallback)(n=>{switch(n.kind){case`mcp-oauth`:return t(`connectMethod.mcp`,{name:e});case`mcp-manual`:return t(`connectMethod.mcpManual`);case`managed-oauth`:return t(`connectMethod.managed`);case`own-oauth`:return t(`connectMethod.own`)}},[t,e])}function Xe(e,t,n){return e.map(e=>(0,Z.jsx)(k.Item,{icon:Je[e.kind],label:t(e),onSelect:()=>n(e)},e.id))}var Ze={slack:`slack_channel`,discord:`discord_channel`,telegram:`telegram`};function Qe(e){return Object.entries(Ze).some(([t,n])=>t===e&&n!==e)}function $e(e){return`plugin:${e}`}function et(e){let t=e.filter(e=>e.transport.type!==`stdio`&&e.status!==`connected`);return t.length===1?t[0].id:null}function tt(e){return async()=>(await e.install(),et(await e.loadPluginServers()))}function nt(e,t){return e.filter(e=>e.source===`plugin`&&e.pluginName===t)}function rt(e){return qe(e)?e:null}function it(e){let{connectedCount:t,needsAttention:n}=ot(e,[]);return{connectedCount:t,needsAttention:n}}function at(e,t){return e.filter(e=>e.provider===t)}function ot(e,t,n=!0){let r=t.flatMap(e=>e.servers),i=t.filter(e=>ct(e,n));return{connectedCount:e.filter(e=>e.connected).length+r.filter(e=>e.status===`connected`).length,needsAttention:e.some(e=>!e.connected)||i.some(e=>e.servers.some(e=>e.status!==`connected`)),configured:e.length>0||i.length>0}}function st(e){return e.status===`connected`||e.hasOAuth||e.hasStaticAuth}function ct(e,t=!0){return t?e.servers.some(st)?!0:!!e.definition.installed&&et(e.servers)===null:!!e.definition.installed||e.servers.length>0}function lt(e){if(e.transport.url)try{return new URL(e.transport.url).hostname}catch{return}}function ut(e,t,n,r=[],i=!0){let a=r.map(e=>({definition:e,servers:nt(n,e.pluginName)})),o=new Set,s=new Set(a.flatMap(e=>e.servers));return[...e.filter(e=>e.supports_managed_mode).flatMap(e=>{let n=at(t,e.provider_key);if(Qe(e.provider_key)&&n.length===0)return[];let r=a.filter(t=>t.definition.oauthProvider===e.provider_key);return r.forEach(e=>o.add(e)),[{kind:`oauth`,id:`oauth:${e.provider_key}`,name:e.display_name??e.provider_key,description:[e.description,...r.map(e=>e.definition.description)].filter(Boolean).join(` `),configured:ot(n,r,i).configured,category:rt(e.category),provider:e,connections:n,methods:r}]}),...a.filter(e=>!o.has(e)).map(e=>({kind:`plugin`,id:`plugin:${e.definition.pluginName}`,name:e.definition.displayName,description:e.definition.description,configured:ct(e,i),category:e.definition.category??null,method:e})),...n.filter(e=>!s.has(e)).map(e=>({kind:`mcp`,id:`mcp:${e.id}`,name:e.id,description:[e.pluginName,lt(e)].filter(Boolean).join(` `),configured:!0,category:null,server:e}))]}function dt(e,t,n=null){let r=t.trim().toLocaleLowerCase();return e.filter(e=>!n||e.category===n).filter(e=>!r||e.name.toLocaleLowerCase().includes(r)||e.description.toLocaleLowerCase().includes(r)).sort((e,t)=>Number(t.configured)-Number(e.configured)||e.name.localeCompare(t.name)||e.id.localeCompare(t.id))}function ft(e){return e.logo?o(`/images/integrations/${e.logo}`):null}function Q(e){return e===`mcp-oauth`||e===`mcp-manual`}function pt(e){switch(e.status){case`connected`:return`connected`;case`connecting`:case`starting`:return`connecting`;case`declared`:return`pending`;default:return`needs-attention`}}function mt(e,t,n){let r=e.servers.length>1;return e.servers.map(e=>{let i=pt(e);return{id:`mcp:${e.id}`,methodId:t,methodKind:n,label:r?e.id:null,detail:lt(e),status:i,pluginName:e.pluginName,serverId:e.id,canReconnect:i!==`connected`&&i!==`connecting`&&e.transport.type!==`stdio`&&!e.hasStaticAuth}})}function ht(e,t,n){return{id:`plugin:${e.pluginName}`,methodId:t,methodKind:n,label:null,status:`pending`,pluginName:e.pluginName,canReconnect:!1}}function gt(e,t){return e.map(e=>({id:`oauth:${e.id}`,methodId:t,methodKind:`managed-oauth`,label:e.account_label,accountId:e.id,status:e.connected?`connected`:`needs-attention`,canReconnect:!e.connected}))}function _t(e,t){let{definition:n}=e,r=n.setup.mode===`manual`?`mcp-manual`:`mcp-oauth`,i=`mcp:${n.pluginName}`,a=t&&e.servers.length===0&&n.installed;return{id:i,kind:r,availability:`available`,instructions:n.setup.instructions,setupGuideUrl:n.documentationUrl,connections:a?[ht(n,i,r)]:mt(e,i,r),plugin:n}}function vt(e,t){let n=[],r,i=null,a;if(e.kind===`oauth`){r=e.provider.provider_key,i=e.provider.logo_url,a=e.provider.description;for(let r of e.methods)n.push(_t(r,t.mcpServersLoaded));if(t.platformGate!==`gated`){let r=`managed:${e.provider.provider_key}`;n.push({id:r,kind:`managed-oauth`,availability:t.platformGate===`full`?`available`:`login-required`,connections:gt(e.connections,r)})}t.ownOAuthAvailable&&n.push({id:`own:${e.provider.provider_key}`,kind:`own-oauth`,availability:`available`,setupGuideUrl:e.provider.dashboard_url??void 0,connections:[]})}else{let{definition:o}=e.method;r=o.pluginName,i=ft(o),a=o.description,n.push(_t(e.method,t.mcpServersLoaded))}let[o,...s]=n;return o?{name:e.name,description:a,iconKey:r,logoUrl:i,primary:o,alternatives:s}:null}function yt(e){return[e.primary,...e.alternatives]}function bt(e){return yt(e).flatMap(e=>e.connections)}function xt(e){return yt(e).filter(e=>!Q(e.kind)||e.connections.length===0)}var $=`pointer-coarse:size-11`,St=[`flex flex-wrap items-start gap-2 [&>*]:shrink-0`,`[&_button]:max-w-full [&_button]:whitespace-normal`,`[&_button]:pointer-coarse:min-h-11`].join(` `);function Ct({icon:e,title:t,subtitle:n,status:r,primaryAction:a,actionMenu:o,layout:s=`row`}){return s===`tile`?(0,Z.jsxs)(i.Root,{bordered:!0,className:`flex h-full flex-col gap-3 transition-colors hover:border-[var(--border-hover)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[e,(0,Z.jsxs)(`div`,{className:`${St} justify-end`,children:[a,o]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),(0,Z.jsx)(`p`,{className:`line-clamp-2 min-h-9 text-body-small-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n})]})]}):(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{padding:`md`,className:`grid grid-cols-[2rem_minmax(6rem,1fr)_minmax(0,auto)] items-start gap-x-3`,children:[e,(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),r]}),n?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-body-medium-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n}):null]}),(0,Z.jsxs)(`div`,{className:`${St} col-start-3 row-start-1 justify-end`,children:[a,o]})]})})}function wt({plan:e,title:t,description:n}){return(0,Z.jsx)(R.Header,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(E,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:40}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(R.Title,{className:`[&>span]:whitespace-normal`,children:t}),(0,Z.jsx)(R.Description,{children:n})]})]})})}function Tt({plan:e,attempt:n,focusMethodId:r,callbackUrl:i,callbackCopied:a=!1,toolsByConnectionId:o,ownOAuthContent:s,tenantHost:c,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onReconnect:p,onDisconnect:m,onOpenTools:h,onCopyCallbackUrl:g,onOpenSetupGuide:_,onClose:v}){let{t:y}=G(`settings`),b=Ye(e.name),x=yt(e),S=bt(e),[C,w]=(0,X.useState)(()=>r?{kind:`connect`,methodId:r}:S.length>0?{kind:`connections`}:{kind:`connect`,methodId:e.primary.id}),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(null);function k(t){return t.kind===`connect`?t:S.length===0?{kind:`connect`,methodId:e.primary.id}:t.kind===`tools`&&!S.some(e=>e.id===t.connectionId)?{kind:`connections`}:t}let A=k(C);function j(e){switch(e.kind){case`mcp-oauth`:case`mcp-manual`:return y(`integrationConnect.tagMcp`);case`managed-oauth`:return y(`integrationConnect.tagVellum`);case`own-oauth`:return y(`integrationConnect.tagOwnApp`)}}function M(t){return t.label?t.label:Q(t.methodKind)?y(`integrationConnect.connectionMcpLabel`,{name:e.name}):y(`integrationConnect.connectionAccountLabel`,{name:e.name})}function N(e,t){return Xe(e,b,t)}function P(e){E(!1),w({kind:`connect`,methodId:e.id})}function F(){if(S.length>0){w({kind:`connections`});return}w({kind:`connect`,methodId:e.primary.id})}let I=A.kind===`tools`?S.find(e=>e.id===A.connectionId):void 0,ee=A.kind===`connect`?x.find(e=>e.id===A.methodId)??e.primary:e.primary;function te(e){let n=e.setupGuideUrl;return n?(0,Z.jsx)(t,{variant:`ghost`,className:`mr-auto min-h-11`,leftIcon:(0,Z.jsx)(Ae,{}),onClick:()=>_(n),children:y(`integrationConnect.setupGuide`)}):null}return(0,Z.jsxs)(R.Root,{open:!0,onOpenChange:e=>{e||v()},children:[(0,Z.jsx)(R.Content,{size:`md`,children:A.kind===`connect`?(0,Z.jsx)(Et,{plan:e,method:ee,setupGuide:te(ee),methods:x,attempt:n,callbackUrl:i,callbackCopied:a,ownOAuthContent:s,tenantHost:c,acknowledged:T,hasConnections:S.length>0,methodItems:N,onAcknowledge:E,onPickMethod:P,onBack:F,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onCopyCallbackUrl:g,onClose:v}):A.kind===`tools`?(0,Z.jsx)(Mt,{plan:e,connection:I,title:I?M(I):e.name,tools:o?.[A.connectionId],onBack:()=>w({kind:`connections`}),onClose:v}):(0,Z.jsx)(At,{plan:e,methods:x,connections:S,connectionTitle:M,methodTag:j,methodItems:N,onPickMethod:P,onOpenTools:e=>{h?.(e),w({kind:`tools`,connectionId:e.id})},onReconnect:e=>{p(e),w({kind:`connect`,methodId:e.methodId})},onRequestDisconnect:O,onClose:v})}),(0,Z.jsx)(oe,{open:D!==null,destructive:!0,title:y(`integrationConnect.removeTitle`,{label:D?M(D):``}),message:y(`integrationConnect.removeMessage`),confirmLabel:y(`integrationConnect.remove`),cancelLabel:y(`integrationConnect.cancel`),onConfirm:()=>{D&&m(D),O(null)},onCancel:()=>O(null)})]})}function Et({plan:e,method:n,methods:r,attempt:i,callbackUrl:a,callbackCopied:o,ownOAuthContent:s,tenantHost:c,acknowledged:l,hasConnections:d,setupGuide:f,methodItems:p,onAcknowledge:m,onPickMethod:h,onBack:g,onConnect:_,onLogin:y,onCancelAttempt:b,onRetryAttempt:x,onCopyCallbackUrl:S,onClose:C}){let{t:w}=G(`settings`),E=n.kind===`managed-oauth`?c:null,D=u(E),O=i?.methodId===n.id?i:null,k=O!==null&&O.phase!==`error`,A=n.availability===`login-required`,j=n.kind===`mcp-manual`&&a!==void 0&&(!l||a.status!==`ready`),M=n.id!==e.primary.id||d,N=r.filter(e=>e.id!==n.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:w(`integrationConnect.connectTitle`,{name:e.name}),description:e.description??w(`integrationConnect.connectDescription`,{name:e.name})}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[M?(0,Z.jsx)(t,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:g,children:w(`integrationConnect.back`)}):null,A?(0,Z.jsx)(U,{tone:`info`,children:w(`integrationConnect.loginRequired`,{name:e.name})}):null,O?(0,Z.jsx)(Dt,{name:e.name,attempt:O,onCancel:b,onRetry:x}):null,E?(0,Z.jsx)(v,{label:E.label,type:`text`,value:D.value,onChange:e=>D.setValue(e.target.value),placeholder:E.placeholder,"aria-invalid":D.showsInvalid||void 0,helperText:D.showsInvalid?w(`integrationConnect.tenantHostInvalid`,{label:E.label,placeholder:E.placeholder}):void 0,disabled:k,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,fullWidth:!0}):null,n.kind===`mcp-manual`?(0,Z.jsx)(Ot,{instructions:n.instructions,name:e.name,callbackUrl:a,callbackCopied:o,acknowledged:l,onAcknowledge:m,onCopyCallbackUrl:S}):n.kind===`own-oauth`?s:(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n.instructions??w(`integrationConnect.browserHint`,{name:e.name})})]}),(0,Z.jsxs)(R.Footer,{children:[f,(0,Z.jsx)(t,{variant:`ghost`,className:`min-h-11`,onClick:C,children:w(`integrationConnect.cancel`)}),n.kind===`own-oauth`?null:(0,Z.jsx)(T,{className:`min-h-11`,disabled:k||j||!D.valid,menuDisabled:k,leftIcon:k?(0,Z.jsx)(ke,{className:`animate-spin`}):null,menuTitle:w(`integrationConnect.otherWays`),menuTriggerLabel:w(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:p(N,h),onClick:()=>A?y():_(n,{acknowledged:l,tenantHost:D.normalized}),children:w(A?`integrationConnect.loginToConnect`:`integrationConnect.connect`)})]})]})}function Dt({name:e,attempt:n,onCancel:r,onRetry:i}){let{t:a}=G(`settings`);if(n.phase===`error`)return(0,Z.jsx)(U,{tone:`error`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(t,{variant:`outlined`,onClick:i,children:a(`integrationConnect.retry`)}),(0,Z.jsx)(t,{variant:`ghost`,onClick:r,children:n.canCancel?a(`integrationConnect.stopWaiting`):a(`integrationConnect.cancel`)})]}),children:(0,Z.jsx)(`p`,{children:n.error??a(`integrationConnect.attemptFailed`,{name:e})})});let o=n.phase===`starting`?a(`integrationConnect.attemptStarting`,{name:e}):n.phase===`connecting`?a(`integrationConnect.attemptConnecting`,{name:e}):a(`integrationConnect.attemptWaiting`,{name:e});return(0,Z.jsx)(U,{tone:`info`,icon:(0,Z.jsx)(ke,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),actions:n.canCancel?(0,Z.jsx)(t,{variant:`ghost`,onClick:r,children:a(`integrationConnect.stopWaiting`)}):void 0,children:o})}function Ot({instructions:e,name:n,callbackUrl:r,callbackCopied:i,acknowledged:a,onAcknowledge:o,onCopyCallbackUrl:c}){let{t:l}=G(`settings`),u=r?.status===`ready`?r.url:void 0,d=e?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e}):null;return r?(0,Z.jsxs)(Z.Fragment,{children:[d,(0,Z.jsxs)(`ol`,{className:`space-y-4`,children:[(0,Z.jsxs)(kt,{index:1,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:l(`integrationConnect.manualStep1`)}),u?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-body-small-default [overflow-wrap:anywhere]`,children:u}),c?(0,Z.jsx)(t,{variant:`outlined`,size:`compact`,leftIcon:i?(0,Z.jsx)(Y,{}):(0,Z.jsx)(Ie,{}),onClick:()=>c(u),children:l(i?`integrationConnect.copied`:`integrationConnect.copy`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:r?.status===`error`?l(`integrationConnect.callbackError`):l(`integrationConnect.callbackLoading`)})]}),(0,Z.jsx)(kt,{index:2,children:(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:l(`integrationConnect.manualStep2`,{name:n})})}),(0,Z.jsx)(kt,{index:3,children:(0,Z.jsx)(s,{checked:a,onCheckedChange:e=>o(e===!0),label:l(`integrationConnect.manualStep3`)})})]})]}):d}function kt({index:e,children:t}){return(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0 text-body-medium-default text-[var(--content-tertiary)]`,children:e}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:t})]})}function At({plan:e,methods:n,connections:r,connectionTitle:i,methodTag:a,methodItems:o,onPickMethod:s,onOpenTools:c,onReconnect:l,onRequestDisconnect:u,onClose:d}){let{t:f}=G(`settings`),p=xt(e);function m(e){let t=n.find(t=>t.id===e.methodId);if(n.length<2||!t)return e.detail;let r=a(t);return e.detail?f(`integrationConnect.connectionSubtitle`,{method:r,detail:e.detail}):r}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:e.name,description:f(`integrationConnect.connectionsDescription`,{name:e.name})}),(0,Z.jsx)(R.Body,{children:(0,Z.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:r.map(e=>(0,Z.jsx)(L,{title:i(e),subtitle:m(e),trailingInteractive:!0,trailing:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 touch-mobile:max-w-24`,children:[(0,Z.jsx)(jt,{status:e.status}),e.canReconnect?(0,Z.jsx)(t,{variant:`outlined`,size:`compact`,leftIcon:(0,Z.jsx)(Te,{}),onClick:()=>l(e),children:e.status===`pending`?f(`integrationConnect.finishConnecting`):f(`integrationConnect.reconnect`)}):null,Q(e.methodKind)?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(je,{}),"aria-label":f(`integrationConnect.toolsAndDetailsLabel`,{label:i(e)}),onClick:()=>c(e)}):null,(0,Z.jsx)(t,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(we,{}),"aria-label":f(`integrationConnect.removeLabel`,{label:i(e)}),onClick:()=>u(e)})]})},e.id))})}),(0,Z.jsxs)(R.Footer,{children:[p.length>0?(0,Z.jsxs)(k.Root,{children:[(0,Z.jsx)(k.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`outlined`,className:`min-h-11`,rightIcon:(0,Z.jsx)(Le,{}),children:f(`integrationConnect.connectAnother`)})}),(0,Z.jsx)(k.Content,{title:f(`integrationConnect.connectAnother`),children:o(p,s)})]}):null,(0,Z.jsx)(t,{className:`min-h-11`,onClick:d,children:f(`integrationConnect.done`)})]})]})}function jt({status:e}){let{t}=G(`settings`);switch(e){case`needs-attention`:return(0,Z.jsx)(y,{tone:`negative`,children:t(`integrationConnect.statusNeedsAttention`)});case`connecting`:return(0,Z.jsx)(y,{children:t(`integrationConnect.statusConnecting`)});case`pending`:return(0,Z.jsx)(y,{children:t(`integrationConnect.statusPending`)});case`connected`:return null}}function Mt({plan:e,connection:n,title:r,tools:i,onBack:a,onClose:o}){let{t:s}=G(`settings`),c=i?.summary;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:r,description:s(`integrationConnect.toolsAndDetails`)}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Z.jsx)(t,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:a,children:s(`integrationConnect.back`)}),(0,Z.jsxs)(`dl`,{className:`space-y-1`,children:[(0,Z.jsx)(`dt`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.endpoint`)}),(0,Z.jsx)(`dd`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:i?.endpointUrl??n?.detail??s(`integrationConnect.endpointUnknown`)})]}),i?.loading?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsLoading`)}):i?.error?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsError`)}):c&&c.tools.length>0?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.toolsSummary`,{count:c.toolCount,tokens:c.estimatedTokens})}),(0,Z.jsx)(B.Root,{type:`multiple`,className:`rounded-lg border border-[var(--border-base)]`,children:c.tools.map(e=>(0,Z.jsxs)(B.Item,{value:e.name,className:`border-b border-[var(--border-base)] last:border-b-0`,children:[(0,Z.jsxs)(B.Trigger,{className:`justify-between gap-2 px-3 py-2.5 text-left [&[data-state=open]>svg]:rotate-180`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default`,children:e.name}),(0,Z.jsx)(Le,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform duration-150`})]}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1 px-3 pb-3`,children:[e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolTokens`,{tokens:e.estimatedTokens})})]})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsEmpty`)})]}),(0,Z.jsx)(R.Footer,{children:(0,Z.jsx)(t,{className:`min-h-11`,onClick:o,children:s(`integrationConnect.done`)})})]})}function Nt({providerKey:e,displayName:n,description:r,logoUrl:i,connections:a,mcpMethods:o=[],disabled:s,onConfigure:c}){let{t:l}=G(`settings`),{connectedCount:u}=it(a),{needsAttention:d,configured:f}=ot(a,o);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(E,{providerKey:e,displayName:n,logoUrl:i,size:32}),title:n,subtitle:u>0?l(`integrationRow.connectedAccounts`,{count:u}):r,status:d?(0,Z.jsx)(y,{tone:`negative`,children:l(`integrationRow.needsAttention`)}):void 0,primaryAction:f?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":l(`integrationRow.configureLabel`,{name:n}),onClick:c,disabled:s}):(0,Z.jsx)(t,{variant:`primary`,onClick:c,disabled:s,children:l(`integrationRow.connect`)})})}function Pt({plan:e,state:n,layout:r=`tile`,showAlternatives:i=!1,disabled:a=!1,onConnect:o,onLogin:s,onCancel:c,onRetry:l,onOpenSetupGuide:u}){let{t:d}=G(`settings`),f=Ye(e.name),p=de(),m=n.phase===`waiting`||n.phase===`connecting`,h=m&&!p;function g(e){if(e.availability===`login-required`){s();return}o(e)}function _(e){return Xe(e,f,g)}let v=i&&e.alternatives.length>0?(0,Z.jsx)(T,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),menuTitle:d(`integrationTile.connect`,{name:e.name}),menuTriggerLabel:d(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:_(yt(e)),disabled:a,onClick:()=>g(e.primary)}):(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),disabled:a,onClick:()=>g(e.primary)});return m?v=(0,Z.jsx)(zt,{name:e.name,state:n,announce:!h,onCancel:c}):n.phase===`failed`&&(v=(0,Z.jsx)(Rt,{plan:e,state:n,disabled:a,methodItems:_,onRetry:l,onOpenSetupGuide:u})),(0,Z.jsx)(Ct,{layout:r,icon:(0,Z.jsx)(E,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:32}),title:e.name,subtitle:n.phase===`failed`?(0,Z.jsx)(Lt,{name:e.name,state:n}):h&&m?(0,Z.jsx)(`span`,{role:`status`,children:It(d,e.name,n)}):e.description??void 0,primaryAction:v})}var Ft=4e3;function It(e,t,n){return n.phase===`waiting`?e(`integrationTile.waiting`,{name:t}):e(`integrationTile.connecting`,{name:t})}function Lt({name:e,state:t}){let{t:n}=G(`settings`),r=t.error||n(`integrationTile.failedGeneric`,{name:e});return(0,Z.jsxs)(`span`,{role:`alert`,title:t.error||void 0,className:`font-medium text-[var(--system-negative-strong)]`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 shrink-0 align-[-0.15em]`}),r]})}function Rt({plan:e,state:n,disabled:r,methodItems:i,onRetry:a,onOpenSetupGuide:o}){let{t:s}=G(`settings`),c=Q(n.methodKind)?n.setupGuideUrl:void 0,l=xt(e).filter(e=>e.id!==n.methodId),u=[...c?[(0,Z.jsx)(k.Item,{icon:Ae,label:s(`integrationTile.setupGuide`),onSelect:()=>o(c)},`setup-guide`)]:[],...i(l)],d=s(`integrationTile.retryLabel`,{name:e.name});return u.length===0?(0,Z.jsx)(t,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,disabled:r,onClick:a}):(0,Z.jsx)(T,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,menuTitle:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuTriggerLabel:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:u,disabled:r,onClick:a})}function zt({name:e,state:n,announce:r,onCancel:i}){let{t:a}=G(`settings`),o=de(),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=n.phase===`waiting`&&n.canCancel,d=It(a,e,n);function f(){l.current&&=(clearTimeout(l.current),null)}function p(e){f(),c(!0),e&&(l.current=setTimeout(()=>c(!1),Ft))}function m(){f(),c(!1)}(0,X.useEffect)(()=>f,[]);function h(e){return o&&e!==`touch`}let g=r?(0,Z.jsx)(`span`,{role:`status`,className:`sr-only`,children:d}):null;return u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:s?(0,Z.jsx)(Fe,{}):(0,Z.jsx)(ke,{className:`animate-spin`}),"aria-label":a(`integrationTile.cancelLabel`,{name:e}),tooltip:a(`integrationTile.waitingCancel`,{name:e}),onPointerEnter:e=>{h(e.pointerType)&&p(!1)},onPointerLeave:e=>{h(e.pointerType)&&m()},onBlur:m,onClick:e=>{if(s||e.detail===0){m(),i();return}p(!0)}}),g]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{content:d,children:(0,Z.jsx)(`span`,{className:ae(re({variant:`outlined`,iconOnly:!0}),$,`cursor-default hover:bg-transparent`),children:(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 animate-spin text-[var(--content-tertiary)]`})})}),g]})}function Bt({assistantId:e,providerKey:t,providerLabel:n,tenantHost:r,restartToken:i,onReport:a}){let{connect:o,dismiss:s,status:c,errorMessage:l}=me({assistantId:e,providerKey:t,providerLabel:n}),u=(0,X.useRef)(o),d=(0,X.useRef)(r);return(0,X.useLayoutEffect)(()=>{u.current=o,d.current=r}),(0,X.useLayoutEffect)(()=>{u.current(void 0,d.current)},[i]),(0,X.useEffect)(()=>s,[s]),(0,X.useEffect)(()=>{a({status:c,errorMessage:l})},[l,a,c]),null}function Vt(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function Ht(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}function Ut({assistantId:e,providerKey:n,displayName:r,logoUrl:a}){let{t:o}=G(`settings`),s=q(),c=W({...ie({path:{assistant_id:e},query:{provider_key:n}}),select:e=>e.apps}),l=W({...ce({path:{assistant_id:e,providerKey:n}}),select:e=>e.oauth_callback_url}),u=c.data??[],d=l.data??null,f=_e({queries:u.map(t=>({...se({path:{assistant_id:e,appId:t.id}}),select:e=>e.connections}))}),m={};u.forEach((e,t)=>{m[e.id]=f[t]?.data??[]});let g=ee({path:{assistant_id:e},query:{provider_key:n}}),_=p({onSuccess:()=>{s.invalidateQueries({queryKey:g}),D(``),k(``),w(!1),z.success(o(`yourOwnOauthTab.appAddedToast`,{name:r}))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.createFailedToast`))}}),y=ue({onSuccess:()=>{s.invalidateQueries({queryKey:g}),z.success(o(`yourOwnOauthTab.appDeletedToast`))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.deleteFailedToast`))}}),b=h({onSuccess:e=>{`auth_url`in e&&(window.location.href=e.auth_url)},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.connectFailedToast`))}}),x=M(),[S,w]=(0,X.useState)(!1),[T,D]=(0,X.useState)(``),[O,k]=(0,X.useState)(``),[A,j]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),te=_.isPending,ne=y.isPending?y.variables?.path?.id??null:null,L=b.isPending?b.variables?.path?.appId??null:null,re=x.isPending?x.variables?.path?.id??null:null,R=()=>{let t=T.trim(),r=O.trim();!t||!r||_.mutate({path:{assistant_id:e},body:{provider_key:n,client_id:t,client_secret:r}})},B=()=>{let t=N;P(null),t&&y.mutate({path:{assistant_id:e,id:t.id}})},ae=t=>{b.mutate({path:{assistant_id:e,appId:t.id},body:{callback_transport:`gateway`,scopes:[]}})};return c.isLoading?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(ke,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.length===0||S?(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:u.length===0?o(`yourOwnOauthTab.addOwnApp`,{name:r}):o(`yourOwnOauthTab.addAnotherApp`,{name:r})}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter leading-relaxed text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.credentialsNote`)})]}),d?(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:o(`yourOwnOauthTab.redirectUrl`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(v,{type:`text`,value:d,readOnly:!0,fullWidth:!0}),(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{C(d,{successMessage:o(`yourOwnOauthTab.copiedToast`),errorMessage:o(`yourOwnOauthTab.copyFailedToast`),onCopied:()=>{j(!0),setTimeout(()=>j(!1),2e3)}})},"aria-label":o(A?`yourOwnOauthTab.copiedAria`:`yourOwnOauthTab.copyRedirectAria`),iconOnly:A?(0,Z.jsx)(Y,{"aria-hidden":!0}):(0,Z.jsx)(Ie,{"aria-hidden":!0})})]}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.redirectHint`)})]}):null,(0,Z.jsx)(v,{label:o(`yourOwnOauthTab.clientId`),type:`text`,value:T,onChange:e=>D(e.target.value),placeholder:o(`yourOwnOauthTab.clientIdPlaceholder`),fullWidth:!0}),(0,Z.jsx)(v,{label:o(`yourOwnOauthTab.clientSecret`),type:`password`,value:O,onChange:e=>k(e.target.value),placeholder:o(`yourOwnOauthTab.clientSecretPlaceholder`),fullWidth:!0}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[u.length>0?(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{w(!1),D(``),k(``)},disabled:te,children:o(`yourOwnOauthTab.cancel`)}):null,(0,Z.jsx)(t,{type:`button`,size:`compact`,onClick:R,disabled:te||!T.trim()||!O.trim(),loading:te,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addApp`)})]})]})}):null,u.map(e=>{let s=m[e.id]??[],c=ne===e.id,l=L===e.id;return(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:Vt(e.client_id)}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.addedOn`,{date:Ht(e.created_at)})})]}),(0,Z.jsx)(t,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>P(e),disabled:c,"aria-label":o(`yourOwnOauthTab.deleteAppAria`,{id:Vt(e.client_id)}),loading:c,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]}),s.length>0?(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:s.map(i=>{let s=re===i.id,c=i.account_info??o(`yourOwnOauthTab.accountFallback`,{name:r});return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(E,{providerKey:n,displayName:r,logoUrl:a,size:18}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:c}),(0,Z.jsx)(t,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>I({appId:e.id,connection:i}),disabled:s,"aria-label":o(`yourOwnOauthTab.disconnectAria`,{account:c}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]},i.id)})}):null,(0,Z.jsx)(t,{type:`button`,size:`compact`,onClick:()=>ae(e),disabled:l,className:`w-full`,loading:l,leftIcon:(0,Z.jsx)(Ae,{"aria-hidden":!0}),children:o(l?`yourOwnOauthTab.waitingAuthorization`:`yourOwnOauthTab.connectAccount`)})]})},e.id)}),u.length>0&&!S?(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>w(!0),className:`w-full border-dashed`,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addAnotherAppButton`)}):null,(0,Z.jsx)(oe,{open:N!==null,title:o(`yourOwnOauthTab.deleteAppTitle`),message:N?o(`yourOwnOauthTab.deleteAppMessage`,{id:Vt(N.client_id)}):``,confirmLabel:o(`yourOwnOauthTab.delete`),destructive:!0,onConfirm:B,onCancel:()=>P(null)}),(0,Z.jsx)(oe,{open:F!==null,title:o(`yourOwnOauthTab.disconnectTitle`,{name:r}),message:F?o(`yourOwnOauthTab.disconnectMessage`,{account:F.connection.account_info??o(`yourOwnOauthTab.accountFallback`,{name:r})}):``,confirmLabel:o(`yourOwnOauthTab.disconnect`),destructive:!0,onConfirm:()=>{let t=F;I(null),t&&x.mutate({path:{assistant_id:e,id:t.connection.id}},{onSuccess:()=>{let n=V({path:{assistant_id:e,appId:t.appId}});s.invalidateQueries({queryKey:n}),s.invalidateQueries({queryKey:g}),z.success(o(`yourOwnOauthTab.disconnectedToast`,{name:r}))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.disconnectFailedToast`))}})},onCancel:()=>I(null)})]})}var Wt={phase:`idle`};function Gt({assistantId:e,mcp:t}){let{t:r}=G(`settings`),i=q(),{mutateAsync:o}=x(),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),v=(0,X.useRef)(null),y=(0,X.useRef)(null),b=t.auth.attempt,S=t.auth.connect,C=t.auth.retry,w=t.auth.stopWaiting,T=t.auth.isBusy,E=t.list.refetch;(0,X.useEffect)(()=>{let e=v.current;if(e&&(v.current=null,b&&b.operationId!==e.priorOperationId)){c({itemId:e.itemId,methodId:e.methodId,methodKind:e.methodKind,setupGuideUrl:e.setupGuideUrl,operationId:b.operationId});return}s&&b?.operationId!==s.operationId&&(c(null),y.current=null)},[b,s]),(0,X.useEffect)(()=>{b?.phase===`connecting`&&(y.current=null)},[b?.phase]),(0,X.useEffect)(()=>{!l||d?.status!==`connected`||(z.success(r(`useOauthConnect.accountConnected`,{name:l.providerLabel,ns:`common`})),u(null),f(null))},[l,d,r]);let D=(0,X.useCallback)(async e=>{let t=await E();return t.isError?[]:nt(t.data?.servers??[],e)},[E]),{remove:O}=Be(e,{onRemoved:()=>{E(),_(null)},onRemoveError:(e,t)=>{n(t,{context:`integrations.connectRollback`,tags:{plugin:e}}),_(null)},announceWarnings:!1}),k=(0,X.useCallback)((t,n)=>{let r=(async()=>{await o({path:{assistant_id:e},body:{name:t}}),m(i,e,t)})();return y.current={itemId:n,pluginName:t,landed:r.then(()=>!0,()=>!1)},r},[e,o,i]),A=(0,X.useCallback)(()=>{let e=y.current;y.current=null,e&&(_(e.itemId),e.landed.then(t=>{if(!t){_(null);return}O(e.pluginName)}))},[O]),j=(0,X.useCallback)(()=>{s&&w(),u(null),f(null),A()},[w,s,A]),M=(0,X.useCallback)((e,t,n,r)=>{g!==e.itemId&&(j(),v.current={...e,priorOperationId:b?.operationId??null},S(t,r,n))},[b,S,j,g]),N=(0,X.useCallback)((e,t,n)=>{let r=n.plugin;if(!r||T)return;let i=!!r.installed;M({itemId:e.id,methodId:n.id,methodKind:n.kind,setupGuideUrl:n.setupGuideUrl},$e(r.pluginName),t.name,tt({install:i?()=>Promise.resolve():()=>k(r.pluginName,e.id),loadPluginServers:()=>D(r.pluginName)}))},[T,M,k,D]),P=(0,X.useCallback)((e,t,n,r)=>{if(e.kind!==`oauth`||T)return;let{provider:i}=e;if(!r?.tenantHost&&a(i.provider_key,i.tenant_host)){h({itemId:e.id,methodId:n.id});return}j(),u({itemId:e.id,methodId:n.id,providerKey:i.provider_key,providerLabel:t.name,tenantHost:r?.tenantHost,restartToken:0})},[T,j]),F=(0,X.useCallback)((e,t,n,r)=>{if(Q(n.kind)){N(e,t,n);return}n.kind===`managed-oauth`&&P(e,t,n,r)},[P,N]),I=(0,X.useCallback)((e,t,n)=>{let r=yt(t).find(e=>e.id===n.methodId);if(!Q(n.methodKind)){r&&P(e,t,r);return}!n.serverId||T||M({itemId:e.id,methodId:n.methodId,methodKind:n.methodKind,setupGuideUrl:r?.setupGuideUrl},n.serverId,t.name)},[T,M,P]),ee=(0,X.useCallback)((e,t,n)=>{if(n.kind===`mcp-manual`||n.kind===`own-oauth`){h({itemId:e.id,methodId:n.id});return}F(e,t,n)},[F]),te=(0,X.useCallback)(()=>{if(s){if(b?.phase!==`error`)return;v.current={itemId:s.itemId,methodId:s.methodId,methodKind:s.methodKind,setupGuideUrl:s.setupGuideUrl,priorOperationId:s.operationId},C();return}f(null),u(e=>e&&{...e,restartToken:e.restartToken+1})},[b,C,s]),ne=(0,X.useCallback)((e,t)=>s?.itemId===e&&b?b.phase===`error`?{phase:`failed`,error:b.error??r(`integrationTile.failedGeneric`,{name:t}),methodId:s.methodId,methodKind:s.methodKind,setupGuideUrl:s.setupGuideUrl}:b.phase===`connecting`?{phase:`connecting`}:{phase:`waiting`,canCancel:!0}:l?.itemId===e?d?.errorMessage?{phase:`failed`,error:d.errorMessage,methodId:l.methodId,methodKind:`managed-oauth`}:{phase:`waiting`,canCancel:!0}:Wt,[b,l,d,s,r]),L=(0,X.useCallback)(e=>s?.itemId===e&&b?{methodId:s.methodId,phase:b.phase,error:b.error,canCancel:!0}:l?.itemId===e?{methodId:l.methodId,phase:d?.errorMessage?`error`:`waiting`,error:d?.errorMessage??void 0,canCancel:!0}:null,[b,l,d,s]),re=(0,X.useCallback)(e=>T&&s?.itemId!==e||l!==null&&l.itemId!==e||g===e,[T,l,s,g]),R=(0,X.useCallback)((e,t)=>h({itemId:e,methodId:t}),[]),B=(0,X.useCallback)(()=>h(null),[]);return{start:ee,run:F,reconnect:I,cancel:j,retry:te,stateFor:ne,attemptFor:L,isBusyElsewhere:re,ownsMcpAttempt:s!==null,attemptItemId:s?.itemId??l?.itemId??null,managed:l,onManagedReport:f,modal:p,openModal:R,closeModal:B}}function Kt({assistantId:e,platformAssistantId:t,onStopAuth:n,onRemoveServer:r,onPluginRemoved:i}){let{t:a}=G(`settings`),o=q(),s=(0,X.useRef)(``),c=Be(e,{onRemoved:()=>{i(),z.success(a(`integrationConnect.removedToast`,{name:s.current}))},onRemoveError:()=>z.error(a(`integrationConnect.removeFailedToast`,{name:s.current}))}),l={path:{assistant_id:t??``}},u=le({onSuccess(e,t){z.success(a(`integrationConnect.disconnectedToast`,{name:s.current}));let n=t.path.connection_id;S(o,l,e=>e?.filter(e=>e.id!==n)),o.invalidateQueries({queryKey:F(l)})},onError(e){z.error(_(e,void 0,a(`integrationConnect.disconnectFailedToast`,{name:s.current})))}}),d=u.mutate,f=c.remove,p=c.isRemoving||u.isPending;return(0,X.useCallback)((e,i)=>{if(!p){if(s.current=i,Q(e.methodKind)){if(n(e),e.pluginName){f(e.pluginName);return}e.serverId&&r(e.serverId);return}!e.accountId||!t||d({path:{assistant_id:t,connection_id:e.accountId}})}},[p,d,r,n,t,f])}var qt=[{value:`none`,labelKey:`mcpAddServerModal.authNone`},{value:`oauth`,labelKey:`mcpAddServerModal.authOAuth`},{value:`bearer`,labelKey:`mcpAddServerModal.authBearer`},{value:`api-key`,labelKey:`mcpAddServerModal.authApiKey`}],Jt=[{value:`sse`,labelKey:`mcpAddServerModal.transportSse`},{value:`streamable-http`,labelKey:`mcpAddServerModal.transportStreamableHttp`},{value:`stdio`,labelKey:`mcpAddServerModal.transportStdio`}];function Yt(e){return qt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Xt(e){return Jt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Zt({open:e,onClose:n,onAdd:r,isPending:i}){let{t:a}=G(`settings`),o=(0,X.useMemo)(()=>Yt(a),[a]),s=(0,X.useMemo)(()=>Xt(a),[a]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`sse`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[y,b]=(0,X.useState)(`none`),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(`X-API-Key`),[T,E]=(0,X.useState)(``),D=(0,X.useCallback)(()=>{l(``),d(`sse`),p(``),h(``),_(``),b(`none`),S(``),w(`X-API-Key`),E(``)},[]),O=(0,X.useCallback)(()=>{i||(D(),n())},[i,D,n]),k=(0,X.useCallback)(()=>{let e=c.trim();if(!e)return;let t={name:e,transportType:u};if(u===`stdio`){let e=m.trim();if(!e)return;t.command=e;let n=g.trim();n&&(t.args=n.split(/\s+/))}else{let e=f.trim();if(!e)return;t.url=e,y===`bearer`&&x.trim()?t.headers={Authorization:`Bearer ${x.trim()}`}:y===`api-key`&&C.trim()&&T.trim()?t.headers={[C.trim()]:T.trim()}:y===`oauth`&&(t.autoAuth=!0)}r(t)},[c,u,f,m,g,y,x,C,T,r]),A=u===`stdio`,j=c.trim()&&(A?m.trim():f.trim());return(0,Z.jsx)(R.Root,{open:e,onOpenChange:e=>{e||O()},children:(0,Z.jsxs)(R.Content,{size:`md`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:a(`mcpAddServerModal.title`)}),(0,Z.jsx)(R.Description,{children:a(`mcpAddServerModal.description`)})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-name`,children:a(`mcpAddServerModal.serverNameLabel`)}),(0,Z.jsx)(v,{id:`mcp-name`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a(`mcpAddServerModal.namePlaceholder`),fullWidth:!0,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-transport`,children:a(`mcpAddServerModal.transportLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-transport`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),A?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-command`,children:a(`mcpAddServerModal.commandLabel`)}),(0,Z.jsx)(v,{id:`mcp-command`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:a(`mcpAddServerModal.commandPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-args`,children:a(`mcpAddServerModal.argsLabel`)}),(0,Z.jsx)(v,{id:`mcp-args`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:a(`mcpAddServerModal.argsPlaceholder`),fullWidth:!0})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-url`,children:a(`mcpAddServerModal.serverUrlLabel`)}),(0,Z.jsx)(v,{id:`mcp-url`,type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:a(`mcpAddServerModal.urlPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-auth`,children:a(`mcpAddServerModal.authenticationLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-auth`,value:y,onChange:e=>b(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:o.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),y===`oauth`?(0,Z.jsx)(`p`,{className:`rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`mcpAddServerModal.oauthHint`)}):null,y===`bearer`?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-bearer`,children:a(`mcpAddServerModal.bearerTokenLabel`)}),(0,Z.jsx)(v,{id:`mcp-bearer`,type:`password`,value:x,onChange:e=>S(e.target.value),placeholder:a(`mcpAddServerModal.bearerPlaceholder`),fullWidth:!0})]}):null,y===`api-key`?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-header`,children:a(`mcpAddServerModal.headerNameLabel`)}),(0,Z.jsx)(v,{id:`mcp-apikey-header`,type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyHeaderPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-value`,children:a(`mcpAddServerModal.apiKeyLabel`)}),(0,Z.jsx)(v,{id:`mcp-apikey-value`,type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(t,{variant:`ghost`,onClick:O,disabled:i,children:a(`mcpAddServerModal.cancel`)}),(0,Z.jsx)(t,{variant:`primary`,onClick:k,disabled:!j||i,children:a(i?`mcpAddServerModal.adding`:`mcpAddServerModal.addServer`)})]})]})})}var Qt=[`none`,`bearer`,`api-key`];function $t(e,t){switch(e){case`none`:return t(`mcpServerDetailModal.authNone`);case`bearer`:return t(`mcpServerDetailModal.authBearerToken`);case`api-key`:return t(`mcpServerDetailModal.authApiKey`)}}function en({server:e,toolsSummary:n,toolsLoading:r=!1,toolsError:i=!1,readOnly:a=!1,onClose:o,onSave:s,isPending:c}){let{t:l}=G(`settings`),[u,d]=(0,X.useState)(`none`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(`X-API-Key`),[g,_]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(e.authType),p(``),h(e.authHeaderName??`X-API-Key`),_(``))},[e]);let y=(0,X.useCallback)(()=>{if(!e||a)return;let t=u!==e.authType,n=u===`bearer`&&f.trim()!==``,r=u===`api-key`&&m.trim()!==``&&g.trim()!==``,i=t||n||r,o;o=i?u===`none`?null:u===`bearer`&&f.trim()?{Authorization:`Bearer ${f.trim()}`}:u===`api-key`&&m.trim()&&g.trim()?{[m.trim()]:g.trim()}:void 0:void 0,s(e.id,{name:e.id,...o===void 0?{}:{headers:o}})},[e,u,f,m,g,s,a]),b=(0,X.useCallback)(()=>{c||o()},[c,o]);return e?(0,Z.jsx)(R.Root,{open:!!e,onOpenChange:e=>{e||b()},children:(0,Z.jsxs)(R.Content,{size:`lg`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:e.id}),(0,Z.jsx)(R.Description,{children:l(`mcpServerDetailModal.description`,{transport:e.transport.type,status:e.status})})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[!a&&e.transport.type!==`stdio`?(0,Z.jsxs)(Z.Fragment,{children:[e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.oauthBadge`)}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.oauthManagedHint`)})]}):null,e.hasOAuth?null:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-auth`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`select`,{id:`mcp-detail-auth`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:Qt.map(e=>(0,Z.jsx)(`option`,{value:e,children:$t(e,l)},e))})]}),u===`bearer`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-bearer`,children:l(`mcpServerDetailModal.bearerToken`)}),(0,Z.jsx)(v,{id:`mcp-detail-bearer`,type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`bearer`?l(`mcpServerDetailModal.savedBearerPlaceholder`):l(`mcpServerDetailModal.bearerTokenPlaceholder`),fullWidth:!0})]}):null,u===`api-key`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-header`,children:l(`mcpServerDetailModal.headerName`)}),(0,Z.jsx)(v,{id:`mcp-detail-apikey-header`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:l(`mcpServerDetailModal.headerNamePlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-value`,children:l(`mcpServerDetailModal.apiKey`)}),(0,Z.jsx)(v,{id:`mcp-detail-apikey-value`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`api-key`?l(`mcpServerDetailModal.savedApiCredentialPlaceholder`):l(`mcpServerDetailModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]}):null,e.transport.url||e.transport.command?(0,Z.jsxs)(`dl`,{className:`space-y-1 text-body-small-default`,children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-secondary)]`,children:e.transport.type===`stdio`?l(`mcpServerDetailModal.command`):l(`mcpServerDetailModal.endpoint`)}),(0,Z.jsx)(`dd`,{className:`text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:e.transport.url??e.transport.command})]}):null,(0,Z.jsxs)(`section`,{className:`space-y-2`,children:[(0,Z.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.toolsHeading`)}),r?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsLoading`)}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsError`)}):n&&n.tools.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.tokenOverhead`,{count:n.estimatedTokens.toLocaleString()})}),(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] rounded-lg border border-[var(--border-base)]`,children:n.tools.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-1 px-3 py-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)] [overflow-wrap:anywhere]`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolEstimatedTokens`,{count:e.estimatedTokens.toLocaleString()})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsEmpty`)})]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(t,{variant:a?`primary`:`ghost`,onClick:b,disabled:c,children:l(a?`mcpServerDetailModal.close`:`mcpServerDetailModal.cancel`)}),a?null:(0,Z.jsx)(t,{variant:`primary`,onClick:y,disabled:c,children:l(c?`mcpServerDetailModal.saving`:`mcpServerDetailModal.save`)})]})]})}):null}function tn({connections:e,allowAdd:n,attemptReportedElsewhere:r=!1}){let{t:i}=G(`settings`),{auth:a,add:o,save:s,remove:c,details:l,configureServer:u}=e;return(0,Z.jsxs)(Z.Fragment,{children:[a.attempt&&!r?(0,Z.jsx)(U,{tone:a.attempt.error?`warning`:`info`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`[overflow-wrap:anywhere]`,children:a.attempt.error??(a.attempt.phase===`connecting`?i(`mcpConnect.waitingForRuntime`,{name:a.attempt.displayName}):i(`mcpConnect.waitingForAuthorization`,{name:a.attempt.displayName}))}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a.attempt.phase===`error`?(0,Z.jsx)(t,{variant:`outlined`,onClick:a.retry,children:i(`mcpConnect.retry`)}):null,(0,Z.jsx)(t,{variant:`ghost`,onClick:a.stopWaiting,children:i(`mcpConnect.stopWaiting`)})]})]})}):null,n?(0,Z.jsx)(Zt,{open:e.addOpen,onClose:()=>e.setAddOpen(!1),onAdd:e.addCustom,isPending:o.isPending}):null,(0,Z.jsx)(en,{server:u,readOnly:u?.source===`plugin`,toolsSummary:l.data?.servers.find(e=>e.serverId===u?.id),toolsLoading:l.isFetching,toolsError:l.isError,onClose:()=>e.setConfigureServerId(null),onSave:(e,t)=>s.mutate(t),isPending:s.isPending}),(0,Z.jsx)(oe,{open:e.removeServerId!==null,title:i(`mcpPage.removeDialogTitle`),message:e.removeServerId?i(`mcpPage.removeDialogMessage`,{serverId:e.removeServerId}):``,confirmLabel:i(`mcpPage.removeDialogConfirm`),destructive:!0,isPending:c.isPending,onConfirm:()=>{e.removeServerId&&c.mutate(e.removeServerId)},onCancel:()=>e.setRemoveServerId(null)})]})}function nn(e,t){let n=new Map(t.map(e=>[e.name,e]));return e.flatMap(e=>{let t=e.integration;if(t?.kind!==`mcp`)return[];let r=n.get(e.name);return[{pluginName:e.name,displayName:t.displayName,description:e.description??t.displayName,documentationUrl:t.documentationUrl,logo:t.logo,oauthProvider:t.oauthProvider,category:rt(t.category)??void 0,setup:t.setup,installed:r?{icon:r.icon,hasIcon:r.hasIcon,iconVersion:r.iconVersion}:void 0}]})}function rn(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,Z.jsx)(De,{size:20})})}function an({server:e,onRemove:n,onConfigure:r,onAuthenticate:i,onManagePlugin:a,isAuthenticating:o,connectDisabled:s=!1}){let{t:c}=G(`settings`),l=e.source===`plugin`,u=!l&&e.status===`needs-auth`&&e.transport.type!==`stdio`,d=!l&&!o&&!u,f=l?c(`mcpServerCard.managePlugin`):o?c(`mcpServerCard.connecting`):e.hasOAuth?c(`mcpServerCard.reconnect`):c(`mcpServerCard.finishConnecting`);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(rn,{}),title:e.id,subtitle:l?e.pluginName:lt(e),status:e.status===`connected`?void 0:(0,Z.jsx)(y,{tone:`negative`,children:c(`mcpServerCard.statusNeedsAttention`)}),primaryAction:d?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":c(`mcpServerCard.configureLabel`,{serverId:e.id}),onClick:()=>r(e.id)}):(0,Z.jsx)(t,{variant:u?`primary`:`outlined`,loading:o,onClick:()=>{l?a(e.pluginName):u&&i(e.id)},disabled:o||u&&s,children:f}),actionMenu:(0,Z.jsxs)(k.Root,{children:[(0,Z.jsx)(k.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`ghost`,iconOnly:(0,Z.jsx)(Ce,{}),className:$,"aria-label":c(`mcpServerCard.moreActions`,{serverId:e.id})})}),(0,Z.jsxs)(k.Content,{title:e.id,showTitle:!0,closeLabel:c(`mcpServerCard.actionsSheetClose`),align:`end`,children:[u||l?(0,Z.jsx)(k.Item,{icon:Pe,label:c(l?`mcpServerCard.viewDetails`:`mcpServerCard.configure`),onSelect:()=>r(e.id)}):null,l?null:(0,Z.jsx)(k.Item,{icon:we,label:c(`mcpServerCard.removeServer`),tone:`destructive`,onSelect:()=>n(e.id)})]})]})})}function on({assistantId:e,definition:t}){let n=He(e,t.pluginName,t.installed?.hasIcon,t.installed?.iconVersion);return(0,Z.jsx)(Ue,{external:!0,icon:t.installed?.icon,iconSrc:n,iconUrl:ft(t)??void 0,size:`md`})}function sn({assistantId:e,method:n,disabled:r,onOpen:i}){let{t:a}=G(`settings`),o=ot([],[n]);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(on,{assistantId:e,definition:n.definition}),title:n.definition.displayName,subtitle:n.definition.description,status:o.needsAttention?(0,Z.jsx)(y,{tone:`negative`,children:a(`integrationRow.needsAttention`)}):void 0,primaryAction:(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":a(`integrationRow.configureLabel`,{name:n.definition.displayName}),disabled:r,onClick:i})})}async function cn(e){let{data:t,response:n}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/list`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP servers: ${n?.status}`);return t}async function ln(e){let{data:t,response:n}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/tools-summary`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP tools summary: ${n?.status}`);return t}async function un(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/update`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to update MCP server: ${n?.status}`)}async function dn(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/add`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to add MCP server: ${n?.status}`)}async function fn(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/remove`,path:{assistant_id:e},body:{name:t}});if(!n?.ok)throw Error(`Failed to remove MCP server: ${n?.status}`)}async function pn(e,t){let{data:n,response:r}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/start`,path:{assistant_id:e},body:{serverId:t}});if(!r?.ok)throw Error(`Failed to start MCP auth: ${r?.status}`);return n}async function mn(e,t){let{data:n,response:r}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/status/${encodeURIComponent(t)}`,path:{assistant_id:e}});if(!r?.ok)throw Error(`Failed to poll MCP auth status: ${r?.status}`);return n}function hn(e,t){return e.some(e=>e.id===t&&e.status===`connected`)}function gn(e,t){return t?null:e}function _n(e){let{t}=G(`settings`),r=q(),[i,a]=(0,X.useState)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=(0,X.useRef)(null),u=(0,X.useCallback)(()=>{o.current=null,c.current=null,s.current?.close(),s.current=null,a(null)},[]);(0,X.useEffect)(()=>(u(),()=>{o.current=null,c.current=null,s.current?.close(),s.current=null}),[e,u]);let f=i?.phase===`authorizing`||i?.phase===`waiting`,p=W({queryKey:l.auth(e,i?.operationId??``),queryFn:()=>mn(e,i.serverId),enabled:f,refetchInterval:f?ge:!1,staleTime:0,gcTime:0,retry:1}),m=W({queryKey:l.list(e),queryFn:()=>cn(e),enabled:i?.phase===`connecting`,refetchInterval:i?.phase===`connecting`?ge:!1,staleTime:0,retry:1});(0,X.useEffect)(()=>{!i||!f||o.current!==i.operationId||!p.data||(p.data.status===`complete`?(s.current?.close(),s.current=null,a({...i,phase:`connecting`}),r.invalidateQueries({queryKey:l.list(e)})):p.data.status===`error`&&a({...i,phase:`error`,error:p.data.error?.replaceAll(i.serverId,i.displayName)??t(`mcpConnect.authorizationFailed`)}))},[e,i,p.data,f,r,t]),(0,X.useEffect)(()=>{i?.phase!==`connecting`||o.current!==i.operationId||!m.data||m.isFetching||hn(m.data.servers,i.serverId)&&(u(),r.invalidateQueries({queryKey:l.details(e)}))},[e,i,r,m.data,m.isFetching,u]),(0,X.useEffect)(()=>{if(!i||i.phase===`error`)return;let e=f?gn(p.error,p.isFetching):i.phase===`connecting`?gn(m.error,m.isFetching):null;e&&(n(e,{context:`mcp.connect.poll`}),a({...i,phase:`error`,error:t(`mcpConnect.pollFailed`)}))},[i,p.error,p.isFetching,f,m.error,m.isFetching,t]),(0,X.useEffect)(()=>{if(!i||i.phase===`error`)return;let e=setTimeout(()=>{o.current===i.operationId&&(s.current?.close(),s.current=null,a(e=>e?.operationId===i.operationId?{...e,phase:`error`,error:t(`mcpConnect.timedOut`)}:e))},Math.max(0,i.startedAt+ne-Date.now()));return()=>clearTimeout(e)},[i,t]);let h=(0,X.useCallback)(t=>{o.current===t&&(a(e=>e?.operationId===t&&e.phase===`authorizing`?{...e,phase:`waiting`}:e),r.invalidateQueries({queryKey:l.auth(e,t)}),r.invalidateQueries({queryKey:l.list(e)}))},[e,r]);(0,X.useEffect)(()=>{let e=s.current;if(i?.phase!==`authorizing`||!e)return;let t=setInterval(()=>{e.closed&&h(i.operationId)},500);return()=>clearInterval(t)},[i?.operationId,i?.phase,h]),(0,X.useEffect)(()=>{let e=i?.operationId,t=i?.phase;if(!(!e||t===`connecting`||t===`error`))return A(()=>h(e))},[i?.operationId,i?.phase,h]);let _=(0,X.useCallback)((r,l,u=r)=>{if(o.current&&i?.phase!==`error`)return;let f=crypto.randomUUID();o.current=f,s.current?.close(),s.current=null,c.current=l?{operationId:f,run:l}:null;let p={operationId:f,serverId:r,displayName:u,startedAt:Date.now(),phase:`starting`};a(p);let m=g()||w(),h=m?null:window.open(``,`_blank`,`width=500,height=600`);if(!m&&!h){a({...p,phase:`error`,error:t(`mcpConnect.popupBlocked`)});return}h&&(h.opener=null,s.current=h);let _=()=>o.current===f&&Date.now()<p.startedAt+3e5;(async()=>{try{let t=await l?.();if(c.current?.operationId===f&&(c.current=null),!_())return;if(t===null){h?.close(),s.current=null,o.current=null,a(null);return}let n=t?{...p,serverId:t}:p;t&&a(n);let r=await pn(e,n.serverId);if(!_())return;if(r.already_authenticated){h?.close(),s.current=null,a({...n,phase:`connecting`});return}let i=new URL(r.auth_url);if(i.protocol!==`https:`&&i.protocol!==`http:`)throw Error(`Unsupported MCP authorization URL protocol`);a({...n,phase:`authorizing`}),h?h.closed||h.location.replace(i.href):await d(i.href)}catch(e){h?.close(),_()&&(s.current=null,n(e,{context:`mcp.connect.start`}),a(e=>e?.operationId===f?{...e,phase:`error`,error:t(`mcpConnect.startFailed`)}:e))}})()},[e,i?.phase,t]);return{attempt:i,isBusy:!!(i&&i.phase!==`error`),connect:_,retry:()=>{i&&_(i.serverId,c.current?.run,i.displayName)},stopWaiting:u}}function vn(e){let{t}=G(`settings`),r=q(),i=_n(e),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),m=W({queryKey:l.list(e),queryFn:()=>cn(e)}),h=m.data?.servers.find(e=>e.id===s)??null,g=W({queryKey:l.details(e),queryFn:()=>ln(e),enabled:h!==null||f!==null}),_=()=>{r.invalidateQueries({queryKey:l.list(e)}),r.invalidateQueries({queryKey:l.details(e)})},v=K({mutationFn:t=>dn(e,t),onSuccess:()=>{_(),o(!1)},onError:e=>{n(e,{context:`mcp.add`}),z.error(t(`mcpConnect.addFailed`))}});return{list:m,details:g,auth:i,add:v,save:K({mutationFn:t=>un(e,t),onSuccess:()=>{_(),c(null)},onError:e=>{n(e,{context:`mcp.update`}),z.error(t(`mcpConnect.saveFailed`))}}),remove:K({mutationFn:t=>fn(e,t),onSuccess:(e,n)=>{i.attempt?.serverId===n&&i.stopWaiting(),_(),d(null),c(null),z.success(t(`mcpPage.toastRemoved`,{serverId:n}))},onError:(e,r)=>{n(e,{context:`mcp.remove`}),z.error(t(`mcpPage.toastRemoveFailed`,{serverId:r}))}}),addCustom:e=>{e.autoAuth?i.connect(e.name,async()=>{await v.mutateAsync(e)},e.name):v.mutate(e)},addOpen:a,setAddOpen:o,configureServer:h,configureServerId:s,setConfigureServerId:c,removeServerId:u,setRemoveServerId:d,toolsServerId:f,setToolsServerId:p}}var yn={productivity:`integrationsPage.categories.productivity`,communication:`integrationsPage.categories.communication`,meetings:`integrationsPage.categories.meetings`,sales:`integrationsPage.categories.sales`,marketing:`integrationsPage.categories.marketing`,finance:`integrationsPage.categories.finance`,commerce:`integrationsPage.categories.commerce`,engineering:`integrationsPage.categories.engineering`,knowledge:`integrationsPage.categories.knowledge`,recruiting:`integrationsPage.categories.recruiting`},bn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr))]`,xn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr))]`;function Sn({title:e,count:t,gridClassName:n,children:r}){return(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-title-small text-[var(--content-default)]`,children:[e,(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t})]}),(0,Z.jsx)(`div`,{className:n,children:r})]})}function Cn(e,t){return{denied:e(`integrationsPage.oauthErrorDenied`),state_invalid:e(`integrationsPage.oauthErrorStateInvalid`),state_expired:e(`integrationsPage.oauthErrorStateExpired`),exchange_failed:e(`integrationsPage.oauthErrorExchangeFailed`),identity_failed:e(`integrationsPage.oauthErrorIdentityFailed`)}[t]}function wn({mcpAssistantId:e}){let{t:i}=G(`settings`),[a,o]=ve(),s=be(),l=ye(),u=te(),f=I(),p=P.use.mcpAddServer(),m=P.use.hasHydrated(),[h,g]=(0,X.useState)(null),[_,y]=(0,X.useState)(!0),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(null),T=a.get(`provider`),E=(0,X.useRef)(null),O=vn(e),k=Ve(e),A=Gt({assistantId:e,mcp:O});(0,X.useEffect)(()=>{let t=!0;return(async()=>{try{let n=await r(e);t&&n.ok&&g(n.data)}catch(e){n(e,{context:`integrations.getAssistant`})}finally{t&&y(!1)}})(),()=>{t=!1}},[e]);let{login:M}=N(`${l.pathname}${l.search}${l.hash}`),F=(0,X.useCallback)(()=>void M(),[M]),ee=A.closeModal,ne=A.cancel,L=A.attemptItemId,re=A.modal?.itemId??null,R=O.setToolsServerId,B=(0,X.useCallback)(()=>{if(re!==null&&L===re&&ne(),ee(),R(null),!a.has(`provider`))return;let e=new URLSearchParams(a);e.delete(`provider`),o(e,{replace:!0})},[ne,L,ee,re,a,o,R]),{platformAssistantId:ie,isLoading:ae,error:oe}=b(h?.id,u===`full`),se=W({...fe({path:{assistant_id:h?.id??``}}),select:e=>e.providers,enabled:!!h}),ce=W({...j({path:{assistant_id:ie??``}}),enabled:!!ie&&u===`full`});(0,X.useEffect)(()=>{let e=a.get(`oauth_status`);if(!e)return;let t=a.get(`oauth_provider`),n=t?t.charAt(0).toUpperCase()+t.slice(1):null;e===`connected`?z.success(n?i(`integrationsPage.accountConnectedToast`,{providerLabel:n}):i(`integrationsPage.accountConnectedToastGeneric`)):e===`error`&&z.error(Cn(i,a.get(`oauth_code`)??`unknown`)??(n?i(`integrationsPage.connectFailedToast`,{providerLabel:n}):i(`integrationsPage.connectFailedToastGeneric`))),s(he.settings.integrations,{replace:!0})},[a,s,i]);let le=se.isError||ce.isError||!!oe||!_&&!h,ue=!le&&!!se.data&&(u!==`full`||!!ce.data),V=(0,X.useMemo)(()=>ut(ue?se.data??[]:[],ue?ce.data??[]:[],O.list.data?.servers??[],k.installedLoaded?nn(k.catalogMatches,k.installedPlugins):[],O.list.isSuccess),[ue,se.data,ce.data,O.list.data,O.list.isSuccess,k.installedLoaded,k.catalogMatches,k.installedPlugins]),de=(0,X.useMemo)(()=>{let e=new Map;for(let t of V)t.category&&e.set(t.category,(e.get(t.category)??0)+1);return Ge.flatMap(t=>{let n=e.get(t);return n?[{category:t,count:n}]:[]})},[V]),H=de.some(e=>e.category===C)?C:null,me=(0,X.useMemo)(()=>dt(V,x,H),[V,x,H]),ge=(0,X.useMemo)(()=>{let e=new Map;for(let t of V){if(t.kind===`mcp`)continue;let n=vt(t,{platformGate:u,ownOAuthAvailable:!f,mcpServersLoaded:O.list.isSuccess});n&&e.set(t.id,n)}return e},[V,f,O.list.isSuccess,u]),K=e=>ge.has(e.id)&&(!e.configured||e.id===L&&A.modal?.itemId!==e.id),_e=e=>!e.configured||K(e),q=me.filter(e=>!_e(e)),xe=me.filter(_e).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),Se=_||se.isLoading||ce.isLoading||ae||O.list.isLoading||(k.isLoading||k.catalogLoading)&&V.length===0,Ce=O.auth.isBusy||A.managed!==null,we=_||!h||u===`full`&&!ie,Te=A.ownsMcpAttempt&&L!==null&&(A.modal?.itemId===L||me.some(e=>e.id===L&&K(e))),J=A.modal?V.find(e=>e.id===A.modal?.itemId):void 0,Y=J?ge.get(J.id):void 0,De=J?.kind===`oauth`?J.provider:void 0,Oe=D(De?.provider_key??``,De?.tenant_host),Ae=A.openModal;(0,X.useEffect)(()=>{if(!T){E.current=null;return}if(T===E.current)return;let e=V.find(e=>e.kind===`oauth`&&e.provider.provider_key===T);e&&(E.current=T,Ae(e.id))},[V,Ae,T]);let je=O.toolsServerId,Me=O.list.data?.servers.find(e=>e.id===je),Ne=Y&&je?bt(Y).find(e=>e.serverId===je):void 0,Pe=Ne?{[Ne.id]:{loading:O.details.isFetching,error:O.details.isError,summary:O.details.data?.servers.find(e=>e.serverId===je),endpointUrl:Me?.transport.url}}:void 0,Fe=Kt({assistantId:e,platformAssistantId:ie,onStopAuth:e=>{let t=O.auth.attempt?.serverId;if(!t)return;let n=e.pluginName!==void 0&&(t===$e(e.pluginName)||O.list.data?.servers.find(e=>e.id===t)?.pluginName===e.pluginName);(t===e.serverId||n)&&O.auth.stopWaiting()},onRemoveServer:O.setRemoveServerId,onPluginRemoved:()=>void O.list.refetch()}),Ie=()=>{p?O.setAddOpen(!0):pe(s,{prompt:i(`mcpPage.setupPrompt`)})},Le=t=>{let n=t.kind===`mcp`?void 0:ge.get(t.id);return t.kind!==`mcp`&&n&&K(t)?(0,Z.jsx)(Pt,{plan:n,state:A.stateFor(t.id,n.name),showAlternatives:!f,disabled:A.isBusyElsewhere(t.id)||n.primary.kind===`managed-oauth`&&we,onConnect:e=>A.start(t,n,e),onLogin:F,onCancel:A.cancel,onRetry:A.retry,onOpenSetupGuide:e=>void d(e)},t.id):t.kind===`oauth`?(0,Z.jsx)(Nt,{providerKey:t.provider.provider_key,displayName:t.name,description:t.provider.description,logoUrl:t.provider.logo_url,connections:t.connections,mcpMethods:t.methods,disabled:we||!n||A.isBusyElsewhere(t.id),onConfigure:()=>A.openModal(t.id)},t.id):t.kind===`plugin`?(0,Z.jsx)(sn,{assistantId:e,method:t.method,disabled:!n||A.isBusyElsewhere(t.id),onOpen:()=>A.openModal(t.id)},t.id):(0,Z.jsx)(an,{server:t.server,onRemove:O.setRemoveServerId,onConfigure:O.setConfigureServerId,onAuthenticate:e=>O.auth.connect(e),onManagePlugin:e=>s(e?`${he.plugins}/${encodeURIComponent(e)}`:he.plugins),isAuthenticating:O.auth.attempt?.serverId===t.server.id&&Ce,connectDisabled:Ce},t.id)};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(v,{value:x,onChange:e=>S(e.target.value),placeholder:i(`integrationsPage.searchPlaceholder`),"aria-label":i(`integrationsPage.searchAriaLabel`),leftIcon:(0,Z.jsx)(Re,{"aria-hidden":!0,className:`size-4`}),className:`min-h-11`,wrapperClassName:`min-w-0 basis-64 flex-1`,fullWidth:!0}),(0,Z.jsx)(t,{variant:`outlined`,className:`min-h-11 max-w-full whitespace-normal`,leftIcon:(0,Z.jsx)(Ee,{}),onClick:Ie,disabled:!m||Ce,children:i(`integrationsPage.addCustom`)})]}),de.length>0?(0,Z.jsx)(`div`,{role:`group`,"aria-label":i(`integrationsPage.categoriesLabel`),className:`flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none]`,children:de.map(e=>(0,Z.jsx)(c,{selected:H===e.category,count:e.count,onClick:()=>w(H===e.category?null:e.category),children:i(yn[e.category])},e.category))}):null]}),le?(0,Z.jsx)(U,{tone:`warning`,children:i(`integrationsPage.oauthUnavailable`)}):null,O.list.isError?(0,Z.jsx)(U,{tone:`warning`,actions:(0,Z.jsx)(t,{variant:`ghost`,onClick:()=>void O.list.refetch(),children:i(`mcpConnect.retry`)}),children:i(`integrationsPage.mcpUnavailable`)}):null,k.catalogError||k.isError?(0,Z.jsx)(U,{tone:`warning`,children:i(`integrationsPage.pluginCatalogUnavailable`)}):null,(0,Z.jsx)(tn,{connections:O,allowAdd:p,attemptReportedElsewhere:Te}),A.managed&&h?(0,Z.jsx)(Bt,{assistantId:h.id,providerKey:A.managed.providerKey,providerLabel:A.managed.providerLabel,tenantHost:A.managed.tenantHost,restartToken:A.managed.restartToken,onReport:A.onManagedReport},A.managed.providerKey):null,Se?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(ke,{className:`size-4 animate-spin`}),i(`integrationsPage.loading`)]}):null,q.length>0?(0,Z.jsx)(Sn,{title:i(`integrationsPage.sectionConfigured`),count:q.length,gridClassName:bn,children:q.map(Le)}):null,xe.length>0?(0,Z.jsx)(Sn,{title:i(`integrationsPage.sectionAvailable`),count:xe.length,gridClassName:xn,children:xe.map(Le)}):null,!Se&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-body-medium-default text-[var(--content-tertiary)]`,children:x.trim()?i(`integrationsPage.emptySearchSubtitle`,{query:x.trim()}):H?i(`integrationsPage.emptyCategory`,{category:i(yn[H])}):i(`integrationsPage.empty`)}):null,A.modal&&Y&&J&&J.kind!==`mcp`?(0,Z.jsx)(Tt,{plan:Y,focusMethodId:A.modal.methodId,attempt:A.attemptFor(J.id),tenantHost:Oe,toolsByConnectionId:Pe,ownOAuthContent:h&&J.kind===`oauth`?(0,Z.jsx)(Ut,{assistantId:h.id,providerKey:J.provider.provider_key,displayName:J.name,logoUrl:J.provider.logo_url}):null,onConnect:(e,t)=>A.run(J,Y,e,t),onLogin:F,onCancelAttempt:A.cancel,onRetryAttempt:A.retry,onReconnect:e=>A.reconnect(J,Y,e),onOpenTools:e=>O.setToolsServerId(e.serverId??null),onDisconnect:e=>Fe(e,Y.name),onOpenSetupGuide:e=>void d(e),onClose:B},J.id):null]})}function Tn(){let e=O();return(0,Z.jsx)(X.Suspense,{children:(0,Z.jsx)(wn,{mcpAssistantId:e},e)})}export{Tn as IntegrationsPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,AS as n,A_ as r,BC as i,Br as a,Ci as o,EC as s,FC as c,Gc as l,Hr as u,Hy as d,Iy as f,Jm as p,Kc as m,Km as h,Ky as g,LS as _,OC as v,PC as y,Pi as b,Qm as x,Qu as S,Ry as C,SS as w,UC as T,Ur as E,Vr as D,W as O,WC as k,Wy as A,Xu as j,Ym as M,Zc as N,Zf as P,Zu as F,_h as I,am as ee,bh as te,bi as ne,eC as L,ew as re,gC as R,hC as z,iC as B,im as ie,iw as ae,mC as oe,nm as se,om as ce,qd as le,qm as ue,rm as V,rw as de,sm as fe,tu as pe,tw as H,vi as me,xS as he,yi as ge,zC as U}from"./app-BEoekemj.js";import{$n as W,E as G,Xn as K,er as _e,nr as q}from"./vendor-cVd2QlFV.js";import{_ as ve,d as ye,f as be,t as xe,x as Se}from"./react-B9IgSVeK.js";import{$r as Ce,A as we,At as Te,D as J,Ji as Y,Lt as Ee,Pt as De,Ya as Oe,Yn as ke,Zr as Ae,a as je,dr as Me,ft as Ne,gt as Pe,i as Fe,li as Ie,qi as Le,vt as Re,za as ze}from"./icons-C0wyat6T.js";import{a as Be,n as Ve,r as He,u as Ue}from"./use-plugins-list-Bfr06IMK.js";var We=Oe(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ge=[`productivity`,`communication`,`meetings`,`sales`,`marketing`,`finance`,`commerce`,`engineering`,`knowledge`,`recruiting`],Ke=new Set(Ge);function qe(e){return typeof e==`string`&&Ke.has(e)}var X=e(Se(),1),Z=xe(),Je={"mcp-oauth":We,"mcp-manual":We,"managed-oauth":Ne,"own-oauth":Me};function Ye(e){let{t}=G(`settings`);return(0,X.useCallback)(n=>{switch(n.kind){case`mcp-oauth`:return t(`connectMethod.mcp`,{name:e});case`mcp-manual`:return t(`connectMethod.mcpManual`);case`managed-oauth`:return t(`connectMethod.managed`);case`own-oauth`:return t(`connectMethod.own`)}},[t,e])}function Xe(e,t,n){return e.map(e=>(0,Z.jsx)(k.Item,{icon:Je[e.kind],label:t(e),onSelect:()=>n(e)},e.id))}var Ze={slack:`slack_channel`,discord:`discord_channel`,telegram:`telegram`};function Qe(e){return Object.entries(Ze).some(([t,n])=>t===e&&n!==e)}function $e(e){return`plugin:${e}`}function et(e){let t=e.filter(e=>e.transport.type!==`stdio`&&e.status!==`connected`);return t.length===1?t[0].id:null}function tt(e){return async()=>(await e.install(),et(await e.loadPluginServers()))}function nt(e,t){return e.filter(e=>e.source===`plugin`&&e.pluginName===t)}function rt(e){return qe(e)?e:null}function it(e){let{connectedCount:t,needsAttention:n}=ot(e,[]);return{connectedCount:t,needsAttention:n}}function at(e,t){return e.filter(e=>e.provider===t)}function ot(e,t,n=!0){let r=t.flatMap(e=>e.servers),i=t.filter(e=>ct(e,n));return{connectedCount:e.filter(e=>e.connected).length+r.filter(e=>e.status===`connected`).length,needsAttention:e.some(e=>!e.connected)||i.some(e=>e.servers.some(e=>e.status!==`connected`)),configured:e.length>0||i.length>0}}function st(e){return e.status===`connected`||e.hasOAuth||e.hasStaticAuth}function ct(e,t=!0){return t?e.servers.some(st)?!0:!!e.definition.installed&&et(e.servers)===null:!!e.definition.installed||e.servers.length>0}function lt(e){if(e.transport.url)try{return new URL(e.transport.url).hostname}catch{return}}function ut(e,t,n,r=[],i=!0){let a=r.map(e=>({definition:e,servers:nt(n,e.pluginName)})),o=new Set,s=new Set(a.flatMap(e=>e.servers));return[...e.filter(e=>e.supports_managed_mode).flatMap(e=>{let n=at(t,e.provider_key);if(Qe(e.provider_key)&&n.length===0)return[];let r=a.filter(t=>t.definition.oauthProvider===e.provider_key);return r.forEach(e=>o.add(e)),[{kind:`oauth`,id:`oauth:${e.provider_key}`,name:e.display_name??e.provider_key,description:[e.description,...r.map(e=>e.definition.description)].filter(Boolean).join(` `),configured:ot(n,r,i).configured,category:rt(e.category),provider:e,connections:n,methods:r}]}),...a.filter(e=>!o.has(e)).map(e=>({kind:`plugin`,id:`plugin:${e.definition.pluginName}`,name:e.definition.displayName,description:e.definition.description,configured:ct(e,i),category:e.definition.category??null,method:e})),...n.filter(e=>!s.has(e)).map(e=>({kind:`mcp`,id:`mcp:${e.id}`,name:e.id,description:[e.pluginName,lt(e)].filter(Boolean).join(` `),configured:!0,category:null,server:e}))]}function dt(e,t,n=null){let r=t.trim().toLocaleLowerCase();return e.filter(e=>!n||e.category===n).filter(e=>!r||e.name.toLocaleLowerCase().includes(r)||e.description.toLocaleLowerCase().includes(r)).sort((e,t)=>Number(t.configured)-Number(e.configured)||e.name.localeCompare(t.name)||e.id.localeCompare(t.id))}function ft(e){return e.logo?o(`/images/integrations/${e.logo}`):null}function Q(e){return e===`mcp-oauth`||e===`mcp-manual`}function pt(e){switch(e.status){case`connected`:return`connected`;case`connecting`:case`starting`:return`connecting`;case`declared`:return`pending`;default:return`needs-attention`}}function mt(e,t,n){let r=e.servers.length>1;return e.servers.map(e=>{let i=pt(e);return{id:`mcp:${e.id}`,methodId:t,methodKind:n,label:r?e.id:null,detail:lt(e),status:i,pluginName:e.pluginName,serverId:e.id,canReconnect:i!==`connected`&&i!==`connecting`&&e.transport.type!==`stdio`&&!e.hasStaticAuth}})}function ht(e,t,n){return{id:`plugin:${e.pluginName}`,methodId:t,methodKind:n,label:null,status:`pending`,pluginName:e.pluginName,canReconnect:!1}}function gt(e,t){return e.map(e=>({id:`oauth:${e.id}`,methodId:t,methodKind:`managed-oauth`,label:e.account_label,accountId:e.id,status:e.connected?`connected`:`needs-attention`,canReconnect:!e.connected}))}function _t(e,t){let{definition:n}=e,r=n.setup.mode===`manual`?`mcp-manual`:`mcp-oauth`,i=`mcp:${n.pluginName}`,a=t&&e.servers.length===0&&n.installed;return{id:i,kind:r,availability:`available`,instructions:n.setup.instructions,setupGuideUrl:n.documentationUrl,connections:a?[ht(n,i,r)]:mt(e,i,r),plugin:n}}function vt(e,t){let n=[],r,i=null,a;if(e.kind===`oauth`){r=e.provider.provider_key,i=e.provider.logo_url,a=e.provider.description;for(let r of e.methods)n.push(_t(r,t.mcpServersLoaded));if(t.platformGate!==`gated`){let r=`managed:${e.provider.provider_key}`;n.push({id:r,kind:`managed-oauth`,availability:t.platformGate===`full`?`available`:`login-required`,connections:gt(e.connections,r)})}t.ownOAuthAvailable&&n.push({id:`own:${e.provider.provider_key}`,kind:`own-oauth`,availability:`available`,setupGuideUrl:e.provider.dashboard_url??void 0,connections:[]})}else{let{definition:o}=e.method;r=o.pluginName,i=ft(o),a=o.description,n.push(_t(e.method,t.mcpServersLoaded))}let[o,...s]=n;return o?{name:e.name,description:a,iconKey:r,logoUrl:i,primary:o,alternatives:s}:null}function yt(e){return[e.primary,...e.alternatives]}function bt(e){return yt(e).flatMap(e=>e.connections)}function xt(e){return yt(e).filter(e=>!Q(e.kind)||e.connections.length===0)}var $=`pointer-coarse:size-11`,St=[`flex flex-wrap items-start gap-2 [&>*]:shrink-0`,`[&_button]:max-w-full [&_button]:whitespace-normal`,`[&_button]:pointer-coarse:min-h-11`].join(` `);function Ct({icon:e,title:t,subtitle:n,status:r,primaryAction:a,actionMenu:o,layout:s=`row`}){return s===`tile`?(0,Z.jsxs)(i.Root,{bordered:!0,className:`flex h-full flex-col gap-3 transition-colors hover:border-[var(--border-hover)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[e,(0,Z.jsxs)(`div`,{className:`${St} justify-end`,children:[a,o]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),(0,Z.jsx)(`p`,{className:`line-clamp-2 min-h-9 text-body-small-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n})]})]}):(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{padding:`md`,className:`grid grid-cols-[2rem_minmax(6rem,1fr)_minmax(0,auto)] items-start gap-x-3`,children:[e,(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),r]}),n?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-body-medium-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n}):null]}),(0,Z.jsxs)(`div`,{className:`${St} col-start-3 row-start-1 justify-end`,children:[a,o]})]})})}function wt({plan:e,title:t,description:n}){return(0,Z.jsx)(R.Header,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(E,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:40}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(R.Title,{className:`[&>span]:whitespace-normal`,children:t}),(0,Z.jsx)(R.Description,{children:n})]})]})})}function Tt({plan:e,attempt:n,focusMethodId:r,callbackUrl:i,callbackCopied:a=!1,toolsByConnectionId:o,ownOAuthContent:s,tenantHost:c,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onReconnect:p,onDisconnect:m,onOpenTools:h,onCopyCallbackUrl:g,onOpenSetupGuide:_,onClose:v}){let{t:y}=G(`settings`),b=Ye(e.name),x=yt(e),S=bt(e),[C,w]=(0,X.useState)(()=>r?{kind:`connect`,methodId:r}:S.length>0?{kind:`connections`}:{kind:`connect`,methodId:e.primary.id}),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(null);function k(t){return t.kind===`connect`?t:S.length===0?{kind:`connect`,methodId:e.primary.id}:t.kind===`tools`&&!S.some(e=>e.id===t.connectionId)?{kind:`connections`}:t}let A=k(C);function j(e){switch(e.kind){case`mcp-oauth`:case`mcp-manual`:return y(`integrationConnect.tagMcp`);case`managed-oauth`:return y(`integrationConnect.tagVellum`);case`own-oauth`:return y(`integrationConnect.tagOwnApp`)}}function M(t){return t.label?t.label:Q(t.methodKind)?y(`integrationConnect.connectionMcpLabel`,{name:e.name}):y(`integrationConnect.connectionAccountLabel`,{name:e.name})}function N(e,t){return Xe(e,b,t)}function P(e){E(!1),w({kind:`connect`,methodId:e.id})}function F(){if(S.length>0){w({kind:`connections`});return}w({kind:`connect`,methodId:e.primary.id})}let I=A.kind===`tools`?S.find(e=>e.id===A.connectionId):void 0,ee=A.kind===`connect`?x.find(e=>e.id===A.methodId)??e.primary:e.primary;function te(e){let n=e.setupGuideUrl;return n?(0,Z.jsx)(t,{variant:`ghost`,className:`mr-auto min-h-11`,leftIcon:(0,Z.jsx)(Ae,{}),onClick:()=>_(n),children:y(`integrationConnect.setupGuide`)}):null}return(0,Z.jsxs)(R.Root,{open:!0,onOpenChange:e=>{e||v()},children:[(0,Z.jsx)(R.Content,{size:`md`,children:A.kind===`connect`?(0,Z.jsx)(Et,{plan:e,method:ee,setupGuide:te(ee),methods:x,attempt:n,callbackUrl:i,callbackCopied:a,ownOAuthContent:s,tenantHost:c,acknowledged:T,hasConnections:S.length>0,methodItems:N,onAcknowledge:E,onPickMethod:P,onBack:F,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onCopyCallbackUrl:g,onClose:v}):A.kind===`tools`?(0,Z.jsx)(Mt,{plan:e,connection:I,title:I?M(I):e.name,tools:o?.[A.connectionId],onBack:()=>w({kind:`connections`}),onClose:v}):(0,Z.jsx)(At,{plan:e,methods:x,connections:S,connectionTitle:M,methodTag:j,methodItems:N,onPickMethod:P,onOpenTools:e=>{h?.(e),w({kind:`tools`,connectionId:e.id})},onReconnect:e=>{p(e),w({kind:`connect`,methodId:e.methodId})},onRequestDisconnect:O,onClose:v})}),(0,Z.jsx)(oe,{open:D!==null,destructive:!0,title:y(`integrationConnect.removeTitle`,{label:D?M(D):``}),message:y(`integrationConnect.removeMessage`),confirmLabel:y(`integrationConnect.remove`),cancelLabel:y(`integrationConnect.cancel`),onConfirm:()=>{D&&m(D),O(null)},onCancel:()=>O(null)})]})}function Et({plan:e,method:n,methods:r,attempt:i,callbackUrl:a,callbackCopied:o,ownOAuthContent:s,tenantHost:c,acknowledged:l,hasConnections:d,setupGuide:f,methodItems:p,onAcknowledge:m,onPickMethod:h,onBack:g,onConnect:_,onLogin:y,onCancelAttempt:b,onRetryAttempt:x,onCopyCallbackUrl:S,onClose:C}){let{t:w}=G(`settings`),E=n.kind===`managed-oauth`?c:null,D=u(E),O=i?.methodId===n.id?i:null,k=O!==null&&O.phase!==`error`,A=n.availability===`login-required`,j=n.kind===`mcp-manual`&&a!==void 0&&(!l||a.status!==`ready`),M=n.id!==e.primary.id||d,N=r.filter(e=>e.id!==n.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:w(`integrationConnect.connectTitle`,{name:e.name}),description:e.description??w(`integrationConnect.connectDescription`,{name:e.name})}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[M?(0,Z.jsx)(t,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:g,children:w(`integrationConnect.back`)}):null,A?(0,Z.jsx)(U,{tone:`info`,children:w(`integrationConnect.loginRequired`,{name:e.name})}):null,O?(0,Z.jsx)(Dt,{name:e.name,attempt:O,onCancel:b,onRetry:x}):null,E?(0,Z.jsx)(v,{label:E.label,type:`text`,value:D.value,onChange:e=>D.setValue(e.target.value),placeholder:E.placeholder,"aria-invalid":D.showsInvalid||void 0,helperText:D.showsInvalid?w(`integrationConnect.tenantHostInvalid`,{label:E.label,placeholder:E.placeholder}):void 0,disabled:k,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,fullWidth:!0}):null,n.kind===`mcp-manual`?(0,Z.jsx)(Ot,{instructions:n.instructions,name:e.name,callbackUrl:a,callbackCopied:o,acknowledged:l,onAcknowledge:m,onCopyCallbackUrl:S}):n.kind===`own-oauth`?s:(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n.instructions??w(`integrationConnect.browserHint`,{name:e.name})})]}),(0,Z.jsxs)(R.Footer,{children:[f,(0,Z.jsx)(t,{variant:`ghost`,className:`min-h-11`,onClick:C,children:w(`integrationConnect.cancel`)}),n.kind===`own-oauth`?null:(0,Z.jsx)(T,{className:`min-h-11`,disabled:k||j||!D.valid,menuDisabled:k,leftIcon:k?(0,Z.jsx)(ke,{className:`animate-spin`}):null,menuTitle:w(`integrationConnect.otherWays`),menuTriggerLabel:w(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:p(N,h),onClick:()=>A?y():_(n,{acknowledged:l,tenantHost:D.normalized}),children:w(A?`integrationConnect.loginToConnect`:`integrationConnect.connect`)})]})]})}function Dt({name:e,attempt:n,onCancel:r,onRetry:i}){let{t:a}=G(`settings`);if(n.phase===`error`)return(0,Z.jsx)(U,{tone:`error`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(t,{variant:`outlined`,onClick:i,children:a(`integrationConnect.retry`)}),(0,Z.jsx)(t,{variant:`ghost`,onClick:r,children:n.canCancel?a(`integrationConnect.stopWaiting`):a(`integrationConnect.cancel`)})]}),children:(0,Z.jsx)(`p`,{children:n.error??a(`integrationConnect.attemptFailed`,{name:e})})});let o=n.phase===`starting`?a(`integrationConnect.attemptStarting`,{name:e}):n.phase===`connecting`?a(`integrationConnect.attemptConnecting`,{name:e}):a(`integrationConnect.attemptWaiting`,{name:e});return(0,Z.jsx)(U,{tone:`info`,icon:(0,Z.jsx)(ke,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),actions:n.canCancel?(0,Z.jsx)(t,{variant:`ghost`,onClick:r,children:a(`integrationConnect.stopWaiting`)}):void 0,children:o})}function Ot({instructions:e,name:n,callbackUrl:r,callbackCopied:i,acknowledged:a,onAcknowledge:o,onCopyCallbackUrl:c}){let{t:l}=G(`settings`),u=r?.status===`ready`?r.url:void 0,d=e?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e}):null;return r?(0,Z.jsxs)(Z.Fragment,{children:[d,(0,Z.jsxs)(`ol`,{className:`space-y-4`,children:[(0,Z.jsxs)(kt,{index:1,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:l(`integrationConnect.manualStep1`)}),u?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-body-small-default [overflow-wrap:anywhere]`,children:u}),c?(0,Z.jsx)(t,{variant:`outlined`,size:`compact`,leftIcon:i?(0,Z.jsx)(Y,{}):(0,Z.jsx)(Ie,{}),onClick:()=>c(u),children:l(i?`integrationConnect.copied`:`integrationConnect.copy`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:r?.status===`error`?l(`integrationConnect.callbackError`):l(`integrationConnect.callbackLoading`)})]}),(0,Z.jsx)(kt,{index:2,children:(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:l(`integrationConnect.manualStep2`,{name:n})})}),(0,Z.jsx)(kt,{index:3,children:(0,Z.jsx)(s,{checked:a,onCheckedChange:e=>o(e===!0),label:l(`integrationConnect.manualStep3`)})})]})]}):d}function kt({index:e,children:t}){return(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0 text-body-medium-default text-[var(--content-tertiary)]`,children:e}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:t})]})}function At({plan:e,methods:n,connections:r,connectionTitle:i,methodTag:a,methodItems:o,onPickMethod:s,onOpenTools:c,onReconnect:l,onRequestDisconnect:u,onClose:d}){let{t:f}=G(`settings`),p=xt(e);function m(e){let t=n.find(t=>t.id===e.methodId);if(n.length<2||!t)return e.detail;let r=a(t);return e.detail?f(`integrationConnect.connectionSubtitle`,{method:r,detail:e.detail}):r}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:e.name,description:f(`integrationConnect.connectionsDescription`,{name:e.name})}),(0,Z.jsx)(R.Body,{children:(0,Z.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:r.map(e=>(0,Z.jsx)(L,{title:i(e),subtitle:m(e),trailingInteractive:!0,trailing:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 touch-mobile:max-w-24`,children:[(0,Z.jsx)(jt,{status:e.status}),e.canReconnect?(0,Z.jsx)(t,{variant:`outlined`,size:`compact`,leftIcon:(0,Z.jsx)(Te,{}),onClick:()=>l(e),children:e.status===`pending`?f(`integrationConnect.finishConnecting`):f(`integrationConnect.reconnect`)}):null,Q(e.methodKind)?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(je,{}),"aria-label":f(`integrationConnect.toolsAndDetailsLabel`,{label:i(e)}),onClick:()=>c(e)}):null,(0,Z.jsx)(t,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(we,{}),"aria-label":f(`integrationConnect.removeLabel`,{label:i(e)}),onClick:()=>u(e)})]})},e.id))})}),(0,Z.jsxs)(R.Footer,{children:[p.length>0?(0,Z.jsxs)(k.Root,{children:[(0,Z.jsx)(k.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`outlined`,className:`min-h-11`,rightIcon:(0,Z.jsx)(Le,{}),children:f(`integrationConnect.connectAnother`)})}),(0,Z.jsx)(k.Content,{title:f(`integrationConnect.connectAnother`),children:o(p,s)})]}):null,(0,Z.jsx)(t,{className:`min-h-11`,onClick:d,children:f(`integrationConnect.done`)})]})]})}function jt({status:e}){let{t}=G(`settings`);switch(e){case`needs-attention`:return(0,Z.jsx)(y,{tone:`negative`,children:t(`integrationConnect.statusNeedsAttention`)});case`connecting`:return(0,Z.jsx)(y,{children:t(`integrationConnect.statusConnecting`)});case`pending`:return(0,Z.jsx)(y,{children:t(`integrationConnect.statusPending`)});case`connected`:return null}}function Mt({plan:e,connection:n,title:r,tools:i,onBack:a,onClose:o}){let{t:s}=G(`settings`),c=i?.summary;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:r,description:s(`integrationConnect.toolsAndDetails`)}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Z.jsx)(t,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:a,children:s(`integrationConnect.back`)}),(0,Z.jsxs)(`dl`,{className:`space-y-1`,children:[(0,Z.jsx)(`dt`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.endpoint`)}),(0,Z.jsx)(`dd`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:i?.endpointUrl??n?.detail??s(`integrationConnect.endpointUnknown`)})]}),i?.loading?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsLoading`)}):i?.error?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsError`)}):c&&c.tools.length>0?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.toolsSummary`,{count:c.toolCount,tokens:c.estimatedTokens})}),(0,Z.jsx)(B.Root,{type:`multiple`,className:`rounded-lg border border-[var(--border-base)]`,children:c.tools.map(e=>(0,Z.jsxs)(B.Item,{value:e.name,className:`border-b border-[var(--border-base)] last:border-b-0`,children:[(0,Z.jsxs)(B.Trigger,{className:`justify-between gap-2 px-3 py-2.5 text-left [&[data-state=open]>svg]:rotate-180`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default`,children:e.name}),(0,Z.jsx)(Le,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform duration-150`})]}),(0,Z.jsx)(B.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1 px-3 pb-3`,children:[e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolTokens`,{tokens:e.estimatedTokens})})]})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsEmpty`)})]}),(0,Z.jsx)(R.Footer,{children:(0,Z.jsx)(t,{className:`min-h-11`,onClick:o,children:s(`integrationConnect.done`)})})]})}function Nt({providerKey:e,displayName:n,description:r,logoUrl:i,connections:a,mcpMethods:o=[],disabled:s,onConfigure:c}){let{t:l}=G(`settings`),{connectedCount:u}=it(a),{needsAttention:d,configured:f}=ot(a,o);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(E,{providerKey:e,displayName:n,logoUrl:i,size:32}),title:n,subtitle:u>0?l(`integrationRow.connectedAccounts`,{count:u}):r,status:d?(0,Z.jsx)(y,{tone:`negative`,children:l(`integrationRow.needsAttention`)}):void 0,primaryAction:f?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":l(`integrationRow.configureLabel`,{name:n}),onClick:c,disabled:s}):(0,Z.jsx)(t,{variant:`primary`,onClick:c,disabled:s,children:l(`integrationRow.connect`)})})}function Pt({plan:e,state:n,layout:r=`tile`,showAlternatives:i=!1,disabled:a=!1,onConnect:o,onLogin:s,onCancel:c,onRetry:l,onOpenSetupGuide:u}){let{t:d}=G(`settings`),f=Ye(e.name),p=de(),m=n.phase===`waiting`||n.phase===`connecting`,h=m&&!p;function g(e){if(e.availability===`login-required`){s();return}o(e)}function _(e){return Xe(e,f,g)}let v=i&&e.alternatives.length>0?(0,Z.jsx)(T,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),menuTitle:d(`integrationTile.connect`,{name:e.name}),menuTriggerLabel:d(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:_(yt(e)),disabled:a,onClick:()=>g(e.primary)}):(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),disabled:a,onClick:()=>g(e.primary)});return m?v=(0,Z.jsx)(zt,{name:e.name,state:n,announce:!h,onCancel:c}):n.phase===`failed`&&(v=(0,Z.jsx)(Rt,{plan:e,state:n,disabled:a,methodItems:_,onRetry:l,onOpenSetupGuide:u})),(0,Z.jsx)(Ct,{layout:r,icon:(0,Z.jsx)(E,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:32}),title:e.name,subtitle:n.phase===`failed`?(0,Z.jsx)(Lt,{name:e.name,state:n}):h&&m?(0,Z.jsx)(`span`,{role:`status`,children:It(d,e.name,n)}):e.description??void 0,primaryAction:v})}var Ft=4e3;function It(e,t,n){return n.phase===`waiting`?e(`integrationTile.waiting`,{name:t}):e(`integrationTile.connecting`,{name:t})}function Lt({name:e,state:t}){let{t:n}=G(`settings`),r=t.error||n(`integrationTile.failedGeneric`,{name:e});return(0,Z.jsxs)(`span`,{role:`alert`,title:t.error||void 0,className:`font-medium text-[var(--system-negative-strong)]`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 shrink-0 align-[-0.15em]`}),r]})}function Rt({plan:e,state:n,disabled:r,methodItems:i,onRetry:a,onOpenSetupGuide:o}){let{t:s}=G(`settings`),c=Q(n.methodKind)?n.setupGuideUrl:void 0,l=xt(e).filter(e=>e.id!==n.methodId),u=[...c?[(0,Z.jsx)(k.Item,{icon:Ae,label:s(`integrationTile.setupGuide`),onSelect:()=>o(c)},`setup-guide`)]:[],...i(l)],d=s(`integrationTile.retryLabel`,{name:e.name});return u.length===0?(0,Z.jsx)(t,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,disabled:r,onClick:a}):(0,Z.jsx)(T,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,menuTitle:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuTriggerLabel:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:u,disabled:r,onClick:a})}function zt({name:e,state:n,announce:r,onCancel:i}){let{t:a}=G(`settings`),o=de(),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=n.phase===`waiting`&&n.canCancel,d=It(a,e,n);function f(){l.current&&=(clearTimeout(l.current),null)}function p(e){f(),c(!0),e&&(l.current=setTimeout(()=>c(!1),Ft))}function m(){f(),c(!1)}(0,X.useEffect)(()=>f,[]);function h(e){return o&&e!==`touch`}let g=r?(0,Z.jsx)(`span`,{role:`status`,className:`sr-only`,children:d}):null;return u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:s?(0,Z.jsx)(Fe,{}):(0,Z.jsx)(ke,{className:`animate-spin`}),"aria-label":a(`integrationTile.cancelLabel`,{name:e}),tooltip:a(`integrationTile.waitingCancel`,{name:e}),onPointerEnter:e=>{h(e.pointerType)&&p(!1)},onPointerLeave:e=>{h(e.pointerType)&&m()},onBlur:m,onClick:e=>{if(s||e.detail===0){m(),i();return}p(!0)}}),g]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{content:d,children:(0,Z.jsx)(`span`,{className:ae(re({variant:`outlined`,iconOnly:!0}),$,`cursor-default hover:bg-transparent`),children:(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 animate-spin text-[var(--content-tertiary)]`})})}),g]})}function Bt({assistantId:e,providerKey:t,providerLabel:n,tenantHost:r,restartToken:i,onReport:a}){let{connect:o,dismiss:s,status:c,errorMessage:l}=me({assistantId:e,providerKey:t,providerLabel:n}),u=(0,X.useRef)(o),d=(0,X.useRef)(r);return(0,X.useLayoutEffect)(()=>{u.current=o,d.current=r}),(0,X.useLayoutEffect)(()=>{u.current(void 0,d.current)},[i]),(0,X.useEffect)(()=>s,[s]),(0,X.useEffect)(()=>{a({status:c,errorMessage:l})},[l,a,c]),null}function Vt(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function Ht(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}function Ut({assistantId:e,providerKey:n,displayName:r,logoUrl:a}){let{t:o}=G(`settings`),s=q(),c=W({...ie({path:{assistant_id:e},query:{provider_key:n}}),select:e=>e.apps}),l=W({...ce({path:{assistant_id:e,providerKey:n}}),select:e=>e.oauth_callback_url}),u=c.data??[],d=l.data??null,f=_e({queries:u.map(t=>({...se({path:{assistant_id:e,appId:t.id}}),select:e=>e.connections}))}),m={};u.forEach((e,t)=>{m[e.id]=f[t]?.data??[]});let g=ee({path:{assistant_id:e},query:{provider_key:n}}),_=p({onSuccess:()=>{s.invalidateQueries({queryKey:g}),D(``),k(``),w(!1),z.success(o(`yourOwnOauthTab.appAddedToast`,{name:r}))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.createFailedToast`))}}),y=ue({onSuccess:()=>{s.invalidateQueries({queryKey:g}),z.success(o(`yourOwnOauthTab.appDeletedToast`))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.deleteFailedToast`))}}),b=h({onSuccess:e=>{`auth_url`in e&&(window.location.href=e.auth_url)},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.connectFailedToast`))}}),x=M(),[S,w]=(0,X.useState)(!1),[T,D]=(0,X.useState)(``),[O,k]=(0,X.useState)(``),[A,j]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),te=_.isPending,ne=y.isPending?y.variables?.path?.id??null:null,L=b.isPending?b.variables?.path?.appId??null:null,re=x.isPending?x.variables?.path?.id??null:null,R=()=>{let t=T.trim(),r=O.trim();!t||!r||_.mutate({path:{assistant_id:e},body:{provider_key:n,client_id:t,client_secret:r}})},B=()=>{let t=N;P(null),t&&y.mutate({path:{assistant_id:e,id:t.id}})},ae=t=>{b.mutate({path:{assistant_id:e,appId:t.id},body:{callback_transport:`gateway`,scopes:[]}})};return c.isLoading?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(ke,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.length===0||S?(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:u.length===0?o(`yourOwnOauthTab.addOwnApp`,{name:r}):o(`yourOwnOauthTab.addAnotherApp`,{name:r})}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter leading-relaxed text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.credentialsNote`)})]}),d?(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:o(`yourOwnOauthTab.redirectUrl`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(v,{type:`text`,value:d,readOnly:!0,fullWidth:!0}),(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{C(d,{successMessage:o(`yourOwnOauthTab.copiedToast`),errorMessage:o(`yourOwnOauthTab.copyFailedToast`),onCopied:()=>{j(!0),setTimeout(()=>j(!1),2e3)}})},"aria-label":o(A?`yourOwnOauthTab.copiedAria`:`yourOwnOauthTab.copyRedirectAria`),iconOnly:A?(0,Z.jsx)(Y,{"aria-hidden":!0}):(0,Z.jsx)(Ie,{"aria-hidden":!0})})]}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.redirectHint`)})]}):null,(0,Z.jsx)(v,{label:o(`yourOwnOauthTab.clientId`),type:`text`,value:T,onChange:e=>D(e.target.value),placeholder:o(`yourOwnOauthTab.clientIdPlaceholder`),fullWidth:!0}),(0,Z.jsx)(v,{label:o(`yourOwnOauthTab.clientSecret`),type:`password`,value:O,onChange:e=>k(e.target.value),placeholder:o(`yourOwnOauthTab.clientSecretPlaceholder`),fullWidth:!0}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[u.length>0?(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{w(!1),D(``),k(``)},disabled:te,children:o(`yourOwnOauthTab.cancel`)}):null,(0,Z.jsx)(t,{type:`button`,size:`compact`,onClick:R,disabled:te||!T.trim()||!O.trim(),loading:te,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addApp`)})]})]})}):null,u.map(e=>{let s=m[e.id]??[],c=ne===e.id,l=L===e.id;return(0,Z.jsx)(i.Root,{children:(0,Z.jsxs)(i.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:Vt(e.client_id)}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.addedOn`,{date:Ht(e.created_at)})})]}),(0,Z.jsx)(t,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>P(e),disabled:c,"aria-label":o(`yourOwnOauthTab.deleteAppAria`,{id:Vt(e.client_id)}),loading:c,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]}),s.length>0?(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:s.map(i=>{let s=re===i.id,c=i.account_info??o(`yourOwnOauthTab.accountFallback`,{name:r});return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(E,{providerKey:n,displayName:r,logoUrl:a,size:18}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:c}),(0,Z.jsx)(t,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>I({appId:e.id,connection:i}),disabled:s,"aria-label":o(`yourOwnOauthTab.disconnectAria`,{account:c}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]},i.id)})}):null,(0,Z.jsx)(t,{type:`button`,size:`compact`,onClick:()=>ae(e),disabled:l,className:`w-full`,loading:l,leftIcon:(0,Z.jsx)(Ae,{"aria-hidden":!0}),children:o(l?`yourOwnOauthTab.waitingAuthorization`:`yourOwnOauthTab.connectAccount`)})]})},e.id)}),u.length>0&&!S?(0,Z.jsx)(t,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>w(!0),className:`w-full border-dashed`,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addAnotherAppButton`)}):null,(0,Z.jsx)(oe,{open:N!==null,title:o(`yourOwnOauthTab.deleteAppTitle`),message:N?o(`yourOwnOauthTab.deleteAppMessage`,{id:Vt(N.client_id)}):``,confirmLabel:o(`yourOwnOauthTab.delete`),destructive:!0,onConfirm:B,onCancel:()=>P(null)}),(0,Z.jsx)(oe,{open:F!==null,title:o(`yourOwnOauthTab.disconnectTitle`,{name:r}),message:F?o(`yourOwnOauthTab.disconnectMessage`,{account:F.connection.account_info??o(`yourOwnOauthTab.accountFallback`,{name:r})}):``,confirmLabel:o(`yourOwnOauthTab.disconnect`),destructive:!0,onConfirm:()=>{let t=F;I(null),t&&x.mutate({path:{assistant_id:e,id:t.connection.id}},{onSuccess:()=>{let n=V({path:{assistant_id:e,appId:t.appId}});s.invalidateQueries({queryKey:n}),s.invalidateQueries({queryKey:g}),z.success(o(`yourOwnOauthTab.disconnectedToast`,{name:r}))},onError:e=>{z.error(e.message||o(`yourOwnOauthTab.disconnectFailedToast`))}})},onCancel:()=>I(null)})]})}var Wt={phase:`idle`};function Gt({assistantId:e,mcp:t}){let{t:r}=G(`settings`),i=q(),{mutateAsync:o}=x(),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null),v=(0,X.useRef)(null),y=(0,X.useRef)(null),b=t.auth.attempt,S=t.auth.connect,C=t.auth.retry,w=t.auth.stopWaiting,T=t.auth.isBusy,E=t.list.refetch;(0,X.useEffect)(()=>{let e=v.current;if(e&&(v.current=null,b&&b.operationId!==e.priorOperationId)){c({itemId:e.itemId,methodId:e.methodId,methodKind:e.methodKind,setupGuideUrl:e.setupGuideUrl,operationId:b.operationId});return}s&&b?.operationId!==s.operationId&&(c(null),y.current=null)},[b,s]),(0,X.useEffect)(()=>{b?.phase===`connecting`&&(y.current=null)},[b?.phase]),(0,X.useEffect)(()=>{!l||d?.status!==`connected`||(z.success(r(`useOauthConnect.accountConnected`,{name:l.providerLabel,ns:`common`})),u(null),f(null))},[l,d,r]);let D=(0,X.useCallback)(async e=>{let t=await E();return t.isError?[]:nt(t.data?.servers??[],e)},[E]),{remove:O}=Be(e,{onRemoved:()=>{E(),_(null)},onRemoveError:(e,t)=>{n(t,{context:`integrations.connectRollback`,tags:{plugin:e}}),_(null)},announceWarnings:!1}),k=(0,X.useCallback)((t,n)=>{let r=(async()=>{await o({path:{assistant_id:e},body:{name:t}}),m(i,e,t)})();return y.current={itemId:n,pluginName:t,landed:r.then(()=>!0,()=>!1)},r},[e,o,i]),A=(0,X.useCallback)(()=>{let e=y.current;y.current=null,e&&(_(e.itemId),e.landed.then(t=>{if(!t){_(null);return}O(e.pluginName)}))},[O]),j=(0,X.useCallback)(()=>{s&&w(),u(null),f(null),A()},[w,s,A]),M=(0,X.useCallback)((e,t,n,r)=>{g!==e.itemId&&(j(),v.current={...e,priorOperationId:b?.operationId??null},S(t,r,n))},[b,S,j,g]),N=(0,X.useCallback)((e,t,n)=>{let r=n.plugin;if(!r||T)return;let i=!!r.installed;M({itemId:e.id,methodId:n.id,methodKind:n.kind,setupGuideUrl:n.setupGuideUrl},$e(r.pluginName),t.name,tt({install:i?()=>Promise.resolve():()=>k(r.pluginName,e.id),loadPluginServers:()=>D(r.pluginName)}))},[T,M,k,D]),P=(0,X.useCallback)((e,t,n,r)=>{if(e.kind!==`oauth`||T)return;let{provider:i}=e;if(!r?.tenantHost&&a(i.provider_key,i.tenant_host)){h({itemId:e.id,methodId:n.id});return}j(),u({itemId:e.id,methodId:n.id,providerKey:i.provider_key,providerLabel:t.name,tenantHost:r?.tenantHost,restartToken:0})},[T,j]),F=(0,X.useCallback)((e,t,n,r)=>{if(Q(n.kind)){N(e,t,n);return}n.kind===`managed-oauth`&&P(e,t,n,r)},[P,N]),I=(0,X.useCallback)((e,t,n)=>{let r=yt(t).find(e=>e.id===n.methodId);if(!Q(n.methodKind)){r&&P(e,t,r);return}!n.serverId||T||M({itemId:e.id,methodId:n.methodId,methodKind:n.methodKind,setupGuideUrl:r?.setupGuideUrl},n.serverId,t.name)},[T,M,P]),ee=(0,X.useCallback)((e,t,n)=>{if(n.kind===`mcp-manual`||n.kind===`own-oauth`){h({itemId:e.id,methodId:n.id});return}F(e,t,n)},[F]),te=(0,X.useCallback)(()=>{if(s){if(b?.phase!==`error`)return;v.current={itemId:s.itemId,methodId:s.methodId,methodKind:s.methodKind,setupGuideUrl:s.setupGuideUrl,priorOperationId:s.operationId},C();return}f(null),u(e=>e&&{...e,restartToken:e.restartToken+1})},[b,C,s]),ne=(0,X.useCallback)((e,t)=>s?.itemId===e&&b?b.phase===`error`?{phase:`failed`,error:b.error??r(`integrationTile.failedGeneric`,{name:t}),methodId:s.methodId,methodKind:s.methodKind,setupGuideUrl:s.setupGuideUrl}:b.phase===`connecting`?{phase:`connecting`}:{phase:`waiting`,canCancel:!0}:l?.itemId===e?d?.errorMessage?{phase:`failed`,error:d.errorMessage,methodId:l.methodId,methodKind:`managed-oauth`}:{phase:`waiting`,canCancel:!0}:Wt,[b,l,d,s,r]),L=(0,X.useCallback)(e=>s?.itemId===e&&b?{methodId:s.methodId,phase:b.phase,error:b.error,canCancel:!0}:l?.itemId===e?{methodId:l.methodId,phase:d?.errorMessage?`error`:`waiting`,error:d?.errorMessage??void 0,canCancel:!0}:null,[b,l,d,s]),re=(0,X.useCallback)(e=>T&&s?.itemId!==e||l!==null&&l.itemId!==e||g===e,[T,l,s,g]),R=(0,X.useCallback)((e,t)=>h({itemId:e,methodId:t}),[]),B=(0,X.useCallback)(()=>h(null),[]);return{start:ee,run:F,reconnect:I,cancel:j,retry:te,stateFor:ne,attemptFor:L,isBusyElsewhere:re,ownsMcpAttempt:s!==null,attemptItemId:s?.itemId??l?.itemId??null,managed:l,onManagedReport:f,modal:p,openModal:R,closeModal:B}}function Kt({assistantId:e,platformAssistantId:t,onStopAuth:n,onRemoveServer:r,onPluginRemoved:i}){let{t:a}=G(`settings`),o=q(),s=(0,X.useRef)(``),c=Be(e,{onRemoved:()=>{i(),z.success(a(`integrationConnect.removedToast`,{name:s.current}))},onRemoveError:()=>z.error(a(`integrationConnect.removeFailedToast`,{name:s.current}))}),l={path:{assistant_id:t??``}},u=le({onSuccess(e,t){z.success(a(`integrationConnect.disconnectedToast`,{name:s.current}));let n=t.path.connection_id;S(o,l,e=>e?.filter(e=>e.id!==n)),o.invalidateQueries({queryKey:F(l)})},onError(e){z.error(_(e,void 0,a(`integrationConnect.disconnectFailedToast`,{name:s.current})))}}),d=u.mutate,f=c.remove,p=c.isRemoving||u.isPending;return(0,X.useCallback)((e,i)=>{if(!p){if(s.current=i,Q(e.methodKind)){if(n(e),e.pluginName){f(e.pluginName);return}e.serverId&&r(e.serverId);return}!e.accountId||!t||d({path:{assistant_id:t,connection_id:e.accountId}})}},[p,d,r,n,t,f])}var qt=[{value:`none`,labelKey:`mcpAddServerModal.authNone`},{value:`oauth`,labelKey:`mcpAddServerModal.authOAuth`},{value:`bearer`,labelKey:`mcpAddServerModal.authBearer`},{value:`api-key`,labelKey:`mcpAddServerModal.authApiKey`}],Jt=[{value:`sse`,labelKey:`mcpAddServerModal.transportSse`},{value:`streamable-http`,labelKey:`mcpAddServerModal.transportStreamableHttp`},{value:`stdio`,labelKey:`mcpAddServerModal.transportStdio`}];function Yt(e){return qt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Xt(e){return Jt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Zt({open:e,onClose:n,onAdd:r,isPending:i}){let{t:a}=G(`settings`),o=(0,X.useMemo)(()=>Yt(a),[a]),s=(0,X.useMemo)(()=>Xt(a),[a]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`sse`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[y,b]=(0,X.useState)(`none`),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(`X-API-Key`),[T,E]=(0,X.useState)(``),D=(0,X.useCallback)(()=>{l(``),d(`sse`),p(``),h(``),_(``),b(`none`),S(``),w(`X-API-Key`),E(``)},[]),O=(0,X.useCallback)(()=>{i||(D(),n())},[i,D,n]),k=(0,X.useCallback)(()=>{let e=c.trim();if(!e)return;let t={name:e,transportType:u};if(u===`stdio`){let e=m.trim();if(!e)return;t.command=e;let n=g.trim();n&&(t.args=n.split(/\s+/))}else{let e=f.trim();if(!e)return;t.url=e,y===`bearer`&&x.trim()?t.headers={Authorization:`Bearer ${x.trim()}`}:y===`api-key`&&C.trim()&&T.trim()?t.headers={[C.trim()]:T.trim()}:y===`oauth`&&(t.autoAuth=!0)}r(t)},[c,u,f,m,g,y,x,C,T,r]),A=u===`stdio`,j=c.trim()&&(A?m.trim():f.trim());return(0,Z.jsx)(R.Root,{open:e,onOpenChange:e=>{e||O()},children:(0,Z.jsxs)(R.Content,{size:`md`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:a(`mcpAddServerModal.title`)}),(0,Z.jsx)(R.Description,{children:a(`mcpAddServerModal.description`)})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-name`,children:a(`mcpAddServerModal.serverNameLabel`)}),(0,Z.jsx)(v,{id:`mcp-name`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a(`mcpAddServerModal.namePlaceholder`),fullWidth:!0,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-transport`,children:a(`mcpAddServerModal.transportLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-transport`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),A?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-command`,children:a(`mcpAddServerModal.commandLabel`)}),(0,Z.jsx)(v,{id:`mcp-command`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:a(`mcpAddServerModal.commandPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-args`,children:a(`mcpAddServerModal.argsLabel`)}),(0,Z.jsx)(v,{id:`mcp-args`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:a(`mcpAddServerModal.argsPlaceholder`),fullWidth:!0})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-url`,children:a(`mcpAddServerModal.serverUrlLabel`)}),(0,Z.jsx)(v,{id:`mcp-url`,type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:a(`mcpAddServerModal.urlPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-auth`,children:a(`mcpAddServerModal.authenticationLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-auth`,value:y,onChange:e=>b(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:o.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),y===`oauth`?(0,Z.jsx)(`p`,{className:`rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`mcpAddServerModal.oauthHint`)}):null,y===`bearer`?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-bearer`,children:a(`mcpAddServerModal.bearerTokenLabel`)}),(0,Z.jsx)(v,{id:`mcp-bearer`,type:`password`,value:x,onChange:e=>S(e.target.value),placeholder:a(`mcpAddServerModal.bearerPlaceholder`),fullWidth:!0})]}):null,y===`api-key`?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-header`,children:a(`mcpAddServerModal.headerNameLabel`)}),(0,Z.jsx)(v,{id:`mcp-apikey-header`,type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyHeaderPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-value`,children:a(`mcpAddServerModal.apiKeyLabel`)}),(0,Z.jsx)(v,{id:`mcp-apikey-value`,type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(t,{variant:`ghost`,onClick:O,disabled:i,children:a(`mcpAddServerModal.cancel`)}),(0,Z.jsx)(t,{variant:`primary`,onClick:k,disabled:!j||i,children:a(i?`mcpAddServerModal.adding`:`mcpAddServerModal.addServer`)})]})]})})}var Qt=[`none`,`bearer`,`api-key`];function $t(e,t){switch(e){case`none`:return t(`mcpServerDetailModal.authNone`);case`bearer`:return t(`mcpServerDetailModal.authBearerToken`);case`api-key`:return t(`mcpServerDetailModal.authApiKey`)}}function en({server:e,toolsSummary:n,toolsLoading:r=!1,toolsError:i=!1,readOnly:a=!1,onClose:o,onSave:s,isPending:c}){let{t:l}=G(`settings`),[u,d]=(0,X.useState)(`none`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(`X-API-Key`),[g,_]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(e.authType),p(``),h(e.authHeaderName??`X-API-Key`),_(``))},[e]);let y=(0,X.useCallback)(()=>{if(!e||a)return;let t=u!==e.authType,n=u===`bearer`&&f.trim()!==``,r=u===`api-key`&&m.trim()!==``&&g.trim()!==``,i=t||n||r,o;o=i?u===`none`?null:u===`bearer`&&f.trim()?{Authorization:`Bearer ${f.trim()}`}:u===`api-key`&&m.trim()&&g.trim()?{[m.trim()]:g.trim()}:void 0:void 0,s(e.id,{name:e.id,...o===void 0?{}:{headers:o}})},[e,u,f,m,g,s,a]),b=(0,X.useCallback)(()=>{c||o()},[c,o]);return e?(0,Z.jsx)(R.Root,{open:!!e,onOpenChange:e=>{e||b()},children:(0,Z.jsxs)(R.Content,{size:`lg`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:e.id}),(0,Z.jsx)(R.Description,{children:l(`mcpServerDetailModal.description`,{transport:e.transport.type,status:e.status})})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[!a&&e.transport.type!==`stdio`?(0,Z.jsxs)(Z.Fragment,{children:[e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.oauthBadge`)}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.oauthManagedHint`)})]}):null,e.hasOAuth?null:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-auth`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`select`,{id:`mcp-detail-auth`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:Qt.map(e=>(0,Z.jsx)(`option`,{value:e,children:$t(e,l)},e))})]}),u===`bearer`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-bearer`,children:l(`mcpServerDetailModal.bearerToken`)}),(0,Z.jsx)(v,{id:`mcp-detail-bearer`,type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`bearer`?l(`mcpServerDetailModal.savedBearerPlaceholder`):l(`mcpServerDetailModal.bearerTokenPlaceholder`),fullWidth:!0})]}):null,u===`api-key`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-header`,children:l(`mcpServerDetailModal.headerName`)}),(0,Z.jsx)(v,{id:`mcp-detail-apikey-header`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:l(`mcpServerDetailModal.headerNamePlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-value`,children:l(`mcpServerDetailModal.apiKey`)}),(0,Z.jsx)(v,{id:`mcp-detail-apikey-value`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`api-key`?l(`mcpServerDetailModal.savedApiCredentialPlaceholder`):l(`mcpServerDetailModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]}):null,e.transport.url||e.transport.command?(0,Z.jsxs)(`dl`,{className:`space-y-1 text-body-small-default`,children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-secondary)]`,children:e.transport.type===`stdio`?l(`mcpServerDetailModal.command`):l(`mcpServerDetailModal.endpoint`)}),(0,Z.jsx)(`dd`,{className:`text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:e.transport.url??e.transport.command})]}):null,(0,Z.jsxs)(`section`,{className:`space-y-2`,children:[(0,Z.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.toolsHeading`)}),r?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsLoading`)}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsError`)}):n&&n.tools.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.tokenOverhead`,{count:n.estimatedTokens.toLocaleString()})}),(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] rounded-lg border border-[var(--border-base)]`,children:n.tools.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-1 px-3 py-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)] [overflow-wrap:anywhere]`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolEstimatedTokens`,{count:e.estimatedTokens.toLocaleString()})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsEmpty`)})]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(t,{variant:a?`primary`:`ghost`,onClick:b,disabled:c,children:l(a?`mcpServerDetailModal.close`:`mcpServerDetailModal.cancel`)}),a?null:(0,Z.jsx)(t,{variant:`primary`,onClick:y,disabled:c,children:l(c?`mcpServerDetailModal.saving`:`mcpServerDetailModal.save`)})]})]})}):null}function tn({connections:e,allowAdd:n,attemptReportedElsewhere:r=!1}){let{t:i}=G(`settings`),{auth:a,add:o,save:s,remove:c,details:l,configureServer:u}=e;return(0,Z.jsxs)(Z.Fragment,{children:[a.attempt&&!r?(0,Z.jsx)(U,{tone:a.attempt.error?`warning`:`info`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`[overflow-wrap:anywhere]`,children:a.attempt.error??(a.attempt.phase===`connecting`?i(`mcpConnect.waitingForRuntime`,{name:a.attempt.displayName}):i(`mcpConnect.waitingForAuthorization`,{name:a.attempt.displayName}))}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a.attempt.phase===`error`?(0,Z.jsx)(t,{variant:`outlined`,onClick:a.retry,children:i(`mcpConnect.retry`)}):null,(0,Z.jsx)(t,{variant:`ghost`,onClick:a.stopWaiting,children:i(`mcpConnect.stopWaiting`)})]})]})}):null,n?(0,Z.jsx)(Zt,{open:e.addOpen,onClose:()=>e.setAddOpen(!1),onAdd:e.addCustom,isPending:o.isPending}):null,(0,Z.jsx)(en,{server:u,readOnly:u?.source===`plugin`,toolsSummary:l.data?.servers.find(e=>e.serverId===u?.id),toolsLoading:l.isFetching,toolsError:l.isError,onClose:()=>e.setConfigureServerId(null),onSave:(e,t)=>s.mutate(t),isPending:s.isPending}),(0,Z.jsx)(oe,{open:e.removeServerId!==null,title:i(`mcpPage.removeDialogTitle`),message:e.removeServerId?i(`mcpPage.removeDialogMessage`,{serverId:e.removeServerId}):``,confirmLabel:i(`mcpPage.removeDialogConfirm`),destructive:!0,isPending:c.isPending,onConfirm:()=>{e.removeServerId&&c.mutate(e.removeServerId)},onCancel:()=>e.setRemoveServerId(null)})]})}function nn(e,t){let n=new Map(t.map(e=>[e.name,e]));return e.flatMap(e=>{let t=e.integration;if(t?.kind!==`mcp`)return[];let r=n.get(e.name);return[{pluginName:e.name,displayName:t.displayName,description:e.description??t.displayName,documentationUrl:t.documentationUrl,logo:t.logo,oauthProvider:t.oauthProvider,category:rt(t.category)??void 0,setup:t.setup,installed:r?{icon:r.icon,hasIcon:r.hasIcon,iconVersion:r.iconVersion}:void 0}]})}function rn(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,Z.jsx)(De,{size:20})})}function an({server:e,onRemove:n,onConfigure:r,onAuthenticate:i,onManagePlugin:a,isAuthenticating:o,connectDisabled:s=!1}){let{t:c}=G(`settings`),l=e.source===`plugin`,u=!l&&e.status===`needs-auth`&&e.transport.type!==`stdio`,d=!l&&!o&&!u,f=l?c(`mcpServerCard.managePlugin`):o?c(`mcpServerCard.connecting`):e.hasOAuth?c(`mcpServerCard.reconnect`):c(`mcpServerCard.finishConnecting`);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(rn,{}),title:e.id,subtitle:l?e.pluginName:lt(e),status:e.status===`connected`?void 0:(0,Z.jsx)(y,{tone:`negative`,children:c(`mcpServerCard.statusNeedsAttention`)}),primaryAction:d?(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":c(`mcpServerCard.configureLabel`,{serverId:e.id}),onClick:()=>r(e.id)}):(0,Z.jsx)(t,{variant:u?`primary`:`outlined`,loading:o,onClick:()=>{l?a(e.pluginName):u&&i(e.id)},disabled:o||u&&s,children:f}),actionMenu:(0,Z.jsxs)(k.Root,{children:[(0,Z.jsx)(k.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`ghost`,iconOnly:(0,Z.jsx)(Ce,{}),className:$,"aria-label":c(`mcpServerCard.moreActions`,{serverId:e.id})})}),(0,Z.jsxs)(k.Content,{title:e.id,showTitle:!0,closeLabel:c(`mcpServerCard.actionsSheetClose`),align:`end`,children:[u||l?(0,Z.jsx)(k.Item,{icon:Pe,label:c(l?`mcpServerCard.viewDetails`:`mcpServerCard.configure`),onSelect:()=>r(e.id)}):null,l?null:(0,Z.jsx)(k.Item,{icon:we,label:c(`mcpServerCard.removeServer`),tone:`destructive`,onSelect:()=>n(e.id)})]})]})})}function on({assistantId:e,definition:t}){let n=He(e,t.pluginName,t.installed?.hasIcon,t.installed?.iconVersion);return(0,Z.jsx)(Ue,{external:!0,icon:t.installed?.icon,iconSrc:n,iconUrl:ft(t)??void 0,size:`md`})}function sn({assistantId:e,method:n,disabled:r,onOpen:i}){let{t:a}=G(`settings`),o=ot([],[n]);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(on,{assistantId:e,definition:n.definition}),title:n.definition.displayName,subtitle:n.definition.description,status:o.needsAttention?(0,Z.jsx)(y,{tone:`negative`,children:a(`integrationRow.needsAttention`)}):void 0,primaryAction:(0,Z.jsx)(t,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":a(`integrationRow.configureLabel`,{name:n.definition.displayName}),disabled:r,onClick:i})})}async function cn(e){let{data:t,response:n}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/list`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP servers: ${n?.status}`);return t}async function ln(e){let{data:t,response:n}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/tools-summary`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP tools summary: ${n?.status}`);return t}async function un(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/update`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to update MCP server: ${n?.status}`)}async function dn(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/add`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to add MCP server: ${n?.status}`)}async function fn(e,t){let{response:n}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/remove`,path:{assistant_id:e},body:{name:t}});if(!n?.ok)throw Error(`Failed to remove MCP server: ${n?.status}`)}async function pn(e,t){let{data:n,response:r}=await f.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/start`,path:{assistant_id:e},body:{serverId:t}});if(!r?.ok)throw Error(`Failed to start MCP auth: ${r?.status}`);return n}async function mn(e,t){let{data:n,response:r}=await f.get({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/status/${encodeURIComponent(t)}`,path:{assistant_id:e}});if(!r?.ok)throw Error(`Failed to poll MCP auth status: ${r?.status}`);return n}function hn(e,t){return e.some(e=>e.id===t&&e.status===`connected`)}function gn(e,t){return t?null:e}function _n(e){let{t}=G(`settings`),r=q(),[i,a]=(0,X.useState)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=(0,X.useRef)(null),u=(0,X.useCallback)(()=>{o.current=null,c.current=null,s.current?.close(),s.current=null,a(null)},[]);(0,X.useEffect)(()=>(u(),()=>{o.current=null,c.current=null,s.current?.close(),s.current=null}),[e,u]);let f=i?.phase===`authorizing`||i?.phase===`waiting`,p=W({queryKey:l.auth(e,i?.operationId??``),queryFn:()=>mn(e,i.serverId),enabled:f,refetchInterval:f?ge:!1,staleTime:0,gcTime:0,retry:1}),m=W({queryKey:l.list(e),queryFn:()=>cn(e),enabled:i?.phase===`connecting`,refetchInterval:i?.phase===`connecting`?ge:!1,staleTime:0,retry:1});(0,X.useEffect)(()=>{!i||!f||o.current!==i.operationId||!p.data||(p.data.status===`complete`?(s.current?.close(),s.current=null,a({...i,phase:`connecting`}),r.invalidateQueries({queryKey:l.list(e)})):p.data.status===`error`&&a({...i,phase:`error`,error:p.data.error?.replaceAll(i.serverId,i.displayName)??t(`mcpConnect.authorizationFailed`)}))},[e,i,p.data,f,r,t]),(0,X.useEffect)(()=>{i?.phase!==`connecting`||o.current!==i.operationId||!m.data||m.isFetching||hn(m.data.servers,i.serverId)&&(u(),r.invalidateQueries({queryKey:l.details(e)}))},[e,i,r,m.data,m.isFetching,u]),(0,X.useEffect)(()=>{if(!i||i.phase===`error`)return;let e=f?gn(p.error,p.isFetching):i.phase===`connecting`?gn(m.error,m.isFetching):null;e&&(n(e,{context:`mcp.connect.poll`}),a({...i,phase:`error`,error:t(`mcpConnect.pollFailed`)}))},[i,p.error,p.isFetching,f,m.error,m.isFetching,t]),(0,X.useEffect)(()=>{if(!i||i.phase===`error`)return;let e=setTimeout(()=>{o.current===i.operationId&&(s.current?.close(),s.current=null,a(e=>e?.operationId===i.operationId?{...e,phase:`error`,error:t(`mcpConnect.timedOut`)}:e))},Math.max(0,i.startedAt+ne-Date.now()));return()=>clearTimeout(e)},[i,t]);let h=(0,X.useCallback)(t=>{o.current===t&&(a(e=>e?.operationId===t&&e.phase===`authorizing`?{...e,phase:`waiting`}:e),r.invalidateQueries({queryKey:l.auth(e,t)}),r.invalidateQueries({queryKey:l.list(e)}))},[e,r]);(0,X.useEffect)(()=>{let e=s.current;if(i?.phase!==`authorizing`||!e)return;let t=setInterval(()=>{e.closed&&h(i.operationId)},500);return()=>clearInterval(t)},[i?.operationId,i?.phase,h]),(0,X.useEffect)(()=>{let e=i?.operationId,t=i?.phase;if(!(!e||t===`connecting`||t===`error`))return A(()=>h(e))},[i?.operationId,i?.phase,h]);let _=(0,X.useCallback)((r,l,u=r)=>{if(o.current&&i?.phase!==`error`)return;let f=crypto.randomUUID();o.current=f,s.current?.close(),s.current=null,c.current=l?{operationId:f,run:l}:null;let p={operationId:f,serverId:r,displayName:u,startedAt:Date.now(),phase:`starting`};a(p);let m=g()||w(),h=m?null:window.open(``,`_blank`,`width=500,height=600`);if(!m&&!h){a({...p,phase:`error`,error:t(`mcpConnect.popupBlocked`)});return}h&&(h.opener=null,s.current=h);let _=()=>o.current===f&&Date.now()<p.startedAt+3e5;(async()=>{try{let t=await l?.();if(c.current?.operationId===f&&(c.current=null),!_())return;if(t===null){h?.close(),s.current=null,o.current=null,a(null);return}let n=t?{...p,serverId:t}:p;t&&a(n);let r=await pn(e,n.serverId);if(!_())return;if(r.already_authenticated){h?.close(),s.current=null,a({...n,phase:`connecting`});return}let i=new URL(r.auth_url);if(i.protocol!==`https:`&&i.protocol!==`http:`)throw Error(`Unsupported MCP authorization URL protocol`);a({...n,phase:`authorizing`}),h?h.closed||h.location.replace(i.href):await d(i.href)}catch(e){h?.close(),_()&&(s.current=null,n(e,{context:`mcp.connect.start`}),a(e=>e?.operationId===f?{...e,phase:`error`,error:t(`mcpConnect.startFailed`)}:e))}})()},[e,i?.phase,t]);return{attempt:i,isBusy:!!(i&&i.phase!==`error`),connect:_,retry:()=>{i&&_(i.serverId,c.current?.run,i.displayName)},stopWaiting:u}}function vn(e){let{t}=G(`settings`),r=q(),i=_n(e),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),m=W({queryKey:l.list(e),queryFn:()=>cn(e)}),h=m.data?.servers.find(e=>e.id===s)??null,g=W({queryKey:l.details(e),queryFn:()=>ln(e),enabled:h!==null||f!==null}),_=()=>{r.invalidateQueries({queryKey:l.list(e)}),r.invalidateQueries({queryKey:l.details(e)})},v=K({mutationFn:t=>dn(e,t),onSuccess:()=>{_(),o(!1)},onError:e=>{n(e,{context:`mcp.add`}),z.error(t(`mcpConnect.addFailed`))}});return{list:m,details:g,auth:i,add:v,save:K({mutationFn:t=>un(e,t),onSuccess:()=>{_(),c(null)},onError:e=>{n(e,{context:`mcp.update`}),z.error(t(`mcpConnect.saveFailed`))}}),remove:K({mutationFn:t=>fn(e,t),onSuccess:(e,n)=>{i.attempt?.serverId===n&&i.stopWaiting(),_(),d(null),c(null),z.success(t(`mcpPage.toastRemoved`,{serverId:n}))},onError:(e,r)=>{n(e,{context:`mcp.remove`}),z.error(t(`mcpPage.toastRemoveFailed`,{serverId:r}))}}),addCustom:e=>{e.autoAuth?i.connect(e.name,async()=>{await v.mutateAsync(e)},e.name):v.mutate(e)},addOpen:a,setAddOpen:o,configureServer:h,configureServerId:s,setConfigureServerId:c,removeServerId:u,setRemoveServerId:d,toolsServerId:f,setToolsServerId:p}}var yn={productivity:`integrationsPage.categories.productivity`,communication:`integrationsPage.categories.communication`,meetings:`integrationsPage.categories.meetings`,sales:`integrationsPage.categories.sales`,marketing:`integrationsPage.categories.marketing`,finance:`integrationsPage.categories.finance`,commerce:`integrationsPage.categories.commerce`,engineering:`integrationsPage.categories.engineering`,knowledge:`integrationsPage.categories.knowledge`,recruiting:`integrationsPage.categories.recruiting`},bn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr))]`,xn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr))]`;function Sn({title:e,count:t,gridClassName:n,children:r}){return(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-title-small text-[var(--content-default)]`,children:[e,(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t})]}),(0,Z.jsx)(`div`,{className:n,children:r})]})}function Cn(e,t){return{denied:e(`integrationsPage.oauthErrorDenied`),state_invalid:e(`integrationsPage.oauthErrorStateInvalid`),state_expired:e(`integrationsPage.oauthErrorStateExpired`),exchange_failed:e(`integrationsPage.oauthErrorExchangeFailed`),identity_failed:e(`integrationsPage.oauthErrorIdentityFailed`)}[t]}function wn({mcpAssistantId:e}){let{t:i}=G(`settings`),[a,o]=ve(),s=be(),l=ye(),u=te(),f=I(),p=P.use.mcpAddServer(),m=P.use.hasHydrated(),[h,g]=(0,X.useState)(null),[_,y]=(0,X.useState)(!0),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(null),T=a.get(`provider`),E=(0,X.useRef)(null),O=vn(e),k=Ve(e),A=Gt({assistantId:e,mcp:O});(0,X.useEffect)(()=>{let t=!0;return(async()=>{try{let n=await r(e);t&&n.ok&&g(n.data)}catch(e){n(e,{context:`integrations.getAssistant`})}finally{t&&y(!1)}})(),()=>{t=!1}},[e]);let{login:M}=N(`${l.pathname}${l.search}${l.hash}`),F=(0,X.useCallback)(()=>void M(),[M]),ee=A.closeModal,ne=A.cancel,L=A.attemptItemId,re=A.modal?.itemId??null,R=O.setToolsServerId,B=(0,X.useCallback)(()=>{if(re!==null&&L===re&&ne(),ee(),R(null),!a.has(`provider`))return;let e=new URLSearchParams(a);e.delete(`provider`),o(e,{replace:!0})},[ne,L,ee,re,a,o,R]),{platformAssistantId:ie,isLoading:ae,error:oe}=b(h?.id,u===`full`),se=W({...fe({path:{assistant_id:h?.id??``}}),select:e=>e.providers,enabled:!!h}),ce=W({...j({path:{assistant_id:ie??``}}),enabled:!!ie&&u===`full`});(0,X.useEffect)(()=>{let e=a.get(`oauth_status`);if(!e)return;let t=a.get(`oauth_provider`),n=t?t.charAt(0).toUpperCase()+t.slice(1):null;e===`connected`?z.success(n?i(`integrationsPage.accountConnectedToast`,{providerLabel:n}):i(`integrationsPage.accountConnectedToastGeneric`)):e===`error`&&z.error(Cn(i,a.get(`oauth_code`)??`unknown`)??(n?i(`integrationsPage.connectFailedToast`,{providerLabel:n}):i(`integrationsPage.connectFailedToastGeneric`))),s(he.settings.integrations,{replace:!0})},[a,s,i]);let le=se.isError||ce.isError||!!oe||!_&&!h,ue=!le&&!!se.data&&(u!==`full`||!!ce.data),V=(0,X.useMemo)(()=>ut(ue?se.data??[]:[],ue?ce.data??[]:[],O.list.data?.servers??[],k.installedLoaded?nn(k.catalogMatches,k.installedPlugins):[],O.list.isSuccess),[ue,se.data,ce.data,O.list.data,O.list.isSuccess,k.installedLoaded,k.catalogMatches,k.installedPlugins]),de=(0,X.useMemo)(()=>{let e=new Map;for(let t of V)t.category&&e.set(t.category,(e.get(t.category)??0)+1);return Ge.flatMap(t=>{let n=e.get(t);return n?[{category:t,count:n}]:[]})},[V]),H=de.some(e=>e.category===C)?C:null,me=(0,X.useMemo)(()=>dt(V,x,H),[V,x,H]),ge=(0,X.useMemo)(()=>{let e=new Map;for(let t of V){if(t.kind===`mcp`)continue;let n=vt(t,{platformGate:u,ownOAuthAvailable:!f,mcpServersLoaded:O.list.isSuccess});n&&e.set(t.id,n)}return e},[V,f,O.list.isSuccess,u]),K=e=>ge.has(e.id)&&(!e.configured||e.id===L&&A.modal?.itemId!==e.id),_e=e=>!e.configured||K(e),q=me.filter(e=>!_e(e)),xe=me.filter(_e).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),Se=_||se.isLoading||ce.isLoading||ae||O.list.isLoading||(k.isLoading||k.catalogLoading)&&V.length===0,Ce=O.auth.isBusy||A.managed!==null,we=_||!h||u===`full`&&!ie,Te=A.ownsMcpAttempt&&L!==null&&(A.modal?.itemId===L||me.some(e=>e.id===L&&K(e))),J=A.modal?V.find(e=>e.id===A.modal?.itemId):void 0,Y=J?ge.get(J.id):void 0,De=J?.kind===`oauth`?J.provider:void 0,Oe=D(De?.provider_key??``,De?.tenant_host),Ae=A.openModal;(0,X.useEffect)(()=>{if(!T){E.current=null;return}if(T===E.current)return;let e=V.find(e=>e.kind===`oauth`&&e.provider.provider_key===T);e&&(E.current=T,Ae(e.id))},[V,Ae,T]);let je=O.toolsServerId,Me=O.list.data?.servers.find(e=>e.id===je),Ne=Y&&je?bt(Y).find(e=>e.serverId===je):void 0,Pe=Ne?{[Ne.id]:{loading:O.details.isFetching,error:O.details.isError,summary:O.details.data?.servers.find(e=>e.serverId===je),endpointUrl:Me?.transport.url}}:void 0,Fe=Kt({assistantId:e,platformAssistantId:ie,onStopAuth:e=>{let t=O.auth.attempt?.serverId;if(!t)return;let n=e.pluginName!==void 0&&(t===$e(e.pluginName)||O.list.data?.servers.find(e=>e.id===t)?.pluginName===e.pluginName);(t===e.serverId||n)&&O.auth.stopWaiting()},onRemoveServer:O.setRemoveServerId,onPluginRemoved:()=>void O.list.refetch()}),Ie=()=>{p?O.setAddOpen(!0):pe(s,{prompt:i(`mcpPage.setupPrompt`)})},Le=t=>{let n=t.kind===`mcp`?void 0:ge.get(t.id);return t.kind!==`mcp`&&n&&K(t)?(0,Z.jsx)(Pt,{plan:n,state:A.stateFor(t.id,n.name),showAlternatives:!f,disabled:A.isBusyElsewhere(t.id)||n.primary.kind===`managed-oauth`&&we,onConnect:e=>A.start(t,n,e),onLogin:F,onCancel:A.cancel,onRetry:A.retry,onOpenSetupGuide:e=>void d(e)},t.id):t.kind===`oauth`?(0,Z.jsx)(Nt,{providerKey:t.provider.provider_key,displayName:t.name,description:t.provider.description,logoUrl:t.provider.logo_url,connections:t.connections,mcpMethods:t.methods,disabled:we||!n||A.isBusyElsewhere(t.id),onConfigure:()=>A.openModal(t.id)},t.id):t.kind===`plugin`?(0,Z.jsx)(sn,{assistantId:e,method:t.method,disabled:!n||A.isBusyElsewhere(t.id),onOpen:()=>A.openModal(t.id)},t.id):(0,Z.jsx)(an,{server:t.server,onRemove:O.setRemoveServerId,onConfigure:O.setConfigureServerId,onAuthenticate:e=>O.auth.connect(e),onManagePlugin:e=>s(e?`${he.plugins}/${encodeURIComponent(e)}`:he.plugins),isAuthenticating:O.auth.attempt?.serverId===t.server.id&&Ce,connectDisabled:Ce},t.id)};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(v,{value:x,onChange:e=>S(e.target.value),placeholder:i(`integrationsPage.searchPlaceholder`),"aria-label":i(`integrationsPage.searchAriaLabel`),leftIcon:(0,Z.jsx)(Re,{"aria-hidden":!0,className:`size-4`}),className:`min-h-11`,wrapperClassName:`min-w-0 basis-64 flex-1`,fullWidth:!0}),(0,Z.jsx)(t,{variant:`outlined`,className:`min-h-11 max-w-full whitespace-normal`,leftIcon:(0,Z.jsx)(Ee,{}),onClick:Ie,disabled:!m||Ce,children:i(`integrationsPage.addCustom`)})]}),de.length>0?(0,Z.jsx)(`div`,{role:`group`,"aria-label":i(`integrationsPage.categoriesLabel`),className:`flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none]`,children:de.map(e=>(0,Z.jsx)(c,{selected:H===e.category,count:e.count,onClick:()=>w(H===e.category?null:e.category),children:i(yn[e.category])},e.category))}):null]}),le?(0,Z.jsx)(U,{tone:`warning`,children:i(`integrationsPage.oauthUnavailable`)}):null,O.list.isError?(0,Z.jsx)(U,{tone:`warning`,actions:(0,Z.jsx)(t,{variant:`ghost`,onClick:()=>void O.list.refetch(),children:i(`mcpConnect.retry`)}),children:i(`integrationsPage.mcpUnavailable`)}):null,k.catalogError||k.isError?(0,Z.jsx)(U,{tone:`warning`,children:i(`integrationsPage.pluginCatalogUnavailable`)}):null,(0,Z.jsx)(tn,{connections:O,allowAdd:p,attemptReportedElsewhere:Te}),A.managed&&h?(0,Z.jsx)(Bt,{assistantId:h.id,providerKey:A.managed.providerKey,providerLabel:A.managed.providerLabel,tenantHost:A.managed.tenantHost,restartToken:A.managed.restartToken,onReport:A.onManagedReport},A.managed.providerKey):null,Se?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(ke,{className:`size-4 animate-spin`}),i(`integrationsPage.loading`)]}):null,q.length>0?(0,Z.jsx)(Sn,{title:i(`integrationsPage.sectionConfigured`),count:q.length,gridClassName:bn,children:q.map(Le)}):null,xe.length>0?(0,Z.jsx)(Sn,{title:i(`integrationsPage.sectionAvailable`),count:xe.length,gridClassName:xn,children:xe.map(Le)}):null,!Se&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-body-medium-default text-[var(--content-tertiary)]`,children:x.trim()?i(`integrationsPage.emptySearchSubtitle`,{query:x.trim()}):H?i(`integrationsPage.emptyCategory`,{category:i(yn[H])}):i(`integrationsPage.empty`)}):null,A.modal&&Y&&J&&J.kind!==`mcp`?(0,Z.jsx)(Tt,{plan:Y,focusMethodId:A.modal.methodId,attempt:A.attemptFor(J.id),tenantHost:Oe,toolsByConnectionId:Pe,ownOAuthContent:h&&J.kind===`oauth`?(0,Z.jsx)(Ut,{assistantId:h.id,providerKey:J.provider.provider_key,displayName:J.name,logoUrl:J.provider.logo_url}):null,onConnect:(e,t)=>A.run(J,Y,e,t),onLogin:F,onCancelAttempt:A.cancel,onRetryAttempt:A.retry,onReconnect:e=>A.reconnect(J,Y,e),onOpenTools:e=>O.setToolsServerId(e.serverId??null),onDisconnect:e=>Fe(e,Y.name),onOpenSetupGuide:e=>void d(e),onClose:B},J.id):null]})}function Tn(){let e=O();return(0,Z.jsx)(X.Suspense,{children:(0,Z.jsx)(wn,{mcpAssistantId:e},e)})}export{Tn as IntegrationsPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,Do as n,HC as r,_S as i,iS as a,iw as o,nu as s,o as c,xS as l,yS as u}from"./app-KRIEMzuO.js";import{E as d}from"./vendor-DLH51Vjf.js";import{d as f,f as p,i as m,n as h,t as g,x as _}from"./react-B9IgSVeK.js";import{Ki as v,za as y}from"./icons-C0wyat6T.js";import{t as b}from"./intelligence-layout-slots-store-BvTIV21o.js";import{n as x}from"./list-detail-navigation-BwyoNgJy.js";var S=e(_(),1),C=g();function w({children:e,className:t}){return(0,C.jsx)(r,{variant:`body-medium-default`,className:o(`max-w-[50vw] truncate text-[var(--content-secondary)]`,t),children:e})}function T({ariaLabel:e,tooltip:n,to:r,onClick:i}){return(0,C.jsx)(t,{"data-mobile-top-bar-back":``,shape:`pill`,variant:`ghost`,iconOnly:(0,C.jsx)(y,{"aria-hidden":!0}),className:`max-md:bg-[var(--surface-active)]`,"aria-label":e,tooltip:n,...r==null?{onClick:i}:{asChild:!0,children:(0,C.jsx)(h,{to:r})}})}var E={schedules:`sections.schedules`,superpowers:`sections.superpowers`,plugins:`sections.superpowers`,skills:`sections.superpowers`,memory:`sections.memory`,library:`sections.library`,workspace:`sections.workspace`,contacts:`sections.contacts`,channels:`sections.channels`};function D(){let{t:e}=d(`intelligence`),t=a.use.name(),{pathname:r,state:o}=f(),g=p(),_=s(),y=n.use.setTopBarCenter(),D=n.use.setMobileTopBar(),O=b.use.headerTrailing(),k=b.use.detailIsScreen(),A=i(r),j=A?.key===`workspace`,M=A?e(E[A.key]):null,N=M??(u(r,l.personality)?e(`identitySections.personality.label`):null),P=_&&N!=null,F=P&&k&&A!=null&&!u(r,A.to)?A.to:null,I=t||e(`identityOverview.defaultAssistantName`),L=e(`intelligenceLayout.backToAriaLabel`,{name:I}),R=e(`intelligenceLayout.backToTitle`,{name:I});return(0,S.useEffect)(()=>{if(P&&N){let t=F==null?{ariaLabel:L,tooltip:R,to:l.identity}:{ariaLabel:e(`intelligenceLayout.backToAriaLabel`,{name:N}),tooltip:e(`intelligenceLayout.backToTitle`,{name:N}),onClick:()=>x(g,o,F)};y(null),D({leading:(0,C.jsx)(T,{...t}),center:j?(0,C.jsx)(`span`,{"data-slot":`workspace-page-title`,className:`flex min-w-0`,children:(0,C.jsx)(w,{className:`text-[var(--content-default)] [--text-body-medium-default-size:17px] [--text-body-medium-default-weight:600]`,children:N})}):(0,C.jsx)(w,{children:N}),trailing:O})}else D(null),y(null);return()=>{D(null),y(null)}},[L,R,F,O,j,N,g,P,D,y,o,e]),A?(0,C.jsxs)(c,{className:j?`max-md:rounded-none max-md:border-0 max-md:px-3.5 max-md:pt-0 max-md:pb-3.5`:void 0,style:j?{backgroundColor:`var(--surface-base)`}:void 0,children:[P?null:(0,C.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center gap-1.5`,children:[(0,C.jsx)(h,{to:l.identity,className:`-ml-2 flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors outline-none hover:bg-[var(--surface-hover)] hover:text-[var(--content-default)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,"aria-label":L,title:R,children:(0,C.jsx)(v,{className:`h-5 w-5`,"aria-hidden":!0})}),(0,C.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:M}),O?(0,C.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:O}):null]}),(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,C.jsx)(m,{})})]}):(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,C.jsx)(m,{})})}export{D as IntelligenceLayout};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,Do as n,HC as r,_S as i,iS as a,iw as o,nu as s,o as c,xS as l,yS as u}from"./app-BEoekemj.js";import{E as d}from"./vendor-cVd2QlFV.js";import{d as f,f as p,i as m,n as h,t as g,x as _}from"./react-B9IgSVeK.js";import{Ki as v,za as y}from"./icons-C0wyat6T.js";import{t as b}from"./intelligence-layout-slots-store-jzhqxk-F.js";import{n as x}from"./list-detail-navigation-BwyoNgJy.js";var S=e(_(),1),C=g();function w({children:e,className:t}){return(0,C.jsx)(r,{variant:`body-medium-default`,className:o(`max-w-[50vw] truncate text-[var(--content-secondary)]`,t),children:e})}function T({ariaLabel:e,tooltip:n,to:r,onClick:i}){return(0,C.jsx)(t,{"data-mobile-top-bar-back":``,shape:`pill`,variant:`ghost`,iconOnly:(0,C.jsx)(y,{"aria-hidden":!0}),className:`max-md:bg-[var(--surface-active)]`,"aria-label":e,tooltip:n,...r==null?{onClick:i}:{asChild:!0,children:(0,C.jsx)(h,{to:r})}})}var E={schedules:`sections.schedules`,superpowers:`sections.superpowers`,plugins:`sections.superpowers`,skills:`sections.superpowers`,memory:`sections.memory`,library:`sections.library`,workspace:`sections.workspace`,contacts:`sections.contacts`,channels:`sections.channels`};function D(){let{t:e}=d(`intelligence`),t=a.use.name(),{pathname:r,state:o}=f(),g=p(),_=s(),y=n.use.setTopBarCenter(),D=n.use.setMobileTopBar(),O=b.use.headerTrailing(),k=b.use.detailIsScreen(),A=i(r),j=A?.key===`workspace`,M=A?e(E[A.key]):null,N=M??(u(r,l.personality)?e(`identitySections.personality.label`):null),P=_&&N!=null,F=P&&k&&A!=null&&!u(r,A.to)?A.to:null,I=t||e(`identityOverview.defaultAssistantName`),L=e(`intelligenceLayout.backToAriaLabel`,{name:I}),R=e(`intelligenceLayout.backToTitle`,{name:I});return(0,S.useEffect)(()=>{if(P&&N){let t=F==null?{ariaLabel:L,tooltip:R,to:l.identity}:{ariaLabel:e(`intelligenceLayout.backToAriaLabel`,{name:N}),tooltip:e(`intelligenceLayout.backToTitle`,{name:N}),onClick:()=>x(g,o,F)};y(null),D({leading:(0,C.jsx)(T,{...t}),center:j?(0,C.jsx)(`span`,{"data-slot":`workspace-page-title`,className:`flex min-w-0`,children:(0,C.jsx)(w,{className:`text-[var(--content-default)] [--text-body-medium-default-size:17px] [--text-body-medium-default-weight:600]`,children:N})}):(0,C.jsx)(w,{children:N}),trailing:O})}else D(null),y(null);return()=>{D(null),y(null)}},[L,R,F,O,j,N,g,P,D,y,o,e]),A?(0,C.jsxs)(c,{className:j?`max-md:rounded-none max-md:border-0 max-md:px-3.5 max-md:pt-0 max-md:pb-3.5`:void 0,style:j?{backgroundColor:`var(--surface-base)`}:void 0,children:[P?null:(0,C.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center gap-1.5`,children:[(0,C.jsx)(h,{to:l.identity,className:`-ml-2 flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors outline-none hover:bg-[var(--surface-hover)] hover:text-[var(--content-default)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,"aria-label":L,title:R,children:(0,C.jsx)(v,{className:`h-5 w-5`,"aria-hidden":!0})}),(0,C.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:M}),O?(0,C.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:O}):null]}),(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,C.jsx)(m,{})})]}):(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,C.jsx)(m,{})})}export{D as IntelligenceLayout};
@@ -0,0 +1 @@
1
+ import{QS as e}from"./app-BEoekemj.js";import{J as t}from"./vendor-cVd2QlFV.js";var n=e(t(e=>({headerTrailing:null,detailIsScreen:!1,setHeaderTrailing:t=>e({headerTrailing:t}),setDetailIsScreen:t=>e({detailIsScreen:t})})));export{n as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{xS as t}from"./app-KRIEMzuO.js";import{f as n,x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(){let e=n();return(0,i.useEffect)(()=>{e(t.settings.keyboardShortcuts,{replace:!0})},[e]),null}export{a as KeyboardShortcutsRedirectPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{xS as t}from"./app-BEoekemj.js";import{f as n,x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(){let e=n();return(0,i.useEffect)(()=>{e(t.settings.keyboardShortcuts,{replace:!0})},[e]),null}export{a as KeyboardShortcutsRedirectPage};
@@ -1,4 +1,4 @@
1
- import{pv as e,xg as t}from"./app-KRIEMzuO.js";var n=2;function r({processing:e,sawProcessing:t,hasReply:r,stableReads:i}){return e===void 0?r&&i>=n:!e&&(r||t)}var i=e=>Math.max(0,Math.min(100,Math.round(e)));function a(t,n,r){let a=e=>i(t[e]??50),o=a(e.companionCoworker),s=a(e.executeCollaborate),c=a(e.playfulSerious),l=a(e.politeUnfiltered),u=n?.trim()||`The user`,d=r?.trim(),f=d?`Your name is ${d}. Write exactly \`- **Name:** ${d}\` in IDENTITY.md — do not rename yourself or invent a different name, even if the file currently shows a placeholder or a different name. This changes your personality, not who you are.`:"Keep your existing name exactly as it is — this changes your personality, not who you are. Do not rename yourself, and if your name is already set, carry it through verbatim (don't treat it as a placeholder to fill). Whatever the name ends up being, keep it on IDENTITY.md's `- **Name:** …` line.";return`<system-message>
1
+ import{pv as e,xg as t}from"./app-BEoekemj.js";var n=2;function r({processing:e,sawProcessing:t,hasReply:r,stableReads:i}){return e===void 0?r&&i>=n:!e&&(r||t)}var i=e=>Math.max(0,Math.min(100,Math.round(e)));function a(t,n,r){let a=e=>i(t[e]??50),o=a(e.companionCoworker),s=a(e.executeCollaborate),c=a(e.playfulSerious),l=a(e.politeUnfiltered),u=n?.trim()||`The user`,d=r?.trim(),f=d?`Your name is ${d}. Write exactly \`- **Name:** ${d}\` in IDENTITY.md — do not rename yourself or invent a different name, even if the file currently shows a placeholder or a different name. This changes your personality, not who you are.`:"Keep your existing name exactly as it is — this changes your personality, not who you are. Do not rename yourself, and if your name is already set, carry it through verbatim (don't treat it as a placeholder to fill). Whatever the name ends up being, keep it on IDENTITY.md's `- **Name:** …` line.";return`<system-message>
2
2
  ${u} wants to customize your personality.
3
3
  This is what they want you to be:
4
4
  Companion (0-100): ${100-o}
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ev as t,Fr as n,Pr as r,W as i,Yh as a,cr as o,nu as s,tu as c,v as l,xS as u}from"./app-KRIEMzuO.js";import{E as d}from"./vendor-DLH51Vjf.js";import{d as f,f as p,h as m,t as h,x as g}from"./react-B9IgSVeK.js";import{Yn as _}from"./icons-C0wyat6T.js";import{t as v}from"./deploy-dialogs-CKv9kQor.js";import{t as y}from"./use-edge-swipe-back-B2Kt4500.js";import{t as b}from"./app-types-BoY_FOAH.js";var x=e(g(),1),S=h();function C({enabled:e}){return e?(0,S.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 z-10`,style:{width:20}}):null}function w(){let{t:e}=d(`library`),{appId:h}=m(),g=i(),w=p(),{pathname:T}=f(),E=s(),D=r.use.isDeploying(),O=(0,x.useRef)(null),[k,A]=(0,x.useState)(null),[j,M]=(0,x.useState)(null),[N,P]=(0,x.useState)(!1),F=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(h)return F.current=h,A(null),M(null),t({path:{assistant_id:g,id:h},throwOnError:!0}).then(({data:e})=>{F.current===h&&(a(g,e.appId,e.html),A({assistantId:g,appId:e.appId,dirName:e.dirName,name:e.name,html:e.html,origin:e.origin}))}).catch(e=>{F.current===h&&M(e instanceof Error?e.message:`Failed to open app`)}),()=>{F.current=null}},[g,h]);let I=(0,x.useCallback)(()=>{w(u.library.root)},[w]),L=(0,x.useCallback)(e=>{w(e)},[w]);y({containerRef:O,onBack:I,enabled:E,navKey:T,prefetchHref:u.library.root});let R=l(),z=(0,x.useCallback)(()=>{k&&R(k)},[k,R]),B=(0,x.useCallback)(async()=>{if(!(!k||N)){P(!0);try{await n(g,{id:k.appId,name:k.name},{exported:e(`libraryAppCard.exported`),failed:e(`libraryAppCard.shareFailed`)})}finally{P(!1)}}},[g,k,N,e]),V=(0,x.useCallback)(()=>{k&&r.getState().deployApp(g,k.appId,k.name,k.html)},[g,k]),H=(0,x.useCallback)(e=>{c(w,{prompt:e})},[w]);return h?j?(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4`,children:[(0,S.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,S.jsx)(`button`,{type:`button`,onClick:I,className:`text-body-medium-default text-[var(--primary-base)] underline`,children:e(`libraryDetailPage.backToLibrary`)})]}):k?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{ref:O,className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,S.jsx)(C,{enabled:E}),(0,S.jsx)(o,{appId:k.appId,appName:k.name,html:k.html,assistantId:g,onClose:I,onNavigateAppRoute:L,...b(k.origin)?{}:{onEdit:z,onShare:B,isSharing:N,onDeploy:V,isDeploying:D},enableFullscreen:!0})]}),(0,S.jsx)(v,{assistantId:g,onStartConversation:H})]}):(0,S.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,S.jsx)(_,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):null}export{w as LibraryDetailPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ev as t,Fr as n,Pr as r,W as i,Yh as a,cr as o,nu as s,tu as c,v as l,xS as u}from"./app-BEoekemj.js";import{E as d}from"./vendor-cVd2QlFV.js";import{d as f,f as p,h as m,t as h,x as g}from"./react-B9IgSVeK.js";import{Yn as _}from"./icons-C0wyat6T.js";import{t as v}from"./deploy-dialogs-BwKeOiNO.js";import{t as y}from"./use-edge-swipe-back-zSNP4R0a.js";import{t as b}from"./app-types-BoY_FOAH.js";var x=e(g(),1),S=h();function C({enabled:e}){return e?(0,S.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 z-10`,style:{width:20}}):null}function w(){let{t:e}=d(`library`),{appId:h}=m(),g=i(),w=p(),{pathname:T}=f(),E=s(),D=r.use.isDeploying(),O=(0,x.useRef)(null),[k,A]=(0,x.useState)(null),[j,M]=(0,x.useState)(null),[N,P]=(0,x.useState)(!1),F=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(h)return F.current=h,A(null),M(null),t({path:{assistant_id:g,id:h},throwOnError:!0}).then(({data:e})=>{F.current===h&&(a(g,e.appId,e.html),A({assistantId:g,appId:e.appId,dirName:e.dirName,name:e.name,html:e.html,origin:e.origin}))}).catch(e=>{F.current===h&&M(e instanceof Error?e.message:`Failed to open app`)}),()=>{F.current=null}},[g,h]);let I=(0,x.useCallback)(()=>{w(u.library.root)},[w]),L=(0,x.useCallback)(e=>{w(e)},[w]);y({containerRef:O,onBack:I,enabled:E,navKey:T,prefetchHref:u.library.root});let R=l(),z=(0,x.useCallback)(()=>{k&&R(k)},[k,R]),B=(0,x.useCallback)(async()=>{if(!(!k||N)){P(!0);try{await n(g,{id:k.appId,name:k.name},{exported:e(`libraryAppCard.exported`),failed:e(`libraryAppCard.shareFailed`)})}finally{P(!1)}}},[g,k,N,e]),V=(0,x.useCallback)(()=>{k&&r.getState().deployApp(g,k.appId,k.name,k.html)},[g,k]),H=(0,x.useCallback)(e=>{c(w,{prompt:e})},[w]);return h?j?(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4`,children:[(0,S.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,S.jsx)(`button`,{type:`button`,onClick:I,className:`text-body-medium-default text-[var(--primary-base)] underline`,children:e(`libraryDetailPage.backToLibrary`)})]}):k?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{ref:O,className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,S.jsx)(C,{enabled:E}),(0,S.jsx)(o,{appId:k.appId,appName:k.name,html:k.html,assistantId:g,onClose:I,onNavigateAppRoute:L,...b(k.origin)?{}:{onEdit:z,onShare:B,isSharing:N,onDeploy:V,isDeploying:D},enableFullscreen:!0})]}),(0,S.jsx)(v,{assistantId:g,onStartConversation:H})]}):(0,S.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,S.jsx)(_,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):null}export{w as LibraryDetailPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,AS as n,Dv as r,Ea as i,Fp as a,Jh as o,Np as s,OC as c,Pp as l,Pr as u,Pt as d,Qt as f,Rg as p,W as m,WC as h,Yi as g,Yo as _,dp as v,fo as y,fp as b,hC as x,is as S,l as C,lr as w,nu as T,po as E,tu as D,u as O,ur as k,vc as A,xS as j}from"./app-KRIEMzuO.js";import{$n as M,E as N,Xn as P,nr as F}from"./vendor-DLH51Vjf.js";import{d as I,f as L,t as R,x as z}from"./react-B9IgSVeK.js";import{$r as B,A as V,At as H,Br as U,Cr as W,Ht as G,Ia as K,Ur as ee,Vt as q,ir as J,ri as te,tr as ne,vt as Y}from"./icons-C0wyat6T.js";import{t as re}from"./deploy-dialogs-CKv9kQor.js";import{t as ie}from"./intelligence-layout-slots-store-BvTIV21o.js";import{n as ae,r as oe,t as se}from"./use-app-delete-Bd9ibG9z.js";import{t as ce}from"./app-types-BoY_FOAH.js";var X=e(z(),1),Z=R();function le(e){return e===1?`1 word`:`${e} words`}function ue({document:e,onOpen:t}){return(0,Z.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:_(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,Z.jsx)(U,{size:34,className:`text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:le(e.wordCount)})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:d(new Date(e.updatedAt))})]})]})}function de({onNewConversation:e}){let{t:n}=N(`library`);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,Z.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,Z.jsx)(J,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,Z.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:n(`libraryEmptyState.heading`)}),(0,Z.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n(`libraryEmptyState.body`)}),e?(0,Z.jsx)(t,{variant:`primary`,size:`regular`,onClick:e,children:n(`libraryEmptyState.newConversation`)}):null]})}function fe({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:a,onDelete:s,onDeploy:c,justImported:l,onAnimationEnd:u}){let{t:p}=N(`library`),m=ce(e.origin),h=m?void 0:s,g=m?void 0:c,v=(0,X.useCallback)(()=>o(t,e.id,e.updatedAt),[t,e.id,e.updatedAt]),y=ae(t,e,{exported:p(`libraryAppCard.exported`),failed:p(`libraryAppCard.shareFailed`)}),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),T=(0,X.useCallback)(()=>C(!0),[]),{deployedUrl:E}=k(t,e.id,{enabled:S&&g!=null}),D=(0,X.useCallback)(()=>{E!=null&&w(E)},[E]);return(0,Z.jsx)(i,{trailingActions:[{id:`pin`,label:p(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),icon:n?G:q,onSelect:()=>a(e)},...h?[{id:`delete`,label:p(`libraryAppCard.delete`),icon:V,variant:`destructive`,onSelect:()=>h(e)}]:[]],className:`rounded-xl`,children:(0,Z.jsxs)(`div`,{"data-reveal-row":``,className:_(`relative flex flex-col gap-2`,l&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:l?u:void 0,onPointerEnter:T,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:_(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,Z.jsx)(f,{name:e.name,icon:e.icon,loadHtml:v})}),(0,Z.jsx)(`div`,{"data-reveal":``,className:`absolute right-2 top-2 z-20`,children:(0,Z.jsx)(pe,{appName:e.name,isPinned:n,open:b,onOpenChange:e=>{e&&T(),x(e)},onPin:()=>a(e),onDelete:h?()=>h(e):void 0,onShare:m?void 0:y,onDeploy:g,deployedUrl:E,onCopyDeployedLink:D})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)] max-md:text-body-medium-lighter max-md:text-[color:var(--content-secondary)]`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)] max-md:hidden`,children:d(new Date(e.createdAt))})]})]})})}function pe({appName:e,isPinned:n,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:s,onDeploy:c,deployedUrl:l,onCopyDeployedLink:u}){let{t:d}=N(`library`),f=l!=null&&l!==``&&u!=null,p=d(`libraryAppCard.actionsTitle`,{appName:e});return(0,Z.jsxs)(h.Root,{open:r,onOpenChange:i,children:[(0,Z.jsx)(h.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`primary`,size:`compact`,iconOnly:(0,Z.jsx)(B,{}),"aria-label":p,onClick:e=>e.stopPropagation()})}),(0,Z.jsxs)(h.Content,{title:p,children:[(0,Z.jsx)(h.Item,{icon:n?G:q,label:d(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),onSelect:a}),s?(0,Z.jsx)(h.Item,{icon:K,label:d(`libraryAppCard.share`),description:d(`libraryAppCard.shareSub`),onSelect:s}):null,c&&f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h.Item,{icon:ne,label:d(`libraryAppCard.deployed`),description:(0,Z.jsx)(`span`,{className:`break-all`,children:l}),trailing:d(`libraryAppCard.copyLink`),onSelect:()=>u?.()}),(0,Z.jsx)(h.Item,{icon:H,label:d(`libraryAppCard.redeploy`),description:d(`libraryAppCard.redeploySub`),onSelect:c})]}):c?(0,Z.jsx)(h.Item,{icon:W,label:d(`libraryAppCard.deploy`),description:d(`libraryAppCard.deploySub`),onSelect:c}):null,o?(0,Z.jsx)(h.Item,{icon:V,label:d(`libraryAppCard.delete`),tone:`destructive`,onSelect:o}):null]})]})}function Q({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)] max-md:sr-only`,children:e}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6 [--swipe-item-surface:var(--surface-base)] max-md:[--swipe-item-surface:var(--surface-overlay)]`,children:t.map(e=>(0,Z.jsx)(fe,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var $=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function me(e){let{pinnedAppIds:t}=g(e),{data:n=[],isLoading:r,error:i}=M({...v({path:{assistant_id:e}}),select:e=>e.apps}),{data:a=[],isLoading:o,error:s}=M({...l({path:{assistant_id:e}}),select:e=>e.documents}),c=r||o,u=i&&s?i instanceof Error?i.message:`Failed to load library`:null,[d,f]=(0,X.useState)(``),p=(0,X.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:a,filteredApps:p,pinnedApps:(0,X.useMemo)(()=>p.filter(e=>t.has(e.id)).sort($),[p,t]),recentApps:(0,X.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort($),[p,t]),filteredDocuments:(0,X.useMemo)(()=>{if(!d.trim())return a;let e=d.toLowerCase();return a.filter(t=>t.title.toLowerCase().includes(e))},[a,d]),searchText:d,setSearchText:f,loading:c,error:u}}async function he(e,t){let{data:n,error:i,response:a}=await r({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!a||!a.ok){let e=(i&&typeof i==`object`&&`message`in i?i.message:null)??`Failed to import app.`;throw Error(e)}return n}function ge({assistantId:e,assistantName:n,onNewConversation:r,onOpenDocument:i,onNewDocument:a,isCreatingDocument:s=!1,onOpenApp:l}){let{t:d}=N(`library`),f=T(),p=F(),{togglePin:m,pinnedAppIds:h}=g(e),_=u.use.isDeploying(),{apps:v,documents:y,filteredApps:C,pinnedApps:w,recentApps:E,filteredDocuments:D,searchText:O,setSearchText:k,loading:A,error:j}=me(e),{pendingDelete:M,isDeleting:P,requestDelete:I,confirmDelete:L,cancelDelete:R}=se(e),[z]=(0,X.useState)(()=>S()?void 0:`.vellum`),B=(0,X.useRef)(null),[V,H]=(0,X.useState)(!1),U=(0,X.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||V)){H(!0);try{let t=await he(e,n);await p.invalidateQueries({queryKey:b({path:{assistant_id:e}})}),x.success(d(`libraryView.imported`,{name:t.name})),l(t.appId)}catch(e){x.error(e instanceof Error?e.message:d(`libraryView.importFailed`))}finally{H(!1),B.current&&(B.current.value=``)}}},[e,V,p,l,d]),W=(0,X.useCallback)(async t=>{if(_)return;let n=v.find(e=>e.id===t)?.name??`this app`;try{let r=await o(e,t);u.getState().deployApp(e,t,n,r)}catch{u.getState().deployApp(e,t,n,``)}},[e,_,v]),G=(0,X.useCallback)(e=>m(e.id),[m]),K=ie.use.setHeaderTrailing(),q=!A&&!j;if((0,X.useEffect)(()=>{if(!q){K(null);return}let e=(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),n=V?e:(0,Z.jsx)(te,{"aria-hidden":!0}),r=s?e:(0,Z.jsx)(ee,{"aria-hidden":!0});return K(f?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:n,"aria-label":d(`libraryView.import`),tooltip:d(`libraryView.import`),className:`max-md:bg-[var(--surface-active)]`,onClick:()=>B.current?.click(),disabled:V}),a?(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:r,"aria-label":d(`libraryView.newDocument`),tooltip:d(`libraryView.newDocument`),className:`max-md:bg-[var(--surface-active)]`,onClick:a,disabled:s}):null]}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(t,{variant:`outlined`,size:`regular`,onClick:()=>B.current?.click(),disabled:V,children:[n,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:d(`libraryView.import`)})]}),a?(0,Z.jsxs)(t,{size:`regular`,onClick:a,disabled:s,children:[r,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:d(`libraryView.newDocument`)})]}):null]})),()=>{K(null)}},[f,q,V,a,s,K,d]),A)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":d(`libraryView.loadingAria`)})});if(j)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:d(`libraryView.retry`)})]});let J=v.length===0&&y.length===0;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsx)(`input`,{ref:B,type:`file`,accept:z,className:`hidden`,onChange:U}),J?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(de,{onNewConversation:r?()=>r():void 0})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,Z.jsx)(c,{fullWidth:!0,type:`text`,placeholder:d(`libraryView.searchPlaceholder`),value:O,onChange:e=>k(e.target.value),leftIcon:(0,Z.jsx)(Y,{size:16})})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:C.length===0&&D.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,Z.jsx)(Y,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:d(`libraryView.noMatches`,{query:O})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Z.jsx)(Q,{title:d(`libraryView.pinned`),apps:w,assistantId:e,pinnedAppIds:h,onOpen:l,onPin:G,onDelete:I,onDeploy:W}),(0,Z.jsx)(Q,{title:d(`libraryView.recents`),apps:E,assistantId:e,pinnedAppIds:h,onOpen:l,onPin:G,onDelete:I,onDeploy:W}),D.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:d(`libraryView.documents`)}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:D.map(e=>(0,Z.jsx)(ue,{document:e,onOpen:e=>{i&&i(e)}},e.surfaceId))})]}):null]})}),(0,Z.jsx)(re,{assistantId:e,assistantName:n,onStartConversation:r}),(0,Z.jsx)(oe,{app:M,isDeleting:P,onConfirm:L,onCancel:R})]})]})}function _e(){let e=F(),t=P({...s(),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a({path:n.path})})}});return{createDocument:({assistantId:e,conversationId:n})=>t.mutateAsync({path:{assistant_id:e},body:{conversationId:n}}),isPending:t.isPending}}function ve(e,t){let{t:r}=N(`library`),i=F(),{createDocument:a}=_e(),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(!1);return{newDocument:(0,X.useCallback)(async()=>{if(!c.current){c.current=!0,s(!0);try{let o=await C({assistantId:e,fallback:r(`libraryView.newDocumentFailed`)});if(!o.ok){x.error(o.error);return}let s;try{({surfaceId:s}=await a({assistantId:e,conversationId:o.conversationId}))}catch(t){n(t,{context:`new_library_document`}),O(e,o.conversationId),x.error(r(`libraryView.newDocumentFailed`));return}A(i,e),t(s)}finally{c.current=!1,s(!1)}}},[e,a,t,i,r]),isCreating:o}}var ye=`0.12.2-dev.202609211450.3151b18`;function be(e){return p(ye,e)}function xe(){let e=m(),t=L(),n=I(),r=(0,X.useCallback)(e=>{D(t,{prompt:e})},[t]),i=(0,X.useCallback)(e=>{t(E(e,n.pathname),{state:y(n,e)})},[t,n]),{newDocument:a,isCreating:o}=ve(e,i),s=be(e),c=(0,X.useCallback)(()=>{a()},[a]),l=(0,X.useCallback)(e=>{t(j.library.app(e))},[t]);return(0,Z.jsx)(ge,{assistantId:e,onNewConversation:r,onOpenDocument:i,onNewDocument:s?c:void 0,isCreatingDocument:o,onOpenApp:l})}export{xe as LibraryPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,AS as n,Dv as r,Ea as i,Fp as a,Jh as o,Np as s,OC as c,Pp as l,Pr as u,Pt as d,Qt as f,Rg as p,W as m,WC as h,Yi as g,Yo as _,dp as v,fo as y,fp as b,hC as x,is as S,l as C,lr as w,nu as T,po as E,tu as D,u as O,ur as k,vc as A,xS as j}from"./app-BEoekemj.js";import{$n as M,E as N,Xn as P,nr as F}from"./vendor-cVd2QlFV.js";import{d as I,f as L,t as R,x as z}from"./react-B9IgSVeK.js";import{$r as B,A as V,At as H,Br as U,Cr as W,Ht as G,Ia as K,Ur as ee,Vt as q,ir as J,ri as te,tr as ne,vt as Y}from"./icons-C0wyat6T.js";import{t as re}from"./deploy-dialogs-BwKeOiNO.js";import{t as ie}from"./intelligence-layout-slots-store-jzhqxk-F.js";import{n as ae,r as oe,t as se}from"./use-app-delete-CzP_P0YE.js";import{t as ce}from"./app-types-BoY_FOAH.js";var X=e(z(),1),Z=R();function le(e){return e===1?`1 word`:`${e} words`}function ue({document:e,onOpen:t}){return(0,Z.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:_(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,Z.jsx)(U,{size:34,className:`text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:le(e.wordCount)})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:d(new Date(e.updatedAt))})]})]})}function de({onNewConversation:e}){let{t:n}=N(`library`);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,Z.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,Z.jsx)(J,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,Z.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:n(`libraryEmptyState.heading`)}),(0,Z.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n(`libraryEmptyState.body`)}),e?(0,Z.jsx)(t,{variant:`primary`,size:`regular`,onClick:e,children:n(`libraryEmptyState.newConversation`)}):null]})}function fe({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:a,onDelete:s,onDeploy:c,justImported:l,onAnimationEnd:u}){let{t:p}=N(`library`),m=ce(e.origin),h=m?void 0:s,g=m?void 0:c,v=(0,X.useCallback)(()=>o(t,e.id,e.updatedAt),[t,e.id,e.updatedAt]),y=ae(t,e,{exported:p(`libraryAppCard.exported`),failed:p(`libraryAppCard.shareFailed`)}),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1),T=(0,X.useCallback)(()=>C(!0),[]),{deployedUrl:E}=k(t,e.id,{enabled:S&&g!=null}),D=(0,X.useCallback)(()=>{E!=null&&w(E)},[E]);return(0,Z.jsx)(i,{trailingActions:[{id:`pin`,label:p(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),icon:n?G:q,onSelect:()=>a(e)},...h?[{id:`delete`,label:p(`libraryAppCard.delete`),icon:V,variant:`destructive`,onSelect:()=>h(e)}]:[]],className:`rounded-xl`,children:(0,Z.jsxs)(`div`,{"data-reveal-row":``,className:_(`relative flex flex-col gap-2`,l&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:l?u:void 0,onPointerEnter:T,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:_(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,Z.jsx)(f,{name:e.name,icon:e.icon,loadHtml:v})}),(0,Z.jsx)(`div`,{"data-reveal":``,className:`absolute right-2 top-2 z-20`,children:(0,Z.jsx)(pe,{appName:e.name,isPinned:n,open:b,onOpenChange:e=>{e&&T(),x(e)},onPin:()=>a(e),onDelete:h?()=>h(e):void 0,onShare:m?void 0:y,onDeploy:g,deployedUrl:E,onCopyDeployedLink:D})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)] max-md:text-body-medium-lighter max-md:text-[color:var(--content-secondary)]`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)] max-md:hidden`,children:d(new Date(e.createdAt))})]})]})})}function pe({appName:e,isPinned:n,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:s,onDeploy:c,deployedUrl:l,onCopyDeployedLink:u}){let{t:d}=N(`library`),f=l!=null&&l!==``&&u!=null,p=d(`libraryAppCard.actionsTitle`,{appName:e});return(0,Z.jsxs)(h.Root,{open:r,onOpenChange:i,children:[(0,Z.jsx)(h.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`primary`,size:`compact`,iconOnly:(0,Z.jsx)(B,{}),"aria-label":p,onClick:e=>e.stopPropagation()})}),(0,Z.jsxs)(h.Content,{title:p,children:[(0,Z.jsx)(h.Item,{icon:n?G:q,label:d(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),onSelect:a}),s?(0,Z.jsx)(h.Item,{icon:K,label:d(`libraryAppCard.share`),description:d(`libraryAppCard.shareSub`),onSelect:s}):null,c&&f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h.Item,{icon:ne,label:d(`libraryAppCard.deployed`),description:(0,Z.jsx)(`span`,{className:`break-all`,children:l}),trailing:d(`libraryAppCard.copyLink`),onSelect:()=>u?.()}),(0,Z.jsx)(h.Item,{icon:H,label:d(`libraryAppCard.redeploy`),description:d(`libraryAppCard.redeploySub`),onSelect:c})]}):c?(0,Z.jsx)(h.Item,{icon:W,label:d(`libraryAppCard.deploy`),description:d(`libraryAppCard.deploySub`),onSelect:c}):null,o?(0,Z.jsx)(h.Item,{icon:V,label:d(`libraryAppCard.delete`),tone:`destructive`,onSelect:o}):null]})]})}function Q({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)] max-md:sr-only`,children:e}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6 [--swipe-item-surface:var(--surface-base)] max-md:[--swipe-item-surface:var(--surface-overlay)]`,children:t.map(e=>(0,Z.jsx)(fe,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var $=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function me(e){let{pinnedAppIds:t}=g(e),{data:n=[],isLoading:r,error:i}=M({...v({path:{assistant_id:e}}),select:e=>e.apps}),{data:a=[],isLoading:o,error:s}=M({...l({path:{assistant_id:e}}),select:e=>e.documents}),c=r||o,u=i&&s?i instanceof Error?i.message:`Failed to load library`:null,[d,f]=(0,X.useState)(``),p=(0,X.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:a,filteredApps:p,pinnedApps:(0,X.useMemo)(()=>p.filter(e=>t.has(e.id)).sort($),[p,t]),recentApps:(0,X.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort($),[p,t]),filteredDocuments:(0,X.useMemo)(()=>{if(!d.trim())return a;let e=d.toLowerCase();return a.filter(t=>t.title.toLowerCase().includes(e))},[a,d]),searchText:d,setSearchText:f,loading:c,error:u}}async function he(e,t){let{data:n,error:i,response:a}=await r({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!a||!a.ok){let e=(i&&typeof i==`object`&&`message`in i?i.message:null)??`Failed to import app.`;throw Error(e)}return n}function ge({assistantId:e,assistantName:n,onNewConversation:r,onOpenDocument:i,onNewDocument:a,isCreatingDocument:s=!1,onOpenApp:l}){let{t:d}=N(`library`),f=T(),p=F(),{togglePin:m,pinnedAppIds:h}=g(e),_=u.use.isDeploying(),{apps:v,documents:y,filteredApps:C,pinnedApps:w,recentApps:E,filteredDocuments:D,searchText:O,setSearchText:k,loading:A,error:j}=me(e),{pendingDelete:M,isDeleting:P,requestDelete:I,confirmDelete:L,cancelDelete:R}=se(e),[z]=(0,X.useState)(()=>S()?void 0:`.vellum`),B=(0,X.useRef)(null),[V,H]=(0,X.useState)(!1),U=(0,X.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||V)){H(!0);try{let t=await he(e,n);await p.invalidateQueries({queryKey:b({path:{assistant_id:e}})}),x.success(d(`libraryView.imported`,{name:t.name})),l(t.appId)}catch(e){x.error(e instanceof Error?e.message:d(`libraryView.importFailed`))}finally{H(!1),B.current&&(B.current.value=``)}}},[e,V,p,l,d]),W=(0,X.useCallback)(async t=>{if(_)return;let n=v.find(e=>e.id===t)?.name??`this app`;try{let r=await o(e,t);u.getState().deployApp(e,t,n,r)}catch{u.getState().deployApp(e,t,n,``)}},[e,_,v]),G=(0,X.useCallback)(e=>m(e.id),[m]),K=ie.use.setHeaderTrailing(),q=!A&&!j;if((0,X.useEffect)(()=>{if(!q){K(null);return}let e=(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),n=V?e:(0,Z.jsx)(te,{"aria-hidden":!0}),r=s?e:(0,Z.jsx)(ee,{"aria-hidden":!0});return K(f?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:n,"aria-label":d(`libraryView.import`),tooltip:d(`libraryView.import`),className:`max-md:bg-[var(--surface-active)]`,onClick:()=>B.current?.click(),disabled:V}),a?(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:r,"aria-label":d(`libraryView.newDocument`),tooltip:d(`libraryView.newDocument`),className:`max-md:bg-[var(--surface-active)]`,onClick:a,disabled:s}):null]}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(t,{variant:`outlined`,size:`regular`,onClick:()=>B.current?.click(),disabled:V,children:[n,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:d(`libraryView.import`)})]}),a?(0,Z.jsxs)(t,{size:`regular`,onClick:a,disabled:s,children:[r,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:d(`libraryView.newDocument`)})]}):null]})),()=>{K(null)}},[f,q,V,a,s,K,d]),A)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":d(`libraryView.loadingAria`)})});if(j)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:d(`libraryView.retry`)})]});let J=v.length===0&&y.length===0;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsx)(`input`,{ref:B,type:`file`,accept:z,className:`hidden`,onChange:U}),J?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(de,{onNewConversation:r?()=>r():void 0})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,Z.jsx)(c,{fullWidth:!0,type:`text`,placeholder:d(`libraryView.searchPlaceholder`),value:O,onChange:e=>k(e.target.value),leftIcon:(0,Z.jsx)(Y,{size:16})})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:C.length===0&&D.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,Z.jsx)(Y,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:d(`libraryView.noMatches`,{query:O})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Z.jsx)(Q,{title:d(`libraryView.pinned`),apps:w,assistantId:e,pinnedAppIds:h,onOpen:l,onPin:G,onDelete:I,onDeploy:W}),(0,Z.jsx)(Q,{title:d(`libraryView.recents`),apps:E,assistantId:e,pinnedAppIds:h,onOpen:l,onPin:G,onDelete:I,onDeploy:W}),D.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:d(`libraryView.documents`)}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:D.map(e=>(0,Z.jsx)(ue,{document:e,onOpen:e=>{i&&i(e)}},e.surfaceId))})]}):null]})}),(0,Z.jsx)(re,{assistantId:e,assistantName:n,onStartConversation:r}),(0,Z.jsx)(oe,{app:M,isDeleting:P,onConfirm:L,onCancel:R})]})]})}function _e(){let e=F(),t=P({...s(),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a({path:n.path})})}});return{createDocument:({assistantId:e,conversationId:n})=>t.mutateAsync({path:{assistant_id:e},body:{conversationId:n}}),isPending:t.isPending}}function ve(e,t){let{t:r}=N(`library`),i=F(),{createDocument:a}=_e(),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(!1);return{newDocument:(0,X.useCallback)(async()=>{if(!c.current){c.current=!0,s(!0);try{let o=await C({assistantId:e,fallback:r(`libraryView.newDocumentFailed`)});if(!o.ok){x.error(o.error);return}let s;try{({surfaceId:s}=await a({assistantId:e,conversationId:o.conversationId}))}catch(t){n(t,{context:`new_library_document`}),O(e,o.conversationId),x.error(r(`libraryView.newDocumentFailed`));return}A(i,e),t(s)}finally{c.current=!1,s(!1)}}},[e,a,t,i,r]),isCreating:o}}var ye=`0.12.2-dev.202609211450.3151b18`;function be(e){return p(ye,e)}function xe(){let e=m(),t=L(),n=I(),r=(0,X.useCallback)(e=>{D(t,{prompt:e})},[t]),i=(0,X.useCallback)(e=>{t(E(e,n.pathname),{state:y(n,e)})},[t,n]),{newDocument:a,isCreating:o}=ve(e,i),s=be(e),c=(0,X.useCallback)(()=>{a()},[a]),l=(0,X.useCallback)(e=>{t(j.library.app(e))},[t]);return(0,Z.jsx)(ge,{assistantId:e,onNewConversation:r,onOpenDocument:i,onNewDocument:s?c:void 0,isCreatingDocument:o,onOpenApp:l})}export{xe as LibraryPage};
@@ -0,0 +1 @@
1
+ import{jx as e}from"./app-BEoekemj.js";export{e as markLockfileAssistantOnboarded};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,$c as n,AS as r,Jy as i,Qc as a,Tb as o,Yy as s,el as c,tl as l,xS as u}from"./app-KRIEMzuO.js";import{E as d}from"./vendor-DLH51Vjf.js";import{d as f,t as p,x as m}from"./react-B9IgSVeK.js";import{n as h,r as g,t as _}from"./auth-welcome-screen-CK9ayr5r.js";import{n as v,t as y}from"./use-return-to-short-circuit-CrgMpIk2.js";var b=e(m(),1),x=p();function S({returnTo:e}){let{t:o}=d(`account`),[s,u]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),m=async()=>{u(null),p(!0);try{await i({returnTo:e??null})}catch(e){if(n(e)){p(!1);return}r(e,{context:`native_login`,tags:{authError:c(e)??`unclassified`}}),u(o(l(e),{community:a})),p(!1)}};return(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(h,{error:s,children:(0,x.jsx)(t,{type:`button`,variant:`primary`,size:`large`,fullWidth:!0,onClick:()=>{m()},disabled:f,children:o(`loginPage.signIn`)})})})}function C({returnTo:e}){let{t}=d(`account`),{search:n}=f(),r=o(e?`${u.account.signup}?returnTo=${encodeURIComponent(e)}`:u.account.signup,n);return(0,x.jsx)(_,{returnTo:e,errorContext:`web_login`,fillsViewport:!0,secondary:{label:t(`loginPage.signUp`),href:r}})}function w(){let e=s(),t=y();return t.kind===`wait`?(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(v,{})}):t.kind===`redirect`?t.node:e?(0,x.jsx)(S,{returnTo:t.returnTo}):(0,x.jsx)(C,{returnTo:t.returnTo})}export{w as LoginPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$C as t,$c as n,AS as r,Jy as i,Qc as a,Tb as o,Yy as s,el as c,tl as l,xS as u}from"./app-BEoekemj.js";import{E as d}from"./vendor-cVd2QlFV.js";import{d as f,t as p,x as m}from"./react-B9IgSVeK.js";import{n as h,r as g,t as _}from"./auth-welcome-screen-CnpHRdVh.js";import{n as v,t as y}from"./use-return-to-short-circuit-C0-TwAO7.js";var b=e(m(),1),x=p();function S({returnTo:e}){let{t:o}=d(`account`),[s,u]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),m=async()=>{u(null),p(!0);try{await i({returnTo:e??null})}catch(e){if(n(e)){p(!1);return}r(e,{context:`native_login`,tags:{authError:c(e)??`unclassified`}}),u(o(l(e),{community:a})),p(!1)}};return(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(h,{error:s,children:(0,x.jsx)(t,{type:`button`,variant:`primary`,size:`large`,fullWidth:!0,onClick:()=>{m()},disabled:f,children:o(`loginPage.signIn`)})})})}function C({returnTo:e}){let{t}=d(`account`),{search:n}=f(),r=o(e?`${u.account.signup}?returnTo=${encodeURIComponent(e)}`:u.account.signup,n);return(0,x.jsx)(_,{returnTo:e,errorContext:`web_login`,fillsViewport:!0,secondary:{label:t(`loginPage.signUp`),href:r}})}function w(){let e=s(),t=y();return t.kind===`wait`?(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(v,{})}):t.kind===`redirect`?t.node:e?(0,x.jsx)(S,{returnTo:t.returnTo}):(0,x.jsx)(C,{returnTo:t.returnTo})}export{w as LoginPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cb as t,Ch as n,fl as r,xS as i}from"./app-KRIEMzuO.js";import{E as a}from"./vendor-DLH51Vjf.js";import{_ as o,t as s,x as c}from"./react-B9IgSVeK.js";import{r as l,t as u}from"./account-shell-Cxi1v479.js";var d=e(c(),1),f=s();function p(){let{t:e}=a(`account`),[s]=o(),c=n.use.logout(),p=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{if(p.current)return;p.current=!0;let e=t(s.get(`returnTo`),i.account.login),n=e.startsWith(`http`)||e===i.account.login?e:`${i.account.login}?returnTo=${encodeURIComponent(e)}`,a=!1;return c().then(()=>{a||r(n)},()=>{a||r(n)}),()=>{a=!0}},[c,s]),(0,f.jsx)(u,{children:(0,f.jsx)(l,{title:e(`logoutPage.title`)})})}export{p as LogoutPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cb as t,Ch as n,fl as r,xS as i}from"./app-BEoekemj.js";import{E as a}from"./vendor-cVd2QlFV.js";import{_ as o,t as s,x as c}from"./react-B9IgSVeK.js";import{r as l,t as u}from"./account-shell-RM4hokh5.js";var d=e(c(),1),f=s();function p(){let{t:e}=a(`account`),[s]=o(),c=n.use.logout(),p=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{if(p.current)return;p.current=!0;let e=t(s.get(`returnTo`),i.account.login),n=e.startsWith(`http`)||e===i.account.login?e:`${i.account.login}?returnTo=${encodeURIComponent(e)}`,a=!1;return c().then(()=>{a||r(n)},()=>{a||r(n)}),()=>{a=!0}},[c,s]),(0,f.jsx)(u,{children:(0,f.jsx)(l,{title:e(`logoutPage.title`)})})}export{p as LogoutPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bh as t,xS as n}from"./app-KRIEMzuO.js";import{d as r,i,t as a,x as o}from"./react-B9IgSVeK.js";import{Vn as s,Ya as c}from"./icons-C0wyat6T.js";import{n as l,t as u}from"./sidebar-tree-D43H3cb8.js";var d=c(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),f=e(o(),1),p=[{id:`emails`,label:`Emails`,href:n.logs.emails,icon:s},{id:`system-events`,label:`System Events`,href:n.logs.systemEvents,icon:d}],m=a();function h(){let e=t({platformHostedOnly:!0}),a=t(),{pathname:o}=r(),s=(0,f.useMemo)(()=>p.filter(t=>!(t.id===`system-events`&&e===`gated`||t.id===`emails`&&a===`gated`)),[e,a]),c=(0,f.useMemo)(()=>{let e=p.find(e=>o===e.href||o.startsWith(e.href+`/`));return e?e.label:o===n.logs.root?p[0]?.label??`Logs & Usage`:`Logs & Usage`},[o]);return(0,m.jsx)(l,{backHref:n.assistant,sidebar:(0,m.jsx)(u,{items:s,indexPath:n.logs.root}),title:c,menuRoute:n.logs.root,children:(0,m.jsx)(i,{})})}export{h as LogsLayout};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bh as t,xS as n}from"./app-BEoekemj.js";import{d as r,i,t as a,x as o}from"./react-B9IgSVeK.js";import{Vn as s,Ya as c}from"./icons-C0wyat6T.js";import{n as l,t as u}from"./sidebar-tree-CtDTchuN.js";var d=c(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),f=e(o(),1),p=[{id:`emails`,label:`Emails`,href:n.logs.emails,icon:s},{id:`system-events`,label:`System Events`,href:n.logs.systemEvents,icon:d}],m=a();function h(){let e=t({platformHostedOnly:!0}),a=t(),{pathname:o}=r(),s=(0,f.useMemo)(()=>p.filter(t=>!(t.id===`system-events`&&e===`gated`||t.id===`emails`&&a===`gated`)),[e,a]),c=(0,f.useMemo)(()=>{let e=p.find(e=>o===e.href||o.startsWith(e.href+`/`));return e?e.label:o===n.logs.root?p[0]?.label??`Logs & Usage`:`Logs & Usage`},[o]);return(0,m.jsx)(l,{backHref:n.assistant,sidebar:(0,m.jsx)(u,{items:s,indexPath:n.logs.root}),title:c,menuRoute:n.logs.root,children:(0,m.jsx)(i,{})})}export{h as LogsLayout};
@@ -0,0 +1 @@
1
+ import{fv as e,j_ as t}from"./app-BEoekemj.js";import{j as n}from"./vendor-cVd2QlFV.js";import{a as r,c as i,m as a,u as o}from"./teleport-gateway-client-BY9KVOT2.js";var s=new Set([500,502,503,504]),c=3,l=e=>new Promise(t=>setTimeout(t,e));async function u(e,t=new Set){for(let n=0;n<=c;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<c&&s.has(o)&&!t.has(o)){await l(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new o(`unknown`,`Unexpected retry loop exit`)}async function d(t,n){let r={operation:`upload`};t&&(r.min_runtime_version=t,r.max_runtime_version=null),n&&(r.consumer=n);let{status:i,data:a}=await u(()=>e.post({url:`/v1/migrations/signed-url/`,body:r,throwOnError:!1}),new Set([404,503]));if(i===503||i===404)throw new o(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(i!==201)throw new o(`export_failed`,`Migration request failed (HTTP ${i}).`);let s=a;return{url:s.url,bundleKey:s.bundle_key,expiresAt:s.expires_at}}async function f(t,n,r){let{status:i,data:s,error:c}=await u(()=>e.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:t,target_runtime_version:n,download_filename:r},throwOnError:!1}),new Set([422]));if(i===422){let e=a(c);if(e)throw new o(`version_mismatch`,e)}if(i!==200&&i!==201)throw new o(`import_failed`,`Migration request failed (HTTP ${i}).`);return s.url}async function p(e,t,n){for(let r=0;r<=c;r++){let i=await m(e,t,n);if(r<c&&s.has(i)){await l(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new o(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function m(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new o(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new o(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function h(t){let{status:n,data:r,error:i}=await u(()=>e.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:t},throwOnError:!1}));return{status:n,body:r??i??null}}async function g(t){let{status:n,data:r}=await u(()=>e.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:t},throwOnError:!1}));if(n!==200)throw new o(`import_failed`,`Job status check failed (HTTP ${n})`);let i=r??{};return{status:typeof i.status==`string`?i.status:`unknown`,jobId:typeof i.job_id==`string`?i.job_id:null,error:typeof i.error==`string`?i.error:null}}var _=5e3,v=36e5,y=e=>new Promise(t=>setTimeout(t,e));async function b(e){let n=await t(e);return n.ok?n.data.version??void 0:void 0}async function x(e,{onStep:t,pollIntervalMs:n=_,timeoutMs:i=v}={}){t?.(`preparing`);let a=await b(e),o=await d(a,`runtime`);return t?.(`exporting`),await S(e,await r(e,o.url),n,i),{bundleKey:o.bundleKey,runtimeVersion:a}}async function S(e,t,r,a){let s=Date.now();for(;Date.now()-s<a;)if(await y(r),await i(e,t)===`complete`)return;throw new o(`export_timed_out`,n(`settings:teleportCard.exportTimedOut`))}function C(e,t){let n=e.replace(/[^A-Za-z0-9._-]+/g,`-`).replace(/^[^A-Za-z0-9]+/,``).slice(0,64),r=t.toISOString().slice(0,10);return`${n||`assistant`}-${r}.vbundle`}export{f as a,g as i,x as n,d as o,h as r,p as s,C as t};
@@ -1 +1 @@
1
- import{On as e,jn as t,rr as n}from"./app-KRIEMzuO.js";import{E as r}from"./vendor-DLH51Vjf.js";import{t as i}from"./react-B9IgSVeK.js";import{t as a}from"./preview-error-B2MuMDf7.js";import{t as o}from"./use-truncated-blob-text-D6z6oSIj.js";var s=i(),c=512*1024;function l({blob:i,filename:l}){let{t:u}=r(`chat`),{text:d,truncated:f,decodeFailed:p}=o(i,c);return p?(0,s.jsx)(a,{filename:l}):d===null?(0,s.jsx)(n,{}):(0,s.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,s.jsx)(e,{content:d}),f&&(0,s.jsx)(t,{children:u(`previewTruncationNotice.markdown`)})]})}export{l as MarkdownPreview};
1
+ import{On as e,jn as t,rr as n}from"./app-BEoekemj.js";import{E as r}from"./vendor-cVd2QlFV.js";import{t as i}from"./react-B9IgSVeK.js";import{t as a}from"./preview-error-Bsw56ZjR.js";import{t as o}from"./use-truncated-blob-text-D6z6oSIj.js";var s=i(),c=512*1024;function l({blob:i,filename:l}){let{t:u}=r(`chat`),{text:d,truncated:f,decodeFailed:p}=o(i,c);return p?(0,s.jsx)(a,{filename:l}):d===null?(0,s.jsx)(n,{}):(0,s.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,s.jsx)(e,{content:d}),f&&(0,s.jsx)(t,{children:u(`previewTruncationNotice.markdown`)})]})}export{l as MarkdownPreview};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Lh as t,nr as n,rr as r}from"./app-KRIEMzuO.js";import{t as i,x as a}from"./react-B9IgSVeK.js";var o=e(a(),1),s=i(),c=`nodownload noplaybackrate`;function l({blob:e,filename:i,kind:a}){let l=n(e,(0,o.useMemo)(()=>t({sniffedMime:null,serverMime:e.type.length>0?e.type:null,filename:i}).mime,[e,i]));return l===null?(0,s.jsx)(r,{}):a===`image`?(0,s.jsx)(`div`,{className:`flex justify-center`,children:(0,s.jsx)(`img`,{src:l,alt:i,className:`h-auto max-w-full rounded-lg border border-[var(--border-element)]`})}):a===`audio`?(0,s.jsx)(`audio`,{src:l,controls:!0,controlsList:c,preload:`metadata`,"aria-label":i,className:`w-full`}):(0,s.jsx)(`video`,{src:l,controls:!0,controlsList:c,playsInline:!0,preload:`metadata`,"aria-label":i,className:`max-w-full rounded-lg border border-[var(--border-element)]`})}export{l as MediaPreview};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Lh as t,nr as n,rr as r}from"./app-BEoekemj.js";import{t as i,x as a}from"./react-B9IgSVeK.js";var o=e(a(),1),s=i(),c=`nodownload noplaybackrate`;function l({blob:e,filename:i,kind:a}){let l=n(e,(0,o.useMemo)(()=>t({sniffedMime:null,serverMime:e.type.length>0?e.type:null,filename:i}).mime,[e,i]));return l===null?(0,s.jsx)(r,{}):a===`image`?(0,s.jsx)(`div`,{className:`flex justify-center`,children:(0,s.jsx)(`img`,{src:l,alt:i,className:`h-auto max-w-full rounded-lg border border-[var(--border-element)]`})}):a===`audio`?(0,s.jsx)(`audio`,{src:l,controls:!0,controlsList:c,preload:`metadata`,"aria-label":i,className:`w-full`}):(0,s.jsx)(`video`,{src:l,controls:!0,controlsList:c,playsInline:!0,preload:`metadata`,"aria-label":i,className:`max-w-full rounded-lg border border-[var(--border-element)]`})}export{l as MediaPreview};