decocms 2.291.2 → 2.292.1

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 (208) hide show
  1. package/dist/client/assets/{AlertCircle-BU25E17i.js → AlertCircle-Cx8oex2u.js} +1 -1
  2. package/dist/client/assets/{ArrowNarrowLeft-DsozI7ul.js → ArrowNarrowLeft-DtpIYMrr.js} +1 -1
  3. package/dist/client/assets/{ArrowUpRight-wUPlLzWo.js → ArrowUpRight-BBjaHjTK.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-B6ooPL10.js → CheckCircle-Mywkb82K.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BjunjZ96.js → ChevronDown-BE0rQ4ho.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DZ8_B5Zy.js → ChevronRight-BVJ2HUMt.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BcfJms1N.js → ChevronUp-B2y_5HwX.js} +1 -1
  8. package/dist/client/assets/{Container-BBbTXyMq.js → Container-CtsNRge8.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-ChXlfNDE.js → DotsVertical-BQnGY6Nc.js} +1 -1
  10. package/dist/client/assets/{LinkExternal01-Bq6E6IiB.js → LinkExternal01-SieYyhiZ.js} +1 -1
  11. package/dist/client/assets/{Lock01-CT9fVg-M.js → Lock01-BrFrkt3t.js} +1 -1
  12. package/dist/client/assets/{Palette-CL1PeBDG.js → Palette-2CChK5yr.js} +1 -1
  13. package/dist/client/assets/{Play-O7Kb3HkD.js → Play-BfzIvHVC.js} +1 -1
  14. package/dist/client/assets/{Plus-BX8KY2Vj.js → Plus-kLSd3TZy.js} +1 -1
  15. package/dist/client/assets/{RefreshCcw01-DtyDEAf2.js → RefreshCcw01-B-L6FvMp.js} +1 -1
  16. package/dist/client/assets/{SearchMd-CJm9ITir.js → SearchMd-BfBE-dHK.js} +1 -1
  17. package/dist/client/assets/{Settings02-0UGyPXgy.js → Settings02-EP4I50bB.js} +1 -1
  18. package/dist/client/assets/{Shield01-ajX6eCWD.js → Shield01-D19-LRUf.js} +1 -1
  19. package/dist/client/assets/{Star01-DLcvdqts.js → Star01-MuiWZ8GS.js} +1 -1
  20. package/dist/client/assets/{Sun-DwH3UR5R.js → Sun-CTLobT4y.js} +1 -1
  21. package/dist/client/assets/{Tool01-Dqe-c7_N.js → Tool01-CeBylvMu.js} +1 -1
  22. package/dist/client/assets/{Trash01-CO6PRylN.js → Trash01-BLGcALKg.js} +1 -1
  23. package/dist/client/assets/{User01-JrKdMZpa.js → User01-BLHrCCyy.js} +1 -1
  24. package/dist/client/assets/{Users03-DGkdZmwX.js → Users03-C3QqJn94.js} +1 -1
  25. package/dist/client/assets/{X-BFKhYElJ.js → X-BJbamPEP.js} +1 -1
  26. package/dist/client/assets/{XCircle-BCi1SPUb.js → XCircle-DP5EGLqX.js} +1 -1
  27. package/dist/client/assets/{XClose-BL1_qV1F.js → XClose-BRn4UVuG.js} +1 -1
  28. package/dist/client/assets/{Zap-Bsssnre4.js → Zap-kZUu0No-.js} +1 -1
  29. package/dist/client/assets/{ZapSquare-dR2caQ4h.js → ZapSquare-B3o6QvJe.js} +1 -1
  30. package/dist/client/assets/{accordion-CSdeKGev.js → accordion-BP1gqDGq.js} +1 -1
  31. package/dist/client/assets/{agent-icon-BHvp6mzD.js → agent-icon-Db8xI2bq.js} +1 -1
  32. package/dist/client/assets/{agents-list-DelQtLci.js → agents-list-CKkZAwkG.js} +1 -1
  33. package/dist/client/assets/ai-providers-Cnvjm1DV.js +1 -0
  34. package/dist/client/assets/{alert-dialog-7-SyZGSt.js → alert-dialog-BFg1HHbW.js} +1 -1
  35. package/dist/client/assets/{auth-catchall-iqLWQ8B0.js → auth-catchall-BPCBowrT.js} +1 -1
  36. package/dist/client/assets/{automation-list-row-CGm-OiLc.js → automation-list-row-0e1qSQoQ.js} +1 -1
  37. package/dist/client/assets/{automations-CYw0JH2e.js → automations-Cr0E7mF8.js} +1 -1
  38. package/dist/client/assets/{avatar-Zzj9UMlL.js → avatar-BfSY5CVM.js} +1 -1
  39. package/dist/client/assets/{badge--Lhfsu1W.js → badge-C_B8gNbw.js} +1 -1
  40. package/dist/client/assets/{brand-context-YW1Q-eq7.js → brand-context-DMrJlbv3.js} +1 -1
  41. package/dist/client/assets/{card-9GTnJhWp.js → card-G6flwhwa.js} +1 -1
  42. package/dist/client/assets/{chat-context-DXvG89K2.js → chat-context-BJBiG4eq.js} +1 -1
  43. package/dist/client/assets/{checkbox-duvwt99y.js → checkbox-LBmczTXJ.js} +1 -1
  44. package/dist/client/assets/{collection-detail-F4_8z6Hn.js → collection-detail-D_lV_A0m.js} +1 -1
  45. package/dist/client/assets/{collection-display-button-DinzcNMl.js → collection-display-button-BXL1tYdg.js} +1 -1
  46. package/dist/client/assets/{collection-search-BcpKEq0y.js → collection-search-CsSMb59s.js} +1 -1
  47. package/dist/client/assets/{collection-search-BoQ_EppH.js → collection-search-DoXoIAYq.js} +1 -1
  48. package/dist/client/assets/{collection-table-wrapper-Q2gV7sPs.js → collection-table-wrapper-B2fVBjE4.js} +1 -1
  49. package/dist/client/assets/{collection-tabs-Dl6rp80p.js → collection-tabs-CA1SpsaZ.js} +1 -1
  50. package/dist/client/assets/{collections-CtHgOGSI.js → collections-BAHpsq0P.js} +1 -1
  51. package/dist/client/assets/{command-BY-OMlmS.js → command-CJYPyBOh.js} +1 -1
  52. package/dist/client/assets/{connection-card-CxvFxmw2.js → connection-card-DZ1fYoPr.js} +1 -1
  53. package/dist/client/assets/{connection-detail-B2-UvKp7.js → connection-detail-DGI32gtH.js} +1 -1
  54. package/dist/client/assets/{connection-form-helpers-skhe2PwK.js → connection-form-helpers-Dim-adMo.js} +1 -1
  55. package/dist/client/assets/{connections-B9rvBIJs.js → connections-Dl4MUHeU.js} +1 -1
  56. package/dist/client/assets/{constants-Bp8ek76r.js → constants-B-gCw63I.js} +1 -1
  57. package/dist/client/assets/{constants-BAzsARw1.js → constants-Dw_UtizE.js} +1 -1
  58. package/dist/client/assets/{dialog-C2cBQ0ty.js → dialog-DjZXbytL.js} +1 -1
  59. package/dist/client/assets/{domain-settings-DX4izaPT.js → domain-settings-NIhMIJvG.js} +1 -1
  60. package/dist/client/assets/{drawer-B_-bDnjD.js → drawer-BFBl_9mB.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-DWNG84J5.js → dropdown-menu--l1OQ6xu.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-C-4aN23S.js → dynamic-plugin-layout-D8kk92gE.js} +1 -1
  63. package/dist/client/assets/{empty-state-BKimHCce.js → empty-state-CWYR2iH4.js} +1 -1
  64. package/dist/client/assets/{empty-state-CLCMWued.js → empty-state-DskpQs8Q.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-DAdB5U1f.js → extract-connection-data-DiYA0QYt.js} +1 -1
  66. package/dist/client/assets/{features-CFZqwKf_.js → features-j7f3i077.js} +1 -1
  67. package/dist/client/assets/{form-92QvOiJ_.js → form-BVdbuwTF.js} +1 -1
  68. package/dist/client/assets/{general-CIx8MPEj.js → general-BLunjYWc.js} +1 -1
  69. package/dist/client/assets/{github-repo-picker-CUaU2lz-.js → github-repo-picker-ku0KWxb8.js} +1 -1
  70. package/dist/client/assets/index-BZi9riJ2.css +1 -0
  71. package/dist/client/assets/{index-CxVUAwST.js → index-Bm_-4bAj.js} +1 -1
  72. package/dist/client/assets/{index-CzXBz_F7.js → index-BnoHDdAn.js} +1 -1
  73. package/dist/client/assets/{index-Dq226A4w.js → index-Bu0xhzLF.js} +2 -2
  74. package/dist/client/assets/{index-DNXvVXJy.js → index-CHcfXh0a.js} +1 -1
  75. package/dist/client/assets/{index-BRQ0tifs.js → index-CllFnV9J.js} +1 -1
  76. package/dist/client/assets/{index-CEfeDibH.js → index-ClmOj0lo.js} +20 -20
  77. package/dist/client/assets/{index-CTsYITXV.js → index-DA_fcz0a.js} +1 -1
  78. package/dist/client/assets/{index-BIYmbFmV.js → index-I_6bIMcX.js} +1 -1
  79. package/dist/client/assets/{index-BPhQ3efs.js → index-QvZR-ABK.js} +1 -1
  80. package/dist/client/assets/{index-BbevWgzi.js → index-x18ABRVV.js} +1 -1
  81. package/dist/client/assets/{infiniteQueryObserver-DAJ1MAYd.js → infiniteQueryObserver-DEk-T30Y.js} +1 -1
  82. package/dist/client/assets/{input-sAl4qpu7.js → input-B5aMagwc.js} +1 -1
  83. package/dist/client/assets/{integration-icon-AZugc3yw.js → integration-icon-B5mNngh-.js} +1 -1
  84. package/dist/client/assets/{label-CgTKL0Kd.js → label-Bv4VMaQH.js} +1 -1
  85. package/dist/client/assets/{layout-irXWDg_F.js → layout-ChoVtsz2.js} +1 -1
  86. package/dist/client/assets/{login-D6bW_SwU.js → login-DFTX50_T.js} +1 -1
  87. package/dist/client/assets/{members-Bl2wPM_1.js → members-BbGgTXF7.js} +1 -1
  88. package/dist/client/assets/{monaco-editor-C_NWZeTl.js → monaco-editor-CV15HqlU.js} +1 -1
  89. package/dist/client/assets/{monitoring-stats-row-CvAc2TdA.js → monitoring-stats-row-FCrYNYUL.js} +1 -1
  90. package/dist/client/assets/{oauth-callback-CVJgN1AT.js → oauth-callback-W1x4HvAt.js} +1 -1
  91. package/dist/client/assets/{oauth-callback-ai-provider-oXA-Awv1.js → oauth-callback-ai-provider-8jGGtkD-.js} +1 -1
  92. package/dist/client/assets/{onboarding-BLnL078F.js → onboarding-DiKHM7MB.js} +1 -1
  93. package/dist/client/assets/{org-layout-OuwJcURT.js → org-layout-B-bINoer.js} +1 -1
  94. package/dist/client/assets/{org-plugin-layout-BldguEGv.js → org-plugin-layout-enuMys5H.js} +1 -1
  95. package/dist/client/assets/{plugin-empty-state-CRh8LLke.js → plugin-empty-state-DCR5r8Zj.js} +1 -1
  96. package/dist/client/assets/{plugin-header-DQQsADvB.js → plugin-header-DX2ycNO6.js} +1 -1
  97. package/dist/client/assets/{plugin-layout-xMoCwh-U.js → plugin-layout-2a2a-fWN.js} +1 -1
  98. package/dist/client/assets/{popover-Cl9Q4B_r.js → popover-CGtNHDEz.js} +1 -1
  99. package/dist/client/assets/{profile-Dwkg2__q.js → profile-C0rN-ocq.js} +1 -1
  100. package/dist/client/assets/{project-app-view-Ds5KIeD6.js → project-app-view-CQsZ6NHk.js} +1 -1
  101. package/dist/client/assets/registry-BO2q_Gke.js +2 -0
  102. package/dist/client/assets/{registry-layout-BcsYgVKZ.js → registry-layout-YWa06n-y.js} +1 -1
  103. package/dist/client/assets/{required-auth-layout-3FXLvGi_.js → required-auth-layout-emsOE3qR.js} +1 -1
  104. package/dist/client/assets/{reset-password-CchTJTF9.js → reset-password-CfhsLJCK.js} +1 -1
  105. package/dist/client/assets/{roles-5IF_wtdu.js → roles-BDsBxvE0.js} +1 -1
  106. package/dist/client/assets/{scroll-area-094tZsTA.js → scroll-area-CoWBmpAM.js} +1 -1
  107. package/dist/client/assets/{search-input-CIR03_9I.js → search-input-DRzVzeWW.js} +1 -1
  108. package/dist/client/assets/{select-C3X6ssTw.js → select-DerdayxE.js} +1 -1
  109. package/dist/client/assets/{select-model-BcH4syAI.js → select-model-BdV3Nm5y.js} +1 -1
  110. package/dist/client/assets/{settings-layout-DiCQMM4S.js → settings-layout-B3TmxZwq.js} +1 -1
  111. package/dist/client/assets/{settings-section-Q55Fgh-8.js → settings-section-nyO0fOgx.js} +1 -1
  112. package/dist/client/assets/{shell-layout-4T5ISWfh.js → shell-layout-cKwbYqFy.js} +1 -1
  113. package/dist/client/assets/{skeleton-DGdg1BKw.js → skeleton-ClT50YXx.js} +1 -1
  114. package/dist/client/assets/{sso-Coky_69P.js → sso-DXETt_Ed.js} +1 -1
  115. package/dist/client/assets/{store-hdsNmYTT.js → store-BBgqe7Dc.js} +1 -1
  116. package/dist/client/assets/store-registry-DKa8Ghfu.js +2 -0
  117. package/dist/client/assets/{switch-D2IuZl3W.js → switch-Bp1Tvx2h.js} +1 -1
  118. package/dist/client/assets/{table-DMAlnYBn.js → table-BL7WuMkY.js} +1 -1
  119. package/dist/client/assets/{tabs-BqcAeZdj.js → tabs-CNz9F6wL.js} +1 -1
  120. package/dist/client/assets/{task-status-95rqQaw6.js → task-status-D3v6N-jY.js} +1 -1
  121. package/dist/client/assets/{textarea-B3aDHfMl.js → textarea-BxmFQbso.js} +1 -1
  122. package/dist/client/assets/{toggle-group-CRKBIdwr.js → toggle-group-B4KaadHq.js} +1 -1
  123. package/dist/client/assets/{tools-list-D1jmrWjZ.js → tools-list-BNtwzSa4.js} +1 -1
  124. package/dist/client/assets/{types-CmztvBo8.js → types-BtVZ_7jK.js} +1 -1
  125. package/dist/client/assets/{use-ai-providers-DV1XR9hI.js → use-ai-providers-DqhLue8O.js} +1 -1
  126. package/dist/client/assets/{use-collections-5a3WcFJc.js → use-collections-CLt7BhQ3.js} +1 -1
  127. package/dist/client/assets/{use-connection-dg_H_Pr1.js → use-connection-BCV5VAjQ.js} +1 -1
  128. package/dist/client/assets/{use-copy-RJi4IuzY.js → use-copy-CYT1tdMJ.js} +1 -1
  129. package/dist/client/assets/{use-create-virtual-mcp-CCwbfx6_.js → use-create-virtual-mcp-DPW_d2QJ.js} +1 -1
  130. package/dist/client/assets/{use-decopilot-events-Dzf3hgZq.js → use-decopilot-events-BNaQbe7E.js} +1 -1
  131. package/dist/client/assets/{use-delete-connection-D5D7M4ay.js → use-delete-connection-YzycomMd.js} +1 -1
  132. package/dist/client/assets/{use-infinite-scroll-C3Qa6hGW.js → use-infinite-scroll-CoMWGssU.js} +1 -1
  133. package/dist/client/assets/{use-list-state-hDUYjUlU.js → use-list-state-jiGNrC7M.js} +1 -1
  134. package/dist/client/assets/{use-mcp-tools-DigN6mZj.js → use-mcp-tools-yi4edHzR.js} +1 -1
  135. package/dist/client/assets/{use-members-ChwILPhE.js → use-members-BPb2gPfy.js} +1 -1
  136. package/dist/client/assets/{use-mobile-BSlkjiym.js → use-mobile-BACO9YYc.js} +1 -1
  137. package/dist/client/assets/{use-navigate-to-agent-yRpKyeIE.js → use-navigate-to-agent-DbPOuTIs.js} +1 -1
  138. package/dist/client/assets/{use-org-sso-OgWFYsGG.js → use-org-sso-CEfAe1W3.js} +1 -1
  139. package/dist/client/assets/{use-organization-roles-AsLd-PIV.js → use-organization-roles-1TjtICKp.js} +1 -1
  140. package/dist/client/assets/{use-organization-settings-dHr-vwwr.js → use-organization-settings-B98QP_Ve.js} +1 -1
  141. package/dist/client/assets/{use-registry-connections-CYHmfgoy.js → use-registry-connections-D0FgXcrs.js} +1 -1
  142. package/dist/client/assets/{use-status-sounds-B12GPbr_.js → use-status-sounds-B5WhjryL.js} +1 -1
  143. package/dist/client/assets/{use-tasks-CBpkur0D.js → use-tasks-COeMfIn8.js} +1 -1
  144. package/dist/client/assets/{use-view-mode-BAlWkrBx.js → use-view-mode-BLlR5qfu.js} +1 -1
  145. package/dist/client/assets/{use-virtual-mcp-CTcuyRU_.js → use-virtual-mcp-CZoeCuBL.js} +1 -1
  146. package/dist/client/assets/useInfiniteQuery-BiAZtptE.js +1 -0
  147. package/dist/client/assets/useSuspenseInfiniteQuery-CPbx6xDm.js +1 -0
  148. package/dist/client/assets/{user-BnSZoTYs.js → user-CWcWoefF.js} +1 -1
  149. package/dist/client/assets/{view-mode-toggle-XuC9ujfW.js → view-mode-toggle-C_B0ABFw.js} +1 -1
  150. package/dist/client/assets/{workflow-CmKE8auY.js → workflow-Cq9jV44q.js} +1 -1
  151. package/dist/client/assets/workflow-detail-CaiPxMVe.js +1 -0
  152. package/dist/client/index.html +2 -2
  153. package/dist/server/cli.js +2 -2
  154. package/dist/server/server.js +1 -1
  155. package/package.json +1 -1
  156. package/dist/client/assets/ai-providers-B3ZQpsvX.js +0 -1
  157. package/dist/client/assets/index-BHUL0rr0.css +0 -1
  158. package/dist/client/assets/registry-BBs0abCV.js +0 -2
  159. package/dist/client/assets/store-registry-DMKzasMp.js +0 -2
  160. package/dist/client/assets/useInfiniteQuery-DWgeOHBC.js +0 -1
  161. package/dist/client/assets/useSuspenseInfiniteQuery-B1Hn37mg.js +0 -1
  162. package/dist/client/assets/workflow-detail-DUmWuXHM.js +0 -1
  163. package/dist/server/node_modules/ansi-styles/index.d.ts +0 -236
  164. package/dist/server/node_modules/ansi-styles/index.js +0 -223
  165. package/dist/server/node_modules/ansi-styles/license +0 -9
  166. package/dist/server/node_modules/ansi-styles/package.json +0 -54
  167. package/dist/server/node_modules/ansi-styles/readme.md +0 -173
  168. package/dist/server/node_modules/environment/index.d.ts +0 -74
  169. package/dist/server/node_modules/environment/index.js +0 -47
  170. package/dist/server/node_modules/environment/license +0 -9
  171. package/dist/server/node_modules/environment/package.json +0 -74
  172. package/dist/server/node_modules/environment/readme.md +0 -94
  173. package/dist/server/node_modules/escape-string-regexp/index.d.ts +0 -18
  174. package/dist/server/node_modules/escape-string-regexp/index.js +0 -11
  175. package/dist/server/node_modules/escape-string-regexp/license +0 -9
  176. package/dist/server/node_modules/escape-string-regexp/package.json +0 -43
  177. package/dist/server/node_modules/escape-string-regexp/readme.md +0 -29
  178. package/dist/server/node_modules/is-unicode-supported/index.d.ts +0 -12
  179. package/dist/server/node_modules/is-unicode-supported/index.js +0 -21
  180. package/dist/server/node_modules/is-unicode-supported/license +0 -9
  181. package/dist/server/node_modules/is-unicode-supported/package.json +0 -47
  182. package/dist/server/node_modules/is-unicode-supported/readme.md +0 -35
  183. package/dist/server/node_modules/pg-pool/LICENSE +0 -21
  184. package/dist/server/node_modules/pg-pool/README.md +0 -357
  185. package/dist/server/node_modules/pg-pool/esm/index.mjs +0 -5
  186. package/dist/server/node_modules/pg-pool/index.js +0 -517
  187. package/dist/server/node_modules/pg-pool/package.json +0 -51
  188. package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
  189. package/dist/server/node_modules/postgres-array/index.js +0 -97
  190. package/dist/server/node_modules/postgres-array/license +0 -21
  191. package/dist/server/node_modules/postgres-array/package.json +0 -35
  192. package/dist/server/node_modules/postgres-array/readme.md +0 -43
  193. package/dist/server/node_modules/postgres-bytea/index.js +0 -33
  194. package/dist/server/node_modules/postgres-bytea/license +0 -21
  195. package/dist/server/node_modules/postgres-bytea/package.json +0 -34
  196. package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
  197. package/dist/server/node_modules/string-width/index.d.ts +0 -39
  198. package/dist/server/node_modules/string-width/index.js +0 -82
  199. package/dist/server/node_modules/string-width/license +0 -9
  200. package/dist/server/node_modules/string-width/package.json +0 -64
  201. package/dist/server/node_modules/string-width/readme.md +0 -66
  202. package/dist/server/node_modules/xtend/.jshintrc +0 -30
  203. package/dist/server/node_modules/xtend/LICENSE +0 -20
  204. package/dist/server/node_modules/xtend/README.md +0 -32
  205. package/dist/server/node_modules/xtend/immutable.js +0 -19
  206. package/dist/server/node_modules/xtend/mutable.js +0 -17
  207. package/dist/server/node_modules/xtend/package.json +0 -55
  208. package/dist/server/node_modules/xtend/test.js +0 -103
