decocms 4.329.8 → 4.330.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 (274) hide show
  1. package/dist/client/assets/{AlertCircle-CYzgJoBY.js → AlertCircle-jy0frqbf.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DAY89ljM.js → AreaChart-B1x8DVFG.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-DbqXNp4F.js → ArrowLeft-BUQYrPiB.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-BoD_mzsH.js → ArrowUp-Avwdkd90.js} +1 -1
  5. package/dist/client/assets/{Check-DTtdlqwY.js → Check-CxhsqO-U.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-COo3JoVL.js → CheckCircle-FHm0D3iO.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CzHqvH7E.js → ChevronRight-BiHn5vM-.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-DyPLbF1-.js → ChevronSelectorVertical-BbRv2olL.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DW8NdY2L.js → ChevronUp-DKezAGzO.js} +1 -1
  10. package/dist/client/assets/{Copy01-CJm4cfCT.js → Copy01-Bmz39xbH.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-CjfdxBcA.js → CreditCard01-C5e5Hx42.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-BtJeAJ0k.js → DotsVertical-8AlMAR5c.js} +1 -1
  13. package/dist/client/assets/{Download01-vFzjwQsB.js → Download01-CPeLy8ol.js} +1 -1
  14. package/dist/client/assets/{ErrorBarContext-Dc6l3YK0.js → ErrorBarContext-3LhkDp4X.js} +1 -1
  15. package/dist/client/assets/{Eye-B218eqe6.js → Eye-DusgBAO3.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-BS5U0z6G.js → GitBranch01-CfVfwURq.js} +1 -1
  17. package/dist/client/assets/{Globe01-cK6XwV5G.js → Globe01-wWGdeE3H.js} +1 -1
  18. package/dist/client/assets/{HardDrive-CuWaM4M_.js → HardDrive-CA1tnjg8.js} +1 -1
  19. package/dist/client/assets/{Image01-tcHGSkc1.js → Image01-DYzKv2ko.js} +1 -1
  20. package/dist/client/assets/{Key01-JyLu0I4O.js → Key01-CGEDvfUF.js} +1 -1
  21. package/dist/client/assets/{Link01-CdgOMLbc.js → Link01-DXelhbvI.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-CQuu9G7s.js → LinkExternal01-DNSJJFeL.js} +1 -1
  23. package/dist/client/assets/{Monitor01-7FxykVXR.js → Monitor01-CH4zCn1-.js} +1 -1
  24. package/dist/client/assets/{Package-DJDm2xPv.js → Package-Z0p4dNPa.js} +1 -1
  25. package/dist/client/assets/{Palette-C64d0Iko.js → Palette-3dQlQIWI.js} +1 -1
  26. package/dist/client/assets/{Play-J7yukJwM.js → Play-DsDbYPnC.js} +1 -1
  27. package/dist/client/assets/{Plus-CqaGj-ml.js → Plus-sgFP0HSc.js} +1 -1
  28. package/dist/client/assets/{SearchMd-Bc3Mg8g_.js → SearchMd-DUxlDNtX.js} +1 -1
  29. package/dist/client/assets/{Sector-hJmrO2Op.js → Sector-B74hc5Ef.js} +1 -1
  30. package/dist/client/assets/{Settings02-BOeVFu7a.js → Settings02-BiZT44gx.js} +1 -1
  31. package/dist/client/assets/{Share07-8fkbsMDg.js → Share07-BUsrOXMs.js} +1 -1
  32. package/dist/client/assets/{Shield01-CVfgL569.js → Shield01-BkWJSg7j.js} +1 -1
  33. package/dist/client/assets/{Stars01-jhCTR7KB.js → Stars01-D42AB0fG.js} +1 -1
  34. package/dist/client/assets/{Sun-CrsI3Qul.js → Sun-CCthEe37.js} +1 -1
  35. package/dist/client/assets/{Tool01-pzhJg-K8.js → Tool01-Bww8mLXx.js} +1 -1
  36. package/dist/client/assets/{Tool02-BOHPr8jH.js → Tool02-CMTwSQ00.js} +1 -1
  37. package/dist/client/assets/{Trash01-sRqUo9Qp.js → Trash01-Cy8JukTX.js} +1 -1
  38. package/dist/client/assets/{TrendUp01-Upn209vz.js → TrendUp01-C1Wh3jCv.js} +1 -1
  39. package/dist/client/assets/{Upload01-D7ygRA1o.js → Upload01-Vx_sWXby.js} +1 -1
  40. package/dist/client/assets/{User01-DGyK5bBG.js → User01-wgouKLSs.js} +1 -1
  41. package/dist/client/assets/{UserSquare-BTio6asa.js → UserSquare-1xv6DUe1.js} +1 -1
  42. package/dist/client/assets/{Users01-D_2eWavO.js → Users01-C6KwtT99.js} +1 -1
  43. package/dist/client/assets/{Users03-DcaeZQDc.js → Users03-EPnVo0bB.js} +1 -1
  44. package/dist/client/assets/{XCircle-CWgi5YJD.js → XCircle-DiB9hL7i.js} +1 -1
  45. package/dist/client/assets/{XClose-RbRtPt7h.js → XClose-C1xUyQZv.js} +1 -1
  46. package/dist/client/assets/{Zap-BLJmtEf5.js → Zap-DSXl6Hp2.js} +1 -1
  47. package/dist/client/assets/{ZoomOut-DUEecXAV.js → ZoomOut-C-2R5l8I.js} +1 -1
  48. package/dist/client/assets/{access-gate-BWlhuXYE.js → access-gate-BdiZftQz.js} +1 -1
  49. package/dist/client/assets/{agent-icon-DMaKG5lr.js → agent-icon-CyHpCstK.js} +1 -1
  50. package/dist/client/assets/agents-list-KDoq76g0.js +1 -0
  51. package/dist/client/assets/ai-providers-BrVf1e6J.js +1 -0
  52. package/dist/client/assets/{alert-DcVkxaWg.js → alert-CFsymptD.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-B0Wnos4x.js → alert-dialog-DW1zmq7a.js} +1 -1
  54. package/dist/client/assets/{analytics-tab-CG2_5LPK.js → analytics-tab-BlBfbh2a.js} +1 -1
  55. package/dist/client/assets/api-keys-D3sWWgsA.js +1 -0
  56. package/dist/client/assets/{api-keys-BbHLdUSi.js → api-keys-S2LvxycO.js} +1 -1
  57. package/dist/client/assets/app-editor-DFmDheE3.js +1 -0
  58. package/dist/client/assets/{auth-DT85eno9.js → auth-DgZXO_E8.js} +1 -1
  59. package/dist/client/assets/{auth-catchall-BTZcD6Ld.js → auth-catchall-BpojlvjI.js} +1 -1
  60. package/dist/client/assets/{auth-entry-CmR2PPN5.js → auth-entry-DB4_abZA.js} +1 -1
  61. package/dist/client/assets/{auth-split-layout-BVRJV6zs.js → auth-split-layout-DsZoXTVd.js} +1 -1
  62. package/dist/client/assets/{authenticate-and-persist-oauth-DiW6CIxv.js → authenticate-and-persist-oauth-BXQocgtU.js} +1 -1
  63. package/dist/client/assets/{automation-list-row-6pOr0T1Y.js → automation-list-row-C5K4rGy8.js} +1 -1
  64. package/dist/client/assets/{automation-runs-DIUeXIwb.js → automation-runs-CbmnlhbC.js} +1 -1
  65. package/dist/client/assets/automations-DlejsTXn.js +1 -0
  66. package/dist/client/assets/{avatar-DcREOm3L.js → avatar-BHNnQU49.js} +1 -1
  67. package/dist/client/assets/{badge-CIvTSfE9.js → badge-Df0POpHX.js} +1 -1
  68. package/dist/client/assets/{block-document-ByUVXxfb.js → block-document-C9jm1koE.js} +1 -1
  69. package/dist/client/assets/{breadcrumb-DxzlsCMh.js → breadcrumb-EUBB2GC0.js} +1 -1
  70. package/dist/client/assets/{buckets-C-g-jUwK.js → buckets-B_HtmkX0.js} +1 -1
  71. package/dist/client/assets/{bulk-category-panel-Du8CckpT.js → bulk-category-panel-WadLNqYR.js} +1 -1
  72. package/dist/client/assets/{capability-load-error-BY9CwF2C.js → capability-load-error-D_PjnnSN.js} +1 -1
  73. package/dist/client/assets/{cards-Cjaru-PI.js → cards-gW-s4zlH.js} +1 -1
  74. package/dist/client/assets/category-editor-Dsjpm8Rs.js +1 -0
  75. package/dist/client/assets/{cdn-tab-By_GCpOq.js → cdn-tab-OVIvDZML.js} +1 -1
  76. package/dist/client/assets/{chart-BGxiKDVj.js → chart-CQ4Em7wn.js} +1 -1
  77. package/dist/client/assets/chat-context-DPbGstfa.js +35 -0
  78. package/dist/client/assets/{checkbox-Rut1nZw7.js → checkbox-CUAxY5xy.js} +1 -1
  79. package/dist/client/assets/{choose-editor-ND0-BV8h.js → choose-editor-CqIcKKAC.js} +1 -1
  80. package/dist/client/assets/{cli-auth-success-DpX_C5l9.js → cli-auth-success-osB4eK21.js} +1 -1
  81. package/dist/client/assets/{client-icons-ButLhVRb.js → client-icons-ErQpUWbT.js} +1 -1
  82. package/dist/client/assets/collection-detail-D3FBmEm5.js +1 -0
  83. package/dist/client/assets/{collection-display-button-nN-lUfYD.js → collection-display-button-AMsRk-So.js} +1 -1
  84. package/dist/client/assets/{collection-search-BL14Irul.js → collection-search-C22mEeLw.js} +1 -1
  85. package/dist/client/assets/{collection-table-wrapper-CIYTBYGm.js → collection-table-wrapper-BJ3Neq9J.js} +1 -1
  86. package/dist/client/assets/{collection-tabs-DVTsrZPo.js → collection-tabs-DTwxsscI.js} +1 -1
  87. package/dist/client/assets/{command-D5rI_pln.js → command-CRqAgH1a.js} +1 -1
  88. package/dist/client/assets/{commerce-onboarding-B5SaVRRE.js → commerce-onboarding-B6_VUkvw.js} +1 -1
  89. package/dist/client/assets/{connect-BA3sxO4p.js → connect-CxVuoW2Z.js} +1 -1
  90. package/dist/client/assets/{connect-layout-C5Hqqfnf.js → connect-layout-sj45J0Mr.js} +1 -1
  91. package/dist/client/assets/{connection-5_SGsrJ3.js → connection-BWzxBGaR.js} +1 -1
  92. package/dist/client/assets/{connection-card-CEJ-3Q6u.js → connection-card-FOWu6o2x.js} +1 -1
  93. package/dist/client/assets/connection-detail-CiSJLPae.js +1 -0
  94. package/dist/client/assets/{connection-form-helpers-DNcNmxy2.js → connection-form-helpers-tCou3o46.js} +1 -1
  95. package/dist/client/assets/{connections-BeNTX4my.js → connections-DBSoZzyn.js} +1 -1
  96. package/dist/client/assets/{create-organization-dialog-D0uQn9pr.js → create-organization-dialog-Crs_YDp8.js} +1 -1
  97. package/dist/client/assets/{decopilot-sse-pool-Czf55XZy.js → decopilot-sse-pool-BrId94vM.js} +1 -1
  98. package/dist/client/assets/{dialog-0Gin8X8J.js → dialog-BdUmjS4-.js} +1 -1
  99. package/dist/client/assets/{domain-settings-BuPT2UUR.js → domain-settings-CTbN1J2P.js} +1 -1
  100. package/dist/client/assets/{drawer-CUXFxduO.js → drawer-D36n-WIv.js} +1 -1
  101. package/dist/client/assets/{dropdown-menu-DeCqeum7.js → dropdown-menu-Dn-LBZem.js} +1 -1
  102. package/dist/client/assets/e2e-tab--nH1lXQP.js +1 -0
  103. package/dist/client/assets/{editor-CMBiwHdj.js → editor-CyAR_I_A.js} +1 -1
  104. package/dist/client/assets/{empty-state-BMKkn0m1.js → empty-state-DLmWbVUB.js} +1 -1
  105. package/dist/client/assets/{empty-state-CY8_Cebe.js → empty-state-DxSmwhAQ.js} +1 -1
  106. package/dist/client/assets/{extract-connection-data-B5gRedj8.js → extract-connection-data-B1I5FGQh.js} +1 -1
  107. package/dist/client/assets/file-explorer-Cbb3XtE4.js +2 -0
  108. package/dist/client/assets/{file-type-icon-DLapffwQ.js → file-type-icon-CVdgx22A.js} +1 -1
  109. package/dist/client/assets/{folder-icon-ivTRZQTW.js → folder-icon-D_WY3arE.js} +1 -1
  110. package/dist/client/assets/{form-C74AeBpT.js → form-BvhSFZHb.js} +1 -1
  111. package/dist/client/assets/{general-aFZP0hTu.js → general-WcU5fWyG.js} +1 -1
  112. package/dist/client/assets/{github-repo-picker-BjPuSYO7.js → github-repo-picker-Cz94q9dS.js} +1 -1
  113. package/dist/client/assets/hooks-SuxNrCzM.js +15 -0
  114. package/dist/client/assets/{hosting-tab-B5mhtZwB.js → hosting-tab-Vlb9Z9ng.js} +1 -1
  115. package/dist/client/assets/index-5qx3FSW_.js +1 -0
  116. package/dist/client/assets/{index-pC2bMkiH.js → index-B18-trnw.js} +1 -1
  117. package/dist/client/assets/{index-tsFJqqt0.js → index-BKZihWQd.js} +1 -1
  118. package/dist/client/assets/index-Ba4EfV0C.js +1 -0
  119. package/dist/client/assets/{index-oIBCiETt.js → index-BjTjNr_G.js} +1 -1
  120. package/dist/client/assets/index-BqRfxAzW.css +1 -0
  121. package/dist/client/assets/{index-2Csvi9Ws.js → index-BxLEr4iz.js} +1 -1
  122. package/dist/client/assets/{index-D1rygici.js → index-CWs8c_71.js} +1 -1
  123. package/dist/client/assets/index-Cd2r3_aA.js +823 -0
  124. package/dist/client/assets/{index-C2cblsfq.js → index-D87zQKXw.js} +2 -2
  125. package/dist/client/assets/{index-ODKhlf52.js → index-lSAvH_rL.js} +7 -7
  126. package/dist/client/assets/{index-redirect-C-DOsnBP.js → index-redirect-BL62_A_W.js} +1 -1
  127. package/dist/client/assets/{infra-billing-Cf5Mc_mR.js → infra-billing-jIqLmoI5.js} +1 -1
  128. package/dist/client/assets/{input-CiTQTJk4.js → input-BdcqHmsD.js} +1 -1
  129. package/dist/client/assets/{integration-icon-Kez26Bfu.js → integration-icon-DTTuvbMM.js} +1 -1
  130. package/dist/client/assets/{invite-member-dialog-CTgMfbpu.js → invite-member-dialog-BW87V_xF.js} +1 -1
  131. package/dist/client/assets/{label-D5NpFiWm.js → label-DFynpq17.js} +1 -1
  132. package/dist/client/assets/{layout-DQMqmKJS.js → layout-CF6grxfQ.js} +1 -1
  133. package/dist/client/assets/{login-DRErB2mB.js → login-DtED1ahd.js} +1 -1
  134. package/dist/client/assets/{markdown-ChK7BSCx.js → markdown-t8p7flD6.js} +1 -1
  135. package/dist/client/assets/{mcp-oauth-C6LUe73x.js → mcp-oauth-DomiX3XJ.js} +1 -1
  136. package/dist/client/assets/{members-DG5bct9N.js → members-Ctc7ayH9.js} +1 -1
  137. package/dist/client/assets/{monaco-editor-DiwjqzwB.js → monaco-editor-mHVc8yep.js} +1 -1
  138. package/dist/client/assets/{monitoring-stats-row-C5tcYCvm.js → monitoring-stats-row-CL1X09To.js} +1 -1
  139. package/dist/client/assets/{multi-select-BO9dCDUw.js → multi-select-Tgem-Hhf.js} +1 -1
  140. package/dist/client/assets/{oauth-callback-0MJlUH-S.js → oauth-callback-GxJ6DISd.js} +1 -1
  141. package/dist/client/assets/{oauth-callback-ai-provider-DSefmt9u.js → oauth-callback-ai-provider-Dgp581R5.js} +1 -1
  142. package/dist/client/assets/{onboarding-BLTEUpJB.js → onboarding-CItp4Z7f.js} +1 -1
  143. package/dist/client/assets/org-layout-D6ojmqyV.js +1 -0
  144. package/dist/client/assets/{organization-choice-dtiSw3mB.js → organization-choice-CKJgJUKz.js} +1 -1
  145. package/dist/client/assets/{orgs-BBdc_gdn.js → orgs-B2ojCkix.js} +1 -1
  146. package/dist/client/assets/page-seo-form-w8HjBh5r.js +1 -0
  147. package/dist/client/assets/{popover-B6ROvgSp.js → popover-DqoSLPyP.js} +1 -1
  148. package/dist/client/assets/post-calendar-09DAXKhm.js +1 -0
  149. package/dist/client/assets/post-editor-D5yb1Jd9.js +1 -0
  150. package/dist/client/assets/{primitives-BS0YBv3z.js → primitives-DTr9rusv.js} +1 -1
  151. package/dist/client/assets/{profile-Bgd1J_38.js → profile-DQHF82sh.js} +1 -1
  152. package/dist/client/assets/project-app-view-BON2Qo3G.js +1 -0
  153. package/dist/client/assets/{project-icon-Bvj4Gwi2.js → project-icon-BIuwk_d_.js} +1 -1
  154. package/dist/client/assets/{prompts-B9luRw0U.js → prompts-DBh87Nh-.js} +1 -1
  155. package/dist/client/assets/record-editor-Dfnjy26m.js +1 -0
  156. package/dist/client/assets/redirect-editor-Dx846JCn.js +1 -0
  157. package/dist/client/assets/registry-DtIvqOVY.js +2 -0
  158. package/dist/client/assets/{registry-layout-m9ny3Ck1.js → registry-layout-DSBGNtl3.js} +1 -1
  159. package/dist/client/assets/{reports-DrKm2A3y.js → reports-DXwcd3N8.js} +1 -1
  160. package/dist/client/assets/{require-capability-CJzBqa0H.js → require-capability-BRvSlC3v.js} +1 -1
  161. package/dist/client/assets/{required-auth-layout-46OxjUc_.js → required-auth-layout-DFpZjgWz.js} +1 -1
  162. package/dist/client/assets/{reset-password-BYWuu2XK.js → reset-password-CSt7aD-W.js} +1 -1
  163. package/dist/client/assets/{review-settings-CQvsPguG.js → review-settings-ll1dG96m.js} +1 -1
  164. package/dist/client/assets/{roles-Cj-x86Nu.js → roles-BkIPtp-o.js} +1 -1
  165. package/dist/client/assets/{schema-R1g-EDIW.js → schema-CnLqwTPD.js} +1 -1
  166. package/dist/client/assets/{scroll-area-CyEB6Rif.js → scroll-area-PP_r4msI.js} +1 -1
  167. package/dist/client/assets/{search-input-C-9S8K7N.js → search-input-DfOXuzww.js} +1 -1
  168. package/dist/client/assets/{secrets-B5p1nQc3.js → secrets-5A0vK4C0.js} +1 -1
  169. package/dist/client/assets/sections-editor-Dm7uM18_.js +2 -0
  170. package/dist/client/assets/{select-CCKtBWNQ.js → select-DX41f4VA.js} +1 -1
  171. package/dist/client/assets/{select-model-BCM4tHqQ.js → select-model-DtEtPkIv.js} +1 -1
  172. package/dist/client/assets/{self-tool-result-CB7a4d84.js → self-tool-result-CdKMJCXt.js} +1 -1
  173. package/dist/client/assets/seo-editor-aQO3Fni3.js +1 -0
  174. package/dist/client/assets/settings-layout-CeJtjB19.js +1 -0
  175. package/dist/client/assets/{settings-sidebar-oq61_zef.js → settings-sidebar-q0M_1AHR.js} +1 -1
  176. package/dist/client/assets/{shell-controls-DQmP8qqR.js → shell-controls-C6dFl2EC.js} +1 -1
  177. package/dist/client/assets/shell-layout-gA5hZo5F.js +1 -0
  178. package/dist/client/assets/{skill-preview-CYNoZHVT.js → skill-preview-DXO3ykC1.js} +1 -1
  179. package/dist/client/assets/{skills-BqlqfSub.js → skills-BYoh3bJo.js} +1 -1
  180. package/dist/client/assets/{sso-BhHRmReI.js → sso-BI0wGWNb.js} +1 -1
  181. package/dist/client/assets/store-registry-UiEHPHdI.js +2 -0
  182. package/dist/client/assets/{store-sl44HVx4.js → store-w5DiLQdh.js} +1 -1
  183. package/dist/client/assets/{switch-BSSC0yiV.js → switch-DW4RRppR.js} +1 -1
  184. package/dist/client/assets/synced-repos-DGuZHHJX.js +1 -0
  185. package/dist/client/assets/{table-C7uS2-l8.js → table-Cc0JpHRt.js} +1 -1
  186. package/dist/client/assets/{tabs-DUurzPXg.js → tabs-C_0yZwsZ.js} +1 -1
  187. package/dist/client/assets/{task-board-BvGOyekg.js → task-board-DkI8yDIf.js} +1 -1
  188. package/dist/client/assets/task-route-jBzYs7u0.js +1 -0
  189. package/dist/client/assets/{tasks-CELgKnJC.js → tasks-_uhom2KC.js} +1 -1
  190. package/dist/client/assets/{textarea-BCk4dtJd.js → textarea-Dyj892-C.js} +1 -1
  191. package/dist/client/assets/thread-intent-Bbkl_NvG.js +1 -0
  192. package/dist/client/assets/thread-route-C9hr7yjZ.js +1 -0
  193. package/dist/client/assets/{toggle-group-DUxN50gx.js → toggle-group-DuOU3Yna.js} +1 -1
  194. package/dist/client/assets/{toolbar-CpbKvwTx.js → toolbar-DIlFGJBQ.js} +1 -1
  195. package/dist/client/assets/{toolbar-icon-button-TSDDGjeV.js → toolbar-icon-button-CGvKs4Hb.js} +1 -1
  196. package/dist/client/assets/{track-CI8Z9Nn_.js → track-BQLynX7D.js} +1 -1
  197. package/dist/client/assets/{types-D6t6wY6o.js → types-yL1rZwC2.js} +1 -1
  198. package/dist/client/assets/{use-ai-providers-DId9f_Qw.js → use-ai-providers-C4A-yG8S.js} +1 -1
  199. package/dist/client/assets/{use-automations-2ubkGlfv.js → use-automations-D1LLY7GK.js} +1 -1
  200. package/dist/client/assets/{use-autosave-Mr0lCg24.js → use-autosave-S3BS9dJB.js} +1 -1
  201. package/dist/client/assets/{use-connection-B9U-_dTx.js → use-connection-DIMvnEsW.js} +1 -1
  202. package/dist/client/assets/{use-copy-BYJ7CaVl.js → use-copy-CDL_kFPB.js} +1 -1
  203. package/dist/client/assets/{use-create-virtual-mcp-DST-jZww.js → use-create-virtual-mcp-BZjj2wtD.js} +1 -1
  204. package/dist/client/assets/{use-debounced-autosave-C9AvD0on.js → use-debounced-autosave-ClxVXQPW.js} +1 -1
  205. package/dist/client/assets/{use-debounced-value-M3lA0gS1.js → use-debounced-value-BTGahjD6.js} +1 -1
  206. package/dist/client/assets/{use-decopilot-events-xXOXhSly.js → use-decopilot-events-qYtca9N_.js} +1 -1
  207. package/dist/client/assets/{use-delete-connection-DTstMy3G.js → use-delete-connection-DArfbR_g.js} +1 -1
  208. package/dist/client/assets/{use-deployment-admin-AaReR26C.js → use-deployment-admin-DZgxyu-a.js} +1 -1
  209. package/dist/client/assets/{use-destination-route-BeQrBWgu.js → use-destination-route-CTNH3xDX.js} +1 -1
  210. package/dist/client/assets/{use-file-configs-C_EM4mvl.js → use-file-configs-C93nUH97.js} +1 -1
  211. package/dist/client/assets/{use-infinite-scroll-CDUEa5S7.js → use-infinite-scroll-DeU5Rpn4.js} +1 -1
  212. package/dist/client/assets/{use-join-requests-BuCWhDtK.js → use-join-requests-DSWsS1rN.js} +1 -1
  213. package/dist/client/assets/{use-mcp-auth-status-DSpPtB7I.js → use-mcp-auth-status-upTMow-Z.js} +1 -1
  214. package/dist/client/assets/{use-mcp-client-qAu1HRUD.js → use-mcp-client-llSiXbX8.js} +1 -1
  215. package/dist/client/assets/{use-mcp-prompts-BAjC4pC7.js → use-mcp-prompts-BOxAK29u.js} +1 -1
  216. package/dist/client/assets/{use-members-BaNaE65J.js → use-members-D_V3G9Gd.js} +1 -1
  217. package/dist/client/assets/use-navigate-to-agent-BooqwyPz.js +5 -0
  218. package/dist/client/assets/{use-org-auth-client-5qGP3Zwp.js → use-org-auth-client-BWThb-V9.js} +1 -1
  219. package/dist/client/assets/{use-org-sso-aiWQ_yZD.js → use-org-sso-DJzTKHrH.js} +1 -1
  220. package/dist/client/assets/{use-organization-roles-NtCfioQO.js → use-organization-roles-CrdtsKsA.js} +1 -1
  221. package/dist/client/assets/{use-organization-settings-BAq06qOp.js → use-organization-settings-BfIVlNk5.js} +1 -1
  222. package/dist/client/assets/{use-panel-navigate-D0FLl0De.js → use-panel-navigate-yCX_W63n.js} +1 -1
  223. package/dist/client/assets/{use-registry-connections-CPuanPK4.js → use-registry-connections-8jKgVSu8.js} +1 -1
  224. package/dist/client/assets/{use-secrets-CY_AzLwb.js → use-secrets-CHDcCDFt.js} +1 -1
  225. package/dist/client/assets/{use-section-preview-base-C6o3t9h3.js → use-section-preview-base-Bnck9XZi.js} +1 -1
  226. package/dist/client/assets/{use-status-sounds-YxnY0Jfq.js → use-status-sounds-D3Nv9moR.js} +1 -1
  227. package/dist/client/assets/{use-tags-simcuqdM.js → use-tags-Bjvv3Ict.js} +1 -1
  228. package/dist/client/assets/{use-view-mode-R_1UfMb3.js → use-view-mode-Bj7dvmOc.js} +1 -1
  229. package/dist/client/assets/{use-virtual-mcp-Dx_0SK12.js → use-virtual-mcp-C5WBYfhP.js} +1 -1
  230. package/dist/client/assets/useInfiniteQuery-DO69sta5.js +1 -0
  231. package/dist/client/assets/useSuspenseInfiniteQuery-BqTEtPhA.js +1 -0
  232. package/dist/client/assets/{users-sBtDdUBj.js → users-8qyHeXl2.js} +1 -1
  233. package/dist/client/assets/variant-calendar-CoASsVeg.js +1 -0
  234. package/dist/client/assets/{view-mode-toggle-H9lV8AEB.js → view-mode-toggle-BOnt9KuJ.js} +1 -1
  235. package/dist/client/index.html +2 -2
  236. package/dist/server/cli.js +3 -3
  237. package/dist/server/server.js +3 -3
  238. package/package.json +1 -1
  239. package/dist/client/assets/agents-list-CRt1ehIK.js +0 -1
  240. package/dist/client/assets/ai-providers-BtjXKwnq.js +0 -1
  241. package/dist/client/assets/api-keys-3svZys7S.js +0 -1
  242. package/dist/client/assets/app-editor-H_jf6ZSO.js +0 -1
  243. package/dist/client/assets/automations-DslAi47a.js +0 -1
  244. package/dist/client/assets/category-editor-DQYrxHNB.js +0 -1
  245. package/dist/client/assets/chat-context-Bn5sHwf1.js +0 -35
  246. package/dist/client/assets/collection-detail-CYJs4kAG.js +0 -1
  247. package/dist/client/assets/connection-detail-C29oiyCC.js +0 -1
  248. package/dist/client/assets/download-app-dialog-yVzVS3rF.js +0 -1
  249. package/dist/client/assets/e2e-tab-Cn7KUYQA.js +0 -1
  250. package/dist/client/assets/file-explorer-D_HrILPb.js +0 -2
  251. package/dist/client/assets/hooks-Bf7O-39q.js +0 -15
  252. package/dist/client/assets/index-But2h6S5.js +0 -1
  253. package/dist/client/assets/index-COScVnc4.js +0 -1
  254. package/dist/client/assets/index-DN9-7YC2.css +0 -1
  255. package/dist/client/assets/index-DPHTbKBf.js +0 -823
  256. package/dist/client/assets/org-layout-BPW6S66q.js +0 -1
  257. package/dist/client/assets/page-seo-form-CzuPQI7W.js +0 -1
  258. package/dist/client/assets/post-calendar-MJw63X6E.js +0 -1
  259. package/dist/client/assets/post-editor-nRZKH-yS.js +0 -1
  260. package/dist/client/assets/project-app-view-BWJaeVo5.js +0 -1
  261. package/dist/client/assets/record-editor-D6sziHec.js +0 -1
  262. package/dist/client/assets/redirect-editor-C1qkZok5.js +0 -1
  263. package/dist/client/assets/registry-SbozeoJx.js +0 -2
  264. package/dist/client/assets/sections-editor-D1XxplAs.js +0 -2
  265. package/dist/client/assets/seo-editor-B3J5DDhZ.js +0 -1
  266. package/dist/client/assets/settings-layout-By8rC2bm.js +0 -1
  267. package/dist/client/assets/shell-layout-BS92F-1s.js +0 -1
  268. package/dist/client/assets/store-registry-CRB-WnCk.js +0 -2
  269. package/dist/client/assets/synced-repos-DlYcoUmF.js +0 -1
  270. package/dist/client/assets/task-route-CmxVMFRO.js +0 -1
  271. package/dist/client/assets/use-navigate-to-agent-Cc5iyUAP.js +0 -5
  272. package/dist/client/assets/useInfiniteQuery-Ce5rZxD_.js +0 -1
  273. package/dist/client/assets/useSuspenseInfiniteQuery-T_0Ug6bp.js +0 -1
  274. package/dist/client/assets/variant-calendar-Dy4t2mk7.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decocms",
