decocms 4.15.2 → 4.17.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 (251) hide show
  1. package/dist/client/assets/{AlertCircle-xiXK2m1S.js → AlertCircle-D8gnDqwf.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-BmskEsx0.js → ArrowUpRight-BlXghneM.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-BNDH43Ag.js → CheckCircle-DCCFCHyS.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-B6BvF7Sd.js → ChevronDown-BLALKRGM.js} +1 -1
  5. package/dist/client/assets/{ChevronRight-Dw8L2p1M.js → ChevronRight-Gacf5_E2.js} +1 -1
  6. package/dist/client/assets/{ChevronUp-D-jnw4zr.js → ChevronUp-DBXbYduj.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-WwDO1LN1.js → DotsVertical-D7ryssxp.js} +1 -1
  8. package/dist/client/assets/{Eye-BQwx1wmd.js → Eye-BFLaa-Ve.js} +1 -1
  9. package/dist/client/assets/{FilterLines-DbCVEN51.js → FilterLines-CK4jmUMp.js} +1 -1
  10. package/dist/client/assets/{Globe01-D6fJXnYu.js → Globe01-Bx-hz-as.js} +1 -1
  11. package/dist/client/assets/{Globe04-CiwifQiE.js → Globe04-u6eY2Kop.js} +1 -1
  12. package/dist/client/assets/{HardDrive-jVcJzH7C.js → HardDrive-B06hZ2KP.js} +1 -1
  13. package/dist/client/assets/{Key01-CbMpsv3k.js → Key01-D0oVN5CX.js} +1 -1
  14. package/dist/client/assets/{LayoutLeft-BEqFgoZN.js → LayoutLeft-1bN-FR8E.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-cdRoZYQa.js → LinkExternal01-D4vA-I3a.js} +1 -1
  16. package/dist/client/assets/{Monitor01-BooVkRPA.js → Monitor01-DrJKeSJ4.js} +1 -1
  17. package/dist/client/assets/{Palette-B_-6r8OI.js → Palette-CvuWqoBi.js} +1 -1
  18. package/dist/client/assets/{Play-DGlKGkL5.js → Play-DuOwU6E2.js} +1 -1
  19. package/dist/client/assets/{Plus-BtoTxZYK.js → Plus-Bz2JwGOE.js} +1 -1
  20. package/dist/client/assets/{SearchLg-BZSX2MgZ.js → SearchLg-CfwbHNr5.js} +1 -1
  21. package/dist/client/assets/{SearchMd-BaVV0tAO.js → SearchMd-Bn2Kbs9E.js} +1 -1
  22. package/dist/client/assets/{Settings02-gahhH0gy.js → Settings02-N32UBNZq.js} +1 -1
  23. package/dist/client/assets/{Shield01-oLYJGlFj.js → Shield01-BztOm8mA.js} +1 -1
  24. package/dist/client/assets/{Star01-luVHztLg.js → Star01-GFElhP7X.js} +1 -1
  25. package/dist/client/assets/{Stars01-DpH0sdeu.js → Stars01-CK-XatBt.js} +1 -1
  26. package/dist/client/assets/{Stars02-D6LvMZe8.js → Stars02-BpRz9194.js} +1 -1
  27. package/dist/client/assets/{Sun-DO5LwE6-.js → Sun-CRJdfBLT.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-B6vzd0rT.js → SwitchHorizontal01-Bcp8nSOf.js} +1 -1
  29. package/dist/client/assets/{Tool01-C_OVknfx.js → Tool01-DrE6CqtR.js} +1 -1
  30. package/dist/client/assets/{Trash01-1Cx1iZXn.js → Trash01-kVRWRMat.js} +1 -1
  31. package/dist/client/assets/{Upload01-vitL1ARO.js → Upload01-TiHLQTwG.js} +1 -1
  32. package/dist/client/assets/{User01-LmHp6b-Q.js → User01-9o9EbE3X.js} +1 -1
  33. package/dist/client/assets/{Users01-CIITH-jI.js → Users01-CMbqiB_R.js} +1 -1
  34. package/dist/client/assets/{Users03-cmpMJ5co.js → Users03-K1B4uaw7.js} +1 -1
  35. package/dist/client/assets/{X-BiJNR_Te.js → X-BQZZQdg0.js} +1 -1
  36. package/dist/client/assets/{XCircle-BBnX9u5e.js → XCircle-BOFvuFHl.js} +1 -1
  37. package/dist/client/assets/{XClose--iVjUaQg.js → XClose-ChRyc7zA.js} +1 -1
  38. package/dist/client/assets/{Zap-DPyu3BVb.js → Zap-RN8PAcZE.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-DlnDLlYE.js → ZapSquare-D4RqdrSL.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-Ckr7emDP.js → ZoomOut-CwXzA7X6.js} +1 -1
  41. package/dist/client/assets/{access-gate-BlMRhjbm.js → access-gate-DayZt2qh.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-DmYkKWaa.js → add-section-modal-BgsTQi1S.js} +1 -1
  43. package/dist/client/assets/agent-capabilities-C8WZk9re.js +1 -0
  44. package/dist/client/assets/agent-icon-BRuLsBYY.js +1 -0
  45. package/dist/client/assets/{agents-list-ZQl_ZD9Q.js → agents-list-Bb32bFe0.js} +1 -1
  46. package/dist/client/assets/ai-providers-CtFbvrBB.js +1 -0
  47. package/dist/client/assets/{alert-WX86Tom_.js → alert-DGlfAxXY.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-BUoYpLYU.js → alert-dialog-D87-BKea.js} +2 -2
  49. package/dist/client/assets/app-editor-BTeZcD9G.js +1 -0
  50. package/dist/client/assets/{auth-catchall-Cfd0BBkz.js → auth-catchall-CDZHIENi.js} +1 -1
  51. package/dist/client/assets/{auth-entry-BsEAQUKA.js → auth-entry--IJuST3G.js} +1 -1
  52. package/dist/client/assets/{auth-B1NZwVfm.js → auth-pLLkIszG.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-BHBGVxZo.js → auth-split-layout-Cm8DpBZy.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-CPe5kdur.js → authenticate-and-persist-oauth-VdmVLbtW.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-CGIEhWIt.js → automation-list-row-DJcYtMaz.js} +1 -1
  56. package/dist/client/assets/{automation-runs-DGpdHPhd.js → automation-runs-BQZ05VJM.js} +1 -1
  57. package/dist/client/assets/automations-DXzG8kgd.js +1 -0
  58. package/dist/client/assets/{avatar-BoywRbPN.js → avatar-DxH3BnSs.js} +1 -1
  59. package/dist/client/assets/{badge-DK9j0SAU.js → badge-wh5eWpb9.js} +1 -1
  60. package/dist/client/assets/{block-document-B8Dhb8WE.js → block-document-OYJ-kskh.js} +2 -2
  61. package/dist/client/assets/{brand-context-p7CvfzzZ.js → brand-context-Dkhy-emW.js} +1 -1
  62. package/dist/client/assets/breadcrumb-DZbB5tzN.js +1 -0
  63. package/dist/client/assets/{buckets-j2Q43bzC.js → buckets-DWf7-mkQ.js} +1 -1
  64. package/dist/client/assets/{bulk-category-panel-Daihu5QP.js → bulk-category-panel-BfqGc7PR.js} +1 -1
  65. package/dist/client/assets/capability-load-error-B0knfbbl.js +1 -0
  66. package/dist/client/assets/{card-BOvVcIuI.js → card-D-LCVQQb.js} +1 -1
  67. package/dist/client/assets/category-editor-dubEmgpx.js +1 -0
  68. package/dist/client/assets/{chat-context-BefD9VOV.js → chat-context-CIKFBD8u.js} +4 -4
  69. package/dist/client/assets/{checkbox-bjWKtrqQ.js → checkbox-CFdij7Ei.js} +1 -1
  70. package/dist/client/assets/{cli-auth-success-COcoMy6R.js → cli-auth-success-BJWjcvwa.js} +1 -1
  71. package/dist/client/assets/collection-detail-C8jnHEZw.js +1 -0
  72. package/dist/client/assets/{collection-display-button-B_XXijXF.js → collection-display-button-DDEI8eBI.js} +1 -1
  73. package/dist/client/assets/{collection-search-BlDJ3wfA.js → collection-search-B0gYtEWh.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-BcQaNGs8.js → collection-tabs-DGDRpyxJ.js} +1 -1
  75. package/dist/client/assets/{command-CgQ_mVdv.js → command-VE4J0WmB.js} +1 -1
  76. package/dist/client/assets/{commerce-onboarding-CqRP_YCU.js → commerce-onboarding-DtwhvPKV.js} +1 -1
  77. package/dist/client/assets/{connect-desktop-dialog-LL9b8y6f.js → connect-desktop-dialog-DRNK5Zqx.js} +1 -1
  78. package/dist/client/assets/{connection-card-Bpuz5oOq.js → connection-card-Dzp4nWAC.js} +1 -1
  79. package/dist/client/assets/connection-detail-BnRE6ILz.js +1 -0
  80. package/dist/client/assets/{connection-form-helpers-RN_jNO2h.js → connection-form-helpers-BKzMCiDP.js} +1 -1
  81. package/dist/client/assets/{connections-DOrslzDp.js → connections-BPohRO-Z.js} +1 -1
  82. package/dist/client/assets/{decopilot-BTryLOPO.js → decopilot-D_-94MU_.js} +1 -1
  83. package/dist/client/assets/{decopilot-sse-pool-B3iq9bDL.js → decopilot-sse-pool-DA88fFcW.js} +1 -1
  84. package/dist/client/assets/{dialog-DPK3tbmm.js → dialog-BdIjDk0G.js} +1 -1
  85. package/dist/client/assets/{domain-settings-BntLQopX.js → domain-settings-CTC9j3wY.js} +1 -1
  86. package/dist/client/assets/{drawer-Dwf4ZgGL.js → drawer-D1X6O6Aa.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-t8H3HZQi.js → dropdown-menu-8PMbgM0q.js} +1 -1
  88. package/dist/client/assets/{empty-state-sOHcjjAp.js → empty-state-y_scHUYK.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-CbdJHvwa.js → extract-connection-data-BhI39RpO.js} +1 -1
  90. package/dist/client/assets/file-explorer-BD0vY2dd.js +2 -0
  91. package/dist/client/assets/{file-type-icon-DWoHIsrr.js → file-type-icon-Bx1NX_Gy.js} +1 -1
  92. package/dist/client/assets/{files-D67zzr7G.js → files-BFgu7BJp.js} +1 -1
  93. package/dist/client/assets/{form-CQEFksrj.js → form-P-LOMg0X.js} +1 -1
  94. package/dist/client/assets/{general-Dq82yEh8.js → general-DaU6Yz-f.js} +1 -1
  95. package/dist/client/assets/github-repo-picker-CmustdLW.js +1 -0
  96. package/dist/client/assets/{hooks-CuZnDV9l.js → hooks-UY6BFV6z.js} +4 -4
  97. package/dist/client/assets/{import-from-deco-dialog-yacIAbQ3.js → import-from-deco-dialog-CopvXqdM.js} +1 -1
  98. package/dist/client/assets/{index-CFGQqfmS.js → index-BZCHEyhA.js} +1 -1
  99. package/dist/client/assets/{index-BWc6Nxi2.js → index-BbFfuuHN.js} +1 -1
  100. package/dist/client/assets/{index-Qpbx_Ubg.js → index-BgCyOgdF.js} +25 -25
  101. package/dist/client/assets/{index-B4LUPYB9.js → index-BrtU3HWl.js} +3 -3
  102. package/dist/client/assets/{index-Ci-9LjrN.js → index-BwaOBBZ-.js} +1 -1
  103. package/dist/client/assets/{index-fyouKFp7.js → index-CAQVV5KO.js} +1 -1
  104. package/dist/client/assets/index-Cgz2WBho.js +173 -0
  105. package/dist/client/assets/index-D4EP6iY-.js +1 -0
  106. package/dist/client/assets/{index-Cwa3p0hS.js → index-DHTICC_v.js} +12 -12
  107. package/dist/client/assets/{index-BRcgRl5F.js → index-DJMmArQj.js} +1 -1
  108. package/dist/client/assets/index-DStyXwbT.js +1 -0
  109. package/dist/client/assets/index-DTpadbju.js +1 -0
  110. package/dist/client/assets/index-DmMZ0-sF.css +1 -0
  111. package/dist/client/assets/{index-DCjwyF3a.js → index-Dq2Ts3Yi.js} +1 -1
  112. package/dist/client/assets/{index-redirect-CxdxO9FQ.js → index-redirect-YHMCgUs4.js} +1 -1
  113. package/dist/client/assets/{input-CGaOw-T7.js → input-DgsFOGyM.js} +1 -1
  114. package/dist/client/assets/{integration-icon-C3jRjsTk.js → integration-icon-m6Sa_hcd.js} +1 -1
  115. package/dist/client/assets/{label-BZyL5FxG.js → label-CwMsBEmc.js} +1 -1
  116. package/dist/client/assets/library-tab-DZNwBek9.js +7 -0
  117. package/dist/client/assets/{login-BN1hJXBV.js → login-DDPQBbDq.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-mWpablQr.js → mcp-oauth-SxDhA9AX.js} +1 -1
  119. package/dist/client/assets/{members-Dd4RdI7L.js → members-DiR3wVIq.js} +2 -2
  120. package/dist/client/assets/{monaco-editor-BXALvB3i.js → monaco-editor-iFVtSMuF.js} +2 -2
  121. package/dist/client/assets/{monitoring-stats-row-BacYESoY.js → monitoring-stats-row-D6W0tudn.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-Cotn2W66.js → oauth-callback-Cj-8kU65.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-BgV408Nu.js → oauth-callback-ai-provider-Dc1dGP3j.js} +1 -1
  124. package/dist/client/assets/{onboarding-BFtZZsIe.js → onboarding-DF_zbux6.js} +1 -1
  125. package/dist/client/assets/{org-install-4COv4x4s.js → org-install-CEMN6R-y.js} +1 -1
  126. package/dist/client/assets/{org-layout-DpRd4osM.js → org-layout-bk5Xtfa_.js} +1 -1
  127. package/dist/client/assets/{organization-choice-DA3edX2I.js → organization-choice-CE_aU8pP.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-BSh8RsR_.js → page-seo-form-Derb8U-C.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-BoNARuVh.js +1 -0
  130. package/dist/client/assets/popover-4-S-2t4S.js +1 -0
  131. package/dist/client/assets/post-editor-CHJjQHP8.js +1 -0
  132. package/dist/client/assets/{primitives-B4bXTWHW.js → primitives-DFOak6EH.js} +1 -1
  133. package/dist/client/assets/{profile-By2qeWmn.js → profile-BNOuWcgq.js} +1 -1
  134. package/dist/client/assets/project-app-view-ChmoDNv-.js +1 -0
  135. package/dist/client/assets/record-editor-CS39Vomm.js +1 -0
  136. package/dist/client/assets/registry-D4tm3ZFm.js +2 -0
  137. package/dist/client/assets/{registry-layout-CC5hk5ko.js → registry-layout-BPKVzNcW.js} +4 -4
  138. package/dist/client/assets/{require-capability-BehmxuVQ.js → require-capability-BJprrccL.js} +1 -1
  139. package/dist/client/assets/{required-auth-layout-yLbhDcyn.js → required-auth-layout-B0YEEBld.js} +1 -1
  140. package/dist/client/assets/{reset-password-D0gNWemZ.js → reset-password-CkXuGUs6.js} +1 -1
  141. package/dist/client/assets/roles-lfwag5Tp.js +1 -0
  142. package/dist/client/assets/{scroll-area-Dv4AuULf.js → scroll-area-C8YtCymQ.js} +54 -54
  143. package/dist/client/assets/{search-input-Cs3ZdvNI.js → search-input-Du_36cRj.js} +1 -1
  144. package/dist/client/assets/{secrets-BOVE2M4N.js → secrets-CnPg0qON.js} +1 -1
  145. package/dist/client/assets/{sections-editor-BIF83FR7.js → sections-editor-BR6KfAKE.js} +2 -2
  146. package/dist/client/assets/select-DzzBmNmo.js +1 -0
  147. package/dist/client/assets/{select-model-BWDQ3R_W.js → select-model-F8Y_Cf3t.js} +1 -1
  148. package/dist/client/assets/seo-editor-gJ1HxoCF.js +1 -0
  149. package/dist/client/assets/settings-layout-CGT7LCro.js +1 -0
  150. package/dist/client/assets/{settings-section-Cejxz9k1.js → settings-section-rq7s23q-.js} +1 -1
  151. package/dist/client/assets/{sheet-D2c3JGDb.js → sheet-B3q7nz8B.js} +1 -1
  152. package/dist/client/assets/shell-controls-mi9y4ySh.js +1 -0
  153. package/dist/client/assets/{shell-layout-DA9rswAV.js → shell-layout-QzfqSuxf.js} +1 -1
  154. package/dist/client/assets/shell-route-loading-Bpj8AlnX.js +1 -0
  155. package/dist/client/assets/{sidebar-Dpacp5GO.js → sidebar-D2BmctMK.js} +1 -1
  156. package/dist/client/assets/{skeleton-BF-CURRH.js → skeleton-f0d6RrIL.js} +1 -1
  157. package/dist/client/assets/{sso-GVB2pZdp.js → sso-D4e1TwT3.js} +1 -1
  158. package/dist/client/assets/{store-DT-86Iyk.js → store-DxI78Zhs.js} +1 -1
  159. package/dist/client/assets/store-registry-DKwI23vv.js +2 -0
  160. package/dist/client/assets/{studio-tools-Cc3djW1I.js → studio-tools-D6ANxpFE.js} +1 -1
  161. package/dist/client/assets/switch-BRlkUTqX.js +1 -0
  162. package/dist/client/assets/{tab-id-AX1D_RMI.js → tab-id-DPNwWMUY.js} +1 -1
  163. package/dist/client/assets/{table-D1UnWNkY.js → table-65-g1dd8.js} +1 -1
  164. package/dist/client/assets/tabs-ByVhqny2.js +1 -0
  165. package/dist/client/assets/{task-status-DZRrvrze.js → task-status-BMnLETgS.js} +1 -1
  166. package/dist/client/assets/{textarea-CPTQY1o8.js → textarea-Dp78LmPE.js} +1 -1
  167. package/dist/client/assets/toggle-group-BIoy7tOG.js +1 -0
  168. package/dist/client/assets/{toolbar-DMKoG-oA.js → toolbar-C1WgDWOZ.js} +1 -1
  169. package/dist/client/assets/{toolbar-icon-button-DlDJuZeE.js → toolbar-icon-button-DdAIuoK2.js} +1 -1
  170. package/dist/client/assets/tools-list-BrZf2-sc.js +1 -0
  171. package/dist/client/assets/tooltip-CWNyrHYY.js +1 -0
  172. package/dist/client/assets/{types-DMbSUWoF.js → types-BHL4d6ji.js} +6 -6
  173. package/dist/client/assets/{use-ai-providers-sdJZ6mNz.js → use-ai-providers-CVS8EjHf.js} +1 -1
  174. package/dist/client/assets/{use-automations-COYPBUbQ.js → use-automations-DJ1_UqKB.js} +1 -1
  175. package/dist/client/assets/{use-capability-Cx7TzNZP.js → use-capability-BmznXR_9.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-JB-6x16B.js → use-clock-tick-BXZK-6ig.js} +1 -1
  177. package/dist/client/assets/{use-collections-DZ119Sar.js → use-collections-BnOL5hT8.js} +1 -1
  178. package/dist/client/assets/{use-connection-BRCO5mnf.js → use-connection-CRsO-Bab.js} +1 -1
  179. package/dist/client/assets/{use-copy-Bwhn0R3v.js → use-copy-DK8lBdjB.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-CMDfkslx.js → use-create-virtual-mcp-C50juX43.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-CH3DgeLx.js → use-debounced-autosave-Q8tZcL7-.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-CLDvK-S2.js → use-debounced-value-C2hJqHIV.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-BcoZT7aN.js → use-decopilot-events-BB7o7ets.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-DfdIG-J6.js → use-delete-connection-D7WMNDAi.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-BRqNHDCC.js → use-file-configs-Bxsm4MXe.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-BlY2ZYrD.js → use-infinite-scroll-DFBavgZf.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-CiFmFzLn.js → use-join-requests-CNT469hS.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-BuhWkkTG.js → use-mcp-client-DAJmDOVO.js} +2 -2
  189. package/dist/client/assets/{use-mcp-prompts-nhERLOSQ.js → use-mcp-prompts-D3eulxzR.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-dv3OXmKZ.js → use-mcp-tools-AjHzJbIQ.js} +1 -1
  191. package/dist/client/assets/{use-members-f3A3oSZc.js → use-members-BZroloWO.js} +1 -1
  192. package/dist/client/assets/{use-mobile-BVYlQKVx.js → use-mobile-BkWraisf.js} +1 -1
  193. package/dist/client/assets/use-navigate-to-agent-Dlhjy-0a.js +1 -0
  194. package/dist/client/assets/{use-org-auth-client-DuKhly8O.js → use-org-auth-client-BG_aw3vg.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-BTyeGmwD.js → use-org-sso-CEETlaem.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-B6Vfkq1E.js → use-organization-roles-BrhJCA0y.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-oKHBa9pl.js → use-organization-settings-D9G2tGsW.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-nW4xrRwo.js → use-registry-connections-CTTYiKTQ.js} +1 -1
  199. package/dist/client/assets/{use-secrets-DzM9DTqX.js → use-secrets-sB7thdOD.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-CSGddnEV.js → use-status-sounds-DuOBmrHo.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-Dy5SYpoU.js → use-view-mode-CFXBQhh0.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-w0FPlf6c.js → use-virtual-mcp-CJycW-Qv.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-Bl42Nudd.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-uA0LQwFa.js +1 -0
  205. package/dist/client/assets/{useSuspenseQueries-D-L7bgwd.js → useSuspenseQueries-DohIOUYY.js} +1 -1
  206. package/dist/client/assets/{variant-calendar-xBT1cOyM.js → variant-calendar-DxXS9CiZ.js} +1 -1
  207. package/dist/client/assets/{view-mode-toggle-bMjjIZR7.js → view-mode-toggle-D2SvIjQW.js} +1 -1
  208. package/dist/client/index.html +2 -2
  209. package/dist/server/cli.js +24 -18
  210. package/dist/server/server.js +12 -12
  211. package/package.json +1 -1
  212. package/dist/client/assets/agent-icon-BoYpzvvS.js +0 -1
  213. package/dist/client/assets/ai-providers-DW4KlY2E.js +0 -1
  214. package/dist/client/assets/app-editor-CKiHOtVn.js +0 -1
  215. package/dist/client/assets/automations-KJARKXj-.js +0 -1
  216. package/dist/client/assets/capability-load-error-BL4phbc9.js +0 -1
  217. package/dist/client/assets/category-editor-Dy_cm45Z.js +0 -1
  218. package/dist/client/assets/collection-detail-B-ATVSm-.js +0 -1
  219. package/dist/client/assets/connection-detail-OhIDV6FV.js +0 -1
  220. package/dist/client/assets/context-menu-D0ShXWy5.js +0 -1
  221. package/dist/client/assets/file-explorer-GYeUuaZX.js +0 -2
  222. package/dist/client/assets/github-repo-picker-Bb7z33dY.js +0 -1
  223. package/dist/client/assets/index-1t5fYSeK.js +0 -1
  224. package/dist/client/assets/index-29b_-5_V.js +0 -3
  225. package/dist/client/assets/index-BOqdPiTk.js +0 -1
  226. package/dist/client/assets/index-C6d-BPKr.js +0 -1
  227. package/dist/client/assets/index-C87wLak6.js +0 -173
  228. package/dist/client/assets/index-D9mYZCKV.css +0 -1
  229. package/dist/client/assets/page-seo-sheet-CTWNHuPj.js +0 -1
  230. package/dist/client/assets/popover-By2TcBeF.js +0 -1
  231. package/dist/client/assets/post-editor-TORkccoD.js +0 -1
  232. package/dist/client/assets/project-app-view-CL8ReRmV.js +0 -1
  233. package/dist/client/assets/record-editor-QZfCQZLp.js +0 -1
  234. package/dist/client/assets/registry-Bq_9kd1q.js +0 -2
  235. package/dist/client/assets/roles-DIoglmxo.js +0 -1
  236. package/dist/client/assets/select-5vOrrfqd.js +0 -1
  237. package/dist/client/assets/seo-editor-BTIvfJYG.js +0 -1
  238. package/dist/client/assets/settings-layout-CvQPWR7I.js +0 -1
  239. package/dist/client/assets/shell-controls-BtIqc_C8.js +0 -1
  240. package/dist/client/assets/shell-route-loading-B5IKQTLv.js +0 -1
  241. package/dist/client/assets/sortable.esm-DkJhyTY3.js +0 -5
  242. package/dist/client/assets/store-registry-C5s51pEV.js +0 -2
  243. package/dist/client/assets/switch-DTEHPKUx.js +0 -1
  244. package/dist/client/assets/tabs-DSgk0a5j.js +0 -1
  245. package/dist/client/assets/toggle-group-CDH3EvAk.js +0 -1
  246. package/dist/client/assets/tools-list-Co_gZxL2.js +0 -1
  247. package/dist/client/assets/tooltip-BI-XgvUE.js +0 -1
  248. package/dist/client/assets/use-navigate-to-agent-DGTdV1zx.js +0 -1
  249. package/dist/client/assets/use-org-fs-Beh5XrxM.js +0 -1
  250. package/dist/client/assets/useInfiniteQuery-_6Vt7DP9.js +0 -1
  251. package/dist/client/assets/useSuspenseInfiniteQuery-DzUbbIRw.js +0 -1
@@ -1 +0,0 @@
1
- import{o as B,s as N,aD as ae,aF as le,aG as he,aE as xe,b6 as me,c as U,n as ge,p as be,r as O,j as s,ad as Ee,t as Q,ac as ye,D as re,m as oe,d as J,K as G,k as ve,l as ue,B as V,v as je,E as $e}from"./index-Cwa3p0hS.js";import{i as Fe}from"./AlertCircle-xiXK2m1S.js";import{P as te}from"./index-CFGQqfmS.js";import{S as ne}from"./skeleton-BF-CURRH.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-Cejxz9k1.js";import{u as X,b as se,c as Se}from"./use-ai-providers-sdJZ6mNz.js";import{i as Oe}from"./CheckCircle-BNDH43Ag.js";import{n as Me,o as Te,p as Ue,S as ze}from"./chat-context-BefD9VOV.js";import{d as qe,e as Le}from"./use-organization-settings-oKHBa9pl.js";import{M as Ve}from"./select-model-BWDQ3R_W.js";import{u as Be}from"./use-debounced-autosave-CH3DgeLx.js";import{I as ie}from"./input-CGaOw-T7.js";import{a as pe,T as Ge}from"./toggle-group-CDH3EvAk.js";import{b as ke,c as Ie,d as Ce,A as Ne,a as Pe,e as we,g as De,f as Ae}from"./alert-dialog-BUoYpLYU.js";import{u as H}from"./studio-tools-Cc3djW1I.js";import{s as Qe}from"./Plus-BtoTxZYK.js";import{b as Ye}from"./Tool01-C_OVknfx.js";import{s as We}from"./Trash01-1Cx1iZXn.js";import{A as He}from"./avatar-BoywRbPN.js";import{O as Ke,P as Je,C as fe}from"./decopilot-BTryLOPO.js";import{i as Xe}from"./Settings02-gahhH0gy.js";import{s as Ze}from"./Eye-BQwx1wmd.js";import{D as et,c as tt,a as st,d as it,e as rt}from"./dialog-DPK3tbmm.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-BehmxuVQ.js";import"./sidebar-Dpacp5GO.js";import"./LayoutLeft-BEqFgoZN.js";import"./use-mobile-BVYlQKVx.js";import"./sheet-D2c3JGDb.js";import"./X-BiJNR_Te.js";import"./tooltip-BI-XgvUE.js";import"./card-BOvVcIuI.js";import"./ArrowUpRight-BmskEsx0.js";import"./hooks-CuZnDV9l.js";import"./use-mcp-client-BuhWkkTG.js";import"./auth-B1NZwVfm.js";import"./decopilot-sse-pool-B3iq9bDL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-w0FPlf6c.js";import"./use-collections-DZ119Sar.js";import"./use-decopilot-events-BcoZT7aN.js";import"./tab-id-AX1D_RMI.js";import"./drawer-Dwf4ZgGL.js";import"./connect-desktop-dialog-LL9b8y6f.js";import"./ChevronUp-D-jnw4zr.js";import"./User01-LmHp6b-Q.js";import"./checkbox-bjWKtrqQ.js";import"./select-5vOrrfqd.js";import"./ChevronDown-B6BvF7Sd.js";import"./Key01-CbMpsv3k.js";import"./SearchMd-BaVV0tAO.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-BooVkRPA.js";import"./ChevronRight-Dw8L2p1M.js";import"./Stars01-DpH0sdeu.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-Cx7TzNZP.js";import"./access-gate-BlMRhjbm.js";import"./capability-load-error-BL4phbc9.js";B({title:N(),url:N(),icon:N()});B({registries:le(N(),B({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const W=B({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=B({tiers:B({fast:W,smart:W,thinking:W,image:W,web_search:W,deep_research:W})});B({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});B({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:B({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:B({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Me(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=O.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],O.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let p;t[7]!==i||t[8]!==u?.providerId?(p=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=p):p=t[9];const k=p;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const F=y.keyId??m??"";S(F),a({keyId:F,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let f;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(f=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=f):f=t[19],f}function pt(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Oe,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function ft(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:w=>{o.reset(i),Q.error(`Failed to save: ${w.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:p}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),O.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==p?(h=()=>{const v=o.getValues(),w=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=p);const P=Y=>Y!=null&&!w.has(Y.keyId),C={fast:P(v.tiers.fast)?null:v.tiers.fast,smart:P(v.tiers.smart)?null:v.tiers.smart,thinking:P(v.tiers.thinking)?null:v.tiers.thinking,image:P(v.tiers.image)?null:v.tiers.image,web_search:P(v.tiers.web_search)?null:v.tiers.web_search,deep_research:P(v.tiers.deep_research)?null:v.tiers.deep_research},q=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!q&&z)return;const L=Ue(t,$);o.reset({tiers:{fast:C.fast??L.chat.fast,smart:C.smart??L.chat.smart,thinking:C.thinking??L.chat.thinking,image:C.image??L.image,web_search:C.web_search??L.webSearch,deep_research:C.deep_research??L.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=p,e[19]=h):h=e[19];const f=c?.id,y=u?.id,F=g?.id;let M;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==p||e[25]!==f||e[26]!==y||e[27]!==F?(M=[o,t,j,_,p,f,y,F],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=p,e[25]=f,e[26]=y,e[27]=F,e[28]=M):M=e[28],O.useEffect(h,M);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(pt,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:w=>{const{field:$}=w;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:P=>{$.onChange(P),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=H(),[i,a]=O.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:f}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return f},onSuccess:yt,onError:bt}),[o,x]=O.useState(""),[S,b]=O.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(pe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(pe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Ge,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let p;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(p=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=p):p=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&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:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==p||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,p,k]})}),e[22]=_,e[23]=p,e[24]=k,e[25]=I):I=e[25],I}function bt(e){Q.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=H(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=O.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=G.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:p,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const f=p?.balanceCents!=null?p.balanceCents/100:null;let y;e[19]!==f?(y=f!=null?`$${f.toFixed(2)}`:"—",e[19]=f,e[20]=y):y=e[20];const F=y;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[M,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(ke,{children:[s.jsx(Ie,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ce,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(we,{children:[A,s.jsx(De,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ae,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==f||e[33]!==F||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",f!=null&&vt(f)),children:F}),e[32]=f,e[33]=F,e[34]=h,e[35]=k,e[36]=v):v=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const $=h&&"animate-spin";let P;e[39]!==$?(P=ue($),e[39]=$,e[40]=P):P=e[40];let C;e[41]!==P?(C=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=C):C=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==C?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=w,e[45]=C,e[46]=q):q=e[46];let z;e[47]!==v||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,q]}),e[47]=v,e[48]=q,e[49]=z):z=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=L):L=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,L]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){Q.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=H(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:G.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:G.aiProviders(t.id)}),Q.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),Q.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["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]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),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:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(V,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=B({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function Pt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=H(),d=oe(),[n,m]=O.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:p}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async f=>{let y;f.apiKey?c?y=JSON.stringify({baseUrl:f.baseUrl||l||"",apiKey:f.apiKey}):y=f.apiKey:c&&f.baseUrl&&f.baseUrl!==l&&(y=JSON.stringify({baseUrl:f.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:f.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:G.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:G.aiProviders(S.id)}),Q.success("Provider updated"),x()},onError:f=>Q.error(`Failed to update: ${f.message}`)});return s.jsxs("form",{onSubmit:j(f=>I(f)),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:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),p.label&&s.jsx("p",{className:"text-xs text-destructive",children:p.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function wt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=H();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?Ke.find(k=>k.id===i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=G.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(Pt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let p;return t[24]!==l||t[25]!==r||t[26]!==_?(p=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=p):p=t[27],p}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=H(),o=oe(),[x,S]=O.useState(!1),[b,d]=O.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?Ke.find(q=>q.id===i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${q} · added ${z} ago`}const _=j;let p;t[5]!==i.id||t[6]!==l?(p=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=p):p=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:G.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:G.aiProviders(r.id)}),o.invalidateQueries({queryKey:G.aiProviderModels(r.id,i.id)}),Q.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==p||t[13]!==k?(I={mutationFn:p,onSuccess:k,onError:At},t[12]=p,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:f}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(He,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(Ye,{size:14})}),t[18]=F):F=t[18];let M,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=M,t[20]=T):(M=t[19],T=t[20]);let R;t[21]!==f?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[F,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:f,onClick:M,children:T})]}),t[21]=f,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(wt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ie,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(ke,{children:[K,s.jsxs(Ce,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Ne,{children:"Cancel"}),t[35]=v):v=t[35];let w;t[36]!==h?(w=s.jsxs(we,{children:[v,s.jsx(De,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let $;t[38]!==E||t[39]!==w?($=s.jsxs(Pe,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=$):$=t[40];let P;t[41]!==x||t[42]!==$?(P=s.jsx(Ae,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=P):P=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==P?(C=s.jsxs(s.Fragment,{children:[D,A,P]}),t[44]=D,t[45]=A,t[46]=P,t[47]=C):C=t[47],C}function At(e){return Q.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Ft).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qe,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(V,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Ft(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Fe,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Ot(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Mt),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=O.useState(!1),[x,S]=O.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let p;e[5]!==n?(p=s.jsx(Je,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=p):p=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=F=>{F||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let f;e[8]!==k||e[9]!==h?(f=s.jsx(fe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=f):f=e[10];let y;return e[11]!==p||e[12]!==f?(y=s.jsxs(s.Fragment,{children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(ft,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(fe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Mt(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Ot,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Qs(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Qs as default};
@@ -1 +0,0 @@
1
- import{c as ge,r as w,j as o,l as ye,t as ue,i as Se}from"./index-Cwa3p0hS.js";import{i as je}from"./ChevronRight-Dw8L2p1M.js";import{S as ke}from"./scroll-area-Dv4AuULf.js";import{A as _e}from"./add-section-modal-DmYkKWaa.js";import{ap as Be,aq as we,ar as Ae,j as Ne,k as Re,as as Ce,Y as Ee,at as Ke,ac as Te}from"./index-Qpbx_Ubg.js";import"./agent-icon-BoYpzvvS.js";import"./AlertCircle-xiXK2m1S.js";import"./Tool01-C_OVknfx.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./Settings02-gahhH0gy.js";import"./XCircle-BBnX9u5e.js";import"./ArrowUpRight-BmskEsx0.js";import"./ZapSquare-DlnDLlYE.js";import"./Users03-cmpMJ5co.js";import"./CheckCircle-BNDH43Ag.js";import"./ChevronUp-D-jnw4zr.js";import"./ChevronDown-B6BvF7Sd.js";import"./DotsVertical-WwDO1LN1.js";import"./Stars02-D6LvMZe8.js";import"./Eye-BQwx1wmd.js";import"./ZoomOut-Ckr7emDP.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Star01-luVHztLg.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./Key01-CbMpsv3k.js";import"./LayoutLeft-BEqFgoZN.js";import"./LinkExternal01-cdRoZYQa.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./Play-DGlKGkL5.js";import"./Plus-BtoTxZYK.js";import"./SearchLg-BZSX2MgZ.js";import"./SearchMd-BaVV0tAO.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Trash01-1Cx1iZXn.js";import"./Upload01-vitL1ARO.js";import"./User01-LmHp6b-Q.js";import"./Users01-CIITH-jI.js";import"./XClose--iVjUaQg.js";import"./X-BiJNR_Te.js";import"./Zap-DPyu3BVb.js";import"./use-clock-tick-JB-6x16B.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Bwhn0R3v.js";import"./tooltip-BI-XgvUE.js";import"./file-type-icon-DWoHIsrr.js";import"./dialog-DPK3tbmm.js";import"./use-mobile-BVYlQKVx.js";import"./tab-id-AX1D_RMI.js";import"./content-blocks-o63cs2vh.js";import"./types-DMbSUWoF.js";import"./use-mcp-client-BuhWkkTG.js";import"./auth-B1NZwVfm.js";import"./chat-context-BefD9VOV.js";import"./hooks-CuZnDV9l.js";import"./decopilot-sse-pool-B3iq9bDL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-w0FPlf6c.js";import"./use-collections-DZ119Sar.js";import"./use-ai-providers-sdJZ6mNz.js";import"./studio-tools-Cc3djW1I.js";import"./use-decopilot-events-BcoZT7aN.js";import"./use-organization-settings-oKHBa9pl.js";import"./shell-layout-DA9rswAV.js";import"./avatar-BoywRbPN.js";import"./alert-dialog-BUoYpLYU.js";import"./required-auth-layout-yLbhDcyn.js";import"./use-org-sso-BTyeGmwD.js";import"./sheet-D2c3JGDb.js";import"./integration-icon-C3jRjsTk.js";import"./use-navigate-to-agent-DGTdV1zx.js";import"./use-connection-BRCO5mnf.js";import"./use-mcp-prompts-nhERLOSQ.js";import"./form-CQEFksrj.js";import"./label-BZyL5FxG.js";import"./input-CGaOw-T7.js";import"./select-5vOrrfqd.js";import"./index-29b_-5_V.js";import"./drawer-Dwf4ZgGL.js";import"./collection-search-BlDJ3wfA.js";import"./tabs-DSgk0a5j.js";import"./toggle-group-CDH3EvAk.js";import"./sortable.esm-DkJhyTY3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Bpuz5oOq.js";import"./use-registry-connections-nW4xrRwo.js";import"./useInfiniteQuery-_6Vt7DP9.js";import"./use-infinite-scroll-BlY2ZYrD.js";import"./extract-connection-data-CbdJHvwa.js";import"./card-BOvVcIuI.js";import"./collection-tabs-BcQaNGs8.js";import"./badge-DK9j0SAU.js";import"./textarea-CPTQY1o8.js";import"./connection-form-helpers-RN_jNO2h.js";import"./authenticate-and-persist-oauth-CPe5kdur.js";import"./mcp-oauth-mWpablQr.js";import"./useSuspenseInfiniteQuery-DzUbbIRw.js";import"./connect-desktop-dialog-LL9b8y6f.js";import"./decopilot-BTryLOPO.js";import"./checkbox-bjWKtrqQ.js";import"./skeleton-BF-CURRH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cejxz9k1.js";import"./popover-By2TcBeF.js";import"./command-CgQ_mVdv.js";import"./index-BWc6Nxi2.js";import"./use-org-fs-Beh5XrxM.js";import"./dropdown-menu-t8H3HZQi.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-B5IKQTLv.js";import"./task-status-DZRrvrze.js";import"./use-status-sounds-CSGddnEV.js";import"./empty-state-sOHcjjAp.js";import"./toolbar-DMKoG-oA.js";import"./index-C87wLak6.js";import"./use-debounced-value-CLDvK-S2.js";import"./index-Ci-9LjrN.js";import"./toolbar-icon-button-DlDJuZeE.js";import"./use-mcp-tools-dv3OXmKZ.js";import"./use-capability-Cx7TzNZP.js";import"./tools-list-Co_gZxL2.js";import"./switch-DTEHPKUx.js";import"./use-debounced-autosave-CH3DgeLx.js";import"./index-CFGQqfmS.js";import"./sidebar-Dpacp5GO.js";import"./search-input-Cs3ZdvNI.js";import"./github-repo-picker-Bb7z33dY.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-DzM9DTqX.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./automation-runs-DGpdHPhd.js";import"./table-D1UnWNkY.js";import"./use-members-f3A3oSZc.js";import"./use-org-auth-client-DuKhly8O.js";import"./use-automations-COYPBUbQ.js";import"./use-file-configs-BRqNHDCC.js";import"./monaco-editor-BXALvB3i.js";import"./select-model-BWDQ3R_W.js";import"./automation-list-row-CGIEhWIt.js";function $e(l,e){const m=(l.title||l.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),f=/^[A-Za-z]/.test(m)&&m.length>0?m:"Section",a=Be(e,f);return{blockKey:a,data:{__resolveType:l.resolveType,name:a}}}function yr(l){const e=ge.c(77),{orgSlug:m,virtualMcpId:f,branch:a,blockKey:i,block:n,meta:s,decofile:c,title:D,excludeFields:H,schemaPending:ae,previewBaseUrl:ne}=l,Y=ae===void 0?!1:ae,u=ne===void 0?null:ne,x=typeof n?.__resolveType=="string"?n.__resolveType:"";let R;e[0]!==H||e[1]!==s||e[2]!==x?(R=we(x,s,H),e[0]=H,e[1]=s,e[2]=x,e[3]=R):R=e[3];const h=R;let C;e[4]!==h?(C=!!h&&Object.keys(h.properties??{}).length>0,e[4]=h,e[5]=C):C=e[5];const G=C;let E;e[6]!==n||e[7]!==i||e[8]!==s||e[9]!==D?(E=D??(n?Ae(i,n,s):i),e[6]=n,e[7]=i,e[8]=s,e[9]=D,e[10]=E):E=e[10];const v=E;let K;e[11]!==a||e[12]!==m||e[13]!==f?(K={orgSlug:m,virtualMcpId:f,branch:a},e[11]=a,e[12]=m,e[13]=f,e[14]=K):K=e[14];const{save:b,flush:J,isPending:Q}=Ne(K);let T;e[15]!==a||e[16]!==m||e[17]!==f?(T={orgSlug:m,virtualMcpId:f,branch:a},e[15]=a,e[16]=m,e[17]=f,e[18]=T):T=e[18];const W=Re(T);let $;e[19]!==b?($=Ee((t,r)=>b(t,r)),e[19]=b,e[20]=$):$=e[20];const X=$,[he,xe]=w.useState(i),[ee,ce]=w.useState(null),[te,de]=w.useState(0);let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=[],e[21]=F):F=e[21];const[p,fe]=w.useState(F),[oe,re]=w.useState(!1),P=w.useRef(null);he!==i&&(xe(i),ce(null),de(Pe),fe([]));let O;e[22]!==n?(O=n??{},e[22]=n,e[23]=O):O=e[23];const ie=O;let g;e[24]!==ee?(g=ee??{},e[24]=ee,e[25]=g):g=e[25];let q;e[26]!==ie||e[27]!==g?(q={...ie,...g},e[26]=ie,e[27]=g,e[28]=q):q=e[28];const se=q;let z;e[29]!==i||e[30]!==x||e[31]!==b?(z=t=>{const r=t;ce(r),b(i,{...r,__resolveType:x})},e[29]=i,e[30]=x,e[31]=b,e[32]=z):z=e[32];const me=z;let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=t=>{fe(t)},e[33]=L):L=e[33];const pe=L;let V;e[34]!==c||e[35]!==J||e[36]!==W?(V=async(t,r)=>{try{const{blockKey:d,data:N}=$e(t,c);await W.mutateAsync({blockKey:d,data:N}),ue.success(`Created section "${d}"`),r({__resolveType:d}),J()}catch(d){const N=d,be=N instanceof Error?N.message:"Could not add section";throw ue.error(be),N}},e[34]=c,e[35]=J,e[36]=W,e[37]=V):V=e[37];const y=V;let I;e[38]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{P.current=t.append,re(!0)},e[38]=I):I=e[38];const ve=I;let U;e[39]!==y?(U=async t=>{const r=P.current;if(r)try{await y(t,d=>{r(d),re(!1),P.current=null})}catch{}},e[39]=y,e[40]=U):U=e[40];const le=U;let M;e[41]!==p||e[42]!==v?(M=p.length>0?[v,...p]:[],e[41]=p,e[42]=v,e[43]=M):M=e[43];const A=M;let S;e[44]!==p||e[45]!==A||e[46]!==v?(S=A.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:A.map((t,r)=>{const d=r===A.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(je,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pe(r===0?[]:Ce(p,r)),de(Fe)},title:t,className:ye("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:v}),e[44]=p,e[45]=A,e[46]=v,e[47]=S):S=e[47];let j;e[48]!==Q?(j=o.jsx(Ke,{isPending:Q,isError:!1}),e[48]=Q,e[49]=j):j=e[49];let k;e[50]!==S||e[51]!==j?(k=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,j]}),e[50]=S,e[51]=j,e[52]=k):k=e[52];let _;e[53]!==i||e[54]!==p||e[55]!==c||e[56]!==se||e[57]!==te||e[58]!==y||e[59]!==me||e[60]!==G||e[61]!==s||e[62]!==u||e[63]!==X||e[64]!==h||e[65]!==Y?(_=o.jsx(ke,{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:G?o.jsx(Te,{schema:h,value:se,onChange:me,basePath:"",breadcrumbPath:p,onBreadcrumbChange:pe,decofile:c,meta:s,onSaveReferencedBlock:X,previewBaseUrl:u,onAddSectionItem:y,onRequestAddSection:ve},`${i}:${te}`):Y?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(Se,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),e[53]=i,e[54]=p,e[55]=c,e[56]=se,e[57]=te,e[58]=y,e[59]=me,e[60]=G,e[61]=s,e[62]=u,e[63]=X,e[64]=h,e[65]=Y,e[66]=_):_=e[66];let B;e[67]!==oe||e[68]!==c||e[69]!==le||e[70]!==s||e[71]!==u?(B=u&&o.jsx(_e,{open:oe,onOpenChange:t=>{re(t),t||(P.current=null)},meta:s,decofile:c,previewBaseUrl:u,onSelect:t=>{le(t)}}),e[67]=oe,e[68]=c,e[69]=le,e[70]=s,e[71]=u,e[72]=B):B=e[72];let Z;return e[73]!==k||e[74]!==_||e[75]!==B?(Z=o.jsxs("div",{className:"flex h-full flex-col",children:[k,_,B]}),e[73]=k,e[74]=_,e[75]=B,e[76]=Z):Z=e[76],Z}function Fe(l){return l+1}function Pe(l){return l+1}export{yr as AppEditor};
@@ -1 +0,0 @@
1
- import{c as k,j as o,D as L,b as T,r as $,B as M,v as N}from"./index-Cwa3p0hS.js";import{s as D}from"./Plus-BtoTxZYK.js";import{i as S}from"./Zap-DPyu3BVb.js";import{S as q}from"./search-input-Cs3ZdvNI.js";import{P as l}from"./index-CFGQqfmS.js";import{E as b}from"./empty-state-sOHcjjAp.js";import{c as O}from"./use-automations-COYPBUbQ.js";import{k as V}from"./use-navigate-to-agent-DGTdV1zx.js";import{A as F}from"./automation-list-row-CGIEhWIt.js";import{o as G}from"./use-mcp-client-BuhWkkTG.js";import{u as H}from"./use-virtual-mcp-w0FPlf6c.js";import{R as J}from"./require-capability-BehmxuVQ.js";import"./SearchMd-BaVV0tAO.js";import"./sidebar-Dpacp5GO.js";import"./LayoutLeft-BEqFgoZN.js";import"./use-mobile-BVYlQKVx.js";import"./sheet-D2c3JGDb.js";import"./X-BiJNR_Te.js";import"./tooltip-BI-XgvUE.js";import"./studio-tools-Cc3djW1I.js";import"./alert-dialog-BUoYpLYU.js";import"./dropdown-menu-t8H3HZQi.js";import"./ChevronUp-D-jnw4zr.js";import"./ChevronRight-Dw8L2p1M.js";import"./DotsVertical-WwDO1LN1.js";import"./Stars02-D6LvMZe8.js";import"./Trash01-1Cx1iZXn.js";import"./agent-icon-BoYpzvvS.js";import"./AlertCircle-xiXK2m1S.js";import"./Tool01-C_OVknfx.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./Settings02-gahhH0gy.js";import"./XCircle-BBnX9u5e.js";import"./ArrowUpRight-BmskEsx0.js";import"./ZapSquare-DlnDLlYE.js";import"./Users03-cmpMJ5co.js";import"./CheckCircle-BNDH43Ag.js";import"./ChevronDown-B6BvF7Sd.js";import"./Eye-BQwx1wmd.js";import"./ZoomOut-Ckr7emDP.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Star01-luVHztLg.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./Key01-CbMpsv3k.js";import"./LinkExternal01-cdRoZYQa.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./Play-DGlKGkL5.js";import"./SearchLg-BZSX2MgZ.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Upload01-vitL1ARO.js";import"./User01-LmHp6b-Q.js";import"./Users01-CIITH-jI.js";import"./XClose--iVjUaQg.js";import"./auth-B1NZwVfm.js";import"./use-collections-DZ119Sar.js";import"./use-capability-Cx7TzNZP.js";import"./access-gate-BlMRhjbm.js";import"./capability-load-error-BL4phbc9.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(q,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(D,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function io(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{io as default};
@@ -1 +0,0 @@
1
- import{c as n,m as o,D as c,j as t,a6 as m,B as u,K as x}from"./index-Cwa3p0hS.js";function f(){const e=n.c(5),l=o(),{locator:a}=c();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-muted text-muted-foreground",children:t.jsx(m,{size:28})}),e[0]=s):s=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Couldn't load your permissions"}),t.jsx("p",{className:"mx-auto max-w-sm text-sm text-muted-foreground",children:"Something went wrong checking your access. This is usually temporary."})]}),e[1]=i):i=e[1];let r;return e[2]!==a||e[3]!==l?(r=t.jsxs("div",{className:"flex h-full min-h-[60vh] flex-1 flex-col items-center justify-center gap-4 p-6 text-center",children:[s,i,t.jsx(u,{variant:"outline",size:"sm",onClick:()=>l.invalidateQueries({queryKey:x.myCapabilities(a)}),children:"Try again"})]}),e[2]=a,e[3]=l,e[4]=r):r=e[4],r}export{f as C};
@@ -1 +0,0 @@
1
- import{c as G,r as S,l as J,j as t,B as U,i as Q,t as I}from"./index-Cwa3p0hS.js";import{i as V}from"./XCircle-BBnX9u5e.js";import{aE as X,Y as T}from"./agent-icon-BoYpzvvS.js";import{n as Z}from"./LinkExternal01-cdRoZYQa.js";import{f as _,a as K,b as tt,c as et,d as ot,e as rt,A as it,g as st}from"./alert-dialog-BUoYpLYU.js";import{I as L}from"./input-CGaOw-T7.js";import{L as M}from"./label-BZyL5FxG.js";import{au as at,av as nt,aD as mt,at as lt,aw as R,ay as pt,aE as ct}from"./index-Qpbx_Ubg.js";import{c as dt,B as ut,a as gt}from"./block-document-B8Dhb8WE.js";import{u as xt,s as v,E as ft}from"./primitives-B4bXTWHW.js";import{t as ht}from"./ChevronDown-B6BvF7Sd.js";import{f as yt,h as jt,e as vt}from"./scroll-area-Dv4AuULf.js";import"./AlertCircle-xiXK2m1S.js";import"./Tool01-C_OVknfx.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./Settings02-gahhH0gy.js";import"./ArrowUpRight-BmskEsx0.js";import"./ZapSquare-DlnDLlYE.js";import"./Users03-cmpMJ5co.js";import"./CheckCircle-BNDH43Ag.js";import"./ChevronUp-D-jnw4zr.js";import"./ChevronRight-Dw8L2p1M.js";import"./DotsVertical-WwDO1LN1.js";import"./Stars02-D6LvMZe8.js";import"./Eye-BQwx1wmd.js";import"./ZoomOut-Ckr7emDP.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Star01-luVHztLg.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./Key01-CbMpsv3k.js";import"./LayoutLeft-BEqFgoZN.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./Play-DGlKGkL5.js";import"./Plus-BtoTxZYK.js";import"./SearchLg-BZSX2MgZ.js";import"./SearchMd-BaVV0tAO.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Trash01-1Cx1iZXn.js";import"./Upload01-vitL1ARO.js";import"./User01-LmHp6b-Q.js";import"./Users01-CIITH-jI.js";import"./XClose--iVjUaQg.js";import"./X-BiJNR_Te.js";import"./Zap-DPyu3BVb.js";import"./index-29b_-5_V.js";import"./chat-context-BefD9VOV.js";import"./hooks-CuZnDV9l.js";import"./use-mcp-client-BuhWkkTG.js";import"./auth-B1NZwVfm.js";import"./decopilot-sse-pool-B3iq9bDL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-w0FPlf6c.js";import"./use-collections-DZ119Sar.js";import"./use-ai-providers-sdJZ6mNz.js";import"./studio-tools-Cc3djW1I.js";import"./use-decopilot-events-BcoZT7aN.js";import"./tab-id-AX1D_RMI.js";import"./use-organization-settings-oKHBa9pl.js";import"./tooltip-BI-XgvUE.js";import"./dialog-DPK3tbmm.js";import"./drawer-Dwf4ZgGL.js";import"./collection-search-BlDJ3wfA.js";import"./use-mobile-BVYlQKVx.js";import"./use-mcp-prompts-nhERLOSQ.js";import"./shell-layout-DA9rswAV.js";import"./avatar-BoywRbPN.js";import"./required-auth-layout-yLbhDcyn.js";import"./use-org-sso-BTyeGmwD.js";import"./form-CQEFksrj.js";import"./select-5vOrrfqd.js";import"./tabs-DSgk0a5j.js";import"./toggle-group-CDH3EvAk.js";import"./sortable.esm-DkJhyTY3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Bpuz5oOq.js";import"./use-registry-connections-nW4xrRwo.js";import"./use-connection-BRCO5mnf.js";import"./useInfiniteQuery-_6Vt7DP9.js";import"./use-infinite-scroll-BlY2ZYrD.js";import"./extract-connection-data-CbdJHvwa.js";import"./card-BOvVcIuI.js";import"./integration-icon-C3jRjsTk.js";import"./collection-tabs-BcQaNGs8.js";import"./badge-DK9j0SAU.js";import"./textarea-CPTQY1o8.js";import"./connection-form-helpers-RN_jNO2h.js";import"./authenticate-and-persist-oauth-CPe5kdur.js";import"./mcp-oauth-mWpablQr.js";import"./useSuspenseInfiniteQuery-DzUbbIRw.js";import"./connect-desktop-dialog-LL9b8y6f.js";import"./decopilot-BTryLOPO.js";import"./checkbox-bjWKtrqQ.js";import"./skeleton-BF-CURRH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cejxz9k1.js";import"./popover-By2TcBeF.js";import"./command-CgQ_mVdv.js";import"./index-BWc6Nxi2.js";import"./use-org-fs-Beh5XrxM.js";import"./dropdown-menu-t8H3HZQi.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-B5IKQTLv.js";import"./task-status-DZRrvrze.js";import"./use-clock-tick-JB-6x16B.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-status-sounds-CSGddnEV.js";import"./empty-state-sOHcjjAp.js";import"./toolbar-DMKoG-oA.js";import"./index-C87wLak6.js";import"./file-type-icon-DWoHIsrr.js";import"./use-debounced-value-CLDvK-S2.js";import"./index-Ci-9LjrN.js";import"./toolbar-icon-button-DlDJuZeE.js";import"./use-mcp-tools-dv3OXmKZ.js";import"./types-DMbSUWoF.js";import"./use-capability-Cx7TzNZP.js";import"./tools-list-Co_gZxL2.js";import"./switch-DTEHPKUx.js";import"./use-debounced-autosave-CH3DgeLx.js";import"./index-CFGQqfmS.js";import"./sidebar-Dpacp5GO.js";import"./sheet-D2c3JGDb.js";import"./search-input-Cs3ZdvNI.js";import"./github-repo-picker-Bb7z33dY.js";import"./use-navigate-to-agent-DGTdV1zx.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-DzM9DTqX.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./automation-runs-DGpdHPhd.js";import"./table-D1UnWNkY.js";import"./use-members-f3A3oSZc.js";import"./use-org-auth-client-DuKhly8O.js";import"./use-automations-COYPBUbQ.js";import"./use-file-configs-BRqNHDCC.js";import"./monaco-editor-BXALvB3i.js";import"./select-model-BWDQ3R_W.js";import"./automation-list-row-CGIEhWIt.js";import"./use-copy-Bwhn0R3v.js";import"./content-blocks-o63cs2vh.js";function bt(k){const e=G.c(18),{icon:f,title:m,defaultOpen:b,children:d}=k,D=b===void 0?!1:b,[x,A]=S.useState(D);let l;e[0]!==f?(l=t.jsx(f,{size:15}),e[0]=f,e[1]=l):l=e[1];let i;e[2]!==m?(i=t.jsx("span",{className:"flex-1 text-left",children:m}),e[2]=m,e[3]=i):i=e[3];const h=x&&"rotate-180";let r;e[4]!==h?(r=J("transition-transform",h),e[4]=h,e[5]=r):r=e[5];let p;e[6]!==r?(p=t.jsx(ht,{size:15,className:r}),e[6]=r,e[7]=p):p=e[7];let c;e[8]!==l||e[9]!==i||e[10]!==p?(c=t.jsx(yt,{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:[l,i,p]})}),e[8]=l,e[9]=i,e[10]=p,e[11]=c):c=e[11];let s;e[12]!==d?(s=t.jsx(jt,{className:"px-2 pt-4",children:d}),e[12]=d,e[13]=s):s=e[13];let u;return e[14]!==x||e[15]!==c||e[16]!==s?(u=t.jsxs(vt,{open:x,onOpenChange:A,className:"mt-4",children:[c,s]}),e[14]=x,e[15]=c,e[16]=s,e[17]=u):u=e[17],u}function ar({orgSlug:k,virtualMcpId:e,branch:f,blockKey:m,block:b,decofile:d,meta:D,onManagePosts:x,onOpenPost:A,previewBaseUrl:l}){const i=at({orgSlug:k,virtualMcpId:e,branch:f}),h=nt(b,"categories"),[r,p,c]=xt(h,o=>{i.mutate({blockKey:m,data:R(m,"categories",o)})}),s=(o,w)=>p({...r,[o]:w}),u=dt({decofile:d,category:r,previewBaseUrl:l}),a=v(r.slug),[B,y]=S.useState(a),[n,C]=S.useState(null),[N,E]=S.useState(!1),$=a?mt(d).filter(o=>o.categorySlugs.includes(a)):[],j=$.length,H=o=>s("slug",o),W=async(o,w)=>{const q=v(r.name);E(!0);try{let g=0;for(const{key:P,payload:O}of pt(d,"posts")){const F=ct(O,o,{name:q,slug:w});F!==O&&(await i.mutateAsync({blockKey:P,data:R(P,"posts",F)}),g+=1)}const z={...r,slug:w};await i.mutateAsync({blockKey:m,data:R(m,"categories",z)}),c(z),I.success(g>0?`Renamed slug and updated ${g} ${g===1?"post":"posts"}`:"Renamed slug"),C(null)}catch(g){y(o),C(null),I.error(g instanceof Error?g.message:"Rename failed")}finally{E(!1)}},Y=()=>{const o=B.trim();if(o===a){B!==o&&y(o);return}if(!o){y(a);return}if(j===0){H(o);return}C({oldSlug:a,newSlug:o,count:j})};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:v(r.name)||"Untitled category"}),t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.jsx(lt,{isPending:i.isPending,isError:i.isError}),u&&t.jsxs(U,{type:"button",variant:"outline",size:"sm",title:"Open the category preview in a new tab",onClick:()=>window.open(u,"_blank","noopener,noreferrer"),children:[t.jsx(Z,{size:14}),"See category preview"]})]})]}),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(ft,{value:v(r.name),onChange:o=>s("name",o),placeholder:"Category name",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:"Slug"}),t.jsx(L,{id:"category-slug",value:B,onChange:o=>y(o.target.value),onBlur:Y,placeholder:"my-category",className:"h-10"})]}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(M,{htmlFor:"category-description",children:"Description"}),t.jsx(L,{id:"category-description",value:v(r.description),onChange:o=>s("description",o.target.value),placeholder:"Short description for this category",className:"h-10"})]}),t.jsx(bt,{icon:X,title:"Content",defaultOpen:!0,children:t.jsx(ut,{value:gt(r.sections),onChange:o=>s("sections",o),meta:D,emptyMessage:"This category has no content yet. Use ⊕ to add your first block."})}),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(T,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"text-sm",children:[j," ",j===1?"post":"posts"," in this category"]})]}),t.jsxs(U,{type:"button",variant:"outline",size:"sm",disabled:!a,title:a?"Pick posts to add to this category":"Set a slug to add posts to this category",onClick:()=>x(a),children:["Add posts",t.jsx(V,{size:14})]})]}),j>0&&t.jsx("ul",{className:"divide-y border-t bg-background",children:$.map(o=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>A(o.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(T,{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:o.title||"Untitled post"}),o.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:o.slug})]})]})},o.key))})]})]})})]}),t.jsx(_,{open:!!n,onOpenChange:o=>{o||N||(y(a),C(null))},children:t.jsxs(K,{children:[t.jsxs(tt,{children:[t.jsx(et,{children:"Rename category slug?"}),t.jsx(ot,{children:n?`Changing the slug from "${n.oldSlug}" to "${n.newSlug}" will update ${n.count} ${n.count===1?"post":"posts"} that reference this category.`:null})]}),t.jsxs(rt,{children:[t.jsx(it,{disabled:N,children:"Cancel"}),t.jsx(st,{onClick:o=>{o.preventDefault(),n&&W(n.oldSlug,n.newSlug)},disabled:N,children:N?t.jsxs(t.Fragment,{children:[t.jsx(Q,{size:14,className:"animate-spin"}),"Renaming…"]}):"Rename & update posts"})]})]})})]})}export{ar as CategoryEditor};
@@ -1 +0,0 @@
1
- import{c as y,j as t,B as F,i as X,o as Ge,s as se,E as Pe,r as T,D as ie,p as Qe,l as V,bf as Ye,u as Xe,G,t as Ze,e as ae,b1 as ke}from"./index-Cwa3p0hS.js";import{E as Ee}from"./empty-state-sOHcjjAp.js";import{u as et,a as Ae}from"./use-collections-DZ119Sar.js";import{u as ce}from"./use-mcp-client-BuhWkkTG.js";import{F as ne,a as tt,b as de,d as me}from"./form-CQEFksrj.js";import{I as ue}from"./input-CGaOw-T7.js";import{T as re}from"./textarea-CPTQY1o8.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-fyouKFp7.js";import{an as rt,z as it,ac as at,ao as ct,a0 as dt,ap as mt,L as be}from"./agent-icon-BoYpzvvS.js";import{g as ut,M as xt,a as Ne}from"./types-DMbSUWoF.js";import{A as pt,a as ft,b as ht}from"./alert-WX86Tom_.js";import{S as ve,a as Se,b as ye,c as we,d as oe}from"./select-5vOrrfqd.js";import{c as gt,T as Ce,a as Ie,b as $e}from"./tooltip-BI-XgvUE.js";import{i as jt}from"./AlertCircle-xiXK2m1S.js";import{s as bt}from"./Stars02-D6LvMZe8.js";import{a as Nt}from"./Eye-BQwx1wmd.js";import{i as vt}from"./Play-DGlKGkL5.js";import{i as St}from"./ChevronRight-Dw8L2p1M.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./tools-list-Co_gZxL2.js";import{a as Oe,u as Re}from"./use-connection-BRCO5mnf.js";import{a as It}from"./use-mcp-tools-dv3OXmKZ.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-C3jRjsTk.js";import{j as Tt,m as Pt}from"./chat-context-BefD9VOV.js";import{b as kt}from"./shell-layout-DA9rswAV.js";import{M as Et}from"./monaco-editor-BXALvB3i.js";import{n as At}from"./XCircle-BBnX9u5e.js";import"./auth-B1NZwVfm.js";import"./label-BZyL5FxG.js";import"./index-CFGQqfmS.js";import"./sidebar-Dpacp5GO.js";import"./LayoutLeft-BEqFgoZN.js";import"./use-mobile-BVYlQKVx.js";import"./sheet-D2c3JGDb.js";import"./X-BiJNR_Te.js";import"./ZoomOut-Ckr7emDP.js";import"./Key01-CbMpsv3k.js";import"./extract-connection-data-CbdJHvwa.js";import"./use-registry-connections-nW4xrRwo.js";import"./use-organization-settings-oKHBa9pl.js";import"./studio-tools-Cc3djW1I.js";import"./Plus-BtoTxZYK.js";import"./index-BRcgRl5F.js";import"./index-C6d-BPKr.js";import"./index-BWc6Nxi2.js";import"./popover-By2TcBeF.js";import"./use-virtual-mcp-w0FPlf6c.js";import"./ChevronUp-D-jnw4zr.js";import"./SearchMd-BaVV0tAO.js";import"./Users03-cmpMJ5co.js";import"./use-create-virtual-mcp-CMDfkslx.js";import"./use-navigate-to-agent-DGTdV1zx.js";import"./Tool01-C_OVknfx.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./Settings02-gahhH0gy.js";import"./ArrowUpRight-BmskEsx0.js";import"./ZapSquare-DlnDLlYE.js";import"./CheckCircle-BNDH43Ag.js";import"./ChevronDown-B6BvF7Sd.js";import"./DotsVertical-WwDO1LN1.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Star01-luVHztLg.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./LinkExternal01-cdRoZYQa.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./SearchLg-BZSX2MgZ.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Trash01-1Cx1iZXn.js";import"./Upload01-vitL1ARO.js";import"./User01-LmHp6b-Q.js";import"./Users01-CIITH-jI.js";import"./XClose--iVjUaQg.js";import"./Zap-DPyu3BVb.js";import"./mcp-oauth-mWpablQr.js";import"./badge-DK9j0SAU.js";import"./hooks-CuZnDV9l.js";import"./decopilot-sse-pool-B3iq9bDL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-sdJZ6mNz.js";import"./use-decopilot-events-BcoZT7aN.js";import"./tab-id-AX1D_RMI.js";import"./avatar-BoywRbPN.js";import"./dialog-DPK3tbmm.js";import"./alert-dialog-BUoYpLYU.js";import"./required-auth-layout-yLbhDcyn.js";import"./use-org-sso-BTyeGmwD.js";import"./index-Ci-9LjrN.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;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 m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(X,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:Mt}),t.jsx(ne,{control:o.control,name:"description",render:zt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Dt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=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:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Dt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Mt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ae(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const A=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:A.title,description:A.description??null,body:le(A)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let E;e[18]!==i.description?(E=i.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:i.description})]}):null,e[18]=i.description,e[19]=E):E=e[19];let P;e[20]!==$||e[21]!==E?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,E]})}),e[20]=$,e[21]=E,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ee,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function ze(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Xe({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[E,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),A=Pt(),{setChatOpen:U}=kt(),M=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[D,Z]=T.useState("json"),[Me,Le]=T.useState(!1);O&&!Me&&(Z("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,K={};if(H&&j?.inputSchema?.properties)for(const d of fe)K[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...K,...c}:(()=>{const z=u.trim();if(!z)return{};const B=JSON.parse(z);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([z,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[z]=="string")try{h[z]=JSON.parse(h[z])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[z]=="string"&&h[z]!==""){const je=Number(h[z]);Number.isNaN(je)||(h[z]=je)}});const v=await _.callTool({name:s,arguments:h}),W=v.structuredContent??v,He=performance.now(),Ke=Math.round(He-d);p(W),g(v),I(h);const We=JSON.stringify(W),ge=new TextEncoder().encode(We).length;w({duration:`${Ke}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(De,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(ze,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.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,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children: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(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":K[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:E?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[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(bt,{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(ct,{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(dt,{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})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{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(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&D==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>A?.setAppContext(M,d),onTeardown:()=>A?.clearAppContext(M),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{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)),Ze.success("Copied to clipboard")},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(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.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:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(X,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Kt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Wt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Wt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ae(f,l,I);let $;s[9]!==R||s[10]!==r?($=async D=>{r&&await R.update.mutateAsync({id:r,data:D})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const E=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let A;s[18]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(Y,{}),s[18]=A):A=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let M;s[24]!==k?(M=t.jsx(q,{children:t.jsx(ze,{children:k})}),s[24]=k,s[25]=M):M=s[25];let _;s[26]!==U||s[27]!==M||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(De,{children:[N,A,U,M]})}),s[26]=U,s[27]=M,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let D;return s[30]!==w||s[31]!==c||s[32]!==E||s[33]!==r?(D=t.jsx(w,{itemId:r,onBack:c,onUpdate:E}),s[30]=w,s[31]=c,s[32]=E,s[33]=r,s[34]=D):D=s[34],D}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Kt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Ln(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Ln as default};
@@ -1 +0,0 @@
1
- import{o as he,aF as Ie,b6 as Ae,s as le,aD as De,c as P,j as t,i as ge,B as V,r as G,l as je,D as J,q as $e,K as ne,b as Y,a9 as ce,z as Pe,b7 as Oe,E as Me,e as ze,b8 as Ee,m as Ve,p as Ue,n as Fe,t as q,b9 as Re}from"./index-Cwa3p0hS.js";import{a as Le}from"./extract-connection-data-CbdJHvwa.js";import{E as ve}from"./empty-state-sOHcjjAp.js";import{E as Be,c as He,r as We,b as Xe,d as qe}from"./connection-form-helpers-RN_jNO2h.js";import{c as Ge,S as Ke,V as Qe}from"./index-fyouKFp7.js";import{u as be,T as Je}from"./tools-list-Co_gZxL2.js";import{u as Ye}from"./use-members-f3A3oSZc.js";import{A as Ze}from"./avatar-BoywRbPN.js";import{a as Ne,b as ye,u as et}from"./use-connection-BRCO5mnf.js";import{u as _e}from"./use-mcp-client-BuhWkkTG.js";import{a as tt}from"./use-mcp-tools-dv3OXmKZ.js";import{a as st}from"./use-mcp-prompts-nhERLOSQ.js";import{i as nt,a as ot}from"./mcp-oauth-mWpablQr.js";import{I as oe}from"./integration-icon-C3jRjsTk.js";import{s as it}from"./Plus-BtoTxZYK.js";import{C as at,E as rt,am as lt,ab as ct}from"./agent-icon-BoYpzvvS.js";import{a as Ce,s as dt}from"./Settings02-gahhH0gy.js";import{s as ae}from"./Trash01-1Cx1iZXn.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-D2c3JGDb.js";import{F as L,b as B,c as H,d as E,e as W,f as ht,a as gt}from"./form-CQEFksrj.js";import{I as X}from"./input-CGaOw-T7.js";import{u as jt,D as vt}from"./use-delete-connection-DfdIG-J6.js";import{c as bt,C as Nt,B as yt,a as _t,b as Ct,d as St,e as wt}from"./monitoring-stats-row-BacYESoY.js";import{u as kt}from"./studio-tools-Cc3djW1I.js";import{u as Tt}from"./use-virtual-mcp-w0FPlf6c.js";import{i as Se}from"./ChevronRight-Dw8L2p1M.js";import{a as we}from"./Users03-cmpMJ5co.js";import{b as ee,a as It,c as te,T as At}from"./tabs-DSgk0a5j.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-DlnDLlYE.js";import{c as $t}from"./Tool01-C_OVknfx.js";import{g as re,M as Pt}from"./types-DMbSUWoF.js";import{C as Ot}from"./collection-search-BlDJ3wfA.js";import{C as Mt}from"./card-BOvVcIuI.js";import{B as zt}from"./badge-DK9j0SAU.js";import{D as Et,a as Vt,b as Ut,c as de}from"./dropdown-menu-t8H3HZQi.js";import{S as me,a as ue,b as xe,c as pe,d as R}from"./select-5vOrrfqd.js";import{i as Ft}from"./CheckCircle-BNDH43Ag.js";import{t as Rt}from"./ChevronDown-B6BvF7Sd.js";import{n as Lt}from"./XCircle-BBnX9u5e.js";import{s as se}from"./Star01-luVHztLg.js";import{s as Bt}from"./XClose--iVjUaQg.js";import"./index-CFGQqfmS.js";import"./sidebar-Dpacp5GO.js";import"./LayoutLeft-BEqFgoZN.js";import"./use-mobile-BVYlQKVx.js";import"./tooltip-BI-XgvUE.js";import"./ZoomOut-Ckr7emDP.js";import"./Key01-CbMpsv3k.js";import"./auth-B1NZwVfm.js";import"./use-registry-connections-nW4xrRwo.js";import"./use-organization-settings-oKHBa9pl.js";import"./index-BRcgRl5F.js";import"./index-C6d-BPKr.js";import"./index-BWc6Nxi2.js";import"./popover-By2TcBeF.js";import"./ChevronUp-D-jnw4zr.js";import"./SearchMd-BaVV0tAO.js";import"./use-create-virtual-mcp-CMDfkslx.js";import"./use-navigate-to-agent-DGTdV1zx.js";import"./Eye-BQwx1wmd.js";import"./use-org-auth-client-DuKhly8O.js";import"./User01-LmHp6b-Q.js";import"./use-collections-DZ119Sar.js";import"./AlertCircle-xiXK2m1S.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./ArrowUpRight-BmskEsx0.js";import"./DotsVertical-WwDO1LN1.js";import"./Stars02-D6LvMZe8.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./LinkExternal01-cdRoZYQa.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./Play-DGlKGkL5.js";import"./SearchLg-BZSX2MgZ.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Upload01-vitL1ARO.js";import"./Users01-CIITH-jI.js";import"./X-BiJNR_Te.js";import"./Zap-DPyu3BVb.js";import"./label-BZyL5FxG.js";import"./alert-dialog-BUoYpLYU.js";const Ht=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=be(d),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{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 v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==a?(N=x&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>a(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=a,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==r?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>r(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>r(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=r,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==i?(S=()=>i(n),e[24]=n,e[25]=i,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function qt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let a;e[0]!==n.icon||e[1]!==n.title?(a=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=a):a=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let r;e[5]!==n||e[6]!==i?(r=()=>i(n),e[5]=n,e[6]=i,e[7]=r):r=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:13}),e[8]=d):d=e[8];let l;e[9]!==r?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r,title:"Configure",children:d})}),e[9]=r,e[10]=l):l=e[10];let u;return e[11]!==a||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[a,o,l]}),e[11]=a,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function Gt(s){const e=P.c(27),{instances:n,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r,onAdd:d,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==x||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,c]}),e[8]=x,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==a||e[13]!==i||e[14]!==o||e[15]!==r){let j;e[17]!==a||e[18]!==i||e[19]!==o||e[20]!==r?(j=N=>t.jsx(G.Suspense,{fallback:t.jsx(qt,{instance:N,onConfigure:i}),children:t.jsx(Xt,{instance:N,onConfigure:i,onAuthenticate:a,onDelete:o,onToggleStatus:r})},N.id),e[17]=a,e[18]=i,e[19]=o,e[20]=r,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=a,e[13]=i,e[14]=o,e[15]=r,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}function Kt(s,e=3){const n=new Map;for(const i of s){if(!i.isError)continue;const a=(i.errorMessage??"").trim()||"Unknown error";n.set(a,(n.get(a)??0)+1)}return[...n.entries()].map(([i,a])=>({message:i,count:a})).sort((i,a)=>a.count-i.count).slice(0,e)}const Qt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Jt(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 Yt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Zt(s){const e=P.c(1),{connectionId:n,orgId:i,timeframe:a}=s,o=kt(),r=Jt(a),{data:d}=$e({queryKey:ne.connectionActivity(n,a,i),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:r.startDate.toISOString(),endDate:r.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(d?.logs??[],r),u=l.data,x=l.totalCalls>0,p=Kt(d?.logs??[]),c=l.totalCalls>0?Math.round(l.totalErrors/l.totalCalls*100):0;let h;return e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=h):h=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),h]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Yt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(Ct,{labelFormatter:ss}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(ts)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})}),p.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:["Top errors",c>0?` · ${c}% of calls failed`:""]}),t.jsx("ul",{className:"space-y-1.5",children:p.map(es)})]})]})}function es(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 ts(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 ss(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ns(){const s=P.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 os(s){const e=P.c(13),{connectionId:n}=s,[i,a]=G.useState("14d"),{org:o}=J();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=r):r=e[0];let d;e[1]!==i?(d=Qt.map(c=>t.jsx("button",{type:"button",onClick:()=>a(c.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=i,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[r,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ns,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==i?(x=t.jsx(G.Suspense,{fallback:u,children:t.jsx(Zt,{connectionId:n,orgId:o.id,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=i,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function is(s){const e=P.c(15),{virtualMcp:n,org:i}=s,a=Y();let o;e[0]!==a||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=a,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(we,{size:16}),e[4]=r):r=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:r}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==d||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,l,u]}),e[11]=o,e[12]=d,e[13]=l,e[14]=x):x=e[14],x}function as(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let a;if(e[0]!==i||e[1]!==n){let r;e[3]!==i?(r=d=>t.jsx(is,{virtualMcp:d,org:i},d.id),e[3]=i,e[4]=r):r=e[4],a=n.map(r),e[0]=i,e[1]=n,e[2]=a}else a=e[2];let o;return e[5]!==a?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:a})}),e[5]=a,e[6]=o):o=e[6],o}function rs(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let a;e[0]!==n.id?(a={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=a):a=e[1];const o=Tt(a);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let l;return e[4]!==i.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(as,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=l):l=e[6],l}function ls(s){const e=P.c(31),{tools:n,connectionId:i,org:a}=s,o=Y(),{org:r}=J();let d;e[0]!==i||e[1]!==r.id||e[2]!==r.slug?(d={connectionId:i,orgId:r.id,orgSlug:r.slug},e[0]=i,e[1]=r.id,e[2]=r.slug,e[3]=d):d=e[3];const l=_e(d),u=Ne(i);let x;e[4]!==u||e[5]!==i?(x=u?ke(u):i,e[4]=u,e[5]=i,e[6]=x):x=e[6];const p=x,[c,h]=G.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==a||e[11]!==c||e[12]!==n){const S=(n??[]).filter(cs),y=c.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==a?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=a,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==c?(j=t.jsx(Ot,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:c?"No apps found":"No apps available",description:c?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=re(f._meta);return t.jsxs(Mt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),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:f.name}),t.jsx(Je,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=a,e[11]=c,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function cs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=r=>r.charAt(0).toUpperCase()+r.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),a=e.map(n),o=e[e.length-1];return a.length>=2&&o&&i.has(o)?[a.pop(),...a].join(" "):a.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=i):i=e[1],i}function ds(s){const e=P.c(50),{tools:n,prompts:i,resources:a,connectionId:o,org:r}=s;let d;e[0]!==i?(d=i===void 0?[]:i,e[0]=i,e[1]=d):d=e[1];const l=d;let u;e[2]!==a?(u=a===void 0?[]:a,e[2]=a,e[3]=u):u=e[3];const x=u,p=Y(),c=Ne(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==r?(v=function(D){!o||!r||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=r,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==r||e[14]!==n?(j=o&&r&&n.some(xs),e[12]=o,e[13]=r,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>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:()=>b(m.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:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==r||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ls,{tools:n,connectionId:o,org:r})}),e[31]=o,e[32]=N,e[33]=r,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(us):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(ms):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=U):U=e[49],U}function ms(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(lt,{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 us(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(Dt,{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:Te(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 xs(s){return re(s._meta)}function ps(s){const e=P.c(13),{connection:n,displayTitle:i}=s,a=i??n.title;let o;e[0]!==n.icon||e[1]!==a?(o=t.jsx(oe,{icon:n.icon,name:a,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=a,e[2]=o):o=e[2];let r;e[3]!==a?(r=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:a})}),e[3]=a,e[4]=r):r=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let l;e[7]!==r||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[r,d]}),e[7]=r,e[8]=d,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function fs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:a}){const o=ce({control:s.control,name:"ui_type"}),r=ce({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Pe(),l=(()=>{if(typeof r!="string"||!r)return!1;try{const c=new URL(r);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=d||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(X,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(Be,{value:c.value??[],onChange:c.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Et,{children:[t.jsx(Vt,{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(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:i,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:a,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.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:()=>c.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ht,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function hs(s){return s.command==="npx"}function gs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function js(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const i=s.connection_headers,a=We(i.envVars);if(hs(i)){const r=gs(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:a}}const o=js(i);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:a}}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 vs(s){let e,n=null,i=null,a=null;return s.ui_type==="NPX"?(e="STDIO",n="",a=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",a=qe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...a&&{connection_headers:a},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function bs({connection:s,connectionId:e,org:n,isUpdating:i,tools:a,prompts:o,resources:r,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ve(),x=ye(),{org:p}=J(),c=jt({onSuccess:()=>{d.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=G.useState(null),[v,b]=G.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:a},C=Ge(k,Wt),f=Ue({resolver:Fe(He),values:fe(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const D=f.getValues(),$=vs(D),F=h?.id??e;await x.update.mutateAsync({id:F,data:$}),f.reset(D)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){q.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),q.success("Authentication successful")},z=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();q.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),q.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),q.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...c}),t.jsx(mt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:h?.title??s.title}),t.jsx(ft,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...f,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(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(E,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(E,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(fs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:M,disabled:!w||i,className:"flex-1",children:i?"Saving…":"Save changes"}),w&&t.jsx(V,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(V,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),c.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(ps,{connection:s,displayTitle:(()=>{const m=d[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.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(os,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Gt,{instances:d,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>c.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),q.success(D==="active"?"Connection enabled":"Connection disabled")}catch{q.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=d[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=d.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(rs,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ds,{tools:a,prompts:o,resources:r,connectionId:e,org:n})})]})})]})})]})}function Ns(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:a,org:o}=ze(i),{org:r}=J(),d=ye();let l;s[2]!==a?(l={slug:a},s[2]=a,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",c=p||null;let h;s[4]!==r.id||s[5]!==r.slug||s[6]!==c?(h={connectionId:c,orgId:r.id,orgSlug:r.slug},s[4]=r.id,s[5]=r.slug,s[6]=c,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(ks):(x?.tools??[]).map(ws);e:{if(u.length<=1){j=A;break e}const z=new Set,U=[],m=Cs;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)z.has(F.name)||(z.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ee(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(_s),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(ys),s[25]=f,s[26]=w):w=s[26];const M=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==d.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==M||s[37]!==u?(O=t.jsx(bs,{org:o,connection:x,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:C,resources:M,siblings:u}),s[30]=d.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=M,s[37]=u,s[38]=O):O=s[38],O}function ys(s){return{name:s.name,description:s.description,uri:s.uri}}function _s(s){return{name:s.name,description:s.description}}function Cs(s){return(s??[]).map(Ss)}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ks(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Me,{children:t.jsx(G.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ns,{})})}),s[0]=e):e=s[0],e}function co(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ts,{}),s[0]=e):e=s[0],e}export{co as default};
@@ -1 +0,0 @@
1
- import{r as i,j as a,dI as y,U as T,V as v,dJ as O,dK as j,dL as G,dM as $,bR as k,dN as U,dO as _,X as D,dP as L,dQ as z,dR as B,dS as X,dT as F,dU as W,dV as H,dW as K,dX as V,c as C,l as g}from"./index-Cwa3p0hS.js";var h="ContextMenu",[J]=D(h,[_]),u=_(),[Q,R]=J(h),N=n=>{const{__scopeContextMenu:e,children:o,onOpenChange:t,dir:r,modal:s=!0}=n,[d,c]=i.useState(!1),x=u(e),m=k(t),l=i.useCallback(f=>{c(f),m(f)},[m]);return a.jsx(Q,{scope:e,open:d,onOpenChange:l,modal:s,children:a.jsx(U,{...x,dir:r,open:d,onOpenChange:l,modal:s,children:o})})};N.displayName=h;var b="ContextMenuTrigger",P=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,disabled:t=!1,...r}=n,s=R(b,o),d=u(o),c=i.useRef({x:0,y:0}),x=i.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),m=i.useRef(0),l=i.useCallback(()=>window.clearTimeout(m.current),[]),f=p=>{c.current={x:p.clientX,y:p.clientY},s.onOpenChange(!0)};return i.useEffect(()=>l,[l]),i.useEffect(()=>{t&&l()},[t,l]),a.jsxs(a.Fragment,{children:[a.jsx(y,{...d,virtualRef:x}),a.jsx(T.span,{"data-state":s.open?"open":"closed","data-disabled":t?"":void 0,...r,ref:e,style:{WebkitTouchCallout:"none",...n.style},onContextMenu:t?n.onContextMenu:v(n.onContextMenu,p=>{l(),f(p),p.preventDefault()}),onPointerDown:t?n.onPointerDown:v(n.onPointerDown,M(p=>{l(),m.current=window.setTimeout(()=>f(p),700)})),onPointerMove:t?n.onPointerMove:v(n.onPointerMove,M(l)),onPointerCancel:t?n.onPointerCancel:v(n.onPointerCancel,M(l)),onPointerUp:t?n.onPointerUp:v(n.onPointerUp,M(l))})]})});P.displayName=b;var Y="ContextMenuPortal",w=n=>{const{__scopeContextMenu:e,...o}=n,t=u(e);return a.jsx(G,{...t,...o})};w.displayName=Y;var I="ContextMenuContent",S=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=R(I,o),s=u(o),d=i.useRef(!1);return a.jsx($,{...s,...t,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),!c.defaultPrevented&&d.current&&c.preventDefault(),d.current=!1},onInteractOutside:c=>{n.onInteractOutside?.(c),!c.defaultPrevented&&!r.modal&&(d.current=!0)},style:{...n.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S.displayName=I;var q="ContextMenuGroup",Z=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(L,{...r,...t,ref:e})});Z.displayName=q;var ee="ContextMenuLabel",te=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(z,{...r,...t,ref:e})});te.displayName=ee;var ne="ContextMenuItem",E=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(O,{...r,...t,ref:e})});E.displayName=ne;var oe="ContextMenuCheckboxItem",re=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(B,{...r,...t,ref:e})});re.displayName=oe;var ae="ContextMenuRadioGroup",se=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(X,{...r,...t,ref:e})});se.displayName=ae;var ie="ContextMenuRadioItem",ce=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(F,{...r,...t,ref:e})});ce.displayName=ie;var ue="ContextMenuItemIndicator",de=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(W,{...r,...t,ref:e})});de.displayName=ue;var le="ContextMenuSeparator",A=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(j,{...r,...t,ref:e})});A.displayName=le;var xe="ContextMenuArrow",pe=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(H,{...r,...t,ref:e})});pe.displayName=xe;var me="ContextMenuSubTrigger",fe=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(K,{...r,...t,ref:e})});fe.displayName=me;var ve="ContextMenuSubContent",Ce=i.forwardRef((n,e)=>{const{__scopeContextMenu:o,...t}=n,r=u(o);return a.jsx(V,{...r,...t,ref:e,style:{...n.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ce.displayName=ve;function M(n){return e=>e.pointerType!=="mouse"?n(e):void 0}var Me=N,ge=P,he=w,_e=S,Re=E,Ne=A;function Pe(n){const e=C.c(4);let o;e[0]!==n?({...o}=n,e[0]=n,e[1]=o):o=e[1];let t;return e[2]!==o?(t=a.jsx(Me,{"data-slot":"context-menu",...o}),e[2]=o,e[3]=t):t=e[3],t}function we(n){const e=C.c(4);let o;e[0]!==n?({...o}=n,e[0]=n,e[1]=o):o=e[1];let t;return e[2]!==o?(t=a.jsx(ge,{"data-slot":"context-menu-trigger",...o}),e[2]=o,e[3]=t):t=e[3],t}function Ie(n){const e=C.c(8);let o,t;e[0]!==n?({className:o,...t}=n,e[0]=n,e[1]=o,e[2]=t):(o=e[1],t=e[2]);let r;e[3]!==o?(r=g("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",o),e[3]=o,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=a.jsx(he,{children:a.jsx(_e,{"data-slot":"context-menu-content",className:r,...t})}),e[5]=t,e[6]=r,e[7]=s):s=e[7],s}function Se(n){const e=C.c(12);let o,t,r,s;e[0]!==n?({className:o,inset:t,variant:s,...r}=n,e[0]=n,e[1]=o,e[2]=t,e[3]=r,e[4]=s):(o=e[1],t=e[2],r=e[3],s=e[4]);const d=s===void 0?"default":s;let c;e[5]!==o?(c=g("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=c):c=e[6];let x;return e[7]!==t||e[8]!==r||e[9]!==c||e[10]!==d?(x=a.jsx(Re,{"data-slot":"context-menu-item","data-inset":t,"data-variant":d,className:c,...r}),e[7]=t,e[8]=r,e[9]=c,e[10]=d,e[11]=x):x=e[11],x}function Ee(n){const e=C.c(8);let o,t;e[0]!==n?({className:o,...t}=n,e[0]=n,e[1]=o,e[2]=t):(o=e[1],t=e[2]);let r;e[3]!==o?(r=g("bg-border -mx-1 my-1 h-px",o),e[3]=o,e[4]=r):r=e[4];let s;return e[5]!==t||e[6]!==r?(s=a.jsx(Ne,{"data-slot":"context-menu-separator",className:r,...t}),e[5]=t,e[6]=r,e[7]=s):s=e[7],s}export{Se as C,Ee as a,we as b,Ie as c,Pe as d};
@@ -1,2 +0,0 @@
1
- import{c as Ke,r as l,j as i,i as re,B as fe,l as Ve,m as ut,t as $,K as Te}from"./index-Cwa3p0hS.js";import{F as mt,l as pt}from"./index-Ci-9LjrN.js";import{i as ht,aA as xt,aB as gt,aC as ae,aD as yt,Y as $e}from"./agent-icon-BoYpzvvS.js";import{a as wt}from"./Tool01-C_OVknfx.js";import{s as jt}from"./XClose--iVjUaQg.js";import{S as bt}from"./scroll-area-Dv4AuULf.js";import{T as Re,a as Oe,b as ze}from"./tooltip-BI-XgvUE.js";import{f as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,A as Ft,g as Lt}from"./alert-dialog-BUoYpLYU.js";import{u as Et}from"./chat-context-BefD9VOV.js";import{b as Pt}from"./shell-layout-DA9rswAV.js";import{am as le,an as Ae,ao as Tt}from"./index-Qpbx_Ubg.js";import{a as $t,b as Rt,c as Ot,D as zt,d as At,e as Wt}from"./dialog-DPK3tbmm.js";import{I as We}from"./input-CGaOw-T7.js";import{b as It,C as _,a as Ie,c as Mt,d as Kt}from"./context-menu-D0ShXWy5.js";import{t as Vt}from"./ChevronDown-B6BvF7Sd.js";import{i as Bt}from"./ChevronRight-Dw8L2p1M.js";import{a as Gt}from"./ZoomOut-Ckr7emDP.js";import{E as qt,m as Me,n as he,o as Qt,p as Ut,q as Ht,t as M,r as ce,g as xe,s as ge,u as Jt,v as Yt,w as ye,x as de,y as we,z as Xt,A as Zt}from"./index-C87wLak6.js";import"./AlertCircle-xiXK2m1S.js";import"./SwitchHorizontal01-B6vzd0rT.js";import"./Settings02-gahhH0gy.js";import"./XCircle-BBnX9u5e.js";import"./ArrowUpRight-BmskEsx0.js";import"./ZapSquare-DlnDLlYE.js";import"./Users03-cmpMJ5co.js";import"./CheckCircle-BNDH43Ag.js";import"./ChevronUp-D-jnw4zr.js";import"./DotsVertical-WwDO1LN1.js";import"./Stars02-D6LvMZe8.js";import"./Eye-BQwx1wmd.js";import"./Globe01-D6fJXnYu.js";import"./FilterLines-DbCVEN51.js";import"./Star01-luVHztLg.js";import"./Globe04-CiwifQiE.js";import"./HardDrive-jVcJzH7C.js";import"./Key01-CbMpsv3k.js";import"./LayoutLeft-BEqFgoZN.js";import"./LinkExternal01-cdRoZYQa.js";import"./Monitor01-BooVkRPA.js";import"./Sun-DO5LwE6-.js";import"./Palette-B_-6r8OI.js";import"./Play-DGlKGkL5.js";import"./Plus-BtoTxZYK.js";import"./SearchLg-BZSX2MgZ.js";import"./SearchMd-BaVV0tAO.js";import"./Shield01-oLYJGlFj.js";import"./Stars01-DpH0sdeu.js";import"./Trash01-1Cx1iZXn.js";import"./Upload01-vitL1ARO.js";import"./User01-LmHp6b-Q.js";import"./Users01-CIITH-jI.js";import"./X-BiJNR_Te.js";import"./Zap-DPyu3BVb.js";import"./use-clock-tick-JB-6x16B.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Bwhn0R3v.js";import"./file-type-icon-DWoHIsrr.js";import"./use-mobile-BVYlQKVx.js";import"./tab-id-AX1D_RMI.js";import"./content-blocks-o63cs2vh.js";import"./types-DMbSUWoF.js";import"./use-mcp-client-BuhWkkTG.js";import"./auth-B1NZwVfm.js";import"./hooks-CuZnDV9l.js";import"./decopilot-sse-pool-B3iq9bDL.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./studio-tools-Cc3djW1I.js";import"./sheet-D2c3JGDb.js";import"./integration-icon-C3jRjsTk.js";import"./use-virtual-mcp-w0FPlf6c.js";import"./use-collections-DZ119Sar.js";import"./use-navigate-to-agent-DGTdV1zx.js";import"./use-connection-BRCO5mnf.js";import"./use-mcp-prompts-nhERLOSQ.js";import"./form-CQEFksrj.js";import"./label-BZyL5FxG.js";import"./select-5vOrrfqd.js";import"./use-ai-providers-sdJZ6mNz.js";import"./use-decopilot-events-BcoZT7aN.js";import"./use-organization-settings-oKHBa9pl.js";import"./avatar-BoywRbPN.js";import"./required-auth-layout-yLbhDcyn.js";import"./use-org-sso-BTyeGmwD.js";import"./index-29b_-5_V.js";import"./drawer-Dwf4ZgGL.js";import"./collection-search-BlDJ3wfA.js";import"./tabs-DSgk0a5j.js";import"./toggle-group-CDH3EvAk.js";import"./sortable.esm-DkJhyTY3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Bpuz5oOq.js";import"./use-registry-connections-nW4xrRwo.js";import"./useInfiniteQuery-_6Vt7DP9.js";import"./use-infinite-scroll-BlY2ZYrD.js";import"./extract-connection-data-CbdJHvwa.js";import"./card-BOvVcIuI.js";import"./collection-tabs-BcQaNGs8.js";import"./badge-DK9j0SAU.js";import"./textarea-CPTQY1o8.js";import"./connection-form-helpers-RN_jNO2h.js";import"./authenticate-and-persist-oauth-CPe5kdur.js";import"./mcp-oauth-mWpablQr.js";import"./useSuspenseInfiniteQuery-DzUbbIRw.js";import"./connect-desktop-dialog-LL9b8y6f.js";import"./decopilot-BTryLOPO.js";import"./checkbox-bjWKtrqQ.js";import"./skeleton-BF-CURRH.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cejxz9k1.js";import"./popover-By2TcBeF.js";import"./command-CgQ_mVdv.js";import"./index-BWc6Nxi2.js";import"./use-org-fs-Beh5XrxM.js";import"./dropdown-menu-t8H3HZQi.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-B5IKQTLv.js";import"./task-status-DZRrvrze.js";import"./use-status-sounds-CSGddnEV.js";import"./empty-state-sOHcjjAp.js";import"./toolbar-DMKoG-oA.js";import"./toolbar-icon-button-DlDJuZeE.js";import"./use-mcp-tools-dv3OXmKZ.js";import"./use-capability-Cx7TzNZP.js";import"./tools-list-Co_gZxL2.js";import"./switch-DTEHPKUx.js";import"./use-debounced-autosave-CH3DgeLx.js";import"./index-CFGQqfmS.js";import"./sidebar-Dpacp5GO.js";import"./search-input-Cs3ZdvNI.js";import"./github-repo-picker-Bb7z33dY.js";import"./use-debounced-value-CLDvK-S2.js";import"./github-installations-DzN1UQ4x.js";import"./use-secrets-DzM9DTqX.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./automation-runs-DGpdHPhd.js";import"./table-D1UnWNkY.js";import"./use-members-f3A3oSZc.js";import"./use-org-auth-client-DuKhly8O.js";import"./use-automations-COYPBUbQ.js";import"./use-file-configs-BRqNHDCC.js";import"./monaco-editor-BXALvB3i.js";import"./select-model-BWDQ3R_W.js";import"./automation-list-row-CGIEhWIt.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:Y,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=Y===void 0?"":Y,o=A===void 0?!1:A,[p,R]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&R(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Rt,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let O;e[11]!==L||e[12]!==N?(O=i.jsxs(Ot,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=O):O=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>R(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==O?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[O,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=O,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:Y,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:R,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const O=`${K*14+8}px`;let S;e[2]!==O?(S={paddingLeft:O},e[2]=O,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==Y||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):Y?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=Y,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==R?(u=i.jsx(_,{onSelect:R,children:"Copy Path"}),e[26]=R,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Bi({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[Y,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=Y,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[R,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,O]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){O(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,H]=l.useState(null),[J,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Xt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),H(null),me(n)}async function He(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),H(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function Je(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){H(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),H(null)}async function Ye(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Xe(t){const n=Yt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await He(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await Je(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(X=>{const oe=new Set(X);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Jt(s.content??"");u(d=>{const X=new Map(d);return X.set(t,{savedContent:a,editorValue:a,loaded:!0}),X})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return R?.kind==="directory"?R.path:R?.kind==="file"?ye(R.path):o?ye(o):"/"}function Le(t){const n=at();H({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=J?qe(J.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
2
- `)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=R?.path===n.path,X=Ht(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>H({mode:"new-file",node:n,parentDir:X}),onNewFolder:()=>H({mode:"new-folder",node:n,parentDir:X}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>H({mode:"rename",node:n,parentDir:X}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[B.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:B.map(t=>{const n=C.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Ve("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Xe,onOpenChange:t=>{!t&&!ee&&H(null)}}),i.jsx(vt,{open:J!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(Ct,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",J?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:J?.name}),J?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!J,onClick:t=>{t.preventDefault(),J&&Ye(J)},children:"Delete"})]})]})})]})}export{Bi as FileExplorer};
@@ -1 +0,0 @@
1
- import{c as $,j as t,D as Q,a as te,m as W,r as G,a5 as B,i as U,d as ne,t as z,K as V,k as se,l as K,q as oe,ae as re}from"./index-Cwa3p0hS.js";import{c as ie,a as ae,d as le,e as ce}from"./dialog-DPK3tbmm.js";import{C as J}from"./checkbox-bjWKtrqQ.js";import{C as ue}from"./collection-search-BlDJ3wfA.js";import{u as de}from"./use-debounced-value-CLDvK-S2.js";import{b as me,u as fe}from"./use-connection-BRCO5mnf.js";import{W as pe,u as H,S as X}from"./use-mcp-client-BuhWkkTG.js";import{b as Z}from"./Settings02-gahhH0gy.js";import{x as ge}from"./agent-icon-BoYpzvvS.js";import{a as xe}from"./authenticate-and-persist-oauth-CPe5kdur.js";import{u as he}from"./use-mcp-tools-dv3OXmKZ.js";import{e as ye}from"./extract-connection-data-CbdJHvwa.js";import{k as be}from"./use-navigate-to-agent-DGTdV1zx.js";import{f as Ne}from"./github-installations-DzN1UQ4x.js";function M(s){const e=$.c(4),{size:n,className:o}=s;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0016 8c0-4.42-3.58-8-8-8z"}),e[0]=u):u=e[0];let l;return e[1]!==o||e[2]!==n?(l=t.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",className:o,children:u}),e[1]=o,e[2]=n,e[3]=l):l=e[3],l}function we(s,e){const n=$.c(12),{org:o}=Q();let u;n[0]!==o.id?(u=pe.REGISTRY(o.id),n[0]=o.id,n[1]=u):u=n[1];const l=u;let i;n[2]!==o.id||n[3]!==o.slug||n[4]!==l?(i={connectionId:l,orgId:o.id,orgSlug:o.slug},n[2]=o.id,n[3]=o.slug,n[4]=l,n[5]=i):i=n[5];const x=H(i);let m;n[6]!==s?(m={name:s},n[6]=s,n[7]=m):m=n[7];const r=e?.enabled??!0;let h;return n[8]!==x||n[9]!==m||n[10]!==r?(h={client:x,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:m,enabled:r,staleTime:3e5,select:je},n[8]=x,n[9]=m,n[10]=r,n[11]=h):h=n[11],he(h)}function je(s){return s.structuredContent?.item??null}const Ie="deco/mcp-github";function Ce(s){const{org:e}=Q(),{data:n}=te.useSession(),o=me(),u=W(),[l,i]=G.useState("idle"),[x,m]=G.useState(null),[r,h]=G.useState(null),{data:g,isLoading:a}=we(Ie,{enabled:s.enabled}),N=G.useRef(!1);s.enabled&&g&&!a&&!N.current&&n?.user?.id&&l==="idle"&&(N.current=!0,b());async function b(){if(!(!g||!n?.user?.id||!e))try{i("installing"),m(null);const y=ye(g,e.id,n.user.id,{remoteIndex:0});if(!y.connection_url)throw new Error("Registry item is missing a remote URL for mcp-github");const{id:I}=await o.create.mutateAsync(y);i("authenticating");const f=await xe({connectionId:I,orgId:e.id,orgSlug:e.slug,persistFallback:d=>o.update.mutateAsync({id:I,data:{connection_token:d}}).then(()=>{})});if(f.ran&&!f.ok){try{await o.delete.mutateAsync(I)}catch{}throw new Error(f.error&&f.error!=="no token received"?f.error:"No token received from GitHub")}B(u,e.id),h(y),i("ready")}catch(y){m(y instanceof Error?y.message:String(y)),i("error")}}function w(){i("idle"),m(null),h(null),N.current=!1}return s.enabled&&a&&l==="idle"?{status:"installing",error:null,connection:null,retry:w}:{status:l,error:x,connection:r,retry:w}}const F={contents:"write",metadata:"read",pull_requests:"write",issues:"write"};function Se(s){if(!s||typeof s!="object"||Array.isArray(s))return F;const e=s;return Object.values(e).some(n=>typeof n!="string")?F:e}function ve(s){if(!(typeof s!="number"||!Number.isFinite(s)||!Number.isInteger(s)||s<=0))return s}function Ee(s){const e=s.metadata?.repoScope;if(!e||typeof e.installationId!="number"||!Number.isFinite(e.installationId)||!Number.isInteger(e.installationId)||e.installationId<=0||typeof e.owner!="string"||typeof e.repo!="string"||e.owner.length===0||e.repo.length===0)return null;const n=ve(e.repositoryId);return{sourceConnectionId:typeof e.sourceConnectionId=="string"?e.sourceConnectionId:void 0,installationId:e.installationId,repositoryId:n,owner:e.owner,repo:e.repo,permissions:Se(e.permissions),grantProvider:e.grantProvider==="github-mcp"?"github-mcp":void 0}}function Te(s){return(s??[]).filter(e=>Ee(e)===null)}const Y="GitHub MCP did not return refreshable repo grant metadata";function L(s){if(typeof s!="string")return null;const e=s.trim();return e.length>0?e:null}function ke(s){try{const e=new URL(s);return(e.protocol==="http:"||e.protocol==="https:")&&!e.username&&!e.password}catch{return!1}}function _e(s){return typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&s>0?s:void 0}async function Ae(s){const{orgSlug:e,sourceConnection:n,installationId:o,owner:u,repo:l,githubCallTool:i,selfCallTool:x}=s,m=await i({name:"MINT_REPO_TOKEN",arguments:{installationId:o,owner:u,repo:l,permissions:F}}),r=m.structuredContent;if(m.isError||!r?.token){const T=m.content?.find(v=>v.type==="text")?.text;throw new Error(T?`Failed to mint a repo-scoped GitHub token: ${T}`:"Failed to mint a repo-scoped GitHub token")}const h=L(r.refreshToken),g=L(r.tokenEndpoint),a=L(r.clientId);if(!h||!g||!a)throw new Error(Y);if(!ke(g))throw new Error(Y);const N=L(r.repository?.owner),b=L(r.repository?.name),w="GitHub MCP returned refresh metadata for a different repository";if(r.repository?.owner!==void 0&&(!N||N.toLowerCase()!==u.toLowerCase()))throw new Error(w);if(r.repository?.name!==void 0&&(!b||b.toLowerCase()!==l.toLowerCase()))throw new Error(w);const y=_e(r.repository?.id),j=r.expiresAt?Date.parse(r.expiresAt):NaN,I=Number.isFinite(j)?Math.max(0,Math.floor((j-Date.now())/1e3)):null,d=(typeof r.expiresIn=="number"&&Number.isFinite(r.expiresIn)&&Number.isInteger(r.expiresIn)&&r.expiresIn>0?r.expiresIn:null)??I,C=await x({name:"COLLECTION_CONNECTIONS_CREATE",arguments:{data:{title:`GitHub: ${u}/${l}`,description:`Repo-scoped GitHub access for ${u}/${l}`,icon:n.icon,app_name:n.app_name,app_id:n.app_id,connection_type:n.connection_type,connection_url:n.connection_url,metadata:{repoScope:{installationId:o,repositoryId:y,owner:u,repo:l,permissions:F,grantProvider:"github-mcp"}}}}}),p=C.structuredContent??C,S=p.item?.id??p.id;if(!S)throw new Error("Failed to create the repo-scoped GitHub connection");if(!(await fetch(`/api/${e}/connections/${S}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:r.token,refreshToken:h,expiresIn:d,scope:r.scope??null,clientId:a,tokenEndpoint:g})})).ok)throw await x({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:S,force:!0}}).catch(()=>{}),new Error("Failed to persist the repo-scoped token");return{childConnectionId:S}}const D=[{key:"auto-respond-to-issues",triggerType:"github.issues.opened",nameSuffix:"auto-respond to issues",label:"Auto-respond to new issues",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A new GitHub issue has been opened in ${s}/${e}. Read the issue, explore relevant code, create a branch, implement the fix, and open a PR referencing the issue number.`},{key:"review-incoming-prs",triggerType:"github.pull_request.opened",nameSuffix:"review incoming PRs",label:"Review incoming pull requests",defaultEnabled:!0,instructions:({owner:s,name:e})=>`A pull request was opened in ${s}/${e}. Read the diff, summarize what changed, flag risks (security, perf, breaking changes), and leave a review comment.`},{key:"note-merged-prs",triggerType:"github.pull_request.closed",nameSuffix:"note merged/closed PRs",label:"Note merged or closed PRs",defaultEnabled:!1,instructions:({owner:s,name:e})=>`A pull request was closed in ${s}/${e}. If it was merged, update changelog/release notes as appropriate.`}];function Re(s,e){const n=new Set;if(s.paramsSchema)for(const u of Object.keys(s.paramsSchema))n.add(u);if(Array.isArray(s.params))for(const u of s.params)n.add(u.name);else if(s.params&&typeof s.params=="object")for(const u of Object.keys(s.params))n.add(u);if(n.has("repo"))return{repo:`${e.owner}/${e.name}`};const o={};return n.has("owner")&&(o.owner=e.owner),n.has("name")&&(o.name=e.name),n.has("repository")&&(o.repository=`${e.owner}/${e.name}`),o}async function Oe({githubCallTool:s,selfCallTool:e,virtualMcpId:n,repo:o,connectionId:u,selectedKeys:l}){const i=await s({name:"TRIGGER_LIST",arguments:{}}),x=i.structuredContent??i,m=new Map((x.triggers??[]).map(a=>[a.type,a])),r=D.filter(a=>l.has(a.key)),h=await Promise.allSettled(r.map(async a=>{const N=m.get(a.triggerType);if(!N)throw new Error(`Trigger ${a.triggerType} not exposed`);const b=await e({name:"AUTOMATION_CREATE",arguments:{name:`${o.name}: ${a.nameSuffix}`,virtual_mcp_id:n,messages:a.instructions(o),active:!0}}),w=(b.structuredContent??b).id;if(!w)throw new Error(`AUTOMATION_CREATE returned no id for ${a.key}`);await e({name:"AUTOMATION_TRIGGER_ADD",arguments:{automation_id:w,type:"event",connection_id:u,event_type:a.triggerType,params:Re(N,o)}})})),g=h.filter(a=>a.status==="rejected").length;return g>0&&console.error("Some GitHub automations failed to set up:",h.filter(a=>a.status==="rejected")),{total:h.length,failed:g}}function Ze(s){const e=$.c(22),{open:n,onOpenChange:o,title:u,hideAutoRespondCheckbox:l,onImportComplete:i}=s,x=u===void 0?"Import from GitHub":u,m=l===void 0?!1:l,[r,h]=G.useState(null);let g;e[0]!==x?(g=t.jsx(ie,{className:"sr-only",children:t.jsx(ae,{children:x})}),e[0]=x,e[1]=g):g=e[1];let a;e[2]!==r||e[3]!==x?(a=t.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3 shrink-0",children:r?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>h(null),className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors shrink-0","aria-label":"Back to accounts",children:t.jsx(Z,{size:16})}),t.jsx("img",{src:r.avatarUrl,alt:r.login,className:"size-5 rounded-full ring-1 ring-border shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:r.login})]}):t.jsxs(t.Fragment,{children:[t.jsx(M,{className:"size-4 text-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-foreground",children:x})]})}),e[2]=r,e[3]=x,e[4]=a):a=e[4];let N;e[5]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=N):N=e[5];let b;e[6]!==o?(b=()=>o(!1),e[6]=o,e[7]=b):b=e[7];let w;e[8]!==m||e[9]!==i||e[10]!==n||e[11]!==r||e[12]!==b?(w=t.jsx("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:t.jsx(G.Suspense,{fallback:N,children:t.jsx(Ge,{open:n,onComplete:b,selectedInstallation:r,onSelectInstallation:h,hideAutoRespondCheckbox:m,onImportComplete:i})})}),e[8]=m,e[9]=i,e[10]=n,e[11]=r,e[12]=b,e[13]=w):w=e[13];let y;e[14]!==g||e[15]!==a||e[16]!==w?(y=t.jsxs(le,{className:"sm:max-w-[560px] h-[85svh] sm:h-[520px] p-0 gap-0 overflow-hidden flex flex-col",children:[g,a,w]}),e[14]=g,e[15]=a,e[16]=w,e[17]=y):y=e[17];let j;return e[18]!==o||e[19]!==n||e[20]!==y?(j=t.jsx(ce,{open:n,onOpenChange:o,children:y}),e[18]=o,e[19]=n,e[20]=y,e[21]=j):j=e[21],j}function Ge({open:s,onComplete:e,selectedInstallation:n,onSelectInstallation:o,hideAutoRespondCheckbox:u,onImportComplete:l}){const{org:i}=Q(),x=W(),m=be(),[r,h]=G.useState(null),[g,a]=G.useState(!0),[N,b]=G.useState(()=>new Set(D.filter(c=>c.defaultEnabled).map(c=>c.key))),w=D.filter(c=>c.defaultEnabled).map(c=>c.key),y=u?new Set(w):g?N:new Set,j=fe({slug:"mcp-github"}),I=Te(j),f=Ce({enabled:s&&I.length===0}),d=I.length===1?I[0]??null:r,C=H({connectionId:d?.id??"",orgId:i.id,orgSlug:i.slug}),p=H({connectionId:X,orgId:i.id,orgSlug:i.slug}),S=async(c,E)=>{try{const O=await C.callTool({name:"get_file_contents",arguments:{owner:c.owner,repo:c.name,path:E}});if(O.isError)return null;const P=O.content?.find(A=>A.type==="resource")?.resource?.text;if(!P)return null;try{const A=JSON.parse(P);return typeof A=="string"?A:JSON.stringify(A)}catch{return P}}catch{return null}},R=(c,E)=>{Promise.all([S(E,"AGENTS.md"),S(E,"CLAUDE.md")]).then(async([_,O])=>{const k=_??O??null;k&&(await p.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:c,data:{metadata:{instructions:k}}}}),B(x,i.id))}).catch(_=>{console.error("GitHub instructions fetch failed:",_)})},T=async({virtualMcpId:c,repo:E,connectionId:_,selectedKeys:O})=>{const{total:k,failed:P}=await Oe({githubCallTool:A=>C.callTool(A),selfCallTool:A=>p.callTool(A),virtualMcpId:c,repo:E,connectionId:_,selectedKeys:O});P>0&&z.warning(`Set up ${k-P}/${k} GitHub automations. Add the rest from the automations view.`)},v=ne({mutationFn:async c=>{if(!d||!n)throw new Error("No GitHub connection or installation");const E=n.installationId,{childConnectionId:_}=await Ae({orgSlug:i.slug,sourceConnection:d,installationId:E,owner:c.owner,repo:c.name,githubCallTool:k=>C.callTool(k),selfCallTool:k=>p.callTool(k)});let O=null;try{const k=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:c.name,description:c.description||"Imported from GitHub",pinned:!1,icon:null,metadata:{githubRepo:{owner:c.owner,name:c.name,url:c.url,installationId:E,connectionId:_},instructions:null,ui:{pinnedViews:null,layout:{defaultMainView:{type:"preview"},chatDefaultOpen:!0}}},connections:[{connection_id:_}]}}}),P=k.structuredContent??k,A=P.item?.id;if(!P.item||!A)throw new Error("Failed to create the imported agent");return O=A,y.size>0&&await T({virtualMcpId:A,repo:c,connectionId:_,selectedKeys:y}).catch(ee=>{console.error("Failed to set up GitHub automations:",ee),z.warning("Imported repo, but failed to set up GitHub automations. You can add triggers manually from the automations view.")}),{virtualMcpId:A,repo:c,connectionId:_,item:P.item}}catch(k){throw O&&await p.callTool({name:"COLLECTION_VIRTUAL_MCP_DELETE",arguments:{id:O}}).catch(()=>{}),await p.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:_,force:!0}}).catch(()=>{}),k}},onSuccess:({virtualMcpId:c,repo:E,connectionId:_,item:O})=>{if(x.setQueryData(V.collectionItem(p,i.id,"","VIRTUAL_MCP",c),{item:O}),B(x,i.id),R(c,E),l){l({virtualMcpId:c,repo:E,connectionId:_});return}z.success(`Imported ${E.name} from GitHub`),e(),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),m(c)},onError:c=>{z.error("Failed to import repo: "+(c instanceof Error?c.message:"Unknown error"))}});return f.status==="installing"||f.status==="authenticating"?t.jsx(q,{status:f.status,error:null,retry:f.retry}):f.status==="error"?t.jsx(q,{status:"error",error:f.error,retry:f.retry}):I.length===0&&f.status==="idle"?t.jsx(q,{status:"installing",error:null,retry:f.retry}):I.length>1&&!d?t.jsxs("div",{className:"flex flex-col py-2",children:[t.jsx("div",{className:"px-4 py-2",children:t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Select a connection"})}),I.map(c=>t.jsxs("button",{type:"button",onClick:()=>h(c),className:"flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left",children:[c.icon?t.jsx("img",{src:c.icon,alt:c.title,className:"size-7 rounded-full shrink-0"}):t.jsx("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(M,{className:"size-3.5 text-muted-foreground"})}),t.jsx("span",{className:"text-sm font-medium",children:c.title})]},c.id))]}):d?n?t.jsx($e,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,installation:n,onSelectRepo:c=>v.mutate(c),isSaving:v.isPending,autoRespondEnabled:g,onAutoRespondChange:a,selectedAutomationKeys:N,onAutomationKeysChange:b,hideAutoRespondCheckbox:u}):t.jsx(Pe,{connectionId:d.id,orgId:i.id,orgSlug:i.slug,onSelect:o,showBackButton:I.length>1,onBack:()=>h(null)}):null}function Pe(s){const e=$.c(31),{connectionId:n,orgId:o,orgSlug:u,onSelect:l,showBackButton:i,onBack:x}=s;let m;e[0]!==o||e[1]!==u?(m={connectionId:X,orgId:o,orgSlug:u},e[0]=o,e[1]=u,e[2]=m):m=e[2];const r=H(m);let h;e[3]!==n||e[4]!==o?(h=V.githubUserOrgs(o,n),e[3]=n,e[4]=o,e[5]=h):h=e[5];let g;e[6]!==n||e[7]!==r?(g=()=>Ne(p=>r.callTool(p),n),e[6]=n,e[7]=r,e[8]=g):g=e[8];let a;e[9]!==h||e[10]!==g?(a={queryKey:h,queryFn:g},e[9]=h,e[10]=g,e[11]=a):a=e[11];const N=se(a);if(N.isLoading){let p;return e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[12]=p):p=e[12],p}if(N.isError){let p;return e[13]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load GitHub accounts"})}),e[13]=p):p=e[13],p}const b=N.data;if(!b)return null;let w;e[14]!==x||e[15]!==i?(w=i&&t.jsx("div",{className:"flex items-center gap-1 px-4 pt-3 pb-1 shrink-0",children:t.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Z,{size:12}),"Change connection"]})}),e[14]=x,e[15]=i,e[16]=w):w=e[16];let y;if(e[17]!==b.installations||e[18]!==l){let p;e[20]!==l?(p=S=>t.jsxs("button",{type:"button",onClick:()=>l(S),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-accent transition-colors text-left group",children:[t.jsx("img",{src:S.avatarUrl,alt:S.login,className:"size-7 rounded-full shrink-0 ring-1 ring-border"}),t.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium leading-none",children:S.login}),S.type==="User"&&t.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Personal account"})]}),t.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:"Select →"})]},S.installationId),e[20]=l,e[21]=p):p=e[21],y=b.installations.map(p),e[17]=b.installations,e[18]=l,e[19]=y}else y=e[19];let j;e[22]!==y?(j=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]",children:y}),e[22]=y,e[23]=j):j=e[23];const I=b.appSlug?`https://github.com/apps/${b.appSlug}/installations/new`:"https://github.com/settings/installations";let f;e[24]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"underline underline-offset-2",children:"Install the GitHub App"}),e[24]=f):f=e[24];let d;e[25]!==I?(d=t.jsx("div",{className:"px-4 py-3 border-t border-border shrink-0",children:t.jsxs("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Account not listed?"," ",f]})}),e[25]=I,e[26]=d):d=e[26];let C;return e[27]!==d||e[28]!==w||e[29]!==j?(C=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[w,j,d]}),e[27]=d,e[28]=w,e[29]=j,e[30]=C):C=e[30],C}function $e(s){const e=$.c(27),{connectionId:n,orgId:o,orgSlug:u,installation:l,onSelectRepo:i,isSaving:x,autoRespondEnabled:m,onAutoRespondChange:r,selectedAutomationKeys:h,onAutomationKeysChange:g,hideAutoRespondCheckbox:a}=s,[N,b]=G.useState(""),w=de(N,300),y=G.useDeferredValue(w),j=N!==y;let I;e[0]!==j||e[1]!==N?(I=t.jsx(ue,{placeholder:"Search repositories...",value:N,onChange:b,isSearching:j}),e[0]=j,e[1]=N,e[2]=I):I=e[2];const f=j?"opacity-40":"opacity-100";let d;e[3]!==f?(d=K("flex-1 overflow-hidden flex flex-col transition-opacity duration-150",f),e[3]=f,e[4]=d):d=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(U,{size:18,className:"animate-spin text-muted-foreground"})}),e[5]=C):C=e[5];let p;e[6]!==n||e[7]!==y||e[8]!==l||e[9]!==x||e[10]!==i||e[11]!==o||e[12]!==u?(p=t.jsx(G.Suspense,{fallback:C,children:t.jsx(Le,{connectionId:n,orgId:o,orgSlug:u,installation:l,query:y,onSelectRepo:i,isSaving:x})}),e[6]=n,e[7]=y,e[8]=l,e[9]=x,e[10]=i,e[11]=o,e[12]=u,e[13]=p):p=e[13];let S;e[14]!==d||e[15]!==p?(S=t.jsx("div",{className:d,children:p}),e[14]=d,e[15]=p,e[16]=S):S=e[16];let R;e[17]!==m||e[18]!==a||e[19]!==r||e[20]!==g||e[21]!==h?(R=!a&&t.jsxs("div",{className:"border-t border-border shrink-0",children:[t.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",children:[t.jsx(J,{checked:m,onCheckedChange:v=>r(v===!0)}),t.jsx("span",{className:"text-xs text-foreground",children:"Set up GitHub automations for this repo"})]}),m&&t.jsx("div",{className:"px-4 pb-3 pl-9 flex flex-col gap-1.5",children:D.map(v=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx(J,{checked:h.has(v.key),onCheckedChange:c=>{const E=new Set(h);c===!0?E.add(v.key):E.delete(v.key),g(E)}}),t.jsx("span",{className:"text-xs text-muted-foreground",children:v.label})]},v.key))})]}),e[17]=m,e[18]=a,e[19]=r,e[20]=g,e[21]=h,e[22]=R):R=e[22];let T;return e[23]!==I||e[24]!==S||e[25]!==R?(T=t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[I,S,R]}),e[23]=I,e[24]=S,e[25]=R,e[26]=T):T=e[26],T}function Le(s){const e=$.c(29),{connectionId:n,orgId:o,orgSlug:u,installation:l,query:i,onSelectRepo:x,isSaving:m}=s;let r;e[0]!==n||e[1]!==o||e[2]!==u?(r={connectionId:n,orgId:o,orgSlug:u},e[0]=n,e[1]=o,e[2]=u,e[3]=r):r=e[3];const h=H(r),g=l.type==="User"?"user":"org",a=i?`${g}:${l.login} ${i} in:name`:`${g}:${l.login}`;let N;e[4]!==n||e[5]!==l.login||e[6]!==o||e[7]!==i?(N=V.githubOrgRepos(o,n,l.login,i),e[4]=n,e[5]=l.login,e[6]=o,e[7]=i,e[8]=N):N=e[8];let b;e[9]!==h||e[10]!==a?(b=async f=>{const{signal:d}=f,p=(await h.callTool({name:"search_repositories",arguments:{query:a,page:1,perPage:30}},void 0,{signal:d})).content?.[0]?.text;if(!p)throw new Error("No response from search_repositories");return(JSON.parse(p).items??[]).map(He)},e[9]=h,e[10]=a,e[11]=b):b=e[11];let w;e[12]!==N||e[13]!==b?(w={queryKey:N,queryFn:b},e[12]=N,e[13]=b,e[14]=w):w=e[14];const{data:y}=oe(w);if(y.length===0){let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("p",{className:"text-sm text-muted-foreground",children:"No repositories found"}),e[15]=f):f=e[15];let d;e[16]!==i?(d=i&&t.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Try a different search term"}),e[16]=i,e[17]=d):d=e[17];let C;return e[18]!==d?(C=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1",children:[f,d]}),e[18]=d,e[19]=C):C=e[19],C}let j;if(e[20]!==m||e[21]!==x||e[22]!==y){let f;e[24]!==m||e[25]!==x?(f=d=>t.jsxs("button",{type:"button",onClick:()=>x(d),disabled:m,className:"flex items-start gap-3 px-4 py-3 hover:bg-accent transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(M,{className:"size-4 text-muted-foreground mt-0.5 shrink-0"}),t.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:t.jsx("span",{className:"text-sm font-medium truncate",children:d.name})}),t.jsxs("span",{className:"flex items-center gap-1 text-xs font-medium text-muted-foreground border border-border rounded px-1.5 py-0.5 shrink-0 leading-none",children:[d.private?t.jsx(re,{size:10}):t.jsx(ge,{size:10}),d.private?"Private":"Public"]})]},d.fullName),e[24]=m,e[25]=x,e[26]=f):f=e[26],j=y.map(f),e[20]=m,e[21]=x,e[22]=y,e[23]=j}else j=e[23];let I;return e[27]!==j?(I=t.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden flex flex-col [scrollbar-gutter:stable]",children:j}),e[27]=j,e[28]=I):I=e[28],I}function He(s){return{name:s.name,fullName:s.full_name,owner:s.full_name.split("/")[0]??"",url:s.html_url,private:s.private,description:s.description,updatedAt:s.updated_at}}function q(s){const e=$.c(33),{status:n,error:o,retry:u}=s;if(n==="error"){let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"size-10 rounded-full bg-destructive/10 flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-destructive"})}),e[0]=p):p=e[0];let S;e[1]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("p",{className:"text-sm font-medium",children:"Connection failed"}),e[1]=S):S=e[1];const R=o??"Something went wrong while connecting to GitHub.";let T;e[2]!==R?(T=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[S,t.jsx("p",{className:"text-xs text-muted-foreground max-w-[260px] leading-relaxed",children:R})]}),e[2]=R,e[3]=T):T=e[3];let v;e[4]!==u?(v=t.jsx("button",{type:"button",onClick:u,className:"text-xs font-medium text-foreground border border-border rounded-md px-3 py-1.5 hover:bg-accent transition-colors",children:"Try again"}),e[4]=u,e[5]=v):v=e[5];let c;return e[6]!==T||e[7]!==v?(c=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[p,T,v]}),e[6]=T,e[7]=v,e[8]=c):c=e[8],c}const l=n==="authenticating";let i;e[9]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"size-10 rounded-full bg-muted flex items-center justify-center",children:t.jsx(M,{className:"size-5 text-foreground"})}),e[9]=i):i=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"relative size-10",children:[i,t.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-background flex items-center justify-center",children:t.jsx(U,{size:12,className:"animate-spin text-muted-foreground"})})]}),e[10]=x):x=e[10];const m=l?"Authenticating with GitHub":"Setting up GitHub";let r;e[11]!==m?(r=t.jsx("p",{className:"text-sm font-medium",children:m}),e[11]=m,e[12]=r):r=e[12];const h=l?"Complete the OAuth flow in your browser":"Installing the GitHub connection...";let g;e[13]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[13]=h,e[14]=g):g=e[14];let a;e[15]!==r||e[16]!==g?(a=t.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[r,g]}),e[15]=r,e[16]=g,e[17]=a):a=e[17];const N=l?"bg-muted-foreground/30":"bg-foreground animate-pulse";let b;e[18]!==N?(b=K("size-1.5 rounded-full",N),e[18]=N,e[19]=b):b=e[19];let w;e[20]!==b?(w=t.jsx("span",{className:b}),e[20]=b,e[21]=w):w=e[21];const y=l?"bg-foreground animate-pulse":"bg-muted-foreground/30";let j;e[22]!==y?(j=K("size-1.5 rounded-full",y),e[22]=y,e[23]=j):j=e[23];let I;e[24]!==j?(I=t.jsx("span",{className:j}),e[24]=j,e[25]=I):I=e[25];let f;e[26]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}),e[26]=f):f=e[26];let d;e[27]!==w||e[28]!==I?(d=t.jsxs("div",{className:"flex items-center gap-1.5",children:[w,I,f]}),e[27]=w,e[28]=I,e[29]=d):d=e[29];let C;return e[30]!==d||e[31]!==a?(C=t.jsxs("div",{className:"flex flex-col items-center gap-4 px-6 py-10",children:[x,a,d]}),e[30]=d,e[31]=a,e[32]=C):C=e[32],C}export{Ze as G,M as a,Te as g,Ae as p,Ce as u};