@decocms/mesh 2.112.1 → 2.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/client/assets/{AlertCircle-FCPOfMF1.js → AlertCircle-CooHa8Dx.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-BDWUoLHG.js → AlertOctagon-Dbg9uZyB.js} +1 -1
  3. package/dist/client/assets/{AlertTriangle-BCxCq-e4.js → AlertTriangle-Ca8IB5bL.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-BvYfYYH9.js → ArrowLeft-DIF2VO2W.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-vQc2J5XU.js → ArrowUp-DgvOdNkG.js} +1 -1
  6. package/dist/client/assets/{Check-C4iILHMM.js → Check-DGXJXTap.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-C2DHvP4R.js → CheckCircle-DDajcDWB.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-D-aLdzmP.js → CheckDone01-CnxPjvi4.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-CzWO4mad.js → CheckVerified02-Iy-LVhoI.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-z_hhibsI.js → ChevronDown-Di42C1UO.js} +1 -1
  11. package/dist/client/assets/{ChevronRight-I0HQjcpK.js → ChevronRight-BNn59ko7.js} +1 -1
  12. package/dist/client/assets/{Clock-BHrBWjOr.js → Clock-BLkZwDYw.js} +1 -1
  13. package/dist/client/assets/{Code01-D2eAdc4e.js → Code01-DooPA--K.js} +1 -1
  14. package/dist/client/assets/{Container-itXK7eFq.js → Container-C1CLnDNL.js} +1 -1
  15. package/dist/client/assets/{Copy01-D61sx1O9.js → Copy01-rucQ3PSp.js} +1 -1
  16. package/dist/client/assets/{Dataflow03-CR35Oo4O.js → Dataflow03-DY9MPHye.js} +1 -1
  17. package/dist/client/assets/{DotsHorizontal-dNde0U3L.js → DotsHorizontal-CxkCXGJv.js} +1 -1
  18. package/dist/client/assets/{DotsVertical-0PjNOywv.js → DotsVertical-NXfqoXCN.js} +1 -1
  19. package/dist/client/assets/{Download01-Ppzhcdhi.js → Download01-f5vnFohs.js} +1 -1
  20. package/dist/client/assets/{Edit01-CH4QDS29.js → Edit01-CxGjhFGJ.js} +1 -1
  21. package/dist/client/assets/{Eye-BbvIJoNv.js → Eye-CmK33jvc.js} +1 -1
  22. package/dist/client/assets/{File02-BimlbaOQ.js → File02-Bs24RCQ6.js} +1 -1
  23. package/dist/client/assets/{File06-Cs4mEm2B.js → File06-XfbhoM8r.js} +1 -1
  24. package/dist/client/assets/{FilterLines-Ph2M5DZ2.js → FilterLines-Gpro-d22.js} +1 -1
  25. package/dist/client/assets/{Globe01-GvSei6pt.js → Globe01-CspKYhQJ.js} +1 -1
  26. package/dist/client/assets/{Globe02-BpA-XAUt.js → Globe02-DcNEoN4R.js} +1 -1
  27. package/dist/client/assets/{Grid01-Df2hXzMp.js → Grid01-DkGxNKPL.js} +1 -1
  28. package/dist/client/assets/{Hash02-D0QsP1AE.js → Hash02-DFSzHnWN.js} +1 -1
  29. package/dist/client/assets/{Home02-BVhbgsZm.js → Home02-CccWHOVS.js} +1 -1
  30. package/dist/client/assets/{Image01-BtB-nhrR.js → Image01-F0dDnjWb.js} +1 -1
  31. package/dist/client/assets/{Inbox01-BeHuJZpk.js → Inbox01-rhXjoTLG.js} +1 -1
  32. package/dist/client/assets/{InfoCircle-3-d4GdVE.js → InfoCircle-DDMndy6f.js} +1 -1
  33. package/dist/client/assets/{Key01-CNV1_V42.js → Key01-BoEk45CQ.js} +1 -1
  34. package/dist/client/assets/{LinkExternal01-CeWXLrLf.js → LinkExternal01-6fiITYn6.js} +1 -1
  35. package/dist/client/assets/{List-DmPJRDbt.js → List-DLWOvAOP.js} +1 -1
  36. package/dist/client/assets/{Loading01-DnWNNpgn.js → Loading01-BGpLDRYx.js} +1 -1
  37. package/dist/client/assets/{Lock01-DW4TF4ZC.js → Lock01-CkEZCQ8T.js} +1 -1
  38. package/dist/client/assets/{Pin01-BrxwDbwD.js → Pin01-CSZOSQvf.js} +1 -1
  39. package/dist/client/assets/{Play-8-KBNkG4.js → Play-Ck339o9D.js} +1 -1
  40. package/dist/client/assets/{Plus-DIdkEy67.js → Plus-BB0XqcsP.js} +1 -1
  41. package/dist/client/assets/{RefreshCcw01-gSTtp8P6.js → RefreshCcw01-BlblCD0d.js} +1 -1
  42. package/dist/client/assets/{RefreshCw01-BvkiiIQe.js → RefreshCw01-C2HUNviY.js} +1 -1
  43. package/dist/client/assets/{Save01-Chjsss53.js → Save01-j7EMqYuR.js} +1 -1
  44. package/dist/client/assets/{SearchMd-7kZlUrdi.js → SearchMd-CguhhQVb.js} +1 -1
  45. package/dist/client/assets/{Settings01-CD4OQjRs.js → Settings01-jz5w4e3w.js} +1 -1
  46. package/dist/client/assets/{Settings02-BHbtkH62.js → Settings02-BEGJoXOf.js} +1 -1
  47. package/dist/client/assets/{Share07-D3p_EMmr.js → Share07-DA5hMI-c.js} +1 -1
  48. package/dist/client/assets/{Terminal-B1Z9JS8b.js → Terminal-B6KzedA2.js} +1 -1
  49. package/dist/client/assets/{Tool01-BIoWQ5Oq.js → Tool01-BPh57jnm.js} +1 -1
  50. package/dist/client/assets/{Trash01-0rSUD5TH.js → Trash01-DGjvH5rG.js} +1 -1
  51. package/dist/client/assets/{Upload01-CSNaYuHm.js → Upload01-BWKtoN2l.js} +1 -1
  52. package/dist/client/assets/{Users03-Dvgp68y-.js → Users03-DWNrz1Vr.js} +1 -1
  53. package/dist/client/assets/{X-iNSeOP_M.js → X-hlRWRdLd.js} +1 -1
  54. package/dist/client/assets/{XCircle-DUGmrBQP.js → XCircle-VzD2IKvZ.js} +1 -1
  55. package/dist/client/assets/{XClose-DLUjvMjV.js → XClose-quksRQbf.js} +1 -1
  56. package/dist/client/assets/{agent-connections-preview-Lj1q_y3G.js → agent-connections-preview-DO3HZtWQ.js} +1 -1
  57. package/dist/client/assets/{agent-detail-DnruJD38.js → agent-detail-Dm90C1dq.js} +1 -1
  58. package/dist/client/assets/{agents-BJH5Anmm.js → agents-Dp1lzRWx.js} +1 -1
  59. package/dist/client/assets/{alert-dialog-BdxAw2_i.js → alert-dialog-BobozgbA.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-CtdIOnhJ.js → auth-catchall-Bg2u42FQ.js} +1 -1
  61. package/dist/client/assets/{avatar-BWyQgamP.js → avatar-DzNBuwvQ.js} +1 -1
  62. package/dist/client/assets/{badge-BrJlkKcu.js → badge-Ba42zrft.js} +1 -1
  63. package/dist/client/assets/{binder-C_0JjEKv.js → binder-XSlHh33G.js} +1 -1
  64. package/dist/client/assets/{breadcrumb-CI_fjGRz.js → breadcrumb-DVboj9hZ.js} +1 -1
  65. package/dist/client/assets/{button-PsdQrz_c.js → button-BvpGJmwj.js} +1 -1
  66. package/dist/client/assets/{card-BzJAU43f.js → card-DUyr2anf.js} +1 -1
  67. package/dist/client/assets/{checkbox-sb8sD5ui.js → checkbox-BgqFPCG8.js} +1 -1
  68. package/dist/client/assets/{circle-alert-C-aADsfY.js → circle-alert-D1V0DFvr.js} +1 -1
  69. package/dist/client/assets/{collection-detail-CDEPRGpA.js → collection-detail-tuOZUkEg.js} +1 -1
  70. package/dist/client/assets/{collection-tab-B1G0VYPs.js → collection-tab-DpQw4w-_.js} +1 -1
  71. package/dist/client/assets/{collection-table-wrapper-D61hhogA.js → collection-table-wrapper-Dwsrv-is.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-CPfRwaoG.js → collection-tabs-BxPjmpup.js} +1 -1
  73. package/dist/client/assets/{command-piAC-M3l.js → command-eII6FM4T.js} +1 -1
  74. package/dist/client/assets/{connect-DEs0Gjzg.js → connect-CjbgNw43.js} +1 -1
  75. package/dist/client/assets/{connection-card-D_177bEv.js → connection-card-B-vaA7In.js} +1 -1
  76. package/dist/client/assets/{connection-detail-BsQ6mZgD.js → connection-detail-1_ZQMYvG.js} +1 -1
  77. package/dist/client/assets/{connections-Td2SKnA7.js → connections-DSsqgW7V.js} +1 -1
  78. package/dist/client/assets/constants-BXsR0e2f.js +1 -0
  79. package/dist/client/assets/{constants-CprpRkCd.js → constants-DTZgxhQr.js} +1 -1
  80. package/dist/client/assets/{create-organization-dialog-BKXFo1B_.js → create-organization-dialog-_ENRfzh2.js} +1 -1
  81. package/dist/client/assets/{create-project-dialog-D4rrUNn8.js → create-project-dialog-CkoSW_Yw.js} +1 -1
  82. package/dist/client/assets/{dialog-u2DH1vwW.js → dialog-Djb2_yQ3.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-BNG4uKQg.js → dropdown-menu-DwhvTSoj.js} +1 -1
  84. package/dist/client/assets/{dynamic-plugin-layout--T7wz40R.js → dynamic-plugin-layout-gS11xmZg.js} +1 -1
  85. package/dist/client/assets/{empty-state-Rr_u3PhY.js → empty-state-CUSdR_G_.js} +1 -1
  86. package/dist/client/assets/{empty-state-FeUZYuz7.js → empty-state-CfAcFJ3T.js} +1 -1
  87. package/dist/client/assets/{env-vars-editor-BA-BCGBg.js → env-vars-editor-CX-fJfxt.js} +1 -1
  88. package/dist/client/assets/{error-boundary-GNG1qY0w.js → error-boundary-Di0tQXdv.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-DQZArmBq.js → extract-connection-data-Dd3BvcTW.js} +1 -1
  90. package/dist/client/assets/{file-browser-BcBWjv7g.js → file-browser-CyYYn3HQ.js} +2 -2
  91. package/dist/client/assets/{form-D_OJdhgN.js → form-DIsigMsk.js} +1 -1
  92. package/dist/client/assets/{grid-view-Dm1uX93F.js → grid-view-BsAPFz5e.js} +1 -1
  93. package/dist/client/assets/{home-BlNwQ5Mo.js → home-DoBwFvBu.js} +1 -1
  94. package/dist/client/assets/{index-CcJrSRNK.js → index-BVrm4rGn.js} +1 -1
  95. package/dist/client/assets/{index-CpSW8k7K.js → index-CDwFwb7Q.js} +1 -1
  96. package/dist/client/assets/{index-CfIrPFpp.js → index-CMu5spRk.js} +1 -1
  97. package/dist/client/assets/{index-VXW3sSDF.js → index-Cs0vYfu9.js} +1 -1
  98. package/dist/client/assets/{index-suBiOdHJ.js → index-DeBwK236.js} +1 -1
  99. package/dist/client/assets/{index-CWOm2npy.js → index-NEbz2HQu.js} +1 -1
  100. package/dist/client/assets/index-hmLeN6Cx.css +1 -0
  101. package/dist/client/assets/{index-CSorKJjK.js → index-p5ek_T2U.js} +3 -3
  102. package/dist/client/assets/{index-C8ziK6W0.js → index-qSvnMMX3.js} +1 -1
  103. package/dist/client/assets/{index-BrPQlPIJ.js → index-r3RmHcg-.js} +1 -1
  104. package/dist/client/assets/{infiniteQueryObserver-CclLryfN.js → infiniteQueryObserver-DbZCUgr5.js} +1 -1
  105. package/dist/client/assets/{input-CUjOwEmR.js → input-Cw77piS4.js} +1 -1
  106. package/dist/client/assets/{integration-icon-BkJxicJN.js → integration-icon-D3fWRQzh.js} +1 -1
  107. package/dist/client/assets/{label-DndR_sdT.js → label-CUy1x9Fc.js} +1 -1
  108. package/dist/client/assets/{layout-BbwowDmb.js → layout-BPYuOiPI.js} +1 -1
  109. package/dist/client/assets/{localstorage-keys-BOMBKTJ_.js → localstorage-keys-DRPmjZks.js} +1 -1
  110. package/dist/client/assets/{login-yCPcoLF7.js → login-CUcM51_h.js} +1 -1
  111. package/dist/client/assets/{markdown-Cux-Thdi.js → markdown-BUX5ABnz.js} +1 -1
  112. package/dist/client/assets/{mcp-oauth-Nf9uKFHm.js → mcp-oauth-Da77-kcD.js} +1 -1
  113. package/dist/client/assets/{mcp-server-card-CJuahgJC.js → mcp-server-card-DcZS4AhS.js} +1 -1
  114. package/dist/client/assets/{mcp-server-detail-2Yl28H-y.js → mcp-server-detail-BsuSFuH9.js} +2 -2
  115. package/dist/client/assets/{members-DEM-d8Dm.js → members-Dt-WMWXs.js} +1 -1
  116. package/dist/client/assets/{monitoring-DHj5kNtj.js → monitoring-DINJ4pYy.js} +1 -1
  117. package/dist/client/assets/{monitoring-dashboard-edit-CgMelTgf.js → monitoring-dashboard-edit-ViuWKC7f.js} +1 -1
  118. package/dist/client/assets/{monitoring-dashboard-view-Ddmcfs0U.js → monitoring-dashboard-view-B53vWJlZ.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-C4PJ4qMY.js → oauth-callback-Dsqe_oXS.js} +1 -1
  120. package/dist/client/assets/{page-xl-8Q4jB.js → page-BKBuf2HE.js} +1 -1
  121. package/dist/client/assets/{page-BcIGf-vT.js → page-BLmopBsr.js} +1 -1
  122. package/dist/client/assets/{plugin-empty-state-CGzQhmga.js → plugin-empty-state-Cdi0lxlF.js} +1 -1
  123. package/dist/client/assets/{plugin-empty-state-Bf86o93w.js → plugin-empty-state-D_Z6xsRD.js} +1 -1
  124. package/dist/client/assets/{plugin-header-BvIdo93g.js → plugin-header-DGLeYRv9.js} +1 -1
  125. package/dist/client/assets/{plugin-header-CftE2XxB.js → plugin-header-D_XJF06t.js} +1 -1
  126. package/dist/client/assets/{popover-YctVmVIU.js → popover-C8z2ljXJ.js} +1 -1
  127. package/dist/client/assets/{project-layout-DAeZPl7k.js → project-layout-gRYIrnzO.js} +1 -1
  128. package/dist/client/assets/{project-settings-Dt5Gs-GG.js → project-settings-iakvSAMp.js} +1 -1
  129. package/dist/client/assets/{projects-list-DX1fGYV-.js → projects-list-BTf0o0Dw.js} +1 -1
  130. package/dist/client/assets/{readme-viewer-C2fFeEY6.js → readme-viewer-DSTuLgLE.js} +1 -1
  131. package/dist/client/assets/registry-layout-D0ZI3R-w.js +5 -0
  132. package/dist/client/assets/{registry-utils-D7nsXOtq.js → registry-utils-D8FLO1oI.js} +1 -1
  133. package/dist/client/assets/{reports-layout-v2eEalG4.js → reports-layout-NWBpDTNI.js} +1 -1
  134. package/dist/client/assets/{reset-password-VgJq-dsS.js → reset-password-BEvAUHxp.js} +1 -1
  135. package/dist/client/assets/{resizable-BbQ3QKOl.js → resizable-Q_6VrAvM.js} +1 -1
  136. package/dist/client/assets/{save-actions-DPNYD3Xt.js → save-actions-DnatwzCI.js} +1 -1
  137. package/dist/client/assets/{scroll-area-COr_hThW.js → scroll-area--Dl42eG7.js} +1 -1
  138. package/dist/client/assets/{select-CM2ceeC7.js → select-DmOdy-_2.js} +1 -1
  139. package/dist/client/assets/{shell-layout-qUVkiQTU.js → shell-layout-DaVrqTvl.js} +3 -3
  140. package/dist/client/assets/{spinner-CMQycAd7.js → spinner-BFe5KsON.js} +1 -1
  141. package/dist/client/assets/{store-invite-BwZ5vJ7L.js → store-invite-B6QzkY9D.js} +1 -1
  142. package/dist/client/assets/{switch-0oBr_5Nc.js → switch-BTNdX6uT.js} +1 -1
  143. package/dist/client/assets/{table-DHGSXIR3.js → table-m7xKes0i.js} +1 -1
  144. package/dist/client/assets/{tasks-Ddrd7Qzh.js → tasks-B817iTsv.js} +1 -1
  145. package/dist/client/assets/{textarea-D8i2_yh5.js → textarea-1ZAkAqPs.js} +1 -1
  146. package/dist/client/assets/{time-range-picker-DY7iwNPy.js → time-range-picker-S5DXdK6J.js} +1 -1
  147. package/dist/client/assets/{toggle-group-CBnmmBtQ.js → toggle-group-B4gd2g4g.js} +1 -1
  148. package/dist/client/assets/{tools-list-DN-MOqZh.js → tools-list-BYJP7wdj.js} +1 -1
  149. package/dist/client/assets/{tooltip-3prvmP9g.js → tooltip-w4nyO9EM.js} +1 -1
  150. package/dist/client/assets/{topbar-portal-CJ7PzdTP.js → topbar-portal-DFijBXBE.js} +1 -1
  151. package/dist/client/assets/{typewriter-title-XyJzPRA3.js → typewriter-title-fwTbDCyQ.js} +1 -1
  152. package/dist/client/assets/{use-binding-lEzTdQvV.js → use-binding-CAtjL1rr.js} +1 -1
  153. package/dist/client/assets/{use-connection-B5d4Q2lv.js → use-connection-BRwTI0xk.js} +1 -1
  154. package/dist/client/assets/{use-copy-B7ViTxT4.js → use-copy-BnGNgGbL.js} +1 -1
  155. package/dist/client/assets/{use-create-virtual-mcp-9TUXvIcj.js → use-create-virtual-mcp-BIn6DTPa.js} +1 -1
  156. package/dist/client/assets/{use-deco-chat-open-CjwdHAPK.js → use-deco-chat-open-CWPuucLF.js} +1 -1
  157. package/dist/client/assets/{use-install-from-registry-BnGzifRr.js → use-install-from-registry-GZkHb-J_.js} +1 -1
  158. package/dist/client/assets/{use-list-state-DcdRxXow.js → use-list-state-CLqJqhda.js} +1 -1
  159. package/dist/client/assets/{use-llm-CBOkk0mL.js → use-llm-BToIG9lg.js} +1 -1
  160. package/dist/client/assets/{use-mcp-prompts-DdDuaFgh.js → use-mcp-prompts-C28zFdyF.js} +1 -1
  161. package/dist/client/assets/{use-mcp-tools-DybhOGoD.js → use-mcp-tools-CnGq7c_h.js} +1 -1
  162. package/dist/client/assets/{use-mobile-Cb1NQmS0.js → use-mobile-Dl83qL71.js} +1 -1
  163. package/dist/client/assets/{use-organization-settings-DBJYJEuX.js → use-organization-settings-BVsgnOKP.js} +1 -1
  164. package/dist/client/assets/{use-project-DSk2rT5y.js → use-project-pPGjnPtH.js} +1 -1
  165. package/dist/client/assets/{use-view-mode-CY2VBoRs.js → use-view-mode-BC3VVzlU.js} +1 -1
  166. package/dist/client/assets/{use-virtual-mcp-C54wao08.js → use-virtual-mcp-C67SrK4s.js} +1 -1
  167. package/dist/client/assets/useInfiniteQuery-CL1DQ1B_.js +1 -0
  168. package/dist/client/assets/{useMutation-DHU1pE7Y.js → useMutation-BLWSoXAi.js} +1 -1
  169. package/dist/client/assets/useQuery-CoMTdc_B.js +1 -0
  170. package/dist/client/assets/useSuspenseInfiniteQuery-BEcP523_.js +1 -0
  171. package/dist/client/assets/{workflow-De5T4r69.js → workflow-D3d1tCTr.js} +1 -1
  172. package/dist/client/index.html +2 -2
  173. package/dist/server/cli.js +171 -171
  174. package/dist/server/migrate.js +155 -155
  175. package/dist/server/server.js +176 -176
  176. package/package.json +1 -1
  177. package/dist/client/assets/constants-BmJIr6_q.js +0 -1
  178. package/dist/client/assets/index-86l5BgKO.css +0 -1
  179. package/dist/client/assets/registry-layout-DbckP3LG.js +0 -5
  180. package/dist/client/assets/useInfiniteQuery-ic9rl40u.js +0 -1
  181. package/dist/client/assets/useQuery-CttS4ob_.js +0 -1
  182. package/dist/client/assets/useSuspenseInfiniteQuery-Ba0Rgdp0.js +0 -1