3
- "version": "4.329.8",
3
+ "version": "4.330.0",
4
4
  "description": "Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- import{c as he,b as ue,j as o,v as Ae,ab as Ie,B as le,b2 as Te,W as ye,n as Le,a as Fe,r as Q,m as ke,K as xe,e as Ee,o as U,t as pe,l as Pe,b8 as Ge,P as de}from"./index-ODKhlf52.js";import{a as ce,b as we,D as ge,c as fe}from"./dropdown-menu-DeCqeum7.js";import{b as Me}from"./Users03-DcaeZQDc.js";import{G as ve,b as ze,a as Oe}from"./github-repo-picker-BjPuSYO7.js";import{a as Be,b as Ue,c as Re}from"./use-virtual-mcp-Dx_0SK12.js";import{i as $e}from"./DotsVertical-BtJeAJ0k.js";import{a as Ve}from"./Settings02-BOeVFu7a.js";import{s as He}from"./Trash01-sRqUo9Qp.js";import{p as Ke,f as je}from"./pt-BR-CLy76QW2.js";import{A as qe,b8 as Qe}from"./agent-icon-DMaKG5lr.js";import{u as _e}from"./use-navigate-to-agent-Cc5iyUAP.js";import{l as Je}from"./use-organization-settings-BAq06qOp.js";import{E as We}from"./empty-state-BMKkn0m1.js";import{u as Ye}from"./use-create-virtual-mcp-DST-jZww.js";import{u as Xe}from"./use-connection-B9U-_dTx.js";import{u as be}from"./use-mcp-client-qAu1HRUD.js";import{S as Ze}from"./constants-DNuUCxmW.js";import{F as et,G as tt}from"./chat-context-Bn5sHwf1.js";import{b as ot,f as st,a as it,G as rt,p as nt}from"./provision-repo-scoped-github-connection-WQFARyHG.js";import{D as lt,b as at,c as ct,d as mt,e as dt}from"./dialog-0Gin8X8J.js";import{i as ut}from"./ArrowLeft-DbqXNp4F.js";import{C as pt}from"./collection-search-BL14Irul.js";import{c as gt,d as ft,b as ht,f as xt,g as jt,e as bt,a as Ct,A as Dt}from"./alert-dialog-B0Wnos4x.js";import{S as yt}from"./search-input-C-9S8K7N.js";import{s as Ce}from"./Plus-CqaGj-ml.js";import{u as wt}from"./use-debounced-value-M3lA0gS1.js";import"./Check-DTtdlqwY.js";import"./ChevronRight-CzHqvH7E.js";import"./authenticate-and-persist-oauth-DiW6CIxv.js";import"./mcp-oauth-C6LUe73x.js";import"./auth-DT85eno9.js";import"./LinkExternal01-CQuu9G7s.js";import"./Share07-8fkbsMDg.js";import"./extract-connection-data-B5gRedj8.js";import"./metadata-dUsYcpuu.js";import"./connection-5_SGsrJ3.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./AlertCircle-CYzgJoBY.js";import"./Tool01-pzhJg-K8.js";import"./ArrowUp-BoD_mzsH.js";import"./Tool02-BOHPr8jH.js";import"./XCircle-CWgi5YJD.js";import"./TrendUp01-Upn209vz.js";import"./ZoomOut-DUEecXAV.js";import"./CheckCircle-COo3JoVL.js";import"./ChevronUp-DW8NdY2L.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./UserSquare-BTio6asa.js";import"./Copy01-CJm4cfCT.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Eye-B218eqe6.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./XClose-RbRtPt7h.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Key01-JyLu0I4O.js";import"./Link01-CdgOMLbc.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Play-J7yukJwM.js";import"./SearchMd-Bc3Mg8g_.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Upload01-D7ygRA1o.js";import"./User01-DGyK5bBG.js";import"./Users01-D_2eWavO.js";import"./Zap-BLJmtEf5.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./task-board-BvGOyekg.js";import"./schema-R1g-EDIW.js";import"./github-repo-COLY3wWI.js";import"./use-panel-navigate-D0FLl0De.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";function De(t){const e=he.c(26),{onCreateFromScratch:r,onImportGitHub:i,onImportDeco:l,isCreating:b,align:y,side:M,showBetaBadge:f,showDecoImport:w}=t,v=y===void 0?"end":y,p=ue();let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Me,{size:14}),e[0]=d):d=e[0];let g;e[1]!==p?(g=p("common.createAgentDropdown.createFromScratch"),e[1]=p,e[2]=g):g=e[2];let c;e[3]!==b||e[4]!==r||e[5]!==g?(c=o.jsxs(ce,{disabled:b,onClick:r,children:[d,g]}),e[3]=b,e[4]=r,e[5]=g,e[6]=c):c=e[6];let _;e[7]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ve,{className:"size-3.5"}),e[7]=_):_=e[7];let m;e[8]!==p?(m=p("common.createAgentDropdown.importFromGitHub"),e[8]=p,e[9]=m):m=e[9];let n;e[10]!==f?(n=f&&o.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[10]=f,e[11]=n):n=e[11];let a;e[12]!==i||e[13]!==m||e[14]!==n?(a=o.jsxs(ce,{onClick:i,children:[_,m,n]}),e[12]=i,e[13]=m,e[14]=n,e[15]=a):a=e[15];let u;e[16]!==l||e[17]!==w||e[18]!==p?(u=w&&o.jsxs(ce,{onClick:l,children:[o.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),p("common.createAgentDropdown.importFromDeco")]}),e[16]=l,e[17]=w,e[18]=p,e[19]=u):u=e[19];let h;return e[20]!==v||e[21]!==M||e[22]!==c||e[23]!==a||e[24]!==u?(h=o.jsxs(we,{side:M,align:v,className:"w-48",children:[c,a,u]}),e[20]=v,e[21]=M,e[22]=c,e[23]=a,e[24]=u,e[25]=h):h=e[25],h}function vt(t){const e=he.c(50),{project:r,lastUsedAt:i,onDeleteClick:l}=t,b=_e(),y=ue(),[M]=Ae(),f=M.language==="pt-BR"?Ke:void 0,w=r.metadata?.ui?.layout;let v;e[0]!==w?(v=Ie(w),e[0]=w,e[1]=v):v=e[1];const p=v;let d;e[2]!==p||e[3]!==b||e[4]!==r.id?(d=()=>b(r.id,{panel:p}),e[2]=p,e[3]=b,e[4]=r.id,e[5]=d):d=e[5];let g;e[6]!==r.title||e[7]!==d?(g=o.jsx("button",{type:"button",onClick:d,className:"absolute inset-0 z-0","aria-label":r.title}),e[6]=r.title,e[7]=d,e[8]=g):g=e[8];let c;e[9]!==r.icon||e[10]!==r.title?(c=o.jsx(qe,{icon:r.icon,name:r.title,size:"sm",className:"shrink-0 shadow-sm"}),e[9]=r.icon,e[10]=r.title,e[11]=c):c=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(ge,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx($e,{size:20})})}),e[12]=_):_=e[12];let m;e[13]!==b||e[14]!==r.id?(m=()=>b(r.id,{panel:"settings"}),e[13]=b,e[14]=r.id,e[15]=m):m=e[15];let n;e[16]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ve,{size:16}),e[16]=n):n=e[16];let a;e[17]!==m?(a=o.jsxs(ce,{onClick:m,children:[n,"Settings"]}),e[17]=m,e[18]=a):a=e[18];let u;e[19]!==l?(u=l&&o.jsxs(ce,{variant:"destructive",onClick:C=>{C.stopPropagation(),l(C)},children:[o.jsx(He,{size:16}),"Delete"]}),e[19]=l,e[20]=u):u=e[20];let h;e[21]!==u||e[22]!==a?(h=o.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:o.jsxs(fe,{children:[_,o.jsxs(we,{align:"end",children:[a,u]})]})}),e[21]=u,e[22]=a,e[23]=h):h=e[23];let x;e[24]!==h||e[25]!==c?(x=o.jsxs("div",{className:"flex items-start justify-between",children:[c,h]}),e[24]=h,e[25]=c,e[26]=x):x=e[26];let z;e[27]!==r.title?(z=o.jsx("div",{className:"flex items-center gap-2 min-w-0",children:o.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:r.title})}),e[27]=r.title,e[28]=z):z=e[28];const E=r.description||"No description";let P;e[29]!==E?(P=o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:E}),e[29]=E,e[30]=P):P=e[30];let S;e[31]!==z||e[32]!==P?(S=o.jsxs("div",{className:"flex flex-col gap-1",children:[z,P]}),e[31]=z,e[32]=P,e[33]=S):S=e[33];let I;e[34]!==x||e[35]!==S?(I=o.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[x,S]}),e[34]=x,e[35]=S,e[36]=I):I=e[36];let T;e[37]!==i||e[38]!==f||e[39]!==r.updated_at||e[40]!==y?(T=i?y("home.projectCard.lastUsed",{time:je(new Date(i),{addSuffix:!0,locale:f})}):y("home.projectCard.updated",{time:je(new Date(r.updated_at),{addSuffix:!0,locale:f})}),e[37]=i,e[38]=f,e[39]=r.updated_at,e[40]=y,e[41]=T):T=e[41];let N;e[42]!==T?(N=o.jsx("div",{className:"border-t border-border mt-auto",children:o.jsx("div",{className:"h-10 flex items-center px-4.5",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:T})})}),e[42]=T,e[43]=N):N=e[43];let j;e[44]!==I||e[45]!==N?(j=o.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[I,N]}),e[44]=I,e[45]=N,e[46]=j):j=e[46];let s;return e[47]!==j||e[48]!==g?(s=o.jsxs(Te,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[g,j]}),e[47]=j,e[48]=g,e[49]=s):s=e[49],s}const _t="deco-sites";function St(t){if(!t||typeof t!="object")return null;const e=t.github;if(!e||typeof e!="object")return null;const r=e.owner,i=e.repo;return typeof r!="string"||typeof i!="string"||r.length===0||i.length===0?null:{owner:r,repo:i}}function Nt(t,e){const r=e?St(e):null,i=r?.owner??_t,l=r?.repo??t;return{owner:i,name:l,url:`https://github.com/${i}/${l}`}}function At(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function Se(t,e,r){const i=await fetch(t,e),l=await i.json().catch(()=>({}));if(!i.ok)throw new Error(l.error??`${r} (${i.status})`);return l}function It(t){return Se(`/api/${t}/deco-sites`,void 0,"Failed to load sites")}function Tt({open:t,onOpenChange:e,onBack:r}){const i=ue(),{org:l}=ye(),b=_e(),y=Le(),{data:M}=Fe.useSession(),[f,w]=Q.useState(null),[v,p]=Q.useState(null),[d,g]=Q.useState(""),c=be({connectionId:Ze,orgId:l.id,orgSlug:l.slug}),_=Xe({slug:"mcp-github"}),m=ot(_),n=ze({enabled:t&&m.length===0}),a=m.length===1?m[0]??null:v,u=m.length>1&&!a,h=be({connectionId:a?.id??"",orgId:l.id,orgSlug:l.slug}),x=t&&m.length===0&&(n.status==="installing"||n.status==="authenticating"||n.status==="idle"),{data:z,isLoading:E,error:P}=ke({queryKey:xe.decoSites(M?.user?.email),queryFn:()=>It(l.slug),enabled:t&&!!M?.user?.email,staleTime:6e4,retry:!1}),S=z?.sites??[],I=s=>{s||(w(null),p(null),g("")),e(s)},T=S.filter(s=>s.name.toLowerCase().includes(d.toLowerCase())||(s.domains?.[0]?.domain?.toLowerCase().includes(d.toLowerCase())??!1)),N=!f||T.some(s=>s.name===f),j=Ee({mutationFn:async s=>{if(!a)throw new Error(i("common.importFromDecoDialog.githubNotConnected"));U("deco_site_import_started",{site_name:s});const{installations:C}=await st(k=>c.callTool(k),a.id),L=S.find(k=>k.name===s);if(!L)throw new Error(i("common.importFromDecoDialog.siteNoLongerAvailable"));const D=Nt(s,L.metadata),F=it(C,D.owner);if(!F)throw new Error(i("common.importFromDecoDialog.installGithubApp",{owner:D.owner,installUrl:rt}));let O=null,K=null;const ae=async()=>{K&&await c.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:K}}).catch(()=>{}),O&&await c.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:O,force:!0}}).catch(()=>{})};try{const k=await Se(`/api/${l.slug}/deco-sites/prepare`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:s})},i("common.importFromDecoDialog.failedToPrepareImport")),{childConnectionId:B,reused:H}=await nt({orgSlug:l.slug,sourceConnection:a,installationId:F.installationId,owner:D.owner,repo:D.name,githubCallTool:q=>h.callTool(q),selfCallTool:q=>c.callTool(q)});O=H?null:B;const R=k.icon??null,J=At(s),W=s.toLowerCase(),$=et(s),V=await c.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:s,description:"Imported from deco.cx",pinned:!1,icon:R??null,metadata:{instructions:null,enabled_plugins:[],siteSlug:W,previewServerUrl:$,productionUrl:$,githubRepo:{owner:D.owner,name:D.name,url:D.url,installationId:F.installationId,connectionId:B},ui:{banner:null,bannerColor:"#22C55E",icon:R,themeColor:"#22C55E",slug:J,pinnedViews:null,layout:{defaultMainView:{type:"site-editor"},chatDefaultOpen:!1}}},connections:[{connection_id:B}]}}}),G=V.structuredContent??V;if(!G.item?.id)throw new Error(i("common.importFromDecoDialog.failedToCreateAgent"));return K=G.item.id,{slug:J,virtualMcpId:G.item.id,item:G.item}}catch(k){throw await ae(),k}},onSuccess:({slug:s,virtualMcpId:C,item:L})=>{U("deco_site_import_succeeded",{site_name:L.title,virtual_mcp_id:C,slug:s}),y.setQueryData(xe.collectionItem(c,l.id,"","VIRTUAL_MCP",C),{item:L}),y.invalidateQueries({predicate:D=>{const F=D.queryKey;return F[1]===l.id&&F[3]==="collection"&&F[4]==="VIRTUAL_MCP"}}),pe.success(i("common.importFromDecoDialog.importSuccess",{slug:s})),I(!1),b(C)},onError:s=>{U("deco_site_import_failed",{error:s instanceof Error?s.message:"Unknown error"}),pe.error(i("common.importFromDecoDialog.importFailed",{error:(s instanceof Error?s.message:i("common.importFromDecoDialog.unknownError"))??""}))}});return o.jsx(lt,{open:t,onOpenChange:I,children:o.jsxs(at,{className:"sm:max-w-[900px] p-0 gap-0 overflow-hidden",children:[o.jsx(ct,{className:"sr-only",children:o.jsx(mt,{children:i("common.importFromDecoDialog.title")})}),o.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[r&&o.jsx("button",{type:"button",onClick:r,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":i("common.importFromDecoDialog.goBack"),children:o.jsx(ut,{size:18})}),o.jsx("span",{className:"text-sm font-medium text-foreground",children:i("common.importFromDecoDialog.title")})]}),o.jsx("div",{children:o.jsx(pt,{value:d,onChange:g,placeholder:i("common.importFromDecoDialog.searchPlaceholder"),onKeyDown:s=>{s.key==="Escape"&&g("")}})}),o.jsxs("div",{className:"pb-0 min-h-[300px]",children:[n.status==="error"&&o.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 h-48 px-8 text-center",children:[o.jsx("p",{className:"text-sm text-destructive",children:n.error??i("common.importFromDecoDialog.failedToConnectGithub")}),o.jsx(le,{variant:"outline",size:"sm",onClick:n.retry,children:i("common.importFromDecoDialog.retryGithubSetup")})]}),x&&n.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.settingUpGithub")}),u&&!x&&n.status!=="error"&&o.jsxs("div",{className:"flex flex-col py-2",children:[o.jsx("div",{className:"px-8 py-2",children:o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:i("common.importFromDecoDialog.selectGithubConnection")})}),m.map(s=>o.jsxs("button",{type:"button",onClick:()=>p(s),className:"flex items-center gap-3 px-8 py-3 hover:bg-accent transition-colors text-left",children:[s.icon?o.jsx("img",{src:s.icon,alt:s.title,className:"size-7 rounded-full shrink-0"}):o.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:o.jsx(ve,{className:"size-3.5 text-muted-foreground"})}),o.jsx("span",{className:"text-sm font-medium",children:s.title})]},s.id))]}),E&&!x&&n.status!=="error"&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.loadingSites")}),!E&&!x&&!u&&n.status!=="error"&&!P&&S.length===0&&o.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:i("common.importFromDecoDialog.noSitesFound")}),!E&&!x&&!u&&n.status!=="error"&&S.length>0&&o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[T.length===0&&o.jsx("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:i("common.importFromDecoDialog.noSitesMatch",{search:d})}),T.map(s=>{const C=tt(s.domains),L=f===s.name;return o.jsxs("button",{type:"button",onClick:()=>w(s.name),className:Pe("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",L?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:s.thumb_url?o.jsx("img",{src:s.thumb_url,alt:s.name,className:"w-full h-full object-cover",loading:"lazy"}):o.jsx("div",{className:"w-full h-full bg-muted"})}),o.jsxs("div",{className:"px-4 py-3",children:[o.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:s.name}),C&&o.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:C})]})]},s.name)})]})]}),o.jsxs(dt,{className:"px-8 py-5 border-t border-border",children:[o.jsx(le,{variant:"outline",onClick:()=>I(!1),disabled:j.isPending,children:i("common.importFromDecoDialog.cancel")}),o.jsx(le,{disabled:!f||!N||j.isPending||E||x||u||!a||n.status==="error",onClick:()=>f&&j.mutate(f),children:j.isPending?i("common.importFromDecoDialog.importing"):i("common.importFromDecoDialog.import")})]})]})})}function ms(){const t=he.c(82),e=ue(),{org:r}=ye(),[i,l]=Q.useState(""),b=wt(i,300);let y;t[0]!==b?(y={searchTerm:b},t[0]=b,t[1]=y):y=t[1];const M=Be(y),f=Ue();let w;t[2]===Symbol.for("react.memo_cache_sentinel")?(w={navigateOnCreate:!0},t[2]=w):w=t[2];const{createVirtualMCP:v,isCreating:p}=Ye(w),[d,g]=Q.useState(null),[c,_]=Q.useState(!1),[m,n]=Q.useState(!1),{granted:a}=Ge("agents:manage"),u=Je();let h;t[3]!==r?(h=A=>A.id!==r.id,t[3]=r,t[4]=h):h=t[4];const x=M.filter(h),{data:z}=Re(x.map(Lt));let E;t[5]!==f||t[6]!==d||t[7]!==e?(E=async()=>{if(!d)return;const{id:A,title:Ne}=d;g(null);try{await f.delete.mutateAsync(A),U("agent_deleted",{agent_id:A,source:"agents_list"}),pe.success(e("routes.agentsList.deletedAgent",{title:Ne}))}catch{}},t[5]=f,t[6]=d,t[7]=e,t[8]=E):E=t[8];const P=E,S=de,I=de,T=de;let N;t[9]!==e?(N=e("routes.agentsList.title"),t[9]=e,t[10]=N):N=t[10];let j;t[11]!==N?(j=o.jsx(de.Title,{children:N}),t[11]=N,t[12]=j):j=t[12];let s;t[13]!==e?(s=e("routes.agentsList.searchPlaceholder"),t[13]=e,t[14]=s):s=t[14];let C;t[15]===Symbol.for("react.memo_cache_sentinel")?(C=A=>{A.key==="Escape"&&(l(""),A.target.blur())},t[15]=C):C=t[15];let L;t[16]!==i||t[17]!==s?(L=o.jsx(yt,{value:i,onChange:l,placeholder:s,className:"w-full md:w-[375px]",onKeyDown:C}),t[16]=i,t[17]=s,t[18]=L):L=t[18];let D;t[19]!==a||t[20]!==v||t[21]!==p||t[22]!==u||t[23]!==e?(D=a&&o.jsxs(fe,{children:[o.jsx(ge,{asChild:!0,children:o.jsxs(le,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(De,{onCreateFromScratch:()=>{U("agent_create_clicked",{source:"agents_list",method:"scratch"}),v()},onImportGitHub:()=>{U("agent_create_clicked",{source:"agents_list",method:"github"}),n(!0)},onImportDeco:()=>{U("agent_create_clicked",{source:"agents_list",method:"deco"}),_(!0)},isCreating:p,align:"end",showDecoImport:u})]}),t[19]=a,t[20]=v,t[21]=p,t[22]=u,t[23]=e,t[24]=D):D=t[24];let F;t[25]!==L||t[26]!==D?(F=o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[L,D]}),t[25]=L,t[26]=D,t[27]=F):F=t[27];let O;t[28]!==F||t[29]!==j?(O=o.jsxs("div",{className:"flex flex-col gap-6",children:[j,F]}),t[28]=F,t[29]=j,t[30]=O):O=t[30];const K=x.length===0&&o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(We,{image:o.jsx(Qe,{size:48,className:"text-muted-foreground"}),title:e(i?"routes.agentsList.noAgentsFound":"routes.agentsList.noAgentsYet"),description:i?e("routes.agentsList.noAgentsMatchSearch",{search:i}):e(a?"routes.agentsList.createAgentToGetStarted":"routes.agentsList.askAdminToCreate"),actions:!i&&a&&o.jsxs(fe,{children:[o.jsx(ge,{asChild:!0,children:o.jsxs(le,{size:"sm",children:[o.jsx(Ce,{size:14}),e("routes.agentsList.createAgent")]})}),o.jsx(De,{onCreateFromScratch:()=>{U("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),v()},onImportGitHub:()=>{U("agent_create_clicked",{source:"agents_list_empty",method:"github"}),n(!0)},onImportDeco:()=>{U("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),_(!0)},isCreating:p,align:"center",showBetaBadge:!0,showDecoImport:u})]})})}),ae=x.length>0&&o.jsxs("div",{className:"mt-6 @container",children:[o.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:e("routes.agentsList.agentsHeading")}),o.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:x.map(A=>o.jsx(vt,{project:A,lastUsedAt:z?.get(A.id)?.last_used_at,onDeleteClick:a?()=>g({id:A.id,title:A.title}):void 0},A.id))})]});let k;t[31]!==O||t[32]!==K||t[33]!==ae||t[34]!==T.Body?(k=o.jsxs(T.Body,{children:[O,K,ae]}),t[31]=O,t[32]=K,t[33]=ae,t[34]=T.Body,t[35]=k):k=t[35];let B;t[36]!==k||t[37]!==I.Content?(B=o.jsx(I.Content,{children:k}),t[36]=k,t[37]=I.Content,t[38]=B):B=t[38];let H;t[39]!==m?(H=o.jsx(Oe,{open:m,onOpenChange:n}),t[39]=m,t[40]=H):H=t[40];let R;t[41]!==c?(R=o.jsx(Tt,{open:c,onOpenChange:_}),t[41]=c,t[42]=R):R=t[42];const J=!!d;let W;t[43]===Symbol.for("react.memo_cache_sentinel")?(W=A=>!A&&g(null),t[43]=W):W=t[43];let $;t[44]!==e?($=e("routes.agentsList.deleteAgentTitle"),t[44]=e,t[45]=$):$=t[45];let V;t[46]!==$?(V=o.jsx(gt,{children:$}),t[46]=$,t[47]=V):V=t[47];let G;t[48]!==e?(G=e("routes.agentsList.deleteAgentDescription"),t[48]=e,t[49]=G):G=t[49];const q=d?.title;let Y;t[50]!==q?(Y=o.jsx("span",{className:"font-medium text-foreground",children:q}),t[50]=q,t[51]=Y):Y=t[51];let X;t[52]!==G||t[53]!==Y?(X=o.jsxs(ft,{children:[G," ",Y,"."]}),t[52]=G,t[53]=Y,t[54]=X):X=t[54];let Z;t[55]!==V||t[56]!==X?(Z=o.jsxs(ht,{children:[V,X]}),t[55]=V,t[56]=X,t[57]=Z):Z=t[57];let ee;t[58]!==e?(ee=e("routes.agentsList.cancelButton"),t[58]=e,t[59]=ee):ee=t[59];let te;t[60]!==ee?(te=o.jsx(xt,{children:ee}),t[60]=ee,t[61]=te):te=t[61];let oe;t[62]!==e?(oe=e("routes.agentsList.deleteButton"),t[62]=e,t[63]=oe):oe=t[63];let se;t[64]!==P||t[65]!==oe?(se=o.jsx(jt,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:oe}),t[64]=P,t[65]=oe,t[66]=se):se=t[66];let ie;t[67]!==te||t[68]!==se?(ie=o.jsxs(bt,{children:[te,se]}),t[67]=te,t[68]=se,t[69]=ie):ie=t[69];let re;t[70]!==Z||t[71]!==ie?(re=o.jsxs(Ct,{children:[Z,ie]}),t[70]=Z,t[71]=ie,t[72]=re):re=t[72];let ne;t[73]!==J||t[74]!==re?(ne=o.jsx(Dt,{open:J,onOpenChange:W,children:re}),t[73]=J,t[74]=re,t[75]=ne):ne=t[75];let me;return t[76]!==S||t[77]!==B||t[78]!==H||t[79]!==R||t[80]!==ne?(me=o.jsxs(S,{children:[B,H,R,ne]}),t[76]=S,t[77]=B,t[78]=H,t[79]=R,t[80]=ne,t[81]=me):me=t[81],me}function Lt(t){return t.id}export{ms as default};