@@ -1 +1 @@
1
- import{e as b,s as k,o as E,bM as P,j as i,a6 as K,aG as _,K as S,z as q}from"./index-Dq226A4w.js";import{P as j}from"./index-DNXvVXJy.js";import{d as z}from"./use-organization-settings-dHr-vwwr.js";import{S as I}from"./switch-D2IuZl3W.js";import{n as Q}from"./Container-BBbTXyMq.js";import{b as R,S as w,a as F,d as M}from"./settings-section-Q55Fgh-8.js";import"./use-mobile-BSlkjiym.js";import"./X-BFKhYElJ.js";import"./constants-BAzsARw1.js";import"./card-9GTnJhWp.js";import"./ArrowUpRight-wUPlLzWo.js";function N(){const e=b.c(17),{org:t,project:s}=k(),o=E();let u;e[0]!==s.enabledPlugins?(u=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=u):u=e[1];const a=u,l=z();let m;e[2]!==t||e[3]!==s.slug||e[4]!==o?(m=()=>{o.invalidateQueries({queryKey:S.project(t.id,s.slug)}),o.invalidateQueries({queryKey:S.projects(t.id)}),o.invalidateQueries({predicate:n=>{const r=n.queryKey;return r[1]===t.id&&r[3]==="collection"&&r[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=o,e[5]=m):m=e[5];const x=m;let g;e[6]!==x||e[7]!==l||e[8]!==a?(g=(n,r)=>{const d=new Set(a);r?d.add(n):d.delete(n),l.mutate({enabled_plugins:Array.from(d)},{onSuccess:x,onError:A})},e[6]=x,e[7]=l,e[8]=a,e[9]=g):g=e[9];const p=g,y=$,C=U;if(P.length===0){let n;return e[10]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=n):n=e[10],n}let c;e[11]!==p||e[12]!==l||e[13]!==a?(c=P.map(n=>{const r=y(n.id),d=C(n.id),h=a.includes(n.id);return i.jsx(R,{title:r?.label??n.id,description:d??void 0,icon:i.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:r?.icon??i.jsx(Q,{size:14})}),onClick:()=>!l.isPending&&p(n.id,!h),action:i.jsx(I,{checked:h,onCheckedChange:v=>p(n.id,v),disabled:l.isPending,onClick:T})},n.id)}),e[11]=p,e[12]=l,e[13]=a,e[14]=c):c=e[14];let f;return e[15]!==c?(f=i.jsx(w,{children:i.jsx(F,{children:c})}),e[15]=c,e[16]=f):f=e[16],f}function T(e){return e.stopPropagation()}function U(e){return P.find(s=>s.id===e)?.description??null}function $(e){const t=K.find(o=>o.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=_.find(o=>o.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function A(e){q.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function D(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(j,{children:i.jsx(j.Content,{children:i.jsx(j.Body,{children:i.jsxs(M,{children:[i.jsx(j.Title,{children:"Plugins"}),i.jsx(N,{})]})})})}),e[0]=t):t=e[0],t}function ee(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(D,{}),e[0]=t):t=e[0],t}export{ee as default};
1
+ import{e as b,s as k,o as E,bM as P,j as i,a6 as K,aG as _,K as S,z as q}from"./index-Bu0xhzLF.js";import{P as j}from"./index-CHcfXh0a.js";import{d as z}from"./use-organization-settings-B98QP_Ve.js";import{S as I}from"./switch-Bp1Tvx2h.js";import{n as Q}from"./Container-CtsNRge8.js";import{b as R,S as w,a as F,d as M}from"./settings-section-nyO0fOgx.js";import"./use-mobile-BACO9YYc.js";import"./X-BJbamPEP.js";import"./constants-Dw_UtizE.js";import"./card-G6flwhwa.js";import"./ArrowUpRight-BBjaHjTK.js";function N(){const e=b.c(17),{org:t,project:s}=k(),o=E();let u;e[0]!==s.enabledPlugins?(u=s.enabledPlugins??[],e[0]=s.enabledPlugins,e[1]=u):u=e[1];const a=u,l=z();let m;e[2]!==t||e[3]!==s.slug||e[4]!==o?(m=()=>{o.invalidateQueries({queryKey:S.project(t.id,s.slug)}),o.invalidateQueries({queryKey:S.projects(t.id)}),o.invalidateQueries({predicate:n=>{const r=n.queryKey;return r[1]===t.id&&r[3]==="collection"&&r[4]==="VIRTUAL_MCP"}})},e[2]=t,e[3]=s.slug,e[4]=o,e[5]=m):m=e[5];const x=m;let g;e[6]!==x||e[7]!==l||e[8]!==a?(g=(n,r)=>{const d=new Set(a);r?d.add(n):d.delete(n),l.mutate({enabled_plugins:Array.from(d)},{onSuccess:x,onError:A})},e[6]=x,e[7]=l,e[8]=a,e[9]=g):g=e[9];const p=g,y=$,C=U;if(P.length===0){let n;return e[10]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),e[10]=n):n=e[10],n}let c;e[11]!==p||e[12]!==l||e[13]!==a?(c=P.map(n=>{const r=y(n.id),d=C(n.id),h=a.includes(n.id);return i.jsx(R,{title:r?.label??n.id,description:d??void 0,icon:i.jsx("span",{className:"text-muted-foreground [&>svg]:size-4",children:r?.icon??i.jsx(Q,{size:14})}),onClick:()=>!l.isPending&&p(n.id,!h),action:i.jsx(I,{checked:h,onCheckedChange:v=>p(n.id,v),disabled:l.isPending,onClick:T})},n.id)}),e[11]=p,e[12]=l,e[13]=a,e[14]=c):c=e[14];let f;return e[15]!==c?(f=i.jsx(w,{children:i.jsx(F,{children:c})}),e[15]=c,e[16]=f):f=e[16],f}function T(e){return e.stopPropagation()}function U(e){return P.find(s=>s.id===e)?.description??null}function $(e){const t=K.find(o=>o.pluginId===e);if(t)return{label:t.label,icon:t.items[0]?.icon};const s=_.find(o=>o.pluginId===e);return s?{label:s.label,icon:s.icon}:null}function A(e){q.error("Failed to update plugin: "+(e instanceof Error?e.message:"Unknown error"))}function D(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(j,{children:i.jsx(j.Content,{children:i.jsx(j.Body,{children:i.jsxs(M,{children:[i.jsx(j.Title,{children:"Plugins"}),i.jsx(N,{})]})})})}),e[0]=t):t=e[0],t}function ee(){const e=b.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=i.jsx(D,{}),e[0]=t):t=e[0],t}export{ee as default};
@@ -1 +1 @@
1
- import{bW as b,e as f,j as c,aB as C,r as d,c as p,aY as j,bX as v,bY as h}from"./index-Dq226A4w.js";import{L as N}from"./label-CgTKL0Kd.js";const E=b,g=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(C,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx(g.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext(g),s=d.useContext($),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},$=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{E as F,M as a,w as b,L as c,P as d,R as e,y as f};
1
+ import{bW as b,e as f,j as c,aB as C,r as d,c as p,aY as j,bX as v,bY as h}from"./index-Bu0xhzLF.js";import{L as N}from"./label-Bv4VMaQH.js";const E=b,g=d.createContext({}),M=t=>{const e=f.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let n;e[4]!==s?(n=c.jsx(C,{...s}),e[4]=s,e[5]=n):n=e[5];let r;return e[6]!==o||e[7]!==n?(r=c.jsx(g.Provider,{value:o,children:n}),e[6]=o,e[7]=n,e[8]=r):r=e[8],r},x=()=>{const t=f.c(13),e=d.useContext(g),s=d.useContext($),{getFieldState:o}=v();let n;t[0]!==e.name?(n={name:e.name},t[0]=e.name,t[1]=n):n=t[1];const r=h(n);let a;t[2]!==e.name||t[3]!==r||t[4]!==o?(a=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=a):a=t[5];const l=a;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,m=`${i}-form-item`,F=`${i}-form-item-description`,I=`${i}-form-item-message`;let u;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==m||t[10]!==F||t[11]!==I?(u={id:i,name:e.name,formItemId:m,formDescriptionId:F,formMessageId:I,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=m,t[10]=F,t[11]=I,t[12]=u):u=t[12],u},$=d.createContext({});function w(t){const e=f.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const n=d.useId();let r;e[3]!==n?(r={id:n},e[3]=n,e[4]=r):r=e[4];let a;e[5]!==s?(a=p("grid gap-2",s),e[5]=s,e[6]=a):a=e[6];let l;e[7]!==o||e[8]!==a?(l=c.jsx("div",{"data-slot":"form-item",className:a,...o}),e[7]=o,e[8]=a,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=c.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formItemId:r}=x(),a=!!n;let l;e[3]!==s?(l=p("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==a||e[8]!==l?(i=c.jsx(N,{"data-slot":"form-label","data-error":a,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=a,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=f.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=x(),l=o?`${r} ${a}`:`${r}`,i=!!o;let m;return e[2]!==n||e[3]!==s||e[4]!==l||e[5]!==i?(m=c.jsx(j,{"data-slot":"form-control",id:n,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=n,e[3]=s,e[4]=l,e[5]=i,e[6]=m):m=e[6],m}function y(t){const e=f.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:n}=x();let r;e[3]!==s?(r=p("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let a;return e[5]!==n||e[6]!==o||e[7]!==r?(a=c.jsx("p",{"data-slot":"form-description",id:n,className:r,...o}),e[5]=n,e[6]=o,e[7]=r,e[8]=a):a=e[8],a}function R(t){const e=f.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:n,formMessageId:r}=x(),a=n?String(n?.message??""):o.children;if(!a)return null;let l;e[3]!==s?(l=p("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==l?(i=c.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:a}),e[5]=a,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{E as F,M as a,w as b,L as c,P as d,R as e,y as f};
@@ -1 +1 @@
1
- import{f as re,s as ce,o as de,r as U,x as me,w as ue,a as fe,t as Y,z as q,K as te,b as ge,j as s,B as H,v as xe,y as Q,e as L,c as pe,aD as he}from"./index-Dq226A4w.js";import{P as V}from"./index-DNXvVXJy.js";import{A as be}from"./avatar-Zzj9UMlL.js";import{I as je}from"./input-sAl4qpu7.js";import{S as X,a as Z,b as W,c as ie,d as ve}from"./settings-section-Q55Fgh-8.js";import{D as Se}from"./domain-settings-DX4izaPT.js";import{u as ye,a as se,D as Ne,c as Ce,S as we,v as _e,K as ze,P as De,d as Pe,C as ke,s as Ae,b as Ie,e as Ee}from"./collection-search-BcpKEq0y.js";import{W as ee,i as Te}from"./constants-BAzsARw1.js";import{u as le}from"./use-virtual-mcp-CTcuyRU_.js";import{b as Oe,P as Re,a as Fe}from"./popover-Cl9Q4B_r.js";import{S as Le}from"./skeleton-DGdg1BKw.js";import{Q as $e}from"./agent-icon-BHvp6mzD.js";import{s as Me}from"./Plus-BX8KY2Vj.js";import{a as ae}from"./Users03-DGkdZmwX.js";import{i as Ke}from"./X-BFKhYElJ.js";import{I as J}from"./integration-icon-AZugc3yw.js";import{u as He,c as Ue}from"./use-organization-settings-dHr-vwwr.js";import"./use-mobile-BSlkjiym.js";import"./User01-JrKdMZpa.js";import"./card-9GTnJhWp.js";import"./ArrowUpRight-wUPlLzWo.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-D2IuZl3W.js";import"./SearchMd-CJm9ITir.js";import"./use-collections-5a3WcFJc.js";import"./AlertCircle-BU25E17i.js";import"./Tool01-Dqe-c7_N.js";import"./XClose-BL1_qV1F.js";import"./RefreshCcw01-DtyDEAf2.js";import"./ArrowNarrowLeft-DsozI7ul.js";import"./XCircle-BCi1SPUb.js";import"./ZapSquare-dR2caQ4h.js";import"./CheckCircle-B6ooPL10.js";import"./ChevronDown-BjunjZ96.js";import"./ChevronRight-DZ8_B5Zy.js";import"./ChevronUp-BcfJms1N.js";import"./DotsVertical-ChXlfNDE.js";import"./Container-BBbTXyMq.js";import"./Star01-DLcvdqts.js";import"./Palette-CL1PeBDG.js";import"./LinkExternal01-Bq6E6IiB.js";import"./Lock01-CT9fVg-M.js";import"./Sun-DwH3UR5R.js";import"./Play-O7Kb3HkD.js";import"./Settings02-0UGyPXgy.js";import"./Shield01-ajX6eCWD.js";import"./Trash01-CO6PRylN.js";import"./Zap-Bsssnre4.js";const qe=xe({name:Q().min(1,"Name is required").max(255,"Name is too long"),slug:Q().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:Q().optional()});function Be(t){const e=L.c(13),{value:a,onChange:i,name:f,disabled:l}=t,n=U.useRef(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=()=>n.current?.click(),e[0]=S):S=e[0];const _=S;let c;e[1]!==i?(c=z=>{const p=z.target.files?.[0];if(!p)return;if(p.size>2097152){q.error("Image must be smaller than 2MB");return}const b=new FileReader;b.onerror=Ge,b.onloadend=()=>{b.result&&i(b.result),n.current&&(n.current.value="")},b.readAsDataURL(p)},e[1]=i,e[2]=c):c=e[2];const g=c;let o;e[3]!==l||e[4]!==g?(o=s.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:g,className:"hidden",disabled:l}),e[3]=l,e[4]=g,e[5]=o):o=e[5];const u=a||void 0,d=f??"?";let m;e[6]!==u||e[7]!==d?(m=s.jsx(be,{url:u,fallback:d,shape:"square",size:"base"}),e[6]=u,e[7]=d,e[8]=m):m=e[8];let x;return e[9]!==l||e[10]!==o||e[11]!==m?(x=s.jsxs("button",{type:"button",onClick:_,disabled:l,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[o,m]}),e[9]=l,e[10]=o,e[11]=m,e[12]=x):x=e[12],x}function Ge(){return q.error("Failed to read image")}function Ve(){const t=re(),{org:e}=ce(),a=de(),[i,f]=U.useState(!1),l=me({resolver:ue(qe),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),n=fe({mutationFn:async o=>{const u={name:o.name,slug:o.slug};o.logo&&(u.logo=o.logo);const d=await ge.organization.update({organizationId:e.id,data:u});if(d?.error)throw new Error(d.error.message||"Failed to update organization");return d},onSuccess:o=>{Y("organization_settings_updated",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields)}),a.invalidateQueries({queryKey:te.organizations()}),a.invalidateQueries({queryKey:te.activeOrganization(e.slug)}),q.success("Organization settings updated successfully"),o?.data?.slug&&o.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:o.data.slug}})},onError:o=>{Y("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields),error:o instanceof Error?o.message:String(o)}),q.error(o instanceof Error?o.message:"Failed to update organization")},onSettled:()=>{f(!1)}}),S=o=>{f(!0),n.mutate(o)},_=l.formState.isDirty,c=l.formState.errors,g=typeof window<"u"?`${window.location.host}/`:"";return s.jsx("form",{onSubmit:l.handleSubmit(S),className:"flex flex-col gap-3",children:s.jsx(X,{children:s.jsxs(Z,{children:[s.jsx(W,{title:"Logo",description:"Recommended size is 256x256px",action:s.jsx(Be,{value:l.watch("logo"),onChange:o=>l.setValue("logo",o??"",{shouldDirty:!0}),name:l.watch("name"),disabled:i})}),s.jsx(W,{title:"Name",action:s.jsx(je,{id:"org-name",...l.register("name"),placeholder:"Organization name",disabled:i,className:"w-[280px]"})}),s.jsx(W,{title:"URL",action:s.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[g&&s.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:g}),s.jsx("input",{id:"org-slug",...l.register("slug"),placeholder:"my-organization",disabled:i,className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:o=>{const u=o.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");l.setValue("slug",u,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}})]})}),(c.name||c.slug||c.logo)&&s.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[c.name&&s.jsx("p",{className:"text-xs text-destructive",children:c.name.message}),c.slug&&s.jsx("p",{className:"text-xs text-destructive",children:c.slug.message}),c.logo&&s.jsx("p",{className:"text-xs text-destructive",children:c.logo.message})]}),_&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>l.reset(),disabled:i,children:"Cancel"}),s.jsx(H,{type:"submit",disabled:i,size:"sm",children:i?"Saving…":"Save"})]})]})})})}const ne=["site-editor","site-diagnostics","ai-image","ai-research"],oe=8;function Qe(t,e,a){const i=e.find(l=>l.id===t);if(i)return{id:i.id,title:i.title,icon:i.icon,kind:"template"};const f=a.find(l=>l.id===t);return f?{id:t,title:f.title,icon:f.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function We(t){const e=L.c(39),{agent:a,onRemove:i}=t;let f;e[0]!==a.id?(f={id:a.id},e[0]=a.id,e[1]=f):f=e[1];const{attributes:l,listeners:n,setNodeRef:S,transform:_,transition:c,isDragging:g}=Pe(f);let o;e[2]!==_?(o=ke.Transform.toString(_),e[2]=_,e[3]=o):o=e[3];const u=g?.5:void 0,d=g?100:void 0;let m;e[4]!==o||e[5]!==u||e[6]!==d||e[7]!==c?(m={transform:o,transition:c,opacity:u,zIndex:d},e[4]=o,e[5]=u,e[6]=d,e[7]=c,e[8]=m):m=e[8];const x=m,z=g&&"shadow-lg";let p;e[9]!==z?(p=pe("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",z),e[9]=z,e[10]=p):p=e[10];const b=`Drag to reorder ${a.title}`;let D;e[11]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx($e,{size:14}),e[11]=D):D=e[11];let A;e[12]!==l||e[13]!==n||e[14]!==b?(A=s.jsx("button",{type:"button",...l,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":b,children:D}),e[12]=l,e[13]=n,e[14]=b,e[15]=A):A=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ae,{size:14}),e[16]=y):y=e[16];let C;e[17]!==a.icon||e[18]!==a.title?(C=s.jsx(J,{icon:a.icon,name:a.title,size:"xs",fallbackIcon:y}),e[17]=a.icon,e[18]=a.title,e[19]=C):C=e[19];let j;e[20]!==a.title?(j=s.jsx("span",{className:"text-sm text-foreground truncate",children:a.title}),e[20]=a.title,e[21]=j):j=e[21];const w=a.kind==="template"?"Template":a.kind==="custom"?"Custom agent":"Unavailable";let h;e[22]!==w?(h=s.jsx("span",{className:"text-xs text-muted-foreground",children:w}),e[22]=w,e[23]=h):h=e[23];let v;e[24]!==j||e[25]!==h?(v=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[j,h]}),e[24]=j,e[25]=h,e[26]=v):v=e[26];const I=`Remove ${a.title}`;let P;e[27]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ke,{size:14}),e[27]=P):P=e[27];let N;e[28]!==i||e[29]!==I?(N=s.jsx("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":I,children:P}),e[28]=i,e[29]=I,e[30]=N):N=e[30];let k;return e[31]!==S||e[32]!==x||e[33]!==A||e[34]!==C||e[35]!==v||e[36]!==N||e[37]!==p?(k=s.jsxs("div",{ref:S,style:x,className:p,children:[A,C,v,N]}),e[31]=S,e[32]=x,e[33]=A,e[34]=C,e[35]=v,e[36]=N,e[37]=p,e[38]=k):k=e[38],k}function Ye(t){const e=L.c(48),{selectedIds:a,onAdd:i}=t,[f,l]=U.useState(!1),[n,S]=U.useState(""),_=le();let c;e[0]!==a?(c=new Set(a),e[0]=a,e[1]=c):c=e[1];const g=c;let o,u,d,m,x,z,p,b,D,A,y,C,j;if(e[2]!==_||e[3]!==i||e[4]!==f||e[5]!==n||e[6]!==g){const P=n.toLowerCase();m=ee.filter(r=>!g.has(r.id)&&(!n||r.title.toLowerCase().includes(P)));let N;e[20]!==g?(N=r=>r.id!==null&&!Te(r.id)&&!g.has(r.id),e[20]=g,e[21]=N):N=e[21],d=_.filter(N).filter(r=>!n||r.title.toLowerCase().includes(P));let k;e[22]!==i?(k=r=>{i(r),l(!1),S("")},e[22]=i,e[23]=k):k=e[23];const T=k;u=Oe,C=f,j=l,e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Re,{asChild:!0,children:s.jsxs(H,{type:"button",variant:"outline",size:"sm",children:[s.jsx(Me,{size:14}),"Add agent"]})}),e[24]=x):x=e[24],o=Fe,D="w-[320px] p-0 overflow-hidden",A="start",e[25]!==n?(y=s.jsx(Ee,{value:n,onChange:S,placeholder:"Search agents..."}),e[25]=n,e[26]=y):y=e[26],z="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",p=m.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),m.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),b=d.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),d.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs",fallbackIcon:s.jsx(ae,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),e[2]=_,e[3]=i,e[4]=f,e[5]=n,e[6]=g,e[7]=o,e[8]=u,e[9]=d,e[10]=m,e[11]=x,e[12]=z,e[13]=p,e[14]=b,e[15]=D,e[16]=A,e[17]=y,e[18]=C,e[19]=j}else o=e[7],u=e[8],d=e[9],m=e[10],x=e[11],z=e[12],p=e[13],b=e[14],D=e[15],A=e[16],y=e[17],C=e[18],j=e[19];let w;e[27]!==d||e[28]!==m.length||e[29]!==n?(w=m.length===0&&d.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=d,e[28]=m.length,e[29]=n,e[30]=w):w=e[30];let h;e[31]!==w||e[32]!==z||e[33]!==p||e[34]!==b?(h=s.jsxs("div",{className:z,children:[p,b,w]}),e[31]=w,e[32]=z,e[33]=p,e[34]=b,e[35]=h):h=e[35];let v;e[36]!==o||e[37]!==h||e[38]!==D||e[39]!==A||e[40]!==y?(v=s.jsxs(o,{className:D,align:A,children:[y,h]}),e[36]=o,e[37]=h,e[38]=D,e[39]=A,e[40]=y,e[41]=v):v=e[41];let I;return e[42]!==u||e[43]!==x||e[44]!==v||e[45]!==C||e[46]!==j?(I=s.jsxs(u,{open:C,onOpenChange:j,children:[x,v]}),e[42]=u,e[43]=x,e[44]=v,e[45]=C,e[46]=j,e[47]=I):I=e[47],I}function Je(){const t=L.c(61),e=He(),a=le(),i=Ue();let f;t[0]!==e?.ids?(f=e?.ids??[...ne],t[0]=e?.ids,t[1]=f):f=t[1];const l=f,[n,S]=U.useState(l);let _;t[2]!==n||t[3]!==l?(_=n.length!==l.length||n.some((E,O)=>E!==l[O]),t[2]=n,t[3]=l,t[4]=_):_=t[4];const c=_;let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:5}},t[5]=g):g=t[5];let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o={coordinateGetter:Ae},t[6]=o):o=t[6];const u=ye(se(De,g),se(ze,o));let d;t[7]!==n?(d=E=>{const{active:O,over:R}=E;if(!R||O.id===R.id)return;const F=n.indexOf(O.id),G=n.indexOf(R.id);F===-1||G===-1||S(Ie([...n],F,G))},t[7]=n,t[8]=d):d=t[8];const m=d;let x;t[9]!==n?(x=E=>{n.includes(E)||S([...n,E])},t[9]=n,t[10]=x):x=t[10];const z=x;let p;t[11]!==n?(p=E=>{S(n.filter(O=>O!==E))},t[11]=n,t[12]=p):p=t[12];const b=p;let D;t[13]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{S([...ne])},t[13]=D):D=t[13];const A=D;let y;t[14]!==n||t[15]!==i?(y=()=>{i.mutate({ids:n},{onSuccess:()=>{Y("default_home_agents_updated",{count:n.length,template_count:n.filter(Ze).length}),q.success("Default home agents updated")},onError:Xe})},t[14]=n,t[15]=i,t[16]=y):y=t[16];const C=y;let j,w,h,v,I,P,N;if(t[17]!==a||t[18]!==n||t[19]!==m||t[20]!==b||t[21]!==u||t[22]!==i.isPending){let E;t[30]!==a?(E=F=>Qe(F,ee,a),t[30]=a,t[31]=E):E=t[31];const O=n.map(E);h=Math.max(0,n.length-oe),w=X,I="Default home agents";let R;t[32]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(he,{size:14}),t[32]=R):R=t[32],t[33]!==i.isPending?(P=s.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:A,disabled:i.isPending,children:[R,"Reset defaults"]}),t[33]=i.isPending,t[34]=P):P=t[34],j=Z,N="px-5 py-5 flex flex-col gap-3",v=O.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ne,{sensors:u,collisionDetection:Ce,onDragEnd:m,children:s.jsx(we,{items:n,strategy:_e,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:O.map((F,G)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[G===oe&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(We,{agent:F,onRemove:()=>b(F.id)})]},F.id))})})}),t[17]=a,t[18]=n,t[19]=m,t[20]=b,t[21]=u,t[22]=i.isPending,t[23]=j,t[24]=w,t[25]=h,t[26]=v,t[27]=I,t[28]=P,t[29]=N}else j=t[23],w=t[24],h=t[25],v=t[26],I=t[27],P=t[28],N=t[29];let k;t[35]!==n||t[36]!==z?(k=s.jsx(Ye,{selectedIds:n,onAdd:z}),t[35]=n,t[36]=z,t[37]=k):k=t[37];let T;t[38]!==h?(T=h>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[h," agent",h===1?"":"s"," won't fit on the home view"]}),t[38]=h,t[39]=T):T=t[39];let r;t[40]!==k||t[41]!==T?(r=s.jsxs("div",{className:"flex items-center justify-between",children:[k,T]}),t[40]=k,t[41]=T,t[42]=r):r=t[42];let $;t[43]!==v||t[44]!==r||t[45]!==N?($=s.jsxs("div",{className:N,children:[v,r]}),t[43]=v,t[44]=r,t[45]=N,t[46]=$):$=t[46];let M;t[47]!==C||t[48]!==l||t[49]!==c||t[50]!==i.isPending?(M=c&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",onClick:()=>S(l),disabled:i.isPending,children:"Cancel"}),s.jsx(H,{type:"button",onClick:C,disabled:i.isPending,children:i.isPending?"Saving…":"Save"})]}),t[47]=C,t[48]=l,t[49]=c,t[50]=i.isPending,t[51]=M):M=t[51];let K;t[52]!==j||t[53]!==$||t[54]!==M?(K=s.jsxs(j,{children:[$,M]}),t[52]=j,t[53]=$,t[54]=M,t[55]=K):K=t[55];let B;return t[56]!==w||t[57]!==I||t[58]!==P||t[59]!==K?(B=s.jsx(w,{title:I,actions:P,children:K}),t[56]=w,t[57]=I,t[58]=P,t[59]=K,t[60]=B):B=t[60],B}function Xe(t){q.error(t instanceof Error?t.message:"Failed to update default home agents")}function Ze(t){return ee.some(e=>e.id===t)}function et(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(X,{title:"Default home agents",children:s.jsx(Z,{children:s.jsx("div",{className:"px-5 py-5 flex flex-col gap-2",children:Array.from({length:4}).map(tt)})})}),t[0]=e):e=t[0],e}function tt(t,e){return s.jsx(Le,{className:"h-12 w-full rounded-lg"},e)}function st(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(U.Suspense,{fallback:s.jsx(et,{}),children:s.jsx(Je,{})}),t[0]=e):e=t[0],e}function nt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(V.Content,{children:s.jsx(V.Body,{children:s.jsxs(ve,{children:[s.jsx(V.Title,{children:"Organization"}),s.jsx(Ve,{}),s.jsx(Se,{}),s.jsx(st,{})]})})})}),t[0]=e):e=t[0],e}function Xt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(nt,{}),t[0]=e):e=t[0],e}export{Xt as default};
1
+ import{f as re,s as ce,o as de,r as U,x as me,w as ue,a as fe,t as Y,z as q,K as te,b as ge,j as s,B as H,v as xe,y as Q,e as L,c as pe,aD as he}from"./index-Bu0xhzLF.js";import{P as V}from"./index-CHcfXh0a.js";import{A as be}from"./avatar-BfSY5CVM.js";import{I as je}from"./input-B5aMagwc.js";import{S as X,a as Z,b as W,c as ie,d as ve}from"./settings-section-nyO0fOgx.js";import{D as Se}from"./domain-settings-NIhMIJvG.js";import{u as ye,a as se,D as Ne,c as Ce,S as we,v as _e,K as ze,P as De,d as Pe,C as ke,s as Ae,b as Ie,e as Ee}from"./collection-search-CsSMb59s.js";import{W as ee,i as Te}from"./constants-Dw_UtizE.js";import{u as le}from"./use-virtual-mcp-CZoeCuBL.js";import{b as Oe,P as Re,a as Fe}from"./popover-CGtNHDEz.js";import{S as Le}from"./skeleton-ClT50YXx.js";import{Q as $e}from"./agent-icon-Db8xI2bq.js";import{s as Me}from"./Plus-kLSd3TZy.js";import{a as ae}from"./Users03-C3QqJn94.js";import{i as Ke}from"./X-BJbamPEP.js";import{I as J}from"./integration-icon-B5mNngh-.js";import{u as He,c as Ue}from"./use-organization-settings-B98QP_Ve.js";import"./use-mobile-BACO9YYc.js";import"./User01-BLHrCCyy.js";import"./card-G6flwhwa.js";import"./ArrowUpRight-BBjaHjTK.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-Bp1Tvx2h.js";import"./SearchMd-BfBE-dHK.js";import"./use-collections-CLt7BhQ3.js";import"./AlertCircle-Cx8oex2u.js";import"./Tool01-CeBylvMu.js";import"./XClose-BRn4UVuG.js";import"./RefreshCcw01-B-L6FvMp.js";import"./ArrowNarrowLeft-DtpIYMrr.js";import"./XCircle-DP5EGLqX.js";import"./ZapSquare-B3o6QvJe.js";import"./CheckCircle-Mywkb82K.js";import"./ChevronDown-BE0rQ4ho.js";import"./ChevronRight-BVJ2HUMt.js";import"./ChevronUp-B2y_5HwX.js";import"./DotsVertical-BQnGY6Nc.js";import"./Container-CtsNRge8.js";import"./Star01-MuiWZ8GS.js";import"./Palette-2CChK5yr.js";import"./LinkExternal01-SieYyhiZ.js";import"./Lock01-BrFrkt3t.js";import"./Sun-CTLobT4y.js";import"./Play-BfzIvHVC.js";import"./Settings02-EP4I50bB.js";import"./Shield01-D19-LRUf.js";import"./Trash01-BLGcALKg.js";import"./Zap-kZUu0No-.js";const qe=xe({name:Q().min(1,"Name is required").max(255,"Name is too long"),slug:Q().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:Q().optional()});function Be(t){const e=L.c(13),{value:a,onChange:i,name:f,disabled:l}=t,n=U.useRef(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=()=>n.current?.click(),e[0]=S):S=e[0];const _=S;let c;e[1]!==i?(c=z=>{const p=z.target.files?.[0];if(!p)return;if(p.size>2097152){q.error("Image must be smaller than 2MB");return}const b=new FileReader;b.onerror=Ge,b.onloadend=()=>{b.result&&i(b.result),n.current&&(n.current.value="")},b.readAsDataURL(p)},e[1]=i,e[2]=c):c=e[2];const g=c;let o;e[3]!==l||e[4]!==g?(o=s.jsx("input",{ref:n,type:"file",accept:"image/*",onChange:g,className:"hidden",disabled:l}),e[3]=l,e[4]=g,e[5]=o):o=e[5];const u=a||void 0,d=f??"?";let m;e[6]!==u||e[7]!==d?(m=s.jsx(be,{url:u,fallback:d,shape:"square",size:"base"}),e[6]=u,e[7]=d,e[8]=m):m=e[8];let x;return e[9]!==l||e[10]!==o||e[11]!==m?(x=s.jsxs("button",{type:"button",onClick:_,disabled:l,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[o,m]}),e[9]=l,e[10]=o,e[11]=m,e[12]=x):x=e[12],x}function Ge(){return q.error("Failed to read image")}function Ve(){const t=re(),{org:e}=ce(),a=de(),[i,f]=U.useState(!1),l=me({resolver:ue(qe),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),n=fe({mutationFn:async o=>{const u={name:o.name,slug:o.slug};o.logo&&(u.logo=o.logo);const d=await ge.organization.update({organizationId:e.id,data:u});if(d?.error)throw new Error(d.error.message||"Failed to update organization");return d},onSuccess:o=>{Y("organization_settings_updated",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields)}),a.invalidateQueries({queryKey:te.organizations()}),a.invalidateQueries({queryKey:te.activeOrganization(e.slug)}),q.success("Organization settings updated successfully"),o?.data?.slug&&o.data.slug!==e.slug&&t({to:"/$org/settings/general",params:{org:o.data.slug}})},onError:o=>{Y("organization_settings_update_failed",{organization_id:e.id,fields:Object.keys(l.formState.dirtyFields),error:o instanceof Error?o.message:String(o)}),q.error(o instanceof Error?o.message:"Failed to update organization")},onSettled:()=>{f(!1)}}),S=o=>{f(!0),n.mutate(o)},_=l.formState.isDirty,c=l.formState.errors,g=typeof window<"u"?`${window.location.host}/`:"";return s.jsx("form",{onSubmit:l.handleSubmit(S),className:"flex flex-col gap-3",children:s.jsx(X,{children:s.jsxs(Z,{children:[s.jsx(W,{title:"Logo",description:"Recommended size is 256x256px",action:s.jsx(Be,{value:l.watch("logo"),onChange:o=>l.setValue("logo",o??"",{shouldDirty:!0}),name:l.watch("name"),disabled:i})}),s.jsx(W,{title:"Name",action:s.jsx(je,{id:"org-name",...l.register("name"),placeholder:"Organization name",disabled:i,className:"w-[280px]"})}),s.jsx(W,{title:"URL",action:s.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[g&&s.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:g}),s.jsx("input",{id:"org-slug",...l.register("slug"),placeholder:"my-organization",disabled:i,className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:o=>{const u=o.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");l.setValue("slug",u,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}})]})}),(c.name||c.slug||c.logo)&&s.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[c.name&&s.jsx("p",{className:"text-xs text-destructive",children:c.name.message}),c.slug&&s.jsx("p",{className:"text-xs text-destructive",children:c.slug.message}),c.logo&&s.jsx("p",{className:"text-xs text-destructive",children:c.logo.message})]}),_&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",size:"sm",onClick:()=>l.reset(),disabled:i,children:"Cancel"}),s.jsx(H,{type:"submit",disabled:i,size:"sm",children:i?"Saving…":"Save"})]})]})})})}const ne=["site-editor","site-diagnostics","ai-image","ai-research"],oe=8;function Qe(t,e,a){const i=e.find(l=>l.id===t);if(i)return{id:i.id,title:i.title,icon:i.icon,kind:"template"};const f=a.find(l=>l.id===t);return f?{id:t,title:f.title,icon:f.icon??null,kind:"custom"}:{id:t,title:t,icon:null,kind:"missing"}}function We(t){const e=L.c(39),{agent:a,onRemove:i}=t;let f;e[0]!==a.id?(f={id:a.id},e[0]=a.id,e[1]=f):f=e[1];const{attributes:l,listeners:n,setNodeRef:S,transform:_,transition:c,isDragging:g}=Pe(f);let o;e[2]!==_?(o=ke.Transform.toString(_),e[2]=_,e[3]=o):o=e[3];const u=g?.5:void 0,d=g?100:void 0;let m;e[4]!==o||e[5]!==u||e[6]!==d||e[7]!==c?(m={transform:o,transition:c,opacity:u,zIndex:d},e[4]=o,e[5]=u,e[6]=d,e[7]=c,e[8]=m):m=e[8];const x=m,z=g&&"shadow-lg";let p;e[9]!==z?(p=pe("flex items-center gap-3 px-3 py-2 rounded-lg border border-border bg-background",z),e[9]=z,e[10]=p):p=e[10];const b=`Drag to reorder ${a.title}`;let D;e[11]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx($e,{size:14}),e[11]=D):D=e[11];let A;e[12]!==l||e[13]!==n||e[14]!==b?(A=s.jsx("button",{type:"button",...l,...n,className:"text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing","aria-label":b,children:D}),e[12]=l,e[13]=n,e[14]=b,e[15]=A):A=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ae,{size:14}),e[16]=y):y=e[16];let C;e[17]!==a.icon||e[18]!==a.title?(C=s.jsx(J,{icon:a.icon,name:a.title,size:"xs",fallbackIcon:y}),e[17]=a.icon,e[18]=a.title,e[19]=C):C=e[19];let j;e[20]!==a.title?(j=s.jsx("span",{className:"text-sm text-foreground truncate",children:a.title}),e[20]=a.title,e[21]=j):j=e[21];const w=a.kind==="template"?"Template":a.kind==="custom"?"Custom agent":"Unavailable";let h;e[22]!==w?(h=s.jsx("span",{className:"text-xs text-muted-foreground",children:w}),e[22]=w,e[23]=h):h=e[23];let v;e[24]!==j||e[25]!==h?(v=s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[j,h]}),e[24]=j,e[25]=h,e[26]=v):v=e[26];const I=`Remove ${a.title}`;let P;e[27]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ke,{size:14}),e[27]=P):P=e[27];let N;e[28]!==i||e[29]!==I?(N=s.jsx("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground p-1 rounded","aria-label":I,children:P}),e[28]=i,e[29]=I,e[30]=N):N=e[30];let k;return e[31]!==S||e[32]!==x||e[33]!==A||e[34]!==C||e[35]!==v||e[36]!==N||e[37]!==p?(k=s.jsxs("div",{ref:S,style:x,className:p,children:[A,C,v,N]}),e[31]=S,e[32]=x,e[33]=A,e[34]=C,e[35]=v,e[36]=N,e[37]=p,e[38]=k):k=e[38],k}function Ye(t){const e=L.c(48),{selectedIds:a,onAdd:i}=t,[f,l]=U.useState(!1),[n,S]=U.useState(""),_=le();let c;e[0]!==a?(c=new Set(a),e[0]=a,e[1]=c):c=e[1];const g=c;let o,u,d,m,x,z,p,b,D,A,y,C,j;if(e[2]!==_||e[3]!==i||e[4]!==f||e[5]!==n||e[6]!==g){const P=n.toLowerCase();m=ee.filter(r=>!g.has(r.id)&&(!n||r.title.toLowerCase().includes(P)));let N;e[20]!==g?(N=r=>r.id!==null&&!Te(r.id)&&!g.has(r.id),e[20]=g,e[21]=N):N=e[21],d=_.filter(N).filter(r=>!n||r.title.toLowerCase().includes(P));let k;e[22]!==i?(k=r=>{i(r),l(!1),S("")},e[22]=i,e[23]=k):k=e[23];const T=k;u=Oe,C=f,j=l,e[24]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Re,{asChild:!0,children:s.jsxs(H,{type:"button",variant:"outline",size:"sm",children:[s.jsx(Me,{size:14}),"Add agent"]})}),e[24]=x):x=e[24],o=Fe,D="w-[320px] p-0 overflow-hidden",A="start",e[25]!==n?(y=s.jsx(Ee,{value:n,onChange:S,placeholder:"Search agents..."}),e[25]=n,e[26]=y):y=e[26],z="max-h-[320px] overflow-y-auto p-2 flex flex-col gap-3",p=m.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Templates"}),m.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs"}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),b=d.length>0&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground px-1",children:"Custom agents"}),d.map(r=>s.jsxs("button",{type:"button",onClick:()=>T(r.id),className:"flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent text-left",children:[s.jsx(J,{icon:r.icon,name:r.title,size:"xs",fallbackIcon:s.jsx(ae,{size:14})}),s.jsx("span",{className:"text-sm truncate",children:r.title})]},r.id))]}),e[2]=_,e[3]=i,e[4]=f,e[5]=n,e[6]=g,e[7]=o,e[8]=u,e[9]=d,e[10]=m,e[11]=x,e[12]=z,e[13]=p,e[14]=b,e[15]=D,e[16]=A,e[17]=y,e[18]=C,e[19]=j}else o=e[7],u=e[8],d=e[9],m=e[10],x=e[11],z=e[12],p=e[13],b=e[14],D=e[15],A=e[16],y=e[17],C=e[18],j=e[19];let w;e[27]!==d||e[28]!==m.length||e[29]!==n?(w=m.length===0&&d.length===0&&s.jsx("div",{className:"text-xs text-muted-foreground text-center py-6",children:n?"No agents found":"All agents are already added"}),e[27]=d,e[28]=m.length,e[29]=n,e[30]=w):w=e[30];let h;e[31]!==w||e[32]!==z||e[33]!==p||e[34]!==b?(h=s.jsxs("div",{className:z,children:[p,b,w]}),e[31]=w,e[32]=z,e[33]=p,e[34]=b,e[35]=h):h=e[35];let v;e[36]!==o||e[37]!==h||e[38]!==D||e[39]!==A||e[40]!==y?(v=s.jsxs(o,{className:D,align:A,children:[y,h]}),e[36]=o,e[37]=h,e[38]=D,e[39]=A,e[40]=y,e[41]=v):v=e[41];let I;return e[42]!==u||e[43]!==x||e[44]!==v||e[45]!==C||e[46]!==j?(I=s.jsxs(u,{open:C,onOpenChange:j,children:[x,v]}),e[42]=u,e[43]=x,e[44]=v,e[45]=C,e[46]=j,e[47]=I):I=e[47],I}function Je(){const t=L.c(61),e=He(),a=le(),i=Ue();let f;t[0]!==e?.ids?(f=e?.ids??[...ne],t[0]=e?.ids,t[1]=f):f=t[1];const l=f,[n,S]=U.useState(l);let _;t[2]!==n||t[3]!==l?(_=n.length!==l.length||n.some((E,O)=>E!==l[O]),t[2]=n,t[3]=l,t[4]=_):_=t[4];const c=_;let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g={activationConstraint:{distance:5}},t[5]=g):g=t[5];let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o={coordinateGetter:Ae},t[6]=o):o=t[6];const u=ye(se(De,g),se(ze,o));let d;t[7]!==n?(d=E=>{const{active:O,over:R}=E;if(!R||O.id===R.id)return;const F=n.indexOf(O.id),G=n.indexOf(R.id);F===-1||G===-1||S(Ie([...n],F,G))},t[7]=n,t[8]=d):d=t[8];const m=d;let x;t[9]!==n?(x=E=>{n.includes(E)||S([...n,E])},t[9]=n,t[10]=x):x=t[10];const z=x;let p;t[11]!==n?(p=E=>{S(n.filter(O=>O!==E))},t[11]=n,t[12]=p):p=t[12];const b=p;let D;t[13]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{S([...ne])},t[13]=D):D=t[13];const A=D;let y;t[14]!==n||t[15]!==i?(y=()=>{i.mutate({ids:n},{onSuccess:()=>{Y("default_home_agents_updated",{count:n.length,template_count:n.filter(Ze).length}),q.success("Default home agents updated")},onError:Xe})},t[14]=n,t[15]=i,t[16]=y):y=t[16];const C=y;let j,w,h,v,I,P,N;if(t[17]!==a||t[18]!==n||t[19]!==m||t[20]!==b||t[21]!==u||t[22]!==i.isPending){let E;t[30]!==a?(E=F=>Qe(F,ee,a),t[30]=a,t[31]=E):E=t[31];const O=n.map(E);h=Math.max(0,n.length-oe),w=X,I="Default home agents";let R;t[32]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(he,{size:14}),t[32]=R):R=t[32],t[33]!==i.isPending?(P=s.jsxs(H,{type:"button",variant:"ghost",size:"sm",onClick:A,disabled:i.isPending,children:[R,"Reset defaults"]}),t[33]=i.isPending,t[34]=P):P=t[34],j=Z,N="px-5 py-5 flex flex-col gap-3",v=O.length===0?s.jsx("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-xs text-muted-foreground",children:'No agents selected. The home view will only show "Create agent".'}):s.jsx(Ne,{sensors:u,collisionDetection:Ce,onDragEnd:m,children:s.jsx(we,{items:n,strategy:_e,children:s.jsx("div",{className:"flex flex-col gap-1.5",children:O.map((F,G)=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[G===oe&&s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex-1 h-px bg-border"}),s.jsx("span",{children:"Below this line is hidden on the home view"}),s.jsx("div",{className:"flex-1 h-px bg-border"})]}),s.jsx(We,{agent:F,onRemove:()=>b(F.id)})]},F.id))})})}),t[17]=a,t[18]=n,t[19]=m,t[20]=b,t[21]=u,t[22]=i.isPending,t[23]=j,t[24]=w,t[25]=h,t[26]=v,t[27]=I,t[28]=P,t[29]=N}else j=t[23],w=t[24],h=t[25],v=t[26],I=t[27],P=t[28],N=t[29];let k;t[35]!==n||t[36]!==z?(k=s.jsx(Ye,{selectedIds:n,onAdd:z}),t[35]=n,t[36]=z,t[37]=k):k=t[37];let T;t[38]!==h?(T=h>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[h," agent",h===1?"":"s"," won't fit on the home view"]}),t[38]=h,t[39]=T):T=t[39];let r;t[40]!==k||t[41]!==T?(r=s.jsxs("div",{className:"flex items-center justify-between",children:[k,T]}),t[40]=k,t[41]=T,t[42]=r):r=t[42];let $;t[43]!==v||t[44]!==r||t[45]!==N?($=s.jsxs("div",{className:N,children:[v,r]}),t[43]=v,t[44]=r,t[45]=N,t[46]=$):$=t[46];let M;t[47]!==C||t[48]!==l||t[49]!==c||t[50]!==i.isPending?(M=c&&s.jsxs(ie,{children:[s.jsx(H,{type:"button",variant:"outline",onClick:()=>S(l),disabled:i.isPending,children:"Cancel"}),s.jsx(H,{type:"button",onClick:C,disabled:i.isPending,children:i.isPending?"Saving…":"Save"})]}),t[47]=C,t[48]=l,t[49]=c,t[50]=i.isPending,t[51]=M):M=t[51];let K;t[52]!==j||t[53]!==$||t[54]!==M?(K=s.jsxs(j,{children:[$,M]}),t[52]=j,t[53]=$,t[54]=M,t[55]=K):K=t[55];let B;return t[56]!==w||t[57]!==I||t[58]!==P||t[59]!==K?(B=s.jsx(w,{title:I,actions:P,children:K}),t[56]=w,t[57]=I,t[58]=P,t[59]=K,t[60]=B):B=t[60],B}function Xe(t){q.error(t instanceof Error?t.message:"Failed to update default home agents")}function Ze(t){return ee.some(e=>e.id===t)}function et(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(X,{title:"Default home agents",children:s.jsx(Z,{children:s.jsx("div",{className:"px-5 py-5 flex flex-col gap-2",children:Array.from({length:4}).map(tt)})})}),t[0]=e):e=t[0],e}function tt(t,e){return s.jsx(Le,{className:"h-12 w-full rounded-lg"},e)}function st(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(U.Suspense,{fallback:s.jsx(et,{}),children:s.jsx(Je,{})}),t[0]=e):e=t[0],e}function nt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(V,{children:s.jsx(V.Content,{children:s.jsx(V.Body,{children:s.jsxs(ve,{children:[s.jsx(V.Title,{children:"Organization"}),s.jsx(Ve,{}),s.jsx(Se,{}),s.jsx(st,{})]})})})}),t[0]=e):e=t[0],e}function Xt(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(nt,{}),t[0]=e):e=t[0],e}export{Xt as default};
@@ -1,4 +1,4 @@
1
- import{e as M,s as z,o as ve,b as ze,r as O,K as ne,n as Fe,a as He,j as t,c as he,B as oe,t as V,z as ie,f as We,a0 as Je,a1 as Xe,az as je,C as Ze,l as xe,V as et}from"./index-Dq226A4w.js";import{S as re,u as $,d as we,W as Be,j as ye}from"./constants-BAzsARw1.js";import{u as Ne}from"./use-navigate-to-agent-yRpKyeIE.js";import{c as ce,d as le,a as de,D as ue,b as tt}from"./dialog-C2cBQ0ty.js";import{i as Ae}from"./RefreshCcw01-DtyDEAf2.js";import{C as qe}from"./collection-search-BoQ_EppH.js";import{c as Ee,b as Se,D as Oe,a as Le}from"./drawer-B_-bDnjD.js";import{u as Re}from"./use-mobile-BSlkjiym.js";import{I as Me}from"./integration-icon-AZugc3yw.js";import{a as ke,u as nt}from"./use-connection-dg_H_Pr1.js";import{u as st,d as Qe}from"./use-mcp-tools-DigN6mZj.js";import{b as Ue,u as it}from"./use-virtual-mcp-CTcuyRU_.js";import{C as ot}from"./checkbox-duvwt99y.js";import{i as at}from"./Lock01-CT9fVg-M.js";import{F as rt}from"./agent-icon-BHvp6mzD.js";import{e as ct}from"./extract-connection-data-DAdB5U1f.js";function lt(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function dt(){const i=await fetch("/api/deco-sites");if(!i.ok){const e=await i.json().catch(()=>({}));throw new Error(e.error??`Failed to load sites (${i.status})`)}return i.json()}function Kt(i){const e=M.c(65),{open:n,onOpenChange:a,onBack:c}=i,{org:s}=z(),l=Ne(),m=ve(),{data:f}=ze.useSession(),[x,h]=O.useState(null),[T,d]=O.useState("");let u;e[0]!==s.id?(u={connectionId:re,orgId:s.id},e[0]=s.id,e[1]=u):u=e[1];const p=$(u);let r;e[2]!==f?.user?.email?(r=ne.decoSites(f?.user?.email),e[2]=f?.user?.email,e[3]=r):r=e[3];const g=n&&!!f?.user?.email;let C;e[4]!==r||e[5]!==g?(C={queryKey:r,queryFn:dt,enabled:g,staleTime:6e4,retry:!1},e[4]=r,e[5]=g,e[6]=C):C=e[6];const{data:_,isLoading:N,error:b}=Fe(C),I=_?.sites??[];let o;e[7]!==a?(o=w=>{w||(h(null),d("")),a(w)},e[7]=a,e[8]=o):o=e[8];const y=o;let A;e[9]!==T?(A=w=>w.name.toLowerCase().includes(T.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(T.toLowerCase()),e[9]=T,e[10]=A):A=e[10];const v=I.filter(A),E=!x||v.some(w=>w.name===x);let j;e[11]!==p||e[12]!==s.id?(j=async w=>{V("deco_site_import_started",{site_name:w});const G=await fetch("/api/deco-sites/connection",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:s.id})}),D=await G.json().catch(ft);if(!G.ok)throw new Error(D.error??`Failed to create connection (${G.status})`);const L=D.connId;if(!L)throw new Error("Server did not return a connection ID");const ge=D.icon??null,te=lt(w),Pe=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:ge??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:ge,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:L,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:L,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:L,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:L,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:L,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:L,toolName:"file_explorer"}}}},connections:[{connection_id:L}]}}}),Ge=Pe.structuredContent??Pe;return{slug:te,virtualMcpId:Ge.item.id,connId:L,item:Ge.item}},e[11]=p,e[12]=s.id,e[13]=j):j=e[13];let S;e[14]!==p||e[15]!==y||e[16]!==l||e[17]!==s.id||e[18]!==m?(S=w=>{const{slug:G,virtualMcpId:D,item:L}=w;V("deco_site_import_succeeded",{site_name:L.title,virtual_mcp_id:D,slug:G}),m.setQueryData(ne.collectionItem(p,s.id,"","VIRTUAL_MCP",D),{item:L}),m.invalidateQueries({predicate:ge=>{const te=ge.queryKey;return te[1]===s.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),m.invalidateQueries({queryKey:ne.projects(s.id)}),ie.success(`Imported ${G} from deco.cx`),y(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(D)},e[14]=p,e[15]=y,e[16]=l,e[17]=s.id,e[18]=m,e[19]=S):S=e[19];let k;e[20]!==j||e[21]!==S?(k={mutationFn:j,onSuccess:S,onError:mt},e[20]=j,e[21]=S,e[22]=k):k=e[22];const U=He(k),F=le,se=ce,R="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let P;e[23]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(de,{className:"sr-only",children:t.jsx(ue,{children:"Import from deco.cx"})}),e[23]=P):P=e[23];let H;e[24]!==c?(H=c&&t.jsx("button",{type:"button",onClick:c,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[24]=c,e[25]=H):H=e[25];let me;e[26]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[26]=me):me=e[26];let B;e[27]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,me]}),e[27]=H,e[28]=B):B=e[28];let fe;e[29]===Symbol.for("react.memo_cache_sentinel")?(fe=w=>{w.key==="Escape"&&d("")},e[29]=fe):fe=e[29];let q;e[30]!==T?(q=t.jsx("div",{children:t.jsx(qe,{value:T,onChange:d,placeholder:"Search sites...",onKeyDown:fe})}),e[30]=T,e[31]=q):q=e[31];const Ke="pb-0 min-h-[300px]";let Q;e[32]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[32]=N,e[33]=Q):Q=e[33];const _e=!N&&!b&&I.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ce=!N&&I.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",T,"”"]}),v.map(w=>{const G=w.domains?.find(ut)?.domain??w.domains?.[0]?.domain,D=x===w.name;return t.jsxs("button",{type:"button",onClick:()=>h(w.name),className:he("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",D?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),G&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:G})]})]},w.name)})]});let Y;e[34]!==Q||e[35]!==_e||e[36]!==Ce?(Y=t.jsxs("div",{className:Ke,children:[Q,_e,Ce]}),e[34]=Q,e[35]=_e,e[36]=Ce,e[37]=Y):Y=e[37];let K;e[38]!==y?(K=()=>y(!1),e[38]=y,e[39]=K):K=e[39];let W;e[40]!==U.isPending||e[41]!==K?(W=t.jsx(oe,{variant:"outline",onClick:K,disabled:U.isPending,children:"Cancel"}),e[40]=U.isPending,e[41]=K,e[42]=W):W=e[42];const Ie=!x||!E||U.isPending||N;let J;e[43]!==U||e[44]!==x?(J=()=>x&&U.mutate(x),e[43]=U,e[44]=x,e[45]=J):J=e[45];const Te=U.isPending?"Importing...":"Import";let X;e[46]!==Ie||e[47]!==J||e[48]!==Te?(X=t.jsx(oe,{disabled:Ie,onClick:J,children:Te}),e[46]=Ie,e[47]=J,e[48]=Te,e[49]=X):X=e[49];let Z;e[50]!==W||e[51]!==X?(Z=t.jsxs(tt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[50]=W,e[51]=X,e[52]=Z):Z=e[52];let ee;e[53]!==se||e[54]!==P||e[55]!==B||e[56]!==q||e[57]!==Y||e[58]!==Z?(ee=t.jsxs(se,{className:R,children:[P,B,q,Y,Z]}),e[53]=se,e[54]=P,e[55]=B,e[56]=q,e[57]=Y,e[58]=Z,e[59]=ee):ee=e[59];let pe;return e[60]!==F||e[61]!==y||e[62]!==n||e[63]!==ee?(pe=t.jsx(F,{open:n,onOpenChange:y,children:ee}),e[60]=F,e[61]=y,e[62]=n,e[63]=ee,e[64]=pe):pe=e[64],pe}function ut(i){return i.production}function mt(i){V("deco_site_import_failed",{error:i instanceof Error?i.message:"Unknown error"}),ie.error("Import failed: "+(i instanceof Error?i.message:"Unknown error"))}function ft(){return{}}function Ye(i,e){const n=M.c(11),{org:a}=z();let c;n[0]!==a.id?(c=we.REGISTRY(a.id),n[0]=a.id,n[1]=c):c=n[1];const s=c;let l;n[2]!==a.id||n[3]!==s?(l={connectionId:s,orgId:a.id},n[2]=a.id,n[3]=s,n[4]=l):l=n[4];const m=$(l);let f;n[5]!==i?(f={name:i},n[5]=i,n[6]=f):f=n[6];const x=e?.enabled??!0;let h;return n[7]!==m||n[8]!==f||n[9]!==x?(h={client:m,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:f,enabled:x,staleTime:3e5,select:pt},n[7]=m,n[8]=f,n[9]=x,n[10]=h):h=n[10],st(h)}function pt(i){return i.structuredContent?.item??null}const gt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function De(i){const e=M.c(7),{onRecruit:n,isRecruiting:a,isLoading:c}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=s):s=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"space-y-2",children:[l,t.jsx("ul",{className:"space-y-1.5",children:gt.map(ht)})]}),e[2]=m):m=e[2];const f=a||c,x=a?"Setting up...":"Add Site Diagnostics";let h;return e[3]!==n||e[4]!==f||e[5]!==x?(h=t.jsxs("div",{className:"flex flex-col gap-6",children:[s,m,t.jsx(oe,{onClick:n,disabled:f,className:"w-full cursor-pointer",children:x})]}),e[3]=n,e[4]=f,e[5]=x,e[6]=h):h=e[6],h}function ht(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Wt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(I=>I.id==="site-diagnostics"),{data:u,isLoading:p}=Ye(d.appId,{enabled:i}),r=u?.title||u?.server?.title||u?.server?.name||d.title,g=u?.server?.icons?.[0]?.src??d.icon,C=u?.server?.description??null,_=t.jsx(Me,{icon:g,name:r,size:"sm"}),N=async()=>{if(u){if(n){e(!1),s(n.id);return}T(!0);try{const I=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:d.appId},limit:1,offset:0}});let o;const A=I?.structuredContent?.items?.find(E=>E.app_id===d.appId);if(A)o=A.id;else{const E=u.server?.remotes?.[0]?.url;if(!E)throw new Error("Registry item is missing a remote URL for site-diagnostics");o=(await l.create.mutateAsync({title:r,description:C,icon:u.server?.icons?.[0]?.src??d.icon,connection_type:"HTTP",connection_url:E,app_name:u.server?.name??"site-diagnostics",app_id:d.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:d.appId,verified:!0}})).id}const v=await m.create.mutateAsync({title:r,description:C,icon:g,status:"active",connections:[{connection_id:o,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:o,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:o,toolName:"diagnose"}}}}});V("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:v.id}),e(!1),s(v.id)}catch(I){V("agent_recruit_failed",{template_id:"site-diagnostics",error:I instanceof Error?I.message:String(I)}),console.error("Failed to create Site Diagnostics agent:",I)}finally{T(!1)}}},b=`Add ${r}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(Le,{className:"text-xl font-semibold",children:b})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(ue,{className:"text-xl font-semibold",children:b})]})}),t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})]})})}const xt="https://sites-lean-canva.decocache.com/api/mcp",Nt=["Build and update Lean Canvas business models visually","Interactive grid UI with all 9 canvas sections","Iterative updates — add information as you discover it","Covers: Problem, Solution, Key Metrics, Unique Value Proposition","Covers: Channels, Customer Segments, Cost Structure, Revenue Streams","Unfair Advantage analysis"];function Ve(i){const e=M.c(7),{onRecruit:n,isRecruiting:a}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Lean Canvas agent that helps you build and iterate on your business model. Describe your idea and it produces a visual, structured canvas."}),e[0]=c):c=e[0];let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=s):s=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"space-y-2",children:[s,t.jsx("ul",{className:"space-y-1.5",children:Nt.map(_t)})]}),e[2]=l):l=e[2];const m=a?"Setting up...":"Add Lean Canvas";let f;return e[3]!==a||e[4]!==n||e[5]!==m?(f=t.jsxs("div",{className:"flex flex-col gap-6",children:[c,l,t.jsx(oe,{onClick:n,disabled:a,className:"w-full cursor-pointer",children:m})]}),e[3]=a,e[4]=n,e[5]=m,e[6]=f):f=e[6],f}function _t(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Jt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(g=>g.id==="lean-canvas"),u=t.jsx(Me,{icon:d.icon,name:d.title,size:"sm"}),p=async()=>{if(n){e(!1),s(n.id);return}T(!0);try{const g=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:"lean-canvas"},limit:1,offset:0}});let C;const N=g?.structuredContent?.items?.find(o=>o.app_id==="lean-canvas"),b=we.SELF(c.id);N?C=N.id:C=(await l.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,connection_type:"HTTP",connection_url:xt,app_name:"lean-canvas",app_id:"lean-canvas",configuration_state:{OBJECT_STORAGE:{__type:"@deco/object-storage",value:b}},metadata:{type:"lean-canvas",source:"store",verified:!0}})).id;const I=await m.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,status:"active",connections:[{connection_id:C,selected_tools:null,selected_resources:null,selected_prompts:null},{connection_id:b,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"lean-canvas",instructions:null,ui:{pinnedViews:[{connectionId:C,toolName:"lean_canvas",label:"lean_canvas",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:C,toolName:"lean_canvas"}}}}});V("agent_recruit_confirmed",{template_id:"lean-canvas",agent_id:I.id}),e(!1),s(I.id)}catch(g){V("agent_recruit_failed",{template_id:"lean-canvas",error:g instanceof Error?g.message:String(g)}),console.error("Failed to create Lean Canvas agent:",g)}finally{T(!1)}},r=`Add ${d.title}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(Le,{className:"text-xl font-semibold",children:r})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(Ve,{onRecruit:p,isRecruiting:h})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(ue,{className:"text-xl font-semibold",children:r})]})}),t.jsx(Ve,{onRecruit:p,isRecruiting:h})]})})}const Ct=`<role>
1
+ import{e as M,s as z,o as ve,b as ze,r as O,K as ne,n as Fe,a as He,j as t,c as he,B as oe,t as V,z as ie,f as We,a0 as Je,a1 as Xe,az as je,C as Ze,l as xe,V as et}from"./index-Bu0xhzLF.js";import{S as re,u as $,d as we,W as Be,j as ye}from"./constants-Dw_UtizE.js";import{u as Ne}from"./use-navigate-to-agent-DbPOuTIs.js";import{c as ce,d as le,a as de,D as ue,b as tt}from"./dialog-DjZXbytL.js";import{i as Ae}from"./RefreshCcw01-B-L6FvMp.js";import{C as qe}from"./collection-search-DoXoIAYq.js";import{c as Ee,b as Se,D as Oe,a as Le}from"./drawer-BFBl_9mB.js";import{u as Re}from"./use-mobile-BACO9YYc.js";import{I as Me}from"./integration-icon-B5mNngh-.js";import{a as ke,u as nt}from"./use-connection-BCV5VAjQ.js";import{u as st,d as Qe}from"./use-mcp-tools-yi4edHzR.js";import{b as Ue,u as it}from"./use-virtual-mcp-CZoeCuBL.js";import{C as ot}from"./checkbox-LBmczTXJ.js";import{i as at}from"./Lock01-BrFrkt3t.js";import{F as rt}from"./agent-icon-Db8xI2bq.js";import{e as ct}from"./extract-connection-data-DiYA0QYt.js";function lt(i){return i.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}async function dt(){const i=await fetch("/api/deco-sites");if(!i.ok){const e=await i.json().catch(()=>({}));throw new Error(e.error??`Failed to load sites (${i.status})`)}return i.json()}function Kt(i){const e=M.c(65),{open:n,onOpenChange:a,onBack:c}=i,{org:s}=z(),l=Ne(),m=ve(),{data:f}=ze.useSession(),[x,h]=O.useState(null),[T,d]=O.useState("");let u;e[0]!==s.id?(u={connectionId:re,orgId:s.id},e[0]=s.id,e[1]=u):u=e[1];const p=$(u);let r;e[2]!==f?.user?.email?(r=ne.decoSites(f?.user?.email),e[2]=f?.user?.email,e[3]=r):r=e[3];const g=n&&!!f?.user?.email;let C;e[4]!==r||e[5]!==g?(C={queryKey:r,queryFn:dt,enabled:g,staleTime:6e4,retry:!1},e[4]=r,e[5]=g,e[6]=C):C=e[6];const{data:_,isLoading:N,error:b}=Fe(C),I=_?.sites??[];let o;e[7]!==a?(o=w=>{w||(h(null),d("")),a(w)},e[7]=a,e[8]=o):o=e[8];const y=o;let A;e[9]!==T?(A=w=>w.name.toLowerCase().includes(T.toLowerCase())||w.domains?.[0]?.domain.toLowerCase().includes(T.toLowerCase()),e[9]=T,e[10]=A):A=e[10];const v=I.filter(A),E=!x||v.some(w=>w.name===x);let j;e[11]!==p||e[12]!==s.id?(j=async w=>{V("deco_site_import_started",{site_name:w});const G=await fetch("/api/deco-sites/connection",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:w,orgId:s.id})}),D=await G.json().catch(ft);if(!G.ok)throw new Error(D.error??`Failed to create connection (${G.status})`);const L=D.connId;if(!L)throw new Error("Server did not return a connection ID");const ge=D.icon??null,te=lt(w),Pe=await p.callTool({name:"COLLECTION_VIRTUAL_MCP_CREATE",arguments:{data:{title:w,description:"Imported from deco.cx",pinned:!0,icon:ge??null,subtype:"project",metadata:{instructions:null,enabled_plugins:[],ui:{banner:null,bannerColor:"#22C55E",icon:ge,themeColor:"#22C55E",slug:te,pinnedViews:[{connectionId:L,toolName:"file_explorer",label:"Preview",icon:null},{connectionId:L,toolName:"fetch_assets",label:"Assets",icon:null},{connectionId:L,toolName:"get_monitor_data",label:"Monitor",icon:null},{connectionId:L,toolName:"list_pull_requests",label:"Pull Requests",icon:null},{connectionId:L,toolName:"list_releases",label:"Releases",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:L,toolName:"file_explorer"}}}},connections:[{connection_id:L}]}}}),Ge=Pe.structuredContent??Pe;return{slug:te,virtualMcpId:Ge.item.id,connId:L,item:Ge.item}},e[11]=p,e[12]=s.id,e[13]=j):j=e[13];let S;e[14]!==p||e[15]!==y||e[16]!==l||e[17]!==s.id||e[18]!==m?(S=w=>{const{slug:G,virtualMcpId:D,item:L}=w;V("deco_site_import_succeeded",{site_name:L.title,virtual_mcp_id:D,slug:G}),m.setQueryData(ne.collectionItem(p,s.id,"","VIRTUAL_MCP",D),{item:L}),m.invalidateQueries({predicate:ge=>{const te=ge.queryKey;return te[1]===s.id&&te[3]==="collection"&&te[4]==="VIRTUAL_MCP"}}),m.invalidateQueries({queryKey:ne.projects(s.id)}),ie.success(`Imported ${G} from deco.cx`),y(!1),localStorage.setItem("mesh:sidebar-open",JSON.stringify(!1)),l(D)},e[14]=p,e[15]=y,e[16]=l,e[17]=s.id,e[18]=m,e[19]=S):S=e[19];let k;e[20]!==j||e[21]!==S?(k={mutationFn:j,onSuccess:S,onError:mt},e[20]=j,e[21]=S,e[22]=k):k=e[22];const U=He(k),F=le,se=ce,R="sm:max-w-[900px] p-0 gap-0 overflow-hidden";let P;e[23]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(de,{className:"sr-only",children:t.jsx(ue,{children:"Import from deco.cx"})}),e[23]=P):P=e[23];let H;e[24]!==c?(H=c&&t.jsx("button",{type:"button",onClick:c,className:"flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors","aria-label":"Go back",children:t.jsx(Ae,{size:18})}),e[24]=c,e[25]=H):H=e[25];let me;e[26]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Import from deco.cx"}),e[26]=me):me=e[26];let B;e[27]!==H?(B=t.jsxs("div",{className:"flex items-center h-12 border-b border-border px-4 gap-3",children:[H,me]}),e[27]=H,e[28]=B):B=e[28];let fe;e[29]===Symbol.for("react.memo_cache_sentinel")?(fe=w=>{w.key==="Escape"&&d("")},e[29]=fe):fe=e[29];let q;e[30]!==T?(q=t.jsx("div",{children:t.jsx(qe,{value:T,onChange:d,placeholder:"Search sites...",onKeyDown:fe})}),e[30]=T,e[31]=q):q=e[31];const Ke="pb-0 min-h-[300px]";let Q;e[32]!==N?(Q=N&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"Loading sites..."}),e[32]=N,e[33]=Q):Q=e[33];const _e=!N&&!b&&I.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:"No sites found for this account."}),Ce=!N&&I.length>0&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 max-h-[420px] overflow-y-auto py-4 px-8 [scrollbar-gutter:stable]",children:[v.length===0&&t.jsxs("p",{className:"col-span-3 text-sm text-muted-foreground text-center py-8",children:["No sites match “",T,"”"]}),v.map(w=>{const G=w.domains?.find(ut)?.domain??w.domains?.[0]?.domain,D=x===w.name;return t.jsxs("button",{type:"button",onClick:()=>h(w.name),className:he("flex flex-col rounded-xl border overflow-hidden text-left transition-all cursor-pointer",D?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[t.jsx("div",{className:"w-full aspect-video bg-muted overflow-hidden",children:w.thumb_url?t.jsx("img",{src:w.thumb_url,alt:w.name,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("div",{className:"w-full h-full bg-muted"})}),t.jsxs("div",{className:"px-4 py-3",children:[t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:w.name}),G&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:G})]})]},w.name)})]});let Y;e[34]!==Q||e[35]!==_e||e[36]!==Ce?(Y=t.jsxs("div",{className:Ke,children:[Q,_e,Ce]}),e[34]=Q,e[35]=_e,e[36]=Ce,e[37]=Y):Y=e[37];let K;e[38]!==y?(K=()=>y(!1),e[38]=y,e[39]=K):K=e[39];let W;e[40]!==U.isPending||e[41]!==K?(W=t.jsx(oe,{variant:"outline",onClick:K,disabled:U.isPending,children:"Cancel"}),e[40]=U.isPending,e[41]=K,e[42]=W):W=e[42];const Ie=!x||!E||U.isPending||N;let J;e[43]!==U||e[44]!==x?(J=()=>x&&U.mutate(x),e[43]=U,e[44]=x,e[45]=J):J=e[45];const Te=U.isPending?"Importing...":"Import";let X;e[46]!==Ie||e[47]!==J||e[48]!==Te?(X=t.jsx(oe,{disabled:Ie,onClick:J,children:Te}),e[46]=Ie,e[47]=J,e[48]=Te,e[49]=X):X=e[49];let Z;e[50]!==W||e[51]!==X?(Z=t.jsxs(tt,{className:"px-8 py-5 border-t border-border",children:[W,X]}),e[50]=W,e[51]=X,e[52]=Z):Z=e[52];let ee;e[53]!==se||e[54]!==P||e[55]!==B||e[56]!==q||e[57]!==Y||e[58]!==Z?(ee=t.jsxs(se,{className:R,children:[P,B,q,Y,Z]}),e[53]=se,e[54]=P,e[55]=B,e[56]=q,e[57]=Y,e[58]=Z,e[59]=ee):ee=e[59];let pe;return e[60]!==F||e[61]!==y||e[62]!==n||e[63]!==ee?(pe=t.jsx(F,{open:n,onOpenChange:y,children:ee}),e[60]=F,e[61]=y,e[62]=n,e[63]=ee,e[64]=pe):pe=e[64],pe}function ut(i){return i.production}function mt(i){V("deco_site_import_failed",{error:i instanceof Error?i.message:"Unknown error"}),ie.error("Import failed: "+(i instanceof Error?i.message:"Unknown error"))}function ft(){return{}}function Ye(i,e){const n=M.c(11),{org:a}=z();let c;n[0]!==a.id?(c=we.REGISTRY(a.id),n[0]=a.id,n[1]=c):c=n[1];const s=c;let l;n[2]!==a.id||n[3]!==s?(l={connectionId:s,orgId:a.id},n[2]=a.id,n[3]=s,n[4]=l):l=n[4];const m=$(l);let f;n[5]!==i?(f={name:i},n[5]=i,n[6]=f):f=n[6];const x=e?.enabled??!0;let h;return n[7]!==m||n[8]!==f||n[9]!==x?(h={client:m,toolName:"COLLECTION_REGISTRY_APP_GET",toolArguments:f,enabled:x,staleTime:3e5,select:pt},n[7]=m,n[8]=f,n[9]=x,n[10]=h):h=n[10],st(h)}function pt(i){return i.structuredContent?.item??null}const gt=["Full HAR capture with cache, TTFB, and request analysis","Screenshot capture for visual inspection","Page discovery via sitemap, navigation, and link crawling","SEO audit — meta tags, structured data, robots.txt","Third-party script inventory and size analysis","Dead link detection across the entire site","Deco-specific diagnostics (?__d debug mode)"];function De(i){const e=M.c(7),{onRecruit:n,isRecruiting:a,isLoading:c}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a blackbox diagnostics agent that tests your storefront from the outside — no internal access needed. Give it a URL and it produces a detailed performance and health report."}),e[0]=s):s=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=l):l=e[1];let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"space-y-2",children:[l,t.jsx("ul",{className:"space-y-1.5",children:gt.map(ht)})]}),e[2]=m):m=e[2];const f=a||c,x=a?"Setting up...":"Add Site Diagnostics";let h;return e[3]!==n||e[4]!==f||e[5]!==x?(h=t.jsxs("div",{className:"flex flex-col gap-6",children:[s,m,t.jsx(oe,{onClick:n,disabled:f,className:"w-full cursor-pointer",children:x})]}),e[3]=n,e[4]=f,e[5]=x,e[6]=h):h=e[6],h}function ht(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Wt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(I=>I.id==="site-diagnostics"),{data:u,isLoading:p}=Ye(d.appId,{enabled:i}),r=u?.title||u?.server?.title||u?.server?.name||d.title,g=u?.server?.icons?.[0]?.src??d.icon,C=u?.server?.description??null,_=t.jsx(Me,{icon:g,name:r,size:"sm"}),N=async()=>{if(u){if(n){e(!1),s(n.id);return}T(!0);try{const I=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:d.appId},limit:1,offset:0}});let o;const A=I?.structuredContent?.items?.find(E=>E.app_id===d.appId);if(A)o=A.id;else{const E=u.server?.remotes?.[0]?.url;if(!E)throw new Error("Registry item is missing a remote URL for site-diagnostics");o=(await l.create.mutateAsync({title:r,description:C,icon:u.server?.icons?.[0]?.src??d.icon,connection_type:"HTTP",connection_url:E,app_name:u.server?.name??"site-diagnostics",app_id:d.appId,metadata:{type:"site-diagnostics",source:"store",registry_item_id:d.appId,verified:!0}})).id}const v=await m.create.mutateAsync({title:r,description:C,icon:g,status:"active",connections:[{connection_id:o,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"site-diagnostics",instructions:null,ui:{pinnedViews:[{connectionId:o,toolName:"diagnose",label:"diagnose",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:o,toolName:"diagnose"}}}}});V("agent_recruit_confirmed",{template_id:"site-diagnostics",agent_id:v.id}),e(!1),s(v.id)}catch(I){V("agent_recruit_failed",{template_id:"site-diagnostics",error:I instanceof Error?I.message:String(I)}),console.error("Failed to create Site Diagnostics agent:",I)}finally{T(!1)}}},b=`Add ${r}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(Le,{className:"text-xl font-semibold",children:b})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[_,t.jsx(ue,{className:"text-xl font-semibold",children:b})]})}),t.jsx(De,{onRecruit:N,isRecruiting:h,isLoading:p})]})})}const xt="https://sites-lean-canva.decocache.com/api/mcp",Nt=["Build and update Lean Canvas business models visually","Interactive grid UI with all 9 canvas sections","Iterative updates — add information as you discover it","Covers: Problem, Solution, Key Metrics, Unique Value Proposition","Covers: Channels, Customer Segments, Cost Structure, Revenue Streams","Unfair Advantage analysis"];function Ve(i){const e=M.c(7),{onRecruit:n,isRecruiting:a}=i;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add a Lean Canvas agent that helps you build and iterate on your business model. Describe your idea and it produces a visual, structured canvas."}),e[0]=c):c=e[0];let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("p",{className:"text-sm font-medium text-foreground",children:"Capabilities"}),e[1]=s):s=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsxs("div",{className:"space-y-2",children:[s,t.jsx("ul",{className:"space-y-1.5",children:Nt.map(_t)})]}),e[2]=l):l=e[2];const m=a?"Setting up...":"Add Lean Canvas";let f;return e[3]!==a||e[4]!==n||e[5]!==m?(f=t.jsxs("div",{className:"flex flex-col gap-6",children:[c,l,t.jsx(oe,{onClick:n,disabled:a,className:"w-full cursor-pointer",children:m})]}),e[3]=a,e[4]=n,e[5]=m,e[6]=f):f=e[6],f}function _t(i){return t.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[t.jsx("span",{className:"text-emerald-500 mt-0.5 shrink-0",children:"+"}),i]},i)}function Jt({open:i,onOpenChange:e,existingAgent:n}){const a=Re(),{org:c}=z(),s=Ne(),l=ke(),m=Ue(),f=$({connectionId:re,orgId:c.id}),x=Qe({client:f}),[h,T]=O.useState(!1),d=Be.find(g=>g.id==="lean-canvas"),u=t.jsx(Me,{icon:d.icon,name:d.title,size:"sm"}),p=async()=>{if(n){e(!1),s(n.id);return}T(!0);try{const g=await x.mutateAsync({name:"COLLECTION_CONNECTIONS_LIST",arguments:{where:{field:["app_id"],operator:"eq",value:"lean-canvas"},limit:1,offset:0}});let C;const N=g?.structuredContent?.items?.find(o=>o.app_id==="lean-canvas"),b=we.SELF(c.id);N?C=N.id:C=(await l.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,connection_type:"HTTP",connection_url:xt,app_name:"lean-canvas",app_id:"lean-canvas",configuration_state:{OBJECT_STORAGE:{__type:"@deco/object-storage",value:b}},metadata:{type:"lean-canvas",source:"store",verified:!0}})).id;const I=await m.create.mutateAsync({title:d.title,description:"Lean Canvas business model builder",icon:d.icon,status:"active",connections:[{connection_id:C,selected_tools:null,selected_resources:null,selected_prompts:null},{connection_id:b,selected_tools:null,selected_resources:null,selected_prompts:null}],metadata:{type:"lean-canvas",instructions:null,ui:{pinnedViews:[{connectionId:C,toolName:"lean_canvas",label:"lean_canvas",icon:null}],layout:{defaultMainView:{type:"ext-apps",id:C,toolName:"lean_canvas"}}}}});V("agent_recruit_confirmed",{template_id:"lean-canvas",agent_id:I.id}),e(!1),s(I.id)}catch(g){V("agent_recruit_failed",{template_id:"lean-canvas",error:g instanceof Error?g.message:String(g)}),console.error("Failed to create Lean Canvas agent:",g)}finally{T(!1)}},r=`Add ${d.title}`;return a?t.jsx(Ee,{open:i,onOpenChange:e,children:t.jsxs(Se,{className:"h-[70dvh]",children:[t.jsx(Oe,{className:"px-4 pt-4 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(Le,{className:"text-xl font-semibold",children:r})]})}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0 px-4 pb-8",children:t.jsx(Ve,{onRecruit:p,isRecruiting:h})})]})}):t.jsx(le,{open:i,onOpenChange:e,children:t.jsxs(ce,{className:"sm:max-w-[500px] p-8",children:[t.jsx(de,{className:"mb-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[u,t.jsx(ue,{className:"text-xl font-semibold",children:r})]})}),t.jsx(Ve,{onRecruit:p,isRecruiting:h})]})})}const Ct=`<role>
2
2
  You are the Agent Manager. You create, configure, and maintain agents (Virtual MCPs) in this workspace.
3
3
  </role>
4
4