@@ -1,5 +0,0 @@
1
- import{r as M,c as K,u as de,z as Be,bA as et,j as s,t as W,bE as an}from"./index-CSorKJjK.js";import{B as F,c as J}from"./button-PsdQrz_c.js";import{i as bt}from"./CheckCircle-C2DHvP4R.js";import{n as on}from"./Container-itXK7eFq.js";import{t as cn}from"./Settings01-CD4OQjRs.js";import{u as Ge}from"./useQuery-CttS4ob_.js";import{u as Me}from"./useMutation-DHU1pE7Y.js";import{a as be,u as ge,j as gs}from"./constants-CprpRkCd.js";import{u as dn}from"./useInfiniteQuery-ic9rl40u.js";import{B as U}from"./badge-BrJlkKcu.js";import{I as ye}from"./input-CUjOwEmR.js";import{a as kt,c as We,D as St,b as Rt,h as ls,i as as,g as mn}from"./dropdown-menu-BNG4uKQg.js";import{e as js,a as ys,b as Tt,T as Ae,d as bs,c as Le}from"./table-DHGSXIR3.js";import{a as os,T as un}from"./toggle-group-CBnmmBtQ.js";import{u as xn}from"./use-view-mode-CY2VBoRs.js";import{i as Xt}from"./DotsVertical-0PjNOywv.js";import{i as hn}from"./FilterLines-Ph2M5DZ2.js";import{i as vs}from"./Globe01-GvSei6pt.js";import{i as mt}from"./Loading01-DnWNNpgn.js";import{i as Ns}from"./SearchMd-7kZlUrdi.js";import{b as It,c as Mt,d as Pt,e as Et,a as Dt,D as $t}from"./dialog-u2DH1vwW.js";import{i as jt}from"./AlertCircle-FCPOfMF1.js";import{n as pn}from"./Download01-Ppzhcdhi.js";import{i as cs}from"./Upload01-CSNaYuHm.js";import{c as Lt,b as zt,d as Ot,A as Ut,g as qt,e as Ft,a as Bt,f as Gt}from"./alert-dialog-BdxAw2_i.js";import{C as ne}from"./card-BzJAU43f.js";import{s as vt}from"./Trash01-0rSUD5TH.js";import{L as ie}from"./label-DndR_sdT.js";import{n as fn,S as ws,a as Cs,b as _s,c as ks,d as Ct}from"./select-CM2ceeC7.js";import{S as _t}from"./switch-0oBr_5Nc.js";import{T as At}from"./textarea-D8i2_yh5.js";import{i as gn}from"./ArrowLeft-BvYfYYH9.js";import{i as jn,u as Ht,t as yn}from"./use-copy-B7ViTxT4.js";import{s as es}from"./RefreshCcw01-gSTtp8P6.js";import{i as bn}from"./X-iNSeOP_M.js";import{t as Ss}from"./ChevronDown-z_hhibsI.js";import{s as Rs}from"./Eye-BbvIJoNv.js";import{n as vn}from"./LinkExternal01-CeWXLrLf.js";import{i as Nn}from"./XCircle-DUGmrBQP.js";import{h as Ts,e as Is}from"./use-connection-B5d4Q2lv.js";import{b as wn,P as Cn,a as _n}from"./popover-YctVmVIU.js";import{i as Wt}from"./Check-C4iILHMM.js";import{a as Jt}from"./Copy01-D61sx1O9.js";import{i as kn,a as Sn}from"./Save01-Chjsss53.js";import{i as Rn}from"./Key01-CNV1_V42.js";import{s as Tn}from"./Plus-DIdkEy67.js";import{a as In,b as Mn,T as Pn}from"./tooltip-3prvmP9g.js";import{a as En,i as Dn}from"./mcp-oauth-Nf9uKFHm.js";import{i as $n}from"./Play-8-KBNkG4.js";import"./infiniteQueryObserver-CclLryfN.js";import"./ChevronRight-I0HQjcpK.js";import"./use-mobile-Cb1NQmS0.js";import"./index-CpSW8k7K.js";const Ms=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243"}));Ms.displayName="EyeOff";const Ps=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M12.5 3H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H17c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122C21 18.395 21 17.93 21 17m-2-9V2m-3 3h6M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4.49 3.418-8.459 7.69c-.476.433-.714.649-.735.836a.5.5 0 0 0 .167.431C6.105 21 6.426 21 7.07 21h9.387c1.44 0 2.159 0 2.724-.242a3 3 0 0 0 1.578-1.578c.242-.565.242-1.285.242-2.724 0-.484 0-.726-.053-.952a2.001 2.001 0 0 0-.374-.778c-.143-.182-.332-.333-.71-.636l-2.797-2.237c-.379-.303-.568-.454-.776-.508a1 1 0 0 0-.557.018c-.205.066-.384.23-.743.555Z"}));Ps.displayName="ImagePlus";const Es=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));Es.displayName="Link01";const Ds=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}),M.createElement("path",{d:"M8 9.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 8 9.04 8 9.6 8h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 8.76 16 9.04 16 9.6v4.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C15.24 16 14.96 16 14.4 16H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 15.24 8 14.96 8 14.4V9.6Z"}));Ds.displayName="StopSquare";const ts=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m6 6 4.5 4.5M6 6H3L2 3l1-1 3 1v3Zm13.259-3.259-2.628 2.628c-.396.396-.594.594-.668.822a1 1 0 0 0 0 .618c.074.228.272.426.668.822l.238.238c.396.396.594.594.822.668a1 1 0 0 0 .618 0c.228-.074.426-.272.822-.668L21.59 5.41a5.5 5.5 0 0 1-6.16 7.485c-.485-.096-.729-.144-.876-.13a.836.836 0 0 0-.373.114c-.13.07-.261.201-.523.463L6.5 20.5a2.121 2.121 0 0 1-3-3l7.157-7.157c.262-.262.393-.393.463-.524a.836.836 0 0 0 .113-.372c.015-.148-.033-.39-.129-.877a5.5 5.5 0 0 1 8.155-5.83ZM12 15l5.5 5.5a2.121 2.121 0 0 0 3-3l-4.525-4.525a5.475 5.475 0 0 1-.934-.17c-.39-.107-.816-.03-1.101.255L12 15Z"}));ts.displayName="Tool02";const G={all:["private-registry"],items:()=>[...G.all,"items"],itemsList:(t,e,n,r)=>[...G.items(),"list",{search:t,tags:e,categories:n,limit:r}],item:t=>[...G.items(),"item",t],filters:()=>[...G.all,"filters"],registryConfig:()=>[...G.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...G.registryConfig(),t,e],publishRequests:()=>[...G.all,"publish-requests"],publishRequestsByOrg:t=>[...G.publishRequests(),"org",t],publishRequestsList:t=>[...G.publishRequests(),"list",{status:t??"all"}],publishRequestsListByOrg:(t,e)=>[...G.publishRequestsByOrg(t),"list",{status:e??"all"}],publishRequestsCount:()=>[...G.publishRequests(),"count"],publishRequestsCountByOrg:t=>[...G.publishRequestsByOrg(t),"count"],publishApiKeys:()=>[...G.all,"publish-api-keys"],monitor:()=>[...G.all,"monitor"],monitorRuns:()=>[...G.monitor(),"runs"],monitorRunsList:t=>[...G.monitorRuns(),"list",{status:t??"all"}],monitorRun:t=>[...G.monitorRuns(),"run",t??"none"],monitorResults:()=>[...G.monitor(),"results"],monitorResultsList:(t,e)=>[...G.monitorResults(),"list",{runId:t??"none",status:e??"all"}],monitorConnections:()=>[...G.monitor(),"connections"],monitorConnectionAuthProbe:t=>[...G.monitorConnections(),"auth-probe",t]};async function ze(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function An(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async c=>ze(o,"REGISTRY_MONITOR_RUN_START",{config:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:G.monitorRuns()}),e.invalidateQueries({queryKey:G.monitorResults()})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}function Ln(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async c=>ze(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async(c,m)=>{await Promise.all([e.invalidateQueries({queryKey:G.monitorRuns()}),e.invalidateQueries({queryKey:G.monitorRun(m)})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}function Qt(t){const e=K.c(10),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:be,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=ge(r);let l;e[2]!==t?(l=G.monitorRunsList(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>ze(o,"REGISTRY_MONITOR_RUN_LIST",{status:t,limit:100}),e[4]=o,e[5]=t,e[6]=a):a=e[6];let i;return e[7]!==l||e[8]!==a?(i={queryKey:l,queryFn:a,staleTime:5e3},e[7]=l,e[8]=a,e[9]=i):i=e[9],Ge(i)}function ss(t){const e=K.c(11),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:be,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=ge(r);let l;e[2]!==t?(l=G.monitorRun(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>ze(o,"REGISTRY_MONITOR_RUN_GET",{runId:t}),e[4]=o,e[5]=t,e[6]=a):a=e[6];const i=!!t;let c;return e[7]!==l||e[8]!==a||e[9]!==i?(c={queryKey:l,queryFn:a,enabled:i,refetchInterval:zn},e[7]=l,e[8]=a,e[9]=i,e[10]=c):c=e[10],Ge(c)}function zn(t){return t.state.data?.run?.status==="running"?5e3:!1}function Nt(t,e,n){const r=K.c(14),{org:o}=de();let l;r[0]!==o.id?(l={connectionId:be,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=ge(l);let i;r[2]!==t||r[3]!==e?(i=G.monitorResultsList(t,e),r[2]=t,r[3]=e,r[4]=i):i=r[4];let c;r[5]!==a||r[6]!==t||r[7]!==e?(c=async()=>ze(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:t,status:e,limit:200,offset:0}),r[5]=a,r[6]=t,r[7]=e,r[8]=c):c=r[8];const m=!!t,x=n==="running"?2500:!1;let h;return r[9]!==i||r[10]!==c||r[11]!==m||r[12]!==x?(h={queryKey:i,queryFn:c,enabled:m,staleTime:5e3,refetchInterval:x},r[9]=i,r[10]=c,r[11]=m,r[12]=x,r[13]=h):h=r[13],Ge(h)}function $s(){const t=K.c(5),{org:e}=de();let n;t[0]!==e.id?(n={connectionId:be,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=ge(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=G.monitorConnections(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>ze(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},t[3]=r,t[4]=l):l=t[4],Ge(l)}function On(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async()=>ze(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:G.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}function Un(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async c=>{const{connectionId:m,authStatus:x}=c;return ze(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:x})},t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:G.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}const ds={monitorMode:"health_check",onFailure:"none",schedule:"manual",cronExpression:"",scheduleEventId:"",perMcpTimeoutMs:3e4,perToolTimeoutMs:1e4,maxAgentSteps:15,testPublicOnly:!1,testPrivateOnly:!1,includePendingRequests:!1,agentContext:"",llmConnectionId:"",llmModelId:""};function As(){const t=K.c(33),{org:e,project:n}=de();let r;t[0]!==e.id?(r={connectionId:be,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const o=ge(r),l=Be();let a;t[2]!==n.id?(a=G.registryConfigByPlugin(n.id??"",et),t[2]=n.id,t[3]=a):a=t[3];let i;t[4]!==o||t[5]!==n.id?(i=async()=>ze(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:et}),t[4]=o,t[5]=n.id,t[6]=i):i=t[6];const c=!!n.id;let m;t[7]!==a||t[8]!==i||t[9]!==c?(m={queryKey:a,queryFn:i,enabled:c},t[7]=a,t[8]=i,t[9]=c,t[10]=m):m=t[10];const x=Ge(m),h=x.data?.config?.settings,f=h&&typeof h=="object"?h.testConfig:void 0,d=typeof(h?h.monitorMode??h.testMode:void 0)=="string";let y;t[11]!==f?(y=f??{},t[11]=f,t[12]=y):y=t[12];let g;t[13]!==d||t[14]!==h||t[15]!==f?(g=d&&!f?h:{},t[13]=d,t[14]=h,t[15]=f,t[16]=g):g=t[16];let C;t[17]!==y||t[18]!==g?(C={...ds,...y,...g},t[17]=y,t[18]=g,t[19]=C):C=t[19];const _=C;let v;t[20]!==o||t[21]!==n.id?(v=async k=>{const N=(await ze(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:et}))?.config?.settings??{};return ze(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:et,settings:{...N,testConfig:{...ds,...N.testConfig??{},...k}}})},t[20]=o,t[21]=n.id,t[22]=v):v=t[22];let b;t[23]!==n.id||t[24]!==l?(b=async()=>{await l.invalidateQueries({queryKey:G.registryConfigByPlugin(n.id??"",et)})},t[23]=n.id,t[24]=l,t[25]=b):b=t[25];let S;t[26]!==v||t[27]!==b?(S={mutationFn:v,onSuccess:b},t[26]=v,t[27]=b,t[28]=S):S=t[28];const u=Me(S);let j;return t[29]!==x.isLoading||t[30]!==u||t[31]!==_?(j={settings:_,isLoading:x.isLoading,saveMutation:u},t[29]=x.isLoading,t[30]=u,t[31]=_,t[32]=j):j=t[32],j}function qn(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async c=>ze(o,"REGISTRY_MONITOR_SCHEDULE_SET",c),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:G.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}function Fn(){const t=K.c(9),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async c=>ze(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:G.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],Me(i)}function Bn(){const t=K.c(3),e=Qt("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Nt(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return t[0]!==l||t[1]!==a?(i={brokenCount:l,isLoading:a},t[0]=l,t[1]=a,t[2]=i):i=t[2],i}const Gn=24;function Qn(t){return t.trim()}async function Pe(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function Ls(t){const e=K.c(19),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:be,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=ge(r);let l,a,i,c;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(a=Qn(t.search),l=t.limit??Gn,c=dn,i=G.itemsList(a,t.tags,t.categories,l),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=c):(l=e[6],a=e[7],i=e[8],c=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==t.categories||e[13]!==t.tags||e[14]!==a?(m=async h=>{const{pageParam:f}=h,p=a.length>0?{operator:"or",conditions:[{field:["title"],operator:"contains",value:a},{field:["description"],operator:"contains",value:a},{field:["id"],operator:"contains",value:a},{field:["server","name"],operator:"contains",value:a}]}:void 0;return Pe(o,"REGISTRY_ITEM_LIST",{cursor:f,limit:l,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:p})},e[10]=o,e[11]=l,e[12]=t.categories,e[13]=t.tags,e[14]=a,e[15]=m):m=e[15];let x;return e[16]!==i||e[17]!==m?(x={queryKey:i,queryFn:m,initialPageParam:void 0,getNextPageParam:Kn,staleTime:3e4},e[16]=i,e[17]=m,e[18]=x):x=e[18],c(x)}function Kn(t){return t.nextCursor}function Vn(){const t=K.c(8),{org:e}=de();let n;t[0]!==e.id?(n={connectionId:be,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=ge(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=G.filters(),t[2]=o):o=t[2];let l;t[3]!==r?(l=async()=>Pe(r,"REGISTRY_ITEM_FILTERS",{}),t[3]=r,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},t[5]=a):a=t[5];let i;return t[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},t[6]=l,t[7]=i):i=t[7],Ge(i)}function ns(){const t=K.c(29),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:G.items()}),e.invalidateQueries({queryKey:G.filters()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async b=>(await Pe(o,"REGISTRY_ITEM_CREATE",{data:b})).item,t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=Me(c);let x;t[9]!==o?(x=async b=>{const{id:S,data:u}=b;return(await Pe(o,"REGISTRY_ITEM_UPDATE",{id:S,data:u})).item},t[9]=o,t[10]=x):x=t[10];let h;t[11]!==a||t[12]!==x?(h={mutationFn:x,onSuccess:a},t[11]=a,t[12]=x,t[13]=h):h=t[13];const f=Me(h);let p;t[14]!==o?(p=async b=>(await Pe(o,"REGISTRY_ITEM_DELETE",{id:b})).item,t[14]=o,t[15]=p):p=t[15];let d;t[16]!==a||t[17]!==p?(d={mutationFn:p,onSuccess:a},t[16]=a,t[17]=p,t[18]=d):d=t[18];const y=Me(d);let g;t[19]!==o?(g=async b=>Pe(o,"REGISTRY_ITEM_BULK_CREATE",{items:b}),t[19]=o,t[20]=g):g=t[20];let C;t[21]!==a||t[22]!==g?(C={mutationFn:g,onSuccess:a},t[21]=a,t[22]=g,t[23]=C):C=t[23];const _=Me(C);let v;return t[24]!==_||t[25]!==m||t[26]!==y||t[27]!==f?(v={createMutation:m,updateMutation:f,deleteMutation:y,bulkCreateMutation:_},t[24]=_,t[25]=m,t[26]=y,t[27]=f,t[28]=v):v=t[28],v}function Kt(t){const e=K.c(34),{org:n,project:r}=de();let o;e[0]!==n.id?(o={connectionId:be,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=ge(o),a=Be();let i;e[2]!==t||e[3]!==r.id?(i=G.registryConfigByPlugin(r.id??"",t),e[2]=t,e[3]=r.id,e[4]=i):i=e[4];let c;e[5]!==l||e[6]!==t||e[7]!==r.id?(c=async()=>Pe(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}),e[5]=l,e[6]=t,e[7]=r.id,e[8]=c):c=e[8];const m=!!r.id;let x;e[9]!==i||e[10]!==c||e[11]!==m?(x={queryKey:i,queryFn:c,enabled:m,staleTime:6e4},e[9]=i,e[10]=c,e[11]=m,e[12]=x):x=e[12];const h=Ge(x);let f;e[13]!==l||e[14]!==t||e[15]!==r.id?(f=async k=>{const N=(await Pe(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}))?.config?.settings??{};return Pe(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:t,settings:{...N,...k}})},e[13]=l,e[14]=t,e[15]=r.id,e[16]=f):f=e[16];let p;e[17]!==t||e[18]!==r.id||e[19]!==a?(p=async()=>{await a.invalidateQueries({queryKey:G.registryConfigByPlugin(r.id??"",t)})},e[17]=t,e[18]=r.id,e[19]=a,e[20]=p):p=e[20];let d;e[21]!==f||e[22]!==p?(d={mutationFn:f,onSuccess:p},e[21]=f,e[22]=p,e[23]=d):d=e[23];const y=Me(d),g=h.data?.config?.settings?.registryName??"Private Registry",C=h.data?.config?.settings?.registryIcon??"",_=h.data?.config?.settings?.llmConnectionId??"",v=h.data?.config?.settings?.llmModelId??"",b=h.data?.config?.settings?.acceptPublishRequests??!1,S=h.data?.config?.settings?.requireApiToken??!1,u=h.data?.config?.settings?.storePrivateOnly??!1;let j;return e[24]!==b||e[25]!==h.isLoading||e[26]!==C||e[27]!==_||e[28]!==v||e[29]!==g||e[30]!==S||e[31]!==y||e[32]!==u?(j={registryName:g,registryIcon:C,registryLLMConnectionId:_,registryLLMModelId:v,acceptPublishRequests:b,requireApiToken:S,storePrivateOnly:u,isLoadingConfig:h.isLoading,saveRegistryConfigMutation:y},e[24]=b,e[25]=h.isLoading,e[26]=C,e[27]=_,e[28]=v,e[29]=g,e[30]=S,e[31]=y,e[32]=u,e[33]=j):j=e[33],j}function Yn(t){const e=K.c(11),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:be,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=ge(r);let l;e[2]!==n.id||e[3]!==t?(l=G.publishRequestsListByOrg(n.id,t),e[2]=n.id,e[3]=t,e[4]=l):l=e[4];let a;e[5]!==o||e[6]!==t?(a=async()=>Pe(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t}),e[5]=o,e[6]=t,e[7]=a):a=e[7];let i;return e[8]!==l||e[9]!==a?(i={queryKey:l,queryFn:a,staleTime:3e4,refetchOnMount:!0},e[8]=l,e[9]=a,e[10]=i):i=e[10],Ge(i)}function Hn(){const t=K.c(9),{org:e}=de();let n;t[0]!==e.id?(n={connectionId:be,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=ge(n);let o;t[2]!==e.id?(o=G.publishRequestsCountByOrg(e.id),t[2]=e.id,t[3]=o):o=t[3];let l;t[4]!==r?(l=async()=>Pe(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),t[4]=r,t[5]=l):l=t[5];let a;return t[6]!==o||t[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},t[6]=o,t[7]=l,t[8]=a):a=t[8],Ge(a)}function Wn(){const t=K.c(17),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:G.publishRequests()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async d=>Pe(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",d),t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=Me(c);let x;t[9]!==o?(x=async d=>Pe(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:d}),t[9]=o,t[10]=x):x=t[10];let h;t[11]!==a||t[12]!==x?(h={mutationFn:x,onSuccess:a},t[11]=a,t[12]=x,t[13]=h):h=t[13];const f=Me(h);let p;return t[14]!==f||t[15]!==m?(p={reviewMutation:m,deleteMutation:f},t[14]=f,t[15]=m,t[16]=p):p=t[16],p}function Jn(){const t=K.c(5),{org:e}=de();let n;t[0]!==e.id?(n={connectionId:be,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=ge(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=G.publishApiKeys(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>Pe(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=r,t[4]=l):l=t[4],Ge(l)}function Zn(){const t=K.c(19),e=Be(),{org:n}=de();let r;t[0]!==n.id?(r={connectionId:be,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=ge(r);let l;t[2]!==o?(l=async d=>Pe(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:d}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:G.publishApiKeys()})},t[4]=e,t[5]=a):a=t[5];let i;t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8];const c=Me(i);let m;t[9]!==o?(m=async d=>Pe(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:d}),t[9]=o,t[10]=m):m=t[10];let x;t[11]!==e?(x=async()=>{await e.invalidateQueries({queryKey:G.publishApiKeys()})},t[11]=e,t[12]=x):x=t[12];let h;t[13]!==m||t[14]!==x?(h={mutationFn:m,onSuccess:x},t[13]=m,t[14]=x,t[15]=h):h=t[15];const f=Me(h);let p;return t[16]!==c||t[17]!==f?(p={generateMutation:c,revokeMutation:f},t[16]=c,t[17]=f,t[18]=p):p=t[18],p}function ms(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function us(t){const e=[];let n="",r=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(l==='"'){r&&a==='"'?(n+='"',o+=1):r=!r;continue}if(l===","&&!r){e.push(n.trim()),n="";continue}n+=l}return e.push(n.trim()),e}const Xn=["id","title"],er=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function tr(t){const e=t.split(/\r?\n/).map(m=>m.trim()).filter(Boolean);if(e.length<2)return{items:[],warnings:[{line:0,message:"CSV must have a header row and at least one data row"}],skipped:0};const n=us(e[0]??""),r=new Map,o=[];n.forEach((m,x)=>{const h=m.toLowerCase().trim();h&&r.set(h,x)});for(const m of Xn)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const x=m.toLowerCase().trim();x&&!er.includes(x)&&o.push({line:1,message:`Unknown column "${m}" will be ignored`})}if(!r.has("id")||!r.has("title"))return{items:[],warnings:o,skipped:0};const l=(m,x)=>{const h=r.get(x);return typeof h=="number"?m[h]??"":""},a=[],i=new Set;let c=0;for(let m=1;m<e.length;m+=1){const x=us(e[m]??""),h=l(x,"id").trim(),f=l(x,"title").trim();if(!h){o.push({line:m+1,message:"Missing id — row skipped"}),c+=1;continue}if(!f){o.push({line:m+1,message:`Missing title for id="${h}" — row skipped`}),c+=1;continue}if(i.has(h)){o.push({line:m+1,message:`Duplicate id="${h}" — row skipped`}),c+=1;continue}i.add(h);const p=l(x,"description").trim(),d=l(x,"remote_url").trim(),g=l(x,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",C=ms(l(x,"tags")),_=ms(l(x,"categories")),v=l(x,"is_public").trim().toLowerCase(),b=v==="true"||v==="1"||v==="yes";a.push({id:h,title:f,description:p||null,is_public:b,_meta:{"mcp.mesh":{...C.length>0?{tags:C}:{},..._.length>0?{categories:_}:{}}},server:{name:h,title:f,description:p||void 0,remotes:d?[{type:g,url:d}]:[]}})}return{items:a,warnings:o,skipped:c}}const sr=`id,title,description,remote_url,remote_type,tags,categories,is_public
2
- my-mcp-server,My MCP Server,A useful MCP server,https://example.com/mcp,http,ai|tools,productivity,true
3
- another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function nr(){const t=new Blob([sr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="registry-import-template.csv",n.click(),URL.revokeObjectURL(e)}function rr(t){const e=K.c(63),{open:n,onOpenChange:r,isImporting:o,onImport:l}=t,a=o===void 0?!1:o,[i,c]=M.useState(null),[m,x]=M.useState(null),[h,f]=M.useState(null),p=M.useRef(null);let d;e[0]!==r?(d=ue=>{r(ue),ue||(c(null),x(null),f(null),p.current&&(p.current.value=""))},e[0]=r,e[1]=d):d=e[1];const y=d;let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=async ue=>{if(!ue)return;f(ue.name),x(null);const ve=await ue.text();c(tr(ve))},e[2]=g):g=e[2];const C=g;let _;e[3]!==l||e[4]!==i?(_=async()=>{if(!i?.items.length)return;const ue=await l(i.items);x(ue)},e[3]=l,e[4]=i,e[5]=_):_=e[5];const v=_;let b;e[6]!==i?.items?(b=i?.items??[],e[6]=i?.items,e[7]=b):b=e[7];const S=b;let u;e[8]!==i?.warnings?(u=i?.warnings??[],e[8]=i?.warnings,e[9]=u):u=e[9];const j=u;let k;e[10]!==j?(k=j.some(or),e[10]=j,e[11]=k):k=e[11];const T=k,N=m!==null;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(It,{children:[s.jsx(Mt,{children:"Import MCP Servers from CSV"}),s.jsx(Pt,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=R):R=e[12];let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=()=>p.current?.click(),e[13]=w):w=e[13];let P;e[14]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(cs,{size:14}),e[14]=P):P=e[14];const D=h?"Change file":"Choose CSV file";let I;e[15]!==a||e[16]!==D?(I=s.jsxs(F,{variant:"outline",size:"sm",className:"gap-1.5",onClick:w,disabled:a,children:[P,D]}),e[15]=a,e[16]=D,e[17]=I):I=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("input",{ref:p,type:"file",accept:".csv,text/csv",className:"hidden",onChange:ue=>C(ue.target.files?.[0]??null)}),e[18]=E):E=e[18];let $;e[19]!==h?($=h&&s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:h}),e[19]=h,e[20]=$):$=e[20];let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx("div",{className:"flex-1"}),e[21]=z):z=e[21];let L;e[22]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsxs(F,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:nr,children:[s.jsx(pn,{size:14}),"Download template"]}),e[22]=L):L=e[22];let q;e[23]!==I||e[24]!==$?(q=s.jsxs("div",{className:"flex items-center gap-3",children:[I,E,$,z,L]}),e[23]=I,e[24]=$,e[25]=q):q=e[25];let V;e[26]!==j?(V=j.length>0&&s.jsx("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-950/30 p-3 grid gap-1",children:j.map(ar)}),e[26]=j,e[27]=V):V=e[27];let Y;e[28]!==S||e[29]!==i?(Y=S.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:"Preview"}),s.jsxs(U,{variant:"secondary",children:[S.length," items"]}),i?.skipped?s.jsxs(U,{variant:"outline",className:"text-yellow-600",children:[i.skipped," skipped"]}):null]}),s.jsx("div",{className:"border rounded-lg overflow-hidden",children:s.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:s.jsxs(js,{children:[s.jsx(ys,{children:s.jsxs(Tt,{children:[s.jsx(Ae,{className:"w-[140px]",children:"ID"}),s.jsx(Ae,{children:"Title"}),s.jsx(Ae,{children:"Remote URL"}),s.jsx(Ae,{className:"w-[80px] text-center",children:"Public"}),s.jsx(Ae,{children:"Tags"})]})}),s.jsx(bs,{children:S.map(lr)})]})})})]}),e[28]=S,e[29]=i,e[30]=Y):Y=e[30];let X;e[31]!==m?(X=m&&s.jsxs("div",{className:"rounded-lg border p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(bt,{size:16,className:"text-emerald-600"}),"Imported ",m.created," item(s) successfully"]}),m.errors.length>0&&s.jsx("div",{className:"grid gap-1 mt-1",children:m.errors.map(ir)})]}),e[31]=m,e[32]=X):X=e[32];let Z;e[33]!==N||e[34]!==i?(Z=!i&&!N&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(cs,{size:32,className:"text-muted-foreground/40 mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a CSV file or download the template to get started."}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Required columns: ",s.jsx("code",{children:"id"}),", ",s.jsx("code",{children:"title"}),". Optional:"," ",s.jsx("code",{children:"description"}),", ",s.jsx("code",{children:"remote_url"}),","," ",s.jsx("code",{children:"remote_type"}),", ",s.jsx("code",{children:"tags"}),","," ",s.jsx("code",{children:"categories"}),", ",s.jsx("code",{children:"is_public"}),"."]}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Use ",s.jsx("code",{children:"|"})," or ",s.jsx("code",{children:";"})," to separate multiple tags/categories within a cell."]})]}),e[33]=N,e[34]=i,e[35]=Z):Z=e[35];let te;e[36]!==q||e[37]!==V||e[38]!==Y||e[39]!==X||e[40]!==Z?(te=s.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[q,V,Y,X,Z]}),e[36]=q,e[37]=V,e[38]=Y,e[39]=X,e[40]=Z,e[41]=te):te=e[41];let se;e[42]!==y?(se=()=>y(!1),e[42]=y,e[43]=se):se=e[43];const he=N?"Done":"Cancel";let re;e[44]!==se||e[45]!==he?(re=s.jsx(F,{variant:"outline",onClick:se,children:he}),e[44]=se,e[45]=he,e[46]=re):re=e[46];let ae;e[47]!==v||e[48]!==T||e[49]!==N||e[50]!==a||e[51]!==S.length?(ae=!N&&s.jsx(F,{onClick:v,disabled:a||S.length===0||T,children:a?"Importing...":`Import ${S.length} item(s)`}),e[47]=v,e[48]=T,e[49]=N,e[50]=a,e[51]=S.length,e[52]=ae):ae=e[52];let oe;e[53]!==re||e[54]!==ae?(oe=s.jsxs(Et,{className:"gap-2 sm:gap-0",children:[re,ae]}),e[53]=re,e[54]=ae,e[55]=oe):oe=e[55];let me;e[56]!==te||e[57]!==oe?(me=s.jsxs(Dt,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[R,te,oe]}),e[56]=te,e[57]=oe,e[58]=me):me=e[58];let ce;return e[59]!==y||e[60]!==n||e[61]!==me?(ce=s.jsx($t,{open:n,onOpenChange:y,children:me}),e[59]=y,e[60]=n,e[61]=me,e[62]=ce):ce=e[62],ce}function ir(t){return s.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[s.jsx(jt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono",children:t.id}),": ",t.error]})]},t.id)}function lr(t){return s.jsxs(Tt,{children:[s.jsx(Le,{className:"font-mono text-xs",children:t.id}),s.jsx(Le,{className:"text-sm",children:t.title}),s.jsx(Le,{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:t.server.remotes?.[0]?.url??s.jsx("span",{className:"italic",children:"none"})}),s.jsx(Le,{className:"text-center",children:t.is_public?s.jsx(U,{variant:"secondary",className:"text-[10px] bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:"Yes"}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"No"})}),s.jsx(Le,{className:"text-xs text-muted-foreground",children:(t._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},t.id)}function ar(t,e){return s.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 flex items-start gap-1.5",children:[s.jsx(jt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[t.line>0&&s.jsxs("span",{className:"font-mono text-[10px] mr-1",children:["Line ",t.line,":"]}),t.message]})]},`${t.line}-${e}`)}function or(t){return t.message.startsWith("Missing required column:")}function cr(t){const e=K.c(19),{open:n,onOpenChange:r,title:o,isDeleting:l,onConfirm:a}=t,i=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Lt,{children:"Delete registry item?"}),e[0]=c):c=e[0];let m;e[1]!==o?(m=s.jsxs(zt,{children:[c,s.jsxs(Ot,{children:["This action cannot be undone. Item ",s.jsx("strong",{children:o})," will be permanently removed from this private registry."]})]}),e[1]=o,e[2]=m):m=e[2];let x;e[3]!==i?(x=s.jsx(Ut,{disabled:i,children:"Cancel"}),e[3]=i,e[4]=x):x=e[4];const h=i?"Deleting...":"Delete";let f;e[5]!==i||e[6]!==a||e[7]!==h?(f=s.jsx(qt,{disabled:i,onClick:a,children:h}),e[5]=i,e[6]=a,e[7]=h,e[8]=f):f=e[8];let p;e[9]!==x||e[10]!==f?(p=s.jsxs(Ft,{children:[x,f]}),e[9]=x,e[10]=f,e[11]=p):p=e[11];let d;e[12]!==m||e[13]!==p?(d=s.jsxs(Bt,{children:[m,p]}),e[12]=m,e[13]=p,e[14]=d):d=e[14];let y;return e[15]!==r||e[16]!==n||e[17]!==d?(y=s.jsx(Gt,{open:n,onOpenChange:r,children:d}),e[15]=r,e[16]=n,e[17]=d,e[18]=y):y=e[18],y}function dr(t){const[e]=t.id.split("/");return e??"provider"}function mr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function ur(t){return t._meta?.["mcp.mesh"]?.categories??[]}function xr(t){return t.server?.icons?.[0]?.src??null}function hr(t){const e=K.c(56),{item:n,onEdit:r,onDelete:o}=t;let l;e[0]!==n?(l=xr(n),e[0]=n,e[1]=l):l=e[1];const a=l;let i;e[2]!==n?(i=[...mr(n),...ur(n)],e[2]=n,e[3]=i):i=e[3];const c=i;let m;e[4]!==c?(m=c.slice(0,3),e[4]=c,e[5]=m):m=e[5];const x=m,h=Math.max(0,c.length-x.length);let f;e[6]!==a||e[7]!==n.title?(f=s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:a?s.jsx("img",{src:a,alt:n.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:n.title.charAt(0).toUpperCase()})}),e[6]=a,e[7]=n.title,e[8]=f):f=e[8];let p;e[9]!==n.title?(p=s.jsx("p",{className:"font-medium truncate",children:n.title}),e[9]=n.title,e[10]=p):p=e[10];let d;e[11]!==n?(d=dr(n),e[11]=n,e[12]=d):d=e[12];let y;e[13]!==d?(y=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:d}),e[13]=d,e[14]=y):y=e[14];let g;e[15]!==n.is_public?(g=n.is_public?s.jsxs(U,{variant:"default",className:"gap-1",children:[s.jsx(vs,{size:10}),"Public"]}):s.jsx(U,{variant:"secondary",children:"Private"}),e[15]=n.is_public,e[16]=g):g=e[16];let C;e[17]!==y||e[18]!==g?(C=s.jsxs("div",{className:"flex items-center gap-2",children:[y,g]}),e[17]=y,e[18]=g,e[19]=C):C=e[19];let _;e[20]!==p||e[21]!==C?(_=s.jsxs("div",{className:"min-w-0 flex-1",children:[p,C]}),e[20]=p,e[21]=C,e[22]=_):_=e[22];let v;e[23]!==_||e[24]!==f?(v=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[f,_]}),e[23]=_,e[24]=f,e[25]=v):v=e[25];let b;e[26]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(kt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),e[26]=b):b=e[26];let S;e[27]!==n||e[28]!==r?(S=s.jsx(We,{onClick:()=>r(n),children:"Edit"}),e[27]=n,e[28]=r,e[29]=S):S=e[29];let u;e[30]!==n||e[31]!==o?(u=()=>o(n),e[30]=n,e[31]=o,e[32]=u):u=e[32];let j;e[33]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(vt,{size:14}),e[33]=j):j=e[33];let k;e[34]!==u?(k=s.jsxs(We,{variant:"destructive",onClick:u,children:[j,"Delete"]}),e[34]=u,e[35]=k):k=e[35];let T;e[36]!==S||e[37]!==k?(T=s.jsxs(St,{children:[b,s.jsxs(Rt,{align:"end",children:[S,k]})]}),e[36]=S,e[37]=k,e[38]=T):T=e[38];let N;e[39]!==v||e[40]!==T?(N=s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v,T]}),e[39]=v,e[40]=T,e[41]=N):N=e[41];const R=n._meta?.["mcp.mesh"]?.short_description||n.description||n.server.description||"No description provided.";let w;e[42]!==R?(w=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:R}),e[42]=R,e[43]=w):w=e[43];let P;e[44]!==n.id||e[45]!==x?(P=x.map($=>s.jsx(U,{variant:"secondary",children:$},`${n.id}-badge-${$}`)),e[44]=n.id,e[45]=x,e[46]=P):P=e[46];let D;e[47]!==h?(D=h>0&&s.jsxs(U,{variant:"outline",children:["+",h]}),e[47]=h,e[48]=D):D=e[48];let I;e[49]!==P||e[50]!==D?(I=s.jsxs("div",{className:"flex flex-wrap gap-1",children:[P,D]}),e[49]=P,e[50]=D,e[51]=I):I=e[51];let E;return e[52]!==N||e[53]!==w||e[54]!==I?(E=s.jsxs(ne,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[N,w,I]}),e[52]=N,e[53]=w,e[54]=I,e[55]=E):E=e[55],E}function zs(t){const e=K.c(27),{value:n,onChange:r,onFileUpload:o,error:l,isUploading:a}=t,i=a===void 0?!1:a,[c,m]=M.useState(!1),[x,h]=M.useState(!1),f=M.useRef(null);let p;e[0]!==i?(p=R=>{R.preventDefault(),i||m(!0)},e[0]=i,e[1]=p):p=e[1];const d=p;let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=R=>{R.preventDefault(),m(!1)},e[2]=y):y=e[2];const g=y;let C;e[3]!==i||e[4]!==o?(C=async R=>{if(R.preventDefault(),m(!1),i)return;const w=R.dataTransfer.files[0];w&&await o(w)},e[3]=i,e[4]=o,e[5]=C):C=e[5];const _=C;let v;e[6]!==i||e[7]!==o?(v=async R=>{const w=R.target.files?.[0];w&&!i&&await o(w),R.target.value=""},e[6]=i,e[7]=o,e[8]=v):v=e[8];const b=v,S=n.length>0;let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ie,{children:"Image"}),e[9]=u):u=e[9];let j;e[10]!==d||e[11]!==_||e[12]!==S||e[13]!==c||e[14]!==i||e[15]!==r||e[16]!==x||e[17]!==n?(j=S?s.jsx("div",{className:"relative group min-h-[180px] rounded-xl border border-border overflow-hidden bg-muted/10",children:s.jsxs("div",{className:"flex items-center gap-3 p-3 h-full",children:[s.jsx("div",{className:"size-20 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0",children:s.jsx("img",{src:n,alt:"Preview",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>f.current?.click(),disabled:i,children:[s.jsx(es,{className:"size-3"}),"Change"]}),s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{r(""),h(!1)},disabled:i,children:[s.jsx(vt,{className:"size-3"}),"Remove"]})]})]})]})}):i?s.jsxs("div",{className:"relative min-h-[180px] rounded-xl border border-border bg-muted/10 flex flex-col items-center justify-center gap-3",children:[s.jsx(mt,{className:"size-8 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):s.jsxs("div",{className:J("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",c?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:d,onDragLeave:g,onDrop:_,onClick:()=>f.current?.click(),children:[s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6 px-4 flex-1",children:[s.jsx("div",{className:J("size-10 rounded-lg flex items-center justify-center transition-colors",c?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:s.jsx(Ps,{size:20})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:c?"Drop image here":"Click or drag to upload"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"PNG, JPG, SVG up to 2MB"})]})]}),x?s.jsx("div",{className:"border-t border-border px-3 py-2",onClick:pr,children:s.jsx(ye,{placeholder:"https://example.com/logo.png",value:n,className:"text-xs h-8",onChange:R=>r(R.target.value)})}):s.jsx("div",{className:"border-t border-border px-4 py-2",children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-full justify-center",onClick:R=>{R.stopPropagation(),h(!0)},children:[s.jsx(Es,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=d,e[11]=_,e[12]=S,e[13]=c,e[14]=i,e[15]=r,e[16]=x,e[17]=n,e[18]=j):j=e[18];let k;e[19]!==b?(k=s.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:b}),e[19]=b,e[20]=k):k=e[20];let T;e[21]!==l?(T=l&&s.jsx("p",{className:"text-xs text-destructive",children:l}),e[21]=l,e[22]=T):T=e[22];let N;return e[23]!==j||e[24]!==k||e[25]!==T?(N=s.jsxs("div",{className:"grid gap-1.5",children:[u,j,k,T]}),e[23]=j,e[24]=k,e[25]=T,e[26]=N):N=e[26],N}function pr(t){return t.stopPropagation()}function Os(){const[t,e]=M.useState("idle"),[n,r]=M.useState(null),{org:o}=de(),l=ge({connectionId:be,orgId:o.id});return{discover:async(c,m)=>{if(!c)return null;e("loading"),r(null);try{const x=await l.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:c,type:m==="sse"?"sse":"http"}}),h=x.structuredContent??x;if(x.isError){const f=x.content?.find(p=>p.type==="text")?.text??"Tool returned an error";return r(f),e("error"),null}return h.error?fr(h.error)?(r(h.error),e("auth_required"),null):(r(h.error),e("error"),null):!h.tools||h.tools.length===0?(r("No tools found on this MCP server."),e("error"),null):(e("success"),h.tools)}catch(x){const h=x instanceof Error?x.message:String(x);return r(h||"Could not discover tools."),e("error"),null}},discoverStatus:t,discoverError:n,resetDiscover:()=>{e("idle"),r(null)}}}function fr(t){const e=t.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function gr(t){const e=K.c(54),{tools:n,onChange:r,remoteUrl:o,remoteType:l,externalDiscoverStatus:a,externalDiscoverError:i}=t,[c,m]=M.useState(n.length>0),{discover:x,discoverStatus:h,discoverError:f,resetDiscover:p}=Os(),d=a??h,y=i??f;let g;e[0]!==x||e[1]!==r||e[2]!==l||e[3]!==o?(g=async()=>{if(!o)return;const L=await x(o,l??"http");L&&(r(L),m(!0))},e[0]=x,e[1]=r,e[2]=l,e[3]=o,e[4]=g):g=e[4];const C=g;let _;e[5]!==r||e[6]!==p?(_=()=>{r([]),p()},e[5]=r,e[6]=p,e[7]=_):_=e[7];const v=_;let b;e[8]!==c?(b=()=>m(!c),e[8]=c,e[9]=b):b=e[9];let S,u;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ts,{size:14,className:"text-muted-foreground"}),u=s.jsx("span",{children:"Tools"}),e[10]=S,e[11]=u):(S=e[10],u=e[11]);let j;e[12]!==n.length?(j=n.length>0&&s.jsx(U,{variant:"secondary",className:"text-xs px-1.5 py-0",children:n.length}),e[12]=n.length,e[13]=j):j=e[13];let k;e[14]!==c?(k=c?s.jsx(fn,{size:14,className:"text-muted-foreground"}):s.jsx(Ss,{size:14,className:"text-muted-foreground"}),e[14]=c,e[15]=k):k=e[15];let T;e[16]!==b||e[17]!==j||e[18]!==k?(T=s.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:b,children:[S,u,j,k]}),e[16]=b,e[17]=j,e[18]=k,e[19]=T):T=e[19];let N;e[20]!==v||e[21]!==n.length?(N=n.length>0&&s.jsxs(F,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:v,children:[s.jsx(vt,{size:12}),"Clear"]}),e[20]=v,e[21]=n.length,e[22]=N):N=e[22];let R;e[23]!==d||e[24]!==C||e[25]!==o||e[26]!==n.length?(R=o&&s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all",onClick:C,disabled:d==="loading",children:[d==="loading"?s.jsx(mt,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),d==="loading"?"Discovering...":n.length>0?"Refresh":"Auto-discover"]}),e[23]=d,e[24]=C,e[25]=o,e[26]=n.length,e[27]=R):R=e[27];let w;e[28]!==R||e[29]!==N?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[N,R]}),e[28]=R,e[29]=N,e[30]=w):w=e[30];let P;e[31]!==w||e[32]!==T?(P=s.jsxs("div",{className:"flex items-center justify-between",children:[T,w]}),e[31]=w,e[32]=T,e[33]=P):P=e[33];let D;e[34]!==d||e[35]!==n.length?(D=d==="success"&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-950/30 rounded-lg px-3 py-2",children:[s.jsx(bt,{size:14,className:"shrink-0"}),s.jsxs("span",{children:["Discovered ",n.length," tool",n.length!==1?"s":""," ","successfully."]})]}),e[34]=d,e[35]=n.length,e[36]=D):D=e[36];let I;e[37]!==y||e[38]!==d?(I=d==="error"&&y&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(jt,{size:14,className:"shrink-0"}),s.jsx("span",{children:y})]}),e[37]=y,e[38]=d,e[39]=I):I=e[39];let E;e[40]!==c||e[41]!==n?(E=c&&n.length>0&&s.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:n.map(jr)}),e[40]=c,e[41]=n,e[42]=E):E=e[42];let $;e[43]!==d||e[44]!==c||e[45]!==o||e[46]!==n.length?($=c&&n.length===0&&d==="idle"&&s.jsx("p",{className:"text-xs text-muted-foreground px-1",children:o?'Click "Auto-discover" to load tools from the MCP server.':"Add a Remote URL first, then tools can be auto-discovered."}),e[43]=d,e[44]=c,e[45]=o,e[46]=n.length,e[47]=$):$=e[47];let z;return e[48]!==P||e[49]!==D||e[50]!==I||e[51]!==E||e[52]!==$?(z=s.jsxs("div",{className:"space-y-3",children:[P,D,I,E,$]}),e[48]=P,e[49]=D,e[50]=I,e[51]=E,e[52]=$,e[53]=z):z=e[53],z}function jr(t){return s.jsx("div",{className:"flex items-center gap-3 px-3 py-2",children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-mono truncate",children:t.name}),t.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.description})]})},t.name)}function Us(t){const{org:e}=de(),[n,r]=M.useState(!1),l=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,a=ge({connectionId:l??"noop",orgId:e.id});return{uploadImage:async(c,m)=>{if(!l)return W.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!c.type.startsWith("image/"))return W.error("Only image files are supported"),null;if(c.size>5*1024*1024)return W.error("Image size must be less than 5MB"),null;r(!0);try{const x=await a.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:m,contentType:c.type}}),h=x.structuredContent?.url||x.url;if(!h)throw new Error("Failed to get presigned URL");const f=await fetch(h,{method:"PUT",body:c,headers:{"Content-Type":c.type}});if(!f.ok)throw new Error(`Upload failed: ${f.statusText}`);const p=await a.callTool({name:"GET_PRESIGNED_URL",arguments:{key:m,expiresIn:31536e3}}),d=p.structuredContent?.url||p.url;if(!d)throw new Error("Failed to get public URL");return d}catch(x){return console.error("Image upload failed:",x),W.error(x instanceof Error?x.message:"Failed to upload image. Please try again."),null}finally{r(!1)}},isUploading:n}}function yr(){const{org:t}=de(),[e,n]=M.useState(null),r=M.useRef(0),o=ge({connectionId:be,orgId:t.id});return{generate:async a=>{r.current+=1,n(a.type);try{const i=await o.callTool({name:"REGISTRY_AI_GENERATE",arguments:a});if(i.isError){const c=i.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(c)}return i.structuredContent??i}finally{r.current-=1,r.current===0&&n(null)}},loadingType:e,isGenerating:e!==null}}const br=new Set(["http","sse","stdio"]),vr=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,xs=["internal","automation","support","sales","ops","ai"],qs=["productivity","communication","customer-support","development","data","operations"],Nr=["Essentials","Details","Advanced"],ht="h-7 text-xs border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all";function hs(t){return t.replace(/^https?:\/\//i,"").trim()}function pt(t){const e=t.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function lt(t){return t.trim().toLowerCase()}function yt(t){return Array.from(new Set(t.map(lt).filter(e=>e.length>0)))}function dt(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function wr(t){const e=K.c(4),{current:n}=t;let r;e[0]!==n?(r=Nr.map((l,a)=>{const i=a+1,c=i===n,m=i<n;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[a>0&&s.jsx("div",{className:J("w-4 h-px",m?"bg-primary":"bg-border")}),s.jsxs("div",{className:J("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",c?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[s.jsx("span",{className:J("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",c?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:i}),s.jsx("span",{className:"hidden sm:inline",children:l})]})]},l)}),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center gap-1.5",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Cr(t){const e=K.c(28),{id:n,label:r,values:o,availableOptions:l,placeholder:a,onChange:i}=t,[c,m]=M.useState(""),[x,h]=M.useState(!1);let f,p,d,y,g;if(e[0]!==l||e[1]!==n||e[2]!==c||e[3]!==x||e[4]!==r||e[5]!==i||e[6]!==a||e[7]!==o){const v=yt(l),b=yt(o),S=new Set(b),u=lt(c),j=v.filter(I=>!S.has(I)).filter(I=>u?I.includes(u):!0).slice(0,8),k=I=>{const E=lt(I);!E||S.has(E)||i([...b,E])},T=I=>{i(b.filter(E=>E!==I))},N=()=>{const I=c.split(/[,\n;]/).map(lt).filter(Boolean);if(I.length===0)return;const E=[...b];for(const $ of I)E.includes($)||E.push($);i(E),m("")},R=u;y="grid gap-2",e[13]!==n||e[14]!==r?(g=s.jsx(ie,{htmlFor:n,children:r}),e[13]=n,e[14]=r,e[15]=g):g=e[15],f="relative";let w;e[16]!==n?(w=()=>{const I=document.getElementById(n);I instanceof HTMLInputElement&&I.focus()},e[16]=n,e[17]=w):w=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=()=>h(!0),e[18]=P):P=e[18];let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=I=>m(I.target.value),e[19]=D):D=e[19],p=s.jsx("div",{className:"min-h-9 w-full rounded-xl border border-input bg-background px-2.5 py-1.5 text-sm focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",onClick:w,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[b.map(I=>s.jsxs(U,{variant:"secondary",className:"gap-1",children:[I,s.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),T(I)},children:s.jsx(bn,{size:12})})]},`${n}-${I}`)),s.jsx("input",{id:n,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:b.length?"":a,value:c,onFocus:P,onBlur:()=>{h(!1),N()},onChange:D,onKeyDown:I=>{if(I.key==="Enter"||I.key===","){I.preventDefault(),N();return}I.key==="Backspace"&&!c&&b.length&&T(b[b.length-1]??"")}})]})}),d=x&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:j.length>0?j.map(I=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:kr,onClick:()=>{k(I),m("")},children:I},`${n}-suggestion-${I}`)):R?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:_r,onClick:()=>{k(R),m("")},children:['Create "',R,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})}),e[0]=l,e[1]=n,e[2]=c,e[3]=x,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=f,e[9]=p,e[10]=d,e[11]=y,e[12]=g}else f=e[8],p=e[9],d=e[10],y=e[11],g=e[12];let C;e[20]!==f||e[21]!==p||e[22]!==d?(C=s.jsxs("div",{className:f,children:[p,d]}),e[20]=f,e[21]=p,e[22]=d,e[23]=C):C=e[23];let _;return e[24]!==y||e[25]!==g||e[26]!==C?(_=s.jsxs("div",{className:y,children:[g,C]}),e[24]=y,e[25]=g,e[26]=C,e[27]=_):_=e[27],_}function _r(t){return t.preventDefault()}function kr(t){return t.preventDefault()}function Sr({id:t,value:e,availableOptions:n,onChange:r}){const[o,l]=M.useState(e),[a,i]=M.useState(!1),c=M.useRef(e);c.current!==e&&(c.current=e,l(e));const m=yt([...qs,...n,e]).filter(Boolean),x=lt(o),h=m.filter(p=>x?p.includes(x):!0).slice(0,8),f=p=>{const d=lt(p);r(d),l(d),i(!1)};return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(ie,{htmlFor:t,children:"Category"}),s.jsxs("div",{className:"relative",children:[s.jsx(ye,{id:t,className:"h-9 text-sm",placeholder:"Select or create category",value:o,onFocus:()=>{l(e),i(!0)},onBlur:()=>{f(o)},onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),f(o))}}),e&&s.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground hover:text-foreground",onMouseDown:p=>p.preventDefault(),onClick:()=>{r(""),l("")},children:"clear"}),a&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:h.length>0?h.map(p=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:d=>d.preventDefault(),onClick:()=>f(p),children:p},`${t}-${p}`)):x?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:p=>p.preventDefault(),onClick:()=>f(x),children:['Create "',x,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})})]})]})}function Rr({open:t,onOpenChange:e,item:n,draft:r,availableTags:o=[],availableCategories:l=[],defaultLLMConnectionId:a="",defaultLLMModelId:i="",isSubmitting:c=!1,onSubmit:m}){const{org:x}=de(),{uploadImage:h,isUploading:f}=Us(),{generate:p,loadingType:d}=yr(),{discover:y,discoverStatus:g,discoverError:C,resetDiscover:_}=Os(),v=!!n,b=r?._meta?.["mcp.mesh"],S=n?.title??r?.title??"",u=n?.id?.split("/")[0]??r?.id?.split("/")[0]??"",j=n?.description??r?.description??"",k=n?._meta?.["mcp.mesh"]?.short_description??b?.short_description??"",T=n?._meta?.["mcp.mesh"]?.owner??b?.owner??"",N=n?.server?.repository?.url??r?.server?.repository?.url??"",R=n?._meta?.["mcp.mesh"]?.readme??b?.readme??"",w=n?._meta?.["mcp.mesh"]?.readme_url??b?.readme_url??"",P=hs(n?.server?.remotes?.[0]?.url??r?.server?.remotes?.[0]?.url??""),D=n?.server?.remotes?.[0]?.type??r?.server?.remotes?.[0]?.type??"http",I=n?._meta?.["mcp.mesh"]?.tags??b?.tags??[],E=n?._meta?.["mcp.mesh"]?.categories?.[0]??b?.categories?.[0]??"",$=n?.server?.icons?.[0]?.src??r?.server?.icons?.[0]?.src??"",z=n?._meta?.["mcp.mesh"]?.tools??b?.tools??[],L=n?.is_public??r?.is_public??!1,[q,V]=M.useState(1),[Y,X]=M.useState(S),[Z,te]=M.useState(u),[se,he]=M.useState(j),[re,ae]=M.useState(k),[oe,me]=M.useState(T),[ce,ue]=M.useState(N),[ve,Se]=M.useState(R),[je,Ie]=M.useState(w),[xe,Ne]=M.useState(R?"content":"link"),[le,_e]=M.useState(P),[H,fe]=M.useState(D),[Re,O]=M.useState(I),[ee,Te]=M.useState(E),[we,Ue]=M.useState($),[Ce,Je]=M.useState(z),[Ze,at]=M.useState(L),[pe,Oe]=M.useState({}),Ee=!!(a&&i),Xe=()=>{V(1),X(S),te(u),he(j),ae(k),me(T),ue(N),Se(R),Ie(w),Ne(R?"content":"link"),_e(P),fe(D),O(I),Te(E),Ue($),Je(z),at(L),Oe({}),_(),qe.current="",De.current&&(clearTimeout(De.current),De.current=null)},ut=async A=>{if(!A)return;const B=v?n?.id:`${Z}/${Y}`.toLowerCase(),$e=dt(B||"temp"),Ve=A.name.split(".").pop()||"png",Ye=`registry/${x.id}/${$e}/icon.${Ve}`,ct=await h(A,Ye);ct?(Ue(ct),Oe(He=>({...He,imageUrl:void 0}))):Oe(He=>({...He,imageUrl:"Failed to upload image. Please try again."}))},De=M.useRef(null),qe=M.useRef(""),tt=M.useRef(H);tt.current=H;const ot=A=>{!A&&De.current&&(clearTimeout(De.current),De.current=null),e(A),A||Xe()},st=async()=>{const A=pt(le);if(!A)return;qe.current=A;const B=await y(A,tt.current);B&&Je(B)},nt=A=>{De.current&&clearTimeout(De.current);const B=pt(A);!B||B===qe.current||A.includes(".")&&(De.current=setTimeout(async()=>{qe.current=B;const $e=await y(B,tt.current);$e&&Je($e)},800))},Qe=()=>Ee?{llmConnectionId:a,modelId:i}:null,Ke=()=>({name:Y.trim(),provider:Z.trim(),url:pt(le),owner:oe.trim(),repositoryUrl:ce.trim(),description:se.trim(),shortDescription:re.trim(),tags:Re,categories:ee?[ee]:[],availableTags:[...xs,...o],availableCategories:[...qs,...l],tools:Ce}),rt=async()=>{const A=Qe();if(!A)return;const B=await p({...A,type:"description",context:Ke()});B.result&&he(B.result.slice(0,1500))},it=async()=>{const A=Qe();if(!A)return;const B=await p({...A,type:"short_description",context:Ke()});B.result&&ae(B.result.slice(0,160))},Q=async()=>{const A=Qe();if(!A)return;const B=await p({...A,type:"tags",context:Ke()});B.items?.length&&O(yt(B.items))},ke=async()=>{const A=Qe();if(!A)return;const B=await p({...A,type:"categories",context:Ke()});B.items?.[0]&&Te(lt(B.items[0]))},xt=async()=>{const A=Qe();if(!A)return;const B=await p({...A,type:"readme",context:Ke()});B.result&&(Se(B.result.slice(0,5e4)),Ne("content"))},rs=A=>{const B={};if(A===1){const $e=dt(Z),Ve=dt(Y),Ye=`${$e}/${Ve}`;Y.trim()||(B.title="Name is required."),v||($e?Ve?vr.test(Ye)||(B.provider="Use lowercase letters/numbers and separators '/' or '-'."):B.title="Name must contain valid characters.":B.provider="Provider is required.");const ct=pt(le),He=H.trim().toLowerCase();if(He!=="stdio"&&ct)try{const ft=new URL(ct);["http:","https:"].includes(ft.protocol)||(B.remoteUrl="Remote URL must be http(s).")}catch{B.remoteUrl="Remote URL is invalid."}if(He&&!br.has(He)&&(B.remoteType="Remote type must be: http, sse or stdio."),we.trim()&&!we.trim().startsWith("data:image/"))try{const Vt=new URL(we.trim());["http:","https:"].includes(Vt.protocol)||(B.imageUrl="Image URL must be http(s).")}catch{B.imageUrl="Image URL is invalid."}}if(A===2&&(se.length>1500&&(B.description="Description must be 1500 characters or less."),re.trim().length>160&&(B.shortDescription="Short description must be 160 characters or less.")),A===3){const $e=je.trim();if($e)try{const Ye=new URL($e);["http:","https:"].includes(Ye.protocol)||(B.readmeUrl="README URL must be http(s).")}catch{B.readmeUrl="README URL is invalid."}ve.trim().length>5e4&&(B.readme="README must be 50 000 characters or less.");const Ve=ce.trim();if(Ve)try{const Ye=new URL(Ve);["http:","https:"].includes(Ye.protocol)||(B.repositoryUrl="Repository URL must be http(s).")}catch{B.repositoryUrl="Repository URL is invalid."}}return Oe(B),Object.values(B).every($e=>$e===void 0)},Vs=()=>{rs(q)&&q<3&&V(q+1)},Ys=()=>{q>1&&V(q-1)},Hs=async()=>{if(!rs(3))return;const A=Y.trim(),B=dt(Z),$e=dt(A),Ve=`${B}/${$e}`,Ye=pt(le),ct=H.trim().toLowerCase(),He=we.trim(),ft=ce.trim(),Vt=re.trim(),Xs=ve.trim(),en=je.trim(),tn=yt(Re),sn=ee?[lt(ee)]:[],nn=n?n.server?.name??n.id:"",rn=(v?nn:Ve).trim(),Yt=se.trim(),ln=oe.trim(),is={title:A,description:Yt.length>0?Yt:null,is_public:Ze,_meta:{"mcp.mesh":{tags:tn,categories:sn,short_description:Vt||null,owner:ln||null,readme:Xs||null,readme_url:en||null,...Ce.length>0?{tools:Ce}:{}}},server:{name:rn,title:A,description:Yt||void 0,icons:He?[{src:He}]:[],repository:ft?{url:ft}:void 0,remotes:Ye?[{type:ct||"http",url:Ye}]:[]}};if(v&&n){await m({id:n.id,data:is}),e(!1);return}await m({id:Ve,...is}),e(!1),Xe()},Ws=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"row-span-2 grid gap-3 content-start",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"registry-item-provider",children:"Provider"}),s.jsx(ye,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:Z,onChange:A=>te(A.target.value),disabled:v}),!v&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",s.jsx("span",{className:"font-mono",children:`${dt(Z)||"provider"}/${dt(Y)||"name"}`})]}),pe.provider&&s.jsx("p",{className:"text-xs text-destructive",children:pe.provider})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"registry-item-title",children:"Name"}),s.jsx(ye,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:Y,onChange:A=>X(A.target.value)}),pe.title&&s.jsx("p",{className:"text-xs text-destructive",children:pe.title})]})]}),s.jsx("div",{className:"row-span-2 content-start",children:s.jsx(zs,{value:we,onChange:A=>{Ue(A),Oe(B=>({...B,imageUrl:void 0}))},onFileUpload:ut,error:pe.imageUrl,isUploading:f})}),s.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[s.jsx(ie,{htmlFor:"registry-remote-url",children:"Remote URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex-1 flex items-center rounded-xl border border-input px-3",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground mr-1",children:"https://"}),s.jsx("input",{id:"registry-remote-url",className:"flex-1 h-9 bg-transparent outline-none text-sm",placeholder:"example.com/mcp",value:le,onChange:A=>{const B=hs(A.target.value);_e(B),nt(B)}})]}),s.jsxs(ws,{value:H,onValueChange:fe,children:[s.jsx(Cs,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:s.jsx(_s,{placeholder:"Type"})}),s.jsxs(ks,{children:[s.jsx(Ct,{value:"http",children:"http"}),s.jsx(Ct,{value:"sse",children:"sse"}),s.jsx(Ct,{value:"stdio",children:"stdio"})]})]})]}),pe.remoteUrl&&s.jsx("p",{className:"text-xs text-destructive",children:pe.remoteUrl}),pe.remoteType&&s.jsx("p",{className:"text-xs text-destructive",children:pe.remoteType})]}),le.trim()&&s.jsxs("div",{className:"col-span-2 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:J(ht,"gap-1.5"),onClick:st,disabled:g==="loading",children:[g==="loading"?s.jsx(mt,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),g==="loading"?"Discovering tools...":Ce.length>0?"Re-discover tools":"Discover tools from URL"]}),Ce.length>0&&g!=="loading"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ce.length," tool",Ce.length!==1?"s":""," loaded"]})]}),g==="success"&&Ce.length>0&&s.jsxs("div",{className:"rounded-lg border border-green-500/20 bg-green-50 dark:bg-green-950/20 px-3 py-2 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400",children:[s.jsx(bt,{size:14,className:"shrink-0"}),s.jsxs("span",{className:"font-medium",children:[Ce.length," tool",Ce.length!==1?"s":""," discovered"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[Ce.slice(0,8).map(A=>s.jsx(U,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:A.name},A.name)),Ce.length>8&&s.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",Ce.length-8," more"]})]}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"These tools will enrich AI-generated descriptions, tags and categories in the next step."})]}),g==="auth_required"&&C&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 border border-amber-500/20 rounded-lg px-3 py-2",children:[s.jsx(jt,{size:14,className:"shrink-0"}),s.jsx("span",{children:"This server requires authentication. The connection is valid but tools cannot be listed without credentials."})]}),g==="error"&&C&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(jt,{size:14,className:"shrink-0"}),s.jsx("span",{children:C})]})]})]}),Js=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ie,{htmlFor:"registry-item-short-description",children:"Short Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[re.length,"/160"]}),Ee&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="short_description",onClick:it,children:d==="short_description"?"Generating...":"AI Generate"})]})]}),s.jsx(ye,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:re,maxLength:160,onChange:A=>ae(A.target.value)}),pe.shortDescription&&s.jsx("p",{className:"text-xs text-destructive",children:pe.shortDescription})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ie,{htmlFor:"registry-item-description",children:"Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[se.length,"/1500"]}),Ee&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="description",onClick:rt,children:d==="description"?"Generating...":"AI Generate"})]})]}),s.jsx(At,{id:"registry-item-description",className:"text-sm max-h-28 overflow-y-auto resize-none",placeholder:"Brief description of this MCP server",rows:2,value:se,onChange:A=>he(A.target.value)}),pe.description&&s.jsx("p",{className:"text-xs text-destructive",children:pe.description})]}),s.jsx("div",{className:"border-t border-border"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Sr,{id:"registry-category",value:ee,availableOptions:l,onChange:Te}),Ee&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:J(ht,"justify-self-start"),disabled:d==="categories",onClick:ke,children:d==="categories"?"Suggesting...":"AI Suggest"})]}),s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Cr,{id:"registry-tags",label:"Tags",values:Re,availableOptions:[...xs,...o],placeholder:"Type and press Enter or comma",onChange:O}),Ee&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:J(ht,"justify-self-start"),disabled:d==="tags",onClick:Q,children:d==="tags"?"Suggesting...":"AI Suggest"})]})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx(ie,{htmlFor:"registry-is-public",className:"text-sm",children:"Public"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Make this MCP visible in the public store URL."})]}),s.jsx(_t,{id:"registry-is-public",checked:Ze,onCheckedChange:at})]})]}),Zs=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),s.jsx(ye,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:oe,onChange:A=>me(A.target.value)})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),s.jsx(ye,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:ce,onChange:A=>ue(A.target.value)}),pe.repositoryUrl&&s.jsx("p",{className:"text-xs text-destructive",children:pe.repositoryUrl})]})]}),s.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ie,{children:"README"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ve.length,"/50000"]})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(Ee?["link","content","generate"]:["link","content"]).map(A=>s.jsx("button",{type:"button",className:J("px-2.5 py-1 text-xs rounded-md",xe===A?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>Ne(A),children:A==="link"?"Link":A==="content"?"Content":"Generate"},A))}),xe==="link"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ye,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:je,onChange:A=>Ie(A.target.value)}),pe.readmeUrl&&s.jsx("p",{className:"text-xs text-destructive",children:pe.readmeUrl})]}),xe==="content"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(At,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
4
-
5
- Describe your MCP here...`,rows:6,value:ve,onChange:A=>Se(A.target.value)}),pe.readme&&s.jsx("p",{className:"text-xs text-destructive",children:pe.readme})]}),Ee&&xe==="generate"&&s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Generates a README using name, description, tools, category and tags as context."}),s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="readme",onClick:xt,children:d==="readme"?"Generating...":"Generate with AI"})]})]}),s.jsx(gr,{tools:Ce,onChange:Je,remoteUrl:pt(le)||void 0,remoteType:H,externalDiscoverStatus:g,externalDiscoverError:C})]});return s.jsx($t,{open:t,onOpenChange:ot,children:s.jsxs(Dt,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(It,{className:"space-y-3",children:[s.jsx(Mt,{children:v?"Edit MCP Server":"Add MCP Server"}),s.jsx(wr,{current:q}),s.jsxs(Pt,{children:[q===1&&"Set up the identity, connection and discover available tools.",q===2&&"Add descriptions, categories and tags to help discovery.",q===3&&"Configure optional metadata, README and tools."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[q===1&&Ws,q===2&&Js,q===3&&Zs]}),s.jsxs(Et,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[s.jsx("div",{children:q>1&&s.jsxs(F,{variant:"ghost",size:"sm",onClick:Ys,children:[s.jsx(gn,{size:14}),"Back"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(F,{variant:"outline",size:"sm",onClick:()=>ot(!1),disabled:c,children:"Cancel"}),q<3?s.jsxs(F,{size:"sm",onClick:Vs,children:["Next",s.jsx(jn,{size:14})]}):s.jsx(F,{size:"sm",onClick:Hs,disabled:c,children:c?"Saving...":v?"Save changes":"Create"})]})]})]})})}function ps(t,e){return t.includes(e)?t.filter(n=>n!==e):[...t,e]}function Tr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Ir(t){return t._meta?.["mcp.mesh"]?.categories??[]}function Mr(t){return t.server?.remotes?.[0]?.url??"-"}function Pr(){const t=K.c(120),[e,n]=M.useState(""),r=M.useDeferredValue(e);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[l,a]=M.useState(o);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[1]=i):i=t[1];const[c,m]=M.useState(i),[x,h]=M.useState(!1),[f,p]=M.useState(!1),[d,y]=M.useState(null),[g,C]=M.useState(null),[_,v]=xn("private-registry-list","cards"),b=M.useRef(null);let S;t[2]!==r||t[3]!==c||t[4]!==l?(S={search:r,tags:l,categories:c},t[2]=r,t[3]=c,t[4]=l,t[5]=S):S=t[5];const u=Ls(S),j=Vn(),{registryLLMConnectionId:k,registryLLMModelId:T}=Kt(et),{createMutation:N,updateMutation:R,deleteMutation:w,bulkCreateMutation:P}=ns();let D,I,E,$,z,L,q,V;if(t[6]!==N||t[7]!==w||t[8]!==g||t[9]!==j.data||t[10]!==u||t[11]!==r||t[12]!==e||t[13]!==c||t[14]!==l||t[15]!==v||t[16]!==R||t[17]!==_){const xe=u.data?.pages.flatMap(Lr).filter(Boolean)??[],Ne=u.data?.pages[0]?.totalCount??xe.length,le=l.length>0||c.length>0||r.length>0,_e=j.data;let H;t[26]!==_e?(H=Array.isArray(_e?.tags)?_e.tags:[],t[26]=_e,t[27]=H):H=t[27],V=H;let fe;t[28]!==_e?(fe=Array.isArray(_e?.categories)?_e.categories:[],t[28]=_e,t[29]=fe):fe=t[29],D=fe;let Re;t[30]!==u?(Re=Q=>{b.current&&(b.current.disconnect(),b.current=null),!(!Q||!u.hasNextPage||u.isFetchingNextPage)&&(b.current=new IntersectionObserver(ke=>{ke[0]?.isIntersecting&&u.hasNextPage&&!u.isFetchingNextPage&&u.fetchNextPage()},{rootMargin:"240px 0px"}),b.current.observe(Q))},t[30]=u,t[31]=Re):Re=t[31];const O=Re;let ee;t[32]!==N||t[33]!==R?(ee=async Q=>{try{"data"in Q?(await R.mutateAsync(Q),W.success("Registry item updated")):(await N.mutateAsync(Q),W.success("Registry item created"))}catch(ke){const xt=ke;throw W.error(xt instanceof Error?xt.message:"Failed to save item"),xt}},t[32]=N,t[33]=R,t[34]=ee):ee=t[34],I=ee;let Te;t[35]!==w||t[36]!==g?(Te=async()=>{if(g)try{await w.mutateAsync(g.id),W.success("Registry item deleted"),C(null)}catch(Q){const ke=Q;W.error(ke instanceof Error?ke.message:"Failed to delete item")}},t[35]=w,t[36]=g,t[37]=Te):Te=t[37],E=Te,L="h-full flex flex-col";let we;t[38]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t[38]=we):we=t[38];const Ue=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[we,s.jsx(U,{variant:"secondary",className:"text-xs",children:Ne})]});let Ce;t[39]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx(kt,{asChild:!0,children:s.jsxs(F,{variant:"outline",size:"sm",className:J("h-8","gap-1.5"),children:[s.jsx(hn,{size:14}),"Filters"]})}),t[39]=Ce):Ce=t[39];let Je;t[40]===Symbol.for("react.memo_cache_sentinel")?(Je=s.jsx(as,{children:"Tags"}),t[40]=Je):Je=t[40];let Ze;t[41]!==l||t[42]!==V?(Ze=V.length>0?V.map(Q=>s.jsxs(ls,{checked:l.includes(Q.value),onCheckedChange:()=>a(ke=>ps(ke,Q.value)),children:[Q.value," (",Q.count,")"]},Q.value)):s.jsx(We,{disabled:!0,children:"No tags available"}),t[41]=l,t[42]=V,t[43]=Ze):Ze=t[43];let at,pe;t[44]===Symbol.for("react.memo_cache_sentinel")?(at=s.jsx(mn,{}),pe=s.jsx(as,{children:"Categories"}),t[44]=at,t[45]=pe):(at=t[44],pe=t[45]);let Oe;t[46]!==D||t[47]!==c?(Oe=D.length>0?D.map(Q=>s.jsxs(ls,{checked:c.includes(Q.value),onCheckedChange:()=>m(ke=>ps(ke,Q.value)),children:[Q.value," (",Q.count,")"]},Q.value)):s.jsx(We,{disabled:!0,children:"No categories available"}),t[46]=D,t[47]=c,t[48]=Oe):Oe=t[48];let Ee;t[49]!==Ze||t[50]!==Oe?(Ee=s.jsxs(St,{children:[Ce,s.jsxs(Rt,{align:"end",className:"w-[260px]",children:[Je,Ze,at,pe,Oe]})]}),t[49]=Ze,t[50]=Oe,t[51]=Ee):Ee=t[51];let Xe;t[52]!==v?(Xe=Q=>{(Q==="cards"||Q==="table")&&v(Q)},t[52]=v,t[53]=Xe):Xe=t[53];let ut,De;t[54]===Symbol.for("react.memo_cache_sentinel")?(ut=s.jsx(os,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),De=s.jsx(os,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"}),t[54]=ut,t[55]=De):(ut=t[54],De=t[55]);let qe;t[56]!==Xe||t[57]!==_?(qe=s.jsxs(un,{type:"single",value:_,onValueChange:Xe,variant:"outline",className:"h-8",children:[ut,De]}),t[56]=Xe,t[57]=_,t[58]=qe):qe=t[58];let tt;t[59]===Symbol.for("react.memo_cache_sentinel")?(tt=s.jsx(F,{variant:"outline",size:"sm",className:"h-8",onClick:()=>p(!0),children:"Import CSV"}),t[59]=tt):tt=t[59];let ot;t[60]===Symbol.for("react.memo_cache_sentinel")?(ot=s.jsx(F,{size:"sm",className:"h-8",onClick:()=>h(!0),children:"Add MCP Servers"}),t[60]=ot):ot=t[60];let st;t[61]!==Ee||t[62]!==qe?(st=s.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[Ee,qe,tt,ot]}),t[61]=Ee,t[62]=qe,t[63]=st):st=t[63];let nt;t[64]!==Ue||t[65]!==st?(nt=s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[Ue,st]}),t[64]=Ue,t[65]=st,t[66]=nt):nt=t[66];let Qe;t[67]===Symbol.for("react.memo_cache_sentinel")?(Qe=s.jsx(Ns,{size:16,className:"text-muted-foreground shrink-0"}),t[67]=Qe):Qe=t[67];let Ke;t[68]===Symbol.for("react.memo_cache_sentinel")?(Ke=Q=>n(Q.target.value),t[68]=Ke):Ke=t[68];let rt;t[69]!==e?(rt=s.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[Qe,s.jsx(ye,{value:e,onChange:Ke,placeholder:"Search by id, title, description, or server name",className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),t[69]=e,t[70]=rt):rt=t[70];let it;t[71]!==le||t[72]!==e||t[73]!==c||t[74]!==l?(it=le&&s.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[l.map(Ar),c.map($r),e.trim()&&s.jsxs(U,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{n(""),a([]),m([])},children:"Clear filters"})]}),t[71]=le,t[72]=e,t[73]=c,t[74]=l,t[75]=it):it=t[75],t[76]!==nt||t[77]!==rt||t[78]!==it?(q=s.jsxs("div",{className:"shrink-0 border-b border-border",children:[nt,rt,it]}),t[76]=nt,t[77]=rt,t[78]=it,t[79]=q):q=t[79],$="flex-1 overflow-auto px-4 md:px-6 py-4",z=xe.length===0?s.jsx("div",{className:"min-h-[320px] rounded-xl border border-dashed border-border flex flex-col items-center justify-center gap-3 p-6 text-center",children:u.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(mt,{className:"size-5 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-medium",children:le?"No items found":"No MCPs in your registry"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:le?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!le&&s.jsx(F,{size:"lg",onClick:()=>h(!0),children:"Add MCP Servers"})]})}):_==="cards"?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:xe.map(Q=>s.jsx(hr,{item:Q,onEdit:y,onDelete:C},Q.id))}),u.hasNextPage&&s.jsx("div",{ref:O,className:"h-2"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"border rounded-lg overflow-auto",children:s.jsxs(js,{children:[s.jsx(ys,{children:s.jsxs(Tt,{children:[s.jsx(Ae,{className:"w-[56px]",children:"Icon"}),s.jsx(Ae,{children:"Title"}),s.jsx(Ae,{children:"ID"}),s.jsx(Ae,{children:"Tags"}),s.jsx(Ae,{children:"Categories"}),s.jsx(Ae,{children:"Remote URL"}),s.jsx(Ae,{children:"Visibility"}),s.jsx(Ae,{className:"text-right w-[68px]",children:"Actions"})]})}),s.jsx(bs,{children:xe.map(Q=>s.jsxs(Tt,{children:[s.jsx(Le,{children:s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:Q.server?.icons?.[0]?.src?s.jsx("img",{src:Q.server.icons[0].src,alt:Q.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:Q.title.charAt(0).toUpperCase()})})}),s.jsx(Le,{children:Q.title}),s.jsx(Le,{className:"font-mono",children:Q.id}),s.jsx(Le,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Tr(Q).slice(0,3).map(ke=>s.jsx(U,{variant:"outline",children:ke},`${Q.id}-tag-${ke}`))})}),s.jsx(Le,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Ir(Q).slice(0,3).map(ke=>s.jsx(U,{variant:"outline",children:ke},`${Q.id}-category-${ke}`))})}),s.jsx(Le,{children:Mr(Q)}),s.jsx(Le,{children:Q.is_public?s.jsxs(U,{variant:"default",className:"gap-1",children:[s.jsx(vs,{size:10}),"Public"]}):s.jsx(U,{variant:"secondary",children:"Private"})}),s.jsx(Le,{className:"text-right",children:s.jsxs(St,{children:[s.jsx(kt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),s.jsxs(Rt,{align:"end",children:[s.jsx(We,{onClick:()=>y(Q),children:"Edit"}),s.jsx(We,{variant:"destructive",onClick:()=>C(Q),children:"Delete"})]})]})})]},Q.id))})]})}),u.hasNextPage&&s.jsx("div",{ref:O,className:"h-2"})]}),t[6]=N,t[7]=w,t[8]=g,t[9]=j.data,t[10]=u,t[11]=r,t[12]=e,t[13]=c,t[14]=l,t[15]=v,t[16]=R,t[17]=_,t[18]=D,t[19]=I,t[20]=E,t[21]=$,t[22]=z,t[23]=L,t[24]=q,t[25]=V}else D=t[18],I=t[19],E=t[20],$=t[21],z=t[22],L=t[23],q=t[24],V=t[25];let Y;t[80]!==u.isFetchingNextPage?(Y=u.isFetchingNextPage&&s.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(mt,{className:"size-4 animate-spin"}),"Loading more items..."]}),t[80]=u.isFetchingNextPage,t[81]=Y):Y=t[81];let X;t[82]!==$||t[83]!==z||t[84]!==Y?(X=s.jsxs("div",{className:$,children:[z,Y]}),t[82]=$,t[83]=z,t[84]=Y,t[85]=X):X=t[85];const Z=d?.id??"create",te=x||!!d;let se;t[86]===Symbol.for("react.memo_cache_sentinel")?(se=xe=>{xe||(h(!1),y(null))},t[86]=se):se=t[86];let he;t[87]!==V?(he=V.map(Dr),t[87]=V,t[88]=he):he=t[88];let re;t[89]!==D?(re=D.map(Er),t[89]=D,t[90]=re):re=t[90];const ae=N.isPending||R.isPending;let oe;t[91]!==d||t[92]!==I||t[93]!==k||t[94]!==T||t[95]!==te||t[96]!==he||t[97]!==re||t[98]!==ae||t[99]!==Z?(oe=s.jsx(Rr,{open:te,onOpenChange:se,item:d,availableTags:he,availableCategories:re,defaultLLMConnectionId:k,defaultLLMModelId:T,isSubmitting:ae,onSubmit:I},Z),t[91]=d,t[92]=I,t[93]=k,t[94]=T,t[95]=te,t[96]=he,t[97]=re,t[98]=ae,t[99]=Z,t[100]=oe):oe=t[100];let me;t[101]!==P?(me=async xe=>{try{const Ne=await P.mutateAsync(xe);return W.success(`Imported ${Ne.created} item(s)`),Ne}catch(Ne){const le=Ne;throw W.error(le instanceof Error?le.message:"Failed to import CSV"),le}},t[101]=P,t[102]=me):me=t[102];let ce;t[103]!==P.isPending||t[104]!==f||t[105]!==me?(ce=s.jsx(rr,{open:f,onOpenChange:p,isImporting:P.isPending,onImport:me}),t[103]=P.isPending,t[104]=f,t[105]=me,t[106]=ce):ce=t[106];const ue=!!g;let ve;t[107]===Symbol.for("react.memo_cache_sentinel")?(ve=xe=>{xe||C(null)},t[107]=ve):ve=t[107];const Se=g?.title??g?.id??"";let je;t[108]!==w.isPending||t[109]!==E||t[110]!==ue||t[111]!==Se?(je=s.jsx(cr,{open:ue,onOpenChange:ve,title:Se,isDeleting:w.isPending,onConfirm:E}),t[108]=w.isPending,t[109]=E,t[110]=ue,t[111]=Se,t[112]=je):je=t[112];let Ie;return t[113]!==oe||t[114]!==ce||t[115]!==je||t[116]!==L||t[117]!==q||t[118]!==X?(Ie=s.jsxs("div",{className:L,children:[q,X,oe,ce,je]}),t[113]=oe,t[114]=ce,t[115]=je,t[116]=L,t[117]=q,t[118]=X,t[119]=Ie):Ie=t[119],Ie}function Er(t){return t.value}function Dr(t){return t.value}function $r(t){return s.jsx(U,{variant:"outline",children:t},`selected-category-${t}`)}function Ar(t){return s.jsxs(U,{variant:"default",children:["#",t]},`selected-tag-${t}`)}function Lr(t){return t.items??[]}const zr=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function fs(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleDateString()}function Or(t){return{id:t.requested_id??t.server?.name,title:t.title,description:t.description??"",_meta:t._meta,server:t.server,is_public:!1}}function Zt(t){const e=t.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function gt(t){const e=t._meta?.["mcp.mesh"];return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Ur(){const[t,e]=M.useState("pending"),[n,r]=M.useState(null),[o,l]=M.useState(null),[a,i]=M.useState(null),[c,m]=M.useState(null),[x,h]=M.useState(""),f=Yn(t),{reviewMutation:p,deleteMutation:d}=Wn(),{createMutation:y}=ns(),g=f.data?.items??[],C=f.data?.totalCount??0,_=new Set(g.filter(u=>u.status==="pending").map(u=>u.id)),v=async()=>{const u=o;if(u){l(null),r(u.id);try{await p.mutateAsync({id:u.id,status:"approved",reviewerNotes:void 0});const j=Or(u);await y.mutateAsync({id:j.id,title:j.title,description:j.description,_meta:j._meta,server:j.server,is_public:j.is_public}),W.success("Request approved and added to registry")}catch(j){const k=j instanceof Error?j.message:"Failed to approve request";k.includes("UNIQUE constraint")||k.includes("already exists")?W.error("An item with this ID already exists in the registry. Delete or rename it first."):W.error(k)}finally{r(null)}}},b=async()=>{if(a)try{await p.mutateAsync({id:a.id,status:"rejected",reviewerNotes:x.trim()||void 0}),W.success("Request rejected"),i(null),h("")}catch(u){W.error(u instanceof Error?u.message:"Failed to reject request")}},S=async u=>{try{await d.mutateAsync(u.id),W.success("Request deleted")}catch(j){W.error(j instanceof Error?j.message:"Failed to delete request")}};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border",children:s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),s.jsx(U,{variant:"secondary",className:"text-xs",children:C})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:zr.map(u=>s.jsx("button",{type:"button",className:J("px-2.5 py-1 text-xs rounded-md transition-colors",t===u.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(u.value),children:u.label},u.value))})]})}),s.jsx("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:f.isLoading?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):f.isError?s.jsxs(ne,{className:"p-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:"Failed to load publish requests."}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f.error instanceof Error?f.error.message:"Unknown error"})]}):g.length===0?s.jsx(ne,{className:"p-8 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No publish requests yet."})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:g.map(u=>{const j=Zt(u),k=gt(u),T=u._meta?.["mcp.mesh"]?.tags??[],N=u._meta?.["mcp.mesh"]?.categories??[],R=k.hasReadmeContent||k.hasReadmeLink||T.length>0||N.length>0,w=[u.requester_name,u.requester_email].filter(Boolean).join(" · ");return s.jsxs(ne,{className:"p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[s.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:j?s.jsx("img",{src:j,alt:u.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:u.title.slice(0,1).toUpperCase()})}),s.jsx("p",{className:"text-sm font-medium truncate",children:u.title})]}),s.jsx(U,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:u.status})]}),u.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:u.description}),R&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[k.hasReadmeContent&&s.jsx(U,{variant:"outline",className:"text-[10px]",children:"README"}),k.hasReadmeLink&&s.jsx(U,{variant:"outline",className:"text-[10px]",children:"README link"}),T.slice(0,2).map(P=>s.jsx(U,{variant:"secondary",className:"text-[10px]",children:P},`${u.id}-tag-${P}`)),N.slice(0,1).map(P=>s.jsx(U,{variant:"secondary",className:"text-[10px]",children:P},`${u.id}-category-${P}`))]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[w&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate",children:w}),s.jsx("span",{children:"·"})]}),s.jsx("span",{className:"shrink-0",children:fs(u.created_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[s.jsxs(F,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>m(u),children:[s.jsx(Rs,{size:13}),"View"]}),_.has(u.id)?s.jsxs(s.Fragment,{children:[s.jsxs(F,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>l(u),disabled:n!==null,children:[s.jsx(bt,{size:13}),n===u.id?"Approving...":"Approve"]}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>{i(u),h("")},disabled:p.isPending,children:[s.jsx(Nn,{size:13}),"Reject"]})]}):s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>S(u),disabled:d.isPending,children:[s.jsx(vt,{size:13}),"Delete"]})]})]},u.id)})})}),s.jsx($t,{open:!!c,onOpenChange:u=>{u||m(null)},children:s.jsxs(Dt,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[s.jsxs(It,{children:[s.jsx(Mt,{children:c?.title??"Request details"}),s.jsx(Pt,{children:"Review all metadata sent by the requester before approving."})]}),c&&s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[s.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Zt(c)?s.jsx("img",{src:Zt(c)||"",alt:c.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:c.title.slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:c.title}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c.server?.name||c.id})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),s.jsx("span",{className:"capitalize",children:c.status})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:fs(c.created_at)})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Requester"}),s.jsx("span",{children:c.requester_name||"-"})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Email"}),s.jsx("span",{children:c.requester_email||"-"})]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{children:"Remote URL"}),s.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:c.server?.remotes?.[0]?.url??"-"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:c.description||"No description provided."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(c._meta?.["mcp.mesh"]?.tags??[]).length?(c._meta?.["mcp.mesh"]?.tags??[]).map(u=>s.jsx(U,{variant:"secondary",children:u},`${c.id}-detail-tag-${u}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(c._meta?.["mcp.mesh"]?.categories??[]).length?(c._meta?.["mcp.mesh"]?.categories??[]).map(u=>s.jsx(U,{variant:"secondary",children:u},`${c.id}-detail-category-${u}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{children:"README"}),gt(c).hasReadmeContent?s.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap max-h-40 overflow-y-auto rounded-md border border-border bg-muted/20 px-2.5 py-2",children:gt(c).readmeContent}):gt(c).hasReadmeLink?s.jsxs("a",{href:gt(c).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:["Open README link",s.jsx(vn,{size:14})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),s.jsx(Et,{children:s.jsx(F,{variant:"outline",onClick:()=>m(null),children:"Close"})})]})}),s.jsx(Gt,{open:!!o,onOpenChange:u=>{u||l(null)},children:s.jsxs(Bt,{children:[s.jsxs(zt,{children:[s.jsx(Lt,{children:"Approve publish request?"}),s.jsxs(Ot,{children:["This will add"," ",s.jsx("span",{className:"font-medium text-foreground",children:o?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),s.jsxs(Ft,{children:[s.jsx(Ut,{children:"Cancel"}),s.jsx(qt,{onClick:v,children:"Approve"})]})]})}),s.jsx($t,{open:!!a,onOpenChange:u=>{u||(i(null),h(""))},children:s.jsxs(Dt,{children:[s.jsxs(It,{children:[s.jsx(Mt,{children:"Reject publish request?"}),s.jsx(Pt,{children:"This request will move to rejected status. You can leave optional notes for context."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),s.jsx(At,{id:"reject-notes",rows:4,value:x,onChange:u=>h(u.target.value),placeholder:"Reason for rejection..."})]}),s.jsxs(Et,{children:[s.jsx(F,{variant:"outline",onClick:()=>{i(null),h("")},children:"Cancel"}),s.jsx(F,{onClick:b,disabled:p.isPending,children:p.isPending?"Rejecting...":"Reject"})]})]})})]})}function Fs(t){const e=K.c(104),{connectionId:n,modelId:r,connections:o,models:l,onConnectionChange:a,onModelChange:i,connectionLabel:c,modelLabel:m,connectionPlaceholder:x,modelPlaceholder:h,className:f}=t,p=c===void 0?"LLM Connection":c,d=m===void 0?"Model":m,y=x===void 0?"Select LLM connection":x,g=h===void 0?"Select model":h,[C,_]=M.useState(!1),[v,b]=M.useState("");let S;if(e[0]!==r||e[1]!==l){let H;e[3]!==r?(H=fe=>fe.id===r,e[3]=r,e[4]=H):H=e[4],S=l.find(H),e[0]=r,e[1]=l,e[2]=S}else S=e[2];const u=S;let j;if(e[5]!==l||e[6]!==v){const H=v.trim().toLowerCase();j=H?l.filter(fe=>fe.title.toLowerCase().includes(H)||fe.id.toLowerCase().includes(H)):l,e[5]=l,e[6]=v,e[7]=j}else j=e[7];const k=j;let T,N,R,w,P,D,I,E,$,z,L,q,V,Y,X,Z,te,se,he,re,ae,oe;if(e[8]!==f||e[9]!==n||e[10]!==p||e[11]!==y||e[12]!==o||e[13]!==d||e[14]!==g||e[15]!==a||e[16]!==C||e[17]!==v||e[18]!==u?.title){let H;e[41]!==n?(H=Ue=>Ue.id===n,e[41]=n,e[42]=H):H=e[42];const fe=o.find(H);P=Fr,e[43]!==f?(se=J("grid gap-1.5",f),e[43]=f,e[44]=se):se=e[44],e[45]!==d?(he=s.jsx(ie,{children:d}),e[45]=d,e[46]=he):he=e[46],w=wn,X=C,Z=_;const Re=u?.title||g;let O;e[47]!==Re?(O=s.jsx("span",{className:"truncate text-left",children:Re}),e[47]=Re,e[48]=O):O=e[48];let ee;e[49]===Symbol.for("react.memo_cache_sentinel")?(ee=s.jsx(Ss,{className:"size-4 shrink-0 opacity-60"}),e[49]=ee):ee=e[49],e[50]!==d||e[51]!==O?(te=s.jsx(Cn,{asChild:!0,children:s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":d,children:[O,ee]})}),e[50]=d,e[51]=O,e[52]=te):te=e[52],R=_n,q="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",V="start",Y=8,z="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Te;e[53]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(Ns,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Te):Te=e[53];let we;e[54]===Symbol.for("react.memo_cache_sentinel")?(we=Ue=>b(Ue.target.value),e[54]=we):we=e[54],e[55]!==v?(L=s.jsxs("div",{className:"relative flex-1 min-w-0",children:[Te,s.jsx(ye,{value:v,onChange:we,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=v,e[56]=L):L=e[56],$="w-auto shrink-0",N=ws,I=n,E=a,T=Cs,re="llm-connection-select",ae="h-9 min-w-[160px] max-w-[220px]",oe=p,D=fe?s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:fe.icon?s.jsx("img",{src:fe.icon,alt:fe.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:fe.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:fe.title})]}):s.jsx(_s,{placeholder:y}),e[8]=f,e[9]=n,e[10]=p,e[11]=y,e[12]=o,e[13]=d,e[14]=g,e[15]=a,e[16]=C,e[17]=v,e[18]=u?.title,e[19]=T,e[20]=N,e[21]=R,e[22]=w,e[23]=P,e[24]=D,e[25]=I,e[26]=E,e[27]=$,e[28]=z,e[29]=L,e[30]=q,e[31]=V,e[32]=Y,e[33]=X,e[34]=Z,e[35]=te,e[36]=se,e[37]=he,e[38]=re,e[39]=ae,e[40]=oe}else T=e[19],N=e[20],R=e[21],w=e[22],P=e[23],D=e[24],I=e[25],E=e[26],$=e[27],z=e[28],L=e[29],q=e[30],V=e[31],Y=e[32],X=e[33],Z=e[34],te=e[35],se=e[36],he=e[37],re=e[38],ae=e[39],oe=e[40];let me;e[57]!==T||e[58]!==D||e[59]!==re||e[60]!==ae||e[61]!==oe?(me=s.jsx(T,{id:re,className:ae,"aria-label":oe,children:D}),e[57]=T,e[58]=D,e[59]=re,e[60]=ae,e[61]=oe,e[62]=me):me=e[62];let ce;e[63]!==o?(ce=o.map(qr),e[63]=o,e[64]=ce):ce=e[64];let ue;e[65]!==ce?(ue=s.jsx(ks,{children:ce}),e[65]=ce,e[66]=ue):ue=e[66];let ve;e[67]!==N||e[68]!==I||e[69]!==E||e[70]!==me||e[71]!==ue?(ve=s.jsxs(N,{value:I,onValueChange:E,children:[me,ue]}),e[67]=N,e[68]=I,e[69]=E,e[70]=me,e[71]=ue,e[72]=ve):ve=e[72];let Se;e[73]!==$||e[74]!==ve?(Se=s.jsx("div",{className:$,children:ve}),e[73]=$,e[74]=ve,e[75]=Se):Se=e[75];let je;e[76]!==z||e[77]!==L||e[78]!==Se?(je=s.jsxs("div",{className:z,children:[L,Se]}),e[76]=z,e[77]=L,e[78]=Se,e[79]=je):je=e[79];let Ie;e[80]!==k||e[81]!==P||e[82]!==r||e[83]!==i?(Ie=k.length===0?s.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):k.map(H=>{const fe=H.id===r,Re=P(H.capabilities);return s.jsxs("button",{type:"button",className:J("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",fe?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{i(H.id),_(!1)},children:[s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/40 overflow-hidden shrink-0 flex items-center justify-center",children:H.logo?s.jsx("img",{src:H.logo,alt:H.title,className:"w-full h-full object-contain"}):s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(H.title||H.id).slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:H.title}),H.title!==H.id&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:H.id})]}),Re.length>0&&s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:Re.map(O=>s.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:O},`${H.id}-${O}`))})]},H.id)}),e[80]=k,e[81]=P,e[82]=r,e[83]=i,e[84]=Ie):Ie=e[84];let xe;e[85]!==Ie?(xe=s.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:Ie}),e[85]=Ie,e[86]=xe):xe=e[86];let Ne;e[87]!==R||e[88]!==q||e[89]!==V||e[90]!==Y||e[91]!==je||e[92]!==xe?(Ne=s.jsxs(R,{className:q,align:V,sideOffset:Y,children:[je,xe]}),e[87]=R,e[88]=q,e[89]=V,e[90]=Y,e[91]=je,e[92]=xe,e[93]=Ne):Ne=e[93];let le;e[94]!==w||e[95]!==X||e[96]!==Z||e[97]!==te||e[98]!==Ne?(le=s.jsxs(w,{open:X,onOpenChange:Z,children:[te,Ne]}),e[94]=w,e[95]=X,e[96]=Z,e[97]=te,e[98]=Ne,e[99]=le):le=e[99];let _e;return e[100]!==se||e[101]!==he||e[102]!==le?(_e=s.jsxs("div",{className:se,children:[he,le]}),e[100]=se,e[101]=he,e[102]=le,e[103]=_e):_e=e[103],_e}function qr(t){return s.jsx(Ct,{value:t.id,children:s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:t.icon?s.jsx("img",{src:t.icon,alt:t.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:t.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:t.title})]})},t.id)}function Fr(t){const e=new Set((t??[]).map(Br)),n=[];return e.has("text")&&n.push("Text"),e.has("vision")&&n.push("Vision"),e.has("tools")&&n.push("Tools"),n}function Br(t){return t.toLowerCase()}function Gr({initialName:t,initialIcon:e,initialLLMConnectionId:n,initialLLMModelId:r,initialAcceptPublishRequests:o,initialRequireApiToken:l,initialStorePrivateOnly:a,revealedKey:i,onRevealedKeyChange:c}){const{org:m}=de(),{uploadImage:x,isUploading:h}=Us(),{saveRegistryConfigMutation:f}=Kt(et),[p,d]=M.useState(t),[y,g]=M.useState(e),[C,_]=M.useState(n),[v,b]=M.useState(r),[S,u]=M.useState(o),[j,k]=M.useState(l),[T,N]=M.useState(a),R=Jn(),{generateMutation:w,revokeMutation:P}=Zn(),[D,I]=M.useState(""),[E,$]=M.useState(!1),[z,L]=M.useState(null),{handleCopy:q,copied:V}=Ht(),{handleCopy:Y,copied:X}=Ht(),{handleCopy:Z,copied:te}=Ht(),se=Ls({search:"",tags:[],categories:[],limit:50}),re=(Ts()??[]).filter(O=>(O.tools??[]).some(ee=>ee.name==="LLM_DO_GENERATE")),ae=C||n||re[0]?.id||"",oe=gs({connectionId:ae||void 0,orgId:m.id}),me=Is(ae||"no-llm-connection","LLM",oe),ce=`${window.location.origin}/org/${m.slug}/registry/mcp`,ve=(se.data?.pages.flatMap(O=>O.items??[])??[]).filter(O=>O.is_public).length,Se=`${window.location.origin}/org/${m.slug}/registry/publish-request`,je=i?.slice(0,12)??null,Ie=!!(je&&(R.data?.items??[]).some(O=>O.prefix===je)),xe=p.trim()!==t.trim()||y.trim()!==e.trim()||C.trim()!==n.trim()||v.trim()!==r.trim()||S!==o||j!==l||T!==a,Ne=f.isPending,le=async O=>{if(!O)return;const ee=O.name.split(".").pop()||"png",Te=`registry/${m.id}/identity/icon.${ee}`,we=await x(O,Te);we?g(we):W.error("Failed to upload icon. Please try again.")},_e=async()=>{const O=p.trim();if(!O)return;const ee=v.trim(),Te=ee?C.trim()||ae||"":C.trim();try{await f.mutateAsync({registryName:O,registryIcon:y.trim(),llmConnectionId:Te,llmModelId:ee,acceptPublishRequests:S,requireApiToken:j,storePrivateOnly:T}),W.success("Registry settings updated")}catch(we){W.error(we instanceof Error?we.message:"Failed to save registry settings")}},H=()=>{d(t),g(e),_(n),b(r),u(o),k(l),N(a)},fe=async()=>{const O=D.trim();if(O)try{const ee=await w.mutateAsync(O);ee?.key&&(c(ee.key),$(!1),I(""),W.success("API key generated. Copy it now — it won't be shown again!"))}catch(ee){W.error(ee instanceof Error?ee.message:"Failed to generate API key")}},Re=async O=>{try{await P.mutateAsync(O),c(null),L(null),W.success("API key revoked")}catch(ee){W.error(ee instanceof Error?ee.message:"Failed to revoke API key")}};return s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4 min-h-[32px]",children:[xe&&s.jsxs(F,{variant:"outline",size:"sm",onClick:H,disabled:Ne,children:[s.jsx(kn,{size:14}),"Undo"]}),s.jsxs(F,{variant:"default",size:"sm",onClick:_e,disabled:Ne||!xe,children:[Ne?s.jsx(mt,{size:14,className:"animate-spin"}):s.jsx(Sn,{size:14}),"Save"]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(ne,{className:"min-w-0 p-4 grid gap-4 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Registry Identity"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the name and icon shown in the store selector."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(ie,{htmlFor:"identity-name",children:"Name"}),s.jsx(ye,{id:"identity-name",value:p,onChange:O=>d(O.target.value),placeholder:"Private Registry"})]}),s.jsx(zs,{value:y,onChange:g,onFileUpload:le,isUploading:h})]}),s.jsxs(ne,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"AI Configuration"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the default model used for AI suggestions."})]}),s.jsx(Fs,{connectionId:ae,modelId:v,connections:re.map(O=>({id:O.id,title:O.title,icon:O.icon??null})),models:me.map(O=>({id:O.id,title:O.title||O.id,logo:O.logo??null,capabilities:O.capabilities??[]})),onConnectionChange:O=>{_(O),b("")},onModelChange:b})]})]}),s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(ne,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Public Registry"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Public URL to consume this registry as an MCP."})]}),s.jsxs(U,{variant:"secondary",children:[ve," ",ve===1?"public item":"public items"]})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:ce}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>q(ce),children:V?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]})]}),s.jsxs(ne,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Store Visibility"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what appears when users browse this registry in Store."})]}),s.jsx(_t,{id:"store-private-only",checked:T,onCheckedChange:N})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Enabled: show only private apps. Disabled: show public and private apps together."}),T!==a&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."})]}),s.jsxs(ne,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Publish Requests"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow external users to submit MCP servers for review."})]}),s.jsx(_t,{id:"accept-publish-requests",checked:S,onCheckedChange:u})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:Se}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>Y(Se),children:X?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[s.jsxs("div",{children:[s.jsx(ie,{className:"text-sm font-medium",children:"Require API Token"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Requests without a valid token will be rejected."})]}),s.jsx(_t,{id:"require-api-token",checked:j,onCheckedChange:k})]}),(S!==o||j!==l)&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),S&&j&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx(Rn,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),i&&!Ie&&s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"New key (refreshing list...)"}),s.jsx(ye,{readOnly:!0,value:i,className:"h-8 text-xs font-mono bg-background"})]}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"grid gap-1.5 flex-1",children:[s.jsx(ie,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),s.jsx(ye,{id:"api-key-name",value:D,onChange:O=>I(O.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),s.jsxs(F,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!D.trim()||w.isPending,onClick:fe,children:[w.isPending?s.jsx(mt,{size:14,className:"animate-spin"}):s.jsx(Tn,{size:14}),"Generate"]})]}),(R.data?.items?.length??0)>0&&s.jsx("div",{className:"grid gap-2",children:R.data?.items?.map(O=>s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[s.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium truncate leading-none",children:O.name}),je===O.prefix?s.jsx(ye,{readOnly:!0,value:E?i??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):s.jsx(ye,{readOnly:!0,value:`${O.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[je===O.prefix&&s.jsxs(s.Fragment,{children:[s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>$(ee=>!ee),children:E?s.jsx(Ms,{size:14}):s.jsx(Rs,{size:14})}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!i,onClick:()=>i&&Z(i),children:te?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:P.isPending,onClick:()=>L({id:O.id,name:O.name}),children:s.jsx(vt,{size:14})})]})]},O.id))})]})]})]})]}),s.jsx(Gt,{open:!!z,onOpenChange:O=>{!O&&!P.isPending&&L(null)},children:s.jsxs(Bt,{children:[s.jsxs(zt,{children:[s.jsx(Lt,{children:"Revoke API key?"}),s.jsxs(Ot,{children:["This action cannot be undone. The key",z?` "${z.name}"`:""," will stop working immediately."]})]}),s.jsxs(Ft,{children:[s.jsx(Ut,{disabled:P.isPending,children:"Cancel"}),s.jsx(qt,{disabled:!z||P.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>z&&Re(z.id),children:P.isPending?"Revoking...":"Revoke key"})]})]})})]})}function Qr(t){const e=K.c(5),{results:n}=t;if(n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ne,{className:"p-4 text-sm text-muted-foreground text-center",children:"No broken MCPs in this run. All healthy! ✓"}),e[0]=l):l=e[0],l}let r;e[1]!==n?(r=n.map(Kr),e[1]=n,e[2]=r):r=e[2];let o;return e[3]!==r?(o=s.jsx("div",{className:"space-y-2",children:r}),e[3]=r,e[4]=o):o=e[4],o}function Kr(t){return s.jsx(Vr,{result:t},t.id)}function Vr(t){const e=K.c(49),{result:n}=t,[r,o]=M.useState(!1);let l;if(e[0]!==r||e[1]!==n.action_taken||e[2]!==n.connection_ok||e[3]!==n.duration_ms||e[4]!==n.error_message||e[5]!==n.id||e[6]!==n.item_title||e[7]!==n.status||e[8]!==n.tool_results||e[9]!==n.tools_listed){const a=n.tool_results.filter(Wr);let i;e[11]!==r?(i=()=>o(!r),e[11]=r,e[12]=i):i=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-red-500 text-sm mt-0.5",children:"✗"}),e[13]=c):c=e[13];let m;e[14]!==n.item_title?(m=s.jsx("h4",{className:"text-sm font-medium truncate",children:n.item_title}),e[14]=n.item_title,e[15]=m):m=e[15];let x;e[16]!==n.status?(x=n.status.replace("_"," "),e[16]=n.status,e[17]=x):x=e[17];let h;e[18]!==x?(h=s.jsx(U,{variant:"destructive",className:"capitalize text-[10px] shrink-0",children:x}),e[18]=x,e[19]=h):h=e[19];let f;e[20]!==m||e[21]!==h?(f=s.jsxs("div",{className:"flex items-center gap-2",children:[m,h]}),e[20]=m,e[21]=h,e[22]=f):f=e[22];const p=n.connection_ok?"✓":"✗";let d;e[23]!==p?(d=s.jsxs("span",{children:["conn: ",p]}),e[23]=p,e[24]=d):d=e[24];const y=n.tools_listed?"✓":"✗";let g;e[25]!==y?(g=s.jsxs("span",{children:["tools listed: ",y]}),e[25]=y,e[26]=g):g=e[26];let C;e[27]!==n.duration_ms?(C=s.jsxs("span",{children:[n.duration_ms,"ms"]}),e[27]=n.duration_ms,e[28]=C):C=e[28];const _=a.length>0&&s.jsxs("span",{className:"text-red-600",children:[a.length," tool",a.length>1?"s":""," ","failed"]});let v;e[29]!==n.action_taken?(v=n.action_taken!=="none"&&s.jsx(U,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:n.action_taken.replace(/_/g," ")}),e[29]=n.action_taken,e[30]=v):v=e[30];let b;e[31]!==g||e[32]!==C||e[33]!==_||e[34]!==v||e[35]!==d?(b=s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[d,g,C,_,v]}),e[31]=g,e[32]=C,e[33]=_,e[34]=v,e[35]=d,e[36]=b):b=e[36];let S;e[37]!==n.error_message?(S=n.error_message&&s.jsx("p",{className:"text-xs text-red-600 line-clamp-2",children:n.error_message}),e[37]=n.error_message,e[38]=S):S=e[38];let u;e[39]!==b||e[40]!==S||e[41]!==f?(u=s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[f,b,S]}),e[39]=b,e[40]=S,e[41]=f,e[42]=u):u=e[42];const j=r?"▲":"▼";let k;e[43]!==j?(k=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:j}),e[43]=j,e[44]=k):k=e[44];let T;e[45]!==u||e[46]!==k||e[47]!==i?(T=s.jsxs("button",{type:"button",className:"w-full text-left p-3 flex items-start gap-3 hover:bg-muted/30 transition-colors",onClick:i,children:[c,u,k]}),e[45]=u,e[46]=k,e[47]=i,e[48]=T):T=e[48],l=s.jsxs(ne,{className:"overflow-hidden",children:[T,r&&s.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Full Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2.5 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:J("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:J("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]})]}),a.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-red-600",children:["Failed Tools (",a.length,")"]}),a.map(N=>s.jsxs("div",{className:"rounded border border-red-500/10 bg-red-500/5 px-2.5 py-1.5 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono font-medium text-red-700",children:N.toolName}),s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[N.durationMs,"ms"]})]}),N.error&&s.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-red-600",children:N.error})]},`${n.id}-${N.toolName}`))]}),n.tool_results.length>0&&n.tool_results.some(Hr)&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Passing Tools"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:n.tool_results.filter(Yr).map(N=>s.jsxs(U,{variant:"secondary",className:"text-[10px]",children:["✓ ",N.toolName]},`${n.id}-${N.toolName}-pass`))})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.connection_ok,e[3]=n.duration_ms,e[4]=n.error_message,e[5]=n.id,e[6]=n.item_title,e[7]=n.status,e[8]=n.tool_results,e[9]=n.tools_listed,e[10]=l}else l=e[10];return l}function Yr(t){return t.success}function Hr(t){return t.success}function Wr(t){return!t.success}const Jr=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}];function Zr(t){const n=t.trim().split(/\s+/);if(n.length!==5)return{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1};const[r,o,l,a,i]=n,c=Number(r),m=Number(o),x=Number(l),h=Number(i);return Number.isInteger(c)&&Number.isInteger(m)&&c>=0&&c<=59&&m>=0&&m<=23?l==="*"&&i==="*"?{frequency:"daily",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*/14"&&i==="*"?{frequency:"biweekly",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*"&&Number.isInteger(h)&&h>=0&&h<=6?{frequency:"weekly",minute:c,hour:m,weekDay:h,dayOfMonth:1}:i==="*"&&Number.isInteger(x)&&x>=1&&x<=31?{frequency:"monthly",minute:c,hour:m,weekDay:1,dayOfMonth:x}:{frequency:"custom",minute:c,hour:m,weekDay:1,dayOfMonth:1}:{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1}}function Xr(t,e){return`${String(t).padStart(2,"0")}:${String(e).padStart(2,"0")}`}function wt(t){return t.frequency==="daily"?`${t.minute} ${t.hour} * * *`:t.frequency==="weekly"?`${t.minute} ${t.hour} * * ${t.weekDay}`:t.frequency==="biweekly"?`${t.minute} ${t.hour} */14 * *`:t.frequency==="monthly"?`${t.minute} ${t.hour} ${t.dayOfMonth} * *`:t.currentValue}function ei(t){const e=K.c(60),{value:n,onChange:r,disabled:o}=t,l=o===void 0?!1:o;let a;e[0]!==n?(a=Zr(n),e[0]=n,e[1]=a):a=e[1];const i=a,c=i.frequency==="custom";let m;e[2]!==r||e[3]!==i.dayOfMonth||e[4]!==i.hour||e[5]!==i.minute||e[6]!==i.weekDay||e[7]!==n?(m=E=>{if(E==="custom"){r(n);return}r(wt({frequency:E,hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:i.dayOfMonth,currentValue:n}))},e[2]=r,e[3]=i.dayOfMonth,e[4]=i.hour,e[5]=i.minute,e[6]=i.weekDay,e[7]=n,e[8]=m):m=e[8];const x=m;let h;e[9]!==r||e[10]!==i.dayOfMonth||e[11]!==i.frequency||e[12]!==i.weekDay||e[13]!==n?(h=E=>{const[$,z]=E.split(":"),L=Number($),q=Number(z);!Number.isInteger(L)||!Number.isInteger(q)||r(wt({frequency:i.frequency,hour:L,minute:q,weekDay:i.weekDay,dayOfMonth:i.dayOfMonth,currentValue:n}))},e[9]=r,e[10]=i.dayOfMonth,e[11]=i.frequency,e[12]=i.weekDay,e[13]=n,e[14]=h):h=e[14];const f=h;let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ie,{children:"Frequency"}),e[15]=p):p=e[15];let d;e[16]!==x?(d=E=>x(E.target.value),e[16]=x,e[17]=d):d=e[17];let y,g,C,_,v;e[18]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("option",{value:"daily",children:"Daily"}),_=s.jsx("option",{value:"weekly",children:"Weekly"}),v=s.jsx("option",{value:"biweekly",children:"Every 2 weeks"}),y=s.jsx("option",{value:"monthly",children:"Monthly"}),g=s.jsx("option",{value:"custom",children:"Custom (raw cron)"}),e[18]=y,e[19]=g,e[20]=C,e[21]=_,e[22]=v):(y=e[18],g=e[19],C=e[20],_=e[21],v=e[22]);let b;e[23]!==l||e[24]!==i.frequency||e[25]!==d?(b=s.jsxs("label",{className:"space-y-1",children:[p,s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.frequency,onChange:d,disabled:l,children:[C,_,v,y,g]})]}),e[23]=l,e[24]=i.frequency,e[25]=d,e[26]=b):b=e[26];let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ie,{children:"Time"}),e[27]=S):S=e[27];let u;e[28]!==i.hour||e[29]!==i.minute?(u=Xr(i.hour,i.minute),e[28]=i.hour,e[29]=i.minute,e[30]=u):u=e[30];let j;e[31]!==f?(j=E=>f(E.target.value),e[31]=f,e[32]=j):j=e[32];const k=l||c;let T;e[33]!==u||e[34]!==j||e[35]!==k?(T=s.jsxs("label",{className:"space-y-1",children:[S,s.jsx(ye,{type:"time",value:u,onChange:j,disabled:k})]}),e[33]=u,e[34]=j,e[35]=k,e[36]=T):T=e[36];let N;e[37]!==l||e[38]!==r||e[39]!==i.dayOfMonth||e[40]!==i.frequency||e[41]!==i.hour||e[42]!==i.minute||e[43]!==i.weekDay||e[44]!==n?(N=i.frequency==="weekly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(ie,{children:"Day of week"}),s.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.weekDay,onChange:E=>r(wt({frequency:"weekly",hour:i.hour,minute:i.minute,weekDay:Number(E.target.value),dayOfMonth:i.dayOfMonth,currentValue:n})),disabled:l,children:Jr.map(ti)})]}):i.frequency==="monthly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(ie,{children:"Day of month"}),s.jsx(ye,{type:"number",min:1,max:31,value:i.dayOfMonth,onChange:E=>{const $=Number(E.target.value);!Number.isInteger($)||$<1||$>31||r(wt({frequency:"monthly",hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:$,currentValue:n}))},disabled:l})]}):s.jsxs("div",{className:"space-y-1",children:[s.jsx(ie,{children:"Schedule notes"}),s.jsx("div",{className:"h-9 rounded-md border border-input bg-muted/20 px-3 text-xs text-muted-foreground flex items-center",children:i.frequency==="biweekly"?"Biweekly uses an every-14-days cron approximation.":i.frequency==="custom"?"Edit raw cron directly below.":"Runs in your server timezone."})]}),e[37]=l,e[38]=r,e[39]=i.dayOfMonth,e[40]=i.frequency,e[41]=i.hour,e[42]=i.minute,e[43]=i.weekDay,e[44]=n,e[45]=N):N=e[45];let R;e[46]!==b||e[47]!==T||e[48]!==N?(R=s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[b,T,N]}),e[46]=b,e[47]=T,e[48]=N,e[49]=R):R=e[49];let w;e[50]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(ie,{children:"Raw cron expression"}),e[50]=w):w=e[50];let P;e[51]!==r?(P=E=>r(E.target.value),e[51]=r,e[52]=P):P=e[52];let D;e[53]!==l||e[54]!==P||e[55]!==n?(D=s.jsxs("label",{className:"space-y-1 block",children:[w,s.jsx(ye,{value:n,onChange:P,disabled:l,placeholder:"*/15 * * * *"})]}),e[53]=l,e[54]=P,e[55]=n,e[56]=D):D=e[56];let I;return e[57]!==R||e[58]!==D?(I=s.jsxs("div",{className:"space-y-2",children:[R,D]}),e[57]=R,e[58]=D,e[59]=I):I=e[59],I}function ti(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function si(t,e){return t.monitorMode!==e.monitorMode||t.onFailure!==e.onFailure||t.llmConnectionId!==e.llmConnectionId||t.llmModelId!==e.llmModelId||t.perMcpTimeoutMs!==e.perMcpTimeoutMs||t.perToolTimeoutMs!==e.perToolTimeoutMs||t.maxAgentSteps!==e.maxAgentSteps||t.testPublicOnly!==e.testPublicOnly||t.testPrivateOnly!==e.testPrivateOnly||t.includePendingRequests!==e.includePendingRequests||(t.agentContext??"")!==(e.agentContext??"")||t.schedule!==e.schedule||t.cronExpression!==e.cronExpression}function ni(){const{registryLLMConnectionId:t,registryLLMModelId:e}=Kt(et),{settings:n,saveMutation:r}=As(),o=qn(),l=Fn(),a=M.useRef(n),[i,c]=M.useState(n),[m,x]=M.useState(!1),[h,f]=M.useState(!1),{org:p}=de(),y=(Ts()??[]).filter(u=>(u.tools??[]).some(j=>j.name==="LLM_DO_GENERATE")),g=i.llmConnectionId||t||y[0]?.id||"",C=gs({connectionId:g||void 0,orgId:p.id}),_=Is(g||"no-llm-connection","LLM",C);a.current!==n&&(a.current=n,c(n));const v=si(i,n),b=u=>{x(!1),c(j=>({...j,...u}))},S=async()=>{const u=i.cronExpression?.trim()??"";let j=n.scheduleEventId??"";if(i.schedule==="cron"&&u.length>0){const R=u!==(n.cronExpression??"");R&&j&&await l.mutateAsync(j),(R||!j)&&(j=(await o.mutateAsync({cronExpression:u,config:i})).scheduleEventId)}else j&&(await l.mutateAsync(j),j="");const k=(i.llmModelId??"").trim(),T=k?(i.llmConnectionId||g||"").trim():(i.llmConnectionId??"").trim(),N={...i,cronExpression:u,scheduleEventId:j,agentContext:(i.agentContext??"").trim(),llmConnectionId:T,llmModelId:k};await r.mutateAsync(N),c(N),x(!0),setTimeout(()=>x(!1),3e3)};return s.jsxs(ne,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA Configuration"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure how the MCP QA agent validates registry entries."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[v&&s.jsx(U,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"Unsaved changes"}),m&&s.jsx(U,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 text-[10px]",children:"✓ Saved"}),s.jsx(F,{size:"sm",onClick:S,disabled:r.isPending||o.isPending||l.isPending||!v,children:r.isPending||o.isPending||l.isPending?"Saving...":"Save settings"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"QA mode",hint:"Defines HOW each MCP is validated: connectivity only, direct tool calls, or multi-step agent execution."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.monitorMode,onChange:u=>b({monitorMode:u.target.value}),children:[s.jsx("option",{value:"health_check",children:"Health check"}),s.jsx("option",{value:"tool_call",children:"Tool call"}),s.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"On failure",hint:"Automatic action to apply when an MCP fails tests in a run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.onFailure,onChange:u=>b({onFailure:u.target.value}),children:[s.jsx("option",{value:"none",children:"Do nothing"}),s.jsx("option",{value:"unlisted",children:"Unlist from store (keep in registry)"}),s.jsx("option",{value:"remove_public",children:"Remove from public store"}),s.jsx("option",{value:"remove_private",children:"Remove from private registry"}),s.jsx("option",{value:"remove_all",children:"Remove from all (public + private)"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"Test scope",hint:"Choose whether tests should run for public items, private items, or both."}),s.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPublicOnly,onChange:u=>b({testPublicOnly:u.target.checked,testPrivateOnly:u.target.checked?!1:i.testPrivateOnly})}),"Public only"]}),s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPrivateOnly,onChange:u=>b({testPrivateOnly:u.target.checked,testPublicOnly:u.target.checked?!1:i.testPublicOnly})}),"Private only"]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"Publish requests",hint:"Include pending publish requests in QA runs to validate them before publishing to the store."}),s.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.includePendingRequests,onChange:u=>b({includePendingRequests:u.target.checked})}),"Include pending requests in tests"]})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"What is tested?",hint:"Clarifies the difference between QA mode and test execution output."}),s.jsxs("div",{className:"rounded-md border border-input bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"QA mode"})," defines the execution strategy."]}),s.jsxs("p",{children:[s.jsx("strong",{children:"QA run history"})," stores past runs."]}),s.jsxs("p",{children:[s.jsx("strong",{children:"QA results log"})," shows per-MCP outcomes inside one run."]})]})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(Fe,{label:"Model (LLM binding)",hint:"Used only in Agentic mode to decide and chain tool calls."}),s.jsx(Fs,{connectionId:g,modelId:i.llmModelId??"",connections:y.map(u=>({id:u.id,title:u.title,icon:u.icon??null})),models:_.map(u=>({id:u.id,title:u.title||u.id,logo:u.logo??null,capabilities:u.capabilities??[]})),onConnectionChange:u=>b({llmConnectionId:u,llmModelId:""}),onModelChange:u=>b({llmModelId:u})})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(Fe,{label:"Additional test context (prompt)",hint:"Extra runtime context passed to the agent, such as valid emails, tenant IDs, or known test entities."}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7",onClick:()=>f(u=>!u),children:[h?"Hide":"View"," default system prompt"]})]}),s.jsx(At,{value:i.agentContext??"",onChange:u=>b({agentContext:u.target.value}),placeholder:'Example: Use "my-user@company.com" as a valid email for Google Drive share/create_permission tests.',rows:3}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use this field for real data required by some tools (valid email, fixed IDs, test environment details, etc)."}),h&&s.jsx("pre",{className:"text-[11px] bg-muted/50 border border-border rounded px-3 py-2 whitespace-pre-wrap max-h-64 overflow-auto",children:an})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(Fe,{label:"Schedule",hint:"Set automatic test runs. Manual mode runs only when you click Start QA run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.schedule??"manual",onChange:u=>b({schedule:u.target.value}),children:[s.jsx("option",{value:"manual",children:"Manual only"}),s.jsx("option",{value:"cron",children:"Cron schedule"})]}),(i.schedule??"manual")==="cron"&&s.jsx(ei,{value:i.cronExpression??"",onChange:u=>b({cronExpression:u})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"Per MCP timeout (ms)",hint:"Max total time allowed to validate one MCP."}),s.jsx(ye,{type:"number",value:i.perMcpTimeoutMs,onChange:u=>b({perMcpTimeoutMs:Number(u.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"Per tool timeout (ms)",hint:"Max time allowed for each individual tool call."}),s.jsx(ye,{type:"number",value:i.perToolTimeoutMs,onChange:u=>b({perToolTimeoutMs:Number(u.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Fe,{label:"Max agent steps",hint:"Maximum number of reasoning/tool steps in Agentic mode."}),s.jsx(ye,{type:"number",value:i.maxAgentSteps,onChange:u=>b({maxAgentSteps:Number(u.target.value)}),min:1,max:30})]})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["LLM fallback from Settings:"," ",s.jsxs("span",{className:"font-mono",children:[t||"-"," / ",e||"-"]})]})]})}function Fe(t){const e=K.c(13),{label:n,hint:r}=t;let o;e[0]!==n?(o=s.jsx(ie,{children:n}),e[0]=n,e[1]=o):o=e[1];const l=`About ${n}`;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(yn,{size:14}),e[2]=a):a=e[2];let i;e[3]!==l?(i=s.jsx(In,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":l,children:a})}),e[3]=l,e[4]=i):i=e[4];let c;e[5]!==r?(c=s.jsx(Mn,{side:"top",className:"max-w-72",children:r}),e[5]=r,e[6]=c):c=e[6];let m;e[7]!==i||e[8]!==c?(m=s.jsxs(Pn,{children:[i,c]}),e[7]=i,e[8]=c,e[9]=m):m=e[9];let x;return e[10]!==o||e[11]!==m?(x=s.jsxs("div",{className:"flex items-center gap-1.5",children:[o,m]}),e[10]=o,e[11]=m,e[12]=x):x=e[12],x}function ri(t){switch(t){case"authenticated":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20"}}function ii(t){switch(t){case"authenticated":return"Authenticated";case"needs_auth":return"Needs Auth";default:return"Not checked"}}function li({entry:t,onAuthChanged:e,failedToolsCount:n,failedResultCount:r}){const[o,l]=M.useState(!1),[a,i]=M.useState(""),[c,m]=M.useState(!1),x=Un(),{updateMutation:h}=ns(),f=t.mapping.connection_id,p=t.mapping.auth_status,d=t.item?.title??t.mapping.item_id,y=t.item?.server?.icons?.[0]?.src??null,g=t.item?.is_public??!1,C=t.item?.is_unlisted??!1,_=t.source==="request",v=Ge({queryKey:G.monitorConnectionAuthProbe(f),queryFn:async()=>Dn({url:`/mcp/${f}`,token:null}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),b=v.data,S=v.isLoading,u=b?.supportsOAuth??!1,j=b?.hasOAuthToken??!1,k=b?.isServerError??!1,T=b?.isAuthenticated??!1,N=S?"checking":k?"server_error":u?T?j?"oauth_connected":"connected":"oauth_available":T?"connected":"token_required",R=()=>{x.mutate({connectionId:f,authStatus:"authenticated"},{onSuccess:()=>e()})},w=async()=>{l(!0);try{const z=(await v.refetch()).data;if(!z){W.error(`Could not reach "${d}". The remote MCP may be down.`);return}if(z.isAuthenticated){W.success(`"${d}" is reachable. You can re-authenticate if needed.`);return}if(z.isServerError){W.error(`Server error for "${d}". The remote MCP may be down.`);return}if(!z.supportsOAuth){W.warning(`"${d}" does not support OAuth. Use the Token field to paste an API key.`);return}W.info(`Opening authentication window for "${d}"...`);const L=await En({connectionId:f,clientName:`MCP Test - ${d}`,timeout:18e4});if(L.error){W.error(`OAuth failed for "${d}": ${L.error}`);return}L.tokenInfo?(await fetch(`/api/connections/${f}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:L.tokenInfo.accessToken,refreshToken:L.tokenInfo.refreshToken,expiresIn:L.tokenInfo.expiresIn,scope:L.tokenInfo.scope,clientId:L.tokenInfo.clientId,clientSecret:L.tokenInfo.clientSecret,tokenEndpoint:L.tokenInfo.tokenEndpoint})})).ok||L.token&&await P(L.token):L.token&&await P(L.token),W.success(`"${d}" authenticated!`),R(),await v.refetch()}catch($){console.error("[MonitorConnectionsPanel] Auth error:",$),W.error(`Error: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},P=async $=>{if(!(await fetch("/mcp/self",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:"COLLECTION_CONNECTIONS_UPDATE",arguments:{id:f,data:{connection_token:$}}}})})).ok)throw new Error("Failed to save token")},D=async()=>{if(!a.trim()){W.error("Token cannot be empty.");return}l(!0);try{await P(a),W.success(`Token saved for "${d}"!`),m(!1),i(""),R(),await v.refetch()}catch($){W.error(`Error saving token: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},I=p==="authenticated"&&!j&&!c&&a.length===0,E=async $=>{if(_){W.info("Visibility controls are available only for store items.");return}if(!t.item){W.error("Registry item not found for this connection.");return}try{await h.mutateAsync({id:t.item.id,data:$}),W.success("Visibility updated"),e()}catch(z){W.error(z instanceof Error?z.message:"Failed to update visibility")}};return s.jsxs(ne,{className:"p-3 space-y-3 h-full",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:y?s.jsx("img",{src:y,alt:d,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:d.charAt(0).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:d}),s.jsx("p",{className:"text-xs text-muted-foreground break-all",children:t.remoteUrl??"-"}),s.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[s.jsx(U,{variant:"outline",className:J("text-[10px]",ri(p)),children:ii(p)}),s.jsx(U,{variant:g?"default":"secondary",className:"text-[10px]",children:g?"Public":"Not public"}),s.jsx(U,{variant:"outline",className:"text-[10px]",children:_?"Request":"Store"}),s.jsxs(U,{variant:"outline",className:J("text-[10px]",N==="server_error"?"border-destructive/40 text-destructive":N==="oauth_connected"?"border-emerald-500/30 text-emerald-600":N==="oauth_available"?"border-sky-500/30 text-sky-600":N==="token_required"?"border-amber-500/30 text-amber-600":"text-muted-foreground"),children:[N==="checking"&&"Checking auth...",N==="server_error"&&"Server error",N==="oauth_connected"&&"OAuth connected",N==="oauth_available"&&"OAuth available",N==="token_required"&&"Token/manual auth",N==="connected"&&"Connected"]}),C&&s.jsx(U,{variant:"outline",className:"text-[10px]",children:"Hidden in private"}),(r>0||n>0)&&s.jsxs(U,{variant:"destructive",className:"text-[10px]",children:[r," failed MCP / ",n," failed tools"]})]})]})]}),s.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:s.jsxs(St,{children:[s.jsx(kt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:16})})}),s.jsx(Rt,{align:"end",children:_?s.jsx(We,{disabled:!0,children:"Request item (no store visibility controls)"}):s.jsxs(s.Fragment,{children:[s.jsx(We,{onClick:()=>E({is_public:!1}),children:"Hide from public store"}),s.jsx(We,{onClick:()=>E({is_unlisted:!0}),children:"Hide from private store"}),s.jsx(We,{onClick:()=>E({is_public:!0,is_unlisted:!1}),children:"Show in both stores"})]})})]})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[u&&s.jsx(F,{size:"sm",onClick:w,disabled:o,children:o?"...":j?"Re-auth OAuth":"OAuth"}),s.jsx(F,{size:"sm",variant:"outline",onClick:()=>v.refetch(),disabled:o||S,children:S?"Checking...":"Re-check"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Token/API key (for MCPs that require manual auth)"}),I?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/50 text-muted-foreground font-mono text-xs",children:"••••••••••••••••"}),s.jsx("button",{type:"button",onClick:()=>m(!0),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted",title:"Replace token",children:"Edit"})]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{type:"password",placeholder:"Paste API token / key...",value:a,onChange:$=>i($.target.value),className:"h-8 text-xs flex-1",onKeyDown:$=>{$.key==="Enter"&&D()}}),s.jsx(F,{size:"sm",className:"h-8 text-xs",onClick:D,disabled:o||!a.trim(),children:"Save"}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{m(!1),i("")},children:"✕"})]})]})]})}function ai(){const t=K.c(55),e=$s(),r=Qt("completed").data?.items?.[0],o=Nt(r?.id,void 0,r?.status),l=On(),[a,i]=M.useState("all");let c,m,x,h,f,p;if(t[0]!==e||t[1]!==o.data?.items||t[2]!==a||t[3]!==l){const g=e.data?.items??[];let C;t[10]!==o.data?.items?(C=(o.data?.items??[]).reduce(di,{}),t[10]=o.data?.items,t[11]=C):C=t[11];const _=C;let v;t[12]!==a?(v=te=>a==="all"?!0:te.source===a,t[12]=a,t[13]=v):v=t[13];const b=g.filter(v);c=ne,f="p-4 space-y-3";let S,u,j,k;t[14]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("h3",{className:"text-sm font-semibold",children:"QA Connections"}),j=s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"We auto-detect auth type. Use OAuth when available, or always paste a Token/API key for manual auth MCPs."}),k=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Listing tools alone does not imply authenticated status."}),S=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Cards show MCP icon, auth status, and latest failed test counters."}),t[14]=S,t[15]=u,t[16]=j,t[17]=k):(S=t[14],u=t[15],j=t[16],k=t[17]);const T=a==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let N;t[18]!==T?(N=J("px-2.5 py-1 text-xs rounded-md transition-colors",T),t[18]=T,t[19]=N):N=t[19];let R;t[20]===Symbol.for("react.memo_cache_sentinel")?(R=()=>i("all"),t[20]=R):R=t[20];let w;t[21]!==N?(w=s.jsx("button",{type:"button",className:N,onClick:R,children:"All"}),t[21]=N,t[22]=w):w=t[22];const P=a==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let D;t[23]!==P?(D=J("px-2.5 py-1 text-xs rounded-md transition-colors",P),t[23]=P,t[24]=D):D=t[24];let I;t[25]===Symbol.for("react.memo_cache_sentinel")?(I=()=>i("store"),t[25]=I):I=t[25];let E;t[26]!==D?(E=s.jsx("button",{type:"button",className:D,onClick:I,children:"Store"}),t[26]=D,t[27]=E):E=t[27];const $=a==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let z;t[28]!==$?(z=J("px-2.5 py-1 text-xs rounded-md transition-colors",$),t[28]=$,t[29]=z):z=t[29];let L;t[30]===Symbol.for("react.memo_cache_sentinel")?(L=()=>i("request"),t[30]=L):L=t[30];let q;t[31]!==z?(q=s.jsx("button",{type:"button",className:z,onClick:L,children:"Requests"}),t[31]=z,t[32]=q):q=t[32];let V;t[33]!==w||t[34]!==E||t[35]!==q?(V=s.jsxs("div",{children:[u,j,k,S,s.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[w,E,q]})]}),t[33]=w,t[34]=E,t[35]=q,t[36]=V):V=t[36];let Y;t[37]!==l?(Y=()=>{l.mutate(void 0,{onSuccess:ci,onError:oi})},t[37]=l,t[38]=Y):Y=t[38];const X=l.isPending?"Syncing...":"Sync";let Z;t[39]!==l.isPending||t[40]!==Y||t[41]!==X?(Z=s.jsx(F,{size:"sm",variant:"outline",onClick:Y,disabled:l.isPending,children:X}),t[39]=l.isPending,t[40]=Y,t[41]=X,t[42]=Z):Z=t[42],t[43]!==V||t[44]!==Z?(p=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[V,Z]}),t[43]=V,t[44]=Z,t[45]=p):p=t[45],m="space-y-2",x=b.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:'No QA connections for this filter. Click "Sync" to create mappings from store items and pending requests.'}),h=b.length>0&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:b.map(te=>{const se=_[te.mapping.item_id]??{failedTools:0,failedResults:0};return s.jsx(li,{entry:te,onAuthChanged:()=>e.refetch(),failedToolsCount:se.failedTools,failedResultCount:se.failedResults},te.mapping.id)})}),t[0]=e,t[1]=o.data?.items,t[2]=a,t[3]=l,t[4]=c,t[5]=m,t[6]=x,t[7]=h,t[8]=f,t[9]=p}else c=t[4],m=t[5],x=t[6],h=t[7],f=t[8],p=t[9];let d;t[46]!==m||t[47]!==x||t[48]!==h?(d=s.jsxs("div",{className:m,children:[x,h]}),t[46]=m,t[47]=x,t[48]=h,t[49]=d):d=t[49];let y;return t[50]!==c||t[51]!==f||t[52]!==p||t[53]!==d?(y=s.jsxs(c,{className:f,children:[p,d]}),t[50]=c,t[51]=f,t[52]=p,t[53]=d,t[54]=y):y=t[54],y}function oi(t){return W.error(`Sync failed: ${t.message}`)}function ci(){return W.success("Connections synced (store + pending requests)")}function di(t,e){const n=t[e.item_id]??{failedTools:0,failedResults:0},r=e.tool_results.filter(mi).length;return n.failedTools=n.failedTools+r,(e.status==="failed"||e.status==="error")&&(n.failedResults=n.failedResults+1),t[e.item_id]=n,t}function mi(t){return!t.success}function Bs(t){switch(t){case"running":return"bg-blue-500/10 text-blue-600 border-blue-500/20";case"completed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"cancelled":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";case"pending":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return""}}function Gs(t,e){if(!t)return null;const n=e?new Date(e).getTime():Date.now(),r=new Date(t).getTime(),o=n-r;return o<1e3?`${o}ms`:o<6e4?`${(o/1e3).toFixed(1)}s`:`${Math.floor(o/6e4)}m ${Math.round(o%6e4/1e3)}s`}function Qs(t){const e=new Map;for(const n of t)e.has(n.toolName)&&e.delete(n.toolName),e.set(n.toolName,n);return Array.from(e.values())}function ui(t){return t.total_items?Math.min(100,Math.round(t.tested_items/t.total_items*100)):0}function xi(t){if(!t)return null;const e=t.match(/Not executed tools \((\d+)\/(\d+)\):/i);if(!e)return null;const n=Number(e[2]);return Number.isFinite(n)&&n>=0?n:null}function hi(t){const e=K.c(57),{result:n,index:r,icon:o}=t,[l,a]=M.useState(!1);let i;if(e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n.action_taken||e[4]!==n.agent_summary||e[5]!==n.connection_ok||e[6]!==n.duration_ms||e[7]!==n.error_message||e[8]!==n.id||e[9]!==n.item_title||e[10]!==n.status||e[11]!==n.tool_results||e[12]!==n.tools_listed){const c=Qs(n.tool_results),m=c.every(ji),x=c.filter(gi),h=x.filter(fi).length,f=x.filter(pi).length,p=x.length>0,d=x.length;let y;e[14]!==n.agent_summary?(y=xi(n.agent_summary),e[14]=n.agent_summary,e[15]=y):y=e[15];const g=y,C=Math.max(c.length,g??0),_=C>0?`${d}/${C} tools tested`:"0 tools";let v;e[16]!==l?(v=()=>a(!l),e[16]=l,e[17]=v):v=e[17];const b=r+1;let S;e[18]!==b?(S=s.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:b}),e[18]=b,e[19]=S):S=e[19];let u;e[20]!==o||e[21]!==n.item_title?(u=s.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:o?s.jsx("img",{src:o,alt:n.item_title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:n.item_title.charAt(0).toUpperCase()})}),e[20]=o,e[21]=n.item_title,e[22]=u):u=e[22];const j=n.status==="passed"?"text-emerald-600":n.status==="needs_auth"?"text-amber-600":"text-red-600";let k;e[23]!==j?(k=J("shrink-0",j),e[23]=j,e[24]=k):k=e[24];const T=n.status==="passed"?"✓":n.status==="needs_auth"?"🔑":"✗";let N;e[25]!==k||e[26]!==T?(N=s.jsx("span",{className:k,children:T}),e[25]=k,e[26]=T,e[27]=N):N=e[27];let R;e[28]!==n.item_title?(R=s.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:n.item_title}),e[28]=n.item_title,e[29]=R):R=e[29];let w;e[30]!==n.duration_ms?(w=s.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.duration_ms,"ms"]}),e[30]=n.duration_ms,e[31]=w):w=e[31];const P=n.status==="passed"?"text-emerald-600 border-emerald-500/20":n.status==="needs_auth"?"text-amber-600 border-amber-500/20":"text-red-600 border-red-500/20";let D;e[32]!==P?(D=J("text-[9px] capitalize shrink-0",P),e[32]=P,e[33]=D):D=e[33];let I;e[34]!==n.status?(I=n.status.replace("_"," "),e[34]=n.status,e[35]=I):I=e[35];let E;e[36]!==D||e[37]!==I?(E=s.jsx(U,{variant:"outline",className:D,children:I}),e[36]=D,e[37]=I,e[38]=E):E=e[38];let $;e[39]!==n.connection_ok?($=n.connection_ok?s.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"conn✓"}):s.jsx("span",{className:"text-[10px] text-red-600 shrink-0",children:"conn✗"}),e[39]=n.connection_ok,e[40]=$):$=e[40];const z=n.tools_listed&&s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:p?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-emerald-600",children:[h,"✓"]})," ",s.jsxs("span",{className:J(f>0?"text-red-600":""),children:[f,"✗"]})]}):m&&c.length>0?s.jsxs("span",{children:[c.length," tools found"]}):"no tools"});let L;e[41]!==_?(L=s.jsx(U,{variant:"outline",className:"text-[9px] shrink-0",children:_}),e[41]=_,e[42]=L):L=e[42];const q=l?"▲":"▼";let V;e[43]!==q?(V=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:q}),e[43]=q,e[44]=V):V=e[44];let Y;e[45]!==N||e[46]!==R||e[47]!==w||e[48]!==E||e[49]!==$||e[50]!==z||e[51]!==L||e[52]!==V||e[53]!==v||e[54]!==S||e[55]!==u?(Y=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors",onClick:v,children:[S,u,N,R,w,E,$,z,L,V]}),e[45]=N,e[46]=R,e[47]=w,e[48]=E,e[49]=$,e[50]=z,e[51]=L,e[52]=V,e[53]=v,e[54]=S,e[55]=u,e[56]=Y):Y=e[56],i=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[Y,l&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error_message})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[s.jsxs("span",{children:["Connection:"," ",s.jsx("span",{className:J(n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("span",{children:["Tools listed:"," ",s.jsx("span",{className:J(n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),n.action_taken!=="none"&&s.jsxs(U,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]})]}),p?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools tested: ",h," passed, ",f," failed"]}),s.jsx("div",{className:"space-y-0.5",children:x.map((X,Z)=>s.jsx(yi,{tool:X},`${n.id}-${X.toolName}-${Z}`))})]}):m&&c.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",c.length,") - not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:c.map((X,Z)=>s.jsx(U,{variant:"outline",className:"text-[10px] font-mono",children:X.toolName},`${n.id}-${X.toolName}-${Z}`))})]}):n.tools_listed?s.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No tools found on this server."}):null,n.agent_summary&&s.jsx("p",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5",children:n.agent_summary})]})]}),e[0]=l,e[1]=o,e[2]=r,e[3]=n.action_taken,e[4]=n.agent_summary,e[5]=n.connection_ok,e[6]=n.duration_ms,e[7]=n.error_message,e[8]=n.id,e[9]=n.item_title,e[10]=n.status,e[11]=n.tool_results,e[12]=n.tools_listed,e[13]=i}else i=e[13];return i}function pi(t){return!t.success}function fi(t){return t.success}function gi(t){return t.outputPreview!=="health_check: not called"}function ji(t){return t.outputPreview==="health_check: not called"}function yi(t){const e=K.c(30),{tool:n}=t,[r,o]=M.useState(!1);let l;e[0]!==r?(l=()=>o(!r),e[0]=r,e[1]=l):l=e[1];const a=n.success?"text-emerald-600":"text-red-600";let i;e[2]!==a?(i=J("font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let x;e[7]!==n.toolName?(x=s.jsx("span",{className:"font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=x):x=e[8];let h;e[9]!==n.durationMs?(h=s.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=h):h=e[10];let f;e[11]!==n.error?(f=n.error&&s.jsx("span",{className:"text-red-500 truncate max-w-28",title:n.error,children:n.error}),e[11]=n.error,e[12]=f):f=e[12];const p=r?"▲":"▼";let d;e[13]!==p?(d=s.jsx("span",{className:"text-muted-foreground",children:p}),e[13]=p,e[14]=d):d=e[14];let y;e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==x||e[19]!==h||e[20]!==f?(y=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1 text-[11px] hover:bg-muted/30 transition-colors",onClick:l,children:[m,x,h,f,d]}),e[15]=l,e[16]=d,e[17]=m,e[18]=x,e[19]=h,e[20]=f,e[21]=y):y=e[21];let g;e[22]!==r||e[23]!==n.error||e[24]!==n.input||e[25]!==n.outputPreview?(g=r&&s.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[n.error&&s.jsx("pre",{className:"bg-red-500/5 border border-red-500/10 rounded px-2 py-1 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:n.outputPreview})]})]}),e[22]=r,e[23]=n.error,e[24]=n.input,e[25]=n.outputPreview,e[26]=g):g=e[26];let C;return e[27]!==y||e[28]!==g?(C=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[y,g]}),e[27]=y,e[28]=g,e[29]=C):C=e[29],C}function bi({activeRunId:t,onRunChange:e}){const{settings:n}=As(),[r,o]=M.useState(null),[l,a]=M.useState(!1),i=M.useRef(0),c=M.useRef(null),m=An(),x=Ln(),h=ss(t),f=Qt(),p=$s(),d=h.data?.run??null,y=d?.status,g=d?.config_snapshot?.monitorMode??d?.config_snapshot?.testMode,C=Nt(t,void 0,y),_=(f.data?.items??[]).find(w=>w.status==="running"),v=f.data?.items?.[0]?.id;!t&&v&&c.current!==v&&(c.current=v,queueMicrotask(()=>{e(v)}));const b=async()=>{const w=Date.now();if(w-i.current<1e3)return;i.current=w;const P=r??n.monitorMode,D=await m.mutateAsync({...n,monitorMode:P});e(D.run.id)},S=async()=>{if(_&&_.id!==t&&_.status==="running"){a(!0);return}await b()},u=async()=>{t&&await x.mutateAsync(t)},j=d?.status==="running",k=d?Gs(d.started_at,d.finished_at):null,T=C.data?.items??[],N=(p.data?.items??[]).reduce((w,P)=>(w[P.mapping.item_id]=P.item?.server?.icons?.[0]?.src??null,w),{}),R=r??n.monitorMode;return s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs(ne,{className:"p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Current QA Run"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a full QA validation run and track results in real time."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[_&&_.id!==t&&s.jsxs(U,{variant:"outline",className:"text-[10px]",children:["Run in progress: ",_.id.slice(0,8)]}),s.jsxs(F,{size:"sm",onClick:S,disabled:m.isPending||j,className:"gap-1.5",children:[s.jsx($n,{size:14}),m.isPending?"Starting...":_&&_.id!==t?"Start another run":"Start QA run"]}),s.jsxs(F,{size:"sm",variant:"outline",onClick:u,disabled:!t||!j,className:"gap-1.5",children:[s.jsx(Ds,{size:14}),"Cancel"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA mode"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:R,onChange:w=>o(w.target.value),disabled:j,children:[s.jsx("option",{value:"health_check",children:"Health check"}),s.jsx("option",{value:"tool_call",children:"Tool call"}),s.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA run history (pick a previous run)"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:t??"",onChange:w=>e(w.target.value||void 0),children:[s.jsx("option",{value:"",children:"Auto-select latest run"}),(f.data?.items??[]).map(w=>s.jsxs("option",{value:w.id,children:[new Date(w.created_at).toLocaleString()," -"," ",w.status]},w.id))]})]})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:R==="health_check"?"Checks connectivity and tool listing only — no tool calls are made.":R==="tool_call"?"Calls each tool with empty inputs to verify it responds without errors.":"Uses an LLM model to execute chained tool calls and validate outputs."}),d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsx(U,{className:J("capitalize",Bs(d.status),d.status==="running"?"animate-pulse":""),children:d.status}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),k&&s.jsx("span",{className:"text-xs text-muted-foreground",children:k}),j&&d.current_item_id&&s.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:["QA on:"," ",s.jsx("span",{className:"font-mono",children:d.current_item_id})]})]}),s.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:J("h-full transition-all duration-500",d.failed_items>0?"bg-orange-500":"bg-emerald-500",j?"animate-pulse":""),style:{width:`${ui(d)}%`}})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:d.passed_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:d.failed_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:d.skipped_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:d.total_items})]})]})]}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"No run selected yet. Start a new run to begin."})]}),s.jsxs(ne,{className:"p-4 space-y-2 min-h-[360px]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["QA results log (",T.length,")"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Live per-MCP test output for the selected run."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[j&&s.jsx(U,{className:"bg-blue-500/10 text-blue-600 border-blue-500/20 animate-pulse",children:"run in progress"}),d&&s.jsxs(U,{variant:"outline",className:"text-[10px]",children:["progress: ",d.tested_items," of ",d.total_items," MCPs"]}),g&&s.jsxs(U,{variant:"outline",className:"text-[10px]",children:["mode: ",g.replace("_"," ")]})]})]}),T.length===0?s.jsx("div",{className:"h-[280px] rounded border border-dashed border-border flex items-center justify-center text-xs text-muted-foreground",children:"No results yet. Start a run to see live logs here."}):s.jsx("div",{ref:w=>{w&&j&&w.scrollHeight-w.scrollTop-w.clientHeight<120&&requestAnimationFrame(()=>{w.scrollTop=w.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:T.map((w,P)=>s.jsx(hi,{result:w,index:P,icon:N[w.item_id]},w.id))})]})]}),s.jsx(Gt,{open:l,onOpenChange:a,children:s.jsxs(Bt,{children:[s.jsxs(zt,{children:[s.jsx(Lt,{children:"Start another test run?"}),s.jsxs(Ot,{children:["There is already a run in progress",_?` (${_.id})`:"",". Starting another run may increase database load and slow down both executions."]})]}),s.jsxs(Ft,{children:[s.jsx(Ut,{children:"Cancel"}),s.jsx(qt,{onClick:()=>{a(!1),b()},children:"Start anyway"})]})]})})]})}function Ks(t){switch(t){case"passed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"error":return"bg-orange-500/10 text-orange-600 border-orange-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";case"skipped":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";default:return""}}function vi(t){switch(t){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function Ni(t){const e=K.c(27),{tool:n}=t,[r,o]=M.useState(!1);let l;e[0]!==r?(l=()=>o(!r),e[0]=r,e[1]=l):l=e[1];const a=n.success?"text-emerald-600":"text-red-600";let i;e[2]!==a?(i=J("text-xs font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let x;e[7]!==n.toolName?(x=s.jsx("span",{className:"text-xs font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=x):x=e[8];let h;e[9]!==n.durationMs?(h=s.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=h):h=e[10];const f=r?"▲":"▼";let p;e[11]!==f?(p=s.jsx("span",{className:"text-[10px] text-muted-foreground",children:f}),e[11]=f,e[12]=p):p=e[12];let d;e[13]!==l||e[14]!==m||e[15]!==x||e[16]!==h||e[17]!==p?(d=s.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",onClick:l,children:[m,x,h,p]}),e[13]=l,e[14]=m,e[15]=x,e[16]=h,e[17]=p,e[18]=d):d=e[18];let y;e[19]!==r||e[20]!==n.error||e[21]!==n.input||e[22]!==n.outputPreview?(y=r&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[n.error&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error})]}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output preview"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:n.outputPreview})]}),!n.error&&!n.outputPreview&&(!n.input||Object.keys(n.input).length===0)&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"No additional details."})]}),e[19]=r,e[20]=n.error,e[21]=n.input,e[22]=n.outputPreview,e[23]=y):y=e[23];let g;return e[24]!==d||e[25]!==y?(g=s.jsxs("div",{className:"rounded border border-border",children:[d,y]}),e[24]=d,e[25]=y,e[26]=g):g=e[26],g}function wi(t){const e=K.c(52),{result:n}=t,[r,o]=M.useState(n.status!=="passed");let l;if(e[0]!==r||e[1]!==n.action_taken||e[2]!==n.agent_summary||e[3]!==n.connection_ok||e[4]!==n.duration_ms||e[5]!==n.error_message||e[6]!==n.id||e[7]!==n.item_title||e[8]!==n.status||e[9]!==n.tool_results||e[10]!==n.tools_listed){const a=Qs(n.tool_results),i=a.every(Si),c=a.filter(ki),m=c.filter(_i).length,x=c.filter(Ci).length,h=c.length>0;let f;e[12]!==r?(f=()=>o(!r),e[12]=r,e[13]=f):f=e[13];let p;e[14]!==n.status?(p=vi(n.status),e[14]=n.status,e[15]=p):p=e[15];let d;e[16]!==p?(d=s.jsx("span",{className:"text-base shrink-0",children:p}),e[16]=p,e[17]=d):d=e[17];let y;e[18]!==n.item_title?(y=s.jsx("p",{className:"text-sm font-medium truncate",children:n.item_title}),e[18]=n.item_title,e[19]=y):y=e[19];let g;e[20]!==n.duration_ms?(g=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.duration_ms,"ms"]}),e[20]=n.duration_ms,e[21]=g):g=e[21];const C=n.connection_ok?"✓":"✗";let _;e[22]!==C?(_=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["conn: ",C]}),e[22]=C,e[23]=_):_=e[23];const v=n.tools_listed?"✓":"✗";let b;e[24]!==v?(b=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["tools listed: ",v]}),e[24]=v,e[25]=b):b=e[25];const S=a.length>0&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:h?s.jsxs(s.Fragment,{children:["tools: ",m,"✓ ",x,"✗"]}):s.jsxs(s.Fragment,{children:[a.length," tools found"]})});let u;e[26]!==n.action_taken?(u=n.action_taken!=="none"&&s.jsxs(U,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]}),e[26]=n.action_taken,e[27]=u):u=e[27];let j;e[28]!==b||e[29]!==S||e[30]!==u||e[31]!==g||e[32]!==_?(j=s.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[g,_,b,S,u]}),e[28]=b,e[29]=S,e[30]=u,e[31]=g,e[32]=_,e[33]=j):j=e[33];let k;e[34]!==j||e[35]!==y?(k=s.jsxs("div",{className:"min-w-0 flex-1",children:[y,j]}),e[34]=j,e[35]=y,e[36]=k):k=e[36];let T;e[37]!==n.status?(T=J("capitalize shrink-0",Ks(n.status)),e[37]=n.status,e[38]=T):T=e[38];let N;e[39]!==n.status?(N=n.status.replace("_"," "),e[39]=n.status,e[40]=N):N=e[40];let R;e[41]!==T||e[42]!==N?(R=s.jsx(U,{className:T,children:N}),e[41]=T,e[42]=N,e[43]=R):R=e[43];const w=r?"▲":"▼";let P;e[44]!==w?(P=s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:w}),e[44]=w,e[45]=P):P=e[45];let D;e[46]!==k||e[47]!==R||e[48]!==P||e[49]!==f||e[50]!==d?(D=s.jsxs("button",{type:"button",className:"w-full text-left px-4 py-3 flex items-center gap-3 hover:bg-muted/30 transition-colors",onClick:f,children:[d,k,R,P]}),e[46]=k,e[47]=R,e[48]=P,e[49]=f,e[50]=d,e[51]=D):D=e[51],l=s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[D,r&&s.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:J("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"Connected":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:J("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?`Yes (${a.length})`:"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Action Taken"}),s.jsx("p",{className:"text-xs font-medium capitalize",children:n.action_taken.replace(/_/g," ")})]})]}),n.error_message&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error Message"}),s.jsx("pre",{className:"text-xs bg-red-500/5 border border-red-500/10 rounded px-3 py-2 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),h?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tool Results (",m," passed, ",x," failed)"]}),s.jsx("div",{className:"space-y-1",children:c.map((I,E)=>s.jsx(Ni,{tool:I},`${n.id}-${I.toolName}-${E}`))})]}):i&&a.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",a.length,") — not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:a.map((I,E)=>s.jsx(U,{variant:"outline",className:"text-[10px] font-mono",children:I.toolName},`${n.id}-${I.toolName}-${E}`))})]}):null,n.agent_summary&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Agent Summary"}),s.jsx("p",{className:"text-xs bg-muted/50 rounded px-3 py-2",children:n.agent_summary})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.agent_summary,e[3]=n.connection_ok,e[4]=n.duration_ms,e[5]=n.error_message,e[6]=n.id,e[7]=n.item_title,e[8]=n.status,e[9]=n.tool_results,e[10]=n.tools_listed,e[11]=l}else l=e[11];return l}function Ci(t){return!t.success}function _i(t){return t.success}function ki(t){return t.outputPreview!=="health_check: not called"}function Si(t){return t.outputPreview==="health_check: not called"}function Ri(t){const e=K.c(4),{value:n,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[{value:"all",label:"All"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"},{value:"error",label:"Error"},{value:"needs_auth",label:"Needs Auth"},{value:"skipped",label:"Skipped"}],e[0]=o):o=e[0];const l=o;let a;return e[1]!==r||e[2]!==n?(a=s.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(i=>s.jsx("button",{type:"button",className:J("text-[11px] px-2 py-0.5 rounded-full border transition-colors",n===i.value?"bg-primary text-primary-foreground border-primary":"bg-muted/30 border-border hover:bg-muted/50"),onClick:()=>r(i.value),children:i.label},i.value))}),e[1]=r,e[2]=n,e[3]=a):a=e[3],a}function Ti(t){const e=K.c(46),{runId:n}=t,[r,o]=M.useState("all"),l=ss(n),a=l.data?.run,i=Nt(n,void 0,a?.status);let c;e[0]!==i.data?.items?(c=i.data?.items??[],e[0]=i.data?.items,e[1]=c):c=e[1];const m=c;let x;e[2]!==m||e[3]!==r?(x=r==="all"?m:m.filter(w=>w.status===r),e[2]=m,e[3]=r,e[4]=x):x=e[4];const h=x;if(!n){let w;return e[5]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(ne,{className:"p-6 text-center space-y-2",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a run to inspect details."})}),e[5]=w):w=e[5],w}let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("h3",{className:"text-sm font-semibold",children:"Run Detail"}),e[6]=f):f=e[6];let p;e[7]!==n?(p=s.jsxs("div",{children:[f,s.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:n})]}),e[7]=n,e[8]=p):p=e[8];let d;e[9]!==a?(d=a&&s.jsx(U,{className:J("capitalize",Ks(a.status)),children:a.status}),e[9]=a,e[10]=d):d=e[10];let y;e[11]!==i||e[12]!==l?(y=s.jsx(F,{size:"sm",variant:"outline",onClick:()=>{l.refetch(),i.refetch()},children:"Refresh"}),e[11]=i,e[12]=l,e[13]=y):y=e[13];let g;e[14]!==d||e[15]!==y?(g=s.jsxs("div",{className:"flex items-center gap-2",children:[d,y]}),e[14]=d,e[15]=y,e[16]=g):g=e[16];let C;e[17]!==p||e[18]!==g?(C=s.jsx(ne,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,g]})}),e[17]=p,e[18]=g,e[19]=C):C=e[19];let _;e[20]!==a?(_=a&&s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:a.total_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tested"}),s.jsx("p",{className:"text-lg font-bold",children:a.tested_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:a.passed_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:a.failed_items})]}),s.jsxs(ne,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:a.skipped_items})]})]}),e[20]=a,e[21]=_):_=e[21];let v;e[22]!==a?(v=a&&(a.started_at||a.finished_at)&&s.jsxs(ne,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[a.started_at&&s.jsxs("span",{children:["Started: ",new Date(a.started_at).toLocaleString()]}),a.finished_at&&s.jsxs("span",{children:["Finished: ",new Date(a.finished_at).toLocaleString()]}),a.started_at&&a.finished_at&&s.jsxs("span",{className:"font-medium text-foreground",children:["Duration:"," ",((new Date(a.finished_at).getTime()-new Date(a.started_at).getTime())/1e3).toFixed(1),"s"]})]}),e[22]=a,e[23]=v):v=e[23];let b;e[24]!==r?(b=s.jsx(Ri,{value:r,onChange:o}),e[24]=r,e[25]=b):b=e[25];const S=h.length!==1?"s":"";let u;e[26]!==h.length||e[27]!==S?(u=s.jsxs("span",{className:"text-xs text-muted-foreground",children:[h.length," result",S]}),e[26]=h.length,e[27]=S,e[28]=u):u=e[28];let j;e[29]!==b||e[30]!==u?(j=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b,u]}),e[29]=b,e[30]=u,e[31]=j):j=e[31];let k;e[32]!==m||e[33]!==h.length?(k=h.length===0&&s.jsx(ne,{className:"p-4 text-sm text-muted-foreground text-center",children:m.length===0?"No test results yet.":"No results match the current filter."}),e[32]=m,e[33]=h.length,e[34]=k):k=e[34];let T;e[35]!==h?(T=h.map(Ii),e[35]=h,e[36]=T):T=e[36];let N;e[37]!==k||e[38]!==T?(N=s.jsxs("div",{className:"space-y-2",children:[k,T]}),e[37]=k,e[38]=T,e[39]=N):N=e[39];let R;return e[40]!==v||e[41]!==j||e[42]!==N||e[43]!==C||e[44]!==_?(R=s.jsxs("div",{className:"space-y-3",children:[C,_,v,j,N]}),e[40]=v,e[41]=j,e[42]=N,e[43]=C,e[44]=_,e[45]=R):R=e[45],R}function Ii(t){return s.jsx(wi,{result:t},t.id)}function Mi(t){return t.tested_items?`${Math.round(t.passed_items/t.tested_items*100)}%`:"-"}function Pi(t){const e=K.c(20),{selectedRunId:n,onSelectRun:r}=t,o=Qt();let l;e[0]!==o.data?.items?(l=o.data?.items??[],e[0]=o.data?.items,e[1]=l):l=e[1];const a=l;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=i):i=e[2];let c;e[3]!==o?(c=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i,s.jsx(F,{size:"sm",variant:"outline",onClick:()=>o.refetch(),children:"Refresh"})]}),e[3]=o,e[4]=c):c=e[4];let m;e[5]!==a.length?(m=a.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs yet. Start QA from the Dashboard tab."}),e[5]=a.length,e[6]=m):m=e[6];let x;if(e[7]!==r||e[8]!==a||e[9]!==n){let p;e[11]!==r||e[12]!==n?(p=d=>{const y=Gs(d.started_at,d.finished_at),g=Mi(d),C=n===d.id;return s.jsxs("button",{type:"button",onClick:()=>r(d.id),className:J("w-full text-left rounded-lg border p-3 transition-colors",C?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(d.created_at).toLocaleString()})}),s.jsx(U,{className:J("capitalize",Bs(d.status)),children:d.status})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[s.jsxs("span",{className:"text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),s.jsxs("span",{className:"text-emerald-600 font-medium",children:[d.passed_items," passed"]}),d.failed_items>0&&s.jsxs("span",{className:"text-red-600 font-medium",children:[d.failed_items," failed"]}),d.skipped_items>0&&s.jsxs("span",{className:"text-muted-foreground",children:[d.skipped_items," skipped"]}),s.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",g]}),y&&s.jsx("span",{className:"text-muted-foreground",children:y})]}),d.config_snapshot&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[s.jsx(U,{variant:"outline",className:"text-[9px]",children:(d.config_snapshot.monitorMode??d.config_snapshot.testMode??"health_check").replace("_"," ")}),d.config_snapshot.onFailure!=="none"&&s.jsxs(U,{variant:"outline",className:"text-[9px] text-red-600",children:["on fail:"," ",d.config_snapshot.onFailure.replace(/_/g," ")]})]})]},d.id)},e[11]=r,e[12]=n,e[13]=p):p=e[13],x=a.map(p),e[7]=r,e[8]=a,e[9]=n,e[10]=x}else x=e[10];let h;e[14]!==m||e[15]!==x?(h=s.jsxs("div",{className:"space-y-2 max-h-[520px] overflow-auto",children:[m,x]}),e[14]=m,e[15]=x,e[16]=h):h=e[16];let f;return e[17]!==c||e[18]!==h?(f=s.jsx(ne,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[c,h]})}),e[17]=c,e[18]=h,e[19]=f):f=e[19],f}function Ei(){const t=K.c(20),[e,n]=M.useState(void 0),[r,o]=M.useState("tests"),a=ss(e).data?.run?.status,i=Nt(e,void 0,a);let c;t[0]!==i.data?.items?(c=i.data?.items??[],t[0]=i.data?.items,t[1]=c):c=t[1];let m;t[2]!==c?(m=c.filter(Di),t[2]=c,t[3]=m):m=t[3];const x=m;let h;t[4]===Symbol.for("react.memo_cache_sentinel")?(h=[{id:"tests",label:"Tests"},{id:"configuration",label:"Configuration"},{id:"connections",label:"Connections"}],t[4]=h):h=t[4];let f;t[5]!==r?(f=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:h.map(C=>{const _=r===C.id;return s.jsx("button",{type:"button",className:J("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",_?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>o(C.id),children:s.jsx("span",{children:C.label})},C.id)})}),t[5]=r,t[6]=f):f=t[6];let p;t[7]!==e||t[8]!==r||t[9]!==x?(p=r==="tests"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(bi,{activeRunId:e,onRunChange:n}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[s.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[e&&s.jsx(Ti,{runId:e}),s.jsx(Pi,{selectedRunId:e,onSelectRun:n})]}),s.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["Broken MCPs"," ",x.length>0&&s.jsx(U,{variant:"destructive",className:"text-[10px] ml-1",children:x.length})]}),s.jsx(Qr,{results:x})]})]})]}),t[7]=e,t[8]=r,t[9]=x,t[10]=p):p=t[10];let d;t[11]!==r?(d=r==="configuration"&&s.jsx(ni,{}),t[11]=r,t[12]=d):d=t[12];let y;t[13]!==r?(y=r==="connections"&&s.jsx(ai,{}),t[13]=r,t[14]=y):y=t[14];let g;return t[15]!==f||t[16]!==p||t[17]!==d||t[18]!==y?(g=s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[f,p,d,y]}),t[15]=f,t[16]=p,t[17]=d,t[18]=y,t[19]=g):g=t[19],g}function Di(t){return t.status==="failed"||t.status==="error"}function $i(t){const e=K.c(9),{activeTab:n,onChange:r,items:o}=t;let l;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==r?(i=c=>{const m=n===c.tab,x=c.icon;return s.jsxs("button",{type:"button",className:J("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",m?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>r(c.tab),children:[s.jsx(x,{size:14}),s.jsx("span",{children:c.label}),typeof c.count=="number"&&c.count>0&&s.jsx("span",{className:"min-w-4 h-4 px-1 inline-flex items-center justify-center rounded-full bg-primary/15 text-[10px] font-semibold",children:c.count})]},c.id)},e[4]=n,e[5]=r,e[6]=i):i=e[6],l=o.map(i),e[0]=n,e[1]=o,e[2]=r,e[3]=l}else l=e[3];let a;return e[7]!==l?(a=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:l}),e[7]=l,e[8]=a):a=e[8],a}function $l(){const t=K.c(52),[e,n]=M.useState("items"),[r,o]=M.useState(null),{registryName:l,registryIcon:a,registryLLMConnectionId:i,registryLLMModelId:c,acceptPublishRequests:m,requireApiToken:x,storePrivateOnly:h}=Kt(et),f=Hn(),p=Bn(),d=`${l}|${a}|${i}|${c}|${m}|${x}|${h}`;!m&&e==="requests"&&n("items");const y=f.data?.pending??0,g=p.brokenCount>0?p.brokenCount:void 0;let C;t[0]!==g?(C={id:"items",label:"Items",icon:on,tab:"items",count:g},t[0]=g,t[1]=C):C=t[1];let _;t[2]!==m||t[3]!==y?(_=m?[{id:"requests",label:"Requests",icon:bt,tab:"requests",count:y}]:[],t[2]=m,t[3]=y,t[4]=_):_=t[4];let v,b;t[5]===Symbol.for("react.memo_cache_sentinel")?(v={id:"qa",label:"QA",icon:ts,tab:"qa"},b={id:"settings",label:"Settings",icon:cn,tab:"settings"},t[5]=v,t[6]=b):(v=t[5],b=t[6]);let S;t[7]!==C||t[8]!==_?(S=[C,..._,v,b],t[7]=C,t[8]=_,t[9]=S):S=t[9];const u=S;let j;t[10]===Symbol.for("react.memo_cache_sentinel")?(j=()=>n("settings"),t[10]=j):j=t[10];let k;t[11]!==a||t[12]!==l?(k=s.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:a?s.jsx("img",{src:a,alt:l,className:"h-full w-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:l.slice(0,1).toUpperCase()})}),t[11]=a,t[12]=l,t[13]=k):k=t[13];let T;t[14]!==l?(T=s.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:l}),t[14]=l,t[15]=T):T=t[15];let N;t[16]!==k||t[17]!==T?(N=s.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:j,children:[k,T]}),t[16]=k,t[17]=T,t[18]=N):N=t[18];let R;t[19]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),t[19]=R):R=t[19];let w;t[20]!==e||t[21]!==u?(w=s.jsx($i,{activeTab:e,onChange:n,items:u}),t[20]=e,t[21]=u,t[22]=w):w=t[22];let P;t[23]!==w||t[24]!==N?(P=s.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[N,R,w]})}),t[23]=w,t[24]=N,t[25]=P):P=t[25];let D;t[26]!==e?(D=e==="items"&&s.jsx(Pr,{}),t[26]=e,t[27]=D):D=t[27];let I;t[28]!==m||t[29]!==e?(I=e==="requests"&&m&&s.jsx(Ur,{}),t[28]=m,t[29]=e,t[30]=I):I=t[30];let E;t[31]!==e?(E=e==="qa"&&s.jsx(Ei,{}),t[31]=e,t[32]=E):E=t[32];let $;t[33]!==m||t[34]!==e||t[35]!==a||t[36]!==i||t[37]!==c||t[38]!==l||t[39]!==x||t[40]!==r||t[41]!==d||t[42]!==h?($=e==="settings"&&s.jsx(Gr,{initialName:l,initialIcon:a,initialLLMConnectionId:i,initialLLMModelId:c,initialAcceptPublishRequests:m,initialRequireApiToken:x,initialStorePrivateOnly:h,revealedKey:r,onRevealedKeyChange:o},d),t[33]=m,t[34]=e,t[35]=a,t[36]=i,t[37]=c,t[38]=l,t[39]=x,t[40]=r,t[41]=d,t[42]=h,t[43]=$):$=t[43];let z;t[44]!==D||t[45]!==I||t[46]!==E||t[47]!==$?(z=s.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[D,I,E,$]}),t[44]=D,t[45]=I,t[46]=E,t[47]=$,t[48]=z):z=t[48];let L;return t[49]!==P||t[50]!==z?(L=s.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[P,z]}),t[49]=P,t[50]=z,t[51]=L):L=t[51],L}export{$l as default};
@@ -1 +0,0 @@
1
- import{I as u}from"./infiniteQueryObserver-CclLryfN.js";import{B as i}from"./index-CSorKJjK.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{B as u,aa as s}from"./index-CSorKJjK.js";function o(e,r){return u(e,s,r)}export{o as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./infiniteQueryObserver-CclLryfN.js";import{B as u,D as n}from"./index-CSorKJjK.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};