decocms 2.285.0 → 2.286.0

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 (231) hide show
  1. package/dist/client/assets/{AlertCircle-0nxz1rX8.js → AlertCircle-DTmaHldD.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-C2eNhBDd.js → ArrowNarrowLeft-DlPeFc4v.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-CkYTxj_S.js → CheckCircle-DJ3lme5R.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-CYzIAmcr.js → ChevronDown-DGnjAtqs.js} +1 -1
  5. package/dist/client/assets/{ChevronRight-DeEIl6Ga.js → ChevronRight-DV9No7GF.js} +1 -1
  6. package/dist/client/assets/{ChevronUp-MMJijhLH.js → ChevronUp-BkSgkwhO.js} +1 -1
  7. package/dist/client/assets/{Container-Co8nThxH.js → Container-B1nHZdmn.js} +1 -1
  8. package/dist/client/assets/DotsVertical-Bp2tW8JI.js +1 -0
  9. package/dist/client/assets/{LinkExternal01-B1CK34My.js → LinkExternal01-BBbCPDtX.js} +1 -1
  10. package/dist/client/assets/{Lock01-D0hjzmk2.js → Lock01-DpPIS3K7.js} +1 -1
  11. package/dist/client/assets/{Palette-Dk9Jb8jx.js → Palette-CI8n49a8.js} +1 -1
  12. package/dist/client/assets/{Play-BxeG5fNv.js → Play-DKFUTU3G.js} +1 -1
  13. package/dist/client/assets/{Plus-gZScqBbn.js → Plus-oXFwCrYz.js} +1 -1
  14. package/dist/client/assets/RefreshCcw01-B10mKiE2.js +1 -0
  15. package/dist/client/assets/SearchMd-BRJBvWf4.js +1 -0
  16. package/dist/client/assets/{Settings02-BF97-Fnm.js → Settings02-Dm9dFDqk.js} +1 -1
  17. package/dist/client/assets/Shield01-BZJVBd5S.js +1 -0
  18. package/dist/client/assets/{Star01-yc5vq0ru.js → Star01-_IJK5Yjt.js} +1 -1
  19. package/dist/client/assets/{Sun-B0IvK7nO.js → Sun-QqE1VnS_.js} +1 -1
  20. package/dist/client/assets/{Tool01-BtxOSAs7.js → Tool01-CKowkGsd.js} +1 -1
  21. package/dist/client/assets/{Trash01-Cv5TKLdc.js → Trash01-C6bAXG6g.js} +1 -1
  22. package/dist/client/assets/{User01-Bm0y4lC0.js → User01-C2-anwoO.js} +1 -1
  23. package/dist/client/assets/{Users03-BjqYs6sm.js → Users03-DqYvPeZM.js} +1 -1
  24. package/dist/client/assets/{X-D_cmo_DI.js → X-i9zBn6Hn.js} +1 -1
  25. package/dist/client/assets/XCircle-C1sJYG9R.js +1 -0
  26. package/dist/client/assets/XClose-BbIo6xHe.js +1 -0
  27. package/dist/client/assets/{Zap-MBVwanCx.js → Zap-KmbRMccM.js} +1 -1
  28. package/dist/client/assets/{ZapSquare-Acx_yvzd.js → ZapSquare-DT93lGV4.js} +1 -1
  29. package/dist/client/assets/{accordion-Bs6iOXfP.js → accordion-BV3tm7bj.js} +1 -1
  30. package/dist/client/assets/agent-icon-CyE6nkC1.js +1 -0
  31. package/dist/client/assets/agents-list-7o6gZt-q.js +1 -0
  32. package/dist/client/assets/ai-providers-DI3UF9nU.js +1 -0
  33. package/dist/client/assets/{alert-dialog-CGn0S0CC.js → alert-dialog-CicrCOay.js} +2 -2
  34. package/dist/client/assets/{auth-catchall-LYMGDHGY.js → auth-catchall-Cyd7fWQv.js} +1 -1
  35. package/dist/client/assets/automation-list-row-B4Vfg4UC.js +1 -0
  36. package/dist/client/assets/automations-DRM_lJom.js +1 -0
  37. package/dist/client/assets/{avatar-B4iYr4Pn.js → avatar-CF1bgUpD.js} +1 -1
  38. package/dist/client/assets/{badge-BKbfqB0P.js → badge-s_TAXGUN.js} +1 -1
  39. package/dist/client/assets/{brand-context-eZ6U4eZs.js → brand-context-iopLFZ2k.js} +1 -1
  40. package/dist/client/assets/{card-C6TLc-pg.js → card-CaekC2K0.js} +1 -1
  41. package/dist/client/assets/{chat-context-bxvplF3Z.js → chat-context-DP5UfIrn.js} +1 -1
  42. package/dist/client/assets/{checkbox-BafUZKEr.js → checkbox-DznLgPgR.js} +1 -1
  43. package/dist/client/assets/collection-detail-CTQuhG7N.js +1 -0
  44. package/dist/client/assets/collection-display-button-BgYKhoGQ.js +1 -0
  45. package/dist/client/assets/{collection-search-BSwS6tWM.js → collection-search-Bo2bOvRn.js} +1 -1
  46. package/dist/client/assets/{collection-search-_WhBw8st.js → collection-search-DMqppne6.js} +1 -1
  47. package/dist/client/assets/collection-table-wrapper-KnWZIddd.js +1 -0
  48. package/dist/client/assets/{collection-tabs-Cegi88gO.js → collection-tabs-CU6MCzSn.js} +1 -1
  49. package/dist/client/assets/{collections-CJcBtWs5.js → collections-DHmXATua.js} +1 -1
  50. package/dist/client/assets/command-D4w2xkZT.js +1 -0
  51. package/dist/client/assets/{connection-card-pbt5_GMK.js → connection-card-DBz-rrLk.js} +1 -1
  52. package/dist/client/assets/connection-detail-zHqb5ZSw.js +1 -0
  53. package/dist/client/assets/{connection-form-helpers-B-iFdAbF.js → connection-form-helpers-CBEV0IXi.js} +1 -1
  54. package/dist/client/assets/connections-CHiGbl1F.js +1 -0
  55. package/dist/client/assets/{constants-BgpFj97_.js → constants-DDHDU3PV.js} +1 -1
  56. package/dist/client/assets/{constants-Dp_2h6cY.js → constants-v4RUVkEN.js} +1 -1
  57. package/dist/client/assets/{dialog-BlDJEasr.js → dialog-C4lREl-t.js} +1 -1
  58. package/dist/client/assets/{drawer-n2769KGk.js → drawer-BTCEaGGQ.js} +1 -1
  59. package/dist/client/assets/dropdown-menu-v2GifVOh.js +1 -0
  60. package/dist/client/assets/{dynamic-plugin-layout-D7LPOea8.js → dynamic-plugin-layout-CVBBnlEt.js} +1 -1
  61. package/dist/client/assets/{empty-state-Di9idjlO.js → empty-state-BdQTFnZA.js} +1 -1
  62. package/dist/client/assets/{empty-state-CCV3q11p.js → empty-state-DdKZ_is7.js} +1 -1
  63. package/dist/client/assets/{extract-connection-data-BkZ-2zmr.js → extract-connection-data-CfXvFcGA.js} +1 -1
  64. package/dist/client/assets/{features-BnFC3Zii.js → features-fsR9zLkr.js} +1 -1
  65. package/dist/client/assets/{form-2LsJQI5E.js → form-D7DN8UcB.js} +1 -1
  66. package/dist/client/assets/general-WQbdllPl.js +1 -0
  67. package/dist/client/assets/{github-repo-picker-DnkATBdp.js → github-repo-picker-DZqLC6FL.js} +2 -2
  68. package/dist/client/assets/index-BCwsJqWc.css +1 -0
  69. package/dist/client/assets/{index-DRvZCWzg.js → index-C5AR7k1c.js} +1 -1
  70. package/dist/client/assets/{index-BqgOT0Li.js → index-CHKi_s_a.js} +1 -1
  71. package/dist/client/assets/{index-DAwDZKfR.js → index-D-RCnwJQ.js} +1 -1
  72. package/dist/client/assets/{index-DHvfV22T.js → index-D34n6J5J.js} +22 -22
  73. package/dist/client/assets/{index-BZMU1-Zz.js → index-DBclwIf_.js} +3 -3
  74. package/dist/client/assets/{index-CYT7K8Th.js → index-DnJZfbsP.js} +3 -3
  75. package/dist/client/assets/{index-D748RB59.js → index-FnxI6OGR.js} +1 -1
  76. package/dist/client/assets/{index-CWVXiaiz.js → index-e3AFJ_dX.js} +1 -1
  77. package/dist/client/assets/{index-DGbBxceU.js → index-qXZ0t4XR.js} +25 -25
  78. package/dist/client/assets/{index-BXweTbWN.js → index-zDq2Zqio.js} +1 -1
  79. package/dist/client/assets/{infiniteQueryObserver-BgQN01Hf.js → infiniteQueryObserver-1_M-sq16.js} +1 -1
  80. package/dist/client/assets/{input-CDeKOB27.js → input-urtyHxks.js} +1 -1
  81. package/dist/client/assets/{integration-icon-CI13mmaS.js → integration-icon-Cdkk9YPE.js} +1 -1
  82. package/dist/client/assets/{label-CnjZ_mJO.js → label-Bt4h_QUk.js} +1 -1
  83. package/dist/client/assets/{layout-BiEb87aZ.js → layout-B5SDe6IW.js} +1 -1
  84. package/dist/client/assets/{login-BfsLvipz.js → login-7zFMf3C1.js} +1 -1
  85. package/dist/client/assets/members-Dy7hWkQ8.js +3 -0
  86. package/dist/client/assets/{monaco-editor-CtX0YP6U.js → monaco-editor-lveN-AoO.js} +1 -1
  87. package/dist/client/assets/{monitoring-stats-row-BQ4J0Yec.js → monitoring-stats-row-D3x0_phM.js} +1 -1
  88. package/dist/client/assets/{oauth-callback-BN4EOUXR.js → oauth-callback-BJALVgfT.js} +1 -1
  89. package/dist/client/assets/{oauth-callback-ai-provider-BaqShyIl.js → oauth-callback-ai-provider-o8Hfz-wL.js} +1 -1
  90. package/dist/client/assets/{onboarding-DsfytkRm.js → onboarding-DlI3PsIA.js} +1 -1
  91. package/dist/client/assets/{org-layout-BfWUJisr.js → org-layout-DPzm8vzJ.js} +1 -1
  92. package/dist/client/assets/{org-plugin-layout-BBYslPfT.js → org-plugin-layout-DB72TzxO.js} +1 -1
  93. package/dist/client/assets/{plugin-empty-state-B5LlIWxc.js → plugin-empty-state-BzyxU1IF.js} +1 -1
  94. package/dist/client/assets/{plugin-header-Bk48Ukf6.js → plugin-header-hJH6-4Nr.js} +1 -1
  95. package/dist/client/assets/{plugin-layout-BKF_beSo.js → plugin-layout-l_MDXBYc.js} +1 -1
  96. package/dist/client/assets/{popover-xVRU-oRu.js → popover-j_PzMtdY.js} +1 -1
  97. package/dist/client/assets/{profile-D-jM1gw3.js → profile-lf_QL3Ye.js} +1 -1
  98. package/dist/client/assets/project-app-view-DuFzKNXE.js +1 -0
  99. package/dist/client/assets/registry-D3m_WKwq.js +2 -0
  100. package/dist/client/assets/{registry-layout-DnwI9vdC.js → registry-layout-DRb_iR_v.js} +3 -3
  101. package/dist/client/assets/{required-auth-layout-B1r3oQ4H.js → required-auth-layout-C2o7AZ4K.js} +1 -1
  102. package/dist/client/assets/{reset-password-DSTvsN7x.js → reset-password-DTEY3I_i.js} +1 -1
  103. package/dist/client/assets/roles-DW1_Kn6r.js +1 -0
  104. package/dist/client/assets/{scroll-area-D5mZ0hRE.js → scroll-area-BebfgLv6.js} +1 -1
  105. package/dist/client/assets/{search-input-Dq6mcRO6.js → search-input-dmuYGYsk.js} +1 -1
  106. package/dist/client/assets/{select-DVBzN73v.js → select-CePxsPeP.js} +1 -1
  107. package/dist/client/assets/{select-model-CT_wRRZk.js → select-model-QQ7yjZl9.js} +2 -2
  108. package/dist/client/assets/settings-layout-Cd1tdTnr.js +1 -0
  109. package/dist/client/assets/{shell-layout-DaX2wZ77.js → shell-layout-BE22YA40.js} +1 -1
  110. package/dist/client/assets/{skeleton-BZGew3qV.js → skeleton-C9NsUzIb.js} +1 -1
  111. package/dist/client/assets/{sso-CSm1qVA0.js → sso-QSGlyP2n.js} +1 -1
  112. package/dist/client/assets/{store-BLxzwqyY.js → store-BB9yi6PD.js} +1 -1
  113. package/dist/client/assets/store-registry-BSp-W72J.js +2 -0
  114. package/dist/client/assets/{switch-DhZAgC2R.js → switch-VBeL01bM.js} +1 -1
  115. package/dist/client/assets/{table-PpA3iGsP.js → table-CQMW-Toa.js} +1 -1
  116. package/dist/client/assets/{tabs-CqvMN_xV.js → tabs-DOoLL5wa.js} +1 -1
  117. package/dist/client/assets/{task-status-fLMf5O9c.js → task-status-vvRP86lz.js} +7 -7
  118. package/dist/client/assets/{textarea-8UV3LDMX.js → textarea-Ie4QUdo5.js} +1 -1
  119. package/dist/client/assets/{toggle-group-Brc7WatS.js → toggle-group-C077Smww.js} +1 -1
  120. package/dist/client/assets/tools-list-UnPsMGhr.js +1 -0
  121. package/dist/client/assets/{types-C318llZ2.js → types-D4PfKOFF.js} +1 -1
  122. package/dist/client/assets/{use-ai-providers-Do6DYo3A.js → use-ai-providers-DHuVj1kn.js} +1 -1
  123. package/dist/client/assets/{use-collections-B6b08eGL.js → use-collections-DRlHpXQL.js} +1 -1
  124. package/dist/client/assets/{use-connection-B4n7P5ZX.js → use-connection-Cif-LY0f.js} +1 -1
  125. package/dist/client/assets/{use-copy-D_fZmQan.js → use-copy-uiSuMvtc.js} +1 -1
  126. package/dist/client/assets/{use-create-virtual-mcp-jrLS8Jsa.js → use-create-virtual-mcp-CBpw3zXA.js} +1 -1
  127. package/dist/client/assets/{use-decopilot-events-BaTABZmJ.js → use-decopilot-events-Dpt6CcIN.js} +1 -1
  128. package/dist/client/assets/{use-delete-connection-CRBBtM2M.js → use-delete-connection-BZmW9ZAz.js} +1 -1
  129. package/dist/client/assets/{use-infinite-scroll-E-ClEQ_w.js → use-infinite-scroll-CWlV3gJA.js} +1 -1
  130. package/dist/client/assets/{use-list-state-DueB6o1G.js → use-list-state-BJZWeXjY.js} +1 -1
  131. package/dist/client/assets/{use-mcp-tools-BGEi8TMH.js → use-mcp-tools-BYVtg7WH.js} +1 -1
  132. package/dist/client/assets/{use-members-C-n0fYdD.js → use-members-M_p47epa.js} +1 -1
  133. package/dist/client/assets/{use-mobile-DHF6z3l-.js → use-mobile-CxvYCzu9.js} +1 -1
  134. package/dist/client/assets/{use-navigate-to-agent-CVVCVmb_.js → use-navigate-to-agent-CFIKBq0L.js} +1 -1
  135. package/dist/client/assets/{use-org-sso-CVSlB5eM.js → use-org-sso-CACnH9GQ.js} +1 -1
  136. package/dist/client/assets/use-organization-roles-o4lVU0iD.js +1 -0
  137. package/dist/client/assets/{use-organization-settings-hZWDePgg.js → use-organization-settings-BD9CIHH5.js} +1 -1
  138. package/dist/client/assets/{use-registry-connections-DE87auCx.js → use-registry-connections-DR_etJ2H.js} +1 -1
  139. package/dist/client/assets/{use-status-sounds-DmiUFixH.js → use-status-sounds-Ce7WandB.js} +1 -1
  140. package/dist/client/assets/{use-tasks-BtKmvszc.js → use-tasks-Dpp1DK1f.js} +1 -1
  141. package/dist/client/assets/{use-view-mode-C4RBFxYO.js → use-view-mode-CZPzVaxj.js} +1 -1
  142. package/dist/client/assets/{use-virtual-mcp-ByUoWLLO.js → use-virtual-mcp-0vHwLInn.js} +1 -1
  143. package/dist/client/assets/useInfiniteQuery-B4w-6TrV.js +1 -0
  144. package/dist/client/assets/useSuspenseInfiniteQuery-WURyRq6p.js +1 -0
  145. package/dist/client/assets/{user-xlREBAPA.js → user-xj80BAo3.js} +1 -1
  146. package/dist/client/assets/{view-mode-toggle-DhKikjfW.js → view-mode-toggle-D5CGwPOj.js} +1 -1
  147. package/dist/client/assets/workflow-CD_DiE5j.js +1 -0
  148. package/dist/client/assets/workflow-detail-CxWEb-ID.js +1 -0
  149. package/dist/client/index.html +2 -2
  150. package/dist/server/cli.js +2 -2
  151. package/dist/server/node_modules/{postgres-bytea/license → pg/LICENSE} +6 -6
  152. package/dist/server/node_modules/pg/README.md +95 -0
  153. package/dist/server/node_modules/pg/esm/index.mjs +20 -0
  154. package/dist/server/node_modules/pg/lib/client.js +743 -0
  155. package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
  156. package/dist/server/node_modules/pg/lib/connection.js +221 -0
  157. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
  158. package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  159. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  160. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
  161. package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
  162. package/dist/server/node_modules/pg/lib/defaults.js +91 -0
  163. package/dist/server/node_modules/pg/lib/index.js +73 -0
  164. package/dist/server/node_modules/pg/lib/native/client.js +323 -0
  165. package/dist/server/node_modules/pg/lib/native/index.js +2 -0
  166. package/dist/server/node_modules/pg/lib/native/query.js +165 -0
  167. package/dist/server/node_modules/pg/lib/query.js +252 -0
  168. package/dist/server/node_modules/pg/lib/result.js +109 -0
  169. package/dist/server/node_modules/pg/lib/stream.js +83 -0
  170. package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
  171. package/dist/server/node_modules/pg/lib/utils.js +217 -0
  172. package/dist/server/node_modules/pg/package.json +76 -0
  173. package/dist/server/server.js +1 -1
  174. package/package.json +1 -1
  175. package/dist/client/assets/SearchMd-DmmmzJIi.js +0 -1
  176. package/dist/client/assets/XCircle-DofWfDB_.js +0 -1
  177. package/dist/client/assets/agent-icon-B4FOoeEp.js +0 -1
  178. package/dist/client/assets/agents-list-CCDumukV.js +0 -1
  179. package/dist/client/assets/ai-providers-DmtetLwH.js +0 -1
  180. package/dist/client/assets/automation-list-row-CKWNl7Xx.js +0 -1
  181. package/dist/client/assets/automations-t-caERGV.js +0 -1
  182. package/dist/client/assets/collection-detail-I5bQPS94.js +0 -1
  183. package/dist/client/assets/collection-display-button-D58wr6x3.js +0 -1
  184. package/dist/client/assets/collection-table-wrapper-DoehWRok.js +0 -1
  185. package/dist/client/assets/command-BDTuhAyF.js +0 -1
  186. package/dist/client/assets/connection-detail-CpUnSGYQ.js +0 -1
  187. package/dist/client/assets/connections-COVM3fme.js +0 -1
  188. package/dist/client/assets/dropdown-menu-DwLxT3z1.js +0 -1
  189. package/dist/client/assets/general-gsvbF_Za.js +0 -1
  190. package/dist/client/assets/index-DeSgX7LP.css +0 -1
  191. package/dist/client/assets/members-COWr_hPe.js +0 -3
  192. package/dist/client/assets/project-app-view-CjbRHagh.js +0 -1
  193. package/dist/client/assets/registry-iJ2QFmg-.js +0 -2
  194. package/dist/client/assets/settings-layout-D70kmFKJ.js +0 -1
  195. package/dist/client/assets/store-registry-BdrjcFsM.js +0 -2
  196. package/dist/client/assets/tools-list-BbeD_D_r.js +0 -1
  197. package/dist/client/assets/useInfiniteQuery-m9L0mxCO.js +0 -1
  198. package/dist/client/assets/workflow-Z523A-0v.js +0 -1
  199. package/dist/client/assets/workflow-detail-CLjOJ-4m.js +0 -1
  200. package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
  201. package/dist/server/node_modules/mimic-fn/index.js +0 -13
  202. package/dist/server/node_modules/mimic-fn/license +0 -9
  203. package/dist/server/node_modules/mimic-fn/package.json +0 -42
  204. package/dist/server/node_modules/mimic-fn/readme.md +0 -69
  205. package/dist/server/node_modules/pg-int8/LICENSE +0 -13
  206. package/dist/server/node_modules/pg-int8/README.md +0 -16
  207. package/dist/server/node_modules/pg-int8/index.js +0 -100
  208. package/dist/server/node_modules/pg-int8/package.json +0 -24
  209. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  210. package/dist/server/node_modules/postgres-array/index.js +0 -97
  211. package/dist/server/node_modules/postgres-array/license +0 -21
  212. package/dist/server/node_modules/postgres-array/package.json +0 -35
  213. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  214. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  215. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  216. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  217. package/dist/server/node_modules/postgres-date/index.js +0 -116
  218. package/dist/server/node_modules/postgres-date/license +0 -21
  219. package/dist/server/node_modules/postgres-date/package.json +0 -33
  220. package/dist/server/node_modules/postgres-date/readme.md +0 -49
  221. package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
  222. package/dist/server/node_modules/postgres-interval/index.js +0 -125
  223. package/dist/server/node_modules/postgres-interval/license +0 -21
  224. package/dist/server/node_modules/postgres-interval/package.json +0 -36
  225. package/dist/server/node_modules/postgres-interval/readme.md +0 -48
  226. package/dist/server/node_modules/split2/LICENSE +0 -13
  227. package/dist/server/node_modules/split2/README.md +0 -85
  228. package/dist/server/node_modules/split2/bench.js +0 -27
  229. package/dist/server/node_modules/split2/index.js +0 -141
  230. package/dist/server/node_modules/split2/package.json +0 -39
  231. package/dist/server/node_modules/split2/test.js +0 -409