@@ -1 +0,0 @@
1
- import{c as J,b as se,ar as Te,aq as Oe,r as W,j as s,as as et,dr as Fe,t as X,dq as Ie,dp as ke,b7 as Ue,W as be,a7 as re,n as je,e as le,K as te,m as Ke,b4 as $e,l as we,B as ee,v as qe,o as Ae,h as tt,ae as st,ag as Pe,dt as it}from"./index-ODKhlf52.js";import{i as lt}from"./AlertCircle-CYzgJoBY.js";import{u as He,b as _e,i as rt,c as ot,p as nt,d as De,e as at,f as ze}from"./use-ai-providers-DId9f_Qw.js";import{i as ct}from"./CheckCircle-COo3JoVL.js";import{b as dt,g as mt}from"./use-organization-settings-BAq06qOp.js";import{S as ut}from"./schema-R1g-EDIW.js";import{c as ft,d as Be,P as pt,C as Ee}from"./select-model-BCM4tHqQ.js";import{u as gt}from"./use-debounced-autosave-C9AvD0on.js";import{I as ye}from"./input-CiTQTJk4.js";import{a as Re,T as xt}from"./toggle-group-DUxN50gx.js";import{c as Ve,d as Le,b as Qe,f as Ge,g as Ye,e as We,a as Je,A as Xe}from"./alert-dialog-B0Wnos4x.js";import{s as ht}from"./Plus-CqaGj-ml.js";import{p as vt,f as yt}from"./pt-BR-CLy76QW2.js";import{a as bt}from"./Tool01-pzhJg-K8.js";import{s as jt}from"./Trash01-sRqUo9Qp.js";import{A as St}from"./avatar-DcREOm3L.js";import{P as Ct}from"./ai-providers-logos-DD3qZ33J.js";import{i as _t}from"./Settings02-BOeVFu7a.js";import{s as Nt}from"./Eye-B218eqe6.js";import{d as Pt,c as It,b as kt,D as Kt,e as Dt}from"./dialog-0Gin8X8J.js";import{R as wt}from"./require-capability-CJzBqa0H.js";import"./constants-DNuUCxmW.js";import"./task-board-BvGOyekg.js";import"./drawer-CUXFxduO.js";import"./chat-context-Bn5sHwf1.js";import"./use-panel-navigate-D0FLl0De.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./use-mcp-client-qAu1HRUD.js";import"./auth-DT85eno9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-Dx_0SK12.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./checkbox-Rut1nZw7.js";import"./Check-DTtdlqwY.js";import"./select-CCKtBWNQ.js";import"./ChevronUp-DW8NdY2L.js";import"./ArrowLeft-DbqXNp4F.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./Key01-JyLu0I4O.js";import"./SearchMd-Bc3Mg8g_.js";import"./Monitor01-7FxykVXR.js";import"./ChevronRight-CzHqvH7E.js";import"./download-app-dialog-yVzVS3rF.js";import"./Copy01-CJm4cfCT.js";import"./Download01-vFzjwQsB.js";import"./Image01-tcHGSkc1.js";import"./Stars01-jhCTR7KB.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./User01-DGyK5bBG.js";import"./access-gate-BWlhuXYE.js";import"./capability-load-error-BY9CwF2C.js";const At=e=>e.capabilities?.includes("image")===!0,Et=e=>rt(e),Rt=e=>ot(e),Mt=[{key:"fast",filter:void 0},{key:"smart",filter:void 0},{key:"thinking",filter:void 0},{key:"image",filter:At},{key:"web_search",filter:Et},{key:"deep_research",filter:Rt}];function Tt(e){const t=J.c(30),{slot:i,onSlotChange:o,filterModels:n,defaultKeyId:c}=e,a=He(),l=a.some(C=>C.id===i?.keyId)?i?.keyId:null,[u,_]=W.useState(l??c);let b,r;t[0]!==l?(b=()=>{l&&_(l)},r=[l],t[0]=l,t[1]=b,t[2]=r):(b=t[1],r=t[2]),W.useEffect(b,r);let p;t[3]!==a||t[4]!==c||t[5]!==u?(p=a.some(C=>C.id===u)?u:c,t[3]=a,t[4]=c,t[5]=u,t[6]=p):p=t[6];const m=p;let f;t[7]!==m||t[8]!==a?(f=m?a.find(C=>C.id===m):null,t[7]=m,t[8]=a,t[9]=f):f=t[9];const P=f,{models:h,isLoading:v}=_e(n?m??void 0:void 0),g=n?v||h.some(n):!0;let N;t[10]!==i||t[11]!==P?.providerId||t[12]!==l?(N=i&&l?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:P?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[10]=i,t[11]=P?.providerId,t[12]=l,t[13]=N):N=t[13];const k=N,x=se();if(n&&!g){let C;t[14]!==x?(C=x("settings.simpleModeSection.notAvailableWithCurrentProvider"),t[14]=x,t[15]=C):C=t[15];let K;return t[16]!==C?(K=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:C}),t[16]=C,t[17]=K):K=t[17],K}let j;t[18]!==x?(j=x("settings.simpleModeSection.pickModel"),t[18]=x,t[19]=j):j=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=C=>_(C),t[20]=S):S=t[20];let d;t[21]!==m||t[22]!==o?(d=C=>{const K=C.keyId??m??"";_(K),o({keyId:K,modelId:C.modelId,title:C.title})},t[21]=m,t[22]=o,t[23]=d):d=t[23];let y;return t[24]!==m||t[25]!==n||t[26]!==k||t[27]!==j||t[28]!==d?(y=s.jsx(ft,{variant:"bordered",placeholder:j,model:k,credentialId:m,filterModels:n,onCredentialChange:S,onModelChange:d}),t[24]=m,t[25]=n,t[26]=k,t[27]=j,t[28]=d,t[29]=y):y=t[29],y}function Ot(e){const t=J.c(10),{isPending:i,showSaved:o}=e,n=se();if(i){let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Ue,{size:12,className:"animate-spin"}),t[0]=c):c=t[0];let a;t[1]!==n?(a=n("settings.simpleModeSection.saving"),t[1]=n,t[2]=a):a=t[2];let l;return t[3]!==a?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,a]}),t[3]=a,t[4]=l):l=t[4],l}if(o){let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(ct,{size:12}),t[5]=c):c=t[5];let a;t[6]!==n?(a=n("settings.simpleModeSection.saved"),t[6]=n,t[7]=a):a=t[7];let l;return t[8]!==a?(l=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[c,a]}),t[8]=a,t[9]=l):l=t[9],l}return null}function Ft(){const e=J.c(58),t=se(),i=He(),o=dt(),n=i.length>0;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=Te(ut),e[0]=c):c=e[0];let a;e[1]!==o?(a={resolver:c,values:o,mode:"onChange"},e[1]=o,e[2]=a):a=e[2];const l=Oe(a),{mutate:u,isPending:_,isSuccess:b}=mt(),r=l.formState.isDirty;let p;e[3]!==l||e[4]!==o||e[5]!==t||e[6]!==u?(p={delayMs:250,save:async()=>{const I=l.getValues();u(I,{onSuccess:()=>l.reset(I,{keepValues:!0}),onError:T=>{l.reset(o),X.error(t("settings.simpleModeSection.failedToSave",{error:T.message}))}})}},e[3]=l,e[4]=o,e[5]=t,e[6]=u,e[7]=p):p=e[7];const{schedule:m}=gt(p),f=i[0],P=i[1],h=i[2],{models:v}=_e(f?.id),{models:g}=_e(P?.id),{models:N}=_e(h?.id);let k,x;e[8]!==l||e[9]!==n?(k=()=>{n||l.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},x=[n,l],e[8]=l,e[9]=n,e[10]=k,e[11]=x):(k=e[10],x=e[11]),W.useEffect(k,x);let j;e[12]!==i||e[13]!==l||e[14]!==f||e[15]!==P||e[16]!==h||e[17]!==v||e[18]!==g||e[19]!==N?(j=()=>{const I=l.getValues(),T=new Set(i.map(Ut)),O={};f?.id&&(O[f.id]=v),P?.id&&(O[P.id]=g),h?.id&&(O[h.id]=N);const M=Q=>Q!=null&&!T.has(Q.keyId),D={fast:M(I.tiers.fast)?null:I.tiers.fast,smart:M(I.tiers.smart)?null:I.tiers.smart,thinking:M(I.tiers.thinking)?null:I.tiers.thinking,image:M(I.tiers.image)?null:I.tiers.image,web_search:M(I.tiers.web_search)?null:I.tiers.web_search,deep_research:M(I.tiers.deep_research)?null:I.tiers.deep_research},G=!D.fast||!D.smart||!D.thinking||!D.image||!D.web_search||!D.deep_research,Y=D.fast===I.tiers.fast&&D.smart===I.tiers.smart&&D.thinking===I.tiers.thinking&&D.image===I.tiers.image&&D.web_search===I.tiers.web_search&&D.deep_research===I.tiers.deep_research;if(!G&&Y)return;const z=nt(i,O);l.reset({tiers:{fast:D.fast??z.chat.fast,smart:D.smart??z.chat.smart,thinking:D.thinking??z.chat.thinking,image:D.image??z.image,web_search:D.web_search??z.webSearch,deep_research:D.deep_research??z.deepResearch}},{keepDirty:!0})},e[12]=i,e[13]=l,e[14]=f,e[15]=P,e[16]=h,e[17]=v,e[18]=g,e[19]=N,e[20]=j):j=e[20];const S=f?.id,d=P?.id,y=h?.id;let C;e[21]!==i||e[22]!==l||e[23]!==v||e[24]!==g||e[25]!==N||e[26]!==S||e[27]!==d||e[28]!==y?(C=[l,i,v,g,N,S,d,y],e[21]=i,e[22]=l,e[23]=v,e[24]=g,e[25]=N,e[26]=S,e[27]=d,e[28]=y,e[29]=C):C=e[29],W.useEffect(j,C);let K;e[30]!==t?(K=I=>({fast:t("settings.simpleModeSection.tierFast"),smart:t("settings.simpleModeSection.tierSmart"),thinking:t("settings.simpleModeSection.tierThinking"),image:t("settings.simpleModeSection.tierImage"),web_search:t("settings.simpleModeSection.tierWebSearch"),deep_research:t("settings.simpleModeSection.tierDeepResearch")})[I]||I,e[30]=t,e[31]=K):K=e[31];const A=K;let w;e[32]!==t?(w=I=>({fast:t("settings.simpleModeSection.tierFastDesc"),smart:t("settings.simpleModeSection.tierSmartDesc"),thinking:t("settings.simpleModeSection.tierThinkingDesc"),image:t("settings.simpleModeSection.tierImageDesc"),web_search:t("settings.simpleModeSection.tierWebSearchDesc"),deep_research:t("settings.simpleModeSection.tierDeepResearchDesc")})[I]||"",e[32]=t,e[33]=w):w=e[33];const E=w;let R;e[34]!==t?(R=t("settings.simpleModeSection.defaultModels"),e[34]=t,e[35]=R):R=e[35];let F;e[36]!==t?(F=t("settings.simpleModeSection.modelsPowerDescription"),e[36]=t,e[37]=F):F=e[37];let B;e[38]!==F?(B=s.jsx("p",{className:"text-sm text-muted-foreground",children:F}),e[38]=F,e[39]=B):B=e[39];const L=b&&!r;let U;e[40]!==_||e[41]!==L?(U=s.jsx(Ot,{isPending:_,showSaved:L}),e[40]=_,e[41]=L,e[42]=U):U=e[42];let $;e[43]!==B||e[44]!==U?($=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[B,U]}),e[43]=B,e[44]=U,e[45]=$):$=e[45];let q;e[46]!==i[0]?.id||e[47]!==l.control||e[48]!==E||e[49]!==A||e[50]!==m?(q=Mt.map(I=>s.jsx(et,{control:l.control,name:`tiers.${I.key}`,render:T=>{const{field:O}=T;return s.jsx(Fe,{title:A(I.key),description:E(I.key),action:s.jsx(Tt,{slot:O.value,defaultKeyId:i[0]?.id??null,filterModels:I.filter,onSlotChange:M=>{O.onChange(M),m()}})})}},I.key)),e[46]=i[0]?.id,e[47]=l.control,e[48]=E,e[49]=A,e[50]=m,e[51]=q):q=e[51];let H;e[52]!==q?(H=s.jsx(Ie,{children:q}),e[52]=q,e[53]=H):H=e[53];let V;return e[54]!==R||e[55]!==$||e[56]!==H?(V=s.jsxs(ke,{title:R,headerClassName:"pl-0",children:[$,H]}),e[54]=R,e[55]=$,e[56]=H,e[57]=V):V=e[57],V}function Ut(e){return e.id}const $t={usd:[10,20,100],brl:[50,100,500]};function qt(){const e=J.c(30),t=se(),i=re(),[o]=qe(),[n,c]=W.useState(!1);let a;e[0]!==t?(a=d=>{X.error(t("settings.decoCreditsHero.topUpFailed",{message:d.message}))},e[0]=t,e[1]=a):a=e[1];const{mutate:l,isPending:u}=le({mutationFn:async d=>{const{url:y}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:d,currency:m});return y},onSuccess:Ht,onError:a}),[_,b]=W.useState(""),[r,p]=W.useState(o.language==="pt-BR"?"brl":"usd"),m=r,f=parseFloat(_),P=!isNaN(f)&&f>=1,h=m==="brl"?"R$":"$";let v;e[2]!==p?(v=d=>{d&&p(d)},e[2]=p,e[3]=v):v=e[3];let g,N;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Re,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),N=s.jsx(Re,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[4]=g,e[5]=N):(g=e[4],N=e[5]);let k;e[6]!==m||e[7]!==v?(k=s.jsxs(xt,{type:"single",variant:"outline",size:"default",value:m,onValueChange:v,children:[g,N]}),e[6]=m,e[7]=v,e[8]=k):k=e[8];let x;e[9]!==m||e[10]!==h||e[11]!==n||e[12]!==u||e[13]!==t||e[14]!==l?(x=!n&&s.jsxs(s.Fragment,{children:[$t[m].map(d=>s.jsxs(ee,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:u,onClick:()=>l(d*100),children:[h,d]},d)),s.jsx(ee,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>c(!0),disabled:u,children:t("settings.decoCreditsHero.custom")})]}),e[9]=m,e[10]=h,e[11]=n,e[12]=u,e[13]=t,e[14]=l,e[15]=x):x=e[15];let j;e[16]!==h||e[17]!==_||e[18]!==f||e[19]!==n||e[20]!==P||e[21]!==u||e[22]!==b||e[23]!==t||e[24]!==l?(j=n&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:h}),s.jsx(ye,{type:"number",min:"1",step:"1",placeholder:t("settings.decoCreditsHero.amountPlaceholder"),value:_,onChange:d=>b(d.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(ee,{className:"h-10",disabled:!P||u,onClick:()=>l(Math.round(f*100)),children:u?"...":t("settings.decoCreditsHero.add")}),s.jsx(ee,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{c(!1),b("")},children:t("settings.decoCreditsHero.cancel")})]}),e[16]=h,e[17]=_,e[18]=f,e[19]=n,e[20]=P,e[21]=u,e[22]=b,e[23]=t,e[24]=l,e[25]=j):j=e[25];let S;return e[26]!==k||e[27]!==x||e[28]!==j?(S=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[k,x,j]})}),e[26]=k,e[27]=x,e[28]=j,e[29]=S):S=e[29],S}function Ht(e){e&&window.open(e,"_blank","noopener,noreferrer")}function zt(e){return e<=0?"text-destructive":e<=1?"text-warning":"text-foreground"}function Bt(){const e=J.c(121),t=se(),{org:i}=be(),o=re(),n=je(),c=De();let a;e[0]!==c?(a=c.find(Vt),e[0]=c,e[1]=a):a=e[1];const l=a,[u,_]=W.useState(!1);let b;e[2]!==l||e[3]!==o?(b=async()=>{l&&await o.call("AI_PROVIDER_KEY_DELETE",{keyId:l.id})},e[2]=l,e[3]=o,e[4]=b):b=e[4];let r;e[5]!==i.id||e[6]!==n||e[7]!==t?(r=()=>{n.invalidateQueries({queryKey:te.aiProviderKeys(i.id)}),n.invalidateQueries({queryKey:te.aiProviders(i.id)}),X.success(t("settings.decoCreditsHero.disconnectSuccess")),_(!1)},e[5]=i.id,e[6]=n,e[7]=t,e[8]=r):r=e[8];let p;e[9]!==t?(p=Ze=>{X.error(t("settings.decoCreditsHero.disconnectError",{message:Ze.message}))},e[9]=t,e[10]=p):p=e[10];let m;e[11]!==b||e[12]!==r||e[13]!==p?(m={mutationFn:b,onSuccess:r,onError:p},e[11]=b,e[12]=r,e[13]=p,e[14]=m):m=e[14];const{mutate:f,isPending:P}=le(m);let h;e[15]!==i.id?(h=te.aiProviderCredits(i.id,"deco"),e[15]=i.id,e[16]=h):h=e[16];const v=!!l;let g;e[17]!==o?(g=async()=>{try{return await o.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[17]=o,e[18]=g):g=e[18];let N;e[19]!==h||e[20]!==v||e[21]!==g?(N={queryKey:h,enabled:v,staleTime:6e4,queryFn:g},e[19]=h,e[20]=v,e[21]=g,e[22]=N):N=e[22];const{data:k,isLoading:x,refetch:j,isFetching:S}=Ke(N);if(!l)return null;const d=k?.balanceCents!=null?k.balanceCents/100:null;let y;e[23]!==d?(y=d!=null?`$${d.toFixed(2)}`:"—",e[23]=d,e[24]=y):y=e[24];const C=y;let K;e[25]!==t?(K=t("settings.decoCreditsHero.title"),e[25]=t,e[26]=K):K=e[26];let A;e[27]!==t?(A=t("settings.decoCreditsHero.decoAiGatewayAlt"),e[27]=t,e[28]=A):A=e[28];let w;e[29]!==A?(w=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:A,className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),e[29]=A,e[30]=w):w=e[30];let E;e[31]!==t?(E=t("settings.decoCreditsHero.accessModels"),e[31]=t,e[32]=E):E=e[32];let R;e[33]!==E?(R=s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:E})}),e[33]=E,e[34]=R):R=e[34];let F;e[35]!==w||e[36]!==R?(F=s.jsxs("div",{className:"flex items-center gap-3",children:[w,R]}),e[35]=w,e[36]=R,e[37]=F):F=e[37];let B;e[38]===Symbol.for("react.memo_cache_sentinel")?(B=()=>_(!0),e[38]=B):B=e[38];let L;e[39]!==t?(L=t("settings.decoCreditsHero.disconnect"),e[39]=t,e[40]=L):L=e[40];let U;e[41]!==P||e[42]!==L?(U=s.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:B,disabled:P,children:L}),e[41]=P,e[42]=L,e[43]=U):U=e[43];let $;e[44]!==F||e[45]!==U?($=s.jsxs("div",{className:"flex items-center justify-between",children:[F,U]}),e[44]=F,e[45]=U,e[46]=$):$=e[46];let q;e[47]!==t?(q=t("settings.decoCreditsHero.disconnectTitle"),e[47]=t,e[48]=q):q=e[48];let H;e[49]!==q?(H=s.jsx(Ve,{children:q}),e[49]=q,e[50]=H):H=e[50];let V;e[51]!==t?(V=t("settings.decoCreditsHero.disconnectDescription"),e[51]=t,e[52]=V):V=e[52];let I;e[53]!==V?(I=s.jsx(Le,{children:V}),e[53]=V,e[54]=I):I=e[54];let T;e[55]!==H||e[56]!==I?(T=s.jsxs(Qe,{children:[H,I]}),e[55]=H,e[56]=I,e[57]=T):T=e[57];let O;e[58]!==t?(O=t("settings.decoCreditsHero.cancelButton"),e[58]=t,e[59]=O):O=e[59];let M;e[60]!==O?(M=s.jsx(Ge,{children:O}),e[60]=O,e[61]=M):M=e[61];let D;e[62]!==f?(D=()=>f(),e[62]=f,e[63]=D):D=e[63];let G;e[64]!==t?(G=t("settings.decoCreditsHero.disconnectButton"),e[64]=t,e[65]=G):G=e[65];let Y;e[66]!==D||e[67]!==G?(Y=s.jsx(Ye,{onClick:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:G}),e[66]=D,e[67]=G,e[68]=Y):Y=e[68];let z;e[69]!==M||e[70]!==Y?(z=s.jsxs(We,{children:[M,Y]}),e[69]=M,e[70]=Y,e[71]=z):z=e[71];let Q;e[72]!==T||e[73]!==z?(Q=s.jsxs(Je,{children:[T,z]}),e[72]=T,e[73]=z,e[74]=Q):Q=e[74];let ie;e[75]!==u||e[76]!==Q?(ie=s.jsx(Xe,{open:u,onOpenChange:_,children:Q}),e[75]=u,e[76]=Q,e[77]=ie):ie=e[77];let Z;e[78]!==d||e[79]!==C||e[80]!==S||e[81]!==x?(Z=x||S?s.jsx($e,{className:"h-9 w-24"}):s.jsx("span",{className:we("text-3xl font-semibold tabular-nums tracking-tight",d!=null&&zt(d)),children:C}),e[78]=d,e[79]=C,e[80]=S,e[81]=x,e[82]=Z):Z=e[82];let oe;e[83]!==j?(oe=()=>j(),e[83]=j,e[84]=oe):oe=e[84];let ne;e[85]!==t?(ne=t("settings.decoCreditsHero.refreshBalance"),e[85]=t,e[86]=ne):ne=e[86];const Ne=S&&"animate-spin";let ae;e[87]!==Ne?(ae=we(Ne),e[87]=Ne,e[88]=ae):ae=e[88];let ce;e[89]!==ae?(ce=s.jsx(Ue,{size:14,className:ae}),e[89]=ae,e[90]=ce):ce=e[90];let de;e[91]!==S||e[92]!==oe||e[93]!==ne||e[94]!==ce?(de=s.jsx("button",{type:"button",onClick:oe,disabled:S,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":ne,children:ce}),e[91]=S,e[92]=oe,e[93]=ne,e[94]=ce,e[95]=de):de=e[95];let me;e[96]!==Z||e[97]!==de?(me=s.jsxs("div",{className:"flex items-baseline gap-2",children:[Z,de]}),e[96]=Z,e[97]=de,e[98]=me):me=e[98];let ue;e[99]!==t?(ue=t("settings.decoCreditsHero.availableBalance"),e[99]=t,e[100]=ue):ue=e[100];let fe;e[101]!==ue?(fe=s.jsx("p",{className:"text-xs text-muted-foreground",children:ue}),e[101]=ue,e[102]=fe):fe=e[102];let pe;e[103]!==me||e[104]!==fe?(pe=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[me,fe]}),e[103]=me,e[104]=fe,e[105]=pe):pe=e[105];let ge;e[106]!==t?(ge=t("settings.decoCreditsHero.addCredits"),e[106]=t,e[107]=ge):ge=e[107];let xe;e[108]!==ge?(xe=s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:ge}),e[108]=ge,e[109]=xe):xe=e[109];let Se;e[110]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx(qt,{}),e[110]=Se):Se=e[110];let he;e[111]!==xe?(he=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[xe,Se]}),e[111]=xe,e[112]=he):he=e[112];let ve;e[113]!==$||e[114]!==ie||e[115]!==pe||e[116]!==he?(ve=s.jsx(Ie,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[$,ie,pe,he]})}),e[113]=$,e[114]=ie,e[115]=pe,e[116]=he,e[117]=ve):ve=e[117];let Ce;return e[118]!==K||e[119]!==ve?(Ce=s.jsx(ke,{title:K,children:ve}),e[118]=K,e[119]=ve,e[120]=Ce):Ce=e[120],Ce}function Vt(e){return e.providerId==="deco"}function Lt(){const e=J.c(12),{org:t}=be(),i=re(),o=je(),n=se();let c;e[0]!==i?(c=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=c):c=e[1];let a;e[2]!==t||e[3]!==o||e[4]!==n?(a=()=>{Ae("ai_provider_provision_succeeded",{provider_id:"deco"}),o.invalidateQueries({queryKey:te.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:te.aiProviders(t.id)}),X.success(n("settings.aiProviders.decoConnectSuccess"))},e[2]=t,e[3]=o,e[4]=n,e[5]=a):a=e[5];let l;e[6]!==n?(l=_=>{Ae("ai_provider_provision_failed",{provider_id:"deco",error:_.message}),X.error(n("settings.aiProviders.decoConnectError",{error:_.message}))},e[6]=n,e[7]=l):l=e[7];let u;return e[8]!==c||e[9]!==a||e[10]!==l?(u={mutationFn:c,onSuccess:a,onError:l},e[8]=c,e[9]=a,e[10]=l,e[11]=u):u=e[11],le(u)}function Qt(){const e=J.c(37),t=se(),{mutate:i,isPending:o}=Lt();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=n):n=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:n.join(", ")}}),e[1]=c):c=e[1];let a;e[2]!==t?(a=t("settings.decoNudgeCard.decoAiGateway"),e[2]=t,e[3]=a):a=e[3];let l;e[4]!==a?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:a,className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[4]=a,e[5]=l):l=e[5];let u;e[6]!==t?(u=t("settings.decoNudgeCard.decoAiGateway"),e[6]=t,e[7]=u):u=e[7];let _;e[8]!==u?(_=s.jsx("p",{className:"text-base font-semibold",children:u}),e[8]=u,e[9]=_):_=e[9];let b;e[10]!==t?(b=t("settings.decoNudgeCard.recommended"),e[10]=t,e[11]=b):b=e[11];let r;e[12]!==b?(r=s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:b}),e[12]=b,e[13]=r):r=e[13];let p;e[14]!==_||e[15]!==r?(p=s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[_,r]}),e[14]=_,e[15]=r,e[16]=p):p=e[16];let m;e[17]!==t?(m=t("settings.decoNudgeCard.description"),e[17]=t,e[18]=m):m=e[18];let f;e[19]!==m?(f=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[19]=m,e[20]=f):f=e[20];let P;e[21]!==f||e[22]!==p?(P=s.jsxs("div",{className:"flex-1 min-w-0",children:[p,f]}),e[21]=f,e[22]=p,e[23]=P):P=e[23];let h;e[24]!==i?(h=()=>i(),e[24]=i,e[25]=h):h=e[25];let v;e[26]!==o||e[27]!==t?(v=t(o?"settings.decoNudgeCard.connecting":"settings.decoNudgeCard.connectDeco"),e[26]=o,e[27]=t,e[28]=v):v=e[28];let g;e[29]!==o||e[30]!==h||e[31]!==v?(g=s.jsx(ee,{variant:"outline",disabled:o,onClick:h,children:v}),e[29]=o,e[30]=h,e[31]=v,e[32]=g):g=e[32];let N;return e[33]!==P||e[34]!==g||e[35]!==l?(N=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[c,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,P,g]})]}),e[33]=P,e[34]=g,e[35]=l,e[36]=N):N=e[36],N}const Gt=e=>st({label:Pe().min(1,e("settings.editProviderDialog.labelRequired")).max(100),apiKey:Pe().optional(),baseUrl:Pe().optional()});function Yt({isOpenAICompatible:e,baseUrl:t,currentBaseUrl:i,apiKey:o}){return e&&!!t&&t!==i&&!o}function Wt({providerKey:e,provider:t,preset:i,maskedKey:o,currentLabel:n,currentBaseUrl:c,onCancel:a,onSuccess:l}){const{org:u}=be(),_=re(),b=je(),r=se(),[p,m]=W.useState(!1),f=t.id==="openai-compatible",P=t.supportedMethods.includes("api-key"),h=Gt(r),{register:v,handleSubmit:g,watch:N,setError:k,formState:{errors:x}}=Oe({resolver:Te(h),defaultValues:{label:n,apiKey:"",baseUrl:c??""}}),j=N("apiKey")??"",{mutate:S,isPending:d}=le({mutationFn:async y=>{let C;y.apiKey&&(f?C=JSON.stringify({baseUrl:y.baseUrl||c||"",apiKey:y.apiKey}):C=y.apiKey),await _.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:y.label,...C!==void 0?{apiKey:C}:{}})},onSuccess:()=>{b.invalidateQueries({queryKey:te.aiProviderKeys(u.id)}),b.invalidateQueries({queryKey:te.aiProviders(u.id)}),X.success(r("settings.editProviderDialog.providerUpdated")),l()},onError:y=>X.error(r("settings.editProviderDialog.failedToUpdate",{error:y.message}))});return s.jsxs("form",{onSubmit:g(y=>{if(Yt({isOpenAICompatible:f,baseUrl:y.baseUrl,currentBaseUrl:c,apiKey:y.apiKey})){k("apiKey",{message:r("settings.editProviderDialog.apiKeyRequiredForBaseUrlChange")});return}S(y)}),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.label")}),s.jsx(ye,{placeholder:r("settings.editProviderDialog.labelPlaceholder"),...v("label"),className:"h-8 text-sm"}),x.label&&s.jsx("p",{className:"text-xs text-destructive",children:x.label.message})]}),f&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("settings.editProviderDialog.baseUrl")}),s.jsx(ye,{type:"url",placeholder:i?.baseUrlPlaceholder??r("settings.editProviderDialog.baseUrlPlaceholder"),...v("baseUrl"),className:"h-8 text-sm"})]}),P&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:[r("settings.editProviderDialog.apiKey")," ",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",r("settings.editProviderDialog.leaveBlankHint"),")"]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ye,{type:p&&j?"text":"password",placeholder:o,...v("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),j&&s.jsx("button",{type:"button",onClick:()=>m(!p),"aria-label":r(p?"settings.editProviderDialog.hideApiKey":"settings.editProviderDialog.showApiKey"),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:p?s.jsx(_t,{size:14}):s.jsx(Nt,{size:14})})]}),x.apiKey&&s.jsx("p",{className:"text-xs text-destructive",children:x.apiKey.message})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(Dt,{children:[s.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:a,disabled:d,children:r("settings.editProviderDialog.cancel")}),s.jsx(ee,{type:"submit",size:"sm",disabled:d,children:r(d?"settings.editProviderDialog.saving":"settings.editProviderDialog.save")})]})]})}function Jt(e){const t=J.c(31),{providerKey:i,provider:o,open:n,onOpenChange:c}=e,a=se(),l=re(),u=o.id==="openai-compatible"&&i.presetId?Be(i.presetId):void 0,_=u?.name??o.name;let b;t[0]!==i.id?(b=te.aiProviderKeyPreview(i.id),t[0]=i.id,t[1]=b):b=t[1];let r;t[2]!==i.id||t[3]!==l?(r=()=>l.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[2]=i.id,t[3]=l,t[4]=r):r=t[4];let p;t[5]!==n||t[6]!==b||t[7]!==r?(p={queryKey:b,queryFn:r,enabled:n,staleTime:0},t[5]=n,t[6]=b,t[7]=r,t[8]=p):p=t[8];const{data:m,isLoading:f}=Ke(p),P=Kt,h=kt,v="sm:max-w-md",g=It,N=Pt,k=a("settings.editProviderDialog.editTitle",{name:_});let x;t[9]!==N||t[10]!==k?(x=s.jsx(N,{children:k}),t[9]=N,t[10]=k,t[11]=x):x=t[11];let j;t[12]!==g||t[13]!==x?(j=s.jsx(g,{children:x}),t[12]=g,t[13]=x,t[14]=j):j=t[14];let S;t[15]!==f||t[16]!==c||t[17]!==u||t[18]!==m||t[19]!==o||t[20]!==i?(S=f||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(tt,{})}):s.jsx(Wt,{providerKey:i,provider:o,preset:u,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>c(!1),onSuccess:()=>c(!1)}),t[15]=f,t[16]=c,t[17]=u,t[18]=m,t[19]=o,t[20]=i,t[21]=S):S=t[21];let d;t[22]!==h||t[23]!==j||t[24]!==S?(d=s.jsxs(h,{className:v,children:[j,S]}),t[22]=h,t[23]=j,t[24]=S,t[25]=d):d=t[25];let y;return t[26]!==P||t[27]!==c||t[28]!==n||t[29]!==d?(y=s.jsx(P,{open:n,onOpenChange:c,children:d}),t[26]=P,t[27]=c,t[28]=n,t[29]=d,t[30]=y):y=t[30],y}function Xt(e){const t=J.c(86),{providerKey:i,provider:o}=e,{org:n}=be(),c=re(),a=je(),[l,u]=W.useState(!1),[_,b]=W.useState(!1),r=se(),[p]=qe(),m=p.language==="pt-BR"?vt:void 0,f=o?.id==="openai-compatible";let P;t[0]!==f||t[1]!==i.presetId?(P=f&&i.presetId?Be(i.presetId):void 0,t[0]=f,t[1]=i.presetId,t[2]=P):P=t[2];const h=P;let v;t[3]!==f||t[4]!==h||t[5]!==o?.name||t[6]!==i.providerId||t[7]!==r?(v=h?h.name:f?r("settings.aiProviders.customOpenAiCompatible"):o?.name??(i.providerId==="claude-code"?r("settings.providerKeyRow.claudeCode"):i.providerId==="codex"?r("settings.providerKeyRow.codex"):i.providerId),t[3]=f,t[4]=h,t[5]=o?.name,t[6]=i.providerId,t[7]=r,t[8]=v):v=t[8];const g=v,N=h?.logo??o?.logo??Ct[i.providerId];let k;e:{if(f){k=i.label;break e}let Z;t[9]!==m||t[10]!==i.createdAt||t[11]!==i.label||t[12]!==r?(Z=r("settings.providerKeyRow.addedTimeAgo",{label:i.label,time:yt(new Date(i.createdAt),{locale:m})}),t[9]=m,t[10]=i.createdAt,t[11]=i.label,t[12]=r,t[13]=Z):Z=t[13],k=Z}const x=k;let j;t[14]!==i.id||t[15]!==c?(j=async()=>{await c.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[14]=i.id,t[15]=c,t[16]=j):j=t[16];let S;t[17]!==n||t[18]!==i.id||t[19]!==a||t[20]!==r?(S=()=>{a.invalidateQueries({queryKey:te.aiProviderKeys(n.id)}),a.invalidateQueries({queryKey:te.aiProviders(n.id)}),a.invalidateQueries({queryKey:te.aiProviderModels(n.id,i.id)}),X.success(r("settings.providerKeyRow.keyDeleted")),u(!1)},t[17]=n,t[18]=i.id,t[19]=a,t[20]=r,t[21]=S):S=t[21];let d;t[22]!==r?(d=Z=>X.error(r("settings.providerKeyRow.failedToDeleteKey",{error:Z.message})),t[22]=r,t[23]=d):d=t[23];let y;t[24]!==j||t[25]!==S||t[26]!==d?(y={mutationFn:j,onSuccess:S,onError:d},t[24]=j,t[25]=S,t[26]=d,t[27]=y):y=t[27];const{mutate:C,isPending:K}=le(y);let A;t[28]!==g||t[29]!==N?(A=N?s.jsx("img",{src:N,alt:g,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(St,{fallback:g.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[28]=g,t[29]=N,t[30]=A):A=t[30];let w;t[31]!==o||t[32]!==r?(w=o?s.jsx(ee,{variant:"ghost",size:"icon","aria-label":r("settings.providerKeyRow.editProviderKey"),className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>b(!0),children:s.jsx(bt,{size:14})}):null,t[31]=o,t[32]=r,t[33]=w):w=t[33];let E;t[34]!==r?(E=r("settings.providerKeyRow.deleteProviderKey"),t[34]=r,t[35]=E):E=t[35];let R,F;t[36]===Symbol.for("react.memo_cache_sentinel")?(R=()=>u(!0),F=s.jsx(jt,{size:14}),t[36]=R,t[37]=F):(R=t[36],F=t[37]);let B;t[38]!==K||t[39]!==E?(B=s.jsx(ee,{variant:"ghost",size:"icon","aria-label":E,className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:K,onClick:R,children:F}),t[38]=K,t[39]=E,t[40]=B):B=t[40];let L;t[41]!==B||t[42]!==w?(L=s.jsxs("div",{className:"flex items-center gap-0.5",children:[w,B]}),t[41]=B,t[42]=w,t[43]=L):L=t[43];let U;t[44]!==x||t[45]!==g||t[46]!==L||t[47]!==A?(U=s.jsx(Fe,{icon:A,title:g,description:x,action:L}),t[44]=x,t[45]=g,t[46]=L,t[47]=A,t[48]=U):U=t[48];let $;t[49]!==_||t[50]!==o||t[51]!==i?($=o?s.jsx(Jt,{providerKey:i,provider:o,open:_,onOpenChange:b}):null,t[49]=_,t[50]=o,t[51]=i,t[52]=$):$=t[52];let q;t[53]!==r?(q=r("settings.providerKeyRow.deleteApiKey"),t[53]=r,t[54]=q):q=t[54];let H;t[55]!==q?(H=s.jsx(Ve,{children:q}),t[55]=q,t[56]=H):H=t[56];let V;t[57]!==i.label?(V=s.jsxs(Le,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]}),t[57]=i.label,t[58]=V):V=t[58];let I;t[59]!==H||t[60]!==V?(I=s.jsxs(Qe,{children:[H,V]}),t[59]=H,t[60]=V,t[61]=I):I=t[61];let T;t[62]!==r?(T=r("settings.providerKeyRow.cancel"),t[62]=r,t[63]=T):T=t[63];let O;t[64]!==T?(O=s.jsx(Ge,{children:T}),t[64]=T,t[65]=O):O=t[65];let M;t[66]!==C?(M=()=>C(),t[66]=C,t[67]=M):M=t[67];let D;t[68]!==r?(D=r("settings.providerKeyRow.delete"),t[68]=r,t[69]=D):D=t[69];let G;t[70]!==M||t[71]!==D?(G=s.jsx(Ye,{onClick:M,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:D}),t[70]=M,t[71]=D,t[72]=G):G=t[72];let Y;t[73]!==O||t[74]!==G?(Y=s.jsxs(We,{children:[O,G]}),t[73]=O,t[74]=G,t[75]=Y):Y=t[75];let z;t[76]!==I||t[77]!==Y?(z=s.jsxs(Je,{children:[I,Y]}),t[76]=I,t[77]=Y,t[78]=z):z=t[78];let Q;t[79]!==l||t[80]!==z?(Q=s.jsx(Xe,{open:l,onOpenChange:u,children:z}),t[79]=l,t[80]=z,t[81]=Q):Q=t[81];let ie;return t[82]!==U||t[83]!==$||t[84]!==Q?(ie=s.jsxs(s.Fragment,{children:[U,$,Q]}),t[82]=U,t[83]=$,t[84]=Q,t[85]=ie):ie=t[85],ie}function Zt(e){const t=e.filter(i=>at(i.providerId));return{hasInventory:e.length>0,hasHostedProvider:t.length>0,hasDeco:t.some(i=>i.providerId==="deco")}}function es(e,t){return e.filter(i=>i.providerId!=="deco").map(i=>({key:i,provider:t.find(o=>o.id===i.providerId)??null}))}function Me(e){const t=J.c(13),{onConnectClick:i}=e,o=se(),n=De(),c=ze();let a;if(t[0]!==c?.providers||t[1]!==n||t[2]!==i||t[3]!==o){const l=c?.providers??[],u=es(n,l);let _;t[5]!==o?(_=o("settings.connectedProvidersSection.sectionTitle"),t[5]=o,t[6]=_):_=t[6];let b;t[7]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(ht,{size:14}),t[7]=b):b=t[7];let r;t[8]!==o?(r=o("settings.connectedProvidersSection.connectButton"),t[8]=o,t[9]=r):r=t[9];let p;t[10]!==i||t[11]!==r?(p=s.jsxs(ee,{size:"sm",onClick:i,children:[b,r]}),t[10]=i,t[11]=r,t[12]=p):p=t[12],a=s.jsx(ke,{title:_,headerClassName:"px-0",actions:p,children:u.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:o("settings.connectedProvidersSection.emptyState")}):s.jsx(Ie,{children:u.map(ts)})}),t[0]=c?.providers,t[1]=n,t[2]=i,t[3]=o,t[4]=a}else a=t[4];return a}function ts(e){const{key:t,provider:i}=e;return s.jsx(Xt,{providerKey:t,provider:i},t.id)}function ss(){const e=J.c(55),t=se(),{org:i}=be(),o=re(),n=je(),[c,a]=W.useState("");let l;e[0]!==i.id?(l=te.claudeSubscription(i.id),e[0]=i.id,e[1]=l):l=e[1];let u;e[2]!==o?(u=()=>o.call("CLAUDE_SUBSCRIPTION_STATUS",{}),e[2]=o,e[3]=u):u=e[3];let _;e[4]!==l||e[5]!==u?(_={queryKey:l,queryFn:u},e[4]=l,e[5]=u,e[6]=_):_=e[6];const b=Ke(_);let r;e[7]!==i.id||e[8]!==n?(r=()=>n.invalidateQueries({queryKey:te.claudeSubscription(i.id)}),e[7]=i.id,e[8]=n,e[9]=r):r=e[9];const p=r;let m;e[10]!==o||e[11]!==c?(m=()=>o.call("CLAUDE_SUBSCRIPTION_CONNECT",{token:c}),e[10]=o,e[11]=c,e[12]=m):m=e[12];let f;e[13]!==p||e[14]!==t?(f=async()=>{a(""),await p(),X.success(t("settings.claudeSubscription.connected"))},e[13]=p,e[14]=t,e[15]=f):f=e[15];let P;e[16]!==m||e[17]!==f?(P={mutationFn:m,onSuccess:f,onError:ls},e[16]=m,e[17]=f,e[18]=P):P=e[18];const h=le(P);let v;e[19]!==o?(v=()=>o.call("CLAUDE_SUBSCRIPTION_DISCONNECT",{}),e[19]=o,e[20]=v):v=e[20];let g;e[21]!==p||e[22]!==t?(g=async()=>{await p(),X.success(t("settings.claudeSubscription.disconnected"))},e[21]=p,e[22]=t,e[23]=g):g=e[23];let N;e[24]!==v||e[25]!==g?(N={mutationFn:v,onSuccess:g,onError:is},e[24]=v,e[25]=g,e[26]=N):N=e[26];const k=le(N),x=b.data?.connected===!0,j=!x&&!!b.data?.linkedAt;let S;e[27]!==t?(S=t("settings.claudeSubscription.title"),e[27]=t,e[28]=S):S=e[28];let d;e[29]!==S?(d=s.jsx("p",{className:"text-base font-semibold",children:S}),e[29]=S,e[30]=d):d=e[30];let y;e[31]!==x||e[32]!==j||e[33]!==t?(y=t(x?"settings.claudeSubscription.active":j?"settings.claudeSubscription.expired":"settings.claudeSubscription.description"),e[31]=x,e[32]=j,e[33]=t,e[34]=y):y=e[34];let C;e[35]!==y?(C=s.jsx("p",{className:"text-sm text-muted-foreground",children:y}),e[35]=y,e[36]=C):C=e[36];let K;e[37]!==d||e[38]!==C?(K=s.jsxs("div",{className:"flex-1 min-w-0",children:[d,C]}),e[37]=d,e[38]=C,e[39]=K):K=e[39];let A;e[40]!==x||e[41]!==k||e[42]!==t?(A=x?s.jsx(ee,{variant:"outline",disabled:k.isPending,onClick:()=>k.mutate(),children:t("settings.claudeSubscription.disconnect")}):null,e[40]=x,e[41]=k,e[42]=t,e[43]=A):A=e[43];let w;e[44]!==K||e[45]!==A?(w=s.jsxs("div",{className:"flex items-center gap-4",children:[K,A]}),e[44]=K,e[45]=A,e[46]=w):w=e[46];let E;e[47]!==h||e[48]!==x||e[49]!==t||e[50]!==c?(E=x?null:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t("settings.claudeSubscription.howTo")," ",s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"claude setup-token"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{type:"password",value:c,onChange:F=>a(F.target.value),placeholder:t("settings.claudeSubscription.tokenPlaceholder")}),s.jsx(ee,{disabled:c.trim().length===0||h.isPending,onClick:()=>h.mutate(),children:t("settings.claudeSubscription.connect")})]})]}),e[47]=h,e[48]=x,e[49]=t,e[50]=c,e[51]=E):E=e[51];let R;return e[52]!==w||e[53]!==E?(R=s.jsxs("div",{className:"rounded-xl border border-border px-6 py-5 flex flex-col gap-4",children:[w,E]}),e[52]=w,e[53]=E,e[54]=R):R=e[54],R}function is(e){return X.error(e.message)}function ls(e){return X.error(e.message)}function rs(e){const t=J.c(3),{error:i}=e;let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(lt,{size:16}),t[0]=o):o=t[0];let n;return t[1]!==i.message?(n=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[o,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=n):n=t[2],n}function os(){const e=J.c(27),t=De();let i;e[0]!==t?(i=Zt(t),e[0]=t,e[1]=i):i=e[1];const{hasInventory:o,hasHostedProvider:n,hasDeco:c}=i,[a,l]=W.useState(!1),[u,_]=W.useState(null),b=ze();let r;e[2]!==b?.providers?(r=b?.providers??[],e[2]=b?.providers,e[3]=r):r=e[3];const p=r;if(!n){let N;e[4]===Symbol.for("react.memo_cache_sentinel")?(N=()=>l(!0),e[4]=N):N=e[4];let k;e[5]!==p?(k=s.jsx(pt,{providers:p,onSelect:_,onShowAll:N}),e[5]=p,e[6]=k):k=e[6];const x=u!==null||a;let j;e[7]===Symbol.for("react.memo_cache_sentinel")?(j=K=>{K||(_(null),l(!1))},e[7]=j):j=e[7];const S=u??void 0;let d;e[8]!==x||e[9]!==S?(d=s.jsx(Ee,{open:x,onOpenChange:j,initialProvider:S}),e[8]=x,e[9]=S,e[10]=d):d=e[10];let y;e[11]!==o?(y=o?s.jsx(Me,{onConnectClick:()=>l(!0)}):null,e[11]=o,e[12]=y):y=e[12];let C;return e[13]!==k||e[14]!==d||e[15]!==y?(C=s.jsxs(s.Fragment,{children:[k,d,y]}),e[13]=k,e[14]=d,e[15]=y,e[16]=C):C=e[16],C}let m;e[17]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(W.Suspense,{fallback:s.jsx($e,{className:"h-16 w-full"}),children:s.jsx(Ft,{})}),e[17]=m):m=e[17];let f;e[18]!==c?(f=c?s.jsx(Bt,{}):s.jsx(Qt,{}),e[18]=c,e[19]=f):f=e[19];let P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(ss,{}),e[20]=P):P=e[20];let h;e[21]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Me,{onConnectClick:()=>l(!0)}),e[21]=h):h=e[21];let v;e[22]!==a?(v=s.jsx(Ee,{open:a,onOpenChange:l}),e[22]=a,e[23]=v):v=e[23];let g;return e[24]!==f||e[25]!==v?(g=s.jsxs(s.Fragment,{children:[m,f,P,h,v]}),e[24]=f,e[25]=v,e[26]=g):g=e[26],g}function ns(){const e=J.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(it,{group:"billing",errorFallback:as,children:s.jsx(os,{})}),e[0]=t):t=e[0],t}function as(e){const{error:t}=e;return s.jsx(rs,{error:t??new Error("Failed to load AI providers")})}function ui(){const e=J.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(wt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(ns,{})}),e[0]=t):t=e[0],t}export{ui as default};
@@ -1 +0,0 @@
1
- import{c as o,j as r}from"./index-ODKhlf52.js";import{O as m}from"./api-keys-BbHLdUSi.js";import{R as p}from"./require-capability-CJzBqa0H.js";import"./AlertCircle-CYzgJoBY.js";import"./Copy01-CJm4cfCT.js";import"./Key01-JyLu0I4O.js";import"./Plus-CqaGj-ml.js";import"./Trash01-sRqUo9Qp.js";import"./alert-dialog-B0Wnos4x.js";import"./dialog-0Gin8X8J.js";import"./input-CiTQTJk4.js";import"./label-D5NpFiWm.js";import"./use-mcp-client-qAu1HRUD.js";import"./constants-DNuUCxmW.js";import"./auth-DT85eno9.js";import"./access-gate-BWlhuXYE.js";import"./capability-load-error-BY9CwF2C.js";function A(){const t=o.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=r.jsx(p,{capability:"api-keys:manage",area:"api-keys",children:r.jsx(m,{})}),t[0]=i):i=t[0],i}export{A as default};
@@ -1 +0,0 @@
1
- import{c as jt,b as Bt,r as A,j as o,l as _t,h as wt,t as ht}from"./index-ODKhlf52.js";import{b as At}from"./chat-context-Bn5sHwf1.js";import{i as Et}from"./ChevronRight-CzHqvH7E.js";import{S as Nt}from"./scroll-area-CyEB6Rif.js";import{u as Rt,A as Tt}from"./use-section-preview-base-C6o3t9h3.js";import{n as Ct,r as Kt,c as Pt,d as Ft,e as Ot,g as Ut,h as $t,S as It,i as zt,j as Lt}from"./index-DPHTbKBf.js";import"./use-panel-navigate-D0FLl0De.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./constants-DNuUCxmW.js";import"./use-mcp-client-qAu1HRUD.js";import"./auth-DT85eno9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./task-board-BvGOyekg.js";import"./schema-R1g-EDIW.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-Dx_0SK12.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./use-organization-settings-BAq06qOp.js";import"./select-CCKtBWNQ.js";import"./Check-DTtdlqwY.js";import"./ChevronUp-DW8NdY2L.js";import"./agent-icon-DMaKG5lr.js";import"./AlertCircle-CYzgJoBY.js";import"./Tool01-pzhJg-K8.js";import"./ArrowUp-BoD_mzsH.js";import"./ArrowLeft-DbqXNp4F.js";import"./Tool02-BOHPr8jH.js";import"./XCircle-CWgi5YJD.js";import"./TrendUp01-Upn209vz.js";import"./ZoomOut-DUEecXAV.js";import"./Users03-DcaeZQDc.js";import"./CheckCircle-COo3JoVL.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./DotsVertical-BtJeAJ0k.js";import"./UserSquare-BTio6asa.js";import"./Copy01-CJm4cfCT.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Settings02-BOeVFu7a.js";import"./Eye-B218eqe6.js";import"./Share07-8fkbsMDg.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./XClose-RbRtPt7h.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Key01-JyLu0I4O.js";import"./Link01-CdgOMLbc.js";import"./LinkExternal01-CQuu9G7s.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Play-J7yukJwM.js";import"./Plus-CqaGj-ml.js";import"./SearchMd-Bc3Mg8g_.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Trash01-sRqUo9Qp.js";import"./Upload01-D7ygRA1o.js";import"./User01-DGyK5bBG.js";import"./Users01-D_2eWavO.js";import"./Zap-BLJmtEf5.js";import"./dialog-0Gin8X8J.js";import"./input-CiTQTJk4.js";import"./automation-runs-DIUeXIwb.js";import"./useInfiniteQuery-Ce5rZxD_.js";import"./use-infinite-scroll-CDUEa5S7.js";import"./use-connection-B9U-_dTx.js";import"./table-C7uS2-l8.js";import"./empty-state-BMKkn0m1.js";import"./use-members-BaNaE65J.js";import"./use-org-auth-client-5qGP3Zwp.js";import"./use-automations-2ubkGlfv.js";import"./useSuspenseInfiniteQuery-T_0Ug6bp.js";import"./avatar-DcREOm3L.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BYJ7CaVl.js";import"./markdown-ChK7BSCx.js";import"./monaco-editor-DiwjqzwB.js";import"./editor-CMBiwHdj.js";import"./types-D6t6wY6o.js";import"./shell-layout-BS92F-1s.js";import"./download-app-dialog-yVzVS3rF.js";import"./project-icon-Bvj4Gwi2.js";import"./github-repo-COLY3wWI.js";import"./command-D5rI_pln.js";import"./index-D1rygici.js";import"./required-auth-layout-46OxjUc_.js";import"./use-org-sso-aiWQ_yZD.js";import"./integration-icon-Kez26Bfu.js";import"./use-navigate-to-agent-Cc5iyUAP.js";import"./use-mcp-prompts-BAjC4pC7.js";import"./form-C74AeBpT.js";import"./label-D5NpFiWm.js";import"./file-type-icon-DLapffwQ.js";import"./drawer-CUXFxduO.js";import"./collection-search-BL14Irul.js";import"./tabs-DUurzPXg.js";import"./toggle-group-DUxN50gx.js";import"./task-route-CmxVMFRO.js";import"./toolbar-icon-button-TSDDGjeV.js";import"./popover-B6ROvgSp.js";import"./github-repo-picker-BjPuSYO7.js";import"./use-debounced-value-M3lA0gS1.js";import"./authenticate-and-persist-oauth-DiW6CIxv.js";import"./mcp-oauth-C6LUe73x.js";import"./extract-connection-data-B5gRedj8.js";import"./metadata-dUsYcpuu.js";import"./connection-5_SGsrJ3.js";import"./provision-repo-scoped-github-connection-WQFARyHG.js";import"./connection-card-CEJ-3Q6u.js";import"./use-registry-connections-CPuanPK4.js";import"./retry-CErkP7V6.js";import"./connection-slug-CITJ0kGN.js";import"./textarea-BCk4dtJd.js";import"./connection-form-helpers-DNcNmxy2.js";import"./collection-tabs-DVTsrZPo.js";import"./badge-CIvTSfE9.js";import"./use-file-configs-C_EM4mvl.js";import"./site-slug-uya6Wp4-.js";import"./dropdown-menu-DeCqeum7.js";import"./get-initials-D-f_fDFw.js";import"./select-model-BCM4tHqQ.js";import"./checkbox-Rut1nZw7.js";import"./ai-providers-logos-DD3qZ33J.js";import"./folder-icon-ivTRZQTW.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-YxnY0Jfq.js";import"./toolbar-CpbKvwTx.js";import"./skill-preview-CYNoZHVT.js";import"./pt-BR-CLy76QW2.js";import"./alert-dialog-B0Wnos4x.js";import"./use-debounced-autosave-C9AvD0on.js";import"./search-input-C-9S8K7N.js";import"./use-mcp-auth-status-DSpPtB7I.js";import"./switch-BSSC0yiV.js";import"./use-secrets-CY_AzLwb.js";import"./client-icons-ButLhVRb.js";import"./connect-layout-C5Hqqfnf.js";import"./self-tool-result-CB7a4d84.js";import"./track-CI8Z9Nn_.js";import"./use-tags-simcuqdM.js";import"./breadcrumb-DxzlsCMh.js";import"./safe-image-url-D5z803Ot.js";import"./automation-list-row-6pOr0T1Y.js";import"./site-error--i37Vnuw.js";import"./cards-Cjaru-PI.js";function Vt(n,t){const s=(n.title||n.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",m=Ct(t,i);return{blockKey:m,data:{__resolveType:n.resolveType,name:m}}}function Ir(n){const t=jt.c(79),{orgSlug:s,virtualMcpId:i,branch:m,blockKey:p,block:x,meta:a,decofile:l,title:bt,excludeFields:Z,schemaPending:lt,previewBaseUrl:ct}=n,D=lt===void 0?!1:lt,H=ct===void 0?null:ct,G=At()?.taskId??null,c=Bt();let N;t[0]!==H||t[1]!==i?(N={virtualMcpId:i,sandboxUrl:H},t[0]=H,t[1]=i,t[2]=N):N=t[2];const h=Rt(N),v=typeof x?.__resolveType=="string"?x.__resolveType:"";let R;t[3]!==Z||t[4]!==a||t[5]!==v?(R=Kt(v,a,Z),t[3]=Z,t[4]=a,t[5]=v,t[6]=R):R=t[6];const b=R;let T;t[7]!==b?(T=!!b&&Object.keys(b.properties??{}).length>0,t[7]=b,t[8]=T):T=t[8];const J=T,dt=bt??(x?Pt(p,x,a):p);let C;t[9]!==m||t[10]!==s||t[11]!==i?(C={orgSlug:s,virtualMcpId:i,branch:m},t[9]=m,t[10]=s,t[11]=i,t[12]=C):C=t[12];const{save:S,flush:Q,isPending:W}=Ft(C);let K;t[13]!==m||t[14]!==s||t[15]!==i?(K={orgSlug:s,virtualMcpId:i,branch:m},t[13]=m,t[14]=s,t[15]=i,t[16]=K):K=t[16];const X=Ot(K);let P;t[17]!==S?(P=zt((e,r)=>S(e,r)),t[17]=S,t[18]=P):P=t[18];const Y=P,[vt,St]=A.useState(p),[tt,ut]=A.useState(null),[et,ft]=A.useState(0);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=[],t[19]=F):F=t[19];const[g,xt]=A.useState(F),[ot,d]=A.useState(!1),O=A.useRef(null);vt!==p&&(St(p),ut(null),ft(Mt),xt([]));let U;t[20]!==x?(U=x??{},t[20]=x,t[21]=U):U=t[21];const rt=U;let y;t[22]!==tt?(y=tt??{},t[22]=tt,t[23]=y):y=t[23];let $;t[24]!==rt||t[25]!==y?($={...rt,...y},t[24]=rt,t[25]=y,t[26]=$):$=t[26];const it=$;let I;t[27]!==p||t[28]!==v||t[29]!==S?(I=e=>{const r=e;ut(r),S(p,{...r,__resolveType:v})},t[27]=p,t[28]=v,t[29]=S,t[30]=I):I=t[30];const st=I;let z;t[31]===Symbol.for("react.memo_cache_sentinel")?(z=e=>{xt(e)},t[31]=z):z=t[31];const E=z;let L;t[32]!==l||t[33]!==Q||t[34]!==X||t[35]!==c?(L=async(e,r)=>{try{const{blockKey:u,data:f}=Vt(e,l);await X.mutateAsync({blockKey:u,data:f}),ht.success(c("sandbox.appEditor.createdSection",{name:u})),r({__resolveType:u}),Q()}catch(u){const f=u,kt=f instanceof Error?f.message:c("sandbox.appEditor.failedAddSection");throw ht.error(kt),f}},t[32]=l,t[33]=Q,t[34]=X,t[35]=c,t[36]=L):L=t[36];const k=L;let V;t[37]!==d?(V=e=>{O.current=e.append,d(!0)},t[37]=d,t[38]=V):V=t[38];const mt=V;let q;t[39]!==k||t[40]!==d?(q=async e=>{const r=O.current;if(r)try{await k(e,u=>{r(u),d(!1),O.current=null})}catch{}},t[39]=k,t[40]=d,t[41]=q):q=t[41];const pt=q,at=g.length>0?[dt,...g]:[],gt="flex h-full flex-col",yt="flex h-12 shrink-0 items-center justify-between border-b px-6",nt=at.length>0?o.jsx("nav",{"aria-label":c("sandbox.appEditor.editingBreadcrumb"),className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:at.map((e,r)=>{const u=r===at.length-1,f=Ut(e);return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(Et,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{E(r===0?[]:$t(g,r)),ft(qt)},title:f,className:_t("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",u?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:f})]},`${f}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:dt});let j;t[42]!==W?(j=o.jsx(Lt,{isPending:W,isError:!1}),t[42]=W,t[43]=j):j=t[43];let B;t[44]!==nt||t[45]!==j?(B=o.jsxs("div",{className:yt,children:[nt,j]}),t[44]=nt,t[45]=j,t[46]=B):B=t[46];let _;t[47]!==p||t[48]!==m||t[49]!==g||t[50]!==l||t[51]!==it||t[52]!==et||t[53]!==k||t[54]!==E||t[55]!==st||t[56]!==mt||t[57]!==J||t[58]!==a||t[59]!==s||t[60]!==Y||t[61]!==b||t[62]!==D||t[63]!==h||t[64]!==c||t[65]!==G||t[66]!==i?(_=o.jsx(Nt,{className:"min-h-0 min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:J?o.jsx(It,{schema:b,value:it,onChange:st,basePath:"",breadcrumbPath:g,onBreadcrumbChange:E,decofile:l,meta:a,onSaveReferencedBlock:Y,previewBaseUrl:h,onAddSectionItem:k,onRequestAddSection:mt,sandbox:{orgSlug:s,virtualMcpId:i,branch:m,threadId:G}},`${p}:${et}`):D?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(wt,{className:"size-4"}),c("sandbox.appEditor.loadingSchema")]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:c("sandbox.appEditor.noEditableSchema")})})})}),t[47]=p,t[48]=m,t[49]=g,t[50]=l,t[51]=it,t[52]=et,t[53]=k,t[54]=E,t[55]=st,t[56]=mt,t[57]=J,t[58]=a,t[59]=s,t[60]=Y,t[61]=b,t[62]=D,t[63]=h,t[64]=c,t[65]=G,t[66]=i,t[67]=_):_=t[67];let w;t[68]!==ot||t[69]!==l||t[70]!==pt||t[71]!==a||t[72]!==h||t[73]!==d?(w=h&&o.jsx(Tt,{open:ot,onOpenChange:e=>{d(e),e||(O.current=null)},meta:a,decofile:l,previewBaseUrl:h,onSelect:e=>{pt(e)}}),t[68]=ot,t[69]=l,t[70]=pt,t[71]=a,t[72]=h,t[73]=d,t[74]=w):w=t[74];let M;return t[75]!==B||t[76]!==_||t[77]!==w?(M=o.jsxs("div",{className:gt,children:[B,_,w]}),t[75]=B,t[76]=_,t[77]=w,t[78]=M):M=t[78],M}function qt(n){return n+1}function Mt(n){return n+1}export{Ir as AppEditor};
@@ -1 +0,0 @@
1
- import{c as B,j as o,b as $,W as D,d as M,r as q,P as d,B as V,o as R}from"./index-ODKhlf52.js";import{s as W}from"./Plus-CqaGj-ml.js";import{i as S}from"./Zap-BLJmtEf5.js";import{S as F}from"./search-input-C-9S8K7N.js";import{E as T}from"./empty-state-BMKkn0m1.js";import{c as G}from"./use-automations-2ubkGlfv.js";import{u as H}from"./use-navigate-to-agent-Cc5iyUAP.js";import{A as J}from"./automation-list-row-6pOr0T1Y.js";import{h as K}from"./constants-DNuUCxmW.js";import{a as O}from"./use-virtual-mcp-Dx_0SK12.js";import{R as Q}from"./require-capability-CJzBqa0H.js";import"./SearchMd-Bc3Mg8g_.js";import"./use-mcp-client-qAu1HRUD.js";import"./auth-DT85eno9.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./task-board-BvGOyekg.js";import"./schema-R1g-EDIW.js";import"./chat-context-Bn5sHwf1.js";import"./use-panel-navigate-D0FLl0De.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./use-organization-settings-BAq06qOp.js";import"./github-repo-COLY3wWI.js";import"./alert-dialog-B0Wnos4x.js";import"./dropdown-menu-DeCqeum7.js";import"./Check-DTtdlqwY.js";import"./ChevronRight-CzHqvH7E.js";import"./DotsVertical-BtJeAJ0k.js";import"./agent-icon-DMaKG5lr.js";import"./AlertCircle-CYzgJoBY.js";import"./Tool01-pzhJg-K8.js";import"./ArrowUp-BoD_mzsH.js";import"./ArrowLeft-DbqXNp4F.js";import"./Tool02-BOHPr8jH.js";import"./XCircle-CWgi5YJD.js";import"./TrendUp01-Upn209vz.js";import"./ZoomOut-DUEecXAV.js";import"./Users03-DcaeZQDc.js";import"./CheckCircle-COo3JoVL.js";import"./ChevronUp-DW8NdY2L.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./UserSquare-BTio6asa.js";import"./Copy01-CJm4cfCT.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Settings02-BOeVFu7a.js";import"./Eye-B218eqe6.js";import"./Share07-8fkbsMDg.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./XClose-RbRtPt7h.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Key01-JyLu0I4O.js";import"./Link01-CdgOMLbc.js";import"./LinkExternal01-CQuu9G7s.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Play-J7yukJwM.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Trash01-sRqUo9Qp.js";import"./Upload01-D7ygRA1o.js";import"./User01-DGyK5bBG.js";import"./Users01-D_2eWavO.js";import"./access-gate-BWlhuXYE.js";import"./capability-load-error-BY9CwF2C.js";function U(){const t=B.c(20),i=$(),{org:l}=D(),{data:C}=G(void 0),g=C===void 0?[]:C,k=O(),P=H(),f=M(),[x,E]=q.useState(""),h=x.toLowerCase(),A=new Map(k.map(X)),b=g.filter(e=>{if(!h||e.name.toLowerCase().includes(h))return!0;if(e.virtual_mcp_id){const p=A.get(e.virtual_mcp_id);if(p&&p.title.toLowerCase().includes(h))return!0}return!1}),z=(e,p)=>{const N=p&&A.has(p)?p:K(l.id);R("automations_list_row_clicked",{automation_id:e,agent_id:N,source:"settings_automations"}),P(N,{panel:`automation:${e}`})};let c;t[0]!==f||t[1]!==l.slug?(c=()=>{R("automations_empty_state_browse_agents_clicked"),f({to:"/$org/settings/agents",params:{org:l.slug}})},t[0]=f,t[1]=l.slug,t[2]=c):c=t[2];const L=c,j=d,v=d,w=d;let s;t[3]!==i?(s=i("settings.automations.pageTitle"),t[3]=i,t[4]=s):s=t[4];let r;t[5]!==s?(r=o.jsx(d.Title,{children:s}),t[5]=s,t[6]=r):r=t[6];const _=g.length>0&&o.jsx(F,{value:x,onChange:E,placeholder:i("settings.automations.searchPlaceholder"),className:"w-full md:w-[375px]"});let m;t[7]!==r||t[8]!==_?(m=o.jsxs("div",{className:"flex flex-col gap-6",children:[r,_]}),t[7]=r,t[8]=_,t[9]=m):m=t[9];const y=g.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(T,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:i("settings.automations.emptyTitle"),description:i("settings.automations.emptyDescription"),actions:o.jsxs(V,{size:"sm",onClick:L,children:[o.jsx(W,{size:14}),i("settings.automations.browseAgentsButton")]})})}):b.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(T,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:i("settings.automations.noResultsTitle"),description:i("settings.automations.noResultsDescription",{search:x})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:b.map(e=>o.jsx(J,{automation:e,showAgent:!0,onClick:()=>z(e.id,e.virtual_mcp_id)},e.id))});let n;t[10]!==w.Body||t[11]!==m||t[12]!==y?(n=o.jsxs(w.Body,{children:[m,y]}),t[10]=w.Body,t[11]=m,t[12]=y,t[13]=n):n=t[13];let a;t[14]!==v.Content||t[15]!==n?(a=o.jsx(v.Content,{children:n}),t[14]=v.Content,t[15]=n,t[16]=a):a=t[16];let u;return t[17]!==j||t[18]!==a?(u=o.jsx(j,{children:a}),t[17]=j,t[18]=a,t[19]=u):u=t[19],u}function X(t){return[t.id,t]}function wo(){const t=B.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Q,{capability:"automations:manage",area:"automations",children:o.jsx(U,{})}),t[0]=i):i=t[0],i}export{wo as default};
@@ -1 +0,0 @@
1
- import{c as X,r as k,l as Y,j as t,b as Z,B as $,h as _,t as H}from"./index-ODKhlf52.js";import{b as K}from"./chat-context-Bn5sHwf1.js";import{i as tt}from"./XCircle-CWgi5YJD.js";import{i as U}from"./ZoomOut-DUEecXAV.js";import{n as ot}from"./LinkExternal01-CQuu9G7s.js";import{bj as et}from"./agent-icon-DMaKG5lr.js";import{A as rt,a as it,b as st,c as at,d as nt,e as mt,f as lt,g as pt}from"./alert-dialog-B0Wnos4x.js";import{I as W}from"./input-CiTQTJk4.js";import{L as M}from"./label-D5NpFiWm.js";import{e as ct,v as dt,w as ut,a5 as gt,j as xt,y as A,H as ft,a6 as ht,z as yt}from"./index-DPHTbKBf.js";import{c as bt,B as jt,a as vt}from"./block-document-ByUVXxfb.js";import{u as Et}from"./use-autosave-Mr0lCg24.js";import{t as Ct}from"./ChevronUp-DW8NdY2L.js";import{al as Nt,am as St,an as wt}from"./automation-runs-DIUeXIwb.js";import{s as j,E as kt}from"./primitives-BS0YBv3z.js";import"./use-panel-navigate-D0FLl0De.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./constants-DNuUCxmW.js";import"./use-mcp-client-qAu1HRUD.js";import"./auth-DT85eno9.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./task-board-BvGOyekg.js";import"./schema-R1g-EDIW.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-virtual-mcp-Dx_0SK12.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./use-organization-settings-BAq06qOp.js";import"./AlertCircle-CYzgJoBY.js";import"./Tool01-pzhJg-K8.js";import"./ArrowUp-BoD_mzsH.js";import"./ArrowLeft-DbqXNp4F.js";import"./Tool02-BOHPr8jH.js";import"./TrendUp01-Upn209vz.js";import"./Users03-DcaeZQDc.js";import"./CheckCircle-COo3JoVL.js";import"./Check-DTtdlqwY.js";import"./ChevronRight-CzHqvH7E.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./DotsVertical-BtJeAJ0k.js";import"./UserSquare-BTio6asa.js";import"./Copy01-CJm4cfCT.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Settings02-BOeVFu7a.js";import"./Eye-B218eqe6.js";import"./Share07-8fkbsMDg.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./XClose-RbRtPt7h.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Key01-JyLu0I4O.js";import"./Link01-CdgOMLbc.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Play-J7yukJwM.js";import"./Plus-CqaGj-ml.js";import"./SearchMd-Bc3Mg8g_.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Trash01-sRqUo9Qp.js";import"./Upload01-D7ygRA1o.js";import"./User01-DGyK5bBG.js";import"./Users01-D_2eWavO.js";import"./Zap-BLJmtEf5.js";import"./dialog-0Gin8X8J.js";import"./drawer-CUXFxduO.js";import"./collection-search-BL14Irul.js";import"./use-mcp-prompts-BAjC4pC7.js";import"./shell-layout-BS92F-1s.js";import"./avatar-DcREOm3L.js";import"./download-app-dialog-yVzVS3rF.js";import"./project-icon-Bvj4Gwi2.js";import"./github-repo-COLY3wWI.js";import"./command-D5rI_pln.js";import"./index-D1rygici.js";import"./required-auth-layout-46OxjUc_.js";import"./use-org-sso-aiWQ_yZD.js";import"./use-navigate-to-agent-Cc5iyUAP.js";import"./form-C74AeBpT.js";import"./select-CCKtBWNQ.js";import"./tabs-DUurzPXg.js";import"./toggle-group-DUxN50gx.js";import"./task-route-CmxVMFRO.js";import"./toolbar-icon-button-TSDDGjeV.js";import"./popover-B6ROvgSp.js";import"./github-repo-picker-BjPuSYO7.js";import"./use-debounced-value-M3lA0gS1.js";import"./use-connection-B9U-_dTx.js";import"./authenticate-and-persist-oauth-DiW6CIxv.js";import"./mcp-oauth-C6LUe73x.js";import"./extract-connection-data-B5gRedj8.js";import"./metadata-dUsYcpuu.js";import"./connection-5_SGsrJ3.js";import"./provision-repo-scoped-github-connection-WQFARyHG.js";import"./connection-card-CEJ-3Q6u.js";import"./use-registry-connections-CPuanPK4.js";import"./useInfiniteQuery-Ce5rZxD_.js";import"./use-infinite-scroll-CDUEa5S7.js";import"./retry-CErkP7V6.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-Kez26Bfu.js";import"./textarea-BCk4dtJd.js";import"./connection-form-helpers-DNcNmxy2.js";import"./collection-tabs-DVTsrZPo.js";import"./badge-CIvTSfE9.js";import"./useSuspenseInfiniteQuery-T_0Ug6bp.js";import"./use-file-configs-C_EM4mvl.js";import"./site-slug-uya6Wp4-.js";import"./dropdown-menu-DeCqeum7.js";import"./get-initials-D-f_fDFw.js";import"./select-model-BCM4tHqQ.js";import"./checkbox-Rut1nZw7.js";import"./ai-providers-logos-DD3qZ33J.js";import"./folder-icon-ivTRZQTW.js";import"./question-004-sINsf4GQ.js";import"./use-members-BaNaE65J.js";import"./use-org-auth-client-5qGP3Zwp.js";import"./use-status-sounds-YxnY0Jfq.js";import"./empty-state-BMKkn0m1.js";import"./toolbar-CpbKvwTx.js";import"./types-D6t6wY6o.js";import"./file-type-icon-DLapffwQ.js";import"./skill-preview-CYNoZHVT.js";import"./markdown-ChK7BSCx.js";import"./editor-CMBiwHdj.js";import"./pt-BR-CLy76QW2.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-debounced-autosave-C9AvD0on.js";import"./scroll-area-CyEB6Rif.js";import"./search-input-C-9S8K7N.js";import"./use-mcp-auth-status-DSpPtB7I.js";import"./switch-BSSC0yiV.js";import"./use-secrets-CY_AzLwb.js";import"./client-icons-ButLhVRb.js";import"./format-time-BnbuEtat.js";import"./connect-layout-C5Hqqfnf.js";import"./self-tool-result-CB7a4d84.js";import"./track-CI8Z9Nn_.js";import"./use-tags-simcuqdM.js";import"./breadcrumb-DxzlsCMh.js";import"./use-copy-BYJ7CaVl.js";import"./monaco-editor-DiwjqzwB.js";import"./safe-image-url-D5z803Ot.js";import"./use-automations-2ubkGlfv.js";import"./automation-list-row-6pOr0T1Y.js";import"./site-error--i37Vnuw.js";import"./cards-Cjaru-PI.js";import"./table-C7uS2-l8.js";function Pt(h){const o=X.c(18),{icon:d,title:n,defaultOpen:v,children:u}=h,P=v===void 0?!1:v,[g,D]=k.useState(P);let m;o[0]!==d?(m=t.jsx(d,{size:15}),o[0]=d,o[1]=m):m=o[1];let r;o[2]!==n?(r=t.jsx("span",{className:"flex-1 text-left",children:n}),o[2]=n,o[3]=r):r=o[3];const y=g&&"rotate-180";let s;o[4]!==y?(s=Y("transition-transform",y),o[4]=y,o[5]=s):s=o[5];let l;o[6]!==s?(l=t.jsx(Ct,{size:15,className:s}),o[6]=s,o[7]=l):l=o[7];let p;o[8]!==m||o[9]!==r||o[10]!==l?(p=t.jsx(Nt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[m,r,l]})}),o[8]=m,o[9]=r,o[10]=l,o[11]=p):p=o[11];let i;o[12]!==u?(i=t.jsx(St,{className:"px-2 pt-4",children:u}),o[12]=u,o[13]=i):i=o[13];let x;return o[14]!==g||o[15]!==p||o[16]!==i?(x=t.jsxs(wt,{open:g,onOpenChange:D,className:"mt-4",children:[p,i]}),o[14]=g,o[15]=p,o[16]=i,o[17]=x):x=o[17],x}function Sr({orgSlug:h,virtualMcpId:o,branch:d,blockKey:n,block:v,decofile:u,meta:P,onManagePosts:g,onOpenPost:D,previewBaseUrl:m}){const r=Z(),y=K()?.taskId??null,s=ct({orgSlug:h,virtualMcpId:o,branch:d}),l=dt({orgSlug:h,virtualMcpId:o,branch:d}),p=ut(v,"categories"),[i,x,q]=Et(p,e=>{s.mutate({blockKey:n,data:A(n,"categories",e)})}),E=(e,w)=>x({...i,[e]:w}),z=bt({decofile:u,category:i,previewBaseUrl:m,draftPointer:l}),a=j(i.slug),[B,b]=k.useState(a),[c,C]=k.useState(null),[N,T]=k.useState(!1),F=a?gt(u).filter(e=>e.categorySlugs.includes(a)):[],S=F.length,G=e=>E("slug",e),J=async(e,w)=>{const V=j(i.name);T(!0);try{let f=0;for(const{key:R,payload:I}of ft(u,"posts")){const L=ht(I,e,{name:V,slug:w});L!==I&&(await s.mutateAsync({blockKey:R,data:A(R,"posts",yt(L))}),f+=1)}const O={...i,slug:w};await s.mutateAsync({blockKey:n,data:A(n,"categories",O)}),q(O),H.success(f>0?r("sandbox.categoryEditor.renameSuccessWithPosts",{count:String(f)}):r("sandbox.categoryEditor.renameSuccessNoPosts")),C(null)}catch(f){b(e),C(null),H.error(f instanceof Error?f.message:r("sandbox.categoryEditor.renameFailed"))}finally{T(!1)}},Q=()=>{const e=B.trim();if(e===a){B!==e&&b(e);return}if(!e){b(a);return}if(S===0){G(e);return}C({oldSlug:a,newSlug:e,count:S})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:j(i.name)||r("sandbox.categoryEditor.untitledCategory")}),t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.jsx(xt,{isPending:s.isPending,isError:s.isError}),z&&t.jsxs($,{type:"button",variant:"outline",size:"sm",title:r("sandbox.categoryEditor.previewTooltip"),onClick:()=>window.open(z,"_blank","noopener,noreferrer"),children:[t.jsx(ot,{size:14}),r("sandbox.categoryEditor.seeCategoryPreview")]})]})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[t.jsx(kt,{value:j(i.name),onChange:e=>E("name",e),placeholder:r("sandbox.categoryEditor.categoryNamePlaceholder"),className:"py-1 text-3xl font-bold text-foreground"}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(M,{htmlFor:"category-slug",children:r("sandbox.categoryEditor.slugLabel")}),t.jsx(W,{id:"category-slug",value:B,onChange:e=>b(e.target.value),onBlur:Q,placeholder:r("sandbox.categoryEditor.slugPlaceholder"),className:"h-10"})]}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(M,{htmlFor:"category-description",children:r("sandbox.categoryEditor.descriptionLabel")}),t.jsx(W,{id:"category-description",value:j(i.description),onChange:e=>E("description",e.target.value),placeholder:r("sandbox.categoryEditor.descriptionPlaceholder"),className:"h-10"})]}),t.jsx(Pt,{icon:et,title:r("sandbox.categoryEditor.contentTitle"),defaultOpen:!0,children:t.jsx(jt,{value:vt(i.sections),onChange:e=>E("sections",e),meta:P,sandboxRef:{orgSlug:h,virtualMcpId:o,branch:d,threadId:y},emptyMessage:r("sandbox.categoryEditor.noContentEmpty")})}),t.jsxs("div",{className:"mt-6 overflow-hidden rounded-lg border bg-muted/30",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(U,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:r("sandbox.categoryEditor.postsInCategory",{count:String(S)})})]}),t.jsxs($,{type:"button",variant:"outline",size:"sm",disabled:!a,title:r(a?"sandbox.categoryEditor.pickPostsTooltip":"sandbox.categoryEditor.setSlugTooltip"),onClick:()=>g(a),children:[r("sandbox.categoryEditor.addPostsButton"),t.jsx(tt,{size:14})]})]}),S>0&&t.jsx("ul",{className:"divide-y border-t bg-background",children:F.map(e=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>D(e.key),className:"flex w-full items-center gap-2.5 px-4 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(U,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm",children:e.title||r("sandbox.categoryEditor.untitledPost")}),e.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.slug})]})]})},e.key))})]})]})})]}),t.jsx(rt,{open:!!c,onOpenChange:e=>{e||N||(b(a),C(null))},children:t.jsxs(it,{children:[t.jsxs(st,{children:[t.jsx(at,{children:r("sandbox.categoryEditor.renameDialogTitle")}),t.jsx(nt,{children:c?r("sandbox.categoryEditor.renameDialogDescription",{oldSlug:c.oldSlug,newSlug:c.newSlug,count:String(c.count)}):null})]}),t.jsxs(mt,{children:[t.jsx(lt,{disabled:N,children:r("sandbox.categoryEditor.cancelButton")}),t.jsx(pt,{onClick:e=>{e.preventDefault(),c&&J(c.oldSlug,c.newSlug)},disabled:N,children:N?t.jsxs(t.Fragment,{children:[t.jsx(_,{className:"size-3.5"}),r("sandbox.categoryEditor.renamingLabel")]}):r("sandbox.categoryEditor.renameActionButton")})]})]})})]})}export{Sr as CategoryEditor};
@@ -1,35 +0,0 @@
1
- import{J as re,c as O,Z as Xe,u as Fe,aX as it,n as Le,W as J,K as oe,t as ae,H as de,d as Je,cV as ct,y as lt,r as k,m as ut,a7 as dt,e as ft,bE as pt,j as X,b as Ae,a as ht,v as mt,cJ as gt,av as yt,o as St}from"./index-ODKhlf52.js";import{u as Ye,a as vt}from"./use-panel-navigate-D0FLl0De.js";import{e as Tt,g as bt,A as ze,S as It,f as kt,l as Mt,m as xt,n as Ct,a as wt,w as At}from"./hooks-Bf7O-39q.js";import{s as Et}from"./slugify-CEUa2lfQ.js";import{u as $t}from"./use-is-desktop-app-BNujXJc_.js";import{u as Pt}from"./use-mcp-client-qAu1HRUD.js";import{S as _t}from"./constants-DNuUCxmW.js";import{f as Rt,d as Dt}from"./use-virtual-mcp-Dx_0SK12.js";import{u as Ze,p as Ot,b as ve,i as Nt,c as Ut}from"./use-ai-providers-DId9f_Qw.js";import{o as Ft,b as Lt}from"./location-oTTXFrSF.js";import{u as qt}from"./use-decopilot-events-xXOXhSly.js";import{D as jt}from"./use-destination-route-BeQrBWgu.js";import{b as Qt}from"./use-organization-settings-BAq06qOp.js";function Ne(t){const e=t?.trim();if(!e)return null;try{const s=new URL(e);return s.protocol!=="http:"&&s.protocol!=="https:"?null:s.href}catch{return null}}function Bt(t){return Ne(t?.previewServerUrl)??Ne(t?.productionUrl)}function en(t){return t?.find(e=>e.production)?.domain??t?.[0]?.domain}function Vt(t){const e=t?.trim();if(!e)return null;const s=/^https?:\/\//i.test(e)?e:`https://${e}`;return Ne(s)}function tn(t){const e=Et(t??"");return e?Vt(`${e}.deco.site`):null}function et(t){return t==="cms"||t==="sandbox"?t:null}function Wt(t){return!!Bt(t)&&t?.fastPreview===!0}function Kt(t){return Wt(t)?"cms":"sandbox"}function sn(t,e){return et(t?.runtime)??Kt(e)}function qe(t,e){return re.chatThreadIntent(t,e)}function Be(t,e,s,n){if(!(!n.runtime&&!n.branch))try{t.setItem(qe(e,s),JSON.stringify(n))}catch{}}function Ve(t,e,s){try{t.removeItem(qe(e,s))}catch{}}function nn(t,e,s){const n=qe(e,s);let r=null;try{r=t.getItem(n),t.removeItem(n)}catch{return{}}if(!r)return{};let a;try{a=JSON.parse(r)}catch{return{}}if(!a||typeof a!="object")return{};const o=a,i=et(o.runtime),u=typeof o.branch=="string"&&o.branch?o.branch:void 0;return{...i?{runtime:i}:{},...u?{branch:u}:{}}}function Ht(t,e=[]){return t==="stop"?"completed":t==="tool-calls"?e.some(n=>n.type==="tool-user_ask"&&n.state==="input-available"||n.state==="approval-requested")?"requires_action":"completed":"failed"}const We={"claude-code-desktop":"claude-code","codex-desktop":"codex","opencode-desktop":"opencode"};function Gt(t){return t==="claude-code"?"claude-code-desktop":t==="codex"?"codex-desktop":t==="opencode"?"opencode-desktop":null}function Xt({pendingOption:t,lockedHarness:e}){return e?Gt(e):t}function Jt(t){return t.thread?.harness_id!=null?{}:{branch:t.globals.branch??null}}const Yt=new Set(["decopilot","claude-code"]);function zt({isDesktopApp:t,harnessId:e}){return e!=null&&!Yt.has(e)}function Zt(t){const e=O.c(19);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=s):s=e[0];const n=Xe(s);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[1]=r):r=e[1];const a=Fe(r),o=Ye();let i;e[2]!==o||e[3]!==a?(i=it(o)?.path??a.preview??a.skill??a.brand??null,e[2]=o,e[3]=a,e[4]=i):i=e[4];const u=i;let f;if(e[5]!==n?.params.appSlug||e[6]!==n?.params.collectionName||e[7]!==n?.params.itemId||e[8]!==u||e[9]!==t){if(f=[],t&&f.push(`### Selected Agent
2
- - ID: ${t}`),u){let M;e[11]!==u?(M=Ft(u),e[11]=u,e[12]=M):M=e[12];const w=M;let d;e[13]!==u?(d=Lt(u),e[13]=u,e[14]=d):d=e[14],f.push(`### Currently Open File
3
- The user has this file open in the Library and is most likely referring to it:
4
- - Name: ${d}
5
- - Library path: ${u}${w?`
6
- - Read/edit it with your file tools at: \`${w}\``:""}
7
-
8
- When a request is ambiguous about which file or resource it targets (e.g. "change the h1", "fix this", "what's in this file", "update the title"), assume it means this file unless the user clearly indicates otherwise.`)}let p;e[15]!==n?.params.appSlug||e[16]!==n?.params.collectionName||e[17]!==n?.params.itemId?(p=[],n?.params.appSlug&&p.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&p.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&p.push(`- Item ID: ${n?.params.itemId}`),e[15]=n?.params.appSlug,e[16]=n?.params.collectionName,e[17]=n?.params.itemId,e[18]=p):p=e[18],p.length>0&&f.push(`### Current Resource
9
- The user is viewing the following resource:
10
- ${p.join(`
11
- `)}
12
-
13
- Help the user understand and work with this resource.`),e[5]=n?.params.appSlug,e[6]=n?.params.collectionName,e[7]=n?.params.itemId,e[8]=u,e[9]=t,e[10]=f}else f=e[10];return f.join(`
14
-
15
- `)}function es(){const t=O.c(5),e=Le(),{org:s}=J();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const r=Xe(n);let a;return t[1]!==r?.params||t[2]!==s||t[3]!==e?(a=o=>{const u=o.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!u||!u[1])return;const f=u[1],p=r?.params.appSlug;if(!p)return;e.invalidateQueries({queryKey:oe.collection(s.slug,p,f)});const M=f.toLowerCase().replace(/_/g," ");ae.success(`${M} updated`)},t[1]=r?.params,t[2]=s,t[3]=e,t[4]=a):a=t[4],a}function ts(){const t=O.c(4),{org:e,project:s}=J(),n=`${e.id}/${s.id}`;let r;t[0]!==n?(r=re.taskLastViewed(n),t[0]=n,t[1]=r):r=t[1];const[,a]=de(r,ss);let o;return t[2]!==a?(o={markTaskRead:u=>{a(f=>({...f,[u]:new Date().toISOString()}))}},t[2]=a,t[3]=o):o=t[3],o}function ss(t){return t??{}}function tt(){const t=O.c(11),e=Je(),{org:s}=J(),n=Tt(),r=bt(),a=Ye();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const i=Fe(o);let u;t[1]!==a||t[2]!==e||t[3]!==s||t[4]!==i||t[5]!==r?(u=(M,w)=>{const d=a&&!ct(a)?a:void 0,x=d?lt(d):null;e({to:jt.agents,params:{org:s.slug,panel:x?.panel},search:{virtualmcpid:w?.virtualMcpId??r,thread:M,...x?.payload??{},...typeof i.sidepanel=="boolean"?{sidepanel:i.sidepanel}:{},...w?.autosend?{autosend:ze}:{}}})},t[1]=a,t[2]=e,t[3]=s,t[4]=i,t[5]=r,t[6]=u):u=t[6];const f=u;let p;return t[7]!==f||t[8]!==n||t[9]!==r?(p={virtualMcpId:r,taskId:n,navigateToTask:f},t[7]=f,t[8]=n,t[9]=r,t[10]=p):p=t[10],p}function ns(t,e){const{mimeType:s,data:n}=t;if(s.startsWith("text/"))try{const r=new TextDecoder().decode(Uint8Array.from(atob(n),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
16
- ${r}`}]}catch(r){console.error("Failed to decode text file:",r)}return[{type:"file",url:`data:${s};base64,${n}`,filename:e,mediaType:s}]}function Ke(t,e){const s=[];for(const n of t)!n||typeof n!="object"||("text"in n&&n.text?s.push({type:"text",text:`[${e}]
17
- ${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&s.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)}));return s}function rs(t,e){const s=(t.files??[]).filter(o=>o.content?.trim()),n=t.omittedPaths??[];if(s.length===0&&n.length===0)return[];const r=s.map(o=>`<skill-file path="${o.relPath}">
18
- ${o.content.trim()}
19
- </skill-file>`).join(`
20
-
21
- `),a=n.length>0?`
22
-
23
- Other files in \`${t.sandboxPath}/\`: ${n.join(", ")}`:"";return[{type:"text",text:`[${e}]
24
- ${r}${a}`}]}function as(t,e){const s=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const r=Array.isArray(n.content)?n.content:[n.content];for(const a of r)switch(a.type){case"text":{const o=a.text?.trim();if(!o)continue;s.push({type:"text",text:`[${e}]
25
- ${o}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;s.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const o=a.resource;if(!o||!o.mimeType)continue;o&&("text"in o&&o.text?s.push({type:"text",text:`[${e}]
26
- ${o.text}`}):"blob"in o&&o.blob&&o.mimeType&&s.push({type:"file",url:`data:${o.mimeType};base64,${o.blob}`,filename:String(o.uri),mediaType:String(o.mimeType)}));break}}}return s}function st(t){if(!t)return[];const e=[];let s="";const n=r=>{if(r){if(r.type==="text"&&"text"in r&&typeof r.text=="string")s+=r.text;else if(r.type==="mention"&&r.attrs){const a=r.attrs.char??"/",o=`${a}${r.attrs.name}`;if(r.attrs.kind==="task"){const i=r.attrs.metadata,u=i?.title??r.attrs.name??"",f=i?.context?.trim()||[u,i?.description?.trim()].filter(Boolean).join(`
27
-
28
- `);f&&e.push({type:"text",text:f});return}if(s+=o,a==="@"){const i=r.attrs.metadata;i&&typeof i=="object"&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??r.attrs.name} (agent_id: ${i.agentId})]
29
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...Ke(i,o))}else if(r.attrs.kind==="skill"){const i=r.attrs.metadata;i&&!Array.isArray(i)&&Array.isArray(i.files)&&e.push(...rs(i,o))}else{const i=r.attrs.metadata||r.attrs.prompts||[];Array.isArray(i)&&i.length>0&&typeof i[0]=="object"&&i[0]!==null&&"role"in i[0]?e.push(...as(i,o)):Array.isArray(i)&&e.push(...Ke(i,o))}}else if(r.type==="file"&&r.attrs){const a=r.attrs,o=`[file:://${encodeURIComponent(a.name)}]`;s+=o,e.push(...ns(a,o))}if("content"in r&&Array.isArray(r.content))for(const a of r.content)n(a)}};return n(t),s.trim()&&e.unshift({type:"text",text:s.trim()}),e}function rn(t){const e=st(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}function an(t){return new Set(t.filter(e=>e.status==="queued").map(e=>e.messageId))}function os(t){return(t??[]).map(e=>e?.type==="text"&&typeof e.text=="string"?e.text:"").join("").trim()}function on(t){return t.filter(e=>e.status==="queued").sort((e,s)=>e.enqueuedAt-s.enqueuedAt)}function is(t,e){return t.some(s=>s.messageId===e.messageId)?t:[...t,e]}function cs(t,e){return t.filter(s=>s.messageId!==e)}const te=new Map,ls=200;function us(t){if(te.size<ls||te.has(t))return;const e=te.keys().next().value;if(e!==void 0){te.delete(e),Ee.delete(e);for(const s of fe.keys())s.startsWith(`${e}:`)&&fe.delete(s)}}const Ee=new Set;function ds(t){Ee.add(t)}function fs(t){return Ee.has(t)}function ps(t){Ee.delete(t)}function be(t){const e=te.get(t);if(e)return te.delete(t),te.set(t,e),e;us(t);const s=new It([]);return te.set(t,s),s}function nt(t,e){be(t).update(s=>is(s,e))}function Ue(t,e){be(t).update(s=>cs(s,e))}function hs(t,e){be(t).set(e)}const fe=new Map;function ms(t,e){fe.set(`${t}:${e.id}`,e)}function gs(t,e){const s=`${t}:${e}`,n=fe.get(s);return fe.delete(s),n}function He(t,e){fe.delete(`${t}:${e}`)}async function ee(t,e){try{const s=await fetch(`/api/${encodeURIComponent(t)}/decopilot/queue/${encodeURIComponent(e)}`,{credentials:"include"});if(!s.ok)return;const n=await s.json();hs(e,n.items??[])}catch{}}function cn(t){const e=O.c(2);let s;e[0]!==t?(s=be(t),e[0]=t,e[1]=s):s=e[1];const n=s;return k.useSyncExternalStore(n.subscribe,n.get,n.get)}function ys(){const{org:t}=J();return{enqueue:nt,refresh:e=>ee(t.slug,e),cancel:async(e,s)=>{const n=`thread-run:${e}:${s}`;Ue(e,s);try{const r=await fetch(`/api/${encodeURIComponent(t.slug)}/decopilot/queue/${encodeURIComponent(e)}/cancel/${encodeURIComponent(n)}`,{method:"POST",credentials:"include"});if(!r.ok&&r.status!==404)throw new Error(`Cancel failed: ${r.status}`);return!0}catch(r){return ae.error(r instanceof Error?r.message:"Failed to cancel"),!1}finally{await ee(t.slug,e)}}}}function we(t,e){return t.find(s=>s!=null&&e.has(s.keyId))??null}function Ss(t,e,s){const n=r=>we([r],s);return{tiers:{fast:we([e.tiers.fast,t.tiers.fast],s),smart:we([e.tiers.smart,t.tiers.smart],s),thinking:we([e.tiers.thinking,t.tiers.thinking],s),image:n(t.tiers.image),web_search:n(t.tiers.web_search),deep_research:n(t.tiers.deep_research)}}}const Te={tiers:{}};function vs(){const t=O.c(7),{org:e}=J();let s;t[0]!==e.id?(s=oe.userModelPreferences(e.id),t[0]=e.id,t[1]=s):s=t[1];let n;t[2]!==e.slug?(n=async()=>{const a=await pt(e.slug,"USER_MODEL_PREFERENCES_GET",{});return a?.tiers?a:Te},t[2]=e.slug,t[3]=n):n=t[3];let r;return t[4]!==s||t[5]!==n?(r={queryKey:s,queryFn:n,staleTime:6e4},t[4]=s,t[5]=n,t[6]=r):r=t[6],ut(r)}function Ts(){return vs().data??Te}function ln(){const t=O.c(19),{org:e}=J(),s=dt(),n=Le();let r;t[0]!==e.id?(r=oe.userModelPreferences(e.id),t[0]=e.id,t[1]=r):r=t[1];const a=r;let o;t[2]!==a||t[3]!==n||t[4]!==s?(o=async w=>{const d=n.getQueryData(a)??Te;return await s.call("USER_MODEL_PREFERENCES_UPDATE",d)??d},t[2]=a,t[3]=n,t[4]=s,t[5]=o):o=t[5];let i,u,f,p;t[6]!==a||t[7]!==n?(i=w=>{const{tier:d,slot:x}=w,N=n.getQueryData(a),U=N??Te;return n.setQueryData(a,{tiers:{...U.tiers,[d]:x}}),{prev:N}},u=(w,d,x)=>{n.setQueryData(a,x?.prev??Te)},f=w=>{n.setQueryData(a,w)},p=()=>{n.isMutating({mutationKey:a})===1&&n.invalidateQueries({queryKey:a})},t[6]=a,t[7]=n,t[8]=i,t[9]=u,t[10]=f,t[11]=p):(i=t[8],u=t[9],f=t[10],p=t[11]);let M;return t[12]!==a||t[13]!==o||t[14]!==i||t[15]!==u||t[16]!==f||t[17]!==p?(M={mutationKey:a,mutationFn:o,onMutate:i,onError:u,onSuccess:f,onSettled:p},t[12]=a,t[13]=o,t[14]=i,t[15]=u,t[16]=f,t[17]=p,t[18]=M):M=t[18],ft(M)}function bs(){const t=O.c(4),e=Qt(),s=Ts(),n=Ze();let r;return t[0]!==n||t[1]!==e||t[2]!==s?(r=Ss(e,s,new Set(n.map(Is))),t[0]=n,t[1]=e,t[2]=s,t[3]=r):r=t[3],r}function Is(t){return t.id}function ne(t,e,s,n){if(!t)return null;const r=e.find(o=>o.id===t.keyId);if(!r)return null;const a=s.find(o=>o.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:r.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function ks(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function Ms(t,e,s,n){if(!s||n.length===0)return null;const r=e.find(u=>u.id===s);if(!r)return null;const a=Ot([r],{[s]:n}),o=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!o)return null;const i=n.find(u=>u.modelId===o.modelId);return i?{...i,keyId:s}:null}const Ge=new Set,Z=new Set;function ue(t){return k.useSyncExternalStore(t.subscribe,t.get,t.get)}function xs(t){return t.kind==="loading"?"ready":t.kind}function rt(t){return t&&typeof t=="object"&&"type"in t?{tiptapDoc:t}:t}const Cs=1e4,ws=10,Ie=k.createContext(null),$e=k.createContext(null),je=k.createContext(null),at=k.createContext(null);function As(t){const e=O.c(3),{value:s,children:n}=t;let r;return e[0]!==n||e[1]!==s?(r=X.jsx(Ie.Provider,{value:s,children:n}),e[0]=n,e[1]=s,e[2]=r):r=e[2],r}function un(t){const e=O.c(2),{children:s}=t;let n;return e[0]!==s?(n=X.jsx(Ie.Provider,{value:null,children:X.jsx($e.Provider,{value:null,children:s})}),e[0]=s,e[1]=n):n=e[1],n}function Es({children:t}){const{locator:e}=J(),{virtualMcpId:s}=tt(),[n,r]=de(re.chatSelectedImageModel(e),null),[a,o]=de(re.chatSelectedWebSearchModel(e),null),[i,u]=de(re.chatSelectedDeepResearchModel(e),null),[f,p]=k.useState(null),[M,w]=k.useState("default"),d=bs(),[x,N]=de(re.chatSimpleModeTier(e),null),U=ks(x),b=Ze(),C=d.tiers[U],q=b.some(c=>c.id===C?.keyId)?C?.keyId:void 0,j=f&&b.some(c=>c.id===f)?f:q??b[0]?.id??null,{models:R,isLoading:A}=ve(j??void 0),{models:E}=ve(q),Y=b.some(c=>c.id===d.tiers.image?.keyId)?d.tiers.image?.keyId:void 0,{models:se}=ve(Y),D=b.some(c=>c.id===d.tiers.web_search?.keyId)?d.tiers.web_search?.keyId:void 0,{models:Q}=ve(D),F=b.some(c=>c.id===d.tiers.deep_research?.keyId)?d.tiers.deep_research?.keyId:void 0,{models:W}=ve(F),K=ne(C,b,E,C?.title)??Ms(U,b,j,R),H=A,G=R.filter(c=>c.capabilities?.includes("image")),B=ne(n,b,G),m=ne(d.tiers.image,b,se,d.tiers.image?.title)??B??G[0]??null,S=R.filter(Nt),I=ne(a,b,S),L=S.find(c=>c.modelId==="perplexity/sonar")??S[0]??null,z=ne(d.tiers.web_search,b,Q,d.tiers.web_search?.title)??I??L,ie=R.filter(Ut),Pe=ne(i,b,ie),P=ie.find(c=>c.modelId==="perplexity/deep-research")??ie.find(c=>c.asyncResearch===!0)??ie[0]??null,ke=ne(d.tiers.deep_research,b,W,d.tiers.deep_research?.title)??Pe??P,pe=Rt(s),_e=Dt().find(c=>c.id===s),Me=pe??_e??{id:s,title:"",description:null,icon:null},[Re,he]=k.useState({}),xe=(c,$)=>{const y=[];for(const g of $.content??[])g.type==="text"&&g.text?.trim()&&y.push(g.text.trim());const T=y.join(`
30
- `);if(!T){me(c);return}new TextEncoder().encode(T).length>Cs||he(g=>Object.keys(g).length>=ws&&!(c in g)?g:{...g,[c]:T})},me=c=>{he($=>{const{[c]:y,...T}=$;return T})},[ge,De]=de(re.chatLastAgentOption(e),c=>c&&c in We?c:null),Ce=qs(),ye=Xt({pendingOption:ge,lockedHarness:Ce?.isThreadLocked?Ce.lockedHarness:null}),Qe=ye?We[ye]:null,[ce,Oe]=k.useState(void 0),l=k.useRef(ce);l.current=ce;const h={selectedModel:K,setModel:()=>{},credentialId:j,setCredentialId:p,allModelsConnections:b,isModelsLoading:H,selectedVirtualMcp:Me,imageModel:m,setImageModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},webSearchModel:z,setWebSearchModel:c=>{o(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:ke,setDeepResearchModel:c=>{u(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:M,setChatMode:w,appContexts:Re,setAppContext:xe,clearAppContext:me,tiptapDoc:ce,setTiptapDoc:Oe,tiptapDocRef:l,resetInteraction:()=>{},simpleModeTier:U,setSimpleModeTier:c=>N(c),pendingAgentOption:ye,setPendingAgentOption:De,pendingHarnessId:Qe};return X.jsx(je.Provider,{value:h,children:t})}function dn(t){const e=O.c(41),{virtualMcpId:s,task:n,children:r}=t,{locator:a}=J(),{data:o}=ht.useSession(),i=o?.user??null,{taskId:u,virtualMcpId:f,navigateToTask:p}=tt(),[M]=mt(),{markTaskRead:w}=ts(),d=wt(),x=u,N=f,U=Zt(N);let b;e[0]!==w||e[1]!==p?(b=(S,I)=>{w(S),p(S,{virtualMcpId:I?.virtualMcpId,autosend:I?.autosend})},e[0]=w,e[1]=p,e[2]=b):b=e[2];const C=b,q=x!==null&&n?.id===x?n:null,j=q?.harness_id??null,R=q?.branch??null,A=j!=null,E=R;let Y;e[3]!==E||e[4]!==a||e[5]!==C||e[6]!==d||e[7]!==s?(Y=S=>{const I=crypto.randomUUID(),L=S?.branch??E;return Be(sessionStorage,a,I,{...S?.runtime?{runtime:S.runtime}:{},...L?{branch:L}:{}}),d.create({id:I,virtual_mcp_id:s,...L?{branch:L}:{},...S?.runtime?{runtime:S.runtime}:{}}).then(()=>{Ve(sessionStorage,a,I),C(I)}).catch(()=>{C(I)}),I},e[3]=E,e[4]=a,e[5]=C,e[6]=d,e[7]=s,e[8]=Y):Y=e[8];const se=Y;let D;e[9]!==E||e[10]!==a||e[11]!==C||e[12]!==d||e[13]!==s?(D=S=>{const I=crypto.randomUUID(),L=S.virtualMcpId??s,z=L===s?E:null;At(sessionStorage,a,I,S.message),z&&Be(sessionStorage,a,I,{branch:z}),d.create({id:I,virtual_mcp_id:L,...z?{branch:z}:{}}).then(()=>{Ve(sessionStorage,a,I),C(I,{virtualMcpId:S.virtualMcpId,autosend:!0})}).catch(()=>{C(I,{virtualMcpId:S.virtualMcpId,autosend:!0})})},e[9]=E,e[10]=a,e[11]=C,e[12]=d,e[13]=s,e[14]=D):D=e[14];const Q=D;let F;e[15]!==x||e[16]!==d?(F=S=>{x&&d.setBranch(x,S)},e[15]=x,e[16]=d,e[17]=F):F=e[17];let W;e[18]!==q||e[19]!==se||e[20]!==Q||e[21]!==E||e[22]!==x||e[23]!==N||e[24]!==A||e[25]!==R||e[26]!==j||e[27]!==C||e[28]!==F?(W={virtualMcpId:N,taskId:x,openTask:C,createTask:se,createTaskWithMessage:Q,activeTask:q,isThreadLocked:A,lockedHarness:j,lockedBranch:R,currentBranch:E,setCurrentTaskBranch:F},e[18]=q,e[19]=se,e[20]=Q,e[21]=E,e[22]=x,e[23]=N,e[24]=A,e[25]=R,e[26]=j,e[27]=C,e[28]=F,e[29]=W):W=e[29];const K=W;let H;e[30]!==U||e[31]!==M||e[32]!==p||e[33]!==i?(H={user:i,contextPrompt:U,preferences:M,rawNavigateToTask:p},e[30]=U,e[31]=M,e[32]=p,e[33]=i,e[34]=H):H=e[34];const G=H;let B;e[35]!==r||e[36]!==G?(B=X.jsx(Es,{children:X.jsx(at.Provider,{value:G,children:r})}),e[35]=r,e[36]=G,e[37]=B):B=e[37];let m;return e[38]!==B||e[39]!==K?(m=X.jsx($e.Provider,{value:K,children:B}),e[38]=B,e[39]=K,e[40]=m):m=e[40],m}const $s=[];function fn(t){const e=O.c(5),{children:s}=t,{createTaskWithMessage:n}=ot();let r;e[0]!==n?(r={messages:$s,status:"ready",sendMessage:async i=>{n({message:rt(i)})},editQueuedMessage:Fs,stop:Us,submit:Ns,removeLocalMessage:Os,isSendInFlight:Ds,error:null,clearError:Rs,finishReason:null,runStatusStage:null,clearFinishReason:_s,isStreaming:!1,isChatEmpty:!0,isWaitingForApprovals:!1,isRunInProgress:!1,hasMoreOlder:!1,isFetchingOlder:!1,fetchOlderMessages:Ps},e[0]=n,e[1]=r):r=e[1];const a=r;let o;return e[2]!==s||e[3]!==a?(o=X.jsx(As,{value:a,children:s}),e[2]=s,e[3]=a,e[4]=o):o=e[4],o}async function Ps(){}function _s(){}function Rs(){}function Ds(){return!1}function Os(){}async function Ns(){}function Us(){}async function Fs(){return!1}function pn({taskId:t,children:e}){const s=Ae(),n=$t(),{virtualMcpId:r,activeTask:a,currentBranch:o}=ot(),i=zt({isDesktopApp:n,harnessId:a?.harness_id}),u=s("chat.input.codingAgentRequiresDesktop");Ge.has(t)||(Ge.add(t),St("chat_opened",{thread_id:t}));const{imageModel:f,webSearchModel:p,deepResearchModel:M,chatMode:w,setChatMode:d,appContexts:x,setTiptapDoc:N,simpleModeTier:U}=Ls(),b=k.useContext(at);if(!b)throw new Error(s("chat.chatContext.activeTaskProviderMissingContext"));const{user:C,contextPrompt:q,preferences:j,rawNavigateToTask:R}=b,{org:A,locator:E}=J(),Y=ys(),[se,D]=k.useState(null),Q=()=>{D(new Error(u))},F=es(),W=Le(),K=kt(),H=Je(),{openPanel:G}=vt(),B=Pt({connectionId:_t,orgId:A.id,orgSlug:A.slug}),m=Mt(A.slug,t,{client:B});k.use(m.ready);const S=ue(m.messages),I=ue(m.status),L=ue(m.finishReason),z=ue(m.runStatusStage),ie=ue(m.hasMoreOlder),Pe=ue(m.isFetchingOlder),P=k.useRef({onToolCall:F,queryClient:W,rawNavigateToTask:R,taskId:t,manager:K,navigate:H,openPanel:G,orgId:A.id,orgSlug:A.slug});P.current={onToolCall:F,queryClient:W,rawNavigateToTask:R,taskId:t,manager:K,navigate:H,openPanel:G,orgId:A.id,orgSlug:A.slug};const ke=()=>{const l=P.current;fs(l.taskId)&&(async()=>(await ee(l.orgSlug,l.taskId),await m.reconcileFromServer()&&be(l.taskId).get().length===0&&ps(l.taskId)))()};qt({orgSlug:A.slug,taskId:t,onTaskStatus:l=>{const h=P.current,c=l.data.message_id;if(l.data.status==="in_progress"&&c){Ue(h.taskId,c);const $=gs(h.taskId,c);$&&m.applyLocalMessage($),ee(h.orgSlug,h.taskId)}ke()},onReconnect:ke}),k.useEffect(()=>{const l={onData:y=>{if(y.type==="data-thread-title"){const T=y.data;if(!T?.title)return;const g=P.current;if(!g.taskId)return;g.manager.patchThread({id:g.taskId,title:T.title,updated_at:new Date().toISOString()});return}if(y.type==="data-deck-updated"){const T=y.data;if(!T?.path)return;const g=T.path,v=P.current;v.queryClient.invalidateQueries({queryKey:oe.orgFsStat(v.orgId,"home",g)}),v.queryClient.invalidateQueries({queryKey:oe.orgFsRecent(v.orgId)}),v.openPanel(gt(g));return}if(y.type==="data-open-preview"){const T=y.data,g=P.current,v=g.taskId;if(v){const le=g.manager.threads.get().find(V=>V.id===v);g.manager.patchThread({id:v,...T?.branch?{branch:T.branch}:{},metadata:{...le?.metadata??{},...T?.githubRepo?{githubRepo:T.githubRepo}:{},...T?.sandboxMap?{sandboxMap:T.sandboxMap}:{}}})}g.openPanel("site-editor");return}},onFinish:(y,T,g)=>{const v=P.current;v.taskId&&ee(v.orgSlug,v.taskId),v.taskId&&v.manager.patchThread({id:v.taskId,status:Ht(g,y.parts),updated_at:new Date().toISOString()});const le=y.parts?.some(_=>{const Se=_;return(Se.type==="tool-bash"||Se.type==="tool-write")&&Se.state==="output-available"});if(v.taskId&&le){const _=oe.threadOutputs(v.taskId);for(const Se of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{v.queryClient.invalidateQueries({queryKey:_})},Se)}v.queryClient.invalidateQueries({queryKey:oe.homeNextActions(v.orgSlug)});const V=y.metadata?.thread_id;V&&V!==v.taskId&&v.rawNavigateToTask(V)},onError:y=>{D(y),console.error("[chat] Error",y)},onToolCall:y=>P.current.onToolCall(y)};m.observer=l,ee(P.current.orgSlug,P.current.taskId);const h=y=>y==="submitted"||y==="streaming";let c=h(m.status.get().kind);const $=m.status.subscribe(()=>{const y=h(m.status.get().kind);if(y===c)return;c=y;const T=P.current;ee(T.orgSlug,T.taskId)});return()=>{m.observer===l&&(m.observer=null),$()}},[m]);const pe=I.kind==="submitted"||I.kind==="streaming",_e=S.length===0,Me=S.at(-1),Re=!pe&&Me?.role==="assistant"&&Me.parts.some(l=>"state"in l&&l.state==="approval-requested"),he=a,xe=(he?.status==="in_progress"||he?.status==="expired")&&I.kind==="ready"&&S.length>0;async function me(l){const h=t,c=r;if(i)return Q(),Z.delete(h),!1;const $=Object.entries(x),y=$.length>0?$.map(([V,_])=>`### App Context: ${V}
31
- ${_}`).join(`
32
-
33
- `):"",T=[q,y].filter(Boolean).join(`
34
-
35
- `);let g=w;g==="gen-image"&&!f&&(g="default"),g==="web-search"&&!p&&(g="default"),g==="deep-research"&&!M&&(g="default"),(g==="web-search"||g==="deep-research")&&d("default");const v=Jt({thread:a?{harness_id:a.harness_id??null,branch:a.branch??null}:null,globals:{branch:o}});a?.harness_id||K.patchThread({id:h,harness_id:"decopilot",updated_at:new Date().toISOString()});const le={tier:U,mode:g,toolApprovalLevel:j.toolApprovalLevel??yt(),system:T||void 0,agent:{id:c},thread_id:h,...v};try{if(pe||xe){let V=!0;try{ms(h,l),await m.enqueue(l,le),nt(h,{workflowId:`thread-run:${h}:${l.id}`,messageId:l.id,text:os(l.parts),hasAttachments:l.parts.some(_=>_.type==="file"),status:"queued",enqueuedAt:Date.now(),optimistic:!0}),ds(h)}catch(_){V=!1,He(h,l.id),Ue(h,l.id),D(_ instanceof Error?_:new Error(String(_))),ae.error(_ instanceof Error?_.message:s("chat.chatContext.failedToQueueMessage"))}return ee(A.slug,h),V}return await m.submit({kind:"message",message:l},le),!0}finally{Z.delete(h)}}async function ge(l){const h=l.parts??st(l.tiptapDoc);if(h.length===0||Z.has(t))return;Z.add(t),D(null),N(void 0);const c={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:C?.image??void 0,name:C?.name??"you"}},$={id:crypto.randomUUID(),role:"user",parts:h,metadata:c};await me($)}async function De(l,h){if(i)return Q(),!1;if(Z.has(t))return ae.info(s("chat.chatContext.stillSendingPreviousMessage")),!1;if(Z.add(t),!await Y.cancel(t,l))return Z.delete(t),ae.error(s("chat.chatContext.couldNotRemoveOriginalMessage")),!1;He(t,l),m.removeLocalMessage(l);const $={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:h}],metadata:{created_at:new Date().toISOString(),user:{avatar:C?.image??void 0,name:C?.name??"you"}}};try{return await me($)}catch(y){return ae.error(y instanceof Error?y.message:s("chat.chatContext.failedToSendEditedMessage")),!1}}const Ce=async()=>{m.stop();try{const l=await fetch(`/api/${A.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const h=await l.json().catch(()=>({}));throw new Error(h.message??s("chat.chatContext.cancelFailedStatus",{status:l.status}))}}catch(l){const h=l instanceof Error?l.message:s("chat.chatContext.failedToCancel");ae.error(h),console.error("[chat] cancelRun",l)}},ye=l=>ge(rt(l)),ce=Fe({strict:!1}).autosend===ze;k.useEffect(()=>{if(!ce||S.length>0||i)return;const l=xt(sessionStorage,E,t);l&&ge(l.message).then(()=>{Ct(sessionStorage,E,t)})},[ce,S.length,i,E,t,ge]);const Oe={messages:S,status:xs(I),sendMessage:ye,editQueuedMessage:De,stop:()=>{if(i){Q();return}Ce()},submit:async(l,h)=>{if(i){Q();return}await m.submit(l,h)},removeLocalMessage:l=>m.removeLocalMessage(l),isSendInFlight:()=>Z.has(t),error:se,clearError:()=>D(null),finishReason:L,runStatusStage:z,clearFinishReason:()=>m.finishReason.set(null),isStreaming:pe,isChatEmpty:_e,isWaitingForApprovals:Re??!1,isRunInProgress:xe,hasMoreOlder:ie,isFetchingOlder:Pe,fetchOlderMessages:m.fetchOlderMessages.bind(m)};return X.jsx(Ie.Provider,{value:Oe,children:e})}function hn(){const t=Ae(),e=k.useContext(Ie);if(!e)throw new Error(t("chat.chatContext.useChatStreamMissingContext"));return e}function mn(){return k.useContext(Ie)}function ot(){const t=Ae(),e=k.useContext($e);if(!e)throw new Error(t("chat.chatContext.useChatTaskMissingContext"));return e}function Ls(){const t=Ae(),e=k.useContext(je);if(!e)throw new Error(t("chat.chatContext.useChatPrefsMissingContext"));return e}function gn(){return k.useContext(je)}function qs(){return k.useContext($e)}export{pn as A,gn as B,Es as C,un as D,Be as E,tn as F,en as G,fn as T,hn as a,qs as b,Bt as c,Kt as d,ot as e,cn as f,ys as g,He as h,we as i,vs as j,ln as k,bs as l,mn as m,zt as n,dn as o,et as p,an as q,sn as r,on as s,Vt as t,Ls as u,Ne as v,rn as w,st as x,tt as y,nn as z};
@@ -1 +0,0 @@
1
- import{c as L,j as t,B as K,h as X,ae as Ye,ag as ie,b as W,E as De,r as D,W as xe,c7 as Ge,c8 as Ee,aq as Xe,u as Ze,L as te,a3 as et,a4 as Se,a1 as ye,a2 as we,t as tt,f as fe,c9 as Oe}from"./index-ODKhlf52.js";import{E as Re}from"./empty-state-BMKkn0m1.js";import{u as he}from"./use-mcp-client-qAu1HRUD.js";import{d as re,F as st,a as ae,b as ce}from"./form-C74AeBpT.js";import{I as ue}from"./input-CiTQTJk4.js";import{T as pe}from"./textarea-BCk4dtJd.js";import{a as ot,b as nt,V as ge,O as lt,M as it}from"./index-pC2bMkiH.js";import{aT as rt,T as at,aU as ct,ay as dt,al as mt,am as ut,aV as pt,w as Ce}from"./agent-icon-DMaKG5lr.js";import{g as xt,M as ft,a as Ie}from"./types-D6t6wY6o.js";import{A as ht,a as gt,b as jt}from"./alert-DcVkxaWg.js";import{S as Te,a as $e,b as Pe,c as ke,d as de}from"./select-CCKtBWNQ.js";import{B as Fe,a as Me,b as Y,c as se,d as oe,e as Be}from"./breadcrumb-DxzlsCMh.js";import{i as bt}from"./AlertCircle-CYzgJoBY.js";import{a as Nt}from"./Copy01-CJm4cfCT.js";import{i as vt}from"./Play-J7yukJwM.js";import{g as St}from"./connection-slug-CITJ0kGN.js";import{u as yt,T as wt}from"./use-mcp-auth-status-DSpPtB7I.js";import{a as ze,u as Le}from"./use-connection-B9U-_dTx.js";import{e as Ct}from"./use-navigate-to-agent-Cc5iyUAP.js";import{M as It,c as Tt}from"./monaco-editor-DiwjqzwB.js";import{I as Ae}from"./integration-icon-Kez26Bfu.js";import{m as $t,B as Pt}from"./chat-context-Bn5sHwf1.js";import{u as kt}from"./shell-layout-BS92F-1s.js";import{E as At}from"./empty-state-CY8_Cebe.js";import{n as Dt}from"./Tool02-BOHPr8jH.js";import"./constants-DNuUCxmW.js";import"./auth-DT85eno9.js";import"./label-D5NpFiWm.js";import"./Key01-JyLu0I4O.js";import"./extract-connection-data-B5gRedj8.js";import"./metadata-dUsYcpuu.js";import"./connection-5_SGsrJ3.js";import"./use-registry-connections-CPuanPK4.js";import"./use-organization-settings-BAq06qOp.js";import"./schema-R1g-EDIW.js";import"./task-board-BvGOyekg.js";import"./Plus-CqaGj-ml.js";import"./index-oIBCiETt.js";import"./index-2Csvi9Ws.js";import"./index-D1rygici.js";import"./popover-B6ROvgSp.js";import"./use-virtual-mcp-Dx_0SK12.js";import"./Check-DTtdlqwY.js";import"./SearchMd-Bc3Mg8g_.js";import"./Users03-DcaeZQDc.js";import"./use-create-virtual-mcp-DST-jZww.js";import"./Tool01-pzhJg-K8.js";import"./ArrowUp-BoD_mzsH.js";import"./ArrowLeft-DbqXNp4F.js";import"./XCircle-CWgi5YJD.js";import"./TrendUp01-Upn209vz.js";import"./ZoomOut-DUEecXAV.js";import"./CheckCircle-COo3JoVL.js";import"./ChevronUp-DW8NdY2L.js";import"./ChevronRight-CzHqvH7E.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./DotsVertical-BtJeAJ0k.js";import"./UserSquare-BTio6asa.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Settings02-BOeVFu7a.js";import"./Eye-B218eqe6.js";import"./Share07-8fkbsMDg.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./XClose-RbRtPt7h.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Link01-CdgOMLbc.js";import"./LinkExternal01-CQuu9G7s.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Trash01-sRqUo9Qp.js";import"./Upload01-D7ygRA1o.js";import"./User01-DGyK5bBG.js";import"./Users01-D_2eWavO.js";import"./Zap-BLJmtEf5.js";import"./slugify-CEUa2lfQ.js";import"./badge-CIvTSfE9.js";import"./mcp-oauth-C6LUe73x.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./github-repo-COLY3wWI.js";import"./editor-CMBiwHdj.js";import"./use-panel-navigate-D0FLl0De.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./avatar-DcREOm3L.js";import"./download-app-dialog-yVzVS3rF.js";import"./dialog-0Gin8X8J.js";import"./project-icon-Bvj4Gwi2.js";import"./command-D5rI_pln.js";import"./required-auth-layout-46OxjUc_.js";import"./use-org-sso-aiWQ_yZD.js";function Et(s){const e=L.c(15),{onSave:r,onUndo:o,isDirty:l,isSaving:i,saveLabel:a,undoLabel:u}=s,c=a===void 0?"Save":a,n=u===void 0?"Undo":u;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let g;e[1]!==i||e[2]!==o||e[3]!==n?(g=t.jsxs(K,{variant:"outline",size:"sm",onClick:o,disabled:i,"aria-label":n,children:[x,n]}),e[1]=i,e[2]=o,e[3]=n,e[4]=g):g=e[4];let m;e[5]!==i?(m=i?t.jsx(X,{className:"size-3.5"}):t.jsx(at,{size:14}),e[5]=i,e[6]=m):m=e[6];let f;e[7]!==i||e[8]!==r||e[9]!==c||e[10]!==m?(f=t.jsxs(K,{variant:"default",size:"sm",onClick:r,disabled:i,"aria-label":c,children:[m,c]}),e[7]=i,e[8]=r,e[9]=c,e[10]=m,e[11]=f):f=e[11];let p;return e[12]!==g||e[13]!==f?(p=t.jsxs(t.Fragment,{children:[g,f]}),e[12]=g,e[13]=f,e[14]=p):p=e[14],p}Ye({title:ie().min(1),description:ie().nullable(),body:ie()});function me(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Ot(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(o=>o==="mcps"),r=e>=0?s[e+1]:void 0;return r?decodeURIComponent(r):void 0}function Rt(s){const e=L.c(43),{form:r}=s,o=W();let l;e[0]!==o?(l=o("details.prompt.details"),e[0]=o,e[1]=l):l=e[1];let i;e[2]!==l?(i=t.jsx("div",{className:"text-sm font-medium text-foreground",children:l}),e[2]=l,e[3]=i):i=e[3];let a;e[4]!==o?(a=w=>{const{field:b}=w;return t.jsxs(ae,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:o("details.prompt.title")}),t.jsx(ce,{children:t.jsx(ue,{...b,placeholder:o("details.prompt.titlePlaceholder"),className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})},e[4]=o,e[5]=a):a=e[5];let u;e[6]!==r.control||e[7]!==a?(u=t.jsx(re,{control:r.control,name:"title",render:a}),e[6]=r.control,e[7]=a,e[8]=u):u=e[8];let c;e[9]!==o?(c=w=>{const{field:b}=w;return t.jsxs(ae,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:o("details.prompt.description")}),t.jsx(ce,{children:t.jsx(ue,{...b,value:b.value??"",placeholder:o("details.prompt.descriptionPlaceholder"),className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})},e[9]=o,e[10]=c):c=e[10];let n;e[11]!==r.control||e[12]!==c?(n=t.jsx(re,{control:r.control,name:"description",render:c}),e[11]=r.control,e[12]=c,e[13]=n):n=e[13];let x;e[14]!==u||e[15]!==n?(x=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[u,n]}),e[14]=u,e[15]=n,e[16]=x):x=e[16];let g;e[17]!==i||e[18]!==x?(g=t.jsxs("div",{className:"flex flex-col gap-4",children:[i,x]}),e[17]=i,e[18]=x,e[19]=g):g=e[19];let m;e[20]!==o?(m=o("details.prompt.message"),e[20]=o,e[21]=m):m=e[21];let f;e[22]!==m?(f=t.jsx("div",{className:"text-sm font-medium text-foreground",children:m}),e[22]=m,e[23]=f):f=e[23];let p;e[24]!==o?(p=o("details.prompt.messageDescription"),e[24]=o,e[25]=p):p=e[25];let j;e[26]!==p?(j=t.jsx("div",{className:"text-xs text-muted-foreground",children:p}),e[26]=p,e[27]=j):j=e[27];let N;e[28]!==o?(N=w=>{const{field:b}=w;return t.jsx(ae,{children:t.jsx(ce,{children:t.jsx(pe,{...b,value:b.value??"",placeholder:o("details.prompt.bodyPlaceholder"),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"})})})},e[28]=o,e[29]=N):N=e[29];let S;e[30]!==r.control||e[31]!==N?(S=t.jsx(re,{control:r.control,name:"body",render:N}),e[30]=r.control,e[31]=N,e[32]=S):S=e[32];let $;e[33]!==f||e[34]!==j||e[35]!==S?($=t.jsxs("div",{className:"flex flex-col gap-2",children:[f,j,S]}),e[33]=f,e[34]=j,e[35]=S,e[36]=$):$=e[36];let y;e[37]!==$||e[38]!==g?(y=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:[g,$]}),e[37]=$,e[38]=g,e[39]=y):y=e[39];let P;return e[40]!==r||e[41]!==y?(P=t.jsx(st,{...r,children:y}),e[40]=r,e[41]=y,e[42]=P):P=e[42],P}function Ft(s){const e=L.c(42),{providerId:r,promptId:o}=s,l=W(),{org:i}=xe(),a=r||null;let u;e[0]!==i.id||e[1]!==i.slug||e[2]!==a?(u={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=a,e[3]=u):u=e[3];const c=he(u),n=Ge(r,"PROMPT",o,c),x=Ee(r,"PROMPT",c),g=x.update.isPending;let m;e[4]!==n?(m=n?{title:n.title,description:n.description??null,body:me(n)}:void 0,e[4]=n,e[5]=m):m=e[5];let f;e[6]!==m?(f={values:m},e[6]=m,e[7]=f):f=e[7];const p=Xe(f);let j;e[8]!==p||e[9]!==n?(j=()=>{n&&p.reset({title:n.title,description:n.description??null,body:me(n)})},e[8]=p,e[9]=n,e[10]=j):j=e[10];const N=j;let S;e[11]!==x.update||e[12]!==p||e[13]!==o?(S=p.handleSubmit(async C=>{const I=await x.update.mutateAsync({id:o,data:{title:C.title,description:C.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:C.body}}]}});p.reset({title:I.title,description:I.description??null,body:me(I)})}),e[11]=x.update,e[12]=p,e[13]=o,e[14]=S):S=e[14];const $=S;if(!n){let C;e[15]!==l?(C=l("details.prompt.notFoundTitle"),e[15]=l,e[16]=C):C=e[16];let I;e[17]!==l?(I=l("details.prompt.notFoundDescription"),e[17]=l,e[18]=I):I=e[18];let O;return e[19]!==C||e[20]!==I?(O=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Re,{title:C,description:I})}),e[19]=C,e[20]=I,e[21]=O):O=e[21],O}let y;e[22]!==n.title?(y=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[22]=n.title,e[23]=y):y=e[23];let P;e[24]!==n.description?(P=n.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:n.description})]}):null,e[24]=n.description,e[25]=P):P=e[25];let w;e[26]!==y||e[27]!==P?(w=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,P]})}),e[26]=y,e[27]=P,e[28]=w):w=e[28];let b;e[29]!==$?(b=()=>{$()},e[29]=$,e[30]=b):b=e[30];let k;e[31]!==p.formState.isDirty||e[32]!==g||e[33]!==N||e[34]!==b?(k=t.jsx(ot,{children:t.jsx(Et,{onSave:b,onUndo:N,isDirty:p.formState.isDirty,isSaving:g})}),e[31]=p.formState.isDirty,e[32]=g,e[33]=N,e[34]=b,e[35]=k):k=e[35];let A;e[36]!==p?(A=t.jsx("div",{className:"h-full",children:t.jsx(Rt,{form:p})}),e[36]=p,e[37]=A):A=e[37];let E;return e[38]!==k||e[39]!==A||e[40]!==w?(E=t.jsxs(ge,{children:[w,k,A]}),e[38]=k,e[39]=A,e[40]=w,e[41]=E):E=e[41],E}function Mt(s){const e=L.c(10),{itemId:r}=s,o=W();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=Ot(),e[0]=l):l=e[0];const i=l;if(!i){let u;e[1]!==o?(u=o("details.prompt.notFoundTitle"),e[1]=o,e[2]=u):u=e[2];let c;e[3]!==o?(c=o("details.prompt.missingConnectionDescription"),e[3]=o,e[4]=c):c=e[4];let n;return e[5]!==u||e[6]!==c?(n=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Re,{title:u,description:c})}),e[5]=u,e[6]=c,e[7]=n):n=e[7],n}let a;return e[8]!==r?(a=t.jsx(De,{children:t.jsx(D.Suspense,{fallback:null,children:t.jsx(Ft,{providerId:i,promptId:r})})}),e[8]=r,e[9]=a):a=e[9],a}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function zt(s){const e=L.c(12),{toolName:r,connectionId:o,siblings:l,onSelectInstance:i,onBack:a}=s,u=W();let c;e[0]!==o?(c={connectionId:o},e[0]=o,e[1]=c):c=e[1];const n=yt(c);if(!n.isAuthenticated){let m;return e[2]!==n.supportsOAuth||e[3]!==a||e[4]!==u?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:n.supportsOAuth?t.jsx(lt,{onAuthenticate:()=>a(),buttonText:u("details.tool.goBackToAuthenticate")}):t.jsx(it,{hasReadme:!1})}),e[2]=n.supportsOAuth,e[3]=a,e[4]=u,e[5]=m):m=e[5],m}const x=`${o}:${r}`;let g;return e[6]!==o||e[7]!==i||e[8]!==l||e[9]!==x||e[10]!==r?(g=t.jsx(Lt,{toolName:r,connectionId:o,siblings:l,onSelectInstance:i},x),e[6]=o,e[7]=i,e[8]=l,e[9]=x,e[10]=r,e[11]=g):g=e[11],g}function Lt({toolName:s,connectionId:e,siblings:r,onSelectInstance:o}){const l=W(),{replayId:i}=Ze({strict:!1}),a=(()=>{if(!i)return null;const d=`replay-${i}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),u=(()=>{if(!a)return null;const d={};for(const[h,T]of Object.entries(a))T!==null&&typeof T=="object"?d[h]=JSON.stringify(T,null,2):d[h]=T;return d})(),[c,n]=D.useState(u??{}),[x,g]=D.useState(a?JSON.stringify(a,null,2):"{}"),[m,f]=D.useState(null),[p,j]=D.useState(null),[N,S]=D.useState(null),[$,y]=D.useState(null),[P,w]=D.useState(!1),[b,k]=D.useState(null),{org:A}=xe(),E=ze(e),C=$t(),I=Pt(),{openSidePanel:O}=kt(),U=`${e}:${s}`,F=he({connectionId:e,orgId:A.id,orgSlug:A.slug}),V=Ct({client:F}),v=V.data?.tools?.find(d=>d.name===s),R=xt(v?._meta),J=d=>{if(!C)return;const h=Tt(d.content);h.content.length>0&&(O(),C.sendMessage({tiptapDoc:h}))},[M,B]=D.useState("json"),[q,Q]=D.useState(!1);R&&!q&&(B("ui"),Q(!0));const _=v?.inputSchema?.properties,je=_?Object.keys(_):[],G=je.length>0,Z={};if(G&&v?.inputSchema?.properties)for(const d of je)Z[d]=v.inputSchema.required?.includes(d)?"":void 0;const ne=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{w(!0),y(null),f(null),j(null),S(null),k(null);const d=performance.now();try{if(!F)throw new Error("MCP client is not available");const h=G?{...Z,...c}:(()=>{const z=x.trim();if(!z)return{};const H=JSON.parse(z);if(H&&typeof H=="object")return H;throw new Error("Raw JSON input must be an object.")})();G&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([z,H])=>{if((H.type==="object"||H.type==="array")&&typeof h[z]=="string")try{h[z]=JSON.parse(h[z])}catch{}else if((H.type==="number"||H.type==="integer")&&typeof h[z]=="string"&&h[z]!==""){const ve=Number(h[z]);Number.isNaN(ve)||(h[z]=ve)}});const T=await F.callTool({name:s,arguments:h}),ee=T.structuredContent??T,Ke=performance.now(),We=Math.round(Ke-d);f(ee),j(T),S(h);const Qe=JSON.stringify(ee),Ne=new TextEncoder().encode(Qe).length;k({duration:`${We}ms`,bytes:`${Ne} bytes`,tokens:`~${Math.ceil(Ne/4)} tokens`,cost:"$0.0000"})}catch(h){const T=h instanceof Error?h.message:String(h);y(T||"Unknown error occurred");const ee=performance.now();k({duration:`${Math.round(ee-d)}ms`})}finally{w(!1)}},le=(d,h)=>{n(T=>({...T,[d]:h}))},Ve=()=>{f(null),j(null),S(null),y(null),k(null)},_e=v?.name??Bt(s),Je=t.jsx(Fe,{children:t.jsxs(Me,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections",params:{org:A.slug},children:l("details.tool.connections")})})}),t.jsx(oe,{}),E&&t.jsxs(t.Fragment,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections/$appSlug",params:{org:A.slug,appSlug:St(E)},search:{tab:"tools"},children:E.title})})}),t.jsx(oe,{})]}),t.jsx(Y,{children:t.jsx(Be,{children:_e})})]})}),be=r.length>1&&t.jsxs(Te,{value:e,onValueChange:o,children:[t.jsx($e,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(Pe,{})}),t.jsx(ke,{children:r.map(d=>t.jsx(de,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ae,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),qe=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:l("details.tool.parameters")}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-destructive",children:"*"})," ",l("details.tool.required")]})]}),t.jsx("div",{className:"space-y-4",children:G&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([d,h])=>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,v.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-destructive text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(pe,{className:"font-mono text-xs",value:ne(d)?c[d]??"":Z[d]??"",onChange:T=>le(d,T.target.value),placeholder:l("details.tool.enterAsJson",{key:d}),rows:3}):h.type==="boolean"?t.jsxs(Te,{value:ne(d)?String(c[d]??""):"",onValueChange:T=>le(d,T==="true"),children:[t.jsx($e,{children:t.jsx(Pe,{placeholder:l("details.tool.selectTrueOrFalse")})}),t.jsxs(ke,{children:[t.jsx(de,{value:"true",children:"true"}),t.jsx(de,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ne(d)?c[d]??"":Z[d]??"",onChange:T=>le(d,T.target.value),placeholder:l("details.tool.enter",{key:d})})]},d)):v?.inputSchema&&!G?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:l("details.tool.rawJsonInput")}),t.jsx(pe,{className:"font-mono text-xs min-h-[120px]",value:x,onChange:d=>g(d.target.value),placeholder:l("details.tool.rawJsonExample")})]}):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:l("details.tool.noParametersRequired")})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:P?t.jsxs(K,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Ve,children:[t.jsx(ct,{className:"h-3.5 w-3.5"}),l("details.tool.cancel")]}):t.jsxs(K,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),l("details.tool.executeTool")]})})]}),He=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:l("details.tool.result")}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&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(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(mt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&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:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),R&&t.jsx(et,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(K,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>B("ui"),children:t.jsx(pt,{size:14})})}),t.jsx(we,{children:l("details.tool.interactiveView")})]}),t.jsxs(Se,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(K,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>B("json"),children:t.jsx(Ce,{size:14})})}),t.jsx(we,{children:l("details.tool.jsonView")})]})]})})]})]}),$&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(ht,{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(bt,{className:"h-4 w-4"}),t.jsx(gt,{className:"mb-0",children:l("details.tool.executionFailed")})]}),t.jsx(jt,{className:"text-xs text-destructive",children:$})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:R&&M==="ui"&&F?t.jsx(D.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(X,{className:"size-4"}),t.jsx("span",{className:"text-sm",children:l("details.tool.loadingApp")})]})}),children:t.jsx(ft,{resourceURI:R,toolInfo:v?{tool:v}:void 0,toolInput:N??void 0,toolResult:p??void 0,displayMode:"fullscreen",minHeight:Ie.view.minHeight,maxHeight:Ie.view.maxHeight,client:F,onMessage:J,onUpdateModelContext:d=>I?.setAppContext(U,d),onTeardown:()=>I?.clearAppContext(U),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(It,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(K,{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(m,null,2)),tt.success(l("details.tool.copiedToClipboard"))},children:t.jsx(Nt,{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(Ce,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:l("details.tool.runToolToSeeResults")})]})})]});return t.jsx(ge,{breadcrumb:Je,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(Ae,{icon:E?.icon||null,name:E?.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:[V.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success animate-pulse shrink-0"}):V.isLoading?t.jsx(X,{className:"size-[10px] text-warning shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-destructive shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:V.isSuccess?"ready":V.isLoading?"connecting":"error"})]}),t.jsx(wt,{annotations:v?.annotations,_meta:v?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:be})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.description||"No description available"})]}),r.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:l("details.tool.instance")}),be]}),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:qe}),He]})})]})})}function Ut(s){const e=L.c(20),{itemId:r,siblings:o,onBack:l}=s,i=W(),[a,u]=D.useState(o[0]?.id??"");let c;e[0]!==a||e[1]!==o?(c=o.find(f=>f.id===a)?.id??o[0]?.id??"",e[0]=a,e[1]=o,e[2]=c):c=e[2];const n=c;if(!ze(n||void 0)||!n){let f;e[3]!==i?(f=i("details.tool.connectionNotFound"),e[3]=i,e[4]=f):f=e[4];let p;e[5]!==f?(p=t.jsx("h3",{className:"text-lg font-semibold",children:f}),e[5]=f,e[6]=p):p=e[6];let j;e[7]!==i?(j=i("details.tool.connectionNotFoundMessage"),e[7]=i,e[8]=j):j=e[8];let N;e[9]!==j?(N=t.jsx("p",{className:"text-sm text-muted-foreground",children:j}),e[9]=j,e[10]=N):N=e[10];let S;return e[11]!==p||e[12]!==N?(S=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:[p,N]})}),e[11]=p,e[12]=N,e[13]=S):S=e[13],S}let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{className:"size-8 text-muted-foreground"})}),e[14]=g):g=e[14];let m;return e[15]!==n||e[16]!==l||e[17]!==o||e[18]!==r?(m=t.jsx(D.Suspense,{fallback:g,children:t.jsx(zt,{toolName:r,connectionId:n,siblings:o,onSelectInstance:u,onBack:l})}),e[15]=n,e[16]=l,e[17]=o,e[18]=r,e[19]=m):m=e[19],m}const Vt={prompt:Mt};function _t(){const s=L.c(9),e=Oe();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=r):r=s[0];const o=fe(r),l=decodeURIComponent(o.itemId);let i;s[1]!==o.appSlug?(i={slug:o.appSlug},s[1]=o.appSlug,s[2]=i):i=s[2];const a=Le(i);let u;s[3]!==e.history?(u=()=>{e.history.back()},s[3]=e.history,s[4]=u):u=s[4];const c=u,n=Jt;let x;return s[5]!==c||s[6]!==l||s[7]!==a?(x=t.jsx(Ut,{itemId:l,siblings:a,onBack:c,onUpdate:n}),s[5]=c,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Jt(s){return Promise.resolve()}function qt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Ht(){const s=L.c(52),e=Oe();let r;s[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=r):r=s[0];const o=fe(r),l=W(),i=decodeURIComponent(o.collectionName),a=decodeURIComponent(o.itemId);let u;s[1]!==e.history?(u=()=>{e.history.back()},s[1]=e.history,s[2]=u):u=s[2];const c=u,{org:n}=xe();let x;s[3]!==o.appSlug?(x={slug:o.appSlug},s[3]=o.appSlug,s[4]=x):x=s[4];const m=Le(x)[0]??null,f=m?.id??"",p=f||"no-connection",j=f??null;let N;s[5]!==n.id||s[6]!==n.slug||s[7]!==j?(N={connectionId:j,orgId:n.id,orgSlug:n.slug},s[5]=n.id,s[6]=n.slug,s[7]=j,s[8]=N):N=s[8];const S=he(N),$=Ee(p,i,S);let y;s[9]!==$||s[10]!==a?(y=async _=>{a&&await $.update.mutateAsync({id:a,data:_})},s[9]=$,s[10]=a,s[11]=y):y=s[11];const P=y;let w;s[12]!==i?(w=i?.toLowerCase(),s[12]=i,s[13]=w):w=s[13];const b=w,k=b&&Vt[b];let A;s[14]!==i?(A=qt(i),s[14]=i,s[15]=A):A=s[15];const E=A;let C;s[16]!==n.slug?(C=t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections",params:{org:n.slug},children:"Connections"})})}),s[16]=n.slug,s[17]=C):C=s[17];let I;s[18]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(oe,{}),s[18]=I):I=s[18];let O;s[19]!==i||s[20]!==m||s[21]!==n.slug||s[22]!==o.appSlug?(O=m&&t.jsxs(t.Fragment,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections/$appSlug",params:{org:n.slug,appSlug:o.appSlug},search:{tab:i},children:m.title})})}),t.jsx(oe,{})]}),s[19]=i,s[20]=m,s[21]=n.slug,s[22]=o.appSlug,s[23]=O):O=s[23];let U;s[24]!==E?(U=t.jsx(Y,{children:t.jsx(Be,{children:E})}),s[24]=E,s[25]=U):U=s[25];let F;s[26]!==O||s[27]!==U||s[28]!==C?(F=t.jsx(Fe,{children:t.jsxs(Me,{children:[C,I,O,U]})}),s[26]=O,s[27]=U,s[28]=C,s[29]=F):F=s[29];const V=F;if(k){let _;return s[30]!==k||s[31]!==c||s[32]!==P||s[33]!==a?(_=t.jsx(k,{itemId:a,onBack:c,onUpdate:P}),s[30]=k,s[31]=c,s[32]=P,s[33]=a,s[34]=_):_=s[34],_}let v;s[35]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Dt,{size:36,className:"text-muted-foreground"}),s[35]=v):v=s[35];let R;s[36]!==l?(R=l("orgs.collectionDetail.noComponentDefinedTitle"),s[36]=l,s[37]=R):R=s[37];let J;s[38]!==l?(J=l("orgs.collectionDetail.noComponentDefinedDescription"),s[38]=l,s[39]=J):J=s[39];let M;s[40]!==l?(M=l("orgs.collectionDetail.goBackButton"),s[40]=l,s[41]=M):M=s[41];let B;s[42]!==c||s[43]!==M?(B={onClick:c,children:M},s[42]=c,s[43]=M,s[44]=B):B=s[44];let q;s[45]!==R||s[46]!==J||s[47]!==B?(q=t.jsx(At,{icon:v,title:R,description:J,buttonProps:B}),s[45]=R,s[46]=J,s[47]=B,s[48]=q):q=s[48];let Q;return s[49]!==V||s[50]!==q?(Q=t.jsx(ge,{breadcrumb:V,children:q}),s[49]=V,s[50]=q,s[51]=Q):Q=s[51],Q}function Kt(){const s=L.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 r=fe(e);if(decodeURIComponent(r.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(_t,{}),s[1]=a):a=s[1],a}let i;return s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ht,{}),s[2]=i):i=s[2],i}function Jo(){const s=L.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(De,{children:t.jsx(D.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{className:"size-8 text-muted-foreground"})}),children:t.jsx(Kt,{})})}),s[0]=e):e=s[0],e}export{Jo as default};
@@ -1 +0,0 @@
1
- import{ae as ve,ak as $e,ao as Oe,ag as me,af as Me,c as U,b as L,j as t,h as Ne,B as q,r as Z,l as Se,W as se,a7 as ze,x as ue,K as te,d as ne,b2 as Ee,b5 as xe,F as Re,E as Ue,f as Ve,c3 as Fe,n as Le,aq as Be,ar as qe,bj as Ge,bi as He,bg as Ke,bh as Qe,c4 as We,t as Y}from"./index-ODKhlf52.js";import{g as Xe}from"./extract-connection-data-B5gRedj8.js";import{E as ye}from"./empty-state-BMKkn0m1.js";import{E as Je,c as Ye,r as Ze,b as et,d as tt}from"./connection-form-helpers-DNcNmxy2.js";import{c as st,S as nt,V as it}from"./index-pC2bMkiH.js";import{u as Ce,T as ot}from"./use-mcp-auth-status-DSpPtB7I.js";import{a as at}from"./use-members-BaNaE65J.js";import{A as lt}from"./avatar-DcREOm3L.js";import{a as _e,b as we,u as rt}from"./use-connection-B9U-_dTx.js";import{u as ke}from"./use-mcp-client-qAu1HRUD.js";import{e as ct}from"./use-navigate-to-agent-Cc5iyUAP.js";import{a as dt}from"./use-mcp-prompts-BAjC4pC7.js";import{i as mt,a as ut}from"./mcp-oauth-C6LUe73x.js";import{I as le}from"./integration-icon-Kez26Bfu.js";import{s as xt}from"./Plus-CqaGj-ml.js";import{R as pt,S as ft,u as ht,aS as gt,s as ie}from"./agent-icon-DMaKG5lr.js";import{a as Ie,s as jt}from"./Settings02-BOeVFu7a.js";import{s as ce}from"./Trash01-sRqUo9Qp.js";import{d as K,a as Q,e as W,b as B,c as X,f as bt,F as vt}from"./form-C74AeBpT.js";import{I as J}from"./input-CiTQTJk4.js";import{u as Nt,D as St}from"./use-delete-connection-DTstMy3G.js";import{c as yt,B as Ct,a as _t,C as wt}from"./monitoring-stats-row-C5tcYCvm.js";import{C as kt,a as It,b as Tt}from"./chart-BGxiKDVj.js";import{a as At}from"./use-virtual-mcp-Dx_0SK12.js";import{i as Te}from"./ChevronRight-CzHqvH7E.js";import{b as Ae}from"./Users03-DcaeZQDc.js";import{b as oe,c as Pt,T as ae,a as Dt}from"./tabs-DUurzPXg.js";import{g as Pe}from"./connection-slug-CITJ0kGN.js";import{b as $t}from"./Tool01-pzhJg-K8.js";import{g as de,M as Ot}from"./types-D6t6wY6o.js";import{C as Mt}from"./collection-search-BL14Irul.js";import{B as zt}from"./badge-CIvTSfE9.js";import{c as Et,D as Rt,b as Ut,a as pe}from"./dropdown-menu-DeCqeum7.js";import{S as fe,a as he,b as ge,c as je,d as H}from"./select-CCKtBWNQ.js";import{i as Vt}from"./CheckCircle-COo3JoVL.js";import{t as Ft}from"./ChevronUp-DW8NdY2L.js";import{n as Lt}from"./Tool02-BOHPr8jH.js";import{b as Bt}from"./UserSquare-BTio6asa.js";import{s as qt}from"./XClose-RbRtPt7h.js";import{p as Gt,i as Ht}from"./connection-5_SGsrJ3.js";import"./metadata-dUsYcpuu.js";import"./constants-DNuUCxmW.js";import"./Key01-JyLu0I4O.js";import"./auth-DT85eno9.js";import"./use-registry-connections-CPuanPK4.js";import"./use-organization-settings-BAq06qOp.js";import"./schema-R1g-EDIW.js";import"./task-board-BvGOyekg.js";import"./index-oIBCiETt.js";import"./index-2Csvi9Ws.js";import"./index-D1rygici.js";import"./popover-B6ROvgSp.js";import"./Check-DTtdlqwY.js";import"./SearchMd-Bc3Mg8g_.js";import"./use-create-virtual-mcp-DST-jZww.js";import"./Eye-B218eqe6.js";import"./use-org-auth-client-5qGP3Zwp.js";import"./User01-DGyK5bBG.js";import"./use-destination-route-BeQrBWgu.js";import"./hooks-Bf7O-39q.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-Czf55XZy.js";import"./chat-context-Bn5sHwf1.js";import"./use-panel-navigate-D0FLl0De.js";import"./slugify-CEUa2lfQ.js";import"./use-is-desktop-app-BNujXJc_.js";import"./use-ai-providers-DId9f_Qw.js";import"./location-oTTXFrSF.js";import"./use-decopilot-events-xXOXhSly.js";import"./github-repo-COLY3wWI.js";import"./AlertCircle-CYzgJoBY.js";import"./ArrowUp-BoD_mzsH.js";import"./ArrowLeft-DbqXNp4F.js";import"./XCircle-CWgi5YJD.js";import"./TrendUp01-Upn209vz.js";import"./ZoomOut-DUEecXAV.js";import"./ChevronSelectorVertical-DyPLbF1-.js";import"./DotsVertical-BtJeAJ0k.js";import"./Copy01-CJm4cfCT.js";import"./CreditCard01-CjfdxBcA.js";import"./Download01-vFzjwQsB.js";import"./Share07-8fkbsMDg.js";import"./GitBranch01-BS5U0z6G.js";import"./Globe01-cK6XwV5G.js";import"./HardDrive-CuWaM4M_.js";import"./Image01-tcHGSkc1.js";import"./Link01-CdgOMLbc.js";import"./LinkExternal01-CQuu9G7s.js";import"./Monitor01-7FxykVXR.js";import"./Sun-CrsI3Qul.js";import"./Package-DJDm2xPv.js";import"./Palette-C64d0Iko.js";import"./Play-J7yukJwM.js";import"./Shield01-CVfgL569.js";import"./Stars01-jhCTR7KB.js";import"./Upload01-D7ygRA1o.js";import"./Users01-D_2eWavO.js";import"./Zap-BLJmtEf5.js";import"./label-D5NpFiWm.js";import"./alert-dialog-B0Wnos4x.js";import"./AreaChart-DAY89ljM.js";import"./ErrorBarContext-Dc6l3YK0.js";import"./Sector-hJmrO2Op.js";const Kt=ve({scopes:Me(me()).describe("List of scopes available"),stateSchema:$e(me(),Oe()).describe("JSON Schema (draft-07) defining the state structure")}),Qt=[{name:"MCP_CONFIGURATION",inputSchema:ve({}),outputSchema:Kt}];function Wt(s){const e=U.c(61),{instance:n,onConfigure:c,onAuthenticate:o,onDelete:i,onToggleStatus:l}=s,a=L();let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const p=Ce(d),r=!(n.connection_type==="VIRTUAL")&&p.supportsOAuth&&!p.isAuthenticated,f=n.status!=="active",u=r||f?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==u?(h=Se("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",u),e[2]=u,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let j;e[7]!==n.title?(j=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=j):j=e[8];let S;e[9]!==n.status||e[10]!==f||e[11]!==r||e[12]!==a?(S=r?t.jsx("span",{className:"text-xs text-destructive font-medium",children:a("details.connectionInstancesPanel.needsAuthorization")}):f?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?a("details.connectionInstancesPanel.disabledError"):a("details.connectionInstancesPanel.disabled")}):null,e[9]=n.status,e[10]=f,e[11]=r,e[12]=a,e[13]=S):S=e[13];let v;e[14]!==j||e[15]!==S?(v=t.jsxs("div",{className:"flex-1 min-w-0",children:[j,S]}),e[14]=j,e[15]=S,e[16]=v):v=e[16];let y;e[17]!==n||e[18]!==r||e[19]!==o||e[20]!==a?(y=r&&t.jsx(q,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>o(n),children:a("details.connectionInstancesPanel.authorize")}),e[17]=n,e[18]=r,e[19]=o,e[20]=a,e[21]=y):y=e[21];let P;e[22]!==n||e[23]!==f||e[24]!==l||e[25]!==a?(P=f?t.jsxs(q,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>l(n,"active"),children:[t.jsx(pt,{size:13}),a("details.connectionInstancesPanel.enable")]}):t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>l(n,"inactive"),title:a("details.connectionInstancesPanel.disable"),"aria-label":a("details.connectionInstancesPanel.disable"),children:t.jsx(ft,{size:13})}),e[22]=n,e[23]=f,e[24]=l,e[25]=a,e[26]=P):P=e[26];let D;e[27]!==n||e[28]!==c?(D=()=>c(n),e[27]=n,e[28]=c,e[29]=D):D=e[29];let _;e[30]!==a?(_=a("details.connectionInstancesPanel.configure"),e[30]=a,e[31]=_):_=e[31];let M;e[32]!==a?(M=a("details.connectionInstancesPanel.configure"),e[32]=a,e[33]=M):M=e[33];let T;e[34]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Ie,{size:13}),e[34]=T):T=e[34];let $;e[35]!==D||e[36]!==_||e[37]!==M?($=t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:D,title:_,"aria-label":M,children:T}),e[35]=D,e[36]=_,e[37]=M,e[38]=$):$=e[38];let I;e[39]!==n||e[40]!==i?(I=()=>i(n),e[39]=n,e[40]=i,e[41]=I):I=e[41];let N;e[42]!==a?(N=a("details.connectionInstancesPanel.delete"),e[42]=a,e[43]=N):N=e[43];let b;e[44]!==a?(b=a("details.connectionInstancesPanel.delete"),e[44]=a,e[45]=b):b=e[45];let E;e[46]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(ce,{size:13}),e[46]=E):E=e[46];let z;e[47]!==I||e[48]!==N||e[49]!==b?(z=t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:I,title:N,"aria-label":b,children:E}),e[47]=I,e[48]=N,e[49]=b,e[50]=z):z=e[50];let k;e[51]!==$||e[52]!==z||e[53]!==y||e[54]!==P?(k=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[y,P,$,z]}),e[51]=$,e[52]=z,e[53]=y,e[54]=P,e[55]=k):k=e[55];let A;return e[56]!==k||e[57]!==h||e[58]!==g||e[59]!==v?(A=t.jsxs("div",{className:h,children:[g,v,k]}),e[56]=k,e[57]=h,e[58]=g,e[59]=v,e[60]=A):A=e[60],A}function Xt(s){const e=U.c(21),{instance:n,onConfigure:c}=s,o=L();let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let l;e[3]!==n.title?(l=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]=l):l=e[4];let a;e[5]!==n||e[6]!==c?(a=()=>c(n),e[5]=n,e[6]=c,e[7]=a):a=e[7];let d;e[8]!==o?(d=o("details.connectionInstancesPanel.configure"),e[8]=o,e[9]=d):d=e[9];let p;e[10]!==o?(p=o("details.connectionInstancesPanel.configure"),e[10]=o,e[11]=p):p=e[11];let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{size:13}),e[12]=m):m=e[12];let r;e[13]!==a||e[14]!==d||e[15]!==p?(r=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,title:d,"aria-label":p,children:m})}),e[13]=a,e[14]=d,e[15]=p,e[16]=r):r=e[16];let f;return e[17]!==i||e[18]!==l||e[19]!==r?(f=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[i,l,r]}),e[17]=i,e[18]=l,e[19]=r,e[20]=f):f=e[20],f}function Jt(s){const e=U.c(33),{instances:n,onConfigure:c,onAuthenticate:o,onDelete:i,onToggleStatus:l,onAdd:a,isAdding:d}=s,p=L();if(n.length===0)return null;let m;e[0]!==n.length||e[1]!==p?(m=n.length===1?p("details.connectionInstancesPanel.instance"):p("details.connectionInstancesPanel.instances"),e[0]=n.length,e[1]=p,e[2]=m):m=e[2];let r;e[3]!==m?(r=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[3]=m,e[4]=r):r=e[4];let f;e[5]!==d?(f=d?t.jsx(Ne,{className:"size-[13px]"}):t.jsx(xt,{size:13}),e[5]=d,e[6]=f):f=e[6];let u;e[7]!==p?(u=p("details.connectionInstancesPanel.addInstance"),e[7]=p,e[8]=u):u=e[8];let h;e[9]!==d||e[10]!==a||e[11]!==f||e[12]!==u?(h=t.jsxs(q,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:a,disabled:d,children:[f,u]}),e[9]=d,e[10]=a,e[11]=f,e[12]=u,e[13]=h):h=e[13];let g;e[14]!==r||e[15]!==h?(g=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[r,h]}),e[14]=r,e[15]=h,e[16]=g):g=e[16];let j;if(e[17]!==n||e[18]!==o||e[19]!==c||e[20]!==i||e[21]!==l){let y;e[23]!==o||e[24]!==c||e[25]!==i||e[26]!==l?(y=P=>t.jsx(Z.Suspense,{fallback:t.jsx(Xt,{instance:P,onConfigure:c}),children:t.jsx(Wt,{instance:P,onConfigure:c,onAuthenticate:o,onDelete:i,onToggleStatus:l})},P.id),e[23]=o,e[24]=c,e[25]=i,e[26]=l,e[27]=y):y=e[27],j=n.map(y),e[17]=n,e[18]=o,e[19]=c,e[20]=i,e[21]=l,e[22]=j}else j=e[22];let S;e[28]!==j?(S=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:j}),e[28]=j,e[29]=S):S=e[29];let v;return e[30]!==g||e[31]!==S?(v=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[g,S]}),e[30]=g,e[31]=S,e[32]=v):v=e[32],v}function Yt(s,e=3){const n=new Map;for(const c of s){if(!c.isError)continue;const o=(c.errorMessage??"").trim()||"Unknown error";n.set(o,(n.get(o)??0)+1)}return[...n.entries()].map(([c,o])=>({message:c,count:o})).sort((c,o)=>o.count-c.count).slice(0,e)}const Zt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function es(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 ts={calls:{label:"Tool calls"},errors:{label:"Errors"}};function ss(s){const e=U.c(4),{connectionId:n,orgId:c,timeframe:o}=s,i=L(),l=ze(),a=es(o),{data:d}=ue({queryKey:te.connectionActivity(n,o,c),queryFn:async()=>await l.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),{data:p}=ue({queryKey:te.connectionActivityErrors(n,o,c),queryFn:async()=>await l.call("MONITORING_LOGS_LIST",{startDate:a.startDate.toISOString(),endDate:a.endDate.toISOString(),connectionId:n,isError:!0,limit:1,offset:0}),staleTime:3e5}),m=yt(d?.logs??[],a,void 0,d?.total,p?.total),r=m.data,f=m.totalCalls>0,u=Yt(d?.logs??[]),h=m.totalCalls>0?Math.round(m.totalErrors/m.totalCalls*100):0;let g;e[0]!==i?(g=i("details.connectionActivity.toolCalls"),e[0]=i,e[1]=g):g=e[1];let j;return e[2]!==g?(j=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:g}),e[2]=g,e[3]=j):j=e[3],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:m.totalCalls.toLocaleString()}),j]}),m.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:m.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("details.connectionActivity.errors")})]}),m.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(m.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("details.connectionActivity.avgLatency")})]})]}),f?t.jsxs("div",{children:[t.jsx(kt,{config:ts,className:"h-16 w-full",children:t.jsxs(Ct,{data:r,barCategoryGap:"4%",children:[t.jsx(It,{content:t.jsx(Tt,{labelFormatter:os}),cursor:{fill:"var(--muted)"}}),t.jsx(_t,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:r.map(is)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:r[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:r[r.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:i("details.connectionActivity.noActivityInThisPeriod")})}),u.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:[i("details.connectionActivity.topErrors"),h>0?` · ${i("details.connectionActivity.errorRatePercentage",{errorRate:h.toString()})}`:""]}),t.jsx("ul",{className:"space-y-1.5",children:u.map(ns)})]})]})}function ns(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function is(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function os(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=U.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 ls(s){const e=U.c(22),{connectionId:n}=s,c=L(),[o,i]=Z.useState("14d"),{org:l}=se();let a;e[0]!==c?(a=c("details.connectionActivity.activity"),e[0]=c,e[1]=a):a=e[1];let d;e[2]!==a?(d=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:a})}),e[2]=a,e[3]=d):d=e[3];let p;e[4]!==c?(p=c("details.connectionActivity.timeframe"),e[4]=c,e[5]=p):p=e[5];let m;e[6]!==o?(m=Zt.map(j=>t.jsx("button",{type:"button","aria-pressed":o===j.value,onClick:()=>i(j.value),className:Se("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",o===j.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:j.label},j.value)),e[6]=o,e[7]=m):m=e[7];let r;e[8]!==p||e[9]!==m?(r=t.jsx("div",{role:"group","aria-label":p,className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:m}),e[8]=p,e[9]=m,e[10]=r):r=e[10];let f;e[11]!==d||e[12]!==r?(f=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[d,r]}),e[11]=d,e[12]=r,e[13]=f):f=e[13];let u;e[14]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(as,{}),e[14]=u):u=e[14];let h;e[15]!==n||e[16]!==l.id||e[17]!==o?(h=t.jsx(Z.Suspense,{fallback:u,children:t.jsx(ss,{connectionId:n,orgId:l.id,timeframe:o})}),e[15]=n,e[16]=l.id,e[17]=o,e[18]=h):h=e[18];let g;return e[19]!==f||e[20]!==h?(g=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,h]}),e[19]=f,e[20]=h,e[21]=g):g=e[21],g}function rs(s){const e=U.c(15),{virtualMcp:n,org:c}=s,o=ne();let i;e[0]!==o||e[1]!==c||e[2]!==n.id?(i=()=>{const r=crypto.randomUUID();o({to:"/$org/$taskId",params:{org:c,taskId:r},search:{virtualmcpid:n.id}})},e[0]=o,e[1]=c,e[2]=n.id,e[3]=i):i=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Ae,{size:16}),e[4]=l):l=e[4];let a;e[5]!==n.icon||e[6]!==n.title?(a=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:l}),e[5]=n.icon,e[6]=n.title,e[7]=a):a=e[7];let d;e[8]!==n.title?(d=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=d):d=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Te,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=p):p=e[10];let m;return e[11]!==i||e[12]!==a||e[13]!==d?(m=t.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[a,d,p]}),e[11]=i,e[12]=a,e[13]=d,e[14]=m):m=e[14],m}function cs(s){const e=U.c(7),{virtualMcps:n,org:c}=s;let o;if(e[0]!==c||e[1]!==n){let l;e[3]!==c?(l=a=>t.jsx(rs,{virtualMcp:a,org:c},a.id),e[3]=c,e[4]=l):l=e[4],o=n.map(l),e[0]=c,e[1]=n,e[2]=o}else o=e[2];let i;return e[5]!==o?(i=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:o})}),e[5]=o,e[6]=i):i=e[6],i}function ds(s){const e=U.c(13),{connection:n}=s,c=L(),{org:o}=se();let i;e[0]!==n.id?(i={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=i):i=e[1];const l=At(i);if(!(l.length>0)){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(t.Fragment,{}),e[2]=f):f=e[2],f}let d;e[3]!==c?(d=c("details.connectionAgentsPanel.usedByAgents"),e[3]=c,e[4]=d):d=e[4];let p;e[5]!==d?(p=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:d})}),e[5]=d,e[6]=p):p=e[6];let m;e[7]!==o.slug||e[8]!==l?(m=t.jsx("div",{className:"px-5 py-4",children:t.jsx(cs,{virtualMcps:l,org:o.slug})}),e[7]=o.slug,e[8]=l,e[9]=m):m=e[9];let r;return e[10]!==p||e[11]!==m?(r=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[p,m]}),e[10]=p,e[11]=m,e[12]=r):r=e[12],r}function ms(s){const e=U.c(35),{tools:n,connectionId:c,org:o}=s,i=L(),l=ne(),{org:a}=se();let d;e[0]!==c||e[1]!==a.id||e[2]!==a.slug?(d={connectionId:c,orgId:a.id,orgSlug:a.slug},e[0]=c,e[1]=a.id,e[2]=a.slug,e[3]=d):d=e[3];const p=ke(d),m=_e(c);let r;e[4]!==m||e[5]!==c?(r=m?Pe(m):c,e[4]=m,e[5]=c,e[6]=r):r=e[6];const f=r,[u,h]=Z.useState("");let g,j,S,v;if(e[7]!==f||e[8]!==p||e[9]!==l||e[10]!==o||e[11]!==u||e[12]!==i||e[13]!==n){const D=(n??[]).filter(us),_=u.toLowerCase().trim(),M=_?D.filter(b=>b.name.toLowerCase().includes(_)||b.description&&b.description.toLowerCase().includes(_)):D;let T;e[18]!==f||e[19]!==l||e[20]!==o?(T=b=>{l({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:o,appSlug:f,collectionName:"tools",itemId:encodeURIComponent(b.name)}})},e[18]=f,e[19]=l,e[20]=o,e[21]=T):T=e[21];const $=T;S="flex flex-col h-full overflow-hidden";let I;e[22]!==i?(I=i("details.connectionUiTab.searchAppsPlaceholder"),e[22]=i,e[23]=I):I=e[23];let N;e[24]===Symbol.for("react.memo_cache_sentinel")?(N=b=>{b.key==="Escape"&&(h(""),b.target.blur())},e[24]=N):N=e[24],e[25]!==u||e[26]!==I?(v=t.jsx(Mt,{value:u,onChange:h,placeholder:I,onKeyDown:N}),e[25]=u,e[26]=I,e[27]=v):v=e[27],g="flex-1 overflow-auto p-5",j=M.length===0?t.jsx(ye,{image:null,title:i(u?"details.connectionUiTab.noAppsFound":"details.connectionUiTab.noAppsAvailable"),description:i(u?"details.connectionUiTab.adjustSearchTerms":"details.connectionUiTab.noInteractiveUis")}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:M.map(b=>{const E=de(b._meta);return t.jsxs(Ee,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>$(b),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Ot,{resourceURI:E,toolInfo:{tool:b},displayMode:"inline",minHeight:200,maxHeight:200,client:p})}),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:b.annotations?.title??b.name}),t.jsx(ot,{annotations:b.annotations,_meta:b._meta})]}),b.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:b.description})]})]},b.name)})}),e[7]=f,e[8]=p,e[9]=l,e[10]=o,e[11]=u,e[12]=i,e[13]=n,e[14]=g,e[15]=j,e[16]=S,e[17]=v}else g=e[14],j=e[15],S=e[16],v=e[17];let y;e[28]!==g||e[29]!==j?(y=t.jsx("div",{className:g,children:j}),e[28]=g,e[29]=j,e[30]=y):y=e[30];let P;return e[31]!==S||e[32]!==v||e[33]!==y?(P=t.jsxs("div",{className:S,children:[v,y]}),e[31]=S,e[32]=v,e[33]=y,e[34]=P):P=e[34],P}function us(s){return!!de(s._meta)}function De(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),c=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),o=e.map(n),i=e[e.length-1];return o.length>=2&&i&&c.has(i)?[o.pop(),...o].join(" "):o.join(" ")}function re(s){const e=U.c(5),{label:n}=s,c=L();let o;e[0]!==n||e[1]!==c?(o=c("details.connectionCapabilities.noItemsAvailable",{item:n}),e[0]=n,e[1]=c,e[2]=o):o=e[2];let i;return e[3]!==o?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:o})}),e[3]=o,e[4]=i):i=e[4],i}function xs(s){const e=U.c(72),{tools:n,prompts:c,resources:o,connectionId:i,org:l}=s;let a;e[0]!==c?(a=c===void 0?[]:c,e[0]=c,e[1]=a):a=e[1];const d=a;let p;e[2]!==o?(p=o===void 0?[]:o,e[2]=o,e[3]=p):p=e[3];const m=p,r=L(),f=ne(),u=_e(i??"");let h;e[4]!==u||e[5]!==i?(h=u?Pe(u):i,e[4]=u,e[5]=i,e[6]=h):h=e[6];const g=h;let j;e[7]!==g||e[8]!==i||e[9]!==f||e[10]!==l?(j=function(V){!i||!l||f({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:l,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(V)}})},e[7]=g,e[8]=i,e[9]=f,e[10]=l,e[11]=j):j=e[11];const S=j;let v;e[12]!==i||e[13]!==l||e[14]!==n?(v=i&&l&&n.some(hs),e[12]=i,e[13]=l,e[14]=n,e[15]=v):v=e[15];const y=v;if(n.length+d.length+m.length===0){let C;e[16]!==r?(C=r("details.connectionCapabilities.capabilities"),e[16]=r,e[17]=C):C=e[17];let V;e[18]!==C?(V=t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:C}),e[18]=C,e[19]=V):V=e[19];let G;e[20]!==r?(G=r("details.connectionCapabilities.noCapabilitiesDiscovered"),e[20]=r,e[21]=G):G=e[21];let F;e[22]!==G?(F=t.jsx("p",{className:"text-sm text-muted-foreground",children:G}),e[22]=G,e[23]=F):F=e[23];let ee;return e[24]!==F||e[25]!==V?(ee=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[V,F]}),e[24]=F,e[25]=V,e[26]=ee):ee=e[26],ee}let D;e[27]!==r||e[28]!==n.length?(D=r("details.connectionCapabilities.toolsTab",{count:n.length}),e[27]=r,e[28]=n.length,e[29]=D):D=e[29];let _;e[30]!==D?(_=t.jsx(oe,{value:"tools",variant:"underline",children:D}),e[30]=D,e[31]=_):_=e[31];let M;e[32]!==y||e[33]!==r?(M=y&&t.jsx(oe,{value:"apps",variant:"underline",children:r("details.connectionCapabilities.uiTab")}),e[32]=y,e[33]=r,e[34]=M):M=e[34];let T;e[35]!==r?(T=r("details.connectionCapabilities.promptsTab"),e[35]=r,e[36]=T):T=e[36];let $;e[37]!==T?($=t.jsx(oe,{value:"prompts",variant:"underline",children:T}),e[37]=T,e[38]=$):$=e[38];let I;e[39]!==r?(I=r("details.connectionCapabilities.resourcesTab"),e[39]=r,e[40]=I):I=e[40];let N;e[41]!==I?(N=t.jsx(oe,{value:"resources",variant:"underline",children:I}),e[41]=I,e[42]=N):N=e[42];let b;e[43]!==M||e[44]!==$||e[45]!==N||e[46]!==_?(b=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(Pt,{variant:"underline",className:"gap-1",children:[_,M,$,N]})}),e[43]=M,e[44]=$,e[45]=N,e[46]=_,e[47]=b):b=e[47];let E;e[48]!==S||e[49]!==n?(E=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:()=>S(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($t,{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:De(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(Te,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},C.name)):t.jsx(re,{label:"tools"}),e[48]=S,e[49]=n,e[50]=E):E=e[50];let z;e[51]!==E?(z=t.jsx(ae,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:E})}),e[51]=E,e[52]=z):z=e[52];let k;e[53]!==i||e[54]!==y||e[55]!==l||e[56]!==n?(k=y&&t.jsx(ae,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ms,{tools:n,connectionId:i,org:l})}),e[53]=i,e[54]=y,e[55]=l,e[56]=n,e[57]=k):k=e[57];let A;e[58]!==d?(A=d.length>0?d.map(fs):t.jsx(re,{label:"prompts"}),e[58]=d,e[59]=A):A=e[59];let R;e[60]!==A?(R=t.jsx(ae,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[60]=A,e[61]=R):R=e[61];let x;e[62]!==m?(x=m.length>0?m.map(ps):t.jsx(re,{label:"resources"}),e[62]=m,e[63]=x):x=e[63];let w;e[64]!==x?(w=t.jsx(ae,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:x})}),e[64]=x,e[65]=w):w=e[65];let O;return e[66]!==b||e[67]!==z||e[68]!==k||e[69]!==R||e[70]!==w?(O=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Dt,{defaultValue:"tools",variant:"underline",children:[b,z,k,R,w]})}),e[66]=b,e[67]=z,e[68]=k,e[69]=R,e[70]=w,e[71]=O):O=e[71],O}function ps(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(gt,{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 fs(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(ht,{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:De(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 hs(s){return de(s._meta)}function gs(s){const e=U.c(13),{connection:n,displayTitle:c}=s,o=c??n.title;let i;e[0]!==n.icon||e[1]!==o?(i=t.jsx(le,{icon:n.icon,name:o,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=o,e[2]=i):i=e[2];let l;e[3]!==o?(l=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:o})}),e[3]=o,e[4]=l):l=e[4];let a;e[5]!==n.description?(a=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]=a):a=e[6];let d;e[7]!==l||e[8]!==a?(d=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,a]}),e[7]=l,e[8]=a,e[9]=d):d=e[9];let p;return e[10]!==i||e[11]!==d?(p=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:[i,d]}),e[10]=i,e[11]=d,e[12]=p):p=e[12],p}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:c,onRemoveOAuth:o}){const i=L(),l=xe({control:s.control,name:"ui_type"}),a=xe({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Re(),p=(()=>{if(typeof a!="string"||!a)return!1;try{const u=new URL(a);return u.hostname==="api.githubcopilot.com"&&u.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),m=d||e.connection_type==="STDIO",r=e.connection_type==="VIRTUAL",f=r?Gt(e.connection_url):null;return r?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:i("details.connectionSidebar.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(Ae,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:i("details.connectionSidebar.virtualMcp")})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("details.connectionSidebar.virtualMcpDescription")})]}),f&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.virtualMcpId")}),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:f})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(K,{control:s.control,name:"ui_type",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.connection")}),l!=="NPX"&&l!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(fe,{value:u.value,onValueChange:u.onChange,children:[t.jsx(B,{children:t.jsxs(he,{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(ie,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(ge,{})]})}),t.jsxs(je,{children:[t.jsx(H,{value:"HTTP",children:i("details.connectionSidebar.http")}),t.jsx(H,{value:"SSE",children:i("details.connectionSidebar.sse")}),t.jsx(H,{value:"Websocket",children:i("details.connectionSidebar.websocket")}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:i("details.connectionSidebar.npxPackage")}),t.jsx(H,{value:"STDIO",children:i("details.connectionSidebar.customCommand")})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(K,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(Q,{className:"flex-1 min-w-0",children:t.jsx(B,{children:t.jsx(J,{placeholder:i("details.connectionSidebar.urlPlaceholder"),...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(fe,{value:u.value,onValueChange:u.onChange,children:[t.jsx(B,{children:t.jsx(he,{className:"h-10",children:t.jsx(ge,{})})}),t.jsxs(je,{children:[t.jsx(H,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ie,{className:"w-4 h-4"}),i("details.connectionSidebar.http")]})}),t.jsx(H,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ie,{className:"w-4 h-4"}),i("details.connectionSidebar.sse")]})}),t.jsx(H,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ie,{className:"w-4 h-4"}),i("details.connectionSidebar.websocket")]})}),m&&t.jsxs(t.Fragment,{children:[t.jsx(H,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),i("details.connectionSidebar.npxPackage")]})}),t.jsx(H,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Bt,{className:"w-4 h-4"}),i("details.connectionSidebar.customCommand")]})})]})]})]}),t.jsx(X,{})]})}),l==="NPX"&&t.jsx(K,{control:s.control,name:"npx_package",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.npmPackage")}),t.jsx(B,{children:t.jsx(J,{placeholder:i("details.connectionSidebar.npmPackagePlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(X,{})]})}),l==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(K,{control:s.control,name:"stdio_command",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.command")}),t.jsx(B,{children:t.jsx(J,{placeholder:i("details.connectionSidebar.commandPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(X,{})]})}),t.jsx(K,{control:s.control,name:"stdio_args",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.arguments")}),t.jsx(B,{children:t.jsx(J,{placeholder:i("details.connectionSidebar.argumentsPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("details.connectionSidebar.spaceSeparatedArguments")}),t.jsx(X,{})]})})]}),t.jsx(K,{control:s.control,name:"stdio_cwd",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.workingDirectory")}),t.jsx(B,{children:t.jsx(J,{placeholder:i("details.connectionSidebar.workingDirectoryPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(X,{})]})})]}),(l==="NPX"||l==="STDIO")&&t.jsx(K,{control:s.control,name:"env_vars",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.environmentVariables")}),t.jsx(B,{children:t.jsx(Je,{value:u.value??[],onChange:u.onChange})}),t.jsx(X,{})]})}),l!=="NPX"&&l!=="STDIO"&&t.jsx(K,{control:s.control,name:"connection_token",render:({field:u})=>t.jsxs(Q,{className:"flex flex-col gap-3",children:[t.jsx(W,{className:"text-xs text-muted-foreground font-medium",children:i(p?"details.connectionSidebar.githubPersonalAccessToken":"details.connectionSidebar.token")}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Et,{children:[t.jsx(Rt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(zt,{variant:"success",className:"gap-1.5",children:[t.jsx(Vt,{size:12}),i("details.connectionSidebar.authenticatedViaOAuth"),t.jsx(Ft,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(pe,{onClick:c,children:[t.jsx(jt,{size:16}),i("details.connectionSidebar.reauthenticate")]}),t.jsxs(pe,{variant:"destructive",onClick:o,children:[t.jsx(ce,{size:16}),i("details.connectionSidebar.removeOAuth")]})]})]})}):e.connection_token&&u.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:()=>u.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:i("details.connectionSidebar.clearAndReplaceToken"),"aria-label":i("details.connectionSidebar.clearAndReplaceToken"),children:t.jsx(qt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(B,{children:t.jsx(J,{type:"password",placeholder:i(p?"details.connectionSidebar.pasteYourGitHubPat":"details.connectionSidebar.enterAccessToken"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),p&&t.jsxs(bt,{children:[i("details.connectionSidebar.createAPatAt")," ",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(X,{})]})})]})}function bs(s){return s.command==="npx"}function vs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Ns(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function be(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"&&Ht(s.connection_headers)){const c=s.connection_headers,o=Ze(c.envVars);if(bs(c)){const l=vs(c);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:o}}const i=Ns(c);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:i.command,stdio_args:i.args,stdio_cwd:i.cwd,env_vars:o}}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 Ss(s){let e,n=null,c=null,o=null;return s.ui_type==="NPX"?(e="STDIO",n="",o=et(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",o=tt(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",c=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...c&&{connection_token:c},...o&&{connection_headers:o},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ys({connection:s,connectionId:e,org:n,isUpdating:c,tools:o,prompts:i,resources:l,siblings:a}){const d=L(),p=ne({from:"/$org/settings/connections/$appSlug"}),m=Le(),r=we(),{org:f}=se(),u=Nt({onSuccess:()=>{a.length<=1&&p({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=Z.useState(null),[j,S]=Z.useState(!1),v=Ce({connectionId:e}),{data:y}=at(),P=y?.data?.members??[],D=h??s,_=P.find(x=>x.userId===D.created_by),T=s?.connection_type==="VIRTUAL"||v.isAuthenticated,$={...s,tools:o},I=st($,Qt),N=Be({resolver:qe(Ye),values:be(h??s)}),b=N.formState.isDirty,E=async()=>{if(!await N.trigger())return;const w=N.getValues(),O=Ss(w),C=h?.id??e;await r.update.mutateAsync({id:C,data:O}),N.reset(w)},z=()=>{N.reset(be(h??s))},k=async x=>{const w=s.configuration_scopes?.length?s.configuration_scopes.join(" "):void 0,{token:O,tokenInfo:C,error:V}=await ut({connectionId:x,orgSlug:f.slug,...w?{scope:w}:{}});if(V||!O){Y.error(d("details.connection.authFailed",{error:V??""}));return}if(C)try{const F=await fetch(`/api/${f.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:C.accessToken,refreshToken:C.refreshToken,expiresIn:C.expiresIn,scope:C.scope,clientId:C.clientId,clientSecret:C.clientSecret,tokenEndpoint:C.tokenEndpoint})});if(!F.ok)console.error("Failed to save OAuth token:",await F.text()),await r.update.mutateAsync({id:x,data:{connection_token:O}});else try{await r.update.mutateAsync({id:x,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(F){console.error("Error saving OAuth token:",F),await r.update.mutateAsync({id:x,data:{connection_token:O}})}else await r.update.mutateAsync({id:x,data:{connection_token:O}});const G=new URL(`/api/${f.slug}/mcp/${x}`,window.location.origin);await m.invalidateQueries({queryKey:te.isMCPAuthenticated(G.href,null)}),await m.invalidateQueries({queryKey:te.mcpClientPrefix()}),Y.success(d("details.connection.authSuccess"))},A=()=>k(s.id),R=async()=>{try{const x=await fetch(`/api/${f.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!x.ok){const O=await x.text();Y.error(d("details.connection.failedRemoveOAuth",{error:O}));return}const w=new URL(`/api/${f.slug}/mcp/${s.id}`,window.location.origin);await m.invalidateQueries({queryKey:te.isMCPAuthenticated(w.href,null)}),Y.success(d("details.connection.oauthRemoved"))}catch(x){console.error("Error removing OAuth token:",x),Y.error(d("details.connection.failedRemoveOAuthError"))}};return t.jsxs(t.Fragment,{children:[t.jsx(St,{...u}),t.jsx(Ge,{open:h!==null,onOpenChange:x=>{x||g(null)},children:t.jsxs(He,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(Ke,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(Qe,{className:"text-base",children:h?.title??s.title}),t.jsx(We,{className:"text-xs",children:d("details.connection.settingsDescription")}),_&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:d("details.connection.connectedBy")}),t.jsx(lt,{url:_.user?.image??void 0,fallback:_.user?.name??_.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:_.user?.name||_.user?.email})]})]}),t.jsxs(vt,{...N,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(K,{control:N.control,name:"title",render:({field:x})=>t.jsxs(Q,{children:[t.jsx(W,{children:d("details.connection.nameLabel")}),t.jsx(B,{children:t.jsx(J,{...x})}),t.jsx(X,{})]})}),t.jsx(K,{control:N.control,name:"description",render:({field:x})=>t.jsxs(Q,{children:[t.jsx(W,{children:d("details.connection.descriptionLabel")}),t.jsx(B,{children:t.jsx(J,{...x,value:x.value||""})}),t.jsx(X,{})]})})]}),t.jsx(js,{form:N,connection:h??s,hasOAuthToken:v.hasOAuthToken,onReauthenticate:A,onRemoveOAuth:R}),t.jsx(nt,{connection:h??s,form:N,hasMcpBinding:I,isMCPAuthenticated:T,supportsOAuth:v.supportsOAuth,isServerError:v.isServerError,onAuthenticate:A,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(q,{onClick:E,disabled:!b||c,className:"flex-1",children:d(c?"details.connection.savingButton":"details.connection.saveButton")}),b&&t.jsx(q,{variant:"outline",onClick:z,children:d("details.connection.undoButton")}),t.jsxs(q,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const x=h??s;g(null),u.requestDelete(x)},children:[t.jsx(ce,{size:15}),d("details.connection.deleteButton")]})]})]},h?.id??s.id)]})}),t.jsx(it,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(gs,{connection:s,displayTitle:(()=>{const x=a[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(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Jt,{instances:a,onConfigure:x=>g(x),onAuthenticate:x=>k(x.id),onDelete:x=>u.requestDelete(x),onToggleStatus:async(x,w)=>{try{await r.update.mutateAsync({id:x.id,data:{status:w}}),Y.success(d(w==="active"?"details.connection.connectionEnabled":"details.connection.connectionDisabled"))}catch{Y.error(d("details.connection.failedUpdateConnection"))}},isAdding:j,onAdd:async()=>{S(!0);try{const x=a[0]??s,w=x.title.replace(/\s*\(\d+\)\s*$/,""),O=a.length+1,C=`${w} (${O})`,V=Xe("conn");await r.create.mutateAsync({id:V,title:C,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 G=new URL(`/api/${f.slug}/mcp/${V}`,window.location.origin),F=await mt({url:G.href,token:null,orgId:f.id});F.supportsOAuth&&!F.isAuthenticated&&await k(V)}finally{S(!1)}}}),t.jsx(ds,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(xs,{tools:o,prompts:i,resources:l,connectionId:e,org:n})})]})})]})})]})}function Cs(){const s=U.c(52),e=L();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/$org/settings/connections/$appSlug"},s[0]=n):n=s[0];const c=ne(n);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug"},s[1]=o):o=s[1];const{appSlug:i,org:l}=Ve(o),{org:a}=se(),d=we();let p;s[2]!==i?(p={slug:i},s[2]=i,s[3]=p):p=s[3];const m=rt(p),r=m[0]??null,f=r?.id??"",u=f||null;let h;s[4]!==a.id||s[5]!==a.slug||s[6]!==u?(h={connectionId:u,orgId:a.id,orgSlug:a.slug},s[4]=a.id,s[5]=a.slug,s[6]=u,s[7]=h):h=s[7];const g=ke(h);let j;s[8]!==g?(j={client:g},s[8]=g,s[9]=j):j=s[9];const{data:S}=ct(j);let v;if(s[10]!==r?.tools||s[11]!==f||s[12]!==m||s[13]!==S){const k=S?S.tools.map(As):(r?.tools??[]).map(Ts);e:{if(m.length<=1){v=k;break e}const A=new Set,R=[],x=ks;for(const w of m){const O=w.id===f?k:x(w.tools);for(const C of O)A.has(C.name)||(A.add(C.name),R.push(C))}v=R.length>0?R:k}s[10]=r?.tools,s[11]=f,s[12]=m,s[13]=S,s[14]=v}else v=s[14];const y=v;let P;s[15]!==g?(P={client:g},s[15]=g,s[16]=P):P=s[16];const{data:D}=dt(P);let _;s[17]!==g?(_={client:g},s[17]=g,s[18]=_):_=s[18];const{data:M}=Fe(_);let T;s[19]!==D?.prompts?(T=D?.prompts??[],s[19]=D?.prompts,s[20]=T):T=s[20];let $;s[21]!==T?($=T.map(ws),s[21]=T,s[22]=$):$=s[22];const I=$;let N;s[23]!==M?.resources?(N=M?.resources??[],s[23]=M?.resources,s[24]=N):N=s[24];let b;s[25]!==N?(b=N.map(_s),s[25]=N,s[26]=b):b=s[26];const E=b;if(!r){let k;s[27]!==e?(k=e("details.connection.notFoundTitle"),s[27]=e,s[28]=k):k=s[28];let A;s[29]!==e?(A=e("details.connection.notFoundDescription"),s[29]=e,s[30]=A):A=s[30];let R;s[31]!==c||s[32]!==l?(R=()=>c({to:"/$org/settings/connections",params:{org:l}}),s[31]=c,s[32]=l,s[33]=R):R=s[33];let x;s[34]!==e?(x=e("details.connection.backButton"),s[34]=e,s[35]=x):x=s[35];let w;s[36]!==R||s[37]!==x?(w=t.jsx(q,{variant:"outline",onClick:R,children:x}),s[36]=R,s[37]=x,s[38]=w):w=s[38];let O;return s[39]!==k||s[40]!==A||s[41]!==w?(O=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ye,{title:k,description:A,actions:w})}),s[39]=k,s[40]=A,s[41]=w,s[42]=O):O=s[42],O}let z;return s[43]!==d.update.isPending||s[44]!==y||s[45]!==r||s[46]!==f||s[47]!==l||s[48]!==I||s[49]!==E||s[50]!==m?(z=t.jsx(ys,{org:l,connection:r,connectionId:f,isUpdating:d.update.isPending,tools:y,prompts:I,resources:E,siblings:m}),s[43]=d.update.isPending,s[44]=y,s[45]=r,s[46]=f,s[47]=l,s[48]=I,s[49]=E,s[50]=m,s[51]=z):z=s[51],z}function _s(s){return{name:s.name,description:s.description,uri:s.uri}}function ws(s){return{name:s.name,description:s.description}}function ks(s){return(s??[]).map(Is)}function Is(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function As(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ps(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ue,{children:t.jsx(Z.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Ne,{className:"size-8 text-muted-foreground"})}),children:t.jsx(Cs,{})})}),s[0]=e):e=s[0],e}function Ti(){const s=U.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ps,{}),s[0]=e):e=s[0],e}export{Ti as default};