@@ -1 +0,0 @@
1
- import{e as xe,C as ke,j as s,B as fe,s as ye,r as P,t as w,z as Ae}from"./index-DHvfV22T.js";import{D as U,e as _e,d as pe,c as ue}from"./dropdown-menu-DwLxT3z1.js";import{a as we}from"./Users03-BjqYs6sm.js";import{b as Pe,G as Te,I as Me,S as Oe,L as ze,a as Le}from"./github-repo-picker-DnkATBdp.js";import{W as Ie,a as Ee}from"./constants-BgpFj97_.js";import{u as Ge,b as Be}from"./use-virtual-mcp-ByUoWLLO.js";import{P as re}from"./index-BXweTbWN.js";import{h as He}from"./XCircle-DofWfDB_.js";import{a as $e}from"./Settings02-BF97-Fnm.js";import{s as Re}from"./Trash01-Cv5TKLdc.js";import{A as Ce,ao as Fe}from"./agent-icon-B4FOoeEp.js";import{u as ve}from"./use-navigate-to-agent-CVVCVmb_.js";import{C as Ne}from"./card-C6TLc-pg.js";import{f as Ve}from"./formatDistanceToNow-Cb2QZZJn.js";import{E as We}from"./empty-state-Di9idjlO.js";import{u as Ke}from"./use-create-virtual-mcp-jrLS8Jsa.js";import{c as qe,b as Je,d as Qe,A as Ue,e as Xe,g as Ye,a as Ze,f as et}from"./alert-dialog-CGn0S0CC.js";import{S as tt}from"./search-input-Dq6mcRO6.js";import{s as he}from"./Plus-gZScqBbn.js";import"./ChevronDown-CYzIAmcr.js";import"./ChevronRight-DeEIl6Ga.js";import"./dialog-BlDJEasr.js";import"./X-D_cmo_DI.js";import"./SearchMd-DmmmzJIi.js";import"./collection-search-BSwS6tWM.js";import"./drawer-n2769KGk.js";import"./use-mobile-DHF6z3l-.js";import"./integration-icon-CI13mmaS.js";import"./Container-Co8nThxH.js";import"./use-connection-B4n7P5ZX.js";import"./use-collections-B6b08eGL.js";import"./use-mcp-tools-BGEi8TMH.js";import"./checkbox-BafUZKEr.js";import"./Lock01-D0hjzmk2.js";import"./extract-connection-data-BkZ-2zmr.js";import"./constants-Dp_2h6cY.js";import"./collections-CJcBtWs5.js";import"./AlertCircle-0nxz1rX8.js";import"./Tool01-BtxOSAs7.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./ZapSquare-Acx_yvzd.js";import"./CheckCircle-CkYTxj_S.js";import"./ChevronUp-MMJijhLH.js";import"./Star01-yc5vq0ru.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Sun-B0IvK7nO.js";import"./Play-BxeG5fNv.js";import"./User01-Bm0y4lC0.js";import"./Zap-MBVwanCx.js";import"./differenceInSeconds-NQ4PDo0z.js";function je(e){const t=xe.c(17),{onCreateFromScratch:i,onImportGitHub:g,onImportDeco:m,isCreating:o,align:j,side:f,showBetaBadge:p}=e,r=j===void 0?"end":j,[n]=ke();let u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(we,{size:14}),t[0]=u):u=t[0];let c;t[1]!==o||t[2]!==i?(c=s.jsxs(U,{disabled:o,onClick:i,children:[u,"Create from scratch"]}),t[1]=o,t[2]=i,t[3]=c):c=t[3];let a;t[4]!==g||t[5]!==n.experimental_vibecode||t[6]!==p?(a=n.experimental_vibecode&&s.jsxs(U,{onClick:g,children:[s.jsx(Pe,{className:"size-3.5"}),"Import from GitHub",p&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"})]}),t[4]=g,t[5]=n.experimental_vibecode,t[6]=p,t[7]=a):a=t[7];let x;t[8]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),t[8]=x):x=t[8];let d;t[9]!==m?(d=s.jsxs(U,{onClick:m,children:[x,"Import from deco.cx"]}),t[9]=m,t[10]=d):d=t[10];let _;return t[11]!==r||t[12]!==f||t[13]!==c||t[14]!==a||t[15]!==d?(_=s.jsxs(_e,{side:f,align:r,className:"w-48",children:[c,a,d]}),t[11]=r,t[12]=f,t[13]=c,t[14]=a,t[15]=d,t[16]=_):_=t[16],_}function st(e){const t=xe.c(44),{project:i,onDeleteClick:g}=e,m=ve();let o;t[0]!==m||t[1]!==i.id?(o=()=>m(i.id),t[0]=m,t[1]=i.id,t[2]=o):o=t[2];let j;t[3]!==i.title||t[4]!==o?(j=s.jsx("button",{type:"button",onClick:o,className:"absolute inset-0 z-0","aria-label":i.title}),t[3]=i.title,t[4]=o,t[5]=j):j=t[5];let f;t[6]!==i.icon||t[7]!==i.title?(f=s.jsx(Ce,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),t[6]=i.icon,t[7]=i.title,t[8]=f):f=t[8];let p;t[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(pe,{asChild:!0,children:s.jsx(fe,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(He,{size:20})})}),t[9]=p):p=t[9];let r;t[10]!==m||t[11]!==i.id?(r=()=>m(i.id,{search:{main:"settings"}}),t[10]=m,t[11]=i.id,t[12]=r):r=t[12];let n;t[13]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx($e,{size:16}),t[13]=n):n=t[13];let u;t[14]!==r?(u=s.jsxs(U,{onClick:r,children:[n,"Settings"]}),t[14]=r,t[15]=u):u=t[15];let c;t[16]!==g?(c=g&&s.jsxs(U,{variant:"destructive",onClick:k=>{k.stopPropagation(),g(k)},children:[s.jsx(Re,{size:16}),"Delete"]}),t[16]=g,t[17]=c):c=t[17];let a;t[18]!==u||t[19]!==c?(a=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(ue,{children:[p,s.jsxs(_e,{align:"end",children:[u,c]})]})}),t[18]=u,t[19]=c,t[20]=a):a=t[20];let x;t[21]!==f||t[22]!==a?(x=s.jsxs("div",{className:"flex items-start justify-between",children:[f,a]}),t[21]=f,t[22]=a,t[23]=x):x=t[23];let d;t[24]!==i.title?(d=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),t[24]=i.title,t[25]=d):d=t[25];const _=i.description||"No description";let b;t[26]!==_?(b=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:_}),t[26]=_,t[27]=b):b=t[27];let v;t[28]!==d||t[29]!==b?(v=s.jsxs("div",{className:"flex flex-col gap-1",children:[d,b]}),t[28]=d,t[29]=b,t[30]=v):v=t[30];let D;t[31]!==x||t[32]!==v?(D=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,v]}),t[31]=x,t[32]=v,t[33]=D):D=t[33];let N;t[34]!==i.updated_at?(N=Ve(new Date(i.updated_at),{addSuffix:!0}),t[34]=i.updated_at,t[35]=N):N=t[35];let S;t[36]!==N?(S=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:N})})}),t[36]=N,t[37]=S):S=t[37];let h;t[38]!==D||t[39]!==S?(h=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[D,S]}),t[38]=D,t[39]=S,t[40]=h):h=t[40];let C;return t[41]!==h||t[42]!==j?(C=s.jsxs(Ne,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[j,h]}),t[41]=h,t[42]=j,t[43]=C):C=t[43],C}function is(){const e=xe.c(79),{org:t}=ye(),i=Ge(),g=Be(),m=ve(),[o,j]=P.useState("");let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},e[0]=f):f=e[0];const{createVirtualMCP:p,isCreating:r}=Ke(f),[n,u]=P.useState(null),[c,a]=P.useState(!1),[x,d]=P.useState(!1),[_,b]=P.useState(!1),[v,D]=P.useState(!1),[N,S]=P.useState(!1);let h,C,k,T,y,A,M,O,z;if(e[1]!==g||e[2]!==i||e[3]!==p||e[4]!==n||e[5]!==r||e[6]!==m||e[7]!==t||e[8]!==o){const Q=o.toLowerCase(),de=i.filter(l=>l.id!==t.id&&(l.title.toLowerCase().includes(Q)||l.description?.toLowerCase().includes(Q)));let te;e[18]!==i?(te=i.some(ot),e[18]=i,e[19]=te):te=e[19];const be=te,me=Ie.filter(l=>(!o||l.title.toLowerCase().includes(Q))&&!(l.id==="studio-pack"&&be)),ge=i.find(lt);y=i.find(it);const De=l=>{w("agents_list_template_clicked",{template_id:l}),l==="site-editor"?a(!0):l==="site-diagnostics"?ge?m(ge.id):b(!0):l==="lean-canvas"?y?m(y.id):S(!0):l==="studio-pack"&&D(!0)};let se;e[20]!==g||e[21]!==n?(se=async()=>{if(!n)return;const{id:l,title:Se}=n;u(null);try{await g.delete.mutateAsync(l),w("agent_deleted",{agent_id:l,source:"agents_list"}),Ae.success(`Deleted "${Se}"`)}catch{}},e[20]=g,e[21]=n,e[22]=se):se=e[22],T=se,k=re,C=re.Content,h=re.Body;let ie;e[23]===Symbol.for("react.memo_cache_sentinel")?(ie=s.jsx(pe,{asChild:!0,children:s.jsxs(fe,{size:"sm",children:[s.jsx(he,{size:14}),"Create Agent"]})}),e[23]=ie):ie=e[23];let K;e[24]!==p?(K=()=>{w("agent_create_clicked",{source:"agents_list",method:"scratch"}),p()},e[24]=p,e[25]=K):K=e[25];let le,oe;e[26]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>{w("agent_create_clicked",{source:"agents_list",method:"github"}),d(!0)},le=()=>{w("agent_create_clicked",{source:"agents_list",method:"deco"}),a(!0)},e[26]=le,e[27]=oe):(le=e[26],oe=e[27]);let q;e[28]!==r||e[29]!==K?(q=s.jsx(re.Title,{actions:s.jsxs(ue,{children:[ie,s.jsx(je,{onCreateFromScratch:K,onImportGitHub:oe,onImportDeco:le,isCreating:r,align:"end"})]}),children:"Agents"}),e[28]=r,e[29]=K,e[30]=q):q=e[30];let ae;e[31]===Symbol.for("react.memo_cache_sentinel")?(ae=l=>{l.key==="Escape"&&(j(""),l.target.blur())},e[31]=ae):ae=e[31];let J;e[32]!==o?(J=s.jsx(tt,{value:o,onChange:j,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:ae}),e[32]=o,e[33]=J):J=e[33],e[34]!==q||e[35]!==J?(A=s.jsxs("div",{className:"flex flex-col gap-6",children:[q,J]}),e[34]=q,e[35]=J,e[36]=A):A=e[36],M=de.length===0&&me.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(We,{image:s.jsx(Fe,{size:48,className:"text-muted-foreground"}),title:o?"No agents found":"No agents yet",description:o?`No agents match "${o}"`:"Create an agent to get started.",actions:!o&&s.jsxs(ue,{children:[s.jsx(pe,{asChild:!0,children:s.jsxs(fe,{size:"sm",children:[s.jsx(he,{size:14}),"Create Agent"]})}),s.jsx(je,{onCreateFromScratch:()=>{w("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),p()},onImportGitHub:()=>{w("agent_create_clicked",{source:"agents_list_empty",method:"github"}),d(!0)},onImportDeco:()=>{w("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),a(!0)},isCreating:r,align:"center",showBetaBadge:!0})]})})}),O=de.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:de.map(l=>s.jsx(st,{project:l,onDeleteClick:()=>u({id:l.id,title:l.title})},l.id))})]}),z=me.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agent Templates"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:me.map(l=>s.jsx(Ne,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50 cursor-pointer",onClick:()=>De(l.id),children:s.jsx("div",{className:"flex flex-col flex-1",children:s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[s.jsx(Ce,{icon:l.icon,name:l.title,size:"sm",className:"shrink-0 shadow-sm"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:l.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to set up"})]})]})})},l.id))})]}),e[1]=g,e[2]=i,e[3]=p,e[4]=n,e[5]=r,e[6]=m,e[7]=t,e[8]=o,e[9]=h,e[10]=C,e[11]=k,e[12]=T,e[13]=y,e[14]=A,e[15]=M,e[16]=O,e[17]=z}else h=e[9],C=e[10],k=e[11],T=e[12],y=e[13],A=e[14],M=e[15],O=e[16],z=e[17];let L;e[37]!==h||e[38]!==A||e[39]!==M||e[40]!==O||e[41]!==z?(L=s.jsxs(h,{children:[A,M,O,z]}),e[37]=h,e[38]=A,e[39]=M,e[40]=O,e[41]=z,e[42]=L):L=e[42];let I;e[43]!==C||e[44]!==L?(I=s.jsx(C,{children:L}),e[43]=C,e[44]=L,e[45]=I):I=e[45];let E;e[46]!==x?(E=s.jsx(Te,{open:x,onOpenChange:d}),e[46]=x,e[47]=E):E=e[47];let G;e[48]!==c?(G=s.jsx(Me,{open:c,onOpenChange:a}),e[48]=c,e[49]=G):G=e[49];let B;e[50]!==_?(B=s.jsx(Oe,{open:_,onOpenChange:b}),e[50]=_,e[51]=B):B=e[51];let H;e[52]!==y||e[53]!==N?(H=s.jsx(ze,{open:N,onOpenChange:S,existingAgent:y}),e[52]=y,e[53]=N,e[54]=H):H=e[54];let $;e[55]!==v?($=s.jsx(Le,{open:v,onOpenChange:D}),e[55]=v,e[56]=$):$=e[56];const ne=!!n;let X;e[57]===Symbol.for("react.memo_cache_sentinel")?(X=Q=>!Q&&u(null),e[57]=X):X=e[57];let Y;e[58]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(qe,{children:"Delete Agent?"}),e[58]=Y):Y=e[58];const ce=n?.title;let R;e[59]!==ce?(R=s.jsxs(Je,{children:[Y,s.jsxs(Qe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:ce}),"."]})]}),e[59]=ce,e[60]=R):R=e[60];let Z;e[61]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx(Ue,{children:"Cancel"}),e[61]=Z):Z=e[61];let F;e[62]!==T?(F=s.jsxs(Xe,{children:[Z,s.jsx(Ye,{onClick:T,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[62]=T,e[63]=F):F=e[63];let V;e[64]!==R||e[65]!==F?(V=s.jsxs(Ze,{children:[R,F]}),e[64]=R,e[65]=F,e[66]=V):V=e[66];let W;e[67]!==ne||e[68]!==V?(W=s.jsx(et,{open:ne,onOpenChange:X,children:V}),e[67]=ne,e[68]=V,e[69]=W):W=e[69];let ee;return e[70]!==k||e[71]!==H||e[72]!==$||e[73]!==W||e[74]!==I||e[75]!==E||e[76]!==G||e[77]!==B?(ee=s.jsxs(k,{children:[I,E,G,B,H,$,W]}),e[70]=k,e[71]=H,e[72]=$,e[73]=W,e[74]=I,e[75]=E,e[76]=G,e[77]=B,e[78]=ee):ee=e[78],ee}function it(e){return e.metadata?.type==="lean-canvas"}function lt(e){return e.metadata?.type==="site-diagnostics"}function ot(e){return Ee(e.id)}export{is as default};
@@ -1 +0,0 @@
1
- import{e as t,j as i}from"./index-DHvfV22T.js";import{O as m}from"./select-model-CT_wRRZk.js";import"./checkbox-BafUZKEr.js";import"./ChevronDown-CYzIAmcr.js";import"./input-CDeKOB27.js";import"./dialog-BlDJEasr.js";import"./X-D_cmo_DI.js";import"./drawer-n2769KGk.js";import"./use-mobile-DHF6z3l-.js";import"./select-DVBzN73v.js";import"./ChevronUp-MMJijhLH.js";import"./skeleton-BZGew3qV.js";import"./Tool01-BtxOSAs7.js";import"./SearchMd-DmmmzJIi.js";import"./Settings02-BF97-Fnm.js";import"./use-ai-providers-Do6DYo3A.js";import"./constants-BgpFj97_.js";import"./chat-context-bxvplF3Z.js";import"./use-virtual-mcp-ByUoWLLO.js";import"./use-collections-B6b08eGL.js";import"./use-decopilot-events-BaTABZmJ.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-tasks-BtKmvszc.js";import"./use-organization-settings-hZWDePgg.js";import"./ai-providers-logos-CS4PCiqI.js";import"./Zap-MBVwanCx.js";import"./AlertCircle-0nxz1rX8.js";import"./CheckCircle-CkYTxj_S.js";import"./Trash01-Cv5TKLdc.js";import"./index-BXweTbWN.js";import"./card-C6TLc-pg.js";import"./switch-DhZAgC2R.js";import"./toggle-group-Brc7WatS.js";import"./avatar-B4iYr4Pn.js";import"./User01-Bm0y4lC0.js";import"./alert-dialog-CGn0S0CC.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./unwrap-tool-result-BYXdCQMg.js";function M(){const o=t.c(1);let r;return o[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(m,{}),o[0]=r):r=o[0],r}export{M as default};
@@ -1 +0,0 @@
1
- import{e as P,s as q,K as k,n as G,o as U,a as K,z as L,r as M,c as Q,j as o,B}from"./index-DHvfV22T.js";import{b as V,d as H,e as Y,g as J,c as W,A as X,a as Z,f as ee}from"./alert-dialog-CGn0S0CC.js";import{d as te,c as ne,e as se,D as ie}from"./dropdown-menu-DwLxT3z1.js";import{A as oe,Q as re}from"./agent-icon-B4FOoeEp.js";import{h as ae}from"./XCircle-DofWfDB_.js";import{s as le}from"./Trash01-Cv5TKLdc.js";import{i as ce}from"./Zap-MBVwanCx.js";import{a as ue}from"./use-virtual-mcp-ByUoWLLO.js";import{S as $,u as z}from"./constants-BgpFj97_.js";function me(t){if(t.paramsSchema&&typeof t.paramsSchema=="object")return t;const e={};if(Array.isArray(t.params))for(const n of t.params)e[n.name]={type:n.type,description:n.description,enum:n.enum};else t.params&&typeof t.params=="object"&&Object.assign(e,t.params);return{type:t.type,description:t.description,paramsSchema:e}}function Ee(t){const e=P.c(11),{org:n}=q(),s=t??$;let r;e[0]!==n.id||e[1]!==s?(r={connectionId:s,orgId:n.id},e[0]=n.id,e[1]=s,e[2]=r):r=e[2];const a=z(r);let i;e[3]!==t?(i=k.toolCall(t??"","TRIGGER_LIST",""),e[3]=t,e[4]=i):i=e[4];let u;e[5]!==a?(u=async()=>{const f=await a.callTool({name:"TRIGGER_LIST",arguments:{}});return(f.structuredContent??f).triggers.map(me)},e[5]=a,e[6]=u):u=e[6];const l=!!t;let d;return e[7]!==i||e[8]!==u||e[9]!==l?(d={queryKey:i,queryFn:u,enabled:l,staleTime:3e4},e[7]=i,e[8]=u,e[9]=l,e[10]=d):d=e[10],G(d)}function Se(t){const e=P.c(11),{org:n}=q();let s;e[0]!==n.id?(s={connectionId:$,orgId:n.id},e[0]=n.id,e[1]=s):s=e[1];const r=z(s);let a;e[2]!==n.id||e[3]!==t?(a=k.automations(n.id,t),e[2]=n.id,e[3]=t,e[4]=a):a=e[4];let i;e[5]!==r||e[6]!==t?(i=async()=>{const l=t!=null?{virtual_mcp_id:t}:{},d=await r.callTool({name:"AUTOMATION_LIST",arguments:l});return(d.structuredContent??d).automations},e[5]=r,e[6]=t,e[7]=i):i=e[7];let u;return e[8]!==a||e[9]!==i?(u={queryKey:a,queryFn:i,staleTime:1e4},e[8]=a,e[9]=i,e[10]=u):u=e[10],G(u)}function Oe(t){const e=P.c(12),{org:n}=q();let s;e[0]!==n.id?(s={connectionId:$,orgId:n.id},e[0]=n.id,e[1]=s):s=e[1];const r=z(s);let a;e[2]!==t||e[3]!==n.id?(a=k.automation(n.id,t),e[2]=t,e[3]=n.id,e[4]=a):a=e[4];let i;e[5]!==r||e[6]!==t?(i=async()=>{const d=await r.callTool({name:"AUTOMATION_GET",arguments:{id:t}});return(d.structuredContent??d).automation},e[5]=r,e[6]=t,e[7]=i):i=e[7];const u=!!t;let l;return e[8]!==a||e[9]!==i||e[10]!==u?(l={queryKey:a,queryFn:i,enabled:u,staleTime:1e4},e[8]=a,e[9]=i,e[10]=u,e[11]=l):l=e[11],G(l)}function we(t){return{name:"New Automation",agent:t?{id:t}:void 0,messages:[],models:{credentialId:"",thinking:{id:""}},temperature:.5,active:!0,virtual_mcp_id:t}}function de(){const t=P.c(54),{org:e}=q();let n;t[0]!==e.id?(n={connectionId:$,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const s=z(n),r=U();let a;t[2]!==e.id||t[3]!==r?(a=()=>r.invalidateQueries({queryKey:k.automationsAll(e.id)}),t[2]=e.id,t[3]=r,t[4]=a):a=t[4];const i=a;let u;t[5]!==e.id||t[6]!==r?(u=m=>r.invalidateQueries({queryKey:k.automation(e.id,m)}),t[5]=e.id,t[6]=r,t[7]=u):u=t[7];const l=u;let d;t[8]!==s?(d=async m=>{const c=await s.callTool({name:"AUTOMATION_CREATE",arguments:m});return c.structuredContent??c},t[8]=s,t[9]=d):d=t[9];let f;t[10]!==i?(f=()=>{i()},t[10]=i,t[11]=f):f=t[11];let b;t[12]!==d||t[13]!==f?(b={mutationFn:d,onSuccess:f,onError:pe},t[12]=d,t[13]=f,t[14]=b):b=t[14];const F=K(b);let D;t[15]!==s?(D=async m=>{const c=await s.callTool({name:"AUTOMATION_UPDATE",arguments:m});return c.structuredContent??c},t[15]=s,t[16]=D):D=t[16];let g;t[17]!==i||t[18]!==l?(g=(m,c)=>{i(),typeof c.id=="string"&&l(c.id)},t[17]=i,t[18]=l,t[19]=g):g=t[19];let S;t[20]!==D||t[21]!==g?(S={mutationFn:D,onSuccess:g,onError:ge},t[20]=D,t[21]=g,t[22]=S):S=t[22];const N=K(S);let p;t[23]!==s?(p=async m=>{const c=await s.callTool({name:"AUTOMATION_DELETE",arguments:{id:m}});return c.structuredContent??c},t[23]=s,t[24]=p):p=t[24];let x;t[25]!==i||t[26]!==e.id||t[27]!==r?(x=(m,c)=>{r.removeQueries({queryKey:k.automation(e.id,c)}),i()},t[25]=i,t[26]=e.id,t[27]=r,t[28]=x):x=t[28];let A;t[29]!==x||t[30]!==p?(A={mutationFn:p,onSuccess:x,onError:fe},t[29]=x,t[30]=p,t[31]=A):A=t[31];const v=K(A);let _;t[32]!==s?(_=async m=>{const c=await s.callTool({name:"AUTOMATION_TRIGGER_ADD",arguments:m});if(c.isError){const I=c.content?.[0]?.text??"Failed to add trigger";throw new Error(I)}return c.structuredContent??c},t[32]=s,t[33]=_):_=t[33];let y;t[34]!==i||t[35]!==l?(y=m=>{i(),l(m.automation_id)},t[34]=i,t[35]=l,t[36]=y):y=t[36];let E;t[37]!==_||t[38]!==y?(E={mutationFn:_,onSuccess:y},t[37]=_,t[38]=y,t[39]=E):E=t[39];const O=K(E);let h;t[40]!==s?(h=async m=>{const c=await s.callTool({name:"AUTOMATION_TRIGGER_REMOVE",arguments:{trigger_id:m.trigger_id}});return c.structuredContent??c},t[40]=s,t[41]=h):h=t[41];let T;t[42]!==i||t[43]!==l?(T=(m,c)=>{i(),l(c.automation_id)},t[42]=i,t[43]=l,t[44]=T):T=t[44];let j;t[45]!==h||t[46]!==T?(j={mutationFn:h,onSuccess:T},t[45]=h,t[46]=T,t[47]=j):j=t[47];const w=K(j);let C;return t[48]!==F||t[49]!==v||t[50]!==O||t[51]!==w||t[52]!==N?(C={create:F,update:N,remove:v,triggerAdd:O,triggerRemove:w},t[48]=F,t[49]=v,t[50]=O,t[51]=w,t[52]=N,t[53]=C):C=t[53],C}function fe(t){L.error(t instanceof Error?t.message:"Failed to delete automation")}function ge(t){L.error(t instanceof Error?t.message:"Failed to update automation")}function pe(t){L.error(t instanceof Error?t.message:"Failed to create automation")}function Fe(t){const e=P.c(51),{automation:n,showAgent:s,onClick:r}=t,{remove:a}=de(),[i,u]=M.useState(!1),l=ue(s?n.agent?.id??void 0:void 0);let d;e[0]!==n.id||e[1]!==a?(d=()=>{a.mutate(n.id),u(!1)},e[0]=n.id,e[1]=a,e[2]=d):d=e[2];const f=d;let b;e[3]!==r?(b=R=>{R.target===R.currentTarget&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),r())},e[3]=r,e[4]=b):b=e[4];const F=b,D=n.active&&n.trigger_count>0?"bg-emerald-500":"bg-muted-foreground/40";let g;e[5]!==D?(g=Q("inline-block size-2 rounded-full shrink-0",D),e[5]=D,e[6]=g):g=e[6];const S=n.active&&n.trigger_count>0?"Active":n.active?"No triggers configured":"Paused";let N;e[7]!==g||e[8]!==S?(N=o.jsx("span",{className:g,"aria-label":S}),e[7]=g,e[8]=S,e[9]=N):N=e[9];let p;e[10]!==l||e[11]!==s?(p=s&&l&&o.jsx(oe,{icon:l.icon??null,name:l.title,size:"xs",className:"shrink-0"}),e[10]=l,e[11]=s,e[12]=p):p=e[12];let x;e[13]!==n.name?(x=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.name}),e[13]=n.name,e[14]=x):x=e[14];let A;e[15]!==l||e[16]!==s?(A=s&&l&&o.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["· ",l.title]}),e[15]=l,e[16]=s,e[17]=A):A=e[17];let v;e[18]!==x||e[19]!==A?(v=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[x,A]}),e[18]=x,e[19]=A,e[20]=v):v=e[20];let _;e[21]!==n.nearest_next_run_at||e[22]!==n.trigger_count?(_=o.jsx(ye,{triggerCount:n.trigger_count,nextRunAt:n.nearest_next_run_at}),e[21]=n.nearest_next_run_at,e[22]=n.trigger_count,e[23]=_):_=e[23];let y;e[24]!==v||e[25]!==_?(y=o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[v,_]}),e[24]=v,e[25]=_,e[26]=y):y=e[26];let E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(te,{asChild:!0,children:o.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:o.jsx(ae,{size:16})})}),e[27]=E):E=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=o.jsx("div",{onClick:_e,onKeyDown:xe,role:"presentation",className:"shrink-0",children:o.jsxs(ne,{children:[E,o.jsx(se,{align:"end",children:o.jsxs(ie,{variant:"destructive",onClick:R=>{R.stopPropagation(),u(!0)},children:[o.jsx(le,{size:16}),"Delete"]})})]})}),e[28]=O):O=e[28];let h;e[29]!==F||e[30]!==r||e[31]!==y||e[32]!==N||e[33]!==p?(h=o.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:F,className:"group w-full flex items-center gap-3 px-4 py-3 border-b border-border text-left hover:bg-muted/50 transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[N,p,y,O]}),e[29]=F,e[30]=r,e[31]=y,e[32]=N,e[33]=p,e[34]=h):h=e[34];let T;e[35]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(W,{children:"Delete automation?"}),e[35]=T):T=e[35];let j;e[36]!==n.name?(j=o.jsxs(V,{children:[T,o.jsxs(H,{children:["This removes"," ",o.jsx("span",{className:"font-medium text-foreground",children:n.name})," ","and all of its triggers. This action cannot be undone."]})]}),e[36]=n.name,e[37]=j):j=e[37];let w;e[38]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(X,{children:"Cancel"}),e[38]=w):w=e[38];let C;e[39]!==f||e[40]!==a.isPending?(C=o.jsxs(Y,{children:[w,o.jsx(J,{onClick:f,disabled:a.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[39]=f,e[40]=a.isPending,e[41]=C):C=e[41];let m;e[42]!==j||e[43]!==C?(m=o.jsxs(Z,{children:[j,C]}),e[42]=j,e[43]=C,e[44]=m):m=e[44];let c;e[45]!==i||e[46]!==m?(c=o.jsx(ee,{open:i,onOpenChange:u,children:m}),e[45]=i,e[46]=m,e[47]=c):c=e[47];let I;return e[48]!==h||e[49]!==c?(I=o.jsxs(o.Fragment,{children:[h,c]}),e[48]=h,e[49]=c,e[50]=I):I=e[50],I}function xe(t){return t.stopPropagation()}function _e(t){return t.stopPropagation()}function ye(t){const e=P.c(4),{triggerCount:n,nextRunAt:s}=t;if(n===0){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("span",{className:"text-xs text-muted-foreground",children:"No triggers configured"}),e[0]=a):a=e[0],a}let r;return e[1]!==s||e[2]!==n?(r=o.jsx("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground min-w-0",children:s?o.jsxs(o.Fragment,{children:[o.jsx(re,{size:12,className:"shrink-0"}),o.jsxs("span",{className:"truncate",children:["Next run ",new Date(s).toLocaleString()]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ce,{size:12,className:"shrink-0"}),o.jsxs("span",{className:"truncate",children:[n," trigger",n===1?"":"s"]})]})}),e[1]=s,e[2]=n,e[3]=r):r=e[3],r}export{Fe as A,Ee as a,Oe as b,Se as c,we as d,de as u};
@@ -1 +0,0 @@
1
- import{e as L,s as R,f as T,r as M,j as e,B as $,t as S}from"./index-DHvfV22T.js";import{s as O}from"./Plus-gZScqBbn.js";import{i as _}from"./Zap-MBVwanCx.js";import{S as V}from"./search-input-Dq6mcRO6.js";import{P as p}from"./index-BXweTbWN.js";import{E as B}from"./empty-state-Di9idjlO.js";import{c as q,A as D}from"./automation-list-row-CKWNl7Xx.js";import{u as F}from"./use-navigate-to-agent-CVVCVmb_.js";import{u as G}from"./use-virtual-mcp-ByUoWLLO.js";import"./SearchMd-DmmmzJIi.js";import"./use-mobile-DHF6z3l-.js";import"./X-D_cmo_DI.js";import"./alert-dialog-CGn0S0CC.js";import"./dropdown-menu-DwLxT3z1.js";import"./ChevronDown-CYzIAmcr.js";import"./ChevronRight-DeEIl6Ga.js";import"./XCircle-DofWfDB_.js";import"./agent-icon-B4FOoeEp.js";import"./AlertCircle-0nxz1rX8.js";import"./Tool01-BtxOSAs7.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./ZapSquare-Acx_yvzd.js";import"./Users03-BjqYs6sm.js";import"./CheckCircle-CkYTxj_S.js";import"./ChevronUp-MMJijhLH.js";import"./Container-Co8nThxH.js";import"./Star01-yc5vq0ru.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Lock01-D0hjzmk2.js";import"./Sun-B0IvK7nO.js";import"./Play-BxeG5fNv.js";import"./Settings02-BF97-Fnm.js";import"./Trash01-Cv5TKLdc.js";import"./User01-Bm0y4lC0.js";import"./constants-BgpFj97_.js";import"./use-collections-B6b08eGL.js";function bt(){const t=L.c(18),{org:u}=R(),{data:y}=q(void 0),d=y===void 0?[]:y,b=G(),f=F(),g=T(),[x,k]=M.useState(""),h=x.toLowerCase(),E=new Map(b.map(H)),A=d.filter(o=>{if(!h||o.name.toLowerCase().includes(h))return!0;const n=o.agent?E.get(o.agent.id):void 0;return!!(n&&n.title.toLowerCase().includes(h))});let a;t[0]!==f?(a=(o,n)=>{n&&(S("automations_list_row_clicked",{automation_id:o,agent_id:n,source:"settings_automations"}),f(n,{search:{main:"automation:"+o}}))},t[0]=f,t[1]=a):a=t[1];const P=a;let m;t[2]!==g||t[3]!==u.slug?(m=()=>{S("automations_empty_state_browse_agents_clicked"),g({to:"/$org/settings/agents",params:{org:u.slug}})},t[2]=g,t[3]=u.slug,t[4]=m):m=t[4];const z=m,j=p,w=p,v=p;let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsx(p.Title,{children:"Automations"}),t[5]=c):c=t[5];const C=d.length>0&&e.jsx(V,{value:x,onChange:k,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let s;t[6]!==C?(s=e.jsxs("div",{className:"flex flex-col gap-6",children:[c,C]}),t[6]=C,t[7]=s):s=t[7];const N=d.length===0?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(B,{image:e.jsx(_,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:e.jsxs($,{size:"sm",onClick:z,children:[e.jsx(O,{size:14}),"Browse agents"]})})}):A.length===0?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(B,{image:e.jsx(_,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${x}"`})}):e.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:A.map(o=>e.jsx(D,{automation:o,showAgent:!0,onClick:()=>P(o.id,o.agent?.id??null)},o.id))});let i;t[8]!==v.Body||t[9]!==s||t[10]!==N?(i=e.jsxs(v.Body,{children:[s,N]}),t[8]=v.Body,t[9]=s,t[10]=N,t[11]=i):i=t[11];let r;t[12]!==w.Content||t[13]!==i?(r=e.jsx(w.Content,{children:i}),t[12]=w.Content,t[13]=i,t[14]=r):r=t[14];let l;return t[15]!==j||t[16]!==r?(l=e.jsx(j,{children:r}),t[15]=j,t[16]=r,t[17]=l):l=t[17],l}function H(t){return[t.id,t]}export{bt as default};
@@ -1 +0,0 @@
1
- import{v as Ke,y as te,e as b,j as t,E as Te,r as C,s as le,x as Qe,c as U,aX as Ye,aY as Ge,l as ie,d as Xe,ay as Q,B as W,z as Ze,g as ae,aZ as ke}from"./index-DHvfV22T.js";import{E as Pe}from"./empty-state-Di9idjlO.js";import{u as et,a as Ee}from"./use-collections-B6b08eGL.js";import{u as ce}from"./constants-BgpFj97_.js";import{a as se,F as tt,b as de,d as me}from"./form-2LsJQI5E.js";import{I as ue}from"./input-CDeKOB27.js";import{T as re}from"./textarea-8UV3LDMX.js";import{a as st,b as nt,V as xe}from"./layout-BiEb87aZ.js";import{S as ot,W as rt,a as lt}from"./index-BZMU1-Zz.js";import{g as it,M as at,b as je}from"./types-C318llZ2.js";import{a as be,c as Ne,d as ve,S as Se,b as ne}from"./select-DVBzN73v.js";import{T as ct,c as ye,a as we,b as Ce}from"./use-mobile-DHF6z3l-.js";import{i as dt}from"./AlertCircle-0nxz1rX8.js";import{O as mt,Q as ut,X as xt,Y as pt,Z as ft,_ as Ie}from"./agent-icon-B4FOoeEp.js";import{f as ht}from"./XCircle-DofWfDB_.js";import{i as gt}from"./Play-BxeG5fNv.js";import{i as jt}from"./ChevronRight-DeEIl6Ga.js";import{O as bt,M as Nt}from"./index-CWVXiaiz.js";import{g as vt}from"./connection-slug-eyAPH6o3.js";import{u as St,T as yt}from"./tools-list-BbeD_D_r.js";import{b as _e,u as Oe}from"./use-connection-B4n7P5ZX.js";import{b as wt}from"./use-mcp-tools-BGEi8TMH.js";import{c as Ct}from"./content-blocks-o63cs2vh.js";import{I as $e}from"./integration-icon-CI13mmaS.js";import{a as It,g as $t}from"./chat-context-bxvplF3Z.js";import{u as Tt}from"./shell-layout-DaX2wZ77.js";import{M as kt}from"./monaco-editor-CtX0YP6U.js";import{E as Pt}from"./empty-state-CCV3q11p.js";import{n as Et}from"./Container-Co8nThxH.js";import"./label-CnjZ_mJO.js";import"./index-BXweTbWN.js";import"./X-D_cmo_DI.js";import"./index-BqgOT0Li.js";import"./collections-CJcBtWs5.js";import"./index-DAwDZKfR.js";import"./use-virtual-mcp-ByUoWLLO.js";import"./accordion-Bs6iOXfP.js";import"./scroll-area-D5mZ0hRE.js";import"./badge-BKbfqB0P.js";import"./view-mode-toggle-DhKikjfW.js";import"./dialog-BlDJEasr.js";import"./dropdown-menu-DwLxT3z1.js";import"./ChevronDown-CYzIAmcr.js";import"./Plus-gZScqBbn.js";import"./Tool01-BtxOSAs7.js";import"./index-DRvZCWzg.js";import"./create-sse-subscription-CxkOgzKf.js";import"./ChevronUp-MMJijhLH.js";import"./SearchMd-DmmmzJIi.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./ZapSquare-Acx_yvzd.js";import"./Users03-BjqYs6sm.js";import"./CheckCircle-CkYTxj_S.js";import"./Star01-yc5vq0ru.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Lock01-D0hjzmk2.js";import"./Sun-B0IvK7nO.js";import"./Settings02-BF97-Fnm.js";import"./Trash01-Cv5TKLdc.js";import"./User01-Bm0y4lC0.js";import"./Zap-MBVwanCx.js";import"./extract-connection-data-BkZ-2zmr.js";import"./constants-Dp_2h6cY.js";import"./use-registry-connections-DE87auCx.js";import"./use-organization-settings-hZWDePgg.js";import"./index-D748RB59.js";import"./popover-xVRU-oRu.js";import"./use-create-virtual-mcp-jrLS8Jsa.js";import"./use-navigate-to-agent-CVVCVmb_.js";import"./use-ai-providers-Do6DYo3A.js";import"./use-decopilot-events-BaTABZmJ.js";import"./use-tasks-BtKmvszc.js";import"./required-auth-layout-B1r3oQ4H.js";import"./use-org-sso-CVSlB5eM.js";Ke({title:te().min(1),description:te().nullable(),body:te()});function oe(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function _t(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function Ot(s){const e=b.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let r;e[1]!==o.control?(r=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(se,{control:o.control,name:"title",render:Dt}),t.jsx(se,{control:o.control,name:"description",render:Rt})]})]}),e[1]=o.control,e[2]=r):r=e[2];let l,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),i=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=l,e[4]=i):(l=e[3],i=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[l,i,t.jsx(se,{control:o.control,name:"body",render:At})]}),e[5]=o.control,e[6]=c):c=e[6];let a;e[7]!==r||e[8]!==c?(a=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[r,c]}),e[7]=r,e[8]=c,e[9]=a):a=e[9];let x;return e[10]!==o||e[11]!==a?(x=t.jsx(tt,{...o,children:a}),e[10]=o,e[11]=a,e[12]=x):x=e[12],x}function At(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Rt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Dt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Mt(s){const e=b.c(35),{providerId:o,promptId:n}=s,{org:r}=le(),l=o||null;let i;e[0]!==r.id||e[1]!==l?(i={connectionId:l,orgId:r.id},e[0]=r.id,e[1]=l,e[2]=i):i=e[2];const c=ce(i),a=et(o,"PROMPT",n,c),x=Ee(o,"PROMPT",c),f=x.update.isPending;let u;e[3]!==a?(u=a?{title:a.title,description:a.description??null,body:oe(a)}:void 0,e[3]=a,e[4]=u):u=e[4];let h;e[5]!==u?(h={values:u},e[5]=u,e[6]=h):h=e[6];const N=Qe(h);let T;e[7]!==N||e[8]!==a?(T=()=>{a&&N.reset({title:a.title,description:a.description??null,body:oe(a)})},e[7]=N,e[8]=a,e[9]=T):T=e[9];const _=T;let O;e[10]!==x.update||e[11]!==N||e[12]!==n?(O=N.handleSubmit(async v=>{const P=await x.update.mutateAsync({id:n,data:{title:v.title,description:v.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:v.body}}]}});N.reset({title:P.title,description:P.description??null,body:oe(P)})}),e[10]=x.update,e[11]=N,e[12]=n,e[13]=O):O=e[13];const A=O;if(!a){let v;return e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pe,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=v):v=e[14],v}let y;e[15]!==a.title?(y=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[15]=a.title,e[16]=y):y=e[16];let k;e[17]!==a.description?(k=a.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:a.description})]}):null,e[17]=a.description,e[18]=k):k=e[18];let I;e[19]!==y||e[20]!==k?(I=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,k]})}),e[19]=y,e[20]=k,e[21]=I):I=e[21];let g;e[22]!==A?(g=()=>{A()},e[22]=A,e[23]=g):g=e[23];let S;e[24]!==N.formState.isDirty||e[25]!==f||e[26]!==_||e[27]!==g?(S=t.jsx(st,{children:t.jsx(ot,{onSave:g,onUndo:_,isDirty:N.formState.isDirty,isSaving:f})}),e[24]=N.formState.isDirty,e[25]=f,e[26]=_,e[27]=g,e[28]=S):S=e[28];let w;e[29]!==N?(w=t.jsx("div",{className:"h-full",children:t.jsx(Ot,{form:N})}),e[29]=N,e[30]=w):w=e[30];let $;return e[31]!==S||e[32]!==w||e[33]!==I?($=t.jsxs(xe,{children:[I,S,w]}),e[31]=S,e[32]=w,e[33]=I,e[34]=$):$=e[34],$}function zt(s){const e=b.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=_t(),e[0]=n):n=e[0];const r=n;if(!r){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pe,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=i):i=e[1],i}let l;return e[2]!==o?(l=t.jsx(Te,{children:t.jsx(C.Suspense,{fallback:null,children:t.jsx(Mt,{providerId:r,promptId:o})})}),e[2]=o,e[3]=l):l=e[3],l}const Ut=Ye("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function Bt(s){const e=b.c(10);let o,n,r;e[0]!==s?({className:o,variant:r,...n}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=r):(o=e[1],n=e[2],r=e[3]);let l;e[4]!==o||e[5]!==r?(l=U(Ut({variant:r}),o),e[4]=o,e[5]=r,e[6]=l):l=e[6];let i;return e[7]!==n||e[8]!==l?(i=t.jsx("div",{"data-slot":"alert",role:"alert",className:l,...n}),e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function Lt(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("line-clamp-1 min-h-4 font-medium tracking-tight",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("div",{"data-slot":"alert-title",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function Vt(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("text-muted-foreground leading-relaxed",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("div",{"data-slot":"alert-description",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function Ae(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("min-w-0 overflow-hidden",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function Re(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("ol",{"data-slot":"breadcrumb-list",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function J(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("li",{"data-slot":"breadcrumb-item",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function Y(s){const e=b.c(10);let o,n,r;e[0]!==s?({asChild:o,className:n,...r}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=r):(o=e[1],n=e[2],r=e[3]);const l=o?Ge:"a";let i;e[4]!==n?(i=U("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=i):i=e[5];let c;return e[6]!==l||e[7]!==r||e[8]!==i?(c=t.jsx(l,{"data-slot":"breadcrumb-link",className:i,...r}),e[6]=l,e[7]=r,e[8]=i,e[9]=c):c=e[9],c}function De(s){const e=b.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let r;e[3]!==o?(r=U("text-foreground font-medium truncate",o),e[3]=o,e[4]=r):r=e[4];let l;return e[5]!==n||e[6]!==r?(l=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:r,...n}),e[5]=n,e[6]=r,e[7]=l):l=e[7],l}function G(s){const e=b.c(12);let o,n,r;e[0]!==s?({children:o,className:n,...r}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=r):(o=e[1],n=e[2],r=e[3]);let l;e[4]!==n?(l=U("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=l):l=e[5];let i;e[6]!==o?(i=o??t.jsx(jt,{}),e[6]=o,e[7]=i):i=e[7];let c;return e[8]!==r||e[9]!==l||e[10]!==i?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:l,...r,children:i}),e[8]=r,e[9]=l,e[10]=i,e[11]=c):c=e[11],c}const Ft=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Jt(s){const e=b.c(11),{toolName:o,connectionId:n,siblings:r,onSelectInstance:l,onBack:i}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const a=St(c);if(!a.isAuthenticated){let u;return e[2]!==a.supportsOAuth||e[3]!==i?(u=t.jsx("div",{className:"flex h-full items-center justify-center",children:a.supportsOAuth?t.jsx(bt,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):t.jsx(Nt,{hasReadme:!1})}),e[2]=a.supportsOAuth,e[3]=i,e[4]=u):u=e[4],u}const x=`${n}:${o}`;let f;return e[5]!==n||e[6]!==l||e[7]!==r||e[8]!==x||e[9]!==o?(f=t.jsx(qt,{toolName:o,connectionId:n,siblings:r,onSelectInstance:l},x),e[5]=n,e[6]=l,e[7]=r,e[8]=x,e[9]=o,e[10]=f):f=e[10],f}function qt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:r}=Xe({strict:!1}),l=(()=>{if(!r)return null;const d=`replay-${r}`,m=sessionStorage.getItem(d);if(!m)return null;sessionStorage.removeItem(d);try{return JSON.parse(m)}catch{return null}})(),i=(()=>{if(!l)return null;const d={};for(const[m,j]of Object.entries(l))j!==null&&typeof j=="object"?d[m]=JSON.stringify(j,null,2):d[m]=j;return d})(),[c,a]=C.useState(i??{}),[x,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[u,h]=C.useState(null),[N,T]=C.useState(null),[_,O]=C.useState(null),[A,y]=C.useState(null),[k,I]=C.useState(!1),[g,S]=C.useState(null),{org:w}=le(),$=_e(e),{sendMessage:v}=It(),P=$t(),{setChatOpen:B}=Tt(),M=`${e}:${s}`,R=ce({connectionId:e,orgId:w.id}),z=wt({client:R}),p=z.data?.tools?.find(d=>d.name===s),E=it(p?._meta),L=d=>{const m=Ct(d.content);m.content.length>0&&(B(!0),v({tiptapDoc:m}))},[D,X]=C.useState("json"),[Me,ze]=C.useState(!1);E&&!Me&&(X("ui"),ze(!0));const pe=p?.inputSchema?.properties,fe=pe?Object.keys(pe):[],q=fe.length>0,H={};if(q&&p?.inputSchema?.properties)for(const d of fe)H[d]=p.inputSchema.required?.includes(d)?"":void 0;const Z=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{I(!0),y(null),h(null),T(null),O(null),S(null);const d=performance.now();try{if(!R)throw new Error("MCP client is not available");const m=q?{...H,...c}:(()=>{const V=x.trim();if(!V)return{};const F=JSON.parse(V);if(F&&typeof F=="object")return F;throw new Error("Raw JSON input must be an object.")})();q&&p?.inputSchema?.properties&&Object.entries(p.inputSchema.properties).forEach(([V,F])=>{if((F.type==="object"||F.type==="array")&&typeof m[V]=="string")try{m[V]=JSON.parse(m[V])}catch{}});const j=await R.callTool({name:s,arguments:m}),K=j.structuredContent??j,qe=performance.now(),We=Math.round(qe-d);h(K),T(j),O(m);const He=JSON.stringify(K),ge=new TextEncoder().encode(He).length;S({duration:`${We}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(m){const j=m instanceof Error?m.message:String(m);y(j||"Unknown error occurred");const K=performance.now();S({duration:`${Math.round(K-d)}ms`})}finally{I(!1)}},ee=(d,m)=>{a(j=>({...j,[d]:m}))},Be=()=>{h(null),T(null),O(null),y(null),S(null)},Le=p?.name??Ft(s),Ve=t.jsx(Ae,{children:t.jsxs(Re,{children:[t.jsx(J,{children:t.jsx(Y,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:w.slug},children:"Connections"})})}),t.jsx(G,{}),$&&t.jsxs(t.Fragment,{children:[t.jsx(J,{children:t.jsx(Y,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:w.slug,appSlug:vt($)},search:{tab:"tools"},children:$.title})})}),t.jsx(G,{})]}),t.jsx(J,{children:t.jsx(De,{children:Le})})]})}),he=o.length>1&&t.jsxs(be,{value:e,onValueChange:n,children:[t.jsx(Ne,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ve,{})}),t.jsx(Se,{children:o.map(d=>t.jsx(ne,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($e,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Fe=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),p?.inputSchema?.required&&p.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:q&&p?.inputSchema?.properties?Object.entries(p.inputSchema.properties).map(([d,m])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,p.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:m.type})]}),m.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:m.description}),m.type==="object"||m.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:Z(d)?c[d]??"":H[d]??"",onChange:j=>ee(d,j.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):m.type==="boolean"?t.jsxs(be,{value:Z(d)?String(c[d]??""):"",onValueChange:j=>ee(d,j==="true"),children:[t.jsx(Ne,{children:t.jsx(ve,{placeholder:"Select true or false..."})}),t.jsxs(Se,{children:[t.jsx(ne,{value:"true",children:"true"}),t.jsx(ne,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:Z(d)?c[d]??"":H[d]??"",onChange:j=>ee(d,j.target.value),placeholder:`Enter ${d}...`})]},d)):p?.inputSchema&&!q?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:x,onChange:d=>f(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:k?t.jsxs(W,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(mt,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(W,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(gt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),Je=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[g&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ut,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.duration})]}),g.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.tokens})]}),g.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(pt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.bytes})]}),g.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:g.cost})})]}),E&&t.jsx(ct,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(ft,{size:14})})}),t.jsx(Ce,{children:"Interactive view"})]}),t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(Ie,{size:14})})}),t.jsx(Ce,{children:"JSON view"})]})]})})]})]}),A&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(Bt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(dt,{className:"h-4 w-4"}),t.jsx(Lt,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(Vt,{className:"text-xs text-destructive",children:A})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:E&&D==="ui"&&R?t.jsx(C.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(at,{resourceURI:E,toolInfo:p?{tool:p}:void 0,toolInput:_??void 0,toolResult:N??void 0,displayMode:"fullscreen",minHeight:je.view.minHeight,maxHeight:je.view.maxHeight,client:R,onMessage:L,onUpdateModelContext:d=>P?.setAppContext(M,d),onTeardown:()=>P?.clearAppContext(M),className:"h-full"})}):u?t.jsxs(t.Fragment,{children:[t.jsx(kt,{code:JSON.stringify(u,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(W,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(u,null,2)),Ze.success("Copied to clipboard")},children:t.jsx(ht,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(Ie,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx($e,{icon:$?.icon||null,name:$?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[z.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):z.isLoading?t.jsx(ie,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:z.isSuccess?"ready":z.isLoading?"connecting":"error"})]}),t.jsx(yt,{annotations:p?.annotations,_meta:p?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:p?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Fe}),Je]})})]})})}function Wt(s){const e=b.c(10),{itemId:o,siblings:n,onBack:r}=s,[l,i]=C.useState(n[0]?.id??"");let c;e[0]!==l||e[1]!==n?(c=n.find(h=>h.id===l)?.id??n[0]?.id??"",e[0]=l,e[1]=n,e[2]=c):c=e[2];const a=c;if(!_e(a||void 0)||!a){let h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=h):h=e[3],h}let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ie,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=f):f=e[4];let u;return e[5]!==a||e[6]!==r||e[7]!==n||e[8]!==o?(u=t.jsx(C.Suspense,{fallback:f,children:t.jsx(Jt,{toolName:o,connectionId:a,siblings:n,onSelectInstance:i,onBack:r})}),e[5]=a,e[6]=r,e[7]=n,e[8]=o,e[9]=u):u=e[9],u}const Ht={workflow:lt,workflow_execution:rt,prompt:zt};function Kt(){const s=b.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),r=decodeURIComponent(n.itemId);let l;s[1]!==n.appSlug?(l={slug:n.appSlug},s[1]=n.appSlug,s[2]=l):l=s[2];const i=Oe(l);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const a=c,x=Qt;let f;return s[5]!==a||s[6]!==r||s[7]!==i?(f=t.jsx(Wt,{itemId:r,siblings:i,onBack:a,onUpdate:x}),s[5]=a,s[6]=r,s[7]=i,s[8]=f):f=s[8],f}async function Qt(s){return Promise.resolve()}function Yt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Gt(){const s=b.c(40),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),r=decodeURIComponent(n.collectionName),l=decodeURIComponent(n.itemId);let i;s[1]!==e.history?(i=()=>{e.history.back()},s[1]=e.history,s[2]=i):i=s[2];const c=i,{org:a}=le();let x;s[3]!==n.appSlug?(x={slug:n.appSlug},s[3]=n.appSlug,s[4]=x):x=s[4];const u=Oe(x)[0]??null,h=u?.id??"",N=h||"no-connection",T=h??null;let _;s[5]!==a.id||s[6]!==T?(_={connectionId:T,orgId:a.id},s[5]=a.id,s[6]=T,s[7]=_):_=s[7];const O=ce(_),A=Ee(N,r,O);let y;s[8]!==A||s[9]!==l?(y=async D=>{l&&await A.update.mutateAsync({id:l,data:D})},s[8]=A,s[9]=l,s[10]=y):y=s[10];const k=y;let I;s[11]!==r?(I=r?.toLowerCase(),s[11]=r,s[12]=I):I=s[12];const g=I,S=g&&Ht[g];let w;s[13]!==r?(w=Yt(r),s[13]=r,s[14]=w):w=s[14];const $=w;let v;s[15]!==a.slug?(v=t.jsx(J,{children:t.jsx(Y,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:a.slug},children:"Connections"})})}),s[15]=a.slug,s[16]=v):v=s[16];let P;s[17]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(G,{}),s[17]=P):P=s[17];let B;s[18]!==r||s[19]!==u||s[20]!==a.slug||s[21]!==n.appSlug?(B=u&&t.jsxs(t.Fragment,{children:[t.jsx(J,{children:t.jsx(Y,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:a.slug,appSlug:n.appSlug},search:{tab:r},children:u.title})})}),t.jsx(G,{})]}),s[18]=r,s[19]=u,s[20]=a.slug,s[21]=n.appSlug,s[22]=B):B=s[22];let M;s[23]!==$?(M=t.jsx(J,{children:t.jsx(De,{children:$})}),s[23]=$,s[24]=M):M=s[24];let R;s[25]!==B||s[26]!==M||s[27]!==v?(R=t.jsx(Ae,{children:t.jsxs(Re,{children:[v,P,B,M]})}),s[25]=B,s[26]=M,s[27]=v,s[28]=R):R=s[28];const z=R;if(S){let D;return s[29]!==S||s[30]!==c||s[31]!==k||s[32]!==l?(D=t.jsx(S,{itemId:l,onBack:c,onUpdate:k}),s[29]=S,s[30]=c,s[31]=k,s[32]=l,s[33]=D):D=s[33],D}let p;s[34]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Et,{size:36,className:"text-muted-foreground"}),s[34]=p):p=s[34];let E;s[35]!==c?(E=t.jsx(Pt,{icon:p,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[35]=c,s[36]=E):E=s[36];let L;return s[37]!==z||s[38]!==E?(L=t.jsx(xe,{breadcrumb:z,children:E}),s[37]=z,s[38]=E,s[39]=L):L=s[39],L}function Xt(){const s=b.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Kt,{}),s[1]=i):i=s[1],i}let l;return s[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Gt,{}),s[2]=l):l=s[2],l}function vn(){const s=b.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Te,{children:t.jsx(C.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ie,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Xt,{})})}),s[0]=e):e=s[0],e}export{vn as default};
@@ -1 +0,0 @@
1
- import{e as B,j as s,c as M,B as V}from"./index-DHvfV22T.js";import{D as z,d as _,e as $,c as E}from"./dropdown-menu-DwLxT3z1.js";import{e as L,ac as O,ad as R,ae as A,a1 as F}from"./agent-icon-B4FOoeEp.js";import{i as S}from"./ChevronDown-CYzIAmcr.js";import{a as I,b as K,T as P,c as W}from"./use-mobile-DHF6z3l-.js";import{V as q}from"./view-mode-toggle-DhKikjfW.js";import{B as G}from"./badge-BKbfqB0P.js";function te(t){const e=B.c(31),{viewMode:r,onViewModeChange:m,sortKey:T,sortDirection:p,onSort:f,sortOptions:u,filters:h}=t;let g;e[0]!==u?(g=u===void 0?[]:u,e[0]=u,e[1]=g):g=e[1];const j=g;let b;e[2]!==h?(b=h===void 0?[]:h,e[2]=h,e[3]=b):b=e[3];const l=b;let v;e[4]!==l?(v=l.filter(J),e[4]=l,e[5]=v):v=e[5];const N=v.length;let w;e[6]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(R,{size:16}),e[6]=w):w=e[6];let i;e[7]!==N?(i=N>0&&s.jsx(G,{variant:"default",className:"absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:N}),e[7]=N,e[8]=i):i=e[8];let o;e[9]!==i?(o=s.jsx(I,{asChild:!0,children:s.jsx(_,{asChild:!0,children:s.jsxs(V,{variant:"outline",size:"icon",className:"relative",children:[w,i]})})}),e[9]=i,e[10]=o):o=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(K,{children:"Display & filters"}),e[11]=C):C=e[11];let a;e[12]!==o?(a=s.jsx(P,{children:s.jsxs(W,{children:[o,C]})}),e[12]=o,e[13]=a):a=e[13];let n;e[14]!==m||e[15]!==r?(n=m&&r&&s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(q,{value:r,onValueChange:m,fullWidth:!0,options:[{value:"table",icon:s.jsx(A,{})},{value:"cards",icon:s.jsx(F,{})}]})}),e[14]=m,e[15]=r,e[16]=n):n=e[16];let c;e[17]!==f||e[18]!==p||e[19]!==T||e[20]!==j?(c=j.length>0&&f&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),j.map(y=>{const D=T===y.id;return s.jsx(z,{onClick:()=>f(y.id),className:M("h-8 px-2 py-0 cursor-pointer",D&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[D&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!D&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:y.label}),D&&p&&(p==="asc"?s.jsx(L,{size:16,className:"text-foreground shrink-0"}):s.jsx(O,{size:16,className:"text-foreground shrink-0"}))]})},y.id)})]}),e[17]=f,e[18]=p,e[19]=T,e[20]=j,e[21]=c):c=e[21];let d;e[22]!==l?(d=l.map(H),e[22]=l,e[23]=d):d=e[23];let x;e[24]!==n||e[25]!==c||e[26]!==d?(x=s.jsxs($,{align:"end",className:"w-[200px] p-0 gap-0",children:[n,c,d]}),e[24]=n,e[25]=c,e[26]=d,e[27]=x):x=e[27];let k;return e[28]!==a||e[29]!==x?(k=s.jsxs(E,{children:[a,x]}),e[28]=a,e[29]=x,e[30]=k):k=e[30],k}function H(t){return s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border last:border-b-0",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:t.label}),t.options.map(e=>{const r=t.value===e.id;return s.jsx(z,{onClick:()=>t.onChange(e.id),className:M("h-8 px-2 py-0 cursor-pointer",r&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!r&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:e.label})]})},e.id)})]},t.label)}function J(t){return t.value!=="ALL"}export{te as C};
@@ -1 +0,0 @@
1
- import{e as k,j as s,c as C}from"./index-DHvfV22T.js";import{e as S,d as R,a as T,T as H,b as L,c as z}from"./table-PpA3iGsP.js";import{e as D,ac as E}from"./agent-icon-B4FOoeEp.js";function I(y){const e=k.c(29),{columns:r,data:f,sortKey:x,sortDirection:u,onSort:i,onRowClick:n,rowClassName:c}=y;let p;e[0]!==u?(p=function(t,h){return s.jsx("div",{className:"w-4 flex items-center justify-center",children:h&&u&&(u==="asc"?s.jsx(D,{size:16,className:"text-muted-foreground transition-colors"}):s.jsx(E,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=u,e[1]=p):p=e[1];const b=p;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=function(t,h){let N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return t===h-1&&(N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),N},e[2]=d):d=e[2];const a=d;let l;if(e[3]!==r||e[4]!==i||e[5]!==b||e[6]!==x){let o;e[8]!==r.length||e[9]!==i||e[10]!==b||e[11]!==x?(o=(t,h)=>{const N=x===t.id;return s.jsx(S,{className:C(a(h,r.length),"group transition-colors select-none",t.sortable&&"hover:bg-accent cursor-pointer",t.rowClassName,t.cellClassName),onClick:t.sortable&&i?()=>i(t.id):void 0,children:s.jsxs("span",{className:"flex items-center gap-1",children:[t.header,t.sortable&&b(t.id,N)]})},t.id)},e[8]=r.length,e[9]=i,e[10]=b,e[11]=x,e[12]=o):o=e[12],l=r.map(o),e[3]=r,e[4]=i,e[5]=b,e[6]=x,e[7]=l}else l=e[7];let g;e[13]!==l?(g=s.jsx(R,{className:"border-b-0",children:s.jsx(T,{className:"h-9 hover:bg-transparent border-b border-border",children:l})}),e[13]=l,e[14]=g):g=e[14];let j;if(e[15]!==r||e[16]!==f||e[17]!==n||e[18]!==c){let o;e[20]!==r||e[21]!==n||e[22]!==c?(o=(t,h)=>{const N=c?.(t);return s.jsx(T,{"data-row-index":h,className:C("group/data-row transition-colors border-b-0 hover:bg-accent/50",n?"cursor-pointer":"",N),onClick:n?()=>n(t):void 0,children:r.map(m=>s.jsx(H,{className:C("px-5 py-4 h-16 align-middle text-sm text-foreground",m.cellClassName,m.wrap?"whitespace-normal wrap-break-word":""),children:s.jsx("div",{className:C(m.wrap?"w-full":"min-w-0 w-full",!m.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:m.render?m.render(t):m.accessor?m.accessor(t):null})},m.id))},h)},e[20]=r,e[21]=n,e[22]=c,e[23]=o):o=e[23],j=f.map(o),e[15]=r,e[16]=f,e[17]=n,e[18]=c,e[19]=j}else j=e[19];let w;e[24]!==j?(w=s.jsx(L,{children:j}),e[24]=j,e[25]=w):w=e[25];let v;return e[26]!==g||e[27]!==w?(v=s.jsxs(z,{className:"w-full border-collapse",children:[g,w]}),e[26]=g,e[27]=w,e[28]=v):v=e[28],v}function B(y){const e=k.c(12),{columns:r,data:f,isLoading:x,sortKey:u,sortDirection:i,onSort:n,onRowClick:c,emptyState:p}=y;if(x===void 0?!1:x){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=a):a=e[0],a}if(f.length===0){let a;e[1]!==p?(a=p||s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=p,e[2]=a):a=e[2];let l;return e[3]!==a?(l=s.jsx("div",{className:"flex items-center justify-center h-full",children:a}),e[3]=a,e[4]=l):l=e[4],l}let d;return e[5]!==r||e[6]!==f||e[7]!==c||e[8]!==n||e[9]!==i||e[10]!==u?(d=s.jsx("div",{className:"flex-1",children:s.jsx(I,{columns:r,data:f,sortKey:u,sortDirection:i,onSort:n,onRowClick:c})}),e[5]=r,e[6]=f,e[7]=c,e[8]=n,e[9]=i,e[10]=u,e[11]=d):d=e[11],d}export{B as C};
@@ -1 +0,0 @@
1
- import{I as c}from"./infiniteQueryObserver-BgQN01Hf.js";import{bY as u,bZ as p,e as n,c as m,j as l}from"./index-DHvfV22T.js";import{_ as d}from"./index-D748RB59.js";import{a as f}from"./SearchMd-DmmmzJIi.js";function v(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:p},c,e)}function y(r){const e=n.c(8);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=l.jsx(d,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function N(r){const e=n.c(9);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx(f,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let a;e[4]!==t?(a=m("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=a):a=e[5];let i;return e[6]!==s||e[7]!==a?(i=l.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,l.jsx(d.Input,{"data-slot":"command-input",className:a,...s})]}),e[6]=s,e[7]=a,e[8]=i):i=e[8],i}function _(r){const e=n.c(8);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=l.jsx(d.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function j(r){const e=n.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let s;return e[2]!==t?(s=l.jsx(d.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(r){const e=n.c(8);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=l.jsx(d.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function C(r){const e=n.c(8);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=l.jsx(d.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}function k(r){const e=n.c(8);let t,s;e[0]!==r?({className:t,...s}=r,e[0]=r,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=m("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let a;return e[5]!==s||e[6]!==o?(a=l.jsx(d.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=a):a=e[7],a}export{j as C,w as a,k as b,C as c,N as d,_ as e,y as f,v as u};
@@ -1 +0,0 @@
1
- import{v as he,aI as Te,aJ as Ie,y as le,aK as Ae,e as $,j as t,l as ge,B as H,r as G,c as je,s as te,V as De,K as oe,f as Q,aL as ce,u as $e,aM as Pe,E as Oe,g as Me,o as ze,x as Ve,w as Ee,a0 as Ue,aN as Fe,z as q,a1 as Le}from"./index-DHvfV22T.js";import{g as Re}from"./constants-Dp_2h6cY.js";import{E as ve}from"./empty-state-Di9idjlO.js";import{E as Be,c as He,r as We,b as Xe,d as Ge}from"./connection-form-helpers-B-iFdAbF.js";import{c as Ke,S as qe}from"./index-CWVXiaiz.js";import{u as be,T as Qe}from"./tools-list-BbeD_D_r.js";import{u as Je}from"./use-members-C-n0fYdD.js";import{A as Ye}from"./avatar-B4iYr4Pn.js";import{b as Ne,a as ye,u as Ze}from"./use-connection-B4n7P5ZX.js";import{u as ie,S as et}from"./constants-BgpFj97_.js";import{b as tt}from"./use-mcp-tools-BGEi8TMH.js";import{g as ae,M as st,a as nt}from"./types-C318llZ2.js";import{b as Y,c as ot,a as Z,T as it,d as at}from"./tabs-CqvMN_xV.js";import{I as se}from"./integration-icon-CI13mmaS.js";import{s as rt}from"./Plus-gZScqBbn.js";import{a as _e}from"./Settings02-BF97-Fnm.js";import{s as re}from"./Trash01-Cv5TKLdc.js";import{p as lt,o as ct,r as dt,n as mt,s as ut}from"./index-BXweTbWN.js";import{a as U,b as F,c as R,d as V,e as B,f as xt,F as pt}from"./form-2LsJQI5E.js";import{I as X}from"./input-CDeKOB27.js";import{u as ft,D as ht}from"./use-delete-connection-CRBBtM2M.js";import{V as gt}from"./layout-BiEb87aZ.js";import{c as jt,C as vt,B as bt,a as Nt,b as yt,d as _t,e as Ct}from"./monitoring-stats-row-BQ4J0Yec.js";import{u as St}from"./use-virtual-mcp-ByUoWLLO.js";import{i as Ce}from"./ChevronRight-DeEIl6Ga.js";import{a as Se}from"./Users03-BjqYs6sm.js";import{g as we}from"./connection-slug-eyAPH6o3.js";import{n as wt}from"./ZapSquare-Acx_yvzd.js";import{W as kt,b as Tt,s as It}from"./agent-icon-B4FOoeEp.js";import{b as At}from"./Tool01-BtxOSAs7.js";import{C as Dt}from"./collection-search-BSwS6tWM.js";import{C as $t}from"./card-C6TLc-pg.js";import{B as Pt}from"./badge-BKbfqB0P.js";import{c as Ot,d as Mt,e as zt,D as de}from"./dropdown-menu-DwLxT3z1.js";import{a as me,c as ue,d as xe,S as pe,b as E}from"./select-DVBzN73v.js";import{i as Vt}from"./CheckCircle-CkYTxj_S.js";import{t as Et}from"./ChevronDown-CYzIAmcr.js";import{n as Ut}from"./Container-Co8nThxH.js";import{s as ee}from"./Star01-yc5vq0ru.js";import{c as Ft}from"./SearchMd-DmmmzJIi.js";import"./collections-CJcBtWs5.js";import"./index-BqgOT0Li.js";import"./index-DAwDZKfR.js";import"./extract-connection-data-BkZ-2zmr.js";import"./use-registry-connections-DE87auCx.js";import"./use-organization-settings-hZWDePgg.js";import"./index-D748RB59.js";import"./popover-xVRU-oRu.js";import"./use-mobile-DHF6z3l-.js";import"./use-create-virtual-mcp-jrLS8Jsa.js";import"./use-navigate-to-agent-CVVCVmb_.js";import"./User01-Bm0y4lC0.js";import"./use-collections-B6b08eGL.js";import"./X-D_cmo_DI.js";import"./label-CnjZ_mJO.js";import"./alert-dialog-CGn0S0CC.js";import"./AlertCircle-0nxz1rX8.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./XCircle-DofWfDB_.js";import"./ChevronUp-MMJijhLH.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Lock01-D0hjzmk2.js";import"./Sun-B0IvK7nO.js";import"./Play-BxeG5fNv.js";import"./Zap-MBVwanCx.js";const Lt=he({scopes:Ae(le()).describe("List of scopes available"),stateSchema:Te(le(),Ie()).describe("JSON Schema (draft-07) defining the state structure")}),Rt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Lt}];function Bt(s){const e=$.c(39),{instance:n,onConfigure:i,onAuthenticate:r,onDelete:o}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const d=be(c),l=!(n.connection_type==="VIRTUAL")&&d.supportsOAuth&&!d.isAuthenticated,u=l?"border-destructive/50 bg-destructive/5":"border-transparent";let p;e[2]!==u?(p=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",u),e[2]=u,e[3]=p):p=e[3];let a;e[4]!==n.icon||e[5]!==n.title?(a=t.jsx(se,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=a):a=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let h;e[9]!==l?(h=l&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=l,e[10]=h):h=e[10];let b;e[11]!==f||e[12]!==h?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,h]}),e[11]=f,e[12]=h,e[13]=b):b=e[13];let j;e[14]!==n||e[15]!==l||e[16]!==r?(j=l&&t.jsx(H,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[14]=n,e[15]=l,e[16]=r,e[17]=j):j=e[17];let v;e[18]!==n||e[19]!==i?(v=()=>i(n),e[18]=n,e[19]=i,e[20]=v):v=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(_e,{size:13}),e[21]=S):S=e[21];let I;e[22]!==v?(I=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:v,title:"Configure",children:S}),e[22]=v,e[23]=I):I=e[23];let N;e[24]!==n||e[25]!==o?(N=()=>o(n),e[24]=n,e[25]=o,e[26]=N):N=e[26];let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(re,{size:13}),e[27]=w):w=e[27];let k;e[28]!==N?(k=t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:N,title:"Delete",children:w}),e[28]=N,e[29]=k):k=e[29];let _;e[30]!==I||e[31]!==k||e[32]!==j?(_=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j,I,k]}),e[30]=I,e[31]=k,e[32]=j,e[33]=_):_=e[33];let T;return e[34]!==_||e[35]!==p||e[36]!==a||e[37]!==b?(T=t.jsxs("div",{className:p,children:[a,b,_]}),e[34]=_,e[35]=p,e[36]=a,e[37]=b,e[38]=T):T=e[38],T}function Ht(s){const e=$.c(15),{instance:n,onConfigure:i}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(se,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let c;e[5]!==n||e[6]!==i?(c=()=>i(n),e[5]=n,e[6]=i,e[7]=c):c=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(_e,{size:13}),e[8]=d):d=e[8];let m;e[9]!==c?(m=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(H,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c,title:"Configure",children:d})}),e[9]=c,e[10]=m):m=e[10];let l;return e[11]!==r||e[12]!==o||e[13]!==m?(l=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,m]}),e[11]=r,e[12]=o,e[13]=m,e[14]=l):l=e[14],l}function Wt(s){const e=$.c(25),{instances:n,onConfigure:i,onAuthenticate:r,onDelete:o,onAdd:c,isAdding:d}=s;if(n.length===0)return null;const m=n.length===1?"Instance":"Instances";let l;e[0]!==m?(l=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[0]=m,e[1]=l):l=e[1];let u;e[2]!==d?(u=d?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(rt,{size:13}),e[2]=d,e[3]=u):u=e[3];let p;e[4]!==d||e[5]!==c||e[6]!==u?(p=t.jsxs(H,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:d,children:[u,"Add instance"]}),e[4]=d,e[5]=c,e[6]=u,e[7]=p):p=e[7];let a;e[8]!==l||e[9]!==p?(a=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[l,p]}),e[8]=l,e[9]=p,e[10]=a):a=e[10];let f;if(e[11]!==n||e[12]!==r||e[13]!==i||e[14]!==o){let j;e[16]!==r||e[17]!==i||e[18]!==o?(j=v=>t.jsx(G.Suspense,{fallback:t.jsx(Ht,{instance:v,onConfigure:i}),children:t.jsx(Bt,{instance:v,onConfigure:i,onAuthenticate:r,onDelete:o})},v.id),e[16]=r,e[17]=i,e[18]=o,e[19]=j):j=e[19],f=n.map(j),e[11]=n,e[12]=r,e[13]=i,e[14]=o,e[15]=f}else f=e[15];let h;e[20]!==f?(h=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=h):h=e[21];let b;return e[22]!==a||e[23]!==h?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a,h]}),e[22]=a,e[23]=h,e[24]=b):b=e[24],b}const Xt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Gt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Kt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function qt(s){const e=$.c(3),{connectionId:n,orgId:i,timeframe:r}=s;let o;e[0]!==i?(o={connectionId:et,orgId:i},e[0]=i,e[1]=o):o=e[1];const c=ie(o),d=Gt(r),{data:m}=De({queryKey:oe.connectionActivity(n,r,i),queryFn:async()=>{const f=await c.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:d.startDate.toISOString(),endDate:d.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return f.structuredContent??f},staleTime:3e5}),l=jt(m?.logs??[],d),u=l.data,p=l.totalCalls>0;let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[2]=a):a=e[2],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),a]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),p?t.jsxs("div",{children:[t.jsx(vt,{config:Kt,className:"h-16 w-full",children:t.jsxs(bt,{data:u,barCategoryGap:"4%",children:[t.jsx(Nt,{content:t.jsx(yt,{labelFormatter:Jt}),cursor:{fill:"var(--muted)"}}),t.jsx(_t,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Qt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Qt(s,e){return t.jsx(Ct,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function Jt(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function Yt(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function Zt(s){const e=$.c(13),{connectionId:n}=s,[i,r]=G.useState("14d"),{org:o}=te();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=c):c=e[0];let d;e[1]!==i?(d=Xt.map(a=>t.jsx("button",{type:"button",onClick:()=>r(a.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value)),e[1]=i,e[2]=d):d=e[2];let m;e[3]!==d?(m=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[c,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=m):m=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Yt,{}),e[5]=l):l=e[5];let u;e[6]!==n||e[7]!==o.id||e[8]!==i?(u=t.jsx(G.Suspense,{fallback:l,children:t.jsx(qt,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=u):u=e[9];let p;return e[10]!==m||e[11]!==u?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[m,u]}),e[10]=m,e[11]=u,e[12]=p):p=e[12],p}function es(s){const e=$.c(15),{virtualMcp:n,org:i}=s,r=Q();let o;e[0]!==r||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:16}),e[4]=c):c=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(se,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:c}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let m;e[8]!==n.title?(m=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=m):m=e[9];let l;e[10]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=l):l=e[10];let u;return e[11]!==o||e[12]!==d||e[13]!==m?(u=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,m,l]}),e[11]=o,e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function ts(s){const e=$.c(7),{virtualMcps:n,org:i}=s;let r;if(e[0]!==i||e[1]!==n){let c;e[3]!==i?(c=d=>t.jsx(es,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=c):c=e[4],r=n.map(c),e[0]=i,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function ss(s){const e=$.c(7),{connection:n}=s,{org:i}=te();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=St(r);if(!(o.length>0)){let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(t.Fragment,{}),e[2]=l):l=e[2],l}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let m;return e[4]!==i.slug||e[5]!==o?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(ts,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=m):m=e[6],m}function ns(s){const e=$.c(30),{tools:n,connectionId:i,org:r}=s,o=Q(),{org:c}=te();let d;e[0]!==i||e[1]!==c.id?(d={connectionId:i,orgId:c.id},e[0]=i,e[1]=c.id,e[2]=d):d=e[2];const m=ie(d),l=Ne(i);let u;e[3]!==l||e[4]!==i?(u=l?we(l):i,e[3]=l,e[4]=i,e[5]=u):u=e[5];const p=u,[a,f]=G.useState("");let h,b,j,v;if(e[6]!==p||e[7]!==m||e[8]!==o||e[9]!==r||e[10]!==a||e[11]!==n){const N=(n??[]).filter(os),w=a.toLowerCase().trim(),k=w?N.filter(g=>g.name.toLowerCase().includes(w)||g.description&&g.description.toLowerCase().includes(w)):N;let _;e[16]!==p||e[17]!==o||e[18]!==r?(_=g=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(g.name)}})},e[16]=p,e[17]=o,e[18]=r,e[19]=_):_=e[19];const T=_;j="flex flex-col h-full overflow-hidden";let y;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=g=>{g.key==="Escape"&&(f(""),g.target.blur())},e[20]=y):y=e[20],e[21]!==a?(v=t.jsx(Dt,{value:a,onChange:f,placeholder:"Search apps...",onKeyDown:y}),e[21]=a,e[22]=v):v=e[22],h="flex-1 overflow-auto p-5",b=k.length===0?t.jsx(ve,{image:null,title:a?"No apps found":"No apps available",description:a?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:k.map(g=>{const P=ae(g._meta);return t.jsxs($t,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>T(g),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(st,{resourceURI:P,toolInfo:{tool:g},displayMode:"inline",minHeight:200,maxHeight:200,client:m})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name}),t.jsx(Qe,{annotations:g.annotations,_meta:g._meta})]}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]})]},g.name)})}),e[6]=p,e[7]=m,e[8]=o,e[9]=r,e[10]=a,e[11]=n,e[12]=h,e[13]=b,e[14]=j,e[15]=v}else h=e[12],b=e[13],j=e[14],v=e[15];let S;e[23]!==h||e[24]!==b?(S=t.jsx("div",{className:h,children:b}),e[23]=h,e[24]=b,e[25]=S):S=e[25];let I;return e[26]!==j||e[27]!==v||e[28]!==S?(I=t.jsxs("div",{className:j,children:[v,S]}),e[26]=j,e[27]=v,e[28]=S,e[29]=I):I=e[29],I}function os(s){return!!ae(s._meta)}function ke(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=c=>c.charAt(0).toUpperCase()+c.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&i.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ne(s){const e=$.c(2),{label:n}=s;let i;return e[0]!==n?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=i):i=e[1],i}function is(s){const e=$.c(50),{tools:n,prompts:i,resources:r,connectionId:o,org:c}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const m=d;let l;e[2]!==r?(l=r===void 0?[]:r,e[2]=r,e[3]=l):l=e[3];const u=l,p=Q(),a=Ne(o??"");let f;e[4]!==a||e[5]!==o?(f=a?we(a):o,e[4]=a,e[5]=o,e[6]=f):f=e[6];const h=f;let b;e[7]!==h||e[8]!==o||e[9]!==p||e[10]!==c?(b=function(A){!o||!c||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:c,appSlug:h,collectionName:"tools",itemId:encodeURIComponent(A)}})},e[7]=h,e[8]=o,e[9]=p,e[10]=c,e[11]=b):b=e[11];const j=b;let v;e[12]!==o||e[13]!==c||e[14]!==n?(v=o&&c&&n.some(ls),e[12]=o,e[13]=c,e[14]=n,e[15]=v):v=e[15];const S=v;if(n.length+m.length+u.length===0){let C;return e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=C):C=e[16],C}let N;e[17]!==n.length?(N=t.jsxs(Y,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=N):N=e[18];let w;e[19]!==S?(w=S&&t.jsx(Y,{value:"apps",variant:"underline",children:"UI"}),e[19]=S,e[20]=w):w=e[20];let k,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Y,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(Y,{value:"resources",variant:"underline",children:"Resources"}),e[21]=k,e[22]=_):(k=e[21],_=e[22]);let T;e[23]!==N||e[24]!==w?(T=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(ot,{variant:"underline",className:"gap-1",children:[N,w,k,_]})}),e[23]=N,e[24]=w,e[25]=T):T=e[25];let y;e[26]!==j||e[27]!==n?(y=n.length>0?n.map(C=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>j(C.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(At,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:ke(C.name)}),C.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:C.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},C.name)):t.jsx(ne,{label:"tools"}),e[26]=j,e[27]=n,e[28]=y):y=e[28];let g;e[29]!==y?(g=t.jsx(Z,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:y})}),e[29]=y,e[30]=g):g=e[30];let P;e[31]!==o||e[32]!==S||e[33]!==c||e[34]!==n?(P=S&&t.jsx(Z,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ns,{tools:n,connectionId:o,org:c})}),e[31]=o,e[32]=S,e[33]=c,e[34]=n,e[35]=P):P=e[35];let M;e[36]!==m?(M=m.length>0?m.map(rs):t.jsx(ne,{label:"prompts"}),e[36]=m,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(Z,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let D;e[40]!==u?(D=u.length>0?u.map(as):t.jsx(ne,{label:"resources"}),e[40]=u,e[41]=D):D=e[41];let z;e[42]!==D?(z=t.jsx(Z,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:D})}),e[42]=D,e[43]=z):z=e[43];let x;return e[44]!==T||e[45]!==g||e[46]!==P||e[47]!==O||e[48]!==z?(x=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(it,{defaultValue:"tools",variant:"underline",children:[T,g,P,O,z]})}),e[44]=T,e[45]=g,e[46]=P,e[47]=O,e[48]=z,e[49]=x):x=e[49],x}function as(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(kt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function rs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(wt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:ke(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ls(s){return ae(s._meta)}function cs(s){const e=$.c(13),{connection:n,displayTitle:i}=s,r=i??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(se,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let c;e[3]!==r?(c=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let m;e[7]!==c||e[8]!==d?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[c,d]}),e[7]=c,e[8]=d,e[9]=m):m=e[9];let l;return e[10]!==o||e[11]!==m?(l=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,m]}),e[10]=o,e[11]=m,e[12]=l):l=e[12],l}function ds({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),c=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=$e(),m=(()=>{if(typeof c!="string"||!c)return!1;try{const a=new URL(c);return a.hostname==="api.githubcopilot.com"&&a.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),l=d||e.connection_type==="STDIO",u=e.connection_type==="VIRTUAL",p=u?Pe(e.connection_url):null;return u?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(Se,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(U,{control:s.control,name:"ui_type",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:a.value,onValueChange:a.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(ee,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(E,{value:"HTTP",children:"HTTP"}),t.jsx(E,{value:"SSE",children:"SSE"}),t.jsx(E,{value:"Websocket",children:"Websocket"}),l&&t.jsxs(t.Fragment,{children:[t.jsx(E,{value:"NPX",children:"NPX Package"}),t.jsx(E,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(U,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(F,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:a.value,onValueChange:a.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(E,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(E,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(E,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee,{className:"w-4 h-4"}),"Websocket"]})}),l&&t.jsxs(t.Fragment,{children:[t.jsx(E,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ut,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(E,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Tt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(B,{})]})}),o==="NPX"&&t.jsx(U,{control:s.control,name:"npx_package",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(U,{control:s.control,name:"stdio_command",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),t.jsx(U,{control:s.control,name:"stdio_args",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(B,{})]})})]}),t.jsx(U,{control:s.control,name:"stdio_cwd",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...a,value:a.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(U,{control:s.control,name:"env_vars",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:a.value??[],onChange:a.onChange})}),t.jsx(B,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(U,{control:s.control,name:"connection_token",render:({field:a})=>t.jsxs(F,{className:"flex flex-col gap-3",children:[t.jsx(R,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Ot,{children:[t.jsx(Mt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Pt,{variant:"success",className:"gap-1.5",children:[t.jsx(Vt,{size:12}),"Authenticated via OAuth",t.jsx(Et,{size:12})]})})}),t.jsxs(zt,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(Ft,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&a.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>a.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(It,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...a,value:a.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(xt,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(B,{})]})})]})}function ms(s){return s.command==="npx"}function us(s){return s.args?.find(e=>!e.startsWith("-"))??""}function xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Fe(s.connection_headers)){const i=s.connection_headers,r=We(i.envVars);if(ms(i)){const c=us(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=xs(i);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function ps(s){let e,n=null,i=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ge(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function fs({connection:s,connectionId:e,org:n,isUpdating:i,tools:r,prompts:o,resources:c,siblings:d}){const m=Q({from:"/$org/settings/connections/$appSlug"}),l=ze(),u=ye(),p=ft({onSuccess:()=>{d.length<=1&&m({to:"/$org/settings/connections",params:{org:n}})}}),[a,f]=G.useState(null),[h,b]=G.useState(!1),j=be({connectionId:e}),{data:v}=Je(),S=v?.data?.members??[],I=a??s,N=S.find(x=>x.userId===I.created_by),k=s?.connection_type==="VIRTUAL"||j.isAuthenticated,_={...s,tools:r},T=Ke(_,Rt),y=Ve({resolver:Ee(He),values:fe(a??s)}),g=y.formState.isDirty,P=async()=>{if(!await y.trigger())return;const C=y.getValues(),A=ps(C),W=a?.id??e;await u.update.mutateAsync({id:W,data:A}),y.reset(C)},M=()=>{y.reset(fe(a??s))},O=async x=>{const{token:C,tokenInfo:A,error:W}=await Le({connectionId:x,scope:"offline_access"});if(W||!C){q.error(`Authentication failed: ${W}`);return}if(A)try{const K=await fetch(`/api/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:A.accessToken,refreshToken:A.refreshToken,expiresIn:A.expiresIn,scope:A.scope,clientId:A.clientId,clientSecret:A.clientSecret,tokenEndpoint:A.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await u.update.mutateAsync({id:x,data:{connection_token:C}});else try{await u.update.mutateAsync({id:x,data:{}})}catch(J){console.warn("Failed to refresh connection tools after OAuth:",J)}}catch(K){console.error("Error saving OAuth token:",K),await u.update.mutateAsync({id:x,data:{connection_token:C}})}else await u.update.mutateAsync({id:x,data:{connection_token:C}});const L=new URL(`/mcp/${x}`,window.location.origin);await l.invalidateQueries({queryKey:oe.isMCPAuthenticated(L.href,null)}),q.success("Authentication successful")},D=()=>O(s.id),z=async()=>{try{const x=await fetch(`/api/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!x.ok){const A=await x.text();q.error(`Failed to remove OAuth: ${A}`);return}const C=new URL(`/mcp/${s.id}`,window.location.origin);await l.invalidateQueries({queryKey:oe.isMCPAuthenticated(C.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(x){console.error("Error removing OAuth token:",x),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(ht,{...p}),t.jsx(lt,{open:a!==null,onOpenChange:x=>{x||f(null)},children:t.jsxs(ct,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(dt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(mt,{className:"text-base",children:a?.title??s.title}),t.jsx(ut,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ye,{url:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(pt,{...y,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(U,{control:y.control,name:"title",render:({field:x})=>t.jsxs(F,{children:[t.jsx(R,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...x})}),t.jsx(B,{})]})}),t.jsx(U,{control:y.control,name:"description",render:({field:x})=>t.jsxs(F,{children:[t.jsx(R,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...x,value:x.value||""})}),t.jsx(B,{})]})})]}),t.jsx(ds,{form:y,connection:a??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:D,onRemoveOAuth:z}),t.jsx(qe,{connection:a??s,form:y,hasMcpBinding:T,isMCPAuthenticated:k,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:D,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(H,{onClick:P,disabled:!g||i,className:"flex-1",children:i?"Saving…":"Save changes"}),g&&t.jsx(H,{variant:"outline",onClick:M,children:"Undo"}),t.jsxs(H,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const x=a??s;f(null),p.requestDelete(x)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},a?.id??s.id)]})}),t.jsx(gt,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(cs,{connection:s,displayTitle:(()=>{const x=d[0]??s;return x.app_name?x.title.replace(/\s*\(\d+\)\s*$/,""):x.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(Zt,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Wt,{instances:d,onConfigure:x=>f(x),onAuthenticate:x=>O(x.id),onDelete:x=>p.requestDelete(x),isAdding:h,onAdd:async()=>{b(!0);try{const x=d[0]??s,C=x.title.replace(/\s*\(\d+\)\s*$/,""),A=d.length+1,W=`${C} (${A})`,L=Re("conn");await u.create.mutateAsync({id:L,title:W,description:x.description??null,connection_type:x.connection_type,connection_url:x.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:x.created_by,organization_id:x.organization_id,icon:x.icon??null,app_name:x.app_name??null,app_id:x.app_id??null,connection_headers:x.connection_headers??null,oauth_config:null,configuration_state:x.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/mcp/${L}`,window.location.origin),J=await Ue({url:K.href,token:null});J.supportsOAuth&&!J.isAuthenticated&&await O(L)}finally{b(!1)}}}),t.jsx(ss,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(is,{tools:r,prompts:o,resources:c,connectionId:e,org:n})})]})})]})})]})}function hs(){const s=$.c(38);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Q(e);let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:r,org:o}=Me(i),{org:c}=te(),d=ye();let m;s[2]!==r?(m={slug:r},s[2]=r,s[3]=m):m=s[3];const l=Ze(m),u=l[0]??null,p=u?.id??"",a=p||null;let f;s[4]!==c.id||s[5]!==a?(f={connectionId:a,orgId:c.id},s[4]=c.id,s[5]=a,s[6]=f):f=s[6];const h=ie(f);let b;s[7]!==h?(b={client:h},s[7]=h,s[8]=b):b=s[8];const{data:j}=tt(b);let v;if(s[9]!==u?.tools||s[10]!==p||s[11]!==l||s[12]!==j){const D=j?j.tools.map(ys):(u?.tools??[]).map(Ns);e:{if(l.length<=1){v=D;break e}const z=new Set,x=[],C=vs;for(const A of l){const W=A.id===p?D:C(A.tools);for(const L of W)z.has(L.name)||(z.add(L.name),x.push(L))}v=x.length>0?x:D}s[9]=u?.tools,s[10]=p,s[11]=l,s[12]=j,s[13]=v}else v=s[13];const S=v;let I;s[14]!==h?(I={client:h},s[14]=h,s[15]=I):I=s[15];const{data:N}=at(I);let w;s[16]!==h?(w={client:h},s[16]=h,s[17]=w):w=s[17];const{data:k}=nt(w);let _;s[18]!==N?.prompts?(_=N?.prompts??[],s[18]=N?.prompts,s[19]=_):_=s[19];let T;s[20]!==_?(T=_.map(js),s[20]=_,s[21]=T):T=s[21];const y=T;let g;s[22]!==k?.resources?(g=k?.resources??[],s[22]=k?.resources,s[23]=g):g=s[23];let P;s[24]!==g?(P=g.map(gs),s[24]=g,s[25]=P):P=s[25];const M=P;if(!u){let D;return s[26]!==n||s[27]!==o?(D=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(H,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[26]=n,s[27]=o,s[28]=D):D=s[28],D}let O;return s[29]!==d.update.isPending||s[30]!==S||s[31]!==u||s[32]!==p||s[33]!==o||s[34]!==y||s[35]!==M||s[36]!==l?(O=t.jsx(fs,{org:o,connection:u,connectionId:p,isUpdating:d.update.isPending,tools:S,prompts:y,resources:M,siblings:l}),s[29]=d.update.isPending,s[30]=S,s[31]=u,s[32]=p,s[33]=o,s[34]=y,s[35]=M,s[36]=l,s[37]=O):O=s[37],O}function gs(s){return{name:s.name,description:s.description,uri:s.uri}}function js(s){return{name:s.name,description:s.description}}function vs(s){return(s??[]).map(bs)}function bs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ns(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function _s(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Oe,{children:t.jsx(G.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(hs,{})})}),s[0]=e):e=s[0],e}function Vn(){const s=$.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(_s,{}),s[0]=e):e=s[0],e}export{Vn as default};
@@ -1 +0,0 @@
1
- import{e as ie,j as t,E as Ye,r as W,l as ce,s as _e,f as Se,d as Je,b as be,u as Ze,a2 as et,a3 as tt,x as nt,w as st,B,t as te,o as ot,c as re,z as G,a0 as it,a1 as lt,K as ct}from"./index-DHvfV22T.js";import{g as rt}from"./constants-Dp_2h6cY.js";import{C as at}from"./collection-display-button-D58wr6x3.js";import{S as dt}from"./search-input-Dq6mcRO6.js";import{C as mt}from"./collection-tabs-Cegi88gO.js";import{u as ut,a as Ne,g as pt,C as fe}from"./connection-card-pbt5_GMK.js";import{E as ht}from"./empty-state-Di9idjlO.js";import{I as xt}from"./integration-icon-CI13mmaS.js";import{P as de}from"./index-BXweTbWN.js";import{u as gt,D as ft}from"./use-delete-connection-CRBBtM2M.js";import{u as jt}from"./use-infinite-scroll-E-ClEQ_w.js";import{u as yt}from"./use-list-state-DueB6o1G.js";import{g as ke,a as Ct,e as vt}from"./extract-connection-data-BkZ-2zmr.js";import{g as ue}from"./connection-slug-eyAPH6o3.js";import{c as De,d as Ae,b as we,A as Te,e as Ie,g as Pe,a as Le,f as Oe}from"./alert-dialog-CGn0S0CC.js";import{C as $e}from"./checkbox-BafUZKEr.js";import{d as Ee,c as ze,a as Fe,D as Me,e as Ve,b as Be}from"./dialog-BlDJEasr.js";import{c as _t,b as St,D as bt,a as Nt,d as kt,e as Dt,f as At}from"./drawer-n2769KGk.js";import{u as wt}from"./use-mobile-DHF6z3l-.js";import{c as Ue,d as Re,e as He,D as pe}from"./dropdown-menu-DwLxT3z1.js";import{a as Q,b as Y,c as J,d as Z,e as ee,F as Ce}from"./form-2LsJQI5E.js";import{I as oe}from"./input-CDeKOB27.js";import{a as Tt,c as It,d as Pt,S as Lt,b as le}from"./select-DVBzN73v.js";import{T as Ot}from"./textarea-8UV3LDMX.js";import{a as Ke,u as $t}from"./use-connection-B4n7P5ZX.js";import{u as Et,S as zt}from"./constants-BgpFj97_.js";import{u as Ft}from"./use-virtual-mcp-ByUoWLLO.js";import{b as Mt,s as We,V as Vt}from"./agent-icon-B4FOoeEp.js";import{n as he}from"./Container-Co8nThxH.js";import{h as Xe}from"./XCircle-DofWfDB_.js";import{s as qe}from"./SearchMd-DmmmzJIi.js";import{s as ge}from"./Star01-yc5vq0ru.js";import{s as Ge}from"./Plus-gZScqBbn.js";import{s as Qe}from"./Trash01-Cv5TKLdc.js";import{i as me,a as ve,E as Bt,c as Ut,p as Rt,b as Ht,d as Kt}from"./connection-form-helpers-B-iFdAbF.js";import"./collections-CJcBtWs5.js";import"./ChevronDown-CYzIAmcr.js";import"./view-mode-toggle-DhKikjfW.js";import"./badge-BKbfqB0P.js";import"./use-registry-connections-DE87auCx.js";import"./use-organization-settings-hZWDePgg.js";import"./useInfiniteQuery-m9L0mxCO.js";import"./infiniteQueryObserver-BgQN01Hf.js";import"./card-C6TLc-pg.js";import"./X-D_cmo_DI.js";import"./use-view-mode-C4RBFxYO.js";import"./ChevronRight-DeEIl6Ga.js";import"./label-CnjZ_mJO.js";import"./ChevronUp-MMJijhLH.js";import"./use-collections-B6b08eGL.js";import"./AlertCircle-0nxz1rX8.js";import"./Tool01-BtxOSAs7.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./ZapSquare-Acx_yvzd.js";import"./Users03-BjqYs6sm.js";import"./CheckCircle-CkYTxj_S.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Lock01-D0hjzmk2.js";import"./Sun-B0IvK7nO.js";import"./Play-BxeG5fNv.js";import"./Settings02-BF97-Fnm.js";import"./User01-Bm0y4lC0.js";import"./Zap-MBVwanCx.js";function Wt(y){const e=ie.c(51),{group:n,onOpen:g,selectionMode:m,selectedIds:d,onToggleSelect:i}=y;let v;if(e[0]!==n.connections||e[1]!==d){let j;e[3]!==d?(j=U=>d.has(U.id),e[3]=d,e[4]=j):j=e[4],v=n.connections.every(j),e[0]=n.connections,e[1]=d,e[2]=v}else v=e[2];const h=v;let _;if(e[5]!==n.connections||e[6]!==d){let j;e[8]!==d?(j=U=>d.has(U.id),e[8]=d,e[9]=j):j=e[9],_=n.connections.some(j),e[5]=n.connections,e[6]=d,e[7]=_}else _=e[7];const u=_,S=`${n.connections.length} instances`;let x;e[10]!==n.icon||e[11]!==n.title||e[12]!==S?(x={title:n.title,icon:n.icon,description:S},e[10]=n.icon,e[11]=n.title,e[12]=S,e[13]=x):x=e[13];let a;e[14]!==h||e[15]!==n.connections||e[16]!==g||e[17]!==i||e[18]!==d||e[19]!==m?(a=()=>m?(()=>{for(const j of n.connections)h?d.has(j.id)&&i(j.id):d.has(j.id)||i(j.id)})():g(),e[14]=h,e[15]=n.connections,e[16]=g,e[17]=i,e[18]=d,e[19]=m,e[20]=a):a=e[20];const p=m&&h&&"ring-2 ring-primary",f=m&&u&&!h&&"ring-1 ring-primary/50";let k;e[21]!==p||e[22]!==f?(k=re(p,f),e[21]=p,e[22]=f,e[23]=k):k=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(he,{}),e[24]=A):A=e[24];let N;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==d||e[29]!==m||e[30]!==u?(N=m?t.jsx($e,{checked:h?!0:u?"indeterminate":!1,onCheckedChange:()=>{for(const j of n.connections)h?d.has(j.id)&&i(j.id):d.has(j.id)||i(j.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=h,e[26]=n.connections,e[27]=i,e[28]=d,e[29]=m,e[30]=u,e[31]=N):N=e[31];const I=m?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let s;e[32]!==I?(s=re("overflow-hidden transition-all duration-150 ease-out",I),e[32]=I,e[33]=s):s=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(Re,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:qt,children:t.jsx(Xe,{size:20})})}),e[34]=D):D=e[34];let M;e[35]!==g?(M=j=>{j.stopPropagation(),g()},e[35]=g,e[36]=M):M=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(qe,{size:16}),e[37]=$):$=e[37];let P;e[38]!==M?(P=t.jsxs(Ue,{children:[D,t.jsx(He,{align:"end",onClick:Xt,children:t.jsxs(pe,{onClick:M,children:[$,"Open"]})})]}),e[38]=M,e[39]=P):P=e[39];let T;e[40]!==s||e[41]!==P?(T=t.jsx("div",{className:s,children:P}),e[40]=s,e[41]=P,e[42]=T):T=e[42];let z;e[43]!==N||e[44]!==T?(z=t.jsxs("div",{className:"flex items-center gap-1",children:[N,T]}),e[43]=N,e[44]=T,e[45]=z):z=e[45];let F;return e[46]!==z||e[47]!==x||e[48]!==a||e[49]!==k?(F=t.jsx(t.Fragment,{children:t.jsx(fe,{connection:x,onClick:a,className:k,fallbackIcon:A,headerActionsAlwaysVisible:!0,headerActions:z})}),e[46]=z,e[47]=x,e[48]=a,e[49]=k,e[50]=F):F=e[50],F}function Xt(y){return y.stopPropagation()}function qt(y){return y.stopPropagation()}function Gt(y){const e=ie.c(28),{count:n,total:g,onSelectAll:m,onDeselectAll:d,onDelete:i,onAddToAgent:v,onToggleStatus:h,onCancel:_}=y;if(n===0)return null;let u;e[0]!==n?(u=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=u):u=e[1];let S;e[2]!==n||e[3]!==d||e[4]!==m||e[5]!==g?(S=n<g?t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:m,children:["Select all (",g,")"]}):t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:d,children:"Clear selection"}),e[2]=n,e[3]=d,e[4]=m,e[5]=g,e[6]=S):S=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Ge,{size:13}),e[7]=x):x=e[7];let a;e[8]!==v?(a=t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:v,children:[x,"Add to Agent"]}),e[8]=v,e[9]=a):a=e[9];let p;e[10]!==h?(p=t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h("active"),children:"Enable"}),e[10]=h,e[11]=p):p=e[11];let f;e[12]!==h?(f=t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h("inactive"),children:"Disable"}),e[12]=h,e[13]=f):f=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Qe,{size:13}),e[14]=k):k=e[14];let A;e[15]!==i?(A=t.jsxs(B,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:[k,"Delete"]}),e[15]=i,e[16]=A):A=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(We,{size:13}),e[17]=N):N=e[17];let I;e[18]!==_?(I=t.jsx(B,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:_,children:N}),e[18]=_,e[19]=I):I=e[19];let s;return e[20]!==u||e[21]!==I||e[22]!==S||e[23]!==a||e[24]!==p||e[25]!==f||e[26]!==A?(s=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[u,S,a,p,f,A,I]})}),e[20]=u,e[21]=I,e[22]=S,e[23]=a,e[24]=p,e[25]=f,e[26]=A,e[27]=s):s=e[27],s}function Qt(y){const e=ie.c(25),{open:n,onOpenChange:g,agents:m,onConfirm:d}=y,[i,v]=W.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Fe,{children:[t.jsx(Me,{children:"Add to Agent"}),t.jsx(Ve,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let _;e[1]!==m||e[2]!==i?(_=m.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):m.map(N=>t.jsxs("button",{type:"button",onClick:()=>v(N.id),className:re("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===N.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(xt,{icon:N.icon,name:N.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:N.title}),N.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.description})]})]},N.id)),e[1]=m,e[2]=i,e[3]=_):_=e[3];let u;e[4]!==_?(u=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:_}),e[4]=_,e[5]=u):u=e[5];let S;e[6]!==g?(S=t.jsx(B,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),e[6]=g,e[7]=S):S=e[7];const x=!i;let a;e[8]!==d||e[9]!==g||e[10]!==i?(a=()=>{i&&(d(i),g(!1),v(null))},e[8]=d,e[9]=g,e[10]=i,e[11]=a):a=e[11];let p;e[12]!==x||e[13]!==a?(p=t.jsx(B,{disabled:x,onClick:a,children:"Add"}),e[12]=x,e[13]=a,e[14]=p):p=e[14];let f;e[15]!==S||e[16]!==p?(f=t.jsxs(Be,{children:[S,p]}),e[15]=S,e[16]=p,e[17]=f):f=e[17];let k;e[18]!==u||e[19]!==f?(k=t.jsxs(ze,{className:"sm:max-w-[400px]",children:[h,u,f]}),e[18]=u,e[19]=f,e[20]=k):k=e[20];let A;return e[21]!==g||e[22]!==n||e[23]!==k?(A=t.jsx(Ee,{open:n,onOpenChange:g,children:k}),e[21]=g,e[22]=n,e[23]=k,e[24]=A):A=e[24],A}function Yt(y){const e=ie.c(20),{open:n,onOpenChange:g,count:m,onConfirm:d}=y,i=m!==1?"s":"";let v;e[0]!==m||e[1]!==i?(v=t.jsxs(De,{children:["Delete ",m," connection",i,"?"]}),e[0]=m,e[1]=i,e[2]=v):v=e[2];const h=m!==1?"s":"";let _;e[3]!==h?(_=t.jsxs(Ae,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=_):_=e[4];let u;e[5]!==v||e[6]!==_?(u=t.jsxs(we,{children:[v,_]}),e[5]=v,e[6]=_,e[7]=u):u=e[7];let S;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(Te,{children:"Cancel"}),e[8]=S):S=e[8];const x=m!==1?"s":"";let a;e[9]!==m||e[10]!==d||e[11]!==x?(a=t.jsxs(Ie,{children:[S,t.jsxs(Pe,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",m," connection",x]})]}),e[9]=m,e[10]=d,e[11]=x,e[12]=a):a=e[12];let p;e[13]!==u||e[14]!==a?(p=t.jsxs(Le,{children:[u,a]}),e[13]=u,e[14]=a,e[15]=p):p=e[15];let f;return e[16]!==g||e[17]!==n||e[18]!==p?(f=t.jsx(Oe,{open:n,onOpenChange:g,children:p}),e[16]=g,e[17]=n,e[18]=p,e[19]=f):f=e[19],f}function Jt(y){return y._registryId?.includes("community-registry")===!0}function Zt(y){const e=ie.c(56),{item:n,allConnections:g,connectedAppNames:m,connectingItemId:d,onNavigateConnected:i,onConnect:v}=y,[h,_]=W.useState(!1),[u,S]=W.useState(null);let x,a;e[0]!==m||e[1]!==n?(x=ke(n)??"",a=m.has(x),e[0]=m,e[1]=n,e[2]=x,e[3]=a):(x=e[2],a=e[3]);const p=a,f=n._meta?.["mcp.mesh"],k=f?.friendlyName||f?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",A=n.server?.description||n.description||null;let N;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(N=n.server?.icons?.[0]?.src||Ct(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=N):N=e[6];const I=N;let s;if(e[7]!==g||e[8]!==x){let b;e[10]!==x?(b=se=>se.connection_type!=="VIRTUAL"&&se.app_name===x,e[10]=x,e[11]=b):b=e[11],s=g.filter(b),e[7]=g,e[8]=x,e[9]=s}else s=e[9];const D=s;let M;e[12]!==n?(M=Jt(n),e[12]=n,e[13]=M):M=e[13];const $=M;let P,T;e[14]!==D||e[15]!==$||e[16]!==p||e[17]!==n||e[18]!==v||e[19]!==i?(P=()=>{if(p){const b=D[0];b&&i(b);return}T()},T=()=>{$?(S("connect"),_(!0)):v(n)},e[14]=D,e[15]=$,e[16]=p,e[17]=n,e[18]=v,e[19]=i,e[20]=P,e[21]=T):(P=e[20],T=e[21]);let z;e[22]!==n||e[23]!==v||e[24]!==u?(z=()=>{te("connections_community_warning_confirmed",{registry_item_id:n.id}),_(!1),u==="connect"&&v(n),S(null)},e[22]=n,e[23]=v,e[24]=u,e[25]=z):z=e[25];const F=z;let j;e[26]!==A||e[27]!==I||e[28]!==k?(j={title:k,description:A,icon:I},e[26]=A,e[27]=I,e[28]=k,e[29]=j):j=e[29];let U;e[30]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(he,{}),e[30]=U):U=e[30];let R;e[31]!==$||e[32]!==n._sourceIcon?(R=$&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[31]=$,e[32]=n._sourceIcon,e[33]=R):R=e[33];let X;e[34]!==d||e[35]!==T||e[36]!==p||e[37]!==n.id?(X=p?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):t.jsx(B,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:d!==null,onClick:b=>{b.stopPropagation(),T()},children:d===n.id?t.jsx(ce,{size:14,className:"animate-spin"}):"Connect"}),e[34]=d,e[35]=T,e[36]=p,e[37]=n.id,e[38]=X):X=e[38];let o;e[39]!==R||e[40]!==X?(o=t.jsxs("div",{className:"flex items-center gap-2",children:[R,X]}),e[39]=R,e[40]=X,e[41]=o):o=e[41];let C;e[42]!==P||e[43]!==o||e[44]!==j?(C=t.jsx(fe,{connection:j,fallbackIcon:U,onClick:P,headerActionsAlwaysVisible:!0,headerActions:o}),e[42]=P,e[43]=o,e[44]=j,e[45]=C):C=e[45];let V;e[46]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs(we,{children:[t.jsx(De,{children:"Community MCP Server"}),t.jsx(Ae,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[46]=V):V=e[46];let H;e[47]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx(Te,{children:"Cancel"}),e[47]=H):H=e[47];let E;e[48]!==F?(E=t.jsxs(Le,{children:[V,t.jsxs(Ie,{children:[H,t.jsx(Pe,{onClick:F,children:"Continue"})]})]}),e[48]=F,e[49]=E):E=e[49];let l;e[50]!==h||e[51]!==E?(l=t.jsx(Oe,{open:h,onOpenChange:_,children:E}),e[50]=h,e[51]=E,e[52]=l):l=e[52];let O;return e[53]!==C||e[54]!==l?(O=t.jsxs(t.Fragment,{children:[C,l]}),e[53]=C,e[54]=l,e[55]=O):O=e[55],O}function en({listState:y,activeTab:e,typeFilter:n,statusFilter:g,registryFilter:m,enabledRegistries:d}){const{org:i}=_e(),v=ot(),h=Se(),{data:_}=be.useSession(),u=Ke(),S=$t(y),x=gt(),[a,p]=W.useState(new Set),f=a.size>0,[k,A]=W.useState(!1),[N,I]=W.useState(!1),[s,D]=W.useState(null),M=Ft(),$=S.filter(c=>!(n!=="ALL"&&c.connection_type!==n||g!=="ALL"&&c.status!==g)),P=pt($),T=c=>{p(r=>{const w=new Set(r);return w.has(c)?w.delete(c):w.add(c),w})},z=()=>{p(new Set)},F=Ne(d,y.searchTerm),j=F.items,U=jt(F.loadMore,F.hasMore,F.isLoadingMore),R=new Set(S.filter(c=>c.app_name).map(c=>c.app_name)),X=m==="ALL"||d.some(c=>c.id===m)?m:"ALL",o=y.search.length>0,C=e==="all"||o?j.filter(c=>{if(X!=="ALL"&&c._registryId!==X)return!1;if(o){const r=ke(c);if(r&&R.has(r))return!1}return!0}):[],V=e==="connected"||o?P:[],H=async c=>{if(!(!i||!_?.user?.id)){te("connection_add_clicked",{action:"connect_new",registry_item_id:c.id,source:"connections_page"}),D(c.id);try{const r=vt(c,i.id,_.user.id,{remoteIndex:0}),w=r.connection_type==="STDIO",L=!!r.connection_url,q=w&&r.connection_headers&&typeof r.connection_headers=="object"&&"command"in r.connection_headers;if(!L&&!q){G.error("This MCP Server cannot be connected: no connection method available"),D(null);return}const{id:K}=await u.create.mutateAsync(r),je=new URL(`/mcp/${K}`,window.location.origin),ye=await it({url:je.href,token:null});if(ye.supportsOAuth&&!ye.isAuthenticated){const{token:ae,tokenInfo:ne,error:xe}=await lt({connectionId:K,scope:"offline_access"});if(xe||!ae){te("connection_oauth_failed",{connection_id:K,flow:"connections_page_connect",error:xe??"no_token"}),G.error(`Authentication failed: ${xe??"no token received"}`);return}else{if(te("connection_oauth_succeeded",{connection_id:K,flow:"connections_page_connect"}),ne)try{(await fetch(`/api/connections/${K}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:ne.accessToken,refreshToken:ne.refreshToken,expiresIn:ne.expiresIn,scope:ne.scope,clientId:ne.clientId,clientSecret:ne.clientSecret,tokenEndpoint:ne.tokenEndpoint})})).ok?await u.update.mutateAsync({id:K,data:{}}):await u.update.mutateAsync({id:K,data:{connection_token:ae}})}catch{await u.update.mutateAsync({id:K,data:{connection_token:ae}})}else await u.update.mutateAsync({id:K,data:{connection_token:ae}});await v.invalidateQueries({queryKey:ct.isMCPAuthenticated(je.href,null)}),G.success("Authentication successful")}}G.success("Connected successfully")}catch(r){G.error(`Failed to connect: ${r instanceof Error?r.message:String(r)}`)}finally{D(null)}}},E=Et({connectionId:zt,orgId:i.id}),l=()=>{v.invalidateQueries({predicate:c=>{const r=c.queryKey;return r[1]===i.id&&r[3]==="collection"&&r[4]==="CONNECTIONS"}})},O=async()=>{A(!1);const c=[...a];te("connections_bulk_delete",{count:c.length});let r=0;for(const w of c)try{(await E.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:w,force:!0}})).isError||r++}catch{}l(),G.success(`Deleted ${r} connection${r!==1?"s":""}`),z()},b=async c=>{const r=[...a];te("connections_bulk_status_toggled",{count:r.length,to_status:c});let w=0;for(const L of r)try{await u.update.mutateAsync({id:L,data:{status:c}}),w++}catch{}l(),G.success(`${c==="active"?"Enabled":"Disabled"} ${w} connection${w!==1?"s":""}`),z()},se=async c=>{const r=M.find(q=>q.id===c);if(!r||!E)return;te("connections_bulk_add_to_agent",{agent_id:c,count:a.size});const w=new Set(r.connections.map(q=>q.connection_id)),L=[...a].filter(q=>!w.has(q)).map(q=>({connection_id:q,selected_tools:null,selected_resources:null,selected_prompts:null}));if(L.length===0){G.info("All selected connections are already in that agent");return}try{await E.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:c,data:{connections:[...r.connections,...L]}}}),v.invalidateQueries({predicate:q=>{const K=q.queryKey;return K[1]===i.id&&K[3]==="collection"&&K[4]==="VIRTUAL_MCP"}}),G.success(`Added ${L.length} connection${L.length!==1?"s":""} to "${r.title}"`),z()}catch{G.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(ft,{...x}),t.jsx(Yt,{open:k,onOpenChange:A,count:a.size,onConfirm:O}),t.jsx(Qt,{open:N,onOpenChange:I,agents:M,onConfirm:se}),F.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(o?C.length===0&&$.length===0:e==="all"?C.length===0:$.length===0)?t.jsx(ht,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:y.search?`No Connections match "${y.search}"`:"Create a connection to get started."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[V.map(c=>{if(c.type==="group")return t.jsx(Wt,{group:c,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:c.key}})},selectionMode:f,selectedIds:a,onToggleSelect:T},c.key);const r=c.connection,w=a.has(r.id);return t.jsx(fe,{connection:r,fallbackIcon:t.jsx(he,{}),onClick:()=>f?T(r.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}}),className:re(w&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[f?t.jsx($e,{checked:w,onCheckedChange:()=>T(r.id),onClick:L=>L.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:re("overflow-hidden transition-all duration-150 ease-out",f?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(Ue,{children:[t.jsx(Re,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:L=>L.stopPropagation(),children:t.jsx(Xe,{size:20})})}),t.jsxs(He,{align:"end",onClick:L=>L.stopPropagation(),children:[t.jsxs(pe,{onClick:L=>{L.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}})},children:[t.jsx(qe,{size:16}),"Open"]}),t.jsxs(pe,{onClick:L=>{L.stopPropagation(),T(r.id)},children:[t.jsx(Vt,{size:16}),"Select"]}),t.jsxs(pe,{variant:"destructive",onClick:L=>{L.stopPropagation(),x.requestDelete(r)},children:[t.jsx(Qe,{size:16}),"Delete"]})]})]})})]})},r.id)}),C.map(c=>t.jsx(Zt,{item:c,allConnections:S,connectedAppNames:R,connectingItemId:s,onNavigateConnected:r=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ue(r)}}),onConnect:H},`catalog-${c._registryId}:${c.id}`)),(e==="all"||o)&&d.length>0&&t.jsx("div",{ref:U,className:"col-span-full h-4"}),(e==="all"||o)&&F.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ce,{size:24,className:"animate-spin text-muted-foreground"})})]})}),f&&t.jsx(Gt,{count:a.size,total:$.length,onSelectAll:()=>{p(new Set($.map(c=>c.id)))},onDeselectAll:()=>p(new Set),onDelete:()=>A(!0),onAddToAgent:()=>I(!0),onToggleStatus:b,onCancel:z})]})}function tn(){const{org:y}=_e(),e=Se(),n=Je({strict:!1}),{data:g}=be.useSession(),{stdioEnabled:m}=Ze(),d=wt(),i=yt({namespace:y.slug,resource:"connections"}),v=Ke(),[h,_]=et(tt.connectionsTab(y.slug),o=>n.tab==="all"||n.tab==="connected"?n.tab:o??"all"),[u,S]=W.useState("ALL"),[x,a]=W.useState("ALL"),[p,f]=W.useState("ALL"),k=ut(),N=Ne(k,i.searchTerm).items,I=i.search!==i.searchTerm,s=nt({resolver:st(Ut),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),D=s.watch("ui_type"),M=s.watch("connection_url"),$=s.watch("npx_package"),P=me({uiType:D,connectionUrl:M??"",npxPackage:$??""})??ve({uiType:D,connectionUrl:M??"",registryItems:N}),T=n.action==="create",z=()=>{te("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:y.slug},search:{action:"create"}})},F=()=>{e({to:"/$org/settings/connections",params:{org:y.slug},search:{}})},j=async o=>{let C,V=null,H=null,E=null;o.ui_type==="NPX"?(C="STDIO",V="",E=Ht(o.npx_package||"",o.env_vars||[])):o.ui_type==="STDIO"?(C="STDIO",V="",E=Kt(o.stdio_command||"",o.stdio_args||"",o.stdio_cwd,o.env_vars||[])):(C=o.ui_type,V=o.connection_url||"",H=o.connection_token||null);const l=rt("conn");te("connection_custom_created",{connection_type:C,ui_type:o.ui_type}),await v.create.mutateAsync({id:l,title:o.title,description:o.description||null,connection_type:C,connection_url:V,connection_token:H,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:g?.user?.id||"system",organization_id:y.id,icon:o.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),F(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:y.slug,appSlug:ue({app_name:null,connection_url:V,title:o.title,id:l})}})},U=o=>{o||(T&&F(),s.reset())},R=o=>{const C=o.trim();if(!C)return;const V=!!s.formState.dirtyFields.title,H=!!s.formState.dirtyFields.description,E=!!s.formState.dirtyFields.env_vars,l=b=>{if(b&&(!V&&!s.getValues("title").trim()&&b.title&&s.setValue("title",b.title,{shouldDirty:!1}),!H&&!(s.getValues("description")??"").trim()&&b.description&&s.setValue("description",b.description,{shouldDirty:!1}),!E&&b.envVarKeys?.length)){const se=s.getValues("env_vars")??[],c=new Set(se.map(w=>w.key)),r=b.envVarKeys.filter(w=>!c.has(w));r.length>0&&s.setValue("env_vars",[...se,...r.map(w=>({key:w,value:""}))],{shouldDirty:!0})}},O=Rt(C);if(O&&m){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",O.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),l(me({uiType:"NPX",npxPackage:O.packageName}));return}if(C.startsWith("http://")||C.startsWith("https://")){const b=D==="HTTP"||D==="SSE"||D==="Websocket"?D:"HTTP";s.setValue("ui_type",b,{shouldDirty:!0}),s.setValue("connection_url",C,{shouldDirty:!0}),l(me({uiType:b,connectionUrl:C})??ve({uiType:b,connectionUrl:C,registryItems:N}));return}D==="NPX"&&l(me({uiType:"NPX",npxPackage:C}))},X=t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(B,{variant:"outline",onClick:z,children:[t.jsx(Ge,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})});return t.jsx(t.Fragment,{children:t.jsxs(de,{children:[(()=>{const o="Create Connection",C="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",H=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:s.control,name:"ui_type",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Type *"}),t.jsxs(Tt,{value:l.value,onValueChange:l.onChange,children:[t.jsx(Z,{children:t.jsx(It,{children:t.jsx(Pt,{})})}),t.jsxs(Lt,{children:[t.jsx(le,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(le,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(le,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"Websocket"]})}),m&&t.jsxs(t.Fragment,{children:[t.jsx(le,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(he,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(le,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Mt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(ee,{})]})}),D==="NPX"&&t.jsx(Q,{control:s.control,name:"npx_package",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"NPM Package *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"@perplexity-ai/mcp-server",...l,value:l.value??"",onPaste:O=>{const b=O.clipboardData.getData("text");b&&(O.preventDefault(),s.setValue("npx_package",b.trim(),{shouldDirty:!0}),R(b))},onBlur:O=>{R(O.target.value),l.onBlur()}})}),t.jsx(ee,{})]})}),D==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:s.control,name:"stdio_command",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Command *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"node, bun, python...",...l,value:l.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"stdio_args",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Arguments"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"arg1 arg2 --flag value",...l,value:l.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"stdio_cwd",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Working Directory"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"/path/to/project (optional)",...l,value:l.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(ee,{})]})})]}),(D==="NPX"||D==="STDIO")&&t.jsx(Q,{control:s.control,name:"env_vars",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Environment Variables"}),t.jsx(Z,{children:t.jsx(Bt,{value:l.value??[],onChange:l.onChange})}),t.jsx(ee,{})]})}),D!=="NPX"&&D!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:s.control,name:"connection_url",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"URL *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"https://example.com/mcp",...l,value:l.value??"",onPaste:O=>{const b=O.clipboardData.getData("text");b&&(O.preventDefault(),s.setValue("connection_url",b.trim(),{shouldDirty:!0}),R(b))},onBlur:O=>{R(O.target.value),l.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"connection_token",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:P?.token?.label??"Token (optional)"}),t.jsx(Z,{children:t.jsx(oe,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...l,value:l.value??""})}),P?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:s.control,name:"title",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Name *"}),t.jsx(Z,{children:t.jsx(oe,{placeholder:"My Connection",...l})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:s.control,name:"description",render:({field:l})=>t.jsxs(Y,{children:[t.jsx(J,{children:"Description"}),t.jsx(Z,{children:t.jsx(Ot,{placeholder:"A brief description of this connection",rows:3,...l,value:l.value??""})}),t.jsx(ee,{})]})})]}),E=T;return d?t.jsx(_t,{open:E,onOpenChange:U,children:t.jsxs(St,{className:"max-h-[90vh]",children:[t.jsx(bt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(Nt,{children:o}),t.jsx(kt,{className:"mt-1",children:C})]}),t.jsx(Dt,{asChild:!0,children:t.jsx(B,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(We,{size:16})})})]})}),t.jsx(Ce,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(j),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:H}),t.jsx(At,{children:t.jsx(B,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Ee,{open:E,onOpenChange:U,children:t.jsxs(ze,{className:"sm:max-w-[525px]",children:[t.jsxs(Fe,{children:[t.jsx(Me,{children:o}),t.jsx(Ve,{children:C})]}),t.jsx(Ce,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(j),children:[t.jsx("div",{className:"py-4",children:H}),t.jsxs(Be,{children:[t.jsx(B,{type:"button",variant:"outline",onClick:()=>U(!1),children:"Cancel"}),t.jsx(B,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(de.Content,{children:t.jsx(de.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(de.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(dt,{value:i.search,onChange:i.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:o=>{o.key==="Escape"&&(i.setSearch(""),o.target.blur())}}),t.jsx(at,{sortKey:i.sortKey,sortDirection:i.sortDirection,onSort:i.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:u,onChange:o=>S(o||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:x,onChange:o=>a(o||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},...k.length>1?[{label:"Registry",value:p,onChange:o=>f(o||"ALL"),options:[{id:"ALL",label:"All registries"},...k.map(o=>({id:o.id,label:o.id.includes("community-registry")?"Community MCP Registry":o.title}))]}]:[]]})]}),X]}),t.jsx(mt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:h,onTabChange:o=>{const C=o;C!==h&&te("connections_page_tab_changed",{to_tab:C}),_(C)}}),t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:I?.5:1,transition:I?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:I?"none":"auto"},children:t.jsx(en,{listState:i,activeTab:h,typeFilter:u,statusFilter:x,registryFilter:p,enabledRegistries:k})})})]})})})]})})}function hs(){const y=ie.c(1);let e;return y[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ye,{children:t.jsx(W.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ce,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(tn,{})})}),y[0]=e):e=y[0],e}export{hs as default};
@@ -1 +0,0 @@
1
- import{e as c,j as d,df as f,dg as m,c as u,dh as g,di as x,dj as v,dk as b,dl as h,dm as w,dn as j,dp as N,dq as p,$ as z,dr as _,ds as y}from"./index-DHvfV22T.js";import{i as $}from"./ChevronDown-CYzIAmcr.js";import{i as D}from"./ChevronRight-DeEIl6Ga.js";import{k as M}from"./XCircle-DofWfDB_.js";function C(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(f,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(m,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function E(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,sideOffset:o,...s}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let i;return e[6]!==s||e[7]!==n||e[8]!==r?(i=d.jsx(x,{children:d.jsx(v,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...s})}),e[6]=s,e[7]=n,e[8]=r,e[9]=i):i=e[9],i}function G(a){const e=c.c(12);let t,s,o,n;e[0]!==a?({className:t,inset:s,variant:n,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let i;e[5]!==t?(i=u("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[5]=t,e[6]=i):i=e[6];let l;return e[7]!==s||e[8]!==o||e[9]!==i||e[10]!==r?(l=d.jsx(g,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":r,className:i,...o}),e[7]=s,e[8]=o,e[9]=i,e[10]=r,e[11]=l):l=e[11],l}function L(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:o,children:s,checked:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==o?(r=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=r):r=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:d.jsx(p,{children:d.jsx($,{className:"size-4"})})}),e[7]=i):i=e[7];let l;return e[8]!==t||e[9]!==s||e[10]!==n||e[11]!==r?(l=d.jsxs(h,{"data-slot":"dropdown-menu-checkbox-item",className:r,checked:t,...n,children:[i,s]}),e[8]=t,e[9]=s,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function O(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(y,{"data-slot":"dropdown-menu-radio-group",...t}),e[2]=t,e[3]=s):s=e[3],s}function q(a){const e=c.c(11);let t,s,o;e[0]!==a?({className:s,children:t,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==s?(n=u("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-lg py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[4]=s,e[5]=n):n=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:d.jsx(p,{children:d.jsx(M,{className:"size-2 fill-current"})})}),e[6]=r):r=e[6];let i;return e[7]!==t||e[8]!==o||e[9]!==n?(i=d.jsxs(_,{"data-slot":"dropdown-menu-radio-item",className:n,...o,children:[r,t]}),e[7]=t,e[8]=o,e[9]=n,e[10]=i):i=e[10],i}function P(a){const e=c.c(10);let t,s,o;e[0]!==a?({className:t,inset:s,...o}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o):(t=e[1],s=e[2],o=e[3]);let n;e[4]!==t?(n=u("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),e[4]=t,e[5]=n):n=e[5];let r;return e[6]!==s||e[7]!==o||e[8]!==n?(r=d.jsx(b,{"data-slot":"dropdown-menu-label","data-inset":s,className:n,...o}),e[6]=s,e[7]=o,e[8]=n,e[9]=r):r=e[9],r}function A(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=d.jsx(w,{"data-slot":"dropdown-menu-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}function B(a){const e=c.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=d.jsx(j,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=s):s=e[3],s}function F(a){const e=c.c(13);let t,s,o,n;e[0]!==a?({className:s,inset:o,children:t,...n}=a,e[0]=a,e[1]=t,e[2]=s,e[3]=o,e[4]=n):(t=e[1],s=e[2],o=e[3],n=e[4]);let r;e[5]!==s?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",s),e[5]=s,e[6]=r):r=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(D,{className:"ml-auto size-4"}),e[7]=i):i=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=d.jsxs(z,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,i]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function H(a){const e=c.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==s||e[6]!==o?(n=d.jsx(N,{"data-slot":"dropdown-menu-sub-content",className:o,...s}),e[5]=s,e[6]=o,e[7]=n):n=e[7],n}export{G as D,B as a,H as b,C as c,T as d,E as e,F as f,q as g,O as h,A as i,P as j,L as k};
@@ -1 +0,0 @@
1
- import{e as G,r as J,z as T,j as s,B as M,f as pe,s as ce,o as de,x as je,w as be,a as W,t as q,K as Z,b as me,v as ve,y as se,n as Ne,c as ye,aD as Se}from"./index-DHvfV22T.js";import{P as Q}from"./index-BXweTbWN.js";import{C as Y,b as X,c as ee,a as te,d as ue,e as _e}from"./card-C6TLc-pg.js";import{I as oe}from"./input-CDeKOB27.js";import{L as B}from"./label-CnjZ_mJO.js";import{c as Ce}from"./XCircle-DofWfDB_.js";import{i as fe}from"./X-D_cmo_DI.js";import{u as V}from"./unwrap-tool-result-BYXdCQMg.js";import{S as we,u as ze,W as ie,i as De}from"./constants-BgpFj97_.js";import{S as Ae}from"./switch-DhZAgC2R.js";import{u as Ee,a as le,D as Ie,c as Pe,S as ke,v as Oe,K as Te,P as Fe,d as Re,C as Le,s as Me,b as $e,e as qe}from"./collection-search-_WhBw8st.js";import{u as ge}from"./use-virtual-mcp-ByUoWLLO.js";import{b as Ge,P as Ke,a as Ue}from"./popover-xVRU-oRu.js";import{S as He}from"./skeleton-BZGew3qV.js";import{T as Be}from"./agent-icon-B4FOoeEp.js";import{s as Je}from"./Plus-gZScqBbn.js";import{a as xe}from"./Users03-BjqYs6sm.js";import{I as ae}from"./integration-icon-CI13mmaS.js";import{u as Qe,c as Ve}from"./use-organization-settings-hZWDePgg.js";import"./use-mobile-DHF6z3l-.js";import"./SearchMd-DmmmzJIi.js";import"./use-collections-B6b08eGL.js";import"./AlertCircle-0nxz1rX8.js";import"./Tool01-BtxOSAs7.js";import"./ArrowNarrowLeft-C2eNhBDd.js";import"./ZapSquare-Acx_yvzd.js";import"./CheckCircle-CkYTxj_S.js";import"./ChevronDown-CYzIAmcr.js";import"./ChevronRight-DeEIl6Ga.js";import"./ChevronUp-MMJijhLH.js";import"./Container-Co8nThxH.js";import"./Star01-yc5vq0ru.js";import"./Palette-Dk9Jb8jx.js";import"./LinkExternal01-B1CK34My.js";import"./Lock01-D0hjzmk2.js";import"./Sun-B0IvK7nO.js";import"./Play-BxeG5fNv.js";import"./Settings02-BF97-Fnm.js";import"./Trash01-Cv5TKLdc.js";import"./User01-Bm0y4lC0.js";import"./Zap-MBVwanCx.js";function We(t){const e=G.c(28),{value:i,onChange:o,name:p,disabled:a}=t,n=J.useRef(null);let C;e[0]!==o?(C=b=>{const w=b.target.files?.[0];if(w){if(w.size>2097152){T.error("Image must be smaller than 2MB");return}const m=new FileReader;m.onerror=()=>{const S=m.error;console.error("FileReader error:",S),T.error(S?.message||"Failed to read image file. Please try again."),n.current&&(n.current.value="")},m.onloadend=()=>{m.readyState===FileReader.DONE&&m.result&&o(m.result),n.current&&(n.current.value="")},m.readAsDataURL(w)}},e[0]=o,e[1]=C):C=e[1];const E=C;let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{n.current?.click()},e[2]=N):N=e[2];const r=N;let f;e[3]!==o?(f=b=>{b.stopPropagation(),o("")},e[3]=o,e[4]=f):f=e[4];const g=f;let d;e[5]!==a||e[6]!==E?(d=s.jsx("input",{type:"file",ref:n,className:"hidden",accept:"image/*",onChange:E,disabled:a}),e[5]=a,e[6]=E,e[7]=d):d=e[7];let c;e[8]!==a||e[9]!==g||e[10]!==p||e[11]!==i?(c=i?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:i,alt:p||"Logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:g,disabled:a,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(fe,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:r,disabled:a,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:pointer-events-none",children:[s.jsx(Ce,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[8]=a,e[9]=g,e[10]=p,e[11]=i,e[12]=c):c=e[12];const z=i?"Change Logo":"Upload Logo";let D;e[13]!==a||e[14]!==z?(D=s.jsx(M,{type:"button",variant:"outline",size:"sm",onClick:r,disabled:a,className:"mb-2",children:z}),e[13]=a,e[14]=z,e[15]=D):D=e[15];let x;e[16]!==a||e[17]!==g||e[18]!==i?(x=i&&s.jsx(M,{type:"button",variant:"ghost",size:"sm",onClick:g,disabled:a,className:"ml-2",children:"Remove"}),e[16]=a,e[17]=g,e[18]=i,e[19]=x):x=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[20]=j):j=e[20];let h;e[21]!==D||e[22]!==x?(h=s.jsxs("div",{className:"flex-1",children:[D,x,j]}),e[21]=D,e[22]=x,e[23]=h):h=e[23];let y;return e[24]!==h||e[25]!==d||e[26]!==c?(y=s.jsxs("div",{className:"flex items-start gap-4",children:[d,c,h]}),e[24]=h,e[25]=d,e[26]=c,e[27]=y):y=e[27],y}const Ze=ve({name:se().min(1,"Name is required").max(255,"Name is too long"),slug:se().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:se().optional()});function Ye(){const t=pe(),{org:e}=ce(),i=de(),[o,p]=J.useState(!1),a=je({resolver:be(Ze),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),n=W({mutationFn:async r=>{const f={name:r.name,slug:r.slug};r.logo&&(f.logo=r.logo);const g=await me.organization.update({organizationId:e.id,data:f});if(g?.error)throw new Error(g.error.message||"Failed to update organization");return g},onSuccess:r=>{q("organization_settings_updated",{organization_id:e.id,fields:Object.keys(a.formState.dirtyFields)}),i.invalidateQueries({queryKey:Z.organizations()}),i.invalidateQueries({queryKey:Z.activeOrganization(e.slug)}),T.success("Organization settings updated successfully"),r?.data?.slug&&r.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:r.data.slug}})},onError:r=>{q("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(a.formState.dirtyFields),error:r instanceof Error?r.message:String(r)}),T.error(r instanceof Error?r.message:"Failed to update organization")},onSettled:()=>{p(!1)}}),C=r=>{p(!0),n.mutate(r)},E=a.formState.isDirty,N=a.formState.errors;return s.jsx("form",{onSubmit:a.handleSubmit(C),className:"flex flex-col gap-6",children:s.jsxs(Y,{className:"p-6",children:[s.jsx(X,{className:"p-0",children:s.jsx(ee,{className:"text-sm",children:"Overview"})}),s.jsxs(te,{className:"flex flex-col gap-6 p-0",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(B,{className:"text-xs text-muted-foreground",children:"Logo"}),s.jsx(We,{value:a.watch("logo"),onChange:r=>a.setValue("logo",r??"",{shouldDirty:!0}),name:a.watch("name"),disabled:o}),N.logo&&s.jsx("p",{className:"text-xs text-destructive",children:N.logo.message})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(B,{htmlFor:"org-name",className:"text-xs text-muted-foreground",children:"Organization name"}),s.jsx(oe,{id:"org-name",...a.register("name"),placeholder:"Organization name",disabled:o}),N.name&&s.jsx("p",{className:"text-xs text-destructive",children:N.name.message})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(B,{htmlFor:"org-slug",className:"text-xs text-muted-foreground",children:"Slug"}),s.jsx(oe,{id:"org-slug",...a.register("slug"),placeholder:"my-organization",disabled:o,onChange:r=>{const f=r.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");a.setValue("slug",f,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Only lowercase letters, numbers, and hyphens."}),N.slug&&s.jsx("p",{className:"text-xs text-destructive",children:N.slug.message})]})]})]}),E&&s.jsxs(ue,{className:"p-0 pt-2 gap-2",children:[s.jsx(M,{type:"submit",disabled:o,children:o?"Saving…":"Save"}),s.jsx(M,{type:"button",variant:"outline",onClick:()=>a.reset(),disabled:o,children:"Cancel"})]})]})})}function Xe(){const t=G.c(62),{org:e}=ce(),{data:i}=me.useSession(),o=de();let p;t[0]!==e.id?(p={connectionId:we,orgId:e.id},t[0]=e.id,t[1]=p):p=t[1];const a=ze(p);let n;t[2]!==e.id?(n=Z.organizationDomain(e.id),t[2]=e.id,t[3]=n):n=t[3];let C;t[4]!==a?(C=async()=>{const l=await a.callTool({name:"ORGANIZATION_DOMAIN_GET",arguments:{}});return V(l)},t[4]=a,t[5]=C):C=t[5];let E;t[6]!==n||t[7]!==C?(E={queryKey:n,queryFn:C},t[6]=n,t[7]=C,t[8]=E):E=t[8];const{data:N,isPending:r}=Ne(E),f=i?.user?.email??"";let g;t[9]!==f?(g=f.split("@")[1]?.toLowerCase()??"",t[9]=f,t[10]=g):g=t[10];const d=g,c=N?.domain??null,z=N?.autoJoinEnabled??!1,D=d&&d!==c;let x;t[11]!==e.id||t[12]!==o?(x=()=>o.invalidateQueries({queryKey:Z.organizationDomain(e.id)}),t[11]=e.id,t[12]=o,t[13]=x):x=t[13];const j=x;let h;t[14]!==a||t[15]!==d?(h=async()=>{const l=await a.callTool({name:"ORGANIZATION_DOMAIN_SET",arguments:{domain:d,autoJoinEnabled:!1}});return V(l)},t[14]=a,t[15]=d,t[16]=h):h=t[16];let y;t[17]!==j||t[18]!==e.id||t[19]!==d?(y=()=>{q("organization_domain_claimed",{organization_id:e.id,email_domain:d}),j(),T.success("Domain claimed")},t[17]=j,t[18]=e.id,t[19]=d,t[20]=y):y=t[20];let b;t[21]!==e.id||t[22]!==d?(b=l=>{q("organization_domain_claim_failed",{organization_id:e.id,email_domain:d,error:l instanceof Error?l.message:String(l)}),T.error(l instanceof Error?l.message:"Failed to claim domain")},t[21]=e.id,t[22]=d,t[23]=b):b=t[23];let w;t[24]!==h||t[25]!==y||t[26]!==b?(w={mutationFn:h,onSuccess:y,onError:b},t[24]=h,t[25]=y,t[26]=b,t[27]=w):w=t[27];const m=W(w);let S;t[28]!==a?(S=async()=>{const l=await a.callTool({name:"ORGANIZATION_DOMAIN_CLEAR",arguments:{}});return V(l)},t[28]=a,t[29]=S):S=t[29];let v;t[30]!==c||t[31]!==j||t[32]!==e.id?(v=()=>{q("organization_domain_cleared",{organization_id:e.id,email_domain:c}),j(),T.success("Domain removed")},t[30]=c,t[31]=j,t[32]=e.id,t[33]=v):v=t[33];let _;t[34]!==c||t[35]!==e.id?(_=l=>{q("organization_domain_clear_failed",{organization_id:e.id,email_domain:c,error:l instanceof Error?l.message:String(l)}),T.error(l instanceof Error?l.message:"Failed to remove domain")},t[34]=c,t[35]=e.id,t[36]=_):_=t[36];let k;t[37]!==S||t[38]!==v||t[39]!==_?(k={mutationFn:S,onSuccess:v,onError:_},t[37]=S,t[38]=v,t[39]=_,t[40]=k):k=t[40];const P=W(k);let A;t[41]!==a||t[42]!==c||t[43]!==e.id?(A=async l=>{if(!c)return;q("organization_auto_join_toggled",{organization_id:e.id,enabled:l});const L=await a.callTool({name:"ORGANIZATION_DOMAIN_UPDATE",arguments:{autoJoinEnabled:l}});return V(L)},t[41]=a,t[42]=c,t[43]=e.id,t[44]=A):A=t[44];let I;t[45]!==j?(I=()=>{j(),T.success("Auto-join setting updated")},t[45]=j,t[46]=I):I=t[46];let O;t[47]!==e.id?(O=l=>{q("organization_auto_join_toggle_failed",{organization_id:e.id,error:l instanceof Error?l.message:String(l)}),T.error(l instanceof Error?l.message:"Failed to update auto-join")},t[47]=e.id,t[48]=O):O=t[48];let u;t[49]!==A||t[50]!==I||t[51]!==O?(u={mutationFn:A,onSuccess:I,onError:O},t[49]=A,t[50]=I,t[51]=O,t[52]=u):u=t[52];const F=W(u);if(r)return null;let R;t[53]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(X,{className:"p-0",children:[s.jsx(ee,{className:"text-sm",children:"Email Domain"}),s.jsx(_e,{className:"text-xs",children:"Claim your company's email domain so new users with matching emails can automatically join this organization."})]}),t[53]=R):R=t[53];let $;return t[54]!==z||t[55]!==D||t[56]!==P||t[57]!==c||t[58]!==m||t[59]!==F||t[60]!==d?($=s.jsxs(Y,{className:"p-6",children:[R,s.jsx(te,{className:"flex flex-col gap-4 p-0 pt-4",children:c?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(B,{className:"text-xs text-muted-foreground",children:"Claimed domain"}),s.jsx("p",{className:"text-sm font-medium",children:c})]}),s.jsx(M,{variant:"outline",size:"sm",onClick:()=>P.mutate(),disabled:P.isPending,children:"Remove"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(B,{className:"text-xs",children:"Auto-join"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Users with @",c," emails will automatically join this organization on signup."]})]}),s.jsx(Ae,{checked:z,onCheckedChange:l=>F.mutate(l),disabled:F.isPending})]})]}):D?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(B,{className:"text-xs text-muted-foreground",children:"Your domain"}),s.jsx("p",{className:"text-sm font-medium",children:d})]}),s.jsx(M,{size:"sm",onClick:()=>m.mutate(),disabled:m.isPending,children:m.isPending?"Claiming...":"Claim Domain"})]}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"No corporate email domain detected."})})]}),t[54]=z,t[55]=D,t[56]=P,t[57]=c,t[58]=m,t[59]=F,t[60]=d,t[61]=$):$=t[61],$}const re=["site-editor","site-diagnostics","ai-image","ai-research"],ne=8;function et(t,e,i){const o=e.find(a=>a.id===t);if(o)return{id:o.id,title:o.title,icon:o.icon,kind:"template"};const p=i.find(a=>a.id===t);return p?{id:t,title:p.title,icon:p.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function tt(t){const e=G.c(39),{agent:i,onRemove:o}=t;let p;e[0]!==i.id?(p={id:i.id},e[0]=i.id,e[1]=p):p=e[1];const{attributes:a,listeners:n,setNodeRef:C,transform:E,transition:N,isDragging:r}=Re(p);let f;e[2]!==E?(f=Le.Transform.toString(E),e[2]=E,e[3]=f):f=e[3];const g=r?.5:void 0,d=r?100:void 0;let c;e[4]!==f||e[5]!==g||e[6]!==d||e[7]!==N?(c={transform:f,transition:N,opacity:g,zIndex:d},e[4]=f,e[5]=g,e[6]=d,e[7]=N,e[8]=c):c=e[8];const z=c,D=r&&"shadow-lg";let x;e[9]!==D?(x=ye("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",D),e[9]=D,e[10]=x):x=e[10];const j=`Drag to reorder ${i.title}`;let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Be,{size:14}),e[11]=h):h=e[11];let y;e[12]!==a||e[13]!==n||e[14]!==j?(y=s.jsx("button",{type:"button",...a,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":j,children:h}),e[12]=a,e[13]=n,e[14]=j,e[15]=y):y=e[15];let b;e[16]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(xe,{size:14}),e[16]=b):b=e[16];let w;e[17]!==i.icon||e[18]!==i.title?(w=s.jsx(ae,{icon:i.icon,name:i.title,size:"xs",fallbackIcon:b}),e[17]=i.icon,e[18]=i.title,e[19]=w):w=e[19];let m;e[20]!==i.title?(m=s.jsx("span",{className:"text-sm text-foreground truncate",children:i.title}),e[20]=i.title,e[21]=m):m=e[21];const S=i.kind==="template"?"Template":i.kind==="custom"?"Custom agent":"Unavailable";let v;e[22]!==S?(v=s.jsx("span",{className:"text-xs text-muted-foreground",children:S}),e[22]=S,e[23]=v):v=e[23];let _;e[24]!==m||e[25]!==v?(_=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[m,v]}),e[24]=m,e[25]=v,e[26]=_):_=e[26];const k=`Remove ${i.title}`;let P;e[27]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(fe,{size:14}),e[27]=P):P=e[27];let A;e[28]!==o||e[29]!==k?(A=s.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":k,children:P}),e[28]=o,e[29]=k,e[30]=A):A=e[30];let I;return e[31]!==C||e[32]!==z||e[33]!==y||e[34]!==w||e[35]!==_||e[36]!==A||e[37]!==x?(I=s.jsxs("div",{ref:C,style:z,className:x,children:[y,w,_,A]}),e[31]=C,e[32]=z,e[33]=y,e[34]=w,e[35]=_,e[36]=A,e[37]=x,e[38]=I):I=e[38],I}function st(t){const e=G.c(48),{selectedIds:i,onAdd:o}=t,[p,a]=J.useState(!1),[n,C]=J.useState(""),E=ge();let N;e[0]!==i?(N=new Set(i),e[0]=i,e[1]=N):N=e[1];const r=N;let f,g,d,c,z,D,x,j,h,y,b,w,m;if(e[2]!==E||e[3]!==o||e[4]!==p||e[5]!==n||e[6]!==r){const P=n.toLowerCase();c=ie.filter(u=>!r.has(u.id)&&(!n||u.title.toLowerCase().includes(P)));let A;e[20]!==r?(A=u=>u.id!==null&&!De(u.id)&&!r.has(u.id),e[20]=r,e[21]=A):A=e[21],d=E.filter(A).filter(u=>!n||u.title.toLowerCase().includes(P));let I;e[22]!==o?(I=u=>{o(u),a(!1),C("")},e[22]=o,e[23]=I):I=e[23];const O=I;g=Ge,w=p,m=a,e[24]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(Ke,{asChild:!0,children:s.jsxs(M,{type:"button",variant:"outline",size:"sm",children:[s.jsx(Je,{size:14}),"Add agent"]})}),e[24]=z):z=e[24],f=Ue,h="w-[320px] p-0 overflow-hidden",y="start",e[25]!==n?(b=s.jsx(qe,{value:n,onChange:C,placeholder:"Search agents..."}),e[25]=n,e[26]=b):b=e[26],D="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",x=c.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),c.map(u=>s.jsxs("button",{type:"button",onClick:()=>O(u.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ae,{icon:u.icon,name:u.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:u.title})]},u.id))]}),j=d.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),d.map(u=>s.jsxs("button",{type:"button",onClick:()=>O(u.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(ae,{icon:u.icon,name:u.title,size:"xs",fallbackIcon:s.jsx(xe,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:u.title})]},u.id))]}),e[2]=E,e[3]=o,e[4]=p,e[5]=n,e[6]=r,e[7]=f,e[8]=g,e[9]=d,e[10]=c,e[11]=z,e[12]=D,e[13]=x,e[14]=j,e[15]=h,e[16]=y,e[17]=b,e[18]=w,e[19]=m}else f=e[7],g=e[8],d=e[9],c=e[10],z=e[11],D=e[12],x=e[13],j=e[14],h=e[15],y=e[16],b=e[17],w=e[18],m=e[19];let S;e[27]!==d||e[28]!==c.length||e[29]!==n?(S=c.length===0&&d.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=d,e[28]=c.length,e[29]=n,e[30]=S):S=e[30];let v;e[31]!==S||e[32]!==D||e[33]!==x||e[34]!==j?(v=s.jsxs("div",{className:D,children:[x,j,S]}),e[31]=S,e[32]=D,e[33]=x,e[34]=j,e[35]=v):v=e[35];let _;e[36]!==f||e[37]!==v||e[38]!==h||e[39]!==y||e[40]!==b?(_=s.jsxs(f,{className:h,align:y,children:[b,v]}),e[36]=f,e[37]=v,e[38]=h,e[39]=y,e[40]=b,e[41]=_):_=e[41];let k;return e[42]!==g||e[43]!==z||e[44]!==_||e[45]!==w||e[46]!==m?(k=s.jsxs(g,{open:w,onOpenChange:m,children:[z,_]}),e[42]=g,e[43]=z,e[44]=_,e[45]=w,e[46]=m,e[47]=k):k=e[47],k}function nt(){const t=G.c(60),e=Qe(),i=ge(),o=Ve();let p;t[0]!==e?.ids?(p=e?.ids??[...re],t[0]=e?.ids,t[1]=p):p=t[1];const a=p,[n,C]=J.useState(a);let E;t[2]!==n||t[3]!==a?(E=n.length!==a.length||n.some((l,L)=>l!==a[L]),t[2]=n,t[3]=a,t[4]=E):E=t[4];const N=E;let r;t[5]===Symbol.for("react.memo_cache_sentinel")?(r={activationConstraint:{distance:5}},t[5]=r):r=t[5];let f;t[6]===Symbol.for("react.memo_cache_sentinel")?(f={coordinateGetter:Me},t[6]=f):f=t[6];const g=Ee(le(Fe,r),le(Te,f));let d;t[7]!==n?(d=l=>{const{active:L,over:K}=l;if(!K||L.id===K.id)return;const H=n.indexOf(L.id),U=n.indexOf(K.id);H===-1||U===-1||C($e([...n],H,U))},t[7]=n,t[8]=d):d=t[8];const c=d;let z;t[9]!==n?(z=l=>{n.includes(l)||C([...n,l])},t[9]=n,t[10]=z):z=t[10];const D=z;let x;t[11]!==n?(x=l=>{C(n.filter(L=>L!==l))},t[11]=n,t[12]=x):x=t[12];const j=x;let h;t[13]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{C([...re])},t[13]=h):h=t[13];const y=h;let b;t[14]!==n||t[15]!==o?(b=()=>{o.mutate({ids:n},{onSuccess:()=>{q("default_home_agents_updated",{count:n.length,template_count:n.filter(it).length}),T.success("Default home agents updated")},onError:at})},t[14]=n,t[15]=o,t[16]=b):b=t[16];const w=b;let m,S,v,_,k,P,A;if(t[17]!==i||t[18]!==n||t[19]!==c||t[20]!==j||t[21]!==g||t[22]!==o.isPending){let l;t[30]!==i?(l=U=>et(U,ie,i),t[30]=i,t[31]=l):l=t[31];const L=n.map(l);v=Math.max(0,n.length-ne),S=Y,k="p-6";let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx(ee,{className:"text-sm",children:"Default home agents"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Choose which agents appear on the home view for everyone in this organization. Drag to reorder. Up to ",ne," tiles render on the home view."]})]}),t[32]=K):K=t[32];let H;t[33]===Symbol.for("react.memo_cache_sentinel")?(H=s.jsx(Se,{size:14}),t[33]=H):H=t[33],t[34]!==o.isPending?(P=s.jsxs(X,{className:"p-0 flex flex-row items-start justify-between gap-3",children:[K,s.jsxs(M,{type:"button",variant:"ghost",size:"sm",onClick:y,disabled:o.isPending,children:[H,"Reset defaults"]})]}),t[34]=o.isPending,t[35]=P):P=t[35],m=te,A="p-0 flex flex-col gap-3",_=L.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ie,{sensors:g,collisionDetection:Pe,onDragEnd:c,children:s.jsx(ke,{items:n,strategy:Oe,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:L.map((U,he)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[he===ne&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(tt,{agent:U,onRemove:()=>j(U.id)})]},U.id))})})}),t[17]=i,t[18]=n,t[19]=c,t[20]=j,t[21]=g,t[22]=o.isPending,t[23]=m,t[24]=S,t[25]=v,t[26]=_,t[27]=k,t[28]=P,t[29]=A}else m=t[23],S=t[24],v=t[25],_=t[26],k=t[27],P=t[28],A=t[29];let I;t[36]!==n||t[37]!==D?(I=s.jsx(st,{selectedIds:n,onAdd:D}),t[36]=n,t[37]=D,t[38]=I):I=t[38];let O;t[39]!==v?(O=v>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[v," agent",v===1?"":"s"," won't fit on the home view"]}),t[39]=v,t[40]=O):O=t[40];let u;t[41]!==I||t[42]!==O?(u=s.jsxs("div",{className:"flex items-center justify-between",children:[I,O]}),t[41]=I,t[42]=O,t[43]=u):u=t[43];let F;t[44]!==m||t[45]!==_||t[46]!==u||t[47]!==A?(F=s.jsxs(m,{className:A,children:[_,u]}),t[44]=m,t[45]=_,t[46]=u,t[47]=A,t[48]=F):F=t[48];let R;t[49]!==w||t[50]!==a||t[51]!==N||t[52]!==o.isPending?(R=N&&s.jsxs(ue,{className:"p-0 pt-2 gap-2",children:[s.jsx(M,{type:"button",onClick:w,disabled:o.isPending,children:o.isPending?"Saving…":"Save"}),s.jsx(M,{type:"button",variant:"outline",onClick:()=>C(a),disabled:o.isPending,children:"Cancel"})]}),t[49]=w,t[50]=a,t[51]=N,t[52]=o.isPending,t[53]=R):R=t[53];let $;return t[54]!==S||t[55]!==k||t[56]!==P||t[57]!==F||t[58]!==R?($=s.jsxs(S,{className:k,children:[P,F,R]}),t[54]=S,t[55]=k,t[56]=P,t[57]=F,t[58]=R,t[59]=$):$=t[59],$}function at(t){T.error(t instanceof Error?t.message:"Failed to update default home agents")}function it(t){return ie.some(e=>e.id===t)}function ot(){const t=G.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(X,{className:"p-0",children:s.jsx(ee,{className:"text-sm",children:"Default home agents"})}),t[0]=e):e=t[0];let i;return t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(Y,{className:"p-6",children:[e,s.jsx(te,{className:"p-0 flex flex-col gap-2",children:Array.from({length:4}).map(lt)})]}),t[1]=i):i=t[1],i}function lt(t,e){return s.jsx(He,{className:"h-12 w-full rounded-lg"},e)}function rt(){const t=G.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(J.Suspense,{fallback:s.jsx(ot,{}),children:s.jsx(nt,{})}),t[0]=e):e=t[0],e}function ct(){const t=G.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Q,{children:s.jsx(Q.Content,{children:s.jsx(Q.Body,{children:s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx(Q.Title,{children:"Organization"}),s.jsx(Ye,{}),s.jsx(Xe,{}),s.jsx(rt,{})]})})})}),t[0]=e):e=t[0],e}function Zt(){const t=G.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ct,{}),t[0]=e):e=t[0],e}export{Zt as default};