decocms 2.179.2 → 2.179.3

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 (383) hide show
  1. package/dist/client/assets/{AlertCircle-QngH9BVd.js → AlertCircle-DcuzO-dN.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-BUW8XsMa.js → AlignLeft-DH6vJ97u.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-Ba2t7m6d.js → ArrowDown-DrJY3Wf3.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-DX2ldnBo.js → ArrowLeft-B0zQkfl0.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-Wy3Qa9X3.js → ArrowUp-B4DKDJey.js} +1 -1
  6. package/dist/client/assets/{Building02-DW6RLSwU.js → Building02-B5vUKe4K.js} +1 -1
  7. package/dist/client/assets/{Check-CLxUgI8Z.js → Check-5nIJP_0B.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-DDKCxiAn.js → CheckCircle-CPfAK_ok.js} +1 -1
  9. package/dist/client/assets/{CheckSquare-IgZnioYh.js → CheckSquare-Bd5OlGNx.js} +1 -1
  10. package/dist/client/assets/{CheckVerified02-Brnp4Z-Q.js → CheckVerified02-BImD45AM.js} +1 -1
  11. package/dist/client/assets/{ChevronDown-D0b1rvAp.js → ChevronDown-t60R5l2B.js} +1 -1
  12. package/dist/client/assets/{ChevronLeft-BOF7bp9d.js → ChevronLeft-lVdUD9SW.js} +1 -1
  13. package/dist/client/assets/{ChevronRight-BEUO8jhU.js → ChevronRight-3uKoJ2yX.js} +1 -1
  14. package/dist/client/assets/{ChevronUp-BWhuIqS7.js → ChevronUp-l7iXrppT.js} +1 -1
  15. package/dist/client/assets/{Clock-Aquumu5W.js → Clock-Cu62NiMl.js} +1 -1
  16. package/dist/client/assets/{Code01-_in0gxFd.js → Code01-DA4cXrzu.js} +1 -1
  17. package/dist/client/assets/{Container-b65PFshp.js → Container-Cvd3ILsk.js} +1 -1
  18. package/dist/client/assets/{Copy01-Ds0OKZs5.js → Copy01-DCmX2pvi.js} +1 -1
  19. package/dist/client/assets/{Dataflow03-CE4IJeUz.js → Dataflow03-SvWKmU9-.js} +1 -1
  20. package/dist/client/assets/{DotsHorizontal-EK1-V4Yv.js → DotsHorizontal-DE3Ptwny.js} +1 -1
  21. package/dist/client/assets/{DotsVertical-Bo0fAyx-.js → DotsVertical-CZep1rYf.js} +1 -1
  22. package/dist/client/assets/{Download01-CN3AkzFm.js → Download01-DOZIvPhC.js} +1 -1
  23. package/dist/client/assets/{Edit01-BeW3IgwV.js → Edit01-Bh7u1xp-.js} +1 -1
  24. package/dist/client/assets/{Edit05-DDQmnS5O.js → Edit05-DwDDlBNQ.js} +1 -1
  25. package/dist/client/assets/{Eye-Cqad01Et.js → Eye-D3Q7o9JY.js} +1 -1
  26. package/dist/client/assets/{EyeOff-rTYDCZUH.js → EyeOff--TPuyP7J.js} +1 -1
  27. package/dist/client/assets/{File02-k_9AZvHT.js → File02-6xeEPCuC.js} +1 -1
  28. package/dist/client/assets/{File06-BAp2UeVQ.js → File06-BocZAjHf.js} +1 -1
  29. package/dist/client/assets/{FilterLines-BQVg1PzI.js → FilterLines-CUdG83Ae.js} +1 -1
  30. package/dist/client/assets/{Globe01-sBw0ReRO.js → Globe01-BTdgnOS2.js} +1 -1
  31. package/dist/client/assets/{Globe02-DlxZmkSI.js → Globe02-X8fGWI0t.js} +1 -1
  32. package/dist/client/assets/{Grid01-B9zEjFyx.js → Grid01-NkSMXhQ7.js} +1 -1
  33. package/dist/client/assets/{Home02-DsMimBHw.js → Home02-BmcJp5G2.js} +1 -1
  34. package/dist/client/assets/{Image01-zSA25K9S.js → Image01-RwxwuRZg.js} +1 -1
  35. package/dist/client/assets/{Inbox01-Bcon6dDK.js → Inbox01-B7dU6IpS.js} +1 -1
  36. package/dist/client/assets/{InfoCircle-CA8mfcG6.js → InfoCircle-BO2XWy7v.js} +1 -1
  37. package/dist/client/assets/{Key01-V3zgT2bk.js → Key01-CjhxaGrC.js} +1 -1
  38. package/dist/client/assets/{LayersTwo01-D3otbQFN.js → LayersTwo01-DEwkReGL.js} +1 -1
  39. package/dist/client/assets/{Link01-VlHez4tu.js → Link01-h9aUM7NA.js} +1 -1
  40. package/dist/client/assets/{LinkExternal01-vs3DKlfq.js → LinkExternal01-CmkQ0Pr-.js} +1 -1
  41. package/dist/client/assets/{List-D6xZGoxJ.js → List-BbeB05v1.js} +1 -1
  42. package/dist/client/assets/{Loading01-DQphO9Su.js → Loading01-D0sCOwf7.js} +1 -1
  43. package/dist/client/assets/{Lock01-Cbqd9PVH.js → Lock01-DFfVnVtc.js} +1 -1
  44. package/dist/client/assets/{Play-jCDYHrdu.js → Play-hGa2UcUZ.js} +1 -1
  45. package/dist/client/assets/{Plus-CURSuoDd.js → Plus-Dcf0Y3wA.js} +1 -1
  46. package/dist/client/assets/{RefreshCcw01-oV1XFIRn.js → RefreshCcw01-BOXuamrY.js} +1 -1
  47. package/dist/client/assets/{Save01-CpNh-fPw.js → Save01-CA0I32a6.js} +1 -1
  48. package/dist/client/assets/{SearchMd-C8ADHGFY.js → SearchMd-BSRGE1t4.js} +1 -1
  49. package/dist/client/assets/{Settings01-B76KnDHb.js → Settings01-CCUkMwLj.js} +1 -1
  50. package/dist/client/assets/{Shield01-BodC6YjW.js → Shield01-BYpsgCVA.js} +1 -1
  51. package/dist/client/assets/{Terminal-BHkLJhoR.js → Terminal-ZymOmGb9.js} +1 -1
  52. package/dist/client/assets/{Tool01-DlbILfZg.js → Tool01-Doogi-IK.js} +1 -1
  53. package/dist/client/assets/{Trash01-CYMRq_nY.js → Trash01-Cs72bTP6.js} +1 -1
  54. package/dist/client/assets/{Upload01-BQ7z5iC5.js → Upload01-ByUvmqDm.js} +1 -1
  55. package/dist/client/assets/{Users03-DEpvReeu.js → Users03-CGvJARf5.js} +1 -1
  56. package/dist/client/assets/{X-BT_y3J3a.js → X-CD9ZB6hw.js} +1 -1
  57. package/dist/client/assets/{XClose-C-H07PEn.js → XClose-BxUlnJUs.js} +1 -1
  58. package/dist/client/assets/{Zap-BY3Hn1l9.js → Zap-0WHKFRes.js} +1 -1
  59. package/dist/client/assets/{agent-connections-preview-DbwllQSw.js → agent-connections-preview-BEmLqtx5.js} +1 -1
  60. package/dist/client/assets/agent-detail-jg81y7ZA.js +2 -0
  61. package/dist/client/assets/agents-PmHD6Xb_.js +1 -0
  62. package/dist/client/assets/{ai-providers-logos-DGTpC_MW.js → ai-providers-logos-C_voEDmL.js} +1 -1
  63. package/dist/client/assets/{alert-dialog-BqCiJDa8.js → alert-dialog-qmvoIx9J.js} +3 -3
  64. package/dist/client/assets/{auth-catchall-DPwCqyhO.js → auth-catchall-ByYcT8WN.js} +1 -1
  65. package/dist/client/assets/automation-detail-C1-q2EzY.js +1 -0
  66. package/dist/client/assets/automations-C9eao1B2.js +1 -0
  67. package/dist/client/assets/avatar-DeGeJRAR.js +1 -0
  68. package/dist/client/assets/badge-Cjjl_FHP.js +1 -0
  69. package/dist/client/assets/{binder-CuBUxi11.js → binder-C1eSZFT4.js} +1 -1
  70. package/dist/client/assets/{breadcrumb-BWfepeob.js → breadcrumb-C8hDXS86.js} +1 -1
  71. package/dist/client/assets/{card-gfMzoGpr.js → card-CoyaoT6W.js} +1 -1
  72. package/dist/client/assets/{checkbox-DygphnIU.js → checkbox-D5DFx9da.js} +1 -1
  73. package/dist/client/assets/{collapsible-BJo6q_NJ.js → collapsible-DcaWkNTt.js} +1 -1
  74. package/dist/client/assets/{collection-detail-fTigPh-V.js → collection-detail-Dsgpohom.js} +3 -3
  75. package/dist/client/assets/{collection-display-button-C42ZnuS7.js → collection-display-button-BcIJp1SX.js} +1 -1
  76. package/dist/client/assets/{collection-search-Dzoe9W56.js → collection-search-nKZEJ_r3.js} +1 -1
  77. package/dist/client/assets/{collection-table-wrapper-Bka5CUqj.js → collection-table-wrapper-Bq15EL3p.js} +1 -1
  78. package/dist/client/assets/{collection-tabs-D9qLvNTu.js → collection-tabs-qLP6ozkD.js} +1 -1
  79. package/dist/client/assets/{command-D_HBfmpj.js → command-Bk-fXiVb.js} +1 -1
  80. package/dist/client/assets/connection-card-BYUbg7iO.js +1 -0
  81. package/dist/client/assets/connection-detail-Zdtj4TKi.js +1 -0
  82. package/dist/client/assets/connections-CMaQr-QY.js +1 -0
  83. package/dist/client/assets/{constants-D5QZg84_.js → constants-DclZTqHf.js} +1 -1
  84. package/dist/client/assets/{context-CGMT963w.js → context-BFi-zuf6.js} +12 -12
  85. package/dist/client/assets/{create-organization-dialog-CeMf7qju.js → create-organization-dialog-pXQ89_sr.js} +1 -1
  86. package/dist/client/assets/{create-project-dialog-Bs_mS8aj.js → create-project-dialog-M-dgrV_c.js} +1 -1
  87. package/dist/client/assets/{danger-gTdMMqBl.js → danger-DqsrtWLB.js} +1 -1
  88. package/dist/client/assets/{danger-zone-BE94J4G-.js → danger-zone-BhDM5wIc.js} +1 -1
  89. package/dist/client/assets/{dependencies-DQ9gMDrw.js → dependencies-CPYZFhhf.js} +1 -1
  90. package/dist/client/assets/dialog-DzGwvQ_K.js +1 -0
  91. package/dist/client/assets/drawer-CAX2URBi.js +1 -0
  92. package/dist/client/assets/{dropdown-menu-DE2pKopg.js → dropdown-menu-BcNYk9_F.js} +1 -1
  93. package/dist/client/assets/dynamic-plugin-layout-D0dkPO22.js +1 -0
  94. package/dist/client/assets/editable-task-title-BR-xQ-UT.js +16 -0
  95. package/dist/client/assets/{empty-state-BjCXvoyS.js → empty-state-BuGXY27l.js} +1 -1
  96. package/dist/client/assets/{empty-state-Bk9Z7Q-U.js → empty-state-CGSu9IQ9.js} +1 -1
  97. package/dist/client/assets/{env-vars-editor-BjeFjhEe.js → env-vars-editor-VoVbIy9n.js} +1 -1
  98. package/dist/client/assets/{extract-connection-data-CZxT3XNH.js → extract-connection-data-DhU56Zd0.js} +1 -1
  99. package/dist/client/assets/{file-browser-C4MCCicp.js → file-browser-DIaRK0us.js} +2 -2
  100. package/dist/client/assets/{form-tOTNzCZe.js → form-DBjkdSps.js} +1 -1
  101. package/dist/client/assets/{general-DOjbT8YE.js → general-DCfBGmuh.js} +1 -1
  102. package/dist/client/assets/{generate-id-kfQDJb0K.js → generate-id-DRuK_WRM.js} +1 -1
  103. package/dist/client/assets/{grid-view-CM2kDBxz.js → grid-view-DsY2qZrB.js} +1 -1
  104. package/dist/client/assets/{home-rO4pkzPH.js → home-C52P_wmy.js} +1 -1
  105. package/dist/client/assets/{index-BLtI6TU9.js → index-BLNBD7Tl.js} +1 -1
  106. package/dist/client/assets/index-BObCXgKJ.js +1 -0
  107. package/dist/client/assets/{index-DyL93sTY.js → index-BzPzEjOV.js} +1 -1
  108. package/dist/client/assets/index-COFAW4F5.js +1 -0
  109. package/dist/client/assets/index-CubWD7-P.css +1 -0
  110. package/dist/client/assets/index-DMmNh7jR.js +218 -0
  111. package/dist/client/assets/index-DYAF-Vgt.js +1 -0
  112. package/dist/client/assets/index-DiczHAor.js +1 -0
  113. package/dist/client/assets/{index-DjVQ8cwy.js → index-Dumm3WtY.js} +2 -2
  114. package/dist/client/assets/{index-Bwlq4qOs.js → index-PFtbLrE4.js} +1 -1
  115. package/dist/client/assets/{index-DiHcYCxZ.js → index-bHgla3gL.js} +1 -1
  116. package/dist/client/assets/index-hmkE8HuP.js +1 -0
  117. package/dist/client/assets/{infiniteQueryObserver-XS4LWR6q.js → infiniteQueryObserver-CZ8w6Ao-.js} +1 -1
  118. package/dist/client/assets/input-Bt_nejZh.js +1 -0
  119. package/dist/client/assets/{integration-icon-C9GR_8Ea.js → integration-icon-Dyr7fOYU.js} +1 -1
  120. package/dist/client/assets/{label-DJvdRQ2A.js → label-DTNkd20e.js} +1 -1
  121. package/dist/client/assets/layout-Ck4QNb1R.js +1 -0
  122. package/dist/client/assets/{layout-10Sxtyop.js → layout-VG2uM_nk.js} +1 -1
  123. package/dist/client/assets/login-x4JJuKeA.js +1 -0
  124. package/dist/client/assets/{logo-upload-iqCQyRXD.js → logo-upload-7WcycT9q.js} +1 -1
  125. package/dist/client/assets/{mcp-app-renderer-C3qFwvPf.js → mcp-app-renderer-hLmmzHl_.js} +1 -1
  126. package/dist/client/assets/{mcp-server-card-DCDS8v4f.js → mcp-server-card-CwYAe4vO.js} +1 -1
  127. package/dist/client/assets/mcp-server-detail-CjZvaa-f.js +2 -0
  128. package/dist/client/assets/{members-CykhAYWe.js → members-Sgl6kVS6.js} +1 -1
  129. package/dist/client/assets/{monaco-editor-DQf5JSy_.js → monaco-editor-BS1-hh4n.js} +4 -4
  130. package/dist/client/assets/monitoring-DWB-fw7M.js +4 -0
  131. package/dist/client/assets/monitoring-dashboard-edit-DdNrWKBz.js +1 -0
  132. package/dist/client/assets/{monitoring-dashboard-view-CXCG5P_H.js → monitoring-dashboard-view-BUxqPLpn.js} +2 -2
  133. package/dist/client/assets/{monitoring-stats-row-BfoeteQX.js → monitoring-stats-row-CiWvBCYV.js} +2 -2
  134. package/dist/client/assets/{oauth-callback-CXrwzvh_.js → oauth-callback-7ed5Z9Xs.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-bQZvbhnr.js → oauth-callback-ai-provider-qEm-Q5-E.js} +1 -1
  136. package/dist/client/assets/{org-ai-providers-4gYTufEL.js → org-ai-providers-CUAlOa9f.js} +1 -1
  137. package/dist/client/assets/page-BQl7Ie3w.js +1 -0
  138. package/dist/client/assets/page-DfQnSuW1.js +1 -0
  139. package/dist/client/assets/{plugin-empty-state-cb7GbeKy.js → plugin-empty-state-DUosCqGd.js} +1 -1
  140. package/dist/client/assets/{plugin-empty-state-CEvZCNFj.js → plugin-empty-state-qFDP0Nr2.js} +1 -1
  141. package/dist/client/assets/{plugin-header-C4ZfQdcs.js → plugin-header-BeGFVTX4.js} +1 -1
  142. package/dist/client/assets/{plugin-header-Do_HgCfI.js → plugin-header-CJlxZY-i.js} +1 -1
  143. package/dist/client/assets/plugins-CzL725OF.js +1 -0
  144. package/dist/client/assets/popover-CF2iI6mL.js +1 -0
  145. package/dist/client/assets/project-app-view-lqZ02NJN.js +1 -0
  146. package/dist/client/assets/project-layout-CBbKmowd.js +1 -0
  147. package/dist/client/assets/{project-plugins-C18qk0lc.js → project-plugins-DqmH9sWQ.js} +1 -1
  148. package/dist/client/assets/{projects-list-CtvT2y9h.js → projects-list-Bz_1RhAg.js} +1 -1
  149. package/dist/client/assets/{registry-layout-Cvu5zKVR.js → registry-layout-6H7s-msc.js} +2 -2
  150. package/dist/client/assets/{registry-utils-Bx7--rIH.js → registry-utils-DZHZD5gP.js} +1 -1
  151. package/dist/client/assets/{reset-password-CSswd9M3.js → reset-password-3HgT81EI.js} +1 -1
  152. package/dist/client/assets/{resizable-B0HQ1vuq.js → resizable-BwEPpKFX.js} +1 -1
  153. package/dist/client/assets/{save-actions-BxTuQTa4.js → save-actions-Z-_7bu1u.js} +1 -1
  154. package/dist/client/assets/scroll-area-CwrVaRUF.js +1 -0
  155. package/dist/client/assets/select-hHfKwVbN.js +1 -0
  156. package/dist/client/assets/select-virtual-mcp-DsImheli.js +1 -0
  157. package/dist/client/assets/shell-layout-Bh0wZbL8.js +3 -0
  158. package/dist/client/assets/{sidebar-settings-pZmI7pGH.js → sidebar-settings-U5rAu7py.js} +1 -1
  159. package/dist/client/assets/{skeleton-NLo71_Sb.js → skeleton-BvrwcS3X.js} +1 -1
  160. package/dist/client/assets/spinner-CSLYV8gq.js +1 -0
  161. package/dist/client/assets/{store-invite-CP9PWG-2.js → store-invite-z_eVOBRF.js} +1 -1
  162. package/dist/client/assets/switch-CoYIum7D.js +1 -0
  163. package/dist/client/assets/{table-BK1bAac3.js → table-BSLV9H8I.js} +1 -1
  164. package/dist/client/assets/tabs-sTqc1_U2.js +1 -0
  165. package/dist/client/assets/{task-status-DCsPkppQ.js → task-status-CrO2oj_v.js} +37 -37
  166. package/dist/client/assets/tasks-CazLoC59.js +1 -0
  167. package/dist/client/assets/tasks-panel-DBJx0hs6.js +1 -0
  168. package/dist/client/assets/textarea-CgJ5x-hs.js +1 -0
  169. package/dist/client/assets/{time-range-picker-CEhZhu7c.js → time-range-picker-BCm8UHQI.js} +1 -1
  170. package/dist/client/assets/toggle-group-C20N8vss.js +1 -0
  171. package/dist/client/assets/{tools-list-DGVVcYEB.js → tools-list-JehNbMf9.js} +1 -1
  172. package/dist/client/assets/tooltip-DHJtaI_Z.js +1 -0
  173. package/dist/client/assets/{topbar-portal-DLbOrsQP.js → topbar-portal-jewy4fLu.js} +1 -1
  174. package/dist/client/assets/{types-BOmhR0hZ.js → types-BtTmvTe4.js} +1 -1
  175. package/dist/client/assets/{use-automations-CPlNdxed.js → use-automations-D-X6Oij9.js} +1 -1
  176. package/dist/client/assets/{use-collections-Le9CzDbY.js → use-collections-DhavVshD.js} +1 -1
  177. package/dist/client/assets/{use-connection-CNeKPAtP.js → use-connection-CVlyXslk.js} +1 -1
  178. package/dist/client/assets/{use-copy-CR_0d0zs.js → use-copy-DkDz3lds.js} +1 -1
  179. package/dist/client/assets/{use-create-virtual-mcp-BOxl7MdZ.js → use-create-virtual-mcp-DZAv89rZ.js} +1 -1
  180. package/dist/client/assets/{use-infinite-scroll-CbBHKCjw.js → use-infinite-scroll-j2WybGGN.js} +1 -1
  181. package/dist/client/assets/{use-install-from-registry-Ckutd61H.js → use-install-from-registry-Ch6GOwHv.js} +1 -1
  182. package/dist/client/assets/{use-list-state-DrSbpG8C.js → use-list-state-Baq-X1EV.js} +1 -1
  183. package/dist/client/assets/{use-mcp-prompts-D4XXlnov.js → use-mcp-prompts-BDRKUj7D.js} +1 -1
  184. package/dist/client/assets/{use-mcp-resources-BueR0w1E.js → use-mcp-resources-BxIahbOo.js} +1 -1
  185. package/dist/client/assets/{use-mcp-tools-CFyULGGP.js → use-mcp-tools-kv4r4Zvn.js} +1 -1
  186. package/dist/client/assets/{use-members-Bgz9FSqE.js → use-members-Coq2XO1k.js} +1 -1
  187. package/dist/client/assets/{use-project-RpN1fut9.js → use-project-XBmxO4XX.js} +1 -1
  188. package/dist/client/assets/{use-store-discovery-BS96E_Li.js → use-store-discovery-D-xa6Q86.js} +1 -1
  189. package/dist/client/assets/use-view-mode-CdGajc1j.js +1 -0
  190. package/dist/client/assets/{use-virtual-mcp-DGT5zflo.js → use-virtual-mcp-DCxXK_bv.js} +1 -1
  191. package/dist/client/assets/useInfiniteQuery-H-W7n7En.js +1 -0
  192. package/dist/client/assets/{useMutation-Betr8yis.js → useMutation-DrLoVqQ7.js} +1 -1
  193. package/dist/client/assets/useQuery-B-AaJTeZ.js +1 -0
  194. package/dist/client/assets/useSuspenseInfiniteQuery-Czq4y4BP.js +1 -0
  195. package/dist/client/assets/{user-ChA79mrb.js → user-8V0wpye0.js} +1 -1
  196. package/dist/client/assets/workflow-Bb3JE-XH.js +1 -0
  197. package/dist/client/index.html +3 -2
  198. package/dist/server/cli.js +1 -1
  199. package/dist/server/node_modules/pg-cloudflare/README.md +112 -0
  200. package/dist/server/node_modules/pg-cloudflare/dist/empty.d.ts +2 -0
  201. package/dist/server/node_modules/pg-cloudflare/dist/empty.js +6 -0
  202. package/dist/server/node_modules/pg-cloudflare/dist/empty.js.map +1 -0
  203. package/dist/server/node_modules/pg-cloudflare/dist/index.d.ts +31 -0
  204. package/dist/server/node_modules/pg-cloudflare/dist/index.js +152 -0
  205. package/dist/server/node_modules/pg-cloudflare/dist/index.js.map +1 -0
  206. package/dist/server/node_modules/pg-cloudflare/esm/index.mjs +3 -0
  207. package/dist/server/node_modules/pg-cloudflare/package.json +39 -0
  208. package/dist/server/node_modules/pg-cloudflare/src/empty.ts +3 -0
  209. package/dist/server/node_modules/pg-cloudflare/src/index.ts +166 -0
  210. package/dist/server/node_modules/pg-cloudflare/src/types.d.ts +25 -0
  211. package/dist/server/node_modules/pg-connection-string/LICENSE +21 -0
  212. package/dist/server/node_modules/pg-connection-string/README.md +105 -0
  213. package/dist/server/node_modules/pg-connection-string/esm/index.mjs +8 -0
  214. package/dist/server/node_modules/pg-connection-string/index.d.ts +36 -0
  215. package/dist/server/node_modules/pg-connection-string/index.js +231 -0
  216. package/dist/server/node_modules/pg-connection-string/package.json +52 -0
  217. package/dist/server/node_modules/pg-pool/LICENSE +21 -0
  218. package/dist/server/node_modules/pg-pool/README.md +357 -0
  219. package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
  220. package/dist/server/node_modules/pg-pool/index.js +517 -0
  221. package/dist/server/node_modules/pg-pool/package.json +51 -0
  222. package/dist/server/node_modules/pg-protocol/LICENSE +21 -0
  223. package/dist/server/node_modules/pg-protocol/README.md +3 -0
  224. package/dist/server/node_modules/pg-protocol/dist/b.d.ts +1 -0
  225. package/dist/server/node_modules/pg-protocol/dist/b.js +23 -0
  226. package/dist/server/node_modules/pg-protocol/dist/b.js.map +1 -0
  227. package/dist/server/node_modules/pg-protocol/dist/buffer-reader.d.ts +15 -0
  228. package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
  229. package/dist/server/node_modules/pg-protocol/dist/buffer-reader.js.map +1 -0
  230. package/dist/server/node_modules/pg-protocol/dist/buffer-writer.d.ts +16 -0
  231. package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js +81 -0
  232. package/dist/server/node_modules/pg-protocol/dist/buffer-writer.js.map +1 -0
  233. package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.d.ts +1 -0
  234. package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js +530 -0
  235. package/dist/server/node_modules/pg-protocol/dist/inbound-parser.test.js.map +1 -0
  236. package/dist/server/node_modules/pg-protocol/dist/index.d.ts +6 -0
  237. package/dist/server/node_modules/pg-protocol/dist/index.js +15 -0
  238. package/dist/server/node_modules/pg-protocol/dist/index.js.map +1 -0
  239. package/dist/server/node_modules/pg-protocol/dist/messages.d.ts +162 -0
  240. package/dist/server/node_modules/pg-protocol/dist/messages.js +160 -0
  241. package/dist/server/node_modules/pg-protocol/dist/messages.js.map +1 -0
  242. package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.d.ts +1 -0
  243. package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js +252 -0
  244. package/dist/server/node_modules/pg-protocol/dist/outbound-serializer.test.js.map +1 -0
  245. package/dist/server/node_modules/pg-protocol/dist/parser.d.ts +24 -0
  246. package/dist/server/node_modules/pg-protocol/dist/parser.js +324 -0
  247. package/dist/server/node_modules/pg-protocol/dist/parser.js.map +1 -0
  248. package/dist/server/node_modules/pg-protocol/dist/serializer.d.ts +42 -0
  249. package/dist/server/node_modules/pg-protocol/dist/serializer.js +189 -0
  250. package/dist/server/node_modules/pg-protocol/dist/serializer.js.map +1 -0
  251. package/dist/server/node_modules/pg-protocol/esm/index.js +11 -0
  252. package/dist/server/node_modules/pg-protocol/package.json +45 -0
  253. package/dist/server/node_modules/pg-protocol/src/b.ts +25 -0
  254. package/dist/server/node_modules/pg-protocol/src/buffer-reader.ts +58 -0
  255. package/dist/server/node_modules/pg-protocol/src/buffer-writer.ts +85 -0
  256. package/dist/server/node_modules/pg-protocol/src/inbound-parser.test.ts +575 -0
  257. package/dist/server/node_modules/pg-protocol/src/index.ts +11 -0
  258. package/dist/server/node_modules/pg-protocol/src/messages.ts +262 -0
  259. package/dist/server/node_modules/pg-protocol/src/outbound-serializer.test.ts +276 -0
  260. package/dist/server/node_modules/pg-protocol/src/parser.ts +413 -0
  261. package/dist/server/node_modules/pg-protocol/src/serializer.ts +274 -0
  262. package/dist/server/node_modules/pg-protocol/src/testing/buffer-list.ts +67 -0
  263. package/dist/server/node_modules/pg-protocol/src/testing/test-buffers.ts +166 -0
  264. package/dist/server/node_modules/pg-protocol/src/types/chunky.d.ts +1 -0
  265. package/dist/server/node_modules/pg-types/.travis.yml +7 -0
  266. package/dist/server/node_modules/pg-types/Makefile +14 -0
  267. package/dist/server/node_modules/pg-types/README.md +75 -0
  268. package/dist/server/node_modules/pg-types/index.d.ts +137 -0
  269. package/dist/server/node_modules/pg-types/index.js +47 -0
  270. package/dist/server/node_modules/pg-types/index.test-d.ts +21 -0
  271. package/dist/server/node_modules/pg-types/lib/arrayParser.js +11 -0
  272. package/dist/server/node_modules/pg-types/lib/binaryParsers.js +257 -0
  273. package/dist/server/node_modules/pg-types/lib/builtins.js +73 -0
  274. package/dist/server/node_modules/pg-types/lib/textParsers.js +215 -0
  275. package/dist/server/node_modules/pg-types/package.json +42 -0
  276. package/dist/server/node_modules/pg-types/test/index.js +24 -0
  277. package/dist/server/node_modules/pg-types/test/types.js +597 -0
  278. package/dist/server/node_modules/pgpass/README.md +74 -0
  279. package/dist/server/node_modules/pgpass/lib/helper.js +233 -0
  280. package/dist/server/node_modules/pgpass/lib/index.js +23 -0
  281. package/dist/server/node_modules/pgpass/package.json +41 -0
  282. package/dist/server/node_modules/postgres-array/index.d.ts +4 -0
  283. package/dist/server/node_modules/postgres-array/index.js +97 -0
  284. package/dist/server/node_modules/postgres-array/license +21 -0
  285. package/dist/server/node_modules/postgres-array/package.json +35 -0
  286. package/dist/server/node_modules/postgres-array/readme.md +43 -0
  287. package/dist/server/node_modules/postgres-date/index.js +116 -0
  288. package/dist/server/node_modules/postgres-date/license +21 -0
  289. package/dist/server/node_modules/postgres-date/package.json +33 -0
  290. package/dist/server/node_modules/postgres-date/readme.md +49 -0
  291. package/dist/server/node_modules/postgres-interval/index.d.ts +20 -0
  292. package/dist/server/node_modules/postgres-interval/index.js +125 -0
  293. package/dist/server/node_modules/postgres-interval/license +21 -0
  294. package/dist/server/node_modules/postgres-interval/package.json +36 -0
  295. package/dist/server/node_modules/postgres-interval/readme.md +48 -0
  296. package/dist/server/node_modules/split2/LICENSE +13 -0
  297. package/dist/server/node_modules/split2/README.md +85 -0
  298. package/dist/server/node_modules/split2/bench.js +27 -0
  299. package/dist/server/node_modules/split2/index.js +141 -0
  300. package/dist/server/node_modules/split2/package.json +39 -0
  301. package/dist/server/node_modules/split2/test.js +409 -0
  302. package/dist/server/node_modules/xtend/.jshintrc +30 -0
  303. package/dist/server/node_modules/xtend/LICENSE +20 -0
  304. package/dist/server/node_modules/xtend/README.md +32 -0
  305. package/dist/server/node_modules/xtend/immutable.js +19 -0
  306. package/dist/server/node_modules/xtend/mutable.js +17 -0
  307. package/dist/server/node_modules/xtend/package.json +55 -0
  308. package/dist/server/node_modules/xtend/test.js +103 -0
  309. package/dist/server/server.js +1 -1
  310. package/package.json +1 -1
  311. package/dist/client/assets/LayoutLeft-CbUmiI7I.js +0 -1
  312. package/dist/client/assets/agent-detail-DqMa-yjy.js +0 -2
  313. package/dist/client/assets/agents-DXD0J3OW.js +0 -1
  314. package/dist/client/assets/automation-detail-bmoX3GK-.js +0 -1
  315. package/dist/client/assets/automations-Dp1WjxxK.js +0 -1
  316. package/dist/client/assets/avatar-BoRF-Me1.js +0 -1
  317. package/dist/client/assets/badge-DIWKuwVU.js +0 -1
  318. package/dist/client/assets/connection-card-DuHVLZ35.js +0 -1
  319. package/dist/client/assets/connection-detail-vcbLbssZ.js +0 -1
  320. package/dist/client/assets/connections-14pDMsUe.js +0 -1
  321. package/dist/client/assets/dialog-B8WS5FOh.js +0 -1
  322. package/dist/client/assets/dynamic-plugin-layout-yMvA298P.js +0 -1
  323. package/dist/client/assets/editable-task-title-oggBOZ_d.js +0 -16
  324. package/dist/client/assets/index-B09Yemt1.js +0 -1
  325. package/dist/client/assets/index-CAsAeYNN.css +0 -1
  326. package/dist/client/assets/index-CMImT9Gt.js +0 -1
  327. package/dist/client/assets/index-D-6rbOIG.js +0 -1
  328. package/dist/client/assets/index-DnJ6a24w.js +0 -218
  329. package/dist/client/assets/index-hCeFdkUk.js +0 -1
  330. package/dist/client/assets/index-qrpgIqks.js +0 -1
  331. package/dist/client/assets/input-BBKBJVKe.js +0 -1
  332. package/dist/client/assets/layout-BjyFY_1R.js +0 -1
  333. package/dist/client/assets/login-ClPbfjlJ.js +0 -1
  334. package/dist/client/assets/mcp-server-detail-lOR_wUNJ.js +0 -2
  335. package/dist/client/assets/monitoring-BPuhRE0m.js +0 -4
  336. package/dist/client/assets/monitoring-dashboard-edit-BVtLOBNe.js +0 -1
  337. package/dist/client/assets/page-CCXJyUyN.js +0 -1
  338. package/dist/client/assets/page-DB3QLlpA.js +0 -1
  339. package/dist/client/assets/plugins-pEgOY1Nz.js +0 -1
  340. package/dist/client/assets/popover-vDURg2rv.js +0 -1
  341. package/dist/client/assets/project-app-view-DfCIvrF7.js +0 -1
  342. package/dist/client/assets/project-layout-CkMdq05b.js +0 -1
  343. package/dist/client/assets/scroll-area-dsTSFUPi.js +0 -1
  344. package/dist/client/assets/select-Bbaj2HCW.js +0 -1
  345. package/dist/client/assets/select-virtual-mcp-CZJoA7HG.js +0 -1
  346. package/dist/client/assets/sheet-B_-2ygzJ.js +0 -1
  347. package/dist/client/assets/shell-layout-Ca5Bbhzi.js +0 -3
  348. package/dist/client/assets/spinner-EdHFCjIL.js +0 -1
  349. package/dist/client/assets/switch-bfk4EFAk.js +0 -1
  350. package/dist/client/assets/tabs-aIY_aIUV.js +0 -1
  351. package/dist/client/assets/tasks-Dw1i-69W.js +0 -1
  352. package/dist/client/assets/tasks-panel-CEAgXi7r.js +0 -1
  353. package/dist/client/assets/textarea-lF0m7xkk.js +0 -1
  354. package/dist/client/assets/toggle-group-Dak-s1p3.js +0 -1
  355. package/dist/client/assets/tooltip-Csc3oeTz.js +0 -1
  356. package/dist/client/assets/use-mobile-Y3tADOOl.js +0 -1
  357. package/dist/client/assets/use-view-mode-BeRbE5Df.js +0 -1
  358. package/dist/client/assets/useInfiniteQuery-ChOuKh6v.js +0 -1
  359. package/dist/client/assets/useQuery-mzOsnjYJ.js +0 -1
  360. package/dist/client/assets/useSuspenseInfiniteQuery-DFs2FFlW.js +0 -1
  361. package/dist/client/assets/workflow-CBDfcQFP.js +0 -1
  362. package/dist/server/node_modules/pg/README.md +0 -95
  363. package/dist/server/node_modules/pg/esm/index.mjs +0 -20
  364. package/dist/server/node_modules/pg/lib/client.js +0 -743
  365. package/dist/server/node_modules/pg/lib/connection-parameters.js +0 -171
  366. package/dist/server/node_modules/pg/lib/connection.js +0 -221
  367. package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +0 -122
  368. package/dist/server/node_modules/pg/lib/crypto/sasl.js +0 -212
  369. package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +0 -43
  370. package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +0 -89
  371. package/dist/server/node_modules/pg/lib/crypto/utils.js +0 -9
  372. package/dist/server/node_modules/pg/lib/defaults.js +0 -91
  373. package/dist/server/node_modules/pg/lib/index.js +0 -73
  374. package/dist/server/node_modules/pg/lib/native/client.js +0 -323
  375. package/dist/server/node_modules/pg/lib/native/index.js +0 -2
  376. package/dist/server/node_modules/pg/lib/native/query.js +0 -165
  377. package/dist/server/node_modules/pg/lib/query.js +0 -252
  378. package/dist/server/node_modules/pg/lib/result.js +0 -109
  379. package/dist/server/node_modules/pg/lib/stream.js +0 -83
  380. package/dist/server/node_modules/pg/lib/type-overrides.js +0 -35
  381. package/dist/server/node_modules/pg/lib/utils.js +0 -217
  382. package/dist/server/node_modules/pg/package.json +0 -76
  383. /package/dist/server/node_modules/{pg → pg-cloudflare}/LICENSE +0 -0
@@ -1,5 +1,5 @@
1
- import{r as I,c as X,u as de,w as Le,bU as Ke,j as t,B as G,D as ee,v as H,ce as pn,a as fn,i as gn}from"./index-DnJ6a24w.js";import{i as it}from"./CheckCircle-DDKCxiAn.js";import{n as jn}from"./Container-b65PFshp.js";import{t as vn}from"./Settings01-B76KnDHb.js";import{u as Fe}from"./useQuery-mzOsnjYJ.js";import{u as Ce}from"./useMutation-Betr8yis.js";import{a as pe,u as he,f as gs}from"./constants-D5QZg84_.js";import{u as js}from"./useInfiniteQuery-ChOuKh6v.js";import{B as F}from"./badge-DIWKuwVU.js";import{I as xe}from"./input-BBKBJVKe.js";import{a as Tt,c as Ee,D as It,b as Mt,g as rs,l as is,h as bn}from"./dropdown-menu-DE2pKopg.js";import{T as vs,a as bs,b as Pt,c as Ie,d as ys,e as Me}from"./table-BK1bAac3.js";import{T as yn,a as ls}from"./toggle-group-Dak-s1p3.js";import{u as Nn}from"./use-view-mode-BeRbE5Df.js";import{i as Ht}from"./DotsVertical-Bo0fAyx-.js";import{i as wn}from"./FilterLines-BQVg1PzI.js";import{i as Ns}from"./Globe01-sBw0ReRO.js";import{i as et}from"./Loading01-DQphO9Su.js";import{i as ws}from"./SearchMd-C8ADHGFY.js";import{b as Et,c as Dt,d as $t,e as At,a as Lt,D as Ot}from"./dialog-B8WS5FOh.js";import{i as xt}from"./AlertCircle-QngH9BVd.js";import{n as Cn}from"./Download01-CN3AkzFm.js";import{i as as}from"./Upload01-BQ7z5iC5.js";import{c as ht,b as pt,d as ft,A as gt,h as jt,e as vt,a as bt,f as yt}from"./alert-dialog-BqCiJDa8.js";import{C as oe}from"./card-gfMzoGpr.js";import{i as os}from"./CheckVerified02-Brnp4Z-Q.js";import{s as wt}from"./Trash01-CYMRq_nY.js";import{L as re}from"./label-DJvdRQ2A.js";import{S as Cs,a as _s,b as ks,c as Ss,d as Rt}from"./select-Bbaj2HCW.js";import{S as Xe}from"./switch-bfk4EFAk.js";import{T as zt}from"./textarea-lF0m7xkk.js";import{i as _n}from"./ArrowLeft-DX2ldnBo.js";import{a as kn,i as Sn,u as Qt,t as Rn}from"./use-copy-CR_0d0zs.js";import{s as Wt}from"./RefreshCcw01-oV1XFIRn.js";import{i as Tn}from"./X-BT_y3J3a.js";import{i as In}from"./Link01-VlHez4tu.js";import{t as Rs}from"./ChevronDown-D0b1rvAp.js";import{n as Mn}from"./ChevronUp-BWhuIqS7.js";import{C as Pn}from"./checkbox-DygphnIU.js";import{s as Ts}from"./Eye-Cqad01Et.js";import{n as En}from"./LinkExternal01-vs3DKlfq.js";import{e as Is}from"./use-collections-Le9CzDbY.js";import{b as Ms}from"./use-connection-CNeKPAtP.js";import{b as Dn,P as $n,a as An}from"./popover-vDURg2rv.js";import{i as Vt}from"./Check-CLxUgI8Z.js";import{a as Kt}from"./Copy01-Ds0OKZs5.js";import{i as Ln}from"./EyeOff-rTYDCZUH.js";import{i as On,a as zn}from"./Save01-CpNh-fPw.js";import{i as Un}from"./Key01-V3zgT2bk.js";import{s as qn}from"./Plus-CURSuoDd.js";import{a as Fn,b as Bn,T as Gn}from"./tooltip-Csc3oeTz.js";import{i as Qn}from"./Play-jCDYHrdu.js";import"./infiniteQueryObserver-XS4LWR6q.js";import"./ChevronRight-BEUO8jhU.js";import"./use-mobile-Y3tADOOl.js";import"./index-hCeFdkUk.js";const Ps=({size:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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"}),I.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"}));Es.displayName="StopSquare";const Jt=({size:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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"}));Jt.displayName="Tool02";const W={all:["private-registry"],items:()=>[...W.all,"items"],itemsList:(s,e,n,r)=>[...W.items(),"list",{search:s,tags:e,categories:n,limit:r}],item:s=>[...W.items(),"item",s],filters:()=>[...W.all,"filters"],registryConfig:()=>[...W.all,"registry-config"],registryConfigByPlugin:(s,e)=>[...W.registryConfig(),s,e],publishRequests:()=>[...W.all,"publish-requests"],publishRequestsByOrg:s=>[...W.publishRequests(),"org",s],publishRequestsList:(s,e,n)=>[...W.publishRequests(),"list",{status:s??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(s,e,n,r)=>[...W.publishRequestsByOrg(s),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...W.publishRequests(),"count"],publishRequestsCountByOrg:s=>[...W.publishRequestsByOrg(s),"count"],publishApiKeys:()=>[...W.all,"publish-api-keys"],monitor:()=>[...W.all,"monitor"],monitorRuns:()=>[...W.monitor(),"runs"],monitorRunsList:s=>[...W.monitorRuns(),"list",{status:s??"all"}],monitorRun:s=>[...W.monitorRuns(),"run",s??"none"],monitorResults:()=>[...W.monitor(),"results"],monitorResultsList:(s,e)=>[...W.monitorResults(),"list",{runId:s??"none",status:e??"all"}],monitorConnections:()=>[...W.monitor(),"connections"],monitorConnectionAuthProbe:s=>[...W.monitorConnections(),"auth-probe",s]};async function Pe(s,e,n){const r=await s.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 Vn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_RUN_START",{config:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.monitorRuns()}),e.invalidateQueries({queryKey:W.monitorResults()})])},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Kn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async(d,m)=>{await Promise.all([e.invalidateQueries({queryKey:W.monitorRuns()}),e.invalidateQueries({queryKey:W.monitorRun(m)})])},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Ut(s){const e=X.c(10),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==s?(l=W.monitorRunsList(s),e[2]=s,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==s?(a=async()=>Pe(o,"REGISTRY_MONITOR_RUN_LIST",{status:s,limit:100}),e[4]=o,e[5]=s,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],Fe(i)}function Zt(s){const e=X.c(11),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==s?(l=W.monitorRun(s),e[2]=s,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==s?(a=async()=>Pe(o,"REGISTRY_MONITOR_RUN_GET",{runId:s}),e[4]=o,e[5]=s,e[6]=a):a=e[6];const i=!!s;let d;return e[7]!==l||e[8]!==a||e[9]!==i?(d={queryKey:l,queryFn:a,enabled:i,refetchInterval:Yn},e[7]=l,e[8]=a,e[9]=i,e[10]=d):d=e[10],Fe(d)}function Yn(s){return s.state.data?.run?.status==="running"?5e3:!1}function Ct(s,e,n){const r=X.c(14),{org:o}=de();let l;r[0]!==o.id?(l={connectionId:pe,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=he(l);let i;r[2]!==s||r[3]!==e?(i=W.monitorResultsList(s,e),r[2]=s,r[3]=e,r[4]=i):i=r[4];let d;r[5]!==a||r[6]!==s||r[7]!==e?(d=async()=>Pe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:s,status:e,limit:200,offset:0}),r[5]=a,r[6]=s,r[7]=e,r[8]=d):d=r[8];const m=!!s,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==d||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:d,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=d,r[11]=m,r[12]=u,r[13]=x):x=r[13],Fe(x)}function Ds(){const s=X.c(5),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.monitorConnections(),s[2]=o):o=s[2];let l;return s[3]!==r?(l={queryKey:o,queryFn:async()=>Pe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},s[3]=r,s[4]=l):l=s[4],Fe(l)}function Hn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async()=>Pe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.monitorConnections()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Wn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>{const{connectionId:m,authStatus:u}=d;return Pe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.monitorConnections()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}const cs={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 $s(){const s=X.c(33),{org:e,project:n}=de();let r;s[0]!==e.id?(r={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=r):r=s[1];const o=he(r),l=Le();let a;s[2]!==n.id?(a=W.registryConfigByPlugin(n.id??"",Ke),s[2]=n.id,s[3]=a):a=s[3];let i;s[4]!==o||s[5]!==n.id?(i=async()=>Pe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:Ke}),s[4]=o,s[5]=n.id,s[6]=i):i=s[6];const d=!!n.id;let m;s[7]!==a||s[8]!==i||s[9]!==d?(m={queryKey:a,queryFn:i,enabled:d},s[7]=a,s[8]=i,s[9]=d,s[10]=m):m=s[10];const u=Fe(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,c=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let v;s[11]!==p?(v=p??{},s[11]=p,s[12]=v):v=s[12];let b;s[13]!==c||s[14]!==x||s[15]!==p?(b=c&&!p?x:{},s[13]=c,s[14]=x,s[15]=p,s[16]=b):b=s[16];let k;s[17]!==v||s[18]!==b?(k={...cs,...v,...b},s[17]=v,s[18]=b,s[19]=k):k=s[19];const S=k;let y;s[20]!==o||s[21]!==n.id?(y=async R=>{const C=(await Pe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:Ke}))?.config?.settings??{};return Pe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:Ke,settings:{...C,testConfig:{...cs,...C.testConfig??{},...R}}})},s[20]=o,s[21]=n.id,s[22]=y):y=s[22];let f;s[23]!==n.id||s[24]!==l?(f=async()=>{await l.invalidateQueries({queryKey:W.registryConfigByPlugin(n.id??"",Ke)})},s[23]=n.id,s[24]=l,s[25]=f):f=s[25];let M;s[26]!==y||s[27]!==f?(M={mutationFn:y,onSuccess:f},s[26]=y,s[27]=f,s[28]=M):M=s[28];const g=Ce(M);let w;return s[29]!==u.isLoading||s[30]!==g||s[31]!==S?(w={settings:S,isLoading:u.isLoading,saveMutation:g},s[29]=u.isLoading,s[30]=g,s[31]=S,s[32]=w):w=s[32],w}function Jn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_SCHEDULE_SET",d),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.registryConfig()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Zn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.registryConfig()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Xn(){const s=X.c(3),e=Ut("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Ct(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return s[0]!==l||s[1]!==a?(i={brokenCount:l,isLoading:a},s[0]=l,s[1]=a,s[2]=i):i=s[2],i}const As=24;function er(s){return s.trim()}async function _e(s,e,n){const r=await s.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(s){const e=X.c(19),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l,a,i,d;e[2]!==s.categories||e[3]!==s.limit||e[4]!==s.search||e[5]!==s.tags?(a=er(s.search),l=s.limit??As,d=js,i=W.itemsList(a,s.tags,s.categories,l),e[2]=s.categories,e[3]=s.limit,e[4]=s.search,e[5]=s.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=d):(l=e[6],a=e[7],i=e[8],d=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==s.categories||e[13]!==s.tags||e[14]!==a?(m=async x=>{const{pageParam:p}=x,h=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 _e(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:s.tags.length?s.tags:void 0,categories:s.categories.length?s.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=s.categories,e[13]=s.tags,e[14]=a,e[15]=m):m=e[15];let u;return e[16]!==i||e[17]!==m?(u={queryKey:i,queryFn:m,initialPageParam:void 0,getNextPageParam:tr,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],d(u)}function tr(s){return s.nextCursor}function sr(){const s=X.c(8),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.filters(),s[2]=o):o=s[2];let l;s[3]!==r?(l=async()=>_e(r,"REGISTRY_ITEM_FILTERS",{}),s[3]=r,s[4]=l):l=s[4];let a;s[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},s[5]=a):a=s[5];let i;return s[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},s[6]=l,s[7]=i):i=s[7],Fe(i)}function Xt(){const s=X.c(29),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.items()}),e.invalidateQueries({queryKey:W.filters()})])},s[2]=e,s[3]=l):l=s[3];const a=l;let i;s[4]!==o?(i=async f=>(await _e(o,"REGISTRY_ITEM_CREATE",{data:f})).item,s[4]=o,s[5]=i):i=s[5];let d;s[6]!==a||s[7]!==i?(d={mutationFn:i,onSuccess:a},s[6]=a,s[7]=i,s[8]=d):d=s[8];const m=Ce(d);let u;s[9]!==o?(u=async f=>{const{id:M,data:g}=f;return(await _e(o,"REGISTRY_ITEM_UPDATE",{id:M,data:g})).item},s[9]=o,s[10]=u):u=s[10];let x;s[11]!==a||s[12]!==u?(x={mutationFn:u,onSuccess:a},s[11]=a,s[12]=u,s[13]=x):x=s[13];const p=Ce(x);let h;s[14]!==o?(h=async f=>(await _e(o,"REGISTRY_ITEM_DELETE",{id:f})).item,s[14]=o,s[15]=h):h=s[15];let c;s[16]!==a||s[17]!==h?(c={mutationFn:h,onSuccess:a},s[16]=a,s[17]=h,s[18]=c):c=s[18];const v=Ce(c);let b;s[19]!==o?(b=async f=>_e(o,"REGISTRY_ITEM_BULK_CREATE",{items:f}),s[19]=o,s[20]=b):b=s[20];let k;s[21]!==a||s[22]!==b?(k={mutationFn:b,onSuccess:a},s[21]=a,s[22]=b,s[23]=k):k=s[23];const S=Ce(k);let y;return s[24]!==S||s[25]!==m||s[26]!==v||s[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:v,bulkCreateMutation:S},s[24]=S,s[25]=m,s[26]=v,s[27]=p,s[28]=y):y=s[28],y}function qt(s){const e=X.c(37),{org:n,project:r}=de();let o;e[0]!==n.id?(o={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=he(o),a=Le();let i;e[2]!==s||e[3]!==r.id?(i=W.registryConfigByPlugin(r.id??"",s),e[2]=s,e[3]=r.id,e[4]=i):i=e[4];let d;e[5]!==l||e[6]!==s||e[7]!==r.id?(d=async()=>_e(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:s}),e[5]=l,e[6]=s,e[7]=r.id,e[8]=d):d=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==d||e[11]!==m?(u={queryKey:i,queryFn:d,enabled:m,staleTime:6e4},e[9]=i,e[10]=d,e[11]=m,e[12]=u):u=e[12];const x=Fe(u);let p;e[13]!==l||e[14]!==s||e[15]!==r.id?(p=async A=>{const P=(await _e(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:s}))?.config?.settings??{};return _e(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:s,settings:{...P,...A}})},e[13]=l,e[14]=s,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==s||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:W.registryConfigByPlugin(r.id??"",s)})},e[17]=s,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==p||e[22]!==h?(c={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=c):c=e[23];const v=Ce(c),b=x.data?.config?.settings?.registryName??"Private Registry",k=x.data?.config?.settings?.registryIcon??"",S=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",f=x.data?.config?.settings?.acceptPublishRequests??!1,M=x.data?.config?.settings?.requireApiToken??!1,g=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,E=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",C=x.data?.config?.settings?.rateLimitMax,T=typeof C=="number"&&C>=1?Math.floor(C):100;let N;return e[24]!==f||e[25]!==x.isLoading||e[26]!==w||e[27]!==T||e[28]!==E||e[29]!==k||e[30]!==S||e[31]!==y||e[32]!==b||e[33]!==M||e[34]!==v||e[35]!==g?(N={registryName:b,registryIcon:k,registryLLMConnectionId:S,registryLLMModelId:y,acceptPublishRequests:f,requireApiToken:M,storePrivateOnly:g,rateLimitEnabled:w,rateLimitWindow:E,rateLimitMax:T,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:v},e[24]=f,e[25]=x.isLoading,e[26]=w,e[27]=T,e[28]=E,e[29]=k,e[30]=S,e[31]=y,e[32]=b,e[33]=M,e[34]=v,e[35]=g,e[36]=N):N=e[36],N}function nr(s){const e=X.c(15),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==n.id||e[3]!==s.sortBy||e[4]!==s.sortDirection||e[5]!==s.status?(l=W.publishRequestsListByOrg(n.id,s.status,s.sortBy,s.sortDirection),e[2]=n.id,e[3]=s.sortBy,e[4]=s.sortDirection,e[5]=s.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==s.sortBy||e[9]!==s.sortDirection||e[10]!==s.status?(a=async d=>{const{pageParam:m}=d;return _e(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:s.status,sortBy:s.sortBy,sortDirection:s.sortDirection,limit:As,offset:m})},e[7]=o,e[8]=s.sortBy,e[9]=s.sortDirection,e[10]=s.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:rr,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],js(i)}function rr(s,e){const n=e.reduce(ir,0);return n<s.totalCount?n:void 0}function ir(s,e){return s+e.items.length}function lr(){const s=X.c(9),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]!==e.id?(o=W.publishRequestsCountByOrg(e.id),s[2]=e.id,s[3]=o):o=s[3];let l;s[4]!==r?(l=async()=>_e(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),s[4]=r,s[5]=l):l=s[5];let a;return s[6]!==o||s[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},s[6]=o,s[7]=l,s[8]=a):a=s[8],Fe(a)}function ar(){const s=X.c(17),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.publishRequests()})])},s[2]=e,s[3]=l):l=s[3];const a=l;let i;s[4]!==o?(i=async c=>_e(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",c),s[4]=o,s[5]=i):i=s[5];let d;s[6]!==a||s[7]!==i?(d={mutationFn:i,onSuccess:a},s[6]=a,s[7]=i,s[8]=d):d=s[8];const m=Ce(d);let u;s[9]!==o?(u=async c=>_e(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:c}),s[9]=o,s[10]=u):u=s[10];let x;s[11]!==a||s[12]!==u?(x={mutationFn:u,onSuccess:a},s[11]=a,s[12]=u,s[13]=x):x=s[13];const p=Ce(x);let h;return s[14]!==p||s[15]!==m?(h={reviewMutation:m,deleteMutation:p},s[14]=p,s[15]=m,s[16]=h):h=s[16],h}function or(){const s=X.c(5),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.publishApiKeys(),s[2]=o):o=s[2];let l;return s[3]!==r?(l={queryKey:o,queryFn:async()=>_e(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},s[3]=r,s[4]=l):l=s[4],Fe(l)}function cr(){const s=X.c(19),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async c=>_e(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:c}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.publishApiKeys()})},s[4]=e,s[5]=a):a=s[5];let i;s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8];const d=Ce(i);let m;s[9]!==o?(m=async c=>_e(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:c}),s[9]=o,s[10]=m):m=s[10];let u;s[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:W.publishApiKeys()})},s[11]=e,s[12]=u):u=s[12];let x;s[13]!==m||s[14]!==u?(x={mutationFn:m,onSuccess:u},s[13]=m,s[14]=u,s[15]=x):x=s[15];const p=Ce(x);let h;return s[16]!==d||s[17]!==p?(h={generateMutation:d,revokeMutation:p},s[16]=d,s[17]=p,s[18]=h):h=s[18],h}function ds(s){return s?s.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function ms(s){const e=[];let n="",r=!1;for(let o=0;o<s.length;o+=1){const l=s[o],a=s[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 dr=["id","title"],mr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ur(s){const e=s.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=ms(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of dr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!mr.includes(u)&&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,u)=>{const x=r.get(u);return typeof x=="number"?m[x]??"":""},a=[],i=new Set;let d=0;for(let m=1;m<e.length;m+=1){const u=ms(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),d+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),d+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),d+=1;continue}i.add(x);const h=l(u,"description").trim(),c=l(u,"remote_url").trim(),b=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",k=ds(l(u,"tags")),S=ds(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),f=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:f,_meta:{"mcp.mesh":{...k.length>0?{tags:k}:{},...S.length>0?{categories:S}:{}}},server:{name:x,title:p,description:h||void 0,remotes:c?[{type:b,url:c}]:[]}})}return{items:a,warnings:o,skipped:d}}const xr=`id,title,description,remote_url,remote_type,tags,categories,is_public
1
+ import{r as I,c as X,u as de,w as Le,bV as Ke,j as t,B as G,D as ee,v as H,cf as pn,a as fn,i as gn}from"./index-DMmNh7jR.js";import{i as it}from"./CheckCircle-CPfAK_ok.js";import{n as jn}from"./Container-Cvd3ILsk.js";import{t as vn}from"./Settings01-CCUkMwLj.js";import{u as Fe}from"./useQuery-B-AaJTeZ.js";import{u as Ce}from"./useMutation-DrLoVqQ7.js";import{a as pe,u as he,f as gs}from"./constants-DclZTqHf.js";import{u as js}from"./useInfiniteQuery-H-W7n7En.js";import{B as F}from"./badge-Cjjl_FHP.js";import{I as xe}from"./input-Bt_nejZh.js";import{a as Tt,c as Ee,D as It,b as Mt,g as rs,l as is,h as bn}from"./dropdown-menu-BcNYk9_F.js";import{T as vs,a as bs,b as Pt,c as Ie,d as ys,e as Me}from"./table-BSLV9H8I.js";import{T as yn,a as ls}from"./toggle-group-C20N8vss.js";import{u as Nn}from"./use-view-mode-CdGajc1j.js";import{i as Ht}from"./DotsVertical-CZep1rYf.js";import{i as wn}from"./FilterLines-CUdG83Ae.js";import{i as Ns}from"./Globe01-BTdgnOS2.js";import{i as et}from"./Loading01-D0sCOwf7.js";import{i as ws}from"./SearchMd-BSRGE1t4.js";import{b as Et,c as Dt,d as $t,e as At,a as Lt,D as Ot}from"./dialog-DzGwvQ_K.js";import{i as xt}from"./AlertCircle-DcuzO-dN.js";import{n as Cn}from"./Download01-DOZIvPhC.js";import{i as as}from"./Upload01-ByUvmqDm.js";import{c as ht,b as pt,d as ft,A as gt,h as jt,e as vt,a as bt,f as yt}from"./alert-dialog-qmvoIx9J.js";import{C as oe}from"./card-CoyaoT6W.js";import{i as os}from"./CheckVerified02-BImD45AM.js";import{s as wt}from"./Trash01-Cs72bTP6.js";import{L as re}from"./label-DTNkd20e.js";import{S as Cs,a as _s,b as ks,c as Ss,d as Rt}from"./select-hHfKwVbN.js";import{S as Xe}from"./switch-CoYIum7D.js";import{T as zt}from"./textarea-CgJ5x-hs.js";import{i as _n}from"./ArrowLeft-B0zQkfl0.js";import{a as kn,i as Sn,u as Qt,t as Rn}from"./use-copy-DkDz3lds.js";import{s as Wt}from"./RefreshCcw01-BOXuamrY.js";import{i as Tn}from"./X-CD9ZB6hw.js";import{i as In}from"./Link01-h9aUM7NA.js";import{t as Rs}from"./ChevronDown-t60R5l2B.js";import{n as Mn}from"./ChevronUp-l7iXrppT.js";import{C as Pn}from"./checkbox-D5DFx9da.js";import{s as Ts}from"./Eye-D3Q7o9JY.js";import{n as En}from"./LinkExternal01-CmkQ0Pr-.js";import{e as Is}from"./use-collections-DhavVshD.js";import{b as Ms}from"./use-connection-CVlyXslk.js";import{b as Dn,P as $n,a as An}from"./popover-CF2iI6mL.js";import{i as Vt}from"./Check-5nIJP_0B.js";import{a as Kt}from"./Copy01-DCmX2pvi.js";import{i as Ln}from"./EyeOff--TPuyP7J.js";import{i as On,a as zn}from"./Save01-CA0I32a6.js";import{i as Un}from"./Key01-CjhxaGrC.js";import{s as qn}from"./Plus-Dcf0Y3wA.js";import{a as Fn,b as Bn,T as Gn}from"./tooltip-DHJtaI_Z.js";import{i as Qn}from"./Play-hGa2UcUZ.js";import"./infiniteQueryObserver-CZ8w6Ao-.js";import"./ChevronRight-3uKoJ2yX.js";import"./index-COFAW4F5.js";const Ps=({size:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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"}),I.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"}));Es.displayName="StopSquare";const Jt=({size:s=24,color:e="currentColor",...n})=>I.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},I.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"}));Jt.displayName="Tool02";const W={all:["private-registry"],items:()=>[...W.all,"items"],itemsList:(s,e,n,r)=>[...W.items(),"list",{search:s,tags:e,categories:n,limit:r}],item:s=>[...W.items(),"item",s],filters:()=>[...W.all,"filters"],registryConfig:()=>[...W.all,"registry-config"],registryConfigByPlugin:(s,e)=>[...W.registryConfig(),s,e],publishRequests:()=>[...W.all,"publish-requests"],publishRequestsByOrg:s=>[...W.publishRequests(),"org",s],publishRequestsList:(s,e,n)=>[...W.publishRequests(),"list",{status:s??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(s,e,n,r)=>[...W.publishRequestsByOrg(s),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...W.publishRequests(),"count"],publishRequestsCountByOrg:s=>[...W.publishRequestsByOrg(s),"count"],publishApiKeys:()=>[...W.all,"publish-api-keys"],monitor:()=>[...W.all,"monitor"],monitorRuns:()=>[...W.monitor(),"runs"],monitorRunsList:s=>[...W.monitorRuns(),"list",{status:s??"all"}],monitorRun:s=>[...W.monitorRuns(),"run",s??"none"],monitorResults:()=>[...W.monitor(),"results"],monitorResultsList:(s,e)=>[...W.monitorResults(),"list",{runId:s??"none",status:e??"all"}],monitorConnections:()=>[...W.monitor(),"connections"],monitorConnectionAuthProbe:s=>[...W.monitorConnections(),"auth-probe",s]};async function Pe(s,e,n){const r=await s.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 Vn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_RUN_START",{config:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.monitorRuns()}),e.invalidateQueries({queryKey:W.monitorResults()})])},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Kn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async(d,m)=>{await Promise.all([e.invalidateQueries({queryKey:W.monitorRuns()}),e.invalidateQueries({queryKey:W.monitorRun(m)})])},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Ut(s){const e=X.c(10),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==s?(l=W.monitorRunsList(s),e[2]=s,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==s?(a=async()=>Pe(o,"REGISTRY_MONITOR_RUN_LIST",{status:s,limit:100}),e[4]=o,e[5]=s,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],Fe(i)}function Zt(s){const e=X.c(11),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==s?(l=W.monitorRun(s),e[2]=s,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==s?(a=async()=>Pe(o,"REGISTRY_MONITOR_RUN_GET",{runId:s}),e[4]=o,e[5]=s,e[6]=a):a=e[6];const i=!!s;let d;return e[7]!==l||e[8]!==a||e[9]!==i?(d={queryKey:l,queryFn:a,enabled:i,refetchInterval:Yn},e[7]=l,e[8]=a,e[9]=i,e[10]=d):d=e[10],Fe(d)}function Yn(s){return s.state.data?.run?.status==="running"?5e3:!1}function Ct(s,e,n){const r=X.c(14),{org:o}=de();let l;r[0]!==o.id?(l={connectionId:pe,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=he(l);let i;r[2]!==s||r[3]!==e?(i=W.monitorResultsList(s,e),r[2]=s,r[3]=e,r[4]=i):i=r[4];let d;r[5]!==a||r[6]!==s||r[7]!==e?(d=async()=>Pe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:s,status:e,limit:200,offset:0}),r[5]=a,r[6]=s,r[7]=e,r[8]=d):d=r[8];const m=!!s,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==d||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:d,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=d,r[11]=m,r[12]=u,r[13]=x):x=r[13],Fe(x)}function Ds(){const s=X.c(5),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.monitorConnections(),s[2]=o):o=s[2];let l;return s[3]!==r?(l={queryKey:o,queryFn:async()=>Pe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},s[3]=r,s[4]=l):l=s[4],Fe(l)}function Hn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async()=>Pe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.monitorConnections()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Wn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>{const{connectionId:m,authStatus:u}=d;return Pe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.monitorConnections()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}const cs={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 $s(){const s=X.c(33),{org:e,project:n}=de();let r;s[0]!==e.id?(r={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=r):r=s[1];const o=he(r),l=Le();let a;s[2]!==n.id?(a=W.registryConfigByPlugin(n.id??"",Ke),s[2]=n.id,s[3]=a):a=s[3];let i;s[4]!==o||s[5]!==n.id?(i=async()=>Pe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:Ke}),s[4]=o,s[5]=n.id,s[6]=i):i=s[6];const d=!!n.id;let m;s[7]!==a||s[8]!==i||s[9]!==d?(m={queryKey:a,queryFn:i,enabled:d},s[7]=a,s[8]=i,s[9]=d,s[10]=m):m=s[10];const u=Fe(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,c=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let v;s[11]!==p?(v=p??{},s[11]=p,s[12]=v):v=s[12];let b;s[13]!==c||s[14]!==x||s[15]!==p?(b=c&&!p?x:{},s[13]=c,s[14]=x,s[15]=p,s[16]=b):b=s[16];let k;s[17]!==v||s[18]!==b?(k={...cs,...v,...b},s[17]=v,s[18]=b,s[19]=k):k=s[19];const S=k;let y;s[20]!==o||s[21]!==n.id?(y=async R=>{const C=(await Pe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:Ke}))?.config?.settings??{};return Pe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:Ke,settings:{...C,testConfig:{...cs,...C.testConfig??{},...R}}})},s[20]=o,s[21]=n.id,s[22]=y):y=s[22];let f;s[23]!==n.id||s[24]!==l?(f=async()=>{await l.invalidateQueries({queryKey:W.registryConfigByPlugin(n.id??"",Ke)})},s[23]=n.id,s[24]=l,s[25]=f):f=s[25];let M;s[26]!==y||s[27]!==f?(M={mutationFn:y,onSuccess:f},s[26]=y,s[27]=f,s[28]=M):M=s[28];const g=Ce(M);let w;return s[29]!==u.isLoading||s[30]!==g||s[31]!==S?(w={settings:S,isLoading:u.isLoading,saveMutation:g},s[29]=u.isLoading,s[30]=g,s[31]=S,s[32]=w):w=s[32],w}function Jn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_SCHEDULE_SET",d),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.registryConfig()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Zn(){const s=X.c(9),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async d=>Pe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:d}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.registryConfig()})},s[4]=e,s[5]=a):a=s[5];let i;return s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8],Ce(i)}function Xn(){const s=X.c(3),e=Ut("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Ct(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return s[0]!==l||s[1]!==a?(i={brokenCount:l,isLoading:a},s[0]=l,s[1]=a,s[2]=i):i=s[2],i}const As=24;function er(s){return s.trim()}async function _e(s,e,n){const r=await s.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(s){const e=X.c(19),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l,a,i,d;e[2]!==s.categories||e[3]!==s.limit||e[4]!==s.search||e[5]!==s.tags?(a=er(s.search),l=s.limit??As,d=js,i=W.itemsList(a,s.tags,s.categories,l),e[2]=s.categories,e[3]=s.limit,e[4]=s.search,e[5]=s.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=d):(l=e[6],a=e[7],i=e[8],d=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==s.categories||e[13]!==s.tags||e[14]!==a?(m=async x=>{const{pageParam:p}=x,h=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 _e(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:s.tags.length?s.tags:void 0,categories:s.categories.length?s.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=s.categories,e[13]=s.tags,e[14]=a,e[15]=m):m=e[15];let u;return e[16]!==i||e[17]!==m?(u={queryKey:i,queryFn:m,initialPageParam:void 0,getNextPageParam:tr,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],d(u)}function tr(s){return s.nextCursor}function sr(){const s=X.c(8),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.filters(),s[2]=o):o=s[2];let l;s[3]!==r?(l=async()=>_e(r,"REGISTRY_ITEM_FILTERS",{}),s[3]=r,s[4]=l):l=s[4];let a;s[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},s[5]=a):a=s[5];let i;return s[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},s[6]=l,s[7]=i):i=s[7],Fe(i)}function Xt(){const s=X.c(29),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.items()}),e.invalidateQueries({queryKey:W.filters()})])},s[2]=e,s[3]=l):l=s[3];const a=l;let i;s[4]!==o?(i=async f=>(await _e(o,"REGISTRY_ITEM_CREATE",{data:f})).item,s[4]=o,s[5]=i):i=s[5];let d;s[6]!==a||s[7]!==i?(d={mutationFn:i,onSuccess:a},s[6]=a,s[7]=i,s[8]=d):d=s[8];const m=Ce(d);let u;s[9]!==o?(u=async f=>{const{id:M,data:g}=f;return(await _e(o,"REGISTRY_ITEM_UPDATE",{id:M,data:g})).item},s[9]=o,s[10]=u):u=s[10];let x;s[11]!==a||s[12]!==u?(x={mutationFn:u,onSuccess:a},s[11]=a,s[12]=u,s[13]=x):x=s[13];const p=Ce(x);let h;s[14]!==o?(h=async f=>(await _e(o,"REGISTRY_ITEM_DELETE",{id:f})).item,s[14]=o,s[15]=h):h=s[15];let c;s[16]!==a||s[17]!==h?(c={mutationFn:h,onSuccess:a},s[16]=a,s[17]=h,s[18]=c):c=s[18];const v=Ce(c);let b;s[19]!==o?(b=async f=>_e(o,"REGISTRY_ITEM_BULK_CREATE",{items:f}),s[19]=o,s[20]=b):b=s[20];let k;s[21]!==a||s[22]!==b?(k={mutationFn:b,onSuccess:a},s[21]=a,s[22]=b,s[23]=k):k=s[23];const S=Ce(k);let y;return s[24]!==S||s[25]!==m||s[26]!==v||s[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:v,bulkCreateMutation:S},s[24]=S,s[25]=m,s[26]=v,s[27]=p,s[28]=y):y=s[28],y}function qt(s){const e=X.c(37),{org:n,project:r}=de();let o;e[0]!==n.id?(o={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=he(o),a=Le();let i;e[2]!==s||e[3]!==r.id?(i=W.registryConfigByPlugin(r.id??"",s),e[2]=s,e[3]=r.id,e[4]=i):i=e[4];let d;e[5]!==l||e[6]!==s||e[7]!==r.id?(d=async()=>_e(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:s}),e[5]=l,e[6]=s,e[7]=r.id,e[8]=d):d=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==d||e[11]!==m?(u={queryKey:i,queryFn:d,enabled:m,staleTime:6e4},e[9]=i,e[10]=d,e[11]=m,e[12]=u):u=e[12];const x=Fe(u);let p;e[13]!==l||e[14]!==s||e[15]!==r.id?(p=async A=>{const P=(await _e(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:s}))?.config?.settings??{};return _e(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:s,settings:{...P,...A}})},e[13]=l,e[14]=s,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==s||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:W.registryConfigByPlugin(r.id??"",s)})},e[17]=s,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let c;e[21]!==p||e[22]!==h?(c={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=c):c=e[23];const v=Ce(c),b=x.data?.config?.settings?.registryName??"Private Registry",k=x.data?.config?.settings?.registryIcon??"",S=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",f=x.data?.config?.settings?.acceptPublishRequests??!1,M=x.data?.config?.settings?.requireApiToken??!1,g=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,E=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",C=x.data?.config?.settings?.rateLimitMax,T=typeof C=="number"&&C>=1?Math.floor(C):100;let N;return e[24]!==f||e[25]!==x.isLoading||e[26]!==w||e[27]!==T||e[28]!==E||e[29]!==k||e[30]!==S||e[31]!==y||e[32]!==b||e[33]!==M||e[34]!==v||e[35]!==g?(N={registryName:b,registryIcon:k,registryLLMConnectionId:S,registryLLMModelId:y,acceptPublishRequests:f,requireApiToken:M,storePrivateOnly:g,rateLimitEnabled:w,rateLimitWindow:E,rateLimitMax:T,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:v},e[24]=f,e[25]=x.isLoading,e[26]=w,e[27]=T,e[28]=E,e[29]=k,e[30]=S,e[31]=y,e[32]=b,e[33]=M,e[34]=v,e[35]=g,e[36]=N):N=e[36],N}function nr(s){const e=X.c(15),{org:n}=de();let r;e[0]!==n.id?(r={connectionId:pe,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=he(r);let l;e[2]!==n.id||e[3]!==s.sortBy||e[4]!==s.sortDirection||e[5]!==s.status?(l=W.publishRequestsListByOrg(n.id,s.status,s.sortBy,s.sortDirection),e[2]=n.id,e[3]=s.sortBy,e[4]=s.sortDirection,e[5]=s.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==s.sortBy||e[9]!==s.sortDirection||e[10]!==s.status?(a=async d=>{const{pageParam:m}=d;return _e(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:s.status,sortBy:s.sortBy,sortDirection:s.sortDirection,limit:As,offset:m})},e[7]=o,e[8]=s.sortBy,e[9]=s.sortDirection,e[10]=s.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:rr,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],js(i)}function rr(s,e){const n=e.reduce(ir,0);return n<s.totalCount?n:void 0}function ir(s,e){return s+e.items.length}function lr(){const s=X.c(9),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]!==e.id?(o=W.publishRequestsCountByOrg(e.id),s[2]=e.id,s[3]=o):o=s[3];let l;s[4]!==r?(l=async()=>_e(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),s[4]=r,s[5]=l):l=s[5];let a;return s[6]!==o||s[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},s[6]=o,s[7]=l,s[8]=a):a=s[8],Fe(a)}function ar(){const s=X.c(17),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:W.publishRequests()})])},s[2]=e,s[3]=l):l=s[3];const a=l;let i;s[4]!==o?(i=async c=>_e(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",c),s[4]=o,s[5]=i):i=s[5];let d;s[6]!==a||s[7]!==i?(d={mutationFn:i,onSuccess:a},s[6]=a,s[7]=i,s[8]=d):d=s[8];const m=Ce(d);let u;s[9]!==o?(u=async c=>_e(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:c}),s[9]=o,s[10]=u):u=s[10];let x;s[11]!==a||s[12]!==u?(x={mutationFn:u,onSuccess:a},s[11]=a,s[12]=u,s[13]=x):x=s[13];const p=Ce(x);let h;return s[14]!==p||s[15]!==m?(h={reviewMutation:m,deleteMutation:p},s[14]=p,s[15]=m,s[16]=h):h=s[16],h}function or(){const s=X.c(5),{org:e}=de();let n;s[0]!==e.id?(n={connectionId:pe,orgId:e.id},s[0]=e.id,s[1]=n):n=s[1];const r=he(n);let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=W.publishApiKeys(),s[2]=o):o=s[2];let l;return s[3]!==r?(l={queryKey:o,queryFn:async()=>_e(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},s[3]=r,s[4]=l):l=s[4],Fe(l)}function cr(){const s=X.c(19),e=Le(),{org:n}=de();let r;s[0]!==n.id?(r={connectionId:pe,orgId:n.id},s[0]=n.id,s[1]=r):r=s[1];const o=he(r);let l;s[2]!==o?(l=async c=>_e(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:c}),s[2]=o,s[3]=l):l=s[3];let a;s[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:W.publishApiKeys()})},s[4]=e,s[5]=a):a=s[5];let i;s[6]!==l||s[7]!==a?(i={mutationFn:l,onSuccess:a},s[6]=l,s[7]=a,s[8]=i):i=s[8];const d=Ce(i);let m;s[9]!==o?(m=async c=>_e(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:c}),s[9]=o,s[10]=m):m=s[10];let u;s[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:W.publishApiKeys()})},s[11]=e,s[12]=u):u=s[12];let x;s[13]!==m||s[14]!==u?(x={mutationFn:m,onSuccess:u},s[13]=m,s[14]=u,s[15]=x):x=s[15];const p=Ce(x);let h;return s[16]!==d||s[17]!==p?(h={generateMutation:d,revokeMutation:p},s[16]=d,s[17]=p,s[18]=h):h=s[18],h}function ds(s){return s?s.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function ms(s){const e=[];let n="",r=!1;for(let o=0;o<s.length;o+=1){const l=s[o],a=s[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 dr=["id","title"],mr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ur(s){const e=s.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=ms(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of dr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!mr.includes(u)&&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,u)=>{const x=r.get(u);return typeof x=="number"?m[x]??"":""},a=[],i=new Set;let d=0;for(let m=1;m<e.length;m+=1){const u=ms(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),d+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),d+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),d+=1;continue}i.add(x);const h=l(u,"description").trim(),c=l(u,"remote_url").trim(),b=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",k=ds(l(u,"tags")),S=ds(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),f=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:f,_meta:{"mcp.mesh":{...k.length>0?{tags:k}:{},...S.length>0?{categories:S}:{}}},server:{name:x,title:p,description:h||void 0,remotes:c?[{type:b,url:c}]:[]}})}return{items:a,warnings:o,skipped:d}}const xr=`id,title,description,remote_url,remote_type,tags,categories,is_public
2
2
  my-mcp-server,My MCP Server,A useful MCP server,https://example.com/mcp,http,ai|tools,productivity,true
3
3
  another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function hr(){const s=new Blob([xr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(s),n=document.createElement("a");n.href=e,n.download="registry-import-template.csv",n.click(),URL.revokeObjectURL(e)}function pr(s){const e=X.c(63),{open:n,onOpenChange:r,isImporting:o,onImport:l}=s,a=o===void 0?!1:o,[i,d]=I.useState(null),[m,u]=I.useState(null),[x,p]=I.useState(null),h=I.useRef(null);let c;e[0]!==r?(c=Z=>{r(Z),Z||(d(null),u(null),p(null),h.current&&(h.current.value=""))},e[0]=r,e[1]=c):c=e[1];const v=c;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=async Z=>{if(!Z)return;p(Z.name),u(null);const ce=await Z.text();d(ur(ce))},e[2]=b):b=e[2];const k=b;let S;e[3]!==l||e[4]!==i?(S=async()=>{if(!i?.items.length)return;const Z=await l(i.items);u(Z)},e[3]=l,e[4]=i,e[5]=S):S=e[5];const y=S;let f;e[6]!==i?.items?(f=i?.items??[],e[6]=i?.items,e[7]=f):f=e[7];const M=f;let g;e[8]!==i?.warnings?(g=i?.warnings??[],e[8]=i?.warnings,e[9]=g):g=e[9];const w=g;let R;e[10]!==w?(R=w.some(vr),e[10]=w,e[11]=R):R=e[11];const E=R,C=m!==null;let T;e[12]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsxs(Et,{children:[t.jsx(Dt,{children:"Import MCP Servers from CSV"}),t.jsx($t,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=T):T=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=()=>h.current?.click(),e[13]=N):N=e[13];let A;e[14]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(as,{size:14}),e[14]=A):A=e[14];const L=x?"Change file":"Choose CSV file";let P;e[15]!==a||e[16]!==L?(P=t.jsxs(G,{variant:"outline",size:"sm",className:"gap-1.5",onClick:N,disabled:a,children:[A,L]}),e[15]=a,e[16]=L,e[17]=P):P=e[17];let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("input",{ref:h,type:"file",accept:".csv,text/csv",className:"hidden",onChange:Z=>k(Z.target.files?.[0]??null)}),e[18]=D):D=e[18];let $;e[19]!==x?($=x&&t.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),e[19]=x,e[20]=$):$=e[20];let z;e[21]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("div",{className:"flex-1"}),e[21]=z):z=e[21];let O;e[22]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs(G,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:hr,children:[t.jsx(Cn,{size:14}),"Download template"]}),e[22]=O):O=e[22];let B;e[23]!==P||e[24]!==$?(B=t.jsxs("div",{className:"flex items-center gap-3",children:[P,D,$,z,O]}),e[23]=P,e[24]=$,e[25]=B):B=e[25];let Q;e[26]!==w?(Q=w.length>0&&t.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:w.map(jr)}),e[26]=w,e[27]=Q):Q=e[27];let j;e[28]!==M||e[29]!==i?(j=M.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium",children:"Preview"}),t.jsxs(F,{variant:"secondary",children:[M.length," items"]}),i?.skipped?t.jsxs(F,{variant:"outline",className:"text-yellow-600",children:[i.skipped," skipped"]}):null]}),t.jsx("div",{className:"border rounded-lg overflow-hidden",children:t.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:t.jsxs(vs,{children:[t.jsx(bs,{children:t.jsxs(Pt,{children:[t.jsx(Ie,{className:"w-[140px]",children:"ID"}),t.jsx(Ie,{children:"Title"}),t.jsx(Ie,{children:"Remote URL"}),t.jsx(Ie,{className:"w-[80px] text-center",children:"Public"}),t.jsx(Ie,{children:"Tags"})]})}),t.jsx(ys,{children:M.map(gr)})]})})})]}),e[28]=M,e[29]=i,e[30]=j):j=e[30];let U;e[31]!==m?(U=m&&t.jsxs("div",{className:"rounded-lg border p-3 grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[t.jsx(it,{size:16,className:"text-emerald-600"}),"Imported ",m.created," item(s) successfully"]}),m.errors.length>0&&t.jsx("div",{className:"grid gap-1 mt-1",children:m.errors.map(fr)})]}),e[31]=m,e[32]=U):U=e[32];let K;e[33]!==C||e[34]!==i?(K=!i&&!C&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[t.jsx(as,{size:32,className:"text-muted-foreground/40 mb-3"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a CSV file or download the template to get started."}),t.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Required columns: ",t.jsx("code",{children:"id"}),", ",t.jsx("code",{children:"title"}),". Optional:"," ",t.jsx("code",{children:"description"}),", ",t.jsx("code",{children:"remote_url"}),","," ",t.jsx("code",{children:"remote_type"}),", ",t.jsx("code",{children:"tags"}),","," ",t.jsx("code",{children:"categories"}),", ",t.jsx("code",{children:"is_public"}),"."]}),t.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Use ",t.jsx("code",{children:"|"})," or ",t.jsx("code",{children:";"})," to separate multiple tags/categories within a cell."]})]}),e[33]=C,e[34]=i,e[35]=K):K=e[35];let te;e[36]!==B||e[37]!==Q||e[38]!==j||e[39]!==U||e[40]!==K?(te=t.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[B,Q,j,U,K]}),e[36]=B,e[37]=Q,e[38]=j,e[39]=U,e[40]=K,e[41]=te):te=e[41];let se;e[42]!==v?(se=()=>v(!1),e[42]=v,e[43]=se):se=e[43];const le=C?"Done":"Cancel";let ae;e[44]!==se||e[45]!==le?(ae=t.jsx(G,{variant:"outline",onClick:se,children:le}),e[44]=se,e[45]=le,e[46]=ae):ae=e[46];let me;e[47]!==y||e[48]!==E||e[49]!==C||e[50]!==a||e[51]!==M.length?(me=!C&&t.jsx(G,{onClick:y,disabled:a||M.length===0||E,children:a?"Importing...":`Import ${M.length} item(s)`}),e[47]=y,e[48]=E,e[49]=C,e[50]=a,e[51]=M.length,e[52]=me):me=e[52];let ue;e[53]!==ae||e[54]!==me?(ue=t.jsxs(At,{className:"gap-2 sm:gap-0",children:[ae,me]}),e[53]=ae,e[54]=me,e[55]=ue):ue=e[55];let _;e[56]!==te||e[57]!==ue?(_=t.jsxs(Lt,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[T,te,ue]}),e[56]=te,e[57]=ue,e[58]=_):_=e[58];let J;return e[59]!==v||e[60]!==n||e[61]!==_?(J=t.jsx(Ot,{open:n,onOpenChange:v,children:_}),e[59]=v,e[60]=n,e[61]=_,e[62]=J):J=e[62],J}function fr(s){return t.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[t.jsx(xt,{size:12,className:"shrink-0 mt-0.5"}),t.jsxs("span",{children:[t.jsx("span",{className:"font-mono",children:s.id}),": ",s.error]})]},s.id)}function gr(s){return t.jsxs(Pt,{children:[t.jsx(Me,{className:"font-mono text-xs",children:s.id}),t.jsx(Me,{className:"text-sm",children:s.title}),t.jsx(Me,{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:s.server.remotes?.[0]?.url??t.jsx("span",{className:"italic",children:"none"})}),t.jsx(Me,{className:"text-center",children:s.is_public?t.jsx(F,{variant:"secondary",className:"text-[10px] bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:"Yes"}):t.jsx("span",{className:"text-xs text-muted-foreground",children:"No"})}),t.jsx(Me,{className:"text-xs text-muted-foreground",children:(s._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},s.id)}function jr(s,e){return t.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 flex items-start gap-1.5",children:[t.jsx(xt,{size:12,className:"shrink-0 mt-0.5"}),t.jsxs("span",{children:[s.line>0&&t.jsxs("span",{className:"font-mono text-[10px] mr-1",children:["Line ",s.line,":"]}),s.message]})]},`${s.line}-${e}`)}function vr(s){return s.message.startsWith("Missing required column:")}function br(s){const e=X.c(19),{open:n,onOpenChange:r,title:o,isDeleting:l,onConfirm:a}=s,i=l===void 0?!1:l;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(ht,{children:"Delete registry item?"}),e[0]=d):d=e[0];let m;e[1]!==o?(m=t.jsxs(pt,{children:[d,t.jsxs(ft,{children:["This action cannot be undone. Item ",t.jsx("strong",{children:o})," will be permanently removed from this private registry."]})]}),e[1]=o,e[2]=m):m=e[2];let u;e[3]!==i?(u=t.jsx(gt,{disabled:i,children:"Cancel"}),e[3]=i,e[4]=u):u=e[4];const x=i?"Deleting...":"Delete";let p;e[5]!==i||e[6]!==a||e[7]!==x?(p=t.jsx(jt,{disabled:i,onClick:a,children:x}),e[5]=i,e[6]=a,e[7]=x,e[8]=p):p=e[8];let h;e[9]!==u||e[10]!==p?(h=t.jsxs(vt,{children:[u,p]}),e[9]=u,e[10]=p,e[11]=h):h=e[11];let c;e[12]!==m||e[13]!==h?(c=t.jsxs(bt,{children:[m,h]}),e[12]=m,e[13]=h,e[14]=c):c=e[14];let v;return e[15]!==r||e[16]!==n||e[17]!==c?(v=t.jsx(yt,{open:n,onOpenChange:r,children:c}),e[15]=r,e[16]=n,e[17]=c,e[18]=v):v=e[18],v}function yr(s){const[e]=s.id.split("/");return e??"provider"}function Nr(s){return s._meta?.["mcp.mesh"]?.tags??[]}function wr(s){return s._meta?.["mcp.mesh"]?.categories??[]}function Cr(s){return s.server?.icons?.[0]?.src??null}function _r(s){const e=X.c(77),{item:n,onEdit:r,onDelete:o,onToggleVerified:l,onToggleOfficial:a}=s;let i;e[0]!==n?(i=Cr(n),e[0]=n,e[1]=i):i=e[1];const d=i,m=n._meta?.["mcp.mesh"]?.verified===!0,u=n._meta?.["mcp.mesh"]?.official===!0;let x;e[2]!==n?(x=[...Nr(n),...wr(n)],e[2]=n,e[3]=x):x=e[3];const p=x;let h;e[4]!==p?(h=p.slice(0,3),e[4]=p,e[5]=h):h=e[5];const c=h,v=Math.max(0,p.length-c.length);let b;e[6]!==d||e[7]!==n.title?(b=t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:d?t.jsx("img",{src:d,alt:n.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:n.title.charAt(0).toUpperCase()})}),e[6]=d,e[7]=n.title,e[8]=b):b=e[8];let k;e[9]!==n.title?(k=t.jsx("p",{className:"font-medium truncate",children:n.title}),e[9]=n.title,e[10]=k):k=e[10];let S;e[11]!==n?(S=yr(n),e[11]=n,e[12]=S):S=e[12];let y;e[13]!==S?(y=t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S}),e[13]=S,e[14]=y):y=e[14];let f;e[15]!==n.is_public?(f=n.is_public?t.jsxs(F,{variant:"default",className:"gap-1",children:[t.jsx(Ns,{size:10}),"Public"]}):t.jsx(F,{variant:"secondary",children:"Private"}),e[15]=n.is_public,e[16]=f):f=e[16];let M;e[17]!==u?(M=u&&t.jsxs(F,{variant:"outline",className:"gap-1 text-primary",children:[t.jsx(os,{size:10}),"Official"]}),e[17]=u,e[18]=M):M=e[18];let g;e[19]!==u||e[20]!==m?(g=!u&&m&&t.jsxs(F,{variant:"outline",className:"gap-1 text-success",children:[t.jsx(os,{size:10}),"Verified"]}),e[19]=u,e[20]=m,e[21]=g):g=e[21];let w;e[22]!==g||e[23]!==y||e[24]!==f||e[25]!==M?(w=t.jsxs("div",{className:"flex items-center gap-2",children:[y,f,M,g]}),e[22]=g,e[23]=y,e[24]=f,e[25]=M,e[26]=w):w=e[26];let R;e[27]!==w||e[28]!==k?(R=t.jsxs("div",{className:"min-w-0 flex-1",children:[k,w]}),e[27]=w,e[28]=k,e[29]=R):R=e[29];let E;e[30]!==R||e[31]!==b?(E=t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[b,R]}),e[30]=R,e[31]=b,e[32]=E):E=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Tt,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(Ht,{size:18})})}),e[33]=C):C=e[33];let T;e[34]!==n||e[35]!==r?(T=t.jsx(Ee,{onClick:()=>r(n),children:"Edit"}),e[34]=n,e[35]=r,e[36]=T):T=e[36];let N;e[37]!==n||e[38]!==l?(N=()=>l(n),e[37]=n,e[38]=l,e[39]=N):N=e[39];const A=m?"Unmark as Verified":"Mark as Verified";let L;e[40]!==N||e[41]!==A?(L=t.jsx(Ee,{onClick:N,children:A}),e[40]=N,e[41]=A,e[42]=L):L=e[42];let P;e[43]!==n||e[44]!==a?(P=()=>a(n),e[43]=n,e[44]=a,e[45]=P):P=e[45];const D=u?"Unmark as Official":"Mark as Official";let $;e[46]!==P||e[47]!==D?($=t.jsx(Ee,{onClick:P,children:D}),e[46]=P,e[47]=D,e[48]=$):$=e[48];let z;e[49]!==n||e[50]!==o?(z=()=>o(n),e[49]=n,e[50]=o,e[51]=z):z=e[51];let O;e[52]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(wt,{size:14}),e[52]=O):O=e[52];let B;e[53]!==z?(B=t.jsxs(Ee,{variant:"destructive",onClick:z,children:[O,"Delete"]}),e[53]=z,e[54]=B):B=e[54];let Q;e[55]!==T||e[56]!==L||e[57]!==$||e[58]!==B?(Q=t.jsxs(It,{children:[C,t.jsxs(Mt,{align:"end",children:[T,L,$,B]})]}),e[55]=T,e[56]=L,e[57]=$,e[58]=B,e[59]=Q):Q=e[59];let j;e[60]!==E||e[61]!==Q?(j=t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[E,Q]}),e[60]=E,e[61]=Q,e[62]=j):j=e[62];const U=n._meta?.["mcp.mesh"]?.short_description||n.description||n.server.description||"No description provided.";let K;e[63]!==U?(K=t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:U}),e[63]=U,e[64]=K):K=e[64];let te;e[65]!==n.id||e[66]!==c?(te=c.map(me=>t.jsx(F,{variant:"secondary",children:me},`${n.id}-badge-${me}`)),e[65]=n.id,e[66]=c,e[67]=te):te=e[67];let se;e[68]!==v?(se=v>0&&t.jsxs(F,{variant:"outline",children:["+",v]}),e[68]=v,e[69]=se):se=e[69];let le;e[70]!==te||e[71]!==se?(le=t.jsxs("div",{className:"flex flex-wrap gap-1",children:[te,se]}),e[70]=te,e[71]=se,e[72]=le):le=e[72];let ae;return e[73]!==j||e[74]!==K||e[75]!==le?(ae=t.jsxs(oe,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[j,K,le]}),e[73]=j,e[74]=K,e[75]=le,e[76]=ae):ae=e[76],ae}function Os(s){const e=X.c(27),{value:n,onChange:r,onFileUpload:o,error:l,isUploading:a}=s,i=a===void 0?!1:a,[d,m]=I.useState(!1),[u,x]=I.useState(!1),p=I.useRef(null);let h;e[0]!==i?(h=T=>{T.preventDefault(),i||m(!0)},e[0]=i,e[1]=h):h=e[1];const c=h;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=T=>{T.preventDefault(),m(!1)},e[2]=v):v=e[2];const b=v;let k;e[3]!==i||e[4]!==o?(k=async T=>{if(T.preventDefault(),m(!1),i)return;const N=T.dataTransfer.files[0];N&&await o(N)},e[3]=i,e[4]=o,e[5]=k):k=e[5];const S=k;let y;e[6]!==i||e[7]!==o?(y=async T=>{const N=T.target.files?.[0];N&&!i&&await o(N),T.target.value=""},e[6]=i,e[7]=o,e[8]=y):y=e[8];const f=y,M=n.length>0;let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(re,{children:"Image"}),e[9]=g):g=e[9];let w;e[10]!==c||e[11]!==S||e[12]!==M||e[13]!==d||e[14]!==i||e[15]!==r||e[16]!==u||e[17]!==n?(w=M?t.jsx("div",{className:"relative group min-h-[180px] rounded-xl border border-border overflow-hidden bg-muted/10",children:t.jsxs("div",{className:"flex items-center gap-3 p-3 h-full",children:[t.jsx("div",{className:"size-20 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0",children:t.jsx("img",{src:n,alt:"Preview",className:"w-full h-full object-cover"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>p.current?.click(),disabled:i,children:[t.jsx(Wt,{className:"size-3"}),"Change"]}),t.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{r(""),x(!1)},disabled:i,children:[t.jsx(wt,{className:"size-3"}),"Remove"]})]})]})]})}):i?t.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:[t.jsx(et,{className:"size-8 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):t.jsxs("div",{className:ee("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",d?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:c,onDragLeave:b,onDrop:S,onClick:()=>p.current?.click(),children:[t.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6 px-4 flex-1",children:[t.jsx("div",{className:ee("size-10 rounded-lg flex items-center justify-center transition-colors",d?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:t.jsx(Ps,{size:20})}),t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:d?"Drop image here":"Click or drag to upload"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"PNG, JPG, SVG up to 2MB"})]})]}),u?t.jsx("div",{className:"border-t border-border px-3 py-2",onClick:kr,children:t.jsx(xe,{placeholder:"https://example.com/logo.png",value:n,className:"text-xs h-8",onChange:T=>r(T.target.value)})}):t.jsx("div",{className:"border-t border-border px-4 py-2",children:t.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:T=>{T.stopPropagation(),x(!0)},children:[t.jsx(In,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=c,e[11]=S,e[12]=M,e[13]=d,e[14]=i,e[15]=r,e[16]=u,e[17]=n,e[18]=w):w=e[18];let R;e[19]!==f?(R=t.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:f}),e[19]=f,e[20]=R):R=e[20];let E;e[21]!==l?(E=l&&t.jsx("p",{className:"text-xs text-destructive",children:l}),e[21]=l,e[22]=E):E=e[22];let C;return e[23]!==w||e[24]!==R||e[25]!==E?(C=t.jsxs("div",{className:"grid gap-1.5",children:[g,w,R,E]}),e[23]=w,e[24]=R,e[25]=E,e[26]=C):C=e[26],C}function kr(s){return s.stopPropagation()}function zs(){const[s,e]=I.useState("idle"),[n,r]=I.useState(null),{org:o}=de(),l=he({connectionId:pe,orgId:o.id});return{discover:async(d,m)=>{if(!d)return null;e("loading"),r(null);try{const u=await l.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:d,type:m==="sse"?"sse":"http"}}),x=u.structuredContent??u;if(u.isError){const p=u.content?.find(h=>h.type==="text")?.text??"Tool returned an error";return r(p),e("error"),null}return x.error?Sr(x.error)?(r(x.error),e("auth_required"),null):(r(x.error),e("error"),null):!x.tools||x.tools.length===0?(r("No tools found on this MCP server."),e("error"),null):(e("success"),x.tools)}catch(u){const x=u instanceof Error?u.message:String(u);return r(x||"Could not discover tools."),e("error"),null}},discoverStatus:s,discoverError:n,resetDiscover:()=>{e("idle"),r(null)}}}function Sr(s){const e=s.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function Rr(s){const e=X.c(54),{tools:n,onChange:r,remoteUrl:o,remoteType:l,externalDiscoverStatus:a,externalDiscoverError:i}=s,[d,m]=I.useState(n.length>0),{discover:u,discoverStatus:x,discoverError:p,resetDiscover:h}=zs(),c=a??x,v=i??p;let b;e[0]!==u||e[1]!==r||e[2]!==l||e[3]!==o?(b=async()=>{if(!o)return;const O=await u(o,l??"http");O&&(r(O),m(!0))},e[0]=u,e[1]=r,e[2]=l,e[3]=o,e[4]=b):b=e[4];const k=b;let S;e[5]!==r||e[6]!==h?(S=()=>{r([]),h()},e[5]=r,e[6]=h,e[7]=S):S=e[7];const y=S;let f;e[8]!==d?(f=()=>m(!d),e[8]=d,e[9]=f):f=e[9];let M,g;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(Jt,{size:14,className:"text-muted-foreground"}),g=t.jsx("span",{children:"Tools"}),e[10]=M,e[11]=g):(M=e[10],g=e[11]);let w;e[12]!==n.length?(w=n.length>0&&t.jsx(F,{variant:"secondary",className:"text-xs px-1.5 py-0",children:n.length}),e[12]=n.length,e[13]=w):w=e[13];let R;e[14]!==d?(R=d?t.jsx(Mn,{size:14,className:"text-muted-foreground"}):t.jsx(Rs,{size:14,className:"text-muted-foreground"}),e[14]=d,e[15]=R):R=e[15];let E;e[16]!==f||e[17]!==w||e[18]!==R?(E=t.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:f,children:[M,g,w,R]}),e[16]=f,e[17]=w,e[18]=R,e[19]=E):E=e[19];let C;e[20]!==y||e[21]!==n.length?(C=n.length>0&&t.jsxs(G,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:y,children:[t.jsx(wt,{size:12}),"Clear"]}),e[20]=y,e[21]=n.length,e[22]=C):C=e[22];let T;e[23]!==c||e[24]!==k||e[25]!==o||e[26]!==n.length?(T=o&&t.jsxs(G,{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:k,disabled:c==="loading",children:[c==="loading"?t.jsx(et,{size:12,className:"animate-spin"}):t.jsx(Wt,{size:12}),c==="loading"?"Discovering...":n.length>0?"Refresh":"Auto-discover"]}),e[23]=c,e[24]=k,e[25]=o,e[26]=n.length,e[27]=T):T=e[27];let N;e[28]!==T||e[29]!==C?(N=t.jsxs("div",{className:"flex items-center gap-2",children:[C,T]}),e[28]=T,e[29]=C,e[30]=N):N=e[30];let A;e[31]!==N||e[32]!==E?(A=t.jsxs("div",{className:"flex items-center justify-between",children:[E,N]}),e[31]=N,e[32]=E,e[33]=A):A=e[33];let L;e[34]!==c||e[35]!==n.length?(L=c==="success"&&t.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:[t.jsx(it,{size:14,className:"shrink-0"}),t.jsxs("span",{children:["Discovered ",n.length," tool",n.length!==1?"s":""," ","successfully."]})]}),e[34]=c,e[35]=n.length,e[36]=L):L=e[36];let P;e[37]!==v||e[38]!==c?(P=c==="error"&&v&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[t.jsx(xt,{size:14,className:"shrink-0"}),t.jsx("span",{children:v})]}),e[37]=v,e[38]=c,e[39]=P):P=e[39];let D;e[40]!==d||e[41]!==n?(D=d&&n.length>0&&t.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:n.map(Tr)}),e[40]=d,e[41]=n,e[42]=D):D=e[42];let $;e[43]!==c||e[44]!==d||e[45]!==o||e[46]!==n.length?($=d&&n.length===0&&c==="idle"&&t.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]=c,e[44]=d,e[45]=o,e[46]=n.length,e[47]=$):$=e[47];let z;return e[48]!==A||e[49]!==L||e[50]!==P||e[51]!==D||e[52]!==$?(z=t.jsxs("div",{className:"space-y-3",children:[A,L,P,D,$]}),e[48]=A,e[49]=L,e[50]=P,e[51]=D,e[52]=$,e[53]=z):z=e[53],z}function Tr(s){return t.jsx("div",{className:"flex items-center gap-3 px-3 py-2",children:t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-mono truncate",children:s.name}),s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description})]})},s.name)}function Us(s){const{org:e}=de(),[n,r]=I.useState(!1),l=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,a=he({connectionId:l??"noop",orgId:e.id});return{uploadImage:async(d,m)=>{if(!l)return H.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!d.type.startsWith("image/"))return H.error("Only image files are supported"),null;if(d.size>5*1024*1024)return H.error("Image size must be less than 5MB"),null;r(!0);try{const u=await a.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:m,contentType:d.type}}),x=u.structuredContent?.url||u.url;if(!x)throw new Error("Failed to get presigned URL");const p=await fetch(x,{method:"PUT",body:d,headers:{"Content-Type":d.type}});if(!p.ok)throw new Error(`Upload failed: ${p.statusText}`);const h=await a.callTool({name:"GET_PRESIGNED_URL",arguments:{key:m,expiresIn:31536e3}}),c=h.structuredContent?.url||h.url;if(!c)throw new Error("Failed to get public URL");return c}catch(u){return console.error("Image upload failed:",u),H.error(u instanceof Error?u.message:"Failed to upload image. Please try again."),null}finally{r(!1)}},isUploading:n}}function Ir(){const{org:s}=de(),[e,n]=I.useState(null),r=I.useRef(0),o=he({connectionId:pe,orgId:s.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 d=i.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(d)}return i.structuredContent??i}finally{r.current-=1,r.current===0&&n(null)}},loadingType:e,isGenerating:e!==null}}const Mr=new Set(["http","sse","stdio"]),Pr=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,us=["internal","automation","support","sales","ops","ai"],qs=["productivity","communication","customer-support","development","data","operations"],Er=["Essentials","Details","Advanced"],nt="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 xs(s){return s.replace(/^https?:\/\//i,"").trim()}function rt(s){const e=s.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function Ye(s){return s.trim().toLowerCase()}function Nt(s){return Array.from(new Set(s.map(Ye).filter(e=>e.length>0)))}function Ze(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Dr(s){const e=X.c(4),{current:n}=s;let r;e[0]!==n?(r=Er.map((l,a)=>{const i=a+1,d=i===n,m=i<n;return t.jsxs("div",{className:"flex items-center gap-1.5",children:[a>0&&t.jsx("div",{className:ee("w-4 h-px",m?"bg-primary":"bg-border")}),t.jsxs("div",{className:ee("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",d?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[t.jsx("span",{className:ee("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",d?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:i}),t.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=t.jsx("div",{className:"flex items-center gap-1.5",children:r}),e[2]=r,e[3]=o):o=e[3],o}function $r(s){const e=X.c(28),{id:n,label:r,values:o,availableOptions:l,placeholder:a,onChange:i}=s,[d,m]=I.useState(""),[u,x]=I.useState(!1);let p,h,c,v,b;if(e[0]!==l||e[1]!==n||e[2]!==d||e[3]!==u||e[4]!==r||e[5]!==i||e[6]!==a||e[7]!==o){const y=Nt(l),f=Nt(o),M=new Set(f),g=Ye(d),w=y.filter(P=>!M.has(P)).filter(P=>g?P.includes(g):!0).slice(0,8),R=P=>{const D=Ye(P);!D||M.has(D)||i([...f,D])},E=P=>{i(f.filter(D=>D!==P))},C=()=>{const P=d.split(/[,\n;]/).map(Ye).filter(Boolean);if(P.length===0)return;const D=[...f];for(const $ of P)D.includes($)||D.push($);i(D),m("")},T=g;v="grid gap-2",e[13]!==n||e[14]!==r?(b=t.jsx(re,{htmlFor:n,children:r}),e[13]=n,e[14]=r,e[15]=b):b=e[15],p="relative";let N;e[16]!==n?(N=()=>{const P=document.getElementById(n);P instanceof HTMLInputElement&&P.focus()},e[16]=n,e[17]=N):N=e[17];let A;e[18]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(!0),e[18]=A):A=e[18];let L;e[19]===Symbol.for("react.memo_cache_sentinel")?(L=P=>m(P.target.value),e[19]=L):L=e[19],h=t.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:N,children:t.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f.map(P=>t.jsxs(F,{variant:"secondary",className:"gap-1",children:[P,t.jsx("button",{type:"button",onClick:D=>{D.preventDefault(),D.stopPropagation(),E(P)},children:t.jsx(Tn,{size:12})})]},`${n}-${P}`)),t.jsx("input",{id:n,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:f.length?"":a,value:d,onFocus:A,onBlur:()=>{x(!1),C()},onChange:L,onKeyDown:P=>{if(P.key==="Enter"||P.key===","){P.preventDefault(),C();return}P.key==="Backspace"&&!d&&f.length&&E(f[f.length-1]??"")}})]})}),c=u&&t.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:w.length>0?w.map(P=>t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Lr,onClick:()=>{R(P),m("")},children:P},`${n}-suggestion-${P}`)):T?t.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Ar,onClick:()=>{R(T),m("")},children:['Create "',T,'"']}):t.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]=d,e[3]=u,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=p,e[9]=h,e[10]=c,e[11]=v,e[12]=b}else p=e[8],h=e[9],c=e[10],v=e[11],b=e[12];let k;e[20]!==p||e[21]!==h||e[22]!==c?(k=t.jsxs("div",{className:p,children:[h,c]}),e[20]=p,e[21]=h,e[22]=c,e[23]=k):k=e[23];let S;return e[24]!==v||e[25]!==b||e[26]!==k?(S=t.jsxs("div",{className:v,children:[b,k]}),e[24]=v,e[25]=b,e[26]=k,e[27]=S):S=e[27],S}function Ar(s){return s.preventDefault()}function Lr(s){return s.preventDefault()}function Or({id:s,value:e,availableOptions:n,onChange:r}){const[o,l]=I.useState(e),[a,i]=I.useState(!1),d=I.useRef(e);d.current!==e&&(d.current=e,l(e));const m=Nt([...qs,...n,e]).filter(Boolean),u=Ye(o),x=m.filter(h=>u?h.includes(u):!0).slice(0,8),p=h=>{const c=Ye(h);r(c),l(c),i(!1)};return t.jsxs("div",{className:"grid gap-2",children:[t.jsx(re,{htmlFor:s,children:"Category"}),t.jsxs("div",{className:"relative",children:[t.jsx(xe,{id:s,className:"h-9 text-sm",placeholder:"Select or create category",value:o,onFocus:()=>{l(e),i(!0)},onBlur:()=>{p(o)},onChange:h=>l(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),p(o))}}),e&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground hover:text-foreground",onMouseDown:h=>h.preventDefault(),onClick:()=>{r(""),l("")},children:"clear"}),a&&t.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:x.length>0?x.map(h=>t.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:c=>c.preventDefault(),onClick:()=>p(h),children:h},`${s}-${h}`)):u?t.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:h=>h.preventDefault(),onClick:()=>p(u),children:['Create "',u,'"']}):t.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})})]})]})}function zr({open:s,onOpenChange:e,item:n,draft:r,availableTags:o=[],availableCategories:l=[],defaultLLMConnectionId:a="",defaultLLMModelId:i="",isSubmitting:d=!1,onSubmit:m}){const{org:u}=de(),{uploadImage:x,isUploading:p}=Us(),{generate:h,loadingType:c}=Ir(),{discover:v,discoverStatus:b,discoverError:k,resetDiscover:S}=zs(),y=!!n,f=r?._meta?.["mcp.mesh"],M=n?.title??r?.title??"",g=n?.id?.split("/")[0]??r?.id?.split("/")[0]??"",w=n?.description??r?.description??"",R=n?._meta?.["mcp.mesh"]?.short_description??f?.short_description??"",E=n?._meta?.["mcp.mesh"]?.owner??f?.owner??"",C=n?.server?.repository?.url??r?.server?.repository?.url??"",T=n?._meta?.["mcp.mesh"]?.readme??f?.readme??"",N=n?._meta?.["mcp.mesh"]?.readme_url??f?.readme_url??"",A=xs(n?.server?.remotes?.[0]?.url??r?.server?.remotes?.[0]?.url??""),L=n?.server?.remotes?.[0]?.type??r?.server?.remotes?.[0]?.type??"http",P=n?._meta?.["mcp.mesh"]?.tags??f?.tags??[],D=n?._meta?.["mcp.mesh"]?.categories?.[0]??f?.categories?.[0]??"",$=n?.server?.icons?.[0]?.src??r?.server?.icons?.[0]?.src??"",z=n?._meta?.["mcp.mesh"]?.tools??f?.tools??[],O=n?.is_public??r?.is_public??!1,B=n?._meta?.["mcp.mesh"]?.verified??f?.verified??!1,Q=n?._meta?.["mcp.mesh"]?.official??f?.official??!1,[j,U]=I.useState(1),[K,te]=I.useState(M),[se,le]=I.useState(g),[ae,me]=I.useState(w),[ue,_]=I.useState(R),[J,Z]=I.useState(E),[ce,fe]=I.useState(C),[ke,ye]=I.useState(T),[ie,De]=I.useState(N),[Te,$e]=I.useState(T?"content":"link"),[ne,je]=I.useState(A),[Ne,be]=I.useState(L),[Oe,Ae]=I.useState(P),[Se,Be]=I.useState(D),[He,lt]=I.useState($),[we,tt]=I.useState(z),[V,ge]=I.useState(O),[st,Ge]=I.useState(B),[_t,at]=I.useState(Q),[ve,ot]=I.useState({}),We=!!(a&&i),es=()=>{U(1),te(M),le(g),me(w),_(R),Z(E),fe(C),ye(T),De(N),$e(T?"content":"link"),je(A),be(L),Ae(P),Be(D),lt($),tt(z),ge(O),Ge(B),at(Q),ot({}),S(),kt.current="",Qe.current&&(clearTimeout(Qe.current),Qe.current=null)},Ks=async q=>{if(!q)return;const Y=y?n?.id:`${se}/${K}`.toLowerCase(),Re=Ze(Y||"temp"),ze=q.name.split(".").pop()||"png",Ue=`registry/${u.id}/${Re}/icon.${ze}`,Je=await x(q,Ue);Je?(lt(Je),ot(qe=>({...qe,imageUrl:void 0}))):ot(qe=>({...qe,imageUrl:"Failed to upload image. Please try again."}))},Qe=I.useRef(null),kt=I.useRef(""),Ft=I.useRef(Ne);Ft.current=Ne;const ts=q=>{!q&&Qe.current&&(clearTimeout(Qe.current),Qe.current=null),e(q),q||es()},Ys=async()=>{const q=rt(ne);if(!q)return;kt.current=q;const Y=await v(q,Ft.current);Y&&tt(Y)},Hs=q=>{Qe.current&&clearTimeout(Qe.current);const Y=rt(q);!Y||Y===kt.current||q.includes(".")&&(Qe.current=setTimeout(async()=>{kt.current=Y;const Re=await v(Y,Ft.current);Re&&tt(Re)},800))},ct=()=>We?{llmConnectionId:a,modelId:i}:null,dt=()=>({name:K.trim(),provider:se.trim(),url:rt(ne),owner:J.trim(),repositoryUrl:ce.trim(),description:ae.trim(),shortDescription:ue.trim(),tags:Oe,categories:Se?[Se]:[],availableTags:[...us,...o],availableCategories:[...qs,...l],tools:we}),Ws=async()=>{const q=ct();if(!q)return;const Y=await h({...q,type:"description",context:dt()});Y.result&&me(Y.result.slice(0,1500))},Js=async()=>{const q=ct();if(!q)return;const Y=await h({...q,type:"short_description",context:dt()});Y.result&&_(Y.result.slice(0,160))},Zs=async()=>{const q=ct();if(!q)return;const Y=await h({...q,type:"tags",context:dt()});Y.items?.length&&Ae(Nt(Y.items))},Xs=async()=>{const q=ct();if(!q)return;const Y=await h({...q,type:"categories",context:dt()});Y.items?.[0]&&Be(Ye(Y.items[0]))},en=async()=>{const q=ct();if(!q)return;const Y=await h({...q,type:"readme",context:dt()});Y.result&&(ye(Y.result.slice(0,5e4)),$e("content"))},ss=q=>{const Y={};if(q===1){const Re=Ze(se),ze=Ze(K),Ue=`${Re}/${ze}`;K.trim()||(Y.title="Name is required."),y||(Re?ze?Pr.test(Ue)||(Y.provider="Use lowercase letters/numbers and separators '/' or '-'."):Y.title="Name must contain valid characters.":Y.provider="Provider is required.");const Je=rt(ne),qe=Ne.trim().toLowerCase();if(qe!=="stdio"&&Je)try{const mt=new URL(Je);["http:","https:"].includes(mt.protocol)||(Y.remoteUrl="Remote URL must be http(s).")}catch{Y.remoteUrl="Remote URL is invalid."}if(qe&&!Mr.has(qe)&&(Y.remoteType="Remote type must be: http, sse or stdio."),He.trim()&&!He.trim().startsWith("data:image/"))try{const Bt=new URL(He.trim());["http:","https:"].includes(Bt.protocol)||(Y.imageUrl="Image URL must be http(s).")}catch{Y.imageUrl="Image URL is invalid."}}if(q===2&&(ae.length>1500&&(Y.description="Description must be 1500 characters or less."),ue.trim().length>160&&(Y.shortDescription="Short description must be 160 characters or less.")),q===3){const Re=ie.trim();if(Re)try{const Ue=new URL(Re);["http:","https:"].includes(Ue.protocol)||(Y.readmeUrl="README URL must be http(s).")}catch{Y.readmeUrl="README URL is invalid."}ke.trim().length>5e4&&(Y.readme="README must be 50 000 characters or less.");const ze=ce.trim();if(ze)try{const Ue=new URL(ze);["http:","https:"].includes(Ue.protocol)||(Y.repositoryUrl="Repository URL must be http(s).")}catch{Y.repositoryUrl="Repository URL is invalid."}}return ot(Y),Object.values(Y).every(Re=>Re===void 0)},tn=()=>{ss(j)&&j<3&&U(j+1)},sn=()=>{j>1&&U(j-1)},nn=async()=>{if(!ss(3))return;const q=K.trim(),Y=Ze(se),Re=Ze(q),ze=`${Y}/${Re}`,Ue=rt(ne),Je=Ne.trim().toLowerCase(),qe=He.trim(),mt=ce.trim(),Bt=ue.trim(),on=ke.trim(),cn=ie.trim(),dn=Nt(Oe),mn=Se?[Ye(Se)]:[],un=n?n.server?.name??n.id:"",xn=(y?un:ze).trim(),Gt=ae.trim(),hn=J.trim(),ns={title:q,description:Gt.length>0?Gt:null,is_public:V,_meta:{"mcp.mesh":{verified:st,official:_t,tags:dn,categories:mn,short_description:Bt||null,owner:hn||null,readme:on||null,readme_url:cn||null,...we.length>0?{tools:we}:{}}},server:{name:xn,title:q,description:Gt||void 0,icons:qe?[{src:qe}]:[],repository:mt?{url:mt}:void 0,remotes:Ue?[{type:Je||"http",url:Ue}]:[]}};if(y&&n){await m({id:n.id,data:ns}),e(!1);return}await m({id:ze,...ns}),e(!1),es()},rn=t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"row-span-2 grid gap-3 content-start",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"registry-item-provider",children:"Provider"}),t.jsx(xe,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:se,onChange:q=>le(q.target.value),disabled:y}),!y&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",t.jsx("span",{className:"font-mono",children:`${Ze(se)||"provider"}/${Ze(K)||"name"}`})]}),ve.provider&&t.jsx("p",{className:"text-xs text-destructive",children:ve.provider})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"registry-item-title",children:"Name"}),t.jsx(xe,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:K,onChange:q=>te(q.target.value)}),ve.title&&t.jsx("p",{className:"text-xs text-destructive",children:ve.title})]})]}),t.jsx("div",{className:"row-span-2 content-start",children:t.jsx(Os,{value:He,onChange:q=>{lt(q),ot(Y=>({...Y,imageUrl:void 0}))},onFileUpload:Ks,error:ve.imageUrl,isUploading:p})}),t.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[t.jsx(re,{htmlFor:"registry-remote-url",children:"Remote URL"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex-1 flex items-center rounded-xl border border-input px-3",children:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground mr-1",children:"https://"}),t.jsx("input",{id:"registry-remote-url",className:"flex-1 h-9 bg-transparent outline-none text-sm",placeholder:"example.com/mcp",value:ne,onChange:q=>{const Y=xs(q.target.value);je(Y),Hs(Y)}})]}),t.jsxs(Cs,{value:Ne,onValueChange:be,children:[t.jsx(_s,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:t.jsx(ks,{placeholder:"Type"})}),t.jsxs(Ss,{children:[t.jsx(Rt,{value:"http",children:"http"}),t.jsx(Rt,{value:"sse",children:"sse"}),t.jsx(Rt,{value:"stdio",children:"stdio"})]})]})]}),ve.remoteUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ve.remoteUrl}),ve.remoteType&&t.jsx("p",{className:"text-xs text-destructive",children:ve.remoteType})]}),ne.trim()&&t.jsxs("div",{className:"col-span-2 space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(G,{type:"button",variant:"outline",size:"sm",className:ee(nt,"gap-1.5"),onClick:Ys,disabled:b==="loading",children:[b==="loading"?t.jsx(et,{size:12,className:"animate-spin"}):t.jsx(Wt,{size:12}),b==="loading"?"Discovering tools...":we.length>0?"Re-discover tools":"Discover tools from URL"]}),we.length>0&&b!=="loading"&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[we.length," tool",we.length!==1?"s":""," loaded"]})]}),b==="success"&&we.length>0&&t.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:[t.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400",children:[t.jsx(it,{size:14,className:"shrink-0"}),t.jsxs("span",{className:"font-medium",children:[we.length," tool",we.length!==1?"s":""," discovered"]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[we.slice(0,8).map(q=>t.jsx(F,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:q.name},q.name)),we.length>8&&t.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",we.length-8," more"]})]}),t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"These tools will enrich AI-generated descriptions, tags and categories in the next step."})]}),b==="auth_required"&&k&&t.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:[t.jsx(xt,{size:14,className:"shrink-0"}),t.jsx("span",{children:"This server requires authentication. The connection is valid but tools cannot be listed without credentials."})]}),b==="error"&&k&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[t.jsx(xt,{size:14,className:"shrink-0"}),t.jsx("span",{children:k})]})]})]}),ln=t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(re,{htmlFor:"registry-item-short-description",children:"Short Description"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs text-muted-foreground",children:[ue.length,"/160"]}),We&&t.jsx(G,{type:"button",variant:"outline",size:"sm",className:nt,disabled:c==="short_description",onClick:Js,children:c==="short_description"?"Generating...":"AI Generate"})]})]}),t.jsx(xe,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:ue,maxLength:160,onChange:q=>_(q.target.value)}),ve.shortDescription&&t.jsx("p",{className:"text-xs text-destructive",children:ve.shortDescription})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(re,{htmlFor:"registry-item-description",children:"Description"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{className:"text-xs text-muted-foreground",children:[ae.length,"/1500"]}),We&&t.jsx(G,{type:"button",variant:"outline",size:"sm",className:nt,disabled:c==="description",onClick:Ws,children:c==="description"?"Generating...":"AI Generate"})]})]}),t.jsx(zt,{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:ae,onChange:q=>me(q.target.value)}),ve.description&&t.jsx("p",{className:"text-xs text-destructive",children:ve.description})]}),t.jsx("div",{className:"border-t border-border"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"grid content-start gap-2",children:[t.jsx(Or,{id:"registry-category",value:Se,availableOptions:l,onChange:Be}),We&&t.jsx(G,{type:"button",variant:"outline",size:"sm",className:ee(nt,"justify-self-start"),disabled:c==="categories",onClick:Xs,children:c==="categories"?"Suggesting...":"AI Suggest"})]}),t.jsxs("div",{className:"grid content-start gap-2",children:[t.jsx($r,{id:"registry-tags",label:"Tags",values:Oe,availableOptions:[...us,...o],placeholder:"Type and press Enter or comma",onChange:Ae}),We&&t.jsx(G,{type:"button",variant:"outline",size:"sm",className:ee(nt,"justify-self-start"),disabled:c==="tags",onClick:Zs,children:c==="tags"?"Suggesting...":"AI Suggest"})]})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(re,{htmlFor:"registry-is-public",className:"text-sm",children:"Public"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Make this MCP visible in the public store URL."})]}),t.jsx(Xe,{id:"registry-is-public",checked:V,onCheckedChange:ge})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(re,{htmlFor:"registry-is-verified",className:"text-sm",children:"Verified"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Curated and approved by deco."})]}),t.jsx(Xe,{id:"registry-is-verified",checked:st,onCheckedChange:Ge})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[t.jsxs("div",{className:"grid gap-0.5",children:[t.jsx(re,{htmlFor:"registry-is-official",className:"text-sm",children:"Official"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Made and hosted by the service provider."})]}),t.jsx(Xe,{id:"registry-is-official",checked:_t,onCheckedChange:at})]})]}),an=t.jsxs("div",{className:"grid gap-3",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),t.jsx(xe,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:J,onChange:q=>Z(q.target.value)})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),t.jsx(xe,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:ce,onChange:q=>fe(q.target.value)}),ve.repositoryUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ve.repositoryUrl})]})]}),t.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(re,{children:"README"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[ke.length,"/50000"]})]}),t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(We?["link","content","generate"]:["link","content"]).map(q=>t.jsx("button",{type:"button",className:ee("px-2.5 py-1 text-xs rounded-md",Te===q?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>$e(q),children:q==="link"?"Link":q==="content"?"Content":"Generate"},q))}),Te==="link"&&t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(xe,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:ie,onChange:q=>De(q.target.value)}),ve.readmeUrl&&t.jsx("p",{className:"text-xs text-destructive",children:ve.readmeUrl})]}),Te==="content"&&t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(zt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
4
4
 
5
- Describe your MCP here...`,rows:6,value:ke,onChange:q=>ye(q.target.value)}),ve.readme&&t.jsx("p",{className:"text-xs text-destructive",children:ve.readme})]}),We&&Te==="generate"&&t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-3",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Generates a README using name, description, tools, category and tags as context."}),t.jsx(G,{type:"button",variant:"outline",size:"sm",className:nt,disabled:c==="readme",onClick:en,children:c==="readme"?"Generating...":"Generate with AI"})]})]}),t.jsx(Rr,{tools:we,onChange:tt,remoteUrl:rt(ne)||void 0,remoteType:Ne,externalDiscoverStatus:b,externalDiscoverError:k})]});return t.jsx(Ot,{open:s,onOpenChange:ts,children:t.jsxs(Lt,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[t.jsxs(Et,{className:"space-y-3",children:[t.jsx(Dt,{children:y?"Edit MCP Server":"Add MCP Server"}),t.jsx(Dr,{current:j}),t.jsxs($t,{children:[j===1&&"Set up the identity, connection and discover available tools.",j===2&&"Add descriptions, categories and tags to help discovery.",j===3&&"Configure optional metadata, README and tools."]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[j===1&&rn,j===2&&ln,j===3&&an]}),t.jsxs(At,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[t.jsx("div",{children:j>1&&t.jsxs(G,{variant:"ghost",size:"sm",onClick:sn,children:[t.jsx(_n,{size:14}),"Back"]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{variant:"outline",size:"sm",onClick:()=>ts(!1),disabled:d,children:"Cancel"}),j<3?t.jsxs(G,{size:"sm",onClick:tn,children:["Next",t.jsx(kn,{size:14})]}):t.jsx(G,{size:"sm",onClick:nn,disabled:d,children:d?"Saving...":y?"Save changes":"Create"})]})]})]})})}function hs(s,e){return s.includes(e)?s.filter(n=>n!==e):[...s,e]}function Ur(s){return s._meta?.["mcp.mesh"]?.tags??[]}function qr(s){return s._meta?.["mcp.mesh"]?.categories??[]}function Fr(s){return s.server?.remotes?.[0]?.url??"-"}function Br(){const[e,n]=I.useState(""),r=I.useDeferredValue(e),[o,l]=I.useState([]),[a,i]=I.useState([]),[d,m]=I.useState(!1),[u,x]=I.useState(!1),[p,h]=I.useState(null),[c,v]=I.useState(null),[b,k]=Nn("private-registry-list","cards"),S=I.useRef(null),y=Ls({search:r,tags:o,categories:a}),f=sr(),{registryLLMConnectionId:M,registryLLMModelId:g}=qt(Ke),{createMutation:w,updateMutation:R,deleteMutation:E,bulkCreateMutation:C}=Xt(),T=y.data?.pages.flatMap(j=>j.items??[]).filter(Boolean)??[],N=y.data?.pages[0]?.totalCount??T.length,A=o.length>0||a.length>0||r.length>0,L=f.data,P=Array.isArray(L?.tags)?L.tags:[],D=Array.isArray(L?.categories)?L.categories:[],$=j=>{S.current&&(S.current.disconnect(),S.current=null),!(!j||!y.hasNextPage||y.isFetchingNextPage)&&(S.current=new IntersectionObserver(U=>{U[0]?.isIntersecting&&y.hasNextPage&&!y.isFetchingNextPage&&y.fetchNextPage()},{rootMargin:"240px 0px"}),S.current.observe(j))},z=async j=>{try{"data"in j?(await R.mutateAsync(j),H.success("Registry item updated")):(await w.mutateAsync(j),H.success("Registry item created"))}catch(U){throw H.error(U instanceof Error?U.message:"Failed to save item"),U}},O=async j=>{const U=j._meta?.["mcp.mesh"]?.verified===!0;try{await R.mutateAsync({id:j.id,data:{_meta:{...j._meta,"mcp.mesh":{...j._meta?.["mcp.mesh"],verified:!U}}}}),H.success(U?"Removed verified status":"Marked as verified")}catch(K){H.error(K instanceof Error?K.message:"Failed to update item")}},B=async j=>{const U=j._meta?.["mcp.mesh"]?.official===!0;try{await R.mutateAsync({id:j.id,data:{_meta:{...j._meta,"mcp.mesh":{...j._meta?.["mcp.mesh"],official:!U}}}}),H.success(U?"Removed official status":"Marked as official")}catch(K){H.error(K instanceof Error?K.message:"Failed to update item")}},Q=async()=>{if(c)try{await E.mutateAsync(c.id),H.success("Registry item deleted"),v(null)}catch(j){H.error(j instanceof Error?j.message:"Failed to delete item")}};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"shrink-0 border-b border-border",children:[t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t.jsx(F,{variant:"secondary",className:"text-xs",children:N})]}),t.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsxs(G,{variant:"outline",size:"sm",className:ee("h-8","gap-1.5"),children:[t.jsx(wn,{size:14}),"Filters"]})}),t.jsxs(Mt,{align:"end",className:"w-[260px]",children:[t.jsx(rs,{children:"Tags"}),P.length>0?P.map(j=>t.jsxs(is,{checked:o.includes(j.value),onCheckedChange:()=>l(U=>hs(U,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ee,{disabled:!0,children:"No tags available"}),t.jsx(bn,{}),t.jsx(rs,{children:"Categories"}),D.length>0?D.map(j=>t.jsxs(is,{checked:a.includes(j.value),onCheckedChange:()=>i(U=>hs(U,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ee,{disabled:!0,children:"No categories available"})]})]}),t.jsxs(yn,{type:"single",value:b,onValueChange:j=>{(j==="cards"||j==="table")&&k(j)},variant:"outline",className:"h-8",children:[t.jsx(ls,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),t.jsx(ls,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"})]}),t.jsx(G,{variant:"outline",size:"sm",className:"h-8",onClick:()=>x(!0),children:"Import CSV"}),t.jsx(G,{size:"sm",className:"h-8",onClick:()=>m(!0),children:"Add MCP Servers"})]})]}),t.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:t.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[t.jsx(ws,{size:16,className:"text-muted-foreground shrink-0"}),t.jsx(xe,{value:e,onChange:j=>n(j.target.value),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"})]})}),A&&t.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[o.map(j=>t.jsxs(F,{variant:"default",children:["#",j]},`selected-tag-${j}`)),a.map(j=>t.jsx(F,{variant:"outline",children:j},`selected-category-${j}`)),e.trim()&&t.jsxs(F,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),t.jsx(G,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{n(""),l([]),i([])},children:"Clear filters"})]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[T.length===0?t.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:y.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(et,{className:"size-5 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-base font-medium",children:A?"No items found":"No MCPs in your registry"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:A?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!A&&t.jsx(G,{size:"lg",onClick:()=>m(!0),children:"Add MCP Servers"})]})}):b==="cards"?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:T.map(j=>t.jsx(_r,{item:j,onEdit:h,onDelete:v,onToggleVerified:O,onToggleOfficial:B},j.id))}),y.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"border rounded-lg overflow-auto",children:t.jsxs(vs,{children:[t.jsx(bs,{children:t.jsxs(Pt,{children:[t.jsx(Ie,{className:"w-[56px]",children:"Icon"}),t.jsx(Ie,{children:"Title"}),t.jsx(Ie,{children:"ID"}),t.jsx(Ie,{children:"Tags"}),t.jsx(Ie,{children:"Categories"}),t.jsx(Ie,{children:"Remote URL"}),t.jsx(Ie,{children:"Visibility"}),t.jsx(Ie,{className:"text-right w-[68px]",children:"Actions"})]})}),t.jsx(ys,{children:T.map(j=>t.jsxs(Pt,{children:[t.jsx(Me,{children:t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:j.server?.icons?.[0]?.src?t.jsx("img",{src:j.server.icons[0].src,alt:j.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:j.title.charAt(0).toUpperCase()})})}),t.jsx(Me,{children:j.title}),t.jsx(Me,{className:"font-mono",children:j.id}),t.jsx(Me,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:Ur(j).slice(0,3).map(U=>t.jsx(F,{variant:"outline",children:U},`${j.id}-tag-${U}`))})}),t.jsx(Me,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:qr(j).slice(0,3).map(U=>t.jsx(F,{variant:"outline",children:U},`${j.id}-category-${U}`))})}),t.jsx(Me,{children:Fr(j)}),t.jsx(Me,{children:j.is_public?t.jsxs(F,{variant:"default",className:"gap-1",children:[t.jsx(Ns,{size:10}),"Public"]}):t.jsx(F,{variant:"secondary",children:"Private"})}),t.jsx(Me,{className:"text-right",children:t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(Ht,{size:18})})}),t.jsxs(Mt,{align:"end",children:[t.jsx(Ee,{onClick:()=>h(j),children:"Edit"}),t.jsx(Ee,{variant:"destructive",onClick:()=>v(j),children:"Delete"})]})]})})]},j.id))})]})}),y.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}),y.isFetchingNextPage&&t.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(et,{className:"size-4 animate-spin"}),"Loading more items..."]})]}),t.jsx(zr,{open:d||!!p,onOpenChange:j=>{j||(m(!1),h(null))},item:p,availableTags:P.map(j=>j.value),availableCategories:D.map(j=>j.value),defaultLLMConnectionId:M,defaultLLMModelId:g,isSubmitting:w.isPending||R.isPending,onSubmit:z},p?.id??"create"),t.jsx(pr,{open:u,onOpenChange:x,isImporting:C.isPending,onImport:async j=>{try{const U=await C.mutateAsync(j);return H.success(`Imported ${U.created} item(s)`),U}catch(U){throw H.error(U instanceof Error?U.message:"Failed to import CSV"),U}}}),t.jsx(br,{open:!!c,onOpenChange:j=>{j||v(null)},title:c?.title??c?.id??"",isDeleting:E.isPending,onConfirm:Q})]})}function Gr(s,e,n=!1){const r=I.useRef(null),o=I.useRef(s),l=I.useRef(e),a=I.useRef(n);return o.current=s,l.current=e,a.current=n,d=>{r.current&&r.current.disconnect(),r.current=new IntersectionObserver(m=>{m[0]?.isIntersecting&&l.current&&!a.current&&o.current()}),d&&r.current.observe(d)}}const Qr=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function ps(s){const e=new Date(s);return Number.isNaN(e.getTime())?s:e.toLocaleDateString()}function fs(s){return{id:s.requested_id??s.server?.name,title:s.title,description:s.description??"",_meta:s._meta,server:s.server,is_public:!1}}function Yt(s){const e=s.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ut(s){const e=s._meta?.["mcp.mesh"];return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Vr(){const[s,e]=I.useState("pending"),[n,r]=I.useState("created_at"),[o,l]=I.useState("asc"),[a,i]=I.useState(new Set),[d,m]=I.useState(!1),[u,x]=I.useState("private"),[p,h]=I.useState(!1),[c,v]=I.useState(null),[b,k]=I.useState(null),[S,y]=I.useState(null),[f,M]=I.useState(null),[g,w]=I.useState(""),R=nr({status:s,sortBy:n,sortDirection:o}),{reviewMutation:E,deleteMutation:C}=ar(),{createMutation:T}=Xt(),N=R.data?.pages.flatMap(_=>_.items)??[],A=R.data?.pages[0]?.totalCount??0,L=R.isFetchingNextPage,P=!!R.hasNextPage,D=Gr(()=>{R.isFetchingNextPage||R.fetchNextPage()},P,L),$=new Set(N.filter(_=>_.status==="pending").map(_=>_.id)),z=N.filter(_=>$.has(_.id)),O=a.size,B=z.filter(_=>a.has(_.id)),Q=N.filter(_=>a.has(_.id)).length,j=z.length>0&&z.every(_=>a.has(_.id)),U=()=>i(new Set),K=(_,J)=>{i(Z=>{const ce=new Set(Z);return J?ce.add(_):ce.delete(_),ce})},te=_=>{i(J=>{const Z=new Set(J);return Z.has(_)?Z.delete(_):Z.add(_),Z})},se=()=>{i(_=>{const J=new Set(_);for(const Z of z)J.add(Z.id);return J})},le=async()=>{const _=b;if(_){k(null),v(_.id);try{await E.mutateAsync({id:_.id,status:"approved",reviewerNotes:void 0});const J=fs(_);await T.mutateAsync({id:J.id,title:J.title,description:J.description,_meta:J._meta,server:J.server,is_public:J.is_public}),H.success("Request approved and added to registry")}catch(J){const Z=J instanceof Error?J.message:"Failed to approve request";Z.includes("UNIQUE constraint")||Z.includes("already exists")?H.error("An item with this ID already exists in the registry. Delete or rename it first."):H.error(Z)}finally{v(null)}}},ae=async()=>{if(S)try{await E.mutateAsync({id:S.id,status:"rejected",reviewerNotes:g.trim()||void 0}),H.success("Request rejected"),y(null),w("")}catch(_){H.error(_ instanceof Error?_.message:"Failed to reject request")}},me=async _=>{try{await C.mutateAsync(_.id),H.success("Request deleted")}catch(J){H.error(J instanceof Error?J.message:"Failed to delete request")}},ue=async()=>{if(B.length===0||p)return;h(!0),m(!1);let _=0;const J=new Set;for(const ce of B)try{await E.mutateAsync({id:ce.id,status:"approved",reviewerNotes:void 0});const fe=fs(ce);await T.mutateAsync({id:fe.id,title:fe.title,description:fe.description,_meta:fe._meta,server:fe.server,is_public:u==="public"}),_++}catch{J.add(ce.id)}const Z=J.size;_>0&&Z===0?H.success(`${_} request${_>1?"s":""} approved as ${u}.`):_>0&&Z>0?H.warning(`Approved ${_}. Failed ${Z}. Failed items remain selected for retry.`):H.error("Bulk approve failed. Selected items were kept for retry."),i(J),h(!1)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"shrink-0 border-b border-border",children:t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),t.jsx(F,{variant:"secondary",className:"text-xs",children:A})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:Qr.map(_=>t.jsx("button",{type:"button",className:ee("px-2.5 py-1 text-xs rounded-md transition-colors",s===_.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(_.value),onClickCapture:()=>U(),children:_.label},_.value))}),t.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${n}:${o}`,onChange:_=>{const[J,Z]=_.target.value.split(":");r(J),l(Z)},children:[t.jsx("option",{value:"created_at:asc",children:"Created at (oldest first)"}),t.jsx("option",{value:"created_at:desc",children:"Created at (newest first)"}),t.jsx("option",{value:"title:asc",children:"Alphabetical (A-Z)"}),t.jsx("option",{value:"title:desc",children:"Alphabetical (Z-A)"})]})]})]})}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[R.isLoading?t.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):R.isError?t.jsxs(oe,{className:"p-8 text-center",children:[t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load publish requests."}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:R.error instanceof Error?R.error.message:"Unknown error"})]}):N.length===0?t.jsx(oe,{className:"p-8 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:s==="pending"?"No pending publish requests.":s==="approved"?"No approved publish requests.":"No rejected publish requests."})}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:N.map(_=>{const J=Yt(_),Z=ut(_),ce=_._meta?.["mcp.mesh"]?.tags??[],fe=_._meta?.["mcp.mesh"]?.categories??[],ke=Z.hasReadmeContent||Z.hasReadmeLink||ce.length>0||fe.length>0,ye=[_.requester_name,_.requester_email].filter(Boolean).join(" · ");return t.jsxs(oe,{className:ee("p-3 grid gap-1.5",$.has(_.id)&&"cursor-pointer hover:bg-muted/30",a.has(_.id)&&"bg-accent/20"),onClick:()=>{$.has(_.id)&&te(_.id)},children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[$.has(_.id)&&t.jsx(Pn,{checked:a.has(_.id),className:"mt-0.5",onCheckedChange:ie=>K(_.id,ie===!0),onClick:ie=>ie.stopPropagation()}),t.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:J?t.jsx("img",{src:J,alt:_.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:_.title.slice(0,1).toUpperCase()})}),t.jsx("p",{className:"text-sm font-medium truncate",children:_.title})]}),t.jsx(F,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:_.status})]}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:_.description}),ke&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[Z.hasReadmeContent&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"README"}),Z.hasReadmeLink&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"README link"}),ce.slice(0,2).map(ie=>t.jsx(F,{variant:"secondary",className:"text-[10px]",children:ie},`${_.id}-tag-${ie}`)),fe.slice(0,1).map(ie=>t.jsx(F,{variant:"secondary",className:"text-[10px]",children:ie},`${_.id}-category-${ie}`))]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[ye&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate",children:ye}),t.jsx("span",{children:"·"})]}),t.jsx("span",{className:"shrink-0",children:ps(_.created_at)})]}),t.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[t.jsxs(G,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),M(_)},children:[t.jsx(Ts,{size:13}),"View"]}),$.has(_.id)?t.jsxs(t.Fragment,{children:[t.jsxs(G,{size:"sm",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),k(_)},disabled:c!==null||p||a.has(_.id),children:[t.jsx(it,{size:13}),c===_.id?"Approving...":a.has(_.id)?"Selected":"Approve"]}),t.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),y(_),w("")},disabled:E.isPending,children:[t.jsx(Sn,{size:13}),"Reject"]})]}):t.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),me(_)},disabled:C.isPending,children:[t.jsx(wt,{size:13}),"Delete"]})]})]},_.id)})}),N.length>0&&P?t.jsx("div",{ref:D,className:"h-1 w-full"}):null,L&&N.length>0?t.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:"Loading more requests..."}):null]}),O>0?t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[t.jsxs("div",{className:"text-xs text-muted-foreground pr-1",children:[O," selected"]}),t.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:se,disabled:j,children:"Select all"}),t.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:U,children:"Clear selection"}),t.jsxs(G,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>m(!0),disabled:p,children:[t.jsx(it,{size:13}),"Approve selected"]})]})}):null,t.jsx(Ot,{open:!!f,onOpenChange:_=>{_||M(null)},children:t.jsxs(Lt,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[t.jsxs(Et,{children:[t.jsx(Dt,{children:f?.title??"Request details"}),t.jsx($t,{children:"Review all metadata sent by the requester before approving."})]}),f&&t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[t.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Yt(f)?t.jsx("img",{src:Yt(f)||"",alt:f.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:f.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:f.title}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.server?.name||f.id})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),t.jsx("span",{className:"capitalize",children:f.status})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),t.jsx("span",{children:ps(f.created_at)})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Requester"}),t.jsx("span",{children:f.requester_name||"-"})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Email"}),t.jsx("span",{children:f.requester_email||"-"})]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Remote URL"}),t.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:f.server?.remotes?.[0]?.url??"-"})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Description"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f.description||"No description provided."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(f._meta?.["mcp.mesh"]?.tags??[]).length?(f._meta?.["mcp.mesh"]?.tags??[]).map(_=>t.jsx(F,{variant:"secondary",children:_},`${f.id}-detail-tag-${_}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(f._meta?.["mcp.mesh"]?.categories??[]).length?(f._meta?.["mcp.mesh"]?.categories??[]).map(_=>t.jsx(F,{variant:"secondary",children:_},`${f.id}-detail-category-${_}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"README"}),ut(f).hasReadmeContent?t.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:ut(f).readmeContent}):ut(f).hasReadmeLink?t.jsxs("a",{href:ut(f).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:["Open README link",t.jsx(En,{size:14})]}):t.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),t.jsx(At,{children:t.jsx(G,{variant:"outline",onClick:()=>M(null),children:"Close"})})]})}),t.jsx(yt,{open:!!b,onOpenChange:_=>{_||k(null)},children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Approve publish request?"}),t.jsxs(ft,{children:["This will add"," ",t.jsx("span",{className:"font-medium text-foreground",children:b?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:le,children:"Approve"})]})]})}),t.jsx(yt,{open:d,onOpenChange:m,children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Approve selected requests?"}),t.jsxs(ft,{children:["This will approve ",B.length," request",B.length>1?"s":""," and create all resulting apps with the same visibility setting."]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"bulk-visibility",children:"Visibility for all selected"}),t.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:u,onChange:_=>x(_.target.value),children:[t.jsx("option",{value:"private",children:"Private"}),t.jsx("option",{value:"public",children:"Public"})]})]}),t.jsxs(vt,{children:[t.jsx(gt,{disabled:p,children:"Cancel"}),t.jsx(jt,{onClick:ue,disabled:p||Q===0,children:p?"Approving...":"Approve selected"})]})]})}),t.jsx(Ot,{open:!!S,onOpenChange:_=>{_||(y(null),w(""))},children:t.jsxs(Lt,{children:[t.jsxs(Et,{children:[t.jsx(Dt,{children:"Reject publish request?"}),t.jsx($t,{children:"This request will move to rejected status. You can leave optional notes for context."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),t.jsx(zt,{id:"reject-notes",rows:4,value:g,onChange:_=>w(_.target.value),placeholder:"Reason for rejection..."})]}),t.jsxs(At,{children:[t.jsx(G,{variant:"outline",onClick:()=>{y(null),w("")},children:"Cancel"}),t.jsx(G,{onClick:ae,disabled:E.isPending,children:E.isPending?"Rejecting...":"Reject"})]})]})})]})}function Fs(s){const e=X.c(104),{connectionId:n,modelId:r,connections:o,models:l,onConnectionChange:a,onModelChange:i,connectionLabel:d,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:x,className:p}=s,h=d===void 0?"LLM Connection":d,c=m===void 0?"Model":m,v=u===void 0?"Select LLM connection":u,b=x===void 0?"Select model":x,[k,S]=I.useState(!1),[y,f]=I.useState("");let M;if(e[0]!==r||e[1]!==l){let ne;e[3]!==r?(ne=je=>je.id===r,e[3]=r,e[4]=ne):ne=e[4],M=l.find(ne),e[0]=r,e[1]=l,e[2]=M}else M=e[2];const g=M;let w;if(e[5]!==l||e[6]!==y){const ne=y.trim().toLowerCase();w=ne?l.filter(je=>je.title.toLowerCase().includes(ne)||je.id.toLowerCase().includes(ne)):l,e[5]=l,e[6]=y,e[7]=w}else w=e[7];const R=w;let E,C,T,N,A,L,P,D,$,z,O,B,Q,j,U,K,te,se,le,ae,me,ue;if(e[8]!==p||e[9]!==n||e[10]!==h||e[11]!==v||e[12]!==o||e[13]!==c||e[14]!==b||e[15]!==a||e[16]!==k||e[17]!==y||e[18]!==g?.title){let ne;e[41]!==n?(ne=Be=>Be.id===n,e[41]=n,e[42]=ne):ne=e[42];const je=o.find(ne);A=Yr,e[43]!==p?(se=ee("grid gap-1.5",p),e[43]=p,e[44]=se):se=e[44],e[45]!==c?(le=t.jsx(re,{children:c}),e[45]=c,e[46]=le):le=e[46],N=Dn,U=k,K=S;const Ne=g?.title||b;let be;e[47]!==Ne?(be=t.jsx("span",{className:"truncate text-left",children:Ne}),e[47]=Ne,e[48]=be):be=e[48];let Oe;e[49]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx(Rs,{className:"size-4 shrink-0 opacity-60"}),e[49]=Oe):Oe=e[49],e[50]!==c||e[51]!==be?(te=t.jsx($n,{asChild:!0,children:t.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":c,children:[be,Oe]})}),e[50]=c,e[51]=be,e[52]=te):te=e[52],T=An,B="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",Q="start",j=8,z="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Ae;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ae=t.jsx(ws,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Ae):Ae=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=Be=>f(Be.target.value),e[54]=Se):Se=e[54],e[55]!==y?(O=t.jsxs("div",{className:"relative flex-1 min-w-0",children:[Ae,t.jsx(xe,{value:y,onChange:Se,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=y,e[56]=O):O=e[56],$="w-auto shrink-0",C=Cs,P=n,D=a,E=_s,ae="llm-connection-select",me="h-9 min-w-[160px] max-w-[220px]",ue=h,L=je?t.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:je.icon?t.jsx("img",{src:je.icon,alt:je.title,className:"w-full h-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:je.title.slice(0,1).toUpperCase()})}),t.jsx("span",{className:"truncate",children:je.title})]}):t.jsx(ks,{placeholder:v}),e[8]=p,e[9]=n,e[10]=h,e[11]=v,e[12]=o,e[13]=c,e[14]=b,e[15]=a,e[16]=k,e[17]=y,e[18]=g?.title,e[19]=E,e[20]=C,e[21]=T,e[22]=N,e[23]=A,e[24]=L,e[25]=P,e[26]=D,e[27]=$,e[28]=z,e[29]=O,e[30]=B,e[31]=Q,e[32]=j,e[33]=U,e[34]=K,e[35]=te,e[36]=se,e[37]=le,e[38]=ae,e[39]=me,e[40]=ue}else E=e[19],C=e[20],T=e[21],N=e[22],A=e[23],L=e[24],P=e[25],D=e[26],$=e[27],z=e[28],O=e[29],B=e[30],Q=e[31],j=e[32],U=e[33],K=e[34],te=e[35],se=e[36],le=e[37],ae=e[38],me=e[39],ue=e[40];let _;e[57]!==E||e[58]!==L||e[59]!==ae||e[60]!==me||e[61]!==ue?(_=t.jsx(E,{id:ae,className:me,"aria-label":ue,children:L}),e[57]=E,e[58]=L,e[59]=ae,e[60]=me,e[61]=ue,e[62]=_):_=e[62];let J;e[63]!==o?(J=o.map(Kr),e[63]=o,e[64]=J):J=e[64];let Z;e[65]!==J?(Z=t.jsx(Ss,{children:J}),e[65]=J,e[66]=Z):Z=e[66];let ce;e[67]!==C||e[68]!==P||e[69]!==D||e[70]!==_||e[71]!==Z?(ce=t.jsxs(C,{value:P,onValueChange:D,children:[_,Z]}),e[67]=C,e[68]=P,e[69]=D,e[70]=_,e[71]=Z,e[72]=ce):ce=e[72];let fe;e[73]!==$||e[74]!==ce?(fe=t.jsx("div",{className:$,children:ce}),e[73]=$,e[74]=ce,e[75]=fe):fe=e[75];let ke;e[76]!==z||e[77]!==O||e[78]!==fe?(ke=t.jsxs("div",{className:z,children:[O,fe]}),e[76]=z,e[77]=O,e[78]=fe,e[79]=ke):ke=e[79];let ye;e[80]!==R||e[81]!==A||e[82]!==r||e[83]!==i?(ye=R.length===0?t.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):R.map(ne=>{const je=ne.id===r,Ne=A(ne.capabilities);return t.jsxs("button",{type:"button",className:ee("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",je?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{i(ne.id),S(!1)},children:[t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/40 overflow-hidden shrink-0 flex items-center justify-center",children:ne.logo?t.jsx("img",{src:ne.logo,alt:ne.title,className:"w-full h-full object-contain"}):t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(ne.title||ne.id).slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate",children:ne.title}),ne.title!==ne.id&&t.jsx("div",{className:"text-xs text-muted-foreground truncate",children:ne.id})]}),Ne.length>0&&t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:Ne.map(be=>t.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:be},`${ne.id}-${be}`))})]},ne.id)}),e[80]=R,e[81]=A,e[82]=r,e[83]=i,e[84]=ye):ye=e[84];let ie;e[85]!==ye?(ie=t.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:ye}),e[85]=ye,e[86]=ie):ie=e[86];let De;e[87]!==T||e[88]!==B||e[89]!==Q||e[90]!==j||e[91]!==ke||e[92]!==ie?(De=t.jsxs(T,{className:B,align:Q,sideOffset:j,children:[ke,ie]}),e[87]=T,e[88]=B,e[89]=Q,e[90]=j,e[91]=ke,e[92]=ie,e[93]=De):De=e[93];let Te;e[94]!==N||e[95]!==U||e[96]!==K||e[97]!==te||e[98]!==De?(Te=t.jsxs(N,{open:U,onOpenChange:K,children:[te,De]}),e[94]=N,e[95]=U,e[96]=K,e[97]=te,e[98]=De,e[99]=Te):Te=e[99];let $e;return e[100]!==se||e[101]!==le||e[102]!==Te?($e=t.jsxs("div",{className:se,children:[le,Te]}),e[100]=se,e[101]=le,e[102]=Te,e[103]=$e):$e=e[103],$e}function Kr(s){return t.jsx(Rt,{value:s.id,children:t.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:s.icon?t.jsx("img",{src:s.icon,alt:s.title,className:"w-full h-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:s.title.slice(0,1).toUpperCase()})}),t.jsx("span",{className:"truncate",children:s.title})]})},s.id)}function Yr(s){const e=new Set((s??[]).map(Hr)),n=[];return e.has("text")&&n.push("Text"),e.has("vision")&&n.push("Vision"),e.has("tools")&&n.push("Tools"),n}function Hr(s){return s.toLowerCase()}function Wr({initialName:s,initialIcon:e,initialLLMConnectionId:n,initialLLMModelId:r,initialAcceptPublishRequests:o,initialRequireApiToken:l,initialStorePrivateOnly:a,initialRateLimitEnabled:i,initialRateLimitWindow:d,initialRateLimitMax:m,revealedKey:u,onRevealedKeyChange:x}){const{org:p}=de(),{uploadImage:h,isUploading:c}=Us(),{saveRegistryConfigMutation:v}=qt(Ke),[b,k]=I.useState(s),[S,y]=I.useState(e),[f,M]=I.useState(n),[g,w]=I.useState(r),[R,E]=I.useState(o),[C,T]=I.useState(l),[N,A]=I.useState(a),[L,P]=I.useState(i),[D,$]=I.useState(d),[z,O]=I.useState(String(m)),B=or(),{generateMutation:Q,revokeMutation:j}=cr(),[U,K]=I.useState(""),[te,se]=I.useState(!1),[le,ae]=I.useState(null),{handleCopy:me,copied:ue}=Qt(),{handleCopy:_,copied:J}=Qt(),{handleCopy:Z,copied:ce}=Qt(),fe=Ls({search:"",tags:[],categories:[],limit:50}),ye=(Ms()??[]).filter(V=>(V.tools??[]).some(ge=>ge.name==="LLM_DO_GENERATE")),ie=f||n||ye[0]?.id||"",De=gs({connectionId:ie||void 0,orgId:p.id}),Te=Is(ie||"no-llm-connection","LLM",De),$e=`${window.location.origin}/org/${p.slug}/registry/mcp`,je=(fe.data?.pages.flatMap(V=>V.items??[])??[]).filter(V=>V.is_public).length,Ne=`${window.location.origin}/org/${p.slug}/registry/publish-request`,be=u?.slice(0,12)??null,Oe=!!(be&&(B.data?.items??[]).some(V=>V.prefix===be)),Ae=b.trim()!==s.trim()||S.trim()!==e.trim()||f.trim()!==n.trim()||g.trim()!==r.trim()||R!==o||C!==l||N!==a||L!==i||D!==d||(Number.parseInt(z,10)||100)!==m,Se=v.isPending,Be=async V=>{if(!V)return;const ge=V.name.split(".").pop()||"png",st=`registry/${p.id}/identity/icon.${ge}`,Ge=await h(V,st);Ge?y(Ge):H.error("Failed to upload icon. Please try again.")},He=async()=>{const V=b.trim();if(!V)return;const ge=g.trim(),st=ge?f.trim()||ie||"":f.trim(),Ge=Number.parseInt(z,10),_t=Number.isFinite(Ge)&&Ge>=1?Ge:100;try{await v.mutateAsync({registryName:V,registryIcon:S.trim(),llmConnectionId:st,llmModelId:ge,acceptPublishRequests:R,requireApiToken:C,storePrivateOnly:N,rateLimitEnabled:L,rateLimitWindow:D,rateLimitMax:_t}),H.success("Registry settings updated")}catch(at){H.error(at instanceof Error?at.message:"Failed to save registry settings")}},lt=()=>{k(s),y(e),M(n),w(r),E(o),T(l),A(a),P(i),$(d),O(String(m))},we=async()=>{const V=U.trim();if(V)try{const ge=await Q.mutateAsync(V);ge?.key&&(x(ge.key),se(!1),K(""),H.success("API key generated. Copy it now — it won't be shown again!"))}catch(ge){H.error(ge instanceof Error?ge.message:"Failed to generate API key")}},tt=async V=>{try{await j.mutateAsync(V),x(null),ae(null),H.success("API key revoked")}catch(ge){H.error(ge instanceof Error?ge.message:"Failed to revoke API key")}};return t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[t.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4 min-h-[32px]",children:[Ae&&t.jsxs(G,{variant:"outline",size:"sm",onClick:lt,disabled:Se,children:[t.jsx(On,{size:14}),"Undo"]}),t.jsxs(G,{variant:"default",size:"sm",onClick:He,disabled:Se||!Ae,children:[Se?t.jsx(et,{size:14,className:"animate-spin"}):t.jsx(zn,{size:14}),"Save"]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(oe,{className:"min-w-0 p-4 grid gap-4 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Registry Identity"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the name and icon shown in the store selector."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"identity-name",children:"Name"}),t.jsx(xe,{id:"identity-name",value:b,onChange:V=>k(V.target.value),placeholder:"Private Registry"})]}),t.jsx(Os,{value:S,onChange:y,onFileUpload:Be,isUploading:c})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"AI Configuration"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the default model used for AI suggestions."})]}),t.jsx(Fs,{connectionId:ie,modelId:g,connections:ye.map(V=>({id:V.id,title:V.title,icon:V.icon??null})),models:Te.map(V=>({id:V.id,title:V.title||V.id,logo:V.logo??null,capabilities:V.capabilities??[]})),onConnectionChange:V=>{M(V),w("")},onModelChange:w})]})]}),t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Public Registry"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Public URL to consume this registry as an MCP."})]}),t.jsxs(F,{variant:"secondary",children:[je," ",je===1?"public item":"public items"]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:$e}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>me($e),children:ue?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Store Visibility"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what appears when users browse this registry in Store."})]}),t.jsx(Xe,{id:"store-private-only",checked:N,onCheckedChange:A})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Enabled: show only private apps. Disabled: show public and private apps together."}),N!==a&&t.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Publish Requests"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow external users to submit MCP servers for review."})]}),t.jsx(Xe,{id:"accept-publish-requests",checked:R,onCheckedChange:E})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:Ne}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>_(Ne),children:J?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(re,{className:"text-sm font-medium",children:"Require API Token"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Requests without a valid token will be rejected."})]}),t.jsx(Xe,{id:"require-api-token",checked:C,onCheckedChange:T})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(re,{className:"text-sm font-medium",children:"Rate Limit"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Limit publish requests per organization by time window."})]}),t.jsx(Xe,{id:"publish-rate-limit",checked:L,onCheckedChange:P})]}),L&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:"Max requests"}),t.jsx(xe,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:z,onChange:V=>O(V.target.value),placeholder:"100"})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:"Window"}),t.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:D,onChange:V=>$(V.target.value),children:[t.jsx("option",{value:"minute",children:"Per minute"}),t.jsx("option",{value:"hour",children:"Per hour"})]})]})]}),(R!==o||C!==l||L!==i||D!==d||(Number.parseInt(z,10)||100)!==m)&&t.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),R&&C&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[t.jsx(Un,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),u&&!Oe&&t.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"New key (refreshing list...)"}),t.jsx(xe,{readOnly:!0,value:u,className:"h-8 text-xs font-mono bg-background"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs("div",{className:"grid gap-1.5 flex-1",children:[t.jsx(re,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),t.jsx(xe,{id:"api-key-name",value:U,onChange:V=>K(V.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),t.jsxs(G,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!U.trim()||Q.isPending,onClick:we,children:[Q.isPending?t.jsx(et,{size:14,className:"animate-spin"}):t.jsx(qn,{size:14}),"Generate"]})]}),(B.data?.items?.length??0)>0&&t.jsx("div",{className:"grid gap-2",children:B.data?.items?.map(V=>t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[t.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium truncate leading-none",children:V.name}),be===V.prefix?t.jsx(xe,{readOnly:!0,value:te?u??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):t.jsx(xe,{readOnly:!0,value:`${V.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[be===V.prefix&&t.jsxs(t.Fragment,{children:[t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>se(ge=>!ge),children:te?t.jsx(Ln,{size:14}):t.jsx(Ts,{size:14})}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!u,onClick:()=>u&&Z(u),children:ce?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:j.isPending,onClick:()=>ae({id:V.id,name:V.name}),children:t.jsx(wt,{size:14})})]})]},V.id))})]})]})]})]}),t.jsx(yt,{open:!!le,onOpenChange:V=>{!V&&!j.isPending&&ae(null)},children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Revoke API key?"}),t.jsxs(ft,{children:["This action cannot be undone. The key",le?` "${le.name}"`:""," will stop working immediately."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{disabled:j.isPending,children:"Cancel"}),t.jsx(jt,{disabled:!le||j.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>le&&tt(le.id),children:j.isPending?"Revoking...":"Revoke key"})]})]})})]})}function Jr(s){const e=X.c(5),{results:n}=s;if(n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(oe,{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(Zr),e[1]=n,e[2]=r):r=e[2];let o;return e[3]!==r?(o=t.jsx("div",{className:"space-y-2",children:r}),e[3]=r,e[4]=o):o=e[4],o}function Zr(s){return t.jsx(Xr,{result:s},s.id)}function Xr(s){const e=X.c(49),{result:n}=s,[r,o]=I.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(si);let i;e[11]!==r?(i=()=>o(!r),e[11]=r,e[12]=i):i=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{className:"text-red-500 text-sm mt-0.5",children:"✗"}),e[13]=d):d=e[13];let m;e[14]!==n.item_title?(m=t.jsx("h4",{className:"text-sm font-medium truncate",children:n.item_title}),e[14]=n.item_title,e[15]=m):m=e[15];let u;e[16]!==n.status?(u=n.status.replace("_"," "),e[16]=n.status,e[17]=u):u=e[17];let x;e[18]!==u?(x=t.jsx(F,{variant:"destructive",className:"capitalize text-[10px] shrink-0",children:u}),e[18]=u,e[19]=x):x=e[19];let p;e[20]!==m||e[21]!==x?(p=t.jsxs("div",{className:"flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=p):p=e[22];const h=n.connection_ok?"✓":"✗";let c;e[23]!==h?(c=t.jsxs("span",{children:["conn: ",h]}),e[23]=h,e[24]=c):c=e[24];const v=n.tools_listed?"✓":"✗";let b;e[25]!==v?(b=t.jsxs("span",{children:["tools listed: ",v]}),e[25]=v,e[26]=b):b=e[26];let k;e[27]!==n.duration_ms?(k=t.jsxs("span",{children:[n.duration_ms,"ms"]}),e[27]=n.duration_ms,e[28]=k):k=e[28];const S=a.length>0&&t.jsxs("span",{className:"text-red-600",children:[a.length," tool",a.length>1?"s":""," ","failed"]});let y;e[29]!==n.action_taken?(y=n.action_taken!=="none"&&t.jsx(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:n.action_taken.replace(/_/g," ")}),e[29]=n.action_taken,e[30]=y):y=e[30];let f;e[31]!==b||e[32]!==k||e[33]!==S||e[34]!==y||e[35]!==c?(f=t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[c,b,k,S,y]}),e[31]=b,e[32]=k,e[33]=S,e[34]=y,e[35]=c,e[36]=f):f=e[36];let M;e[37]!==n.error_message?(M=n.error_message&&t.jsx("p",{className:"text-xs text-red-600 line-clamp-2",children:n.error_message}),e[37]=n.error_message,e[38]=M):M=e[38];let g;e[39]!==f||e[40]!==M||e[41]!==p?(g=t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p,f,M]}),e[39]=f,e[40]=M,e[41]=p,e[42]=g):g=e[42];const w=r?"▲":"▼";let R;e[43]!==w?(R=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:w}),e[43]=w,e[44]=R):R=e[44];let E;e[45]!==g||e[46]!==R||e[47]!==i?(E=t.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:[d,g,R]}),e[45]=g,e[46]=R,e[47]=i,e[48]=E):E=e[48],l=t.jsxs(oe,{className:"overflow-hidden",children:[E,r&&t.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[n.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Full Error"}),t.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})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),t.jsx("p",{className:ee("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),t.jsx("p",{className:ee("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),t.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]})]}),a.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-red-600",children:["Failed Tools (",a.length,")"]}),a.map(C=>t.jsxs("div",{className:"rounded border border-red-500/10 bg-red-500/5 px-2.5 py-1.5 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono font-medium text-red-700",children:C.toolName}),t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[C.durationMs,"ms"]})]}),C.error&&t.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-red-600",children:C.error})]},`${n.id}-${C.toolName}`))]}),n.tool_results.length>0&&n.tool_results.some(ti)&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Passing Tools"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:n.tool_results.filter(ei).map(C=>t.jsxs(F,{variant:"secondary",className:"text-[10px]",children:["✓ ",C.toolName]},`${n.id}-${C.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 ei(s){return s.success}function ti(s){return s.success}function si(s){return!s.success}const ni=[{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 ri(s){const n=s.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,d=Number(r),m=Number(o),u=Number(l),x=Number(i);return Number.isInteger(d)&&Number.isInteger(m)&&d>=0&&d<=59&&m>=0&&m<=23?l==="*"&&i==="*"?{frequency:"daily",minute:d,hour:m,weekDay:1,dayOfMonth:1}:l==="*/14"&&i==="*"?{frequency:"biweekly",minute:d,hour:m,weekDay:1,dayOfMonth:1}:l==="*"&&Number.isInteger(x)&&x>=0&&x<=6?{frequency:"weekly",minute:d,hour:m,weekDay:x,dayOfMonth:1}:i==="*"&&Number.isInteger(u)&&u>=1&&u<=31?{frequency:"monthly",minute:d,hour:m,weekDay:1,dayOfMonth:u}:{frequency:"custom",minute:d,hour:m,weekDay:1,dayOfMonth:1}:{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1}}function ii(s,e){return`${String(s).padStart(2,"0")}:${String(e).padStart(2,"0")}`}function St(s){return s.frequency==="daily"?`${s.minute} ${s.hour} * * *`:s.frequency==="weekly"?`${s.minute} ${s.hour} * * ${s.weekDay}`:s.frequency==="biweekly"?`${s.minute} ${s.hour} */14 * *`:s.frequency==="monthly"?`${s.minute} ${s.hour} ${s.dayOfMonth} * *`:s.currentValue}function li(s){const e=X.c(60),{value:n,onChange:r,disabled:o}=s,l=o===void 0?!1:o;let a;e[0]!==n?(a=ri(n),e[0]=n,e[1]=a):a=e[1];const i=a,d=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=D=>{if(D==="custom"){r(n);return}r(St({frequency:D,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 u=m;let x;e[9]!==r||e[10]!==i.dayOfMonth||e[11]!==i.frequency||e[12]!==i.weekDay||e[13]!==n?(x=D=>{const[$,z]=D.split(":"),O=Number($),B=Number(z);!Number.isInteger(O)||!Number.isInteger(B)||r(St({frequency:i.frequency,hour:O,minute:B,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]=x):x=e[14];const p=x;let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(re,{children:"Frequency"}),e[15]=h):h=e[15];let c;e[16]!==u?(c=D=>u(D.target.value),e[16]=u,e[17]=c):c=e[17];let v,b,k,S,y;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("option",{value:"daily",children:"Daily"}),S=t.jsx("option",{value:"weekly",children:"Weekly"}),y=t.jsx("option",{value:"biweekly",children:"Every 2 weeks"}),v=t.jsx("option",{value:"monthly",children:"Monthly"}),b=t.jsx("option",{value:"custom",children:"Custom (raw cron)"}),e[18]=v,e[19]=b,e[20]=k,e[21]=S,e[22]=y):(v=e[18],b=e[19],k=e[20],S=e[21],y=e[22]);let f;e[23]!==l||e[24]!==i.frequency||e[25]!==c?(f=t.jsxs("label",{className:"space-y-1",children:[h,t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.frequency,onChange:c,disabled:l,children:[k,S,y,v,b]})]}),e[23]=l,e[24]=i.frequency,e[25]=c,e[26]=f):f=e[26];let M;e[27]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(re,{children:"Time"}),e[27]=M):M=e[27];let g;e[28]!==i.hour||e[29]!==i.minute?(g=ii(i.hour,i.minute),e[28]=i.hour,e[29]=i.minute,e[30]=g):g=e[30];let w;e[31]!==p?(w=D=>p(D.target.value),e[31]=p,e[32]=w):w=e[32];const R=l||d;let E;e[33]!==g||e[34]!==w||e[35]!==R?(E=t.jsxs("label",{className:"space-y-1",children:[M,t.jsx(xe,{type:"time",value:g,onChange:w,disabled:R})]}),e[33]=g,e[34]=w,e[35]=R,e[36]=E):E=e[36];let C;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?(C=i.frequency==="weekly"?t.jsxs("label",{className:"space-y-1",children:[t.jsx(re,{children:"Day of week"}),t.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.weekDay,onChange:D=>r(St({frequency:"weekly",hour:i.hour,minute:i.minute,weekDay:Number(D.target.value),dayOfMonth:i.dayOfMonth,currentValue:n})),disabled:l,children:ni.map(ai)})]}):i.frequency==="monthly"?t.jsxs("label",{className:"space-y-1",children:[t.jsx(re,{children:"Day of month"}),t.jsx(xe,{type:"number",min:1,max:31,value:i.dayOfMonth,onChange:D=>{const $=Number(D.target.value);!Number.isInteger($)||$<1||$>31||r(St({frequency:"monthly",hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:$,currentValue:n}))},disabled:l})]}):t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{children:"Schedule notes"}),t.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]=C):C=e[45];let T;e[46]!==f||e[47]!==E||e[48]!==C?(T=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[f,E,C]}),e[46]=f,e[47]=E,e[48]=C,e[49]=T):T=e[49];let N;e[50]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(re,{children:"Raw cron expression"}),e[50]=N):N=e[50];let A;e[51]!==r?(A=D=>r(D.target.value),e[51]=r,e[52]=A):A=e[52];let L;e[53]!==l||e[54]!==A||e[55]!==n?(L=t.jsxs("label",{className:"space-y-1 block",children:[N,t.jsx(xe,{value:n,onChange:A,disabled:l,placeholder:"*/15 * * * *"})]}),e[53]=l,e[54]=A,e[55]=n,e[56]=L):L=e[56];let P;return e[57]!==T||e[58]!==L?(P=t.jsxs("div",{className:"space-y-2",children:[T,L]}),e[57]=T,e[58]=L,e[59]=P):P=e[59],P}function ai(s){return t.jsx("option",{value:s.value,children:s.label},s.value)}function oi(s,e){return s.onFailure!==e.onFailure||s.llmConnectionId!==e.llmConnectionId||s.llmModelId!==e.llmModelId||s.perMcpTimeoutMs!==e.perMcpTimeoutMs||s.perToolTimeoutMs!==e.perToolTimeoutMs||s.maxAgentSteps!==e.maxAgentSteps||s.testPublicOnly!==e.testPublicOnly||s.testPrivateOnly!==e.testPrivateOnly||s.includePendingRequests!==e.includePendingRequests||(s.agentContext??"")!==(e.agentContext??"")||s.schedule!==e.schedule||s.cronExpression!==e.cronExpression}function ci(){const{registryLLMConnectionId:s,registryLLMModelId:e}=qt(Ke),{settings:n,saveMutation:r}=$s(),o=Jn(),l=Zn(),a=I.useRef(n),[i,d]=I.useState(n),[m,u]=I.useState(!1),[x,p]=I.useState(!1),{org:h}=de(),v=(Ms()??[]).filter(g=>(g.tools??[]).some(w=>w.name==="LLM_DO_GENERATE")),b=i.llmConnectionId||s||v[0]?.id||"",k=gs({connectionId:b||void 0,orgId:h.id}),S=Is(b||"no-llm-connection","LLM",k);a.current!==n&&(a.current=n,d(n));const y=oi(i,n),f=g=>{u(!1),d(w=>({...w,...g}))},M=async()=>{const g=i.cronExpression?.trim()??"";let w=n.scheduleEventId??"";if(i.schedule==="cron"&&g.length>0){const T=g!==(n.cronExpression??"");T&&w&&await l.mutateAsync(w),(T||!w)&&(w=(await o.mutateAsync({cronExpression:g,config:i})).scheduleEventId)}else w&&(await l.mutateAsync(w),w="");const R=(i.llmModelId??"").trim(),E=R?(i.llmConnectionId||b||"").trim():(i.llmConnectionId??"").trim(),C={...i,cronExpression:g,scheduleEventId:w,agentContext:(i.agentContext??"").trim(),llmConnectionId:E,llmModelId:R};await r.mutateAsync(C),d(C),u(!0),setTimeout(()=>u(!1),3e3)};return t.jsxs(oe,{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA Configuration"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure how the MCP QA agent validates registry entries."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[y&&t.jsx(F,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"Unsaved changes"}),m&&t.jsx(F,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 text-[10px]",children:"✓ Saved"}),t.jsx(G,{size:"sm",onClick:M,disabled:r.isPending||o.isPending||l.isPending||!y,children:r.isPending||o.isPending||l.isPending?"Saving...":"Save settings"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"On failure",hint:"Automatic action to apply when an MCP fails tests in a run."}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.onFailure,onChange:g=>f({onFailure:g.target.value}),children:[t.jsx("option",{value:"none",children:"Do nothing"}),t.jsx("option",{value:"unlisted",children:"Unlist from store (keep in registry)"}),t.jsx("option",{value:"remove_public",children:"Remove from public store"}),t.jsx("option",{value:"remove_private",children:"Remove from private registry"}),t.jsx("option",{value:"remove_all",children:"Remove from all (public + private)"})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Test scope",hint:"Choose whether tests should run for public items, private items, or both."}),t.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.testPublicOnly,onChange:g=>f({testPublicOnly:g.target.checked,testPrivateOnly:g.target.checked?!1:i.testPrivateOnly})}),"Public only"]}),t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.testPrivateOnly,onChange:g=>f({testPrivateOnly:g.target.checked,testPublicOnly:g.target.checked?!1:i.testPublicOnly})}),"Private only"]})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Publish requests",hint:"Include pending publish requests in QA runs to validate them before publishing to the store."}),t.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.includePendingRequests,onChange:g=>f({includePendingRequests:g.target.checked})}),"Include pending requests in tests"]})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsx(Ve,{label:"Model (LLM binding)",hint:"Used only in Agentic mode to decide and chain tool calls."}),t.jsx(Fs,{connectionId:b,modelId:i.llmModelId??"",connections:v.map(g=>({id:g.id,title:g.title,icon:g.icon??null})),models:S.map(g=>({id:g.id,title:g.title||g.id,logo:g.logo??null,capabilities:g.capabilities??[]})),onConnectionChange:g=>f({llmConnectionId:g,llmModelId:""}),onModelChange:g=>f({llmModelId:g})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx(Ve,{label:"Additional test context (prompt)",hint:"Extra runtime context passed to the agent, such as valid emails, tenant IDs, or known test entities."}),t.jsxs(G,{size:"sm",variant:"outline",className:"h-7",onClick:()=>p(g=>!g),children:[x?"Hide":"View"," default system prompt"]})]}),t.jsx(zt,{value:i.agentContext??"",onChange:g=>f({agentContext:g.target.value}),placeholder:'Example: Use "my-user@company.com" as a valid email for Google Drive share/create_permission tests.',rows:3}),t.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)."}),x&&t.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:pn})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsx(Ve,{label:"Schedule",hint:"Set automatic test runs. Manual mode runs only when you click Start QA run."}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.schedule??"manual",onChange:g=>f({schedule:g.target.value}),children:[t.jsx("option",{value:"manual",children:"Manual only"}),t.jsx("option",{value:"cron",children:"Cron schedule"})]}),(i.schedule??"manual")==="cron"&&t.jsx(li,{value:i.cronExpression??"",onChange:g=>f({cronExpression:g})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Per MCP timeout (ms)",hint:"Max total time allowed to validate one MCP."}),t.jsx(xe,{type:"number",value:i.perMcpTimeoutMs,onChange:g=>f({perMcpTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Per tool timeout (ms)",hint:"Max time allowed for each individual tool call."}),t.jsx(xe,{type:"number",value:i.perToolTimeoutMs,onChange:g=>f({perToolTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Max agent steps",hint:"Maximum number of reasoning/tool steps in Agentic mode."}),t.jsx(xe,{type:"number",value:i.maxAgentSteps,onChange:g=>f({maxAgentSteps:Number(g.target.value)}),min:1,max:30})]})]}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:["LLM fallback from Settings:"," ",t.jsxs("span",{className:"font-mono",children:[s||"-"," / ",e||"-"]})]})]})}function Ve(s){const e=X.c(13),{label:n,hint:r}=s;let o;e[0]!==n?(o=t.jsx(re,{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=t.jsx(Rn,{size:14}),e[2]=a):a=e[2];let i;e[3]!==l?(i=t.jsx(Fn,{asChild:!0,children:t.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 d;e[5]!==r?(d=t.jsx(Bn,{side:"top",className:"max-w-72",children:r}),e[5]=r,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==d?(m=t.jsxs(Gn,{children:[i,d]}),e[7]=i,e[8]=d,e[9]=m):m=e[9];let u;return e[10]!==o||e[11]!==m?(u=t.jsxs("div",{className:"flex items-center gap-1.5",children:[o,m]}),e[10]=o,e[11]=m,e[12]=u):u=e[12],u}function di(s){switch(s){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 mi(s){switch(s){case"authenticated":return"Authenticated";case"needs_auth":return"Needs Auth";default:return"Not checked"}}function ui({entry:s,onAuthChanged:e,failedToolsCount:n,failedResultCount:r}){const[o,l]=I.useState(!1),[a,i]=I.useState(""),[d,m]=I.useState(!1),u=Wn(),{updateMutation:x}=Xt(),p=s.mapping.connection_id,h=s.mapping.auth_status,c=s.item?.title??s.mapping.item_id,v=s.item?.server?.icons?.[0]?.src??null,b=s.item?.is_public??!1,k=s.item?.is_unlisted??!1,S=s.source==="request",y=Fe({queryKey:W.monitorConnectionAuthProbe(p),queryFn:async()=>gn({url:`/mcp/${p}`,token:null}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),f=y.data,M=y.isLoading,g=f?.supportsOAuth??!1,w=f?.hasOAuthToken??!1,R=f?.isServerError??!1,E=f?.isAuthenticated??!1,C=M?"checking":R?"server_error":g?E?w?"oauth_connected":"connected":"oauth_available":E?"connected":"token_required",T=()=>{u.mutate({connectionId:p,authStatus:"authenticated"},{onSuccess:()=>e()})},N=async()=>{l(!0);try{const z=(await y.refetch()).data;if(!z){H.error(`Could not reach "${c}". The remote MCP may be down.`);return}if(z.isAuthenticated){H.success(`"${c}" is reachable. You can re-authenticate if needed.`);return}if(z.isServerError){H.error(`Server error for "${c}". The remote MCP may be down.`);return}if(!z.supportsOAuth){H.warning(`"${c}" does not support OAuth. Use the Token field to paste an API key.`);return}H.info(`Opening authentication window for "${c}"...`);const O=await fn({connectionId:p,clientName:`MCP Test - ${c}`,timeout:18e4});if(O.error){H.error(`OAuth failed for "${c}": ${O.error}`);return}O.tokenInfo?(await fetch(`/api/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:O.tokenInfo.accessToken,refreshToken:O.tokenInfo.refreshToken,expiresIn:O.tokenInfo.expiresIn,scope:O.tokenInfo.scope,clientId:O.tokenInfo.clientId,clientSecret:O.tokenInfo.clientSecret,tokenEndpoint:O.tokenInfo.tokenEndpoint})})).ok||O.token&&await A(O.token):O.token&&await A(O.token),H.success(`"${c}" authenticated!`),T(),await y.refetch()}catch($){console.error("[MonitorConnectionsPanel] Auth error:",$),H.error(`Error: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},A=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:p,data:{connection_token:$}}}})})).ok)throw new Error("Failed to save token")},L=async()=>{if(!a.trim()){H.error("Token cannot be empty.");return}l(!0);try{await A(a),H.success(`Token saved for "${c}"!`),m(!1),i(""),T(),await y.refetch()}catch($){H.error(`Error saving token: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},P=h==="authenticated"&&!w&&!d&&a.length===0,D=async $=>{if(S){H.info("Visibility controls are available only for store items.");return}if(!s.item){H.error("Registry item not found for this connection.");return}try{await x.mutateAsync({id:s.item.id,data:$}),H.success("Visibility updated"),e()}catch(z){H.error(z instanceof Error?z.message:"Failed to update visibility")}};return t.jsxs(oe,{className:"p-3 space-y-3 h-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:v?t.jsx("img",{src:v,alt:c,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:c.charAt(0).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:c}),t.jsx("p",{className:"text-xs text-muted-foreground break-all",children:s.remoteUrl??"-"}),t.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[t.jsx(F,{variant:"outline",className:ee("text-[10px]",di(h)),children:mi(h)}),t.jsx(F,{variant:b?"default":"secondary",className:"text-[10px]",children:b?"Public":"Not public"}),t.jsx(F,{variant:"outline",className:"text-[10px]",children:S?"Request":"Store"}),t.jsxs(F,{variant:"outline",className:ee("text-[10px]",C==="server_error"?"border-destructive/40 text-destructive":C==="oauth_connected"?"border-emerald-500/30 text-emerald-600":C==="oauth_available"?"border-sky-500/30 text-sky-600":C==="token_required"?"border-amber-500/30 text-amber-600":"text-muted-foreground"),children:[C==="checking"&&"Checking auth...",C==="server_error"&&"Server error",C==="oauth_connected"&&"OAuth connected",C==="oauth_available"&&"OAuth available",C==="token_required"&&"Token/manual auth",C==="connected"&&"Connected"]}),k&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"Hidden in private"}),(r>0||n>0)&&t.jsxs(F,{variant:"destructive",className:"text-[10px]",children:[r," failed MCP / ",n," failed tools"]})]})]})]}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(Ht,{size:16})})}),t.jsx(Mt,{align:"end",children:S?t.jsx(Ee,{disabled:!0,children:"Request item (no store visibility controls)"}):t.jsxs(t.Fragment,{children:[t.jsx(Ee,{onClick:()=>D({is_public:!1}),children:"Hide from public store"}),t.jsx(Ee,{onClick:()=>D({is_unlisted:!0}),children:"Hide from private store"}),t.jsx(Ee,{onClick:()=>D({is_public:!0,is_unlisted:!1}),children:"Show in both stores"})]})})]})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[g&&t.jsx(G,{size:"sm",onClick:N,disabled:o,children:o?"...":w?"Re-auth OAuth":"OAuth"}),t.jsx(G,{size:"sm",variant:"outline",onClick:()=>y.refetch(),disabled:o||M,children:M?"Checking...":"Re-check"})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Token/API key (for MCPs that require manual auth)"}),P?t.jsxs("div",{className:"relative group",children:[t.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:"••••••••••••••••"}),t.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"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(xe,{type:"password",placeholder:"Paste API token / key...",value:a,onChange:$=>i($.target.value),className:"h-8 text-xs flex-1",onKeyDown:$=>{$.key==="Enter"&&L()}}),t.jsx(G,{size:"sm",className:"h-8 text-xs",onClick:L,disabled:o||!a.trim(),children:"Save"}),t.jsx(G,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{m(!1),i("")},children:"✕"})]})]})]})}function xi(){const s=X.c(55),e=Ds(),r=Ut("completed").data?.items?.[0],o=Ct(r?.id,void 0,r?.status),l=Hn(),[a,i]=I.useState("all");let d,m,u,x,p,h;if(s[0]!==e||s[1]!==o.data?.items||s[2]!==a||s[3]!==l){const b=e.data?.items??[];let k;s[10]!==o.data?.items?(k=(o.data?.items??[]).reduce(fi,{}),s[10]=o.data?.items,s[11]=k):k=s[11];const S=k;let y;s[12]!==a?(y=te=>a==="all"?!0:te.source===a,s[12]=a,s[13]=y):y=s[13];const f=b.filter(y);d=oe,p="p-4 space-y-3";let M,g,w,R;s[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("h3",{className:"text-sm font-semibold",children:"QA Connections"}),w=t.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."}),R=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Listing tools alone does not imply authenticated status."}),M=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Cards show MCP icon, auth status, and latest failed test counters."}),s[14]=M,s[15]=g,s[16]=w,s[17]=R):(M=s[14],g=s[15],w=s[16],R=s[17]);const E=a==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let C;s[18]!==E?(C=ee("px-2.5 py-1 text-xs rounded-md transition-colors",E),s[18]=E,s[19]=C):C=s[19];let T;s[20]===Symbol.for("react.memo_cache_sentinel")?(T=()=>i("all"),s[20]=T):T=s[20];let N;s[21]!==C?(N=t.jsx("button",{type:"button",className:C,onClick:T,children:"All"}),s[21]=C,s[22]=N):N=s[22];const A=a==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let L;s[23]!==A?(L=ee("px-2.5 py-1 text-xs rounded-md transition-colors",A),s[23]=A,s[24]=L):L=s[24];let P;s[25]===Symbol.for("react.memo_cache_sentinel")?(P=()=>i("store"),s[25]=P):P=s[25];let D;s[26]!==L?(D=t.jsx("button",{type:"button",className:L,onClick:P,children:"Store"}),s[26]=L,s[27]=D):D=s[27];const $=a==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let z;s[28]!==$?(z=ee("px-2.5 py-1 text-xs rounded-md transition-colors",$),s[28]=$,s[29]=z):z=s[29];let O;s[30]===Symbol.for("react.memo_cache_sentinel")?(O=()=>i("request"),s[30]=O):O=s[30];let B;s[31]!==z?(B=t.jsx("button",{type:"button",className:z,onClick:O,children:"Requests"}),s[31]=z,s[32]=B):B=s[32];let Q;s[33]!==N||s[34]!==D||s[35]!==B?(Q=t.jsxs("div",{children:[g,w,R,M,t.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[N,D,B]})]}),s[33]=N,s[34]=D,s[35]=B,s[36]=Q):Q=s[36];let j;s[37]!==l?(j=()=>{l.mutate(void 0,{onSuccess:pi,onError:hi})},s[37]=l,s[38]=j):j=s[38];const U=l.isPending?"Syncing...":"Sync";let K;s[39]!==l.isPending||s[40]!==j||s[41]!==U?(K=t.jsx(G,{size:"sm",variant:"outline",onClick:j,disabled:l.isPending,children:U}),s[39]=l.isPending,s[40]=j,s[41]=U,s[42]=K):K=s[42],s[43]!==Q||s[44]!==K?(h=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[Q,K]}),s[43]=Q,s[44]=K,s[45]=h):h=s[45],m="space-y-2",u=f.length===0&&t.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.'}),x=f.length>0&&t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:f.map(te=>{const se=S[te.mapping.item_id]??{failedTools:0,failedResults:0};return t.jsx(ui,{entry:te,onAuthChanged:()=>e.refetch(),failedToolsCount:se.failedTools,failedResultCount:se.failedResults},te.mapping.id)})}),s[0]=e,s[1]=o.data?.items,s[2]=a,s[3]=l,s[4]=d,s[5]=m,s[6]=u,s[7]=x,s[8]=p,s[9]=h}else d=s[4],m=s[5],u=s[6],x=s[7],p=s[8],h=s[9];let c;s[46]!==m||s[47]!==u||s[48]!==x?(c=t.jsxs("div",{className:m,children:[u,x]}),s[46]=m,s[47]=u,s[48]=x,s[49]=c):c=s[49];let v;return s[50]!==d||s[51]!==p||s[52]!==h||s[53]!==c?(v=t.jsxs(d,{className:p,children:[h,c]}),s[50]=d,s[51]=p,s[52]=h,s[53]=c,s[54]=v):v=s[54],v}function hi(s){return H.error(`Sync failed: ${s.message}`)}function pi(){return H.success("Connections synced (store + pending requests)")}function fi(s,e){const n=s[e.item_id]??{failedTools:0,failedResults:0},r=e.tool_results.filter(gi).length;return n.failedTools=n.failedTools+r,(e.status==="failed"||e.status==="error")&&(n.failedResults=n.failedResults+1),s[e.item_id]=n,s}function gi(s){return!s.success}function Bs(s){switch(s){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(s,e){if(!s)return null;const n=e?new Date(e).getTime():Date.now(),r=new Date(s).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(s){const e=new Map;for(const n of s)e.has(n.toolName)&&e.delete(n.toolName),e.set(n.toolName,n);return Array.from(e.values())}function ji(s){return s.total_items?Math.min(100,Math.round(s.tested_items/s.total_items*100)):0}function vi(s){if(!s)return null;const e=s.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 bi(s){const e=X.c(57),{result:n,index:r,icon:o}=s,[l,a]=I.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 d=Qs(n.tool_results),m=d.every(Ci),u=d.filter(wi),x=u.filter(Ni).length,p=u.filter(yi).length,h=u.length>0,c=u.length;let v;e[14]!==n.agent_summary?(v=vi(n.agent_summary),e[14]=n.agent_summary,e[15]=v):v=e[15];const b=v,k=Math.max(d.length,b??0),S=k>0?`${c}/${k} tools tested`:"0 tools";let y;e[16]!==l?(y=()=>a(!l),e[16]=l,e[17]=y):y=e[17];const f=r+1;let M;e[18]!==f?(M=t.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:f}),e[18]=f,e[19]=M):M=e[19];let g;e[20]!==o||e[21]!==n.item_title?(g=t.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:o?t.jsx("img",{src:o,alt:n.item_title,className:"h-full w-full object-cover",loading:"lazy"}):t.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]=g):g=e[22];const w=n.status==="passed"?"text-emerald-600":n.status==="needs_auth"?"text-amber-600":"text-red-600";let R;e[23]!==w?(R=ee("shrink-0",w),e[23]=w,e[24]=R):R=e[24];const E=n.status==="passed"?"✓":n.status==="needs_auth"?"🔑":"✗";let C;e[25]!==R||e[26]!==E?(C=t.jsx("span",{className:R,children:E}),e[25]=R,e[26]=E,e[27]=C):C=e[27];let T;e[28]!==n.item_title?(T=t.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:n.item_title}),e[28]=n.item_title,e[29]=T):T=e[29];let N;e[30]!==n.duration_ms?(N=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.duration_ms,"ms"]}),e[30]=n.duration_ms,e[31]=N):N=e[31];const A=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 L;e[32]!==A?(L=ee("text-[9px] capitalize shrink-0",A),e[32]=A,e[33]=L):L=e[33];let P;e[34]!==n.status?(P=n.status.replace("_"," "),e[34]=n.status,e[35]=P):P=e[35];let D;e[36]!==L||e[37]!==P?(D=t.jsx(F,{variant:"outline",className:L,children:P}),e[36]=L,e[37]=P,e[38]=D):D=e[38];let $;e[39]!==n.connection_ok?($=n.connection_ok?t.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"conn✓"}):t.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&&t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:h?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-emerald-600",children:[x,"✓"]})," ",t.jsxs("span",{className:ee(p>0?"text-red-600":""),children:[p,"✗"]})]}):m&&d.length>0?t.jsxs("span",{children:[d.length," tools found"]}):"no tools"});let O;e[41]!==S?(O=t.jsx(F,{variant:"outline",className:"text-[9px] shrink-0",children:S}),e[41]=S,e[42]=O):O=e[42];const B=l?"▲":"▼";let Q;e[43]!==B?(Q=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:B}),e[43]=B,e[44]=Q):Q=e[44];let j;e[45]!==C||e[46]!==T||e[47]!==N||e[48]!==D||e[49]!==$||e[50]!==z||e[51]!==O||e[52]!==Q||e[53]!==y||e[54]!==M||e[55]!==g?(j=t.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:y,children:[M,g,C,T,N,D,$,z,O,Q]}),e[45]=C,e[46]=T,e[47]=N,e[48]=D,e[49]=$,e[50]=z,e[51]=O,e[52]=Q,e[53]=y,e[54]=M,e[55]=g,e[56]=j):j=e[56],i=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[j,l&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[n.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),t.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})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[t.jsxs("span",{children:["Connection:"," ",t.jsx("span",{className:ee(n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),t.jsxs("span",{children:["Tools listed:"," ",t.jsx("span",{className:ee(n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),n.action_taken!=="none"&&t.jsxs(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]})]}),h?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools tested: ",x," passed, ",p," failed"]}),t.jsx("div",{className:"space-y-0.5",children:u.map((U,K)=>t.jsx(_i,{tool:U},`${n.id}-${U.toolName}-${K}`))})]}):m&&d.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",d.length,") - not individually tested (health-check mode)"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:d.map((U,K)=>t.jsx(F,{variant:"outline",className:"text-[10px] font-mono",children:U.toolName},`${n.id}-${U.toolName}-${K}`))})]}):n.tools_listed?t.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No tools found on this server."}):null,n.agent_summary&&t.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 yi(s){return!s.success}function Ni(s){return s.success}function wi(s){return s.outputPreview!=="health_check: not called"}function Ci(s){return s.outputPreview==="health_check: not called"}function _i(s){const e=X.c(30),{tool:n}=s,[r,o]=I.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=ee("font-bold",a),e[2]=a,e[3]=i):i=e[3];const d=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==d?(m=t.jsx("span",{className:i,children:d}),e[4]=i,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=t.jsx("span",{className:"font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=u):u=e[8];let x;e[9]!==n.durationMs?(x=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=x):x=e[10];let p;e[11]!==n.error?(p=n.error&&t.jsx("span",{className:"text-red-500 truncate max-w-28",title:n.error,children:n.error}),e[11]=n.error,e[12]=p):p=e[12];const h=r?"▲":"▼";let c;e[13]!==h?(c=t.jsx("span",{className:"text-muted-foreground",children:h}),e[13]=h,e[14]=c):c=e[14];let v;e[15]!==l||e[16]!==c||e[17]!==m||e[18]!==u||e[19]!==x||e[20]!==p?(v=t.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,u,x,p,c]}),e[15]=l,e[16]=c,e[17]=m,e[18]=u,e[19]=x,e[20]=p,e[21]=v):v=e[21];let b;e[22]!==r||e[23]!==n.error||e[24]!==n.input||e[25]!==n.outputPreview?(b=r&&t.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[n.error&&t.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&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),t.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&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output"}),t.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]=b):b=e[26];let k;return e[27]!==v||e[28]!==b?(k=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[v,b]}),e[27]=v,e[28]=b,e[29]=k):k=e[29],k}function ki({activeRunId:s,onRunChange:e}){const{settings:n}=$s(),[r,o]=I.useState(null),[l,a]=I.useState(!1),i=I.useRef(0),d=I.useRef(null),m=Vn(),u=Kn(),x=Zt(s),p=Ut(),h=Ds(),c=x.data?.run??null,v=c?.status,b=c?.config_snapshot?.monitorMode??c?.config_snapshot?.testMode,k=Ct(s,void 0,v),S=(p.data?.items??[]).find(N=>N.status==="running"),y=p.data?.items?.[0]?.id;!s&&y&&d.current!==y&&(d.current=y,queueMicrotask(()=>{e(y)}));const f=async()=>{const N=Date.now();if(N-i.current<1e3)return;i.current=N;const A=r??n.monitorMode,L=await m.mutateAsync({...n,monitorMode:A});e(L.run.id)},M=async()=>{if(S&&S.id!==s&&S.status==="running"){a(!0);return}await f()},g=async()=>{s&&await u.mutateAsync(s)},w=c?.status==="running",R=c?Gs(c.started_at,c.finished_at):null,E=k.data?.items??[],C=(h.data?.items??[]).reduce((N,A)=>(N[A.mapping.item_id]=A.item?.server?.icons?.[0]?.src??null,N),{}),T=r??n.monitorMode;return t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs(oe,{className:"p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Current QA Run"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a full QA validation run and track results in real time."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[S&&S.id!==s&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["Run in progress: ",S.id.slice(0,8)]}),t.jsxs(G,{size:"sm",onClick:M,disabled:m.isPending||w,className:"gap-1.5",children:[t.jsx(Qn,{size:14}),m.isPending?"Starting...":S&&S.id!==s?"Start another run":"Start QA run"]}),t.jsxs(G,{size:"sm",variant:"outline",onClick:g,disabled:!s||!w,className:"gap-1.5",children:[t.jsx(Es,{size:14}),"Cancel"]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA mode"}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:T,onChange:N=>o(N.target.value),disabled:w,children:[t.jsx("option",{value:"health_check",children:"Health check"}),t.jsx("option",{value:"tool_call",children:"Tool call"}),t.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA run history (pick a previous run)"}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:s??"",onChange:N=>e(N.target.value||void 0),children:[t.jsx("option",{value:"",children:"Auto-select latest run"}),(p.data?.items??[]).map(N=>t.jsxs("option",{value:N.id,children:[new Date(N.created_at).toLocaleString()," -"," ",N.status]},N.id))]})]})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:T==="health_check"?"Checks connectivity and tool listing only — no tool calls are made.":T==="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."}),c?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsx(F,{className:ee("capitalize",Bs(c.status),c.status==="running"?"animate-pulse":""),children:c.status}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.tested_items,"/",c.total_items," tested"]}),R&&t.jsx("span",{className:"text-xs text-muted-foreground",children:R}),w&&c.current_item_id&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:["QA on:"," ",t.jsx("span",{className:"font-mono",children:c.current_item_id})]})]}),t.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:t.jsx("div",{className:ee("h-full transition-all duration-500",c.failed_items>0?"bg-orange-500":"bg-emerald-500",w?"animate-pulse":""),style:{width:`${ji(c)}%`}})}),t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),t.jsx("p",{className:"text-lg font-bold text-emerald-600",children:c.passed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),t.jsx("p",{className:"text-lg font-bold text-red-600",children:c.failed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),t.jsx("p",{className:"text-lg font-bold",children:c.skipped_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),t.jsx("p",{className:"text-lg font-bold",children:c.total_items})]})]})]}):t.jsx("p",{className:"text-xs text-muted-foreground",children:"No run selected yet. Start a new run to begin."})]}),t.jsxs(oe,{className:"p-4 space-y-2 min-h-[360px]",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("h3",{className:"text-sm font-semibold",children:["QA results log (",E.length,")"]}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Live per-MCP test output for the selected run."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[w&&t.jsx(F,{className:"bg-blue-500/10 text-blue-600 border-blue-500/20 animate-pulse",children:"run in progress"}),c&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["progress: ",c.tested_items," of ",c.total_items," MCPs"]}),b&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["mode: ",b.replace("_"," ")]})]})]}),E.length===0?t.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."}):t.jsx("div",{ref:N=>{N&&w&&N.scrollHeight-N.scrollTop-N.clientHeight<120&&requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:E.map((N,A)=>t.jsx(bi,{result:N,index:A,icon:C[N.item_id]},N.id))})]})]}),t.jsx(yt,{open:l,onOpenChange:a,children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Start another test run?"}),t.jsxs(ft,{children:["There is already a run in progress",S?` (${S.id})`:"",". Starting another run may increase database load and slow down both executions."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:()=>{a(!1),f()},children:"Start anyway"})]})]})})]})}function Vs(s){switch(s){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 Si(s){switch(s){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function Ri(s){const e=X.c(27),{tool:n}=s,[r,o]=I.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=ee("text-xs font-bold",a),e[2]=a,e[3]=i):i=e[3];const d=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==d?(m=t.jsx("span",{className:i,children:d}),e[4]=i,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=t.jsx("span",{className:"text-xs font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=u):u=e[8];let x;e[9]!==n.durationMs?(x=t.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=x):x=e[10];const p=r?"▲":"▼";let h;e[11]!==p?(h=t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p}),e[11]=p,e[12]=h):h=e[12];let c;e[13]!==l||e[14]!==m||e[15]!==u||e[16]!==x||e[17]!==h?(c=t.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,u,x,h]}),e[13]=l,e[14]=m,e[15]=u,e[16]=x,e[17]=h,e[18]=c):c=e[18];let v;e[19]!==r||e[20]!==n.error||e[21]!==n.input||e[22]!==n.outputPreview?(v=r&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[n.error&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),t.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&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),t.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&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output preview"}),t.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)&&t.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]=v):v=e[23];let b;return e[24]!==c||e[25]!==v?(b=t.jsxs("div",{className:"rounded border border-border",children:[c,v]}),e[24]=c,e[25]=v,e[26]=b):b=e[26],b}function Ti(s){const e=X.c(52),{result:n}=s,[r,o]=I.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(Ei),d=a.filter(Pi),m=d.filter(Mi).length,u=d.filter(Ii).length,x=d.length>0;let p;e[12]!==r?(p=()=>o(!r),e[12]=r,e[13]=p):p=e[13];let h;e[14]!==n.status?(h=Si(n.status),e[14]=n.status,e[15]=h):h=e[15];let c;e[16]!==h?(c=t.jsx("span",{className:"text-base shrink-0",children:h}),e[16]=h,e[17]=c):c=e[17];let v;e[18]!==n.item_title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.item_title}),e[18]=n.item_title,e[19]=v):v=e[19];let b;e[20]!==n.duration_ms?(b=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.duration_ms,"ms"]}),e[20]=n.duration_ms,e[21]=b):b=e[21];const k=n.connection_ok?"✓":"✗";let S;e[22]!==k?(S=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["conn: ",k]}),e[22]=k,e[23]=S):S=e[23];const y=n.tools_listed?"✓":"✗";let f;e[24]!==y?(f=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["tools listed: ",y]}),e[24]=y,e[25]=f):f=e[25];const M=a.length>0&&t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x?t.jsxs(t.Fragment,{children:["tools: ",m,"✓ ",u,"✗"]}):t.jsxs(t.Fragment,{children:[a.length," tools found"]})});let g;e[26]!==n.action_taken?(g=n.action_taken!=="none"&&t.jsxs(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]}),e[26]=n.action_taken,e[27]=g):g=e[27];let w;e[28]!==f||e[29]!==M||e[30]!==g||e[31]!==b||e[32]!==S?(w=t.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[b,S,f,M,g]}),e[28]=f,e[29]=M,e[30]=g,e[31]=b,e[32]=S,e[33]=w):w=e[33];let R;e[34]!==w||e[35]!==v?(R=t.jsxs("div",{className:"min-w-0 flex-1",children:[v,w]}),e[34]=w,e[35]=v,e[36]=R):R=e[36];let E;e[37]!==n.status?(E=ee("capitalize shrink-0",Vs(n.status)),e[37]=n.status,e[38]=E):E=e[38];let C;e[39]!==n.status?(C=n.status.replace("_"," "),e[39]=n.status,e[40]=C):C=e[40];let T;e[41]!==E||e[42]!==C?(T=t.jsx(F,{className:E,children:C}),e[41]=E,e[42]=C,e[43]=T):T=e[43];const N=r?"▲":"▼";let A;e[44]!==N?(A=t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:N}),e[44]=N,e[45]=A):A=e[45];let L;e[46]!==R||e[47]!==T||e[48]!==A||e[49]!==p||e[50]!==c?(L=t.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:p,children:[c,R,T,A]}),e[46]=R,e[47]=T,e[48]=A,e[49]=p,e[50]=c,e[51]=L):L=e[51],l=t.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[L,r&&t.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),t.jsx("p",{className:ee("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"Connected":"Failed"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),t.jsx("p",{className:ee("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?`Yes (${a.length})`:"No"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),t.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Action Taken"}),t.jsx("p",{className:"text-xs font-medium capitalize",children:n.action_taken.replace(/_/g," ")})]})]}),n.error_message&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error Message"}),t.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})]}),x?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tool Results (",m," passed, ",u," failed)"]}),t.jsx("div",{className:"space-y-1",children:d.map((P,D)=>t.jsx(Ri,{tool:P},`${n.id}-${P.toolName}-${D}`))})]}):i&&a.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",a.length,") — not individually tested (health-check mode)"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:a.map((P,D)=>t.jsx(F,{variant:"outline",className:"text-[10px] font-mono",children:P.toolName},`${n.id}-${P.toolName}-${D}`))})]}):null,n.agent_summary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Agent Summary"}),t.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 Ii(s){return!s.success}function Mi(s){return s.success}function Pi(s){return s.outputPreview!=="health_check: not called"}function Ei(s){return s.outputPreview==="health_check: not called"}function Di(s){const e=X.c(4),{value:n,onChange:r}=s;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=t.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(i=>t.jsx("button",{type:"button",className:ee("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 $i(s){const e=X.c(46),{runId:n}=s,[r,o]=I.useState("all"),l=Zt(n),a=l.data?.run,i=Ct(n,void 0,a?.status);let d;e[0]!==i.data?.items?(d=i.data?.items??[],e[0]=i.data?.items,e[1]=d):d=e[1];const m=d;let u;e[2]!==m||e[3]!==r?(u=r==="all"?m:m.filter(N=>N.status===r),e[2]=m,e[3]=r,e[4]=u):u=e[4];const x=u;if(!n){let N;return e[5]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(oe,{className:"p-6 text-center space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a run to inspect details."})}),e[5]=N):N=e[5],N}let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("h3",{className:"text-sm font-semibold",children:"Run Detail"}),e[6]=p):p=e[6];let h;e[7]!==n?(h=t.jsxs("div",{children:[p,t.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:n})]}),e[7]=n,e[8]=h):h=e[8];let c;e[9]!==a?(c=a&&t.jsx(F,{className:ee("capitalize",Vs(a.status)),children:a.status}),e[9]=a,e[10]=c):c=e[10];let v;e[11]!==i||e[12]!==l?(v=t.jsx(G,{size:"sm",variant:"outline",onClick:()=>{l.refetch(),i.refetch()},children:"Refresh"}),e[11]=i,e[12]=l,e[13]=v):v=e[13];let b;e[14]!==c||e[15]!==v?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[c,v]}),e[14]=c,e[15]=v,e[16]=b):b=e[16];let k;e[17]!==h||e[18]!==b?(k=t.jsx(oe,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,b]})}),e[17]=h,e[18]=b,e[19]=k):k=e[19];let S;e[20]!==a?(S=a&&t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),t.jsx("p",{className:"text-lg font-bold",children:a.total_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tested"}),t.jsx("p",{className:"text-lg font-bold",children:a.tested_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),t.jsx("p",{className:"text-lg font-bold text-emerald-600",children:a.passed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),t.jsx("p",{className:"text-lg font-bold text-red-600",children:a.failed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),t.jsx("p",{className:"text-lg font-bold",children:a.skipped_items})]})]}),e[20]=a,e[21]=S):S=e[21];let y;e[22]!==a?(y=a&&(a.started_at||a.finished_at)&&t.jsxs(oe,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[a.started_at&&t.jsxs("span",{children:["Started: ",new Date(a.started_at).toLocaleString()]}),a.finished_at&&t.jsxs("span",{children:["Finished: ",new Date(a.finished_at).toLocaleString()]}),a.started_at&&a.finished_at&&t.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]=y):y=e[23];let f;e[24]!==r?(f=t.jsx(Di,{value:r,onChange:o}),e[24]=r,e[25]=f):f=e[25];const M=x.length!==1?"s":"";let g;e[26]!==x.length||e[27]!==M?(g=t.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," result",M]}),e[26]=x.length,e[27]=M,e[28]=g):g=e[28];let w;e[29]!==f||e[30]!==g?(w=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f,g]}),e[29]=f,e[30]=g,e[31]=w):w=e[31];let R;e[32]!==m||e[33]!==x.length?(R=x.length===0&&t.jsx(oe,{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]=x.length,e[34]=R):R=e[34];let E;e[35]!==x?(E=x.map(Ai),e[35]=x,e[36]=E):E=e[36];let C;e[37]!==R||e[38]!==E?(C=t.jsxs("div",{className:"space-y-2",children:[R,E]}),e[37]=R,e[38]=E,e[39]=C):C=e[39];let T;return e[40]!==y||e[41]!==w||e[42]!==C||e[43]!==k||e[44]!==S?(T=t.jsxs("div",{className:"space-y-3",children:[k,S,y,w,C]}),e[40]=y,e[41]=w,e[42]=C,e[43]=k,e[44]=S,e[45]=T):T=e[45],T}function Ai(s){return t.jsx(Ti,{result:s},s.id)}function Li(s){return s.tested_items?`${Math.round(s.passed_items/s.tested_items*100)}%`:"-"}function Oi(s){const e=X.c(20),{selectedRunId:n,onSelectRun:r}=s,o=Ut();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=t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=i):i=e[2];let d;e[3]!==o?(d=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i,t.jsx(G,{size:"sm",variant:"outline",onClick:()=>o.refetch(),children:"Refresh"})]}),e[3]=o,e[4]=d):d=e[4];let m;e[5]!==a.length?(m=a.length===0&&t.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 u;if(e[7]!==r||e[8]!==a||e[9]!==n){let h;e[11]!==r||e[12]!==n?(h=c=>{const v=Gs(c.started_at,c.finished_at),b=Li(c),k=n===c.id;return t.jsxs("button",{type:"button",onClick:()=>r(c.id),className:ee("w-full text-left rounded-lg border p-3 transition-colors",k?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(c.created_at).toLocaleString()})}),t.jsx(F,{className:ee("capitalize",Bs(c.status)),children:c.status})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[t.jsxs("span",{className:"text-muted-foreground",children:[c.tested_items,"/",c.total_items," tested"]}),t.jsxs("span",{className:"text-emerald-600 font-medium",children:[c.passed_items," passed"]}),c.failed_items>0&&t.jsxs("span",{className:"text-red-600 font-medium",children:[c.failed_items," failed"]}),c.skipped_items>0&&t.jsxs("span",{className:"text-muted-foreground",children:[c.skipped_items," skipped"]}),t.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",b]}),v&&t.jsx("span",{className:"text-muted-foreground",children:v})]}),c.config_snapshot&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.jsx(F,{variant:"outline",className:"text-[9px]",children:(c.config_snapshot.monitorMode??c.config_snapshot.testMode??"health_check").replace("_"," ")}),c.config_snapshot.onFailure!=="none"&&t.jsxs(F,{variant:"outline",className:"text-[9px] text-red-600",children:["on fail:"," ",c.config_snapshot.onFailure.replace(/_/g," ")]})]})]},c.id)},e[11]=r,e[12]=n,e[13]=h):h=e[13],u=a.map(h),e[7]=r,e[8]=a,e[9]=n,e[10]=u}else u=e[10];let x;e[14]!==m||e[15]!==u?(x=t.jsxs("div",{className:"space-y-2 max-h-[520px] overflow-auto",children:[m,u]}),e[14]=m,e[15]=u,e[16]=x):x=e[16];let p;return e[17]!==d||e[18]!==x?(p=t.jsx(oe,{className:"p-4",children:t.jsxs("div",{className:"space-y-3",children:[d,x]})}),e[17]=d,e[18]=x,e[19]=p):p=e[19],p}function zi(){const s=X.c(20),[e,n]=I.useState(void 0),[r,o]=I.useState("tests"),a=Zt(e).data?.run?.status,i=Ct(e,void 0,a);let d;s[0]!==i.data?.items?(d=i.data?.items??[],s[0]=i.data?.items,s[1]=d):d=s[1];let m;s[2]!==d?(m=d.filter(Ui),s[2]=d,s[3]=m):m=s[3];const u=m;let x;s[4]===Symbol.for("react.memo_cache_sentinel")?(x=[{id:"tests",label:"Tests"},{id:"configuration",label:"Configuration"},{id:"connections",label:"Connections"}],s[4]=x):x=s[4];let p;s[5]!==r?(p=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:x.map(k=>{const S=r===k.id;return t.jsx("button",{type:"button",className:ee("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",S?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>o(k.id),children:t.jsx("span",{children:k.label})},k.id)})}),s[5]=r,s[6]=p):p=s[6];let h;s[7]!==e||s[8]!==r||s[9]!==u?(h=r==="tests"&&t.jsxs("div",{className:"space-y-6",children:[t.jsx(ki,{activeRunId:e,onRunChange:n}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[t.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[e&&t.jsx($i,{runId:e}),t.jsx(Oi,{selectedRunId:e,onSelectRun:n})]}),t.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[t.jsxs("h3",{className:"text-sm font-semibold",children:["Broken MCPs"," ",u.length>0&&t.jsx(F,{variant:"destructive",className:"text-[10px] ml-1",children:u.length})]}),t.jsx(Jr,{results:u})]})]})]}),s[7]=e,s[8]=r,s[9]=u,s[10]=h):h=s[10];let c;s[11]!==r?(c=r==="configuration"&&t.jsx(ci,{}),s[11]=r,s[12]=c):c=s[12];let v;s[13]!==r?(v=r==="connections"&&t.jsx(xi,{}),s[13]=r,s[14]=v):v=s[14];let b;return s[15]!==p||s[16]!==h||s[17]!==c||s[18]!==v?(b=t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[p,h,c,v]}),s[15]=p,s[16]=h,s[17]=c,s[18]=v,s[19]=b):b=s[19],b}function Ui(s){return s.status==="failed"||s.status==="error"}function qi(s){const e=X.c(9),{activeTab:n,onChange:r,items:o}=s;let l;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==r?(i=d=>{const m=n===d.tab,u=d.icon;return t.jsxs("button",{type:"button",className:ee("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(d.tab),children:[t.jsx(u,{size:14}),t.jsx("span",{children:d.label}),typeof d.count=="number"&&d.count>0&&t.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:d.count})]},d.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=t.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 Gl(){const s=X.c(55),[e,n]=I.useState("items"),[r,o]=I.useState(null),{registryName:l,registryIcon:a,registryLLMConnectionId:i,registryLLMModelId:d,acceptPublishRequests:m,requireApiToken:u,storePrivateOnly:x,rateLimitEnabled:p,rateLimitWindow:h,rateLimitMax:c}=qt(Ke),v=lr(),b=Xn(),k=`${l}|${a}|${i}|${d}|${m}|${u}|${x}|${p}|${h}|${c}`;!m&&e==="requests"&&n("items");const S=v.data?.pending??0,y=b.brokenCount>0?b.brokenCount:void 0;let f;s[0]!==y?(f={id:"items",label:"Items",icon:jn,tab:"items",count:y},s[0]=y,s[1]=f):f=s[1];let M;s[2]!==m||s[3]!==S?(M=m?[{id:"requests",label:"Requests",icon:it,tab:"requests",count:S}]:[],s[2]=m,s[3]=S,s[4]=M):M=s[4];let g,w;s[5]===Symbol.for("react.memo_cache_sentinel")?(g={id:"qa",label:"QA",icon:Jt,tab:"qa"},w={id:"settings",label:"Settings",icon:vn,tab:"settings"},s[5]=g,s[6]=w):(g=s[5],w=s[6]);let R;s[7]!==f||s[8]!==M?(R=[f,...M,g,w],s[7]=f,s[8]=M,s[9]=R):R=s[9];const E=R;let C;s[10]===Symbol.for("react.memo_cache_sentinel")?(C=()=>n("settings"),s[10]=C):C=s[10];let T;s[11]!==a||s[12]!==l?(T=t.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:a?t.jsx("img",{src:a,alt:l,className:"h-full w-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:l.slice(0,1).toUpperCase()})}),s[11]=a,s[12]=l,s[13]=T):T=s[13];let N;s[14]!==l?(N=t.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:l}),s[14]=l,s[15]=N):N=s[15];let A;s[16]!==T||s[17]!==N?(A=t.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:C,children:[T,N]}),s[16]=T,s[17]=N,s[18]=A):A=s[18];let L;s[19]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),s[19]=L):L=s[19];let P;s[20]!==e||s[21]!==E?(P=t.jsx(qi,{activeTab:e,onChange:n,items:E}),s[20]=e,s[21]=E,s[22]=P):P=s[22];let D;s[23]!==P||s[24]!==A?(D=t.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:t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[A,L,P]})}),s[23]=P,s[24]=A,s[25]=D):D=s[25];let $;s[26]!==e?($=e==="items"&&t.jsx(Br,{}),s[26]=e,s[27]=$):$=s[27];let z;s[28]!==m||s[29]!==e?(z=e==="requests"&&m&&t.jsx(Vr,{}),s[28]=m,s[29]=e,s[30]=z):z=s[30];let O;s[31]!==e?(O=e==="qa"&&t.jsx(zi,{}),s[31]=e,s[32]=O):O=s[32];let B;s[33]!==m||s[34]!==e||s[35]!==p||s[36]!==c||s[37]!==h||s[38]!==a||s[39]!==i||s[40]!==d||s[41]!==l||s[42]!==u||s[43]!==r||s[44]!==k||s[45]!==x?(B=e==="settings"&&t.jsx(Wr,{initialName:l,initialIcon:a,initialLLMConnectionId:i,initialLLMModelId:d,initialAcceptPublishRequests:m,initialRequireApiToken:u,initialStorePrivateOnly:x,initialRateLimitEnabled:p,initialRateLimitWindow:h,initialRateLimitMax:c,revealedKey:r,onRevealedKeyChange:o},k),s[33]=m,s[34]=e,s[35]=p,s[36]=c,s[37]=h,s[38]=a,s[39]=i,s[40]=d,s[41]=l,s[42]=u,s[43]=r,s[44]=k,s[45]=x,s[46]=B):B=s[46];let Q;s[47]!==$||s[48]!==z||s[49]!==O||s[50]!==B?(Q=t.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[$,z,O,B]}),s[47]=$,s[48]=z,s[49]=O,s[50]=B,s[51]=Q):Q=s[51];let j;return s[52]!==D||s[53]!==Q?(j=t.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[D,Q]}),s[52]=D,s[53]=Q,s[54]=j):j=s[54],j}export{Gl as default};
5
+ Describe your MCP here...`,rows:6,value:ke,onChange:q=>ye(q.target.value)}),ve.readme&&t.jsx("p",{className:"text-xs text-destructive",children:ve.readme})]}),We&&Te==="generate"&&t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-3",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Generates a README using name, description, tools, category and tags as context."}),t.jsx(G,{type:"button",variant:"outline",size:"sm",className:nt,disabled:c==="readme",onClick:en,children:c==="readme"?"Generating...":"Generate with AI"})]})]}),t.jsx(Rr,{tools:we,onChange:tt,remoteUrl:rt(ne)||void 0,remoteType:Ne,externalDiscoverStatus:b,externalDiscoverError:k})]});return t.jsx(Ot,{open:s,onOpenChange:ts,children:t.jsxs(Lt,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[t.jsxs(Et,{className:"space-y-3",children:[t.jsx(Dt,{children:y?"Edit MCP Server":"Add MCP Server"}),t.jsx(Dr,{current:j}),t.jsxs($t,{children:[j===1&&"Set up the identity, connection and discover available tools.",j===2&&"Add descriptions, categories and tags to help discovery.",j===3&&"Configure optional metadata, README and tools."]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[j===1&&rn,j===2&&ln,j===3&&an]}),t.jsxs(At,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[t.jsx("div",{children:j>1&&t.jsxs(G,{variant:"ghost",size:"sm",onClick:sn,children:[t.jsx(_n,{size:14}),"Back"]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{variant:"outline",size:"sm",onClick:()=>ts(!1),disabled:d,children:"Cancel"}),j<3?t.jsxs(G,{size:"sm",onClick:tn,children:["Next",t.jsx(kn,{size:14})]}):t.jsx(G,{size:"sm",onClick:nn,disabled:d,children:d?"Saving...":y?"Save changes":"Create"})]})]})]})})}function hs(s,e){return s.includes(e)?s.filter(n=>n!==e):[...s,e]}function Ur(s){return s._meta?.["mcp.mesh"]?.tags??[]}function qr(s){return s._meta?.["mcp.mesh"]?.categories??[]}function Fr(s){return s.server?.remotes?.[0]?.url??"-"}function Br(){const[e,n]=I.useState(""),r=I.useDeferredValue(e),[o,l]=I.useState([]),[a,i]=I.useState([]),[d,m]=I.useState(!1),[u,x]=I.useState(!1),[p,h]=I.useState(null),[c,v]=I.useState(null),[b,k]=Nn("private-registry-list","cards"),S=I.useRef(null),y=Ls({search:r,tags:o,categories:a}),f=sr(),{registryLLMConnectionId:M,registryLLMModelId:g}=qt(Ke),{createMutation:w,updateMutation:R,deleteMutation:E,bulkCreateMutation:C}=Xt(),T=y.data?.pages.flatMap(j=>j.items??[]).filter(Boolean)??[],N=y.data?.pages[0]?.totalCount??T.length,A=o.length>0||a.length>0||r.length>0,L=f.data,P=Array.isArray(L?.tags)?L.tags:[],D=Array.isArray(L?.categories)?L.categories:[],$=j=>{S.current&&(S.current.disconnect(),S.current=null),!(!j||!y.hasNextPage||y.isFetchingNextPage)&&(S.current=new IntersectionObserver(U=>{U[0]?.isIntersecting&&y.hasNextPage&&!y.isFetchingNextPage&&y.fetchNextPage()},{rootMargin:"240px 0px"}),S.current.observe(j))},z=async j=>{try{"data"in j?(await R.mutateAsync(j),H.success("Registry item updated")):(await w.mutateAsync(j),H.success("Registry item created"))}catch(U){throw H.error(U instanceof Error?U.message:"Failed to save item"),U}},O=async j=>{const U=j._meta?.["mcp.mesh"]?.verified===!0;try{await R.mutateAsync({id:j.id,data:{_meta:{...j._meta,"mcp.mesh":{...j._meta?.["mcp.mesh"],verified:!U}}}}),H.success(U?"Removed verified status":"Marked as verified")}catch(K){H.error(K instanceof Error?K.message:"Failed to update item")}},B=async j=>{const U=j._meta?.["mcp.mesh"]?.official===!0;try{await R.mutateAsync({id:j.id,data:{_meta:{...j._meta,"mcp.mesh":{...j._meta?.["mcp.mesh"],official:!U}}}}),H.success(U?"Removed official status":"Marked as official")}catch(K){H.error(K instanceof Error?K.message:"Failed to update item")}},Q=async()=>{if(c)try{await E.mutateAsync(c.id),H.success("Registry item deleted"),v(null)}catch(j){H.error(j instanceof Error?j.message:"Failed to delete item")}};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"shrink-0 border-b border-border",children:[t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t.jsx(F,{variant:"secondary",className:"text-xs",children:N})]}),t.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsxs(G,{variant:"outline",size:"sm",className:ee("h-8","gap-1.5"),children:[t.jsx(wn,{size:14}),"Filters"]})}),t.jsxs(Mt,{align:"end",className:"w-[260px]",children:[t.jsx(rs,{children:"Tags"}),P.length>0?P.map(j=>t.jsxs(is,{checked:o.includes(j.value),onCheckedChange:()=>l(U=>hs(U,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ee,{disabled:!0,children:"No tags available"}),t.jsx(bn,{}),t.jsx(rs,{children:"Categories"}),D.length>0?D.map(j=>t.jsxs(is,{checked:a.includes(j.value),onCheckedChange:()=>i(U=>hs(U,j.value)),children:[j.value," (",j.count,")"]},j.value)):t.jsx(Ee,{disabled:!0,children:"No categories available"})]})]}),t.jsxs(yn,{type:"single",value:b,onValueChange:j=>{(j==="cards"||j==="table")&&k(j)},variant:"outline",className:"h-8",children:[t.jsx(ls,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),t.jsx(ls,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"})]}),t.jsx(G,{variant:"outline",size:"sm",className:"h-8",onClick:()=>x(!0),children:"Import CSV"}),t.jsx(G,{size:"sm",className:"h-8",onClick:()=>m(!0),children:"Add MCP Servers"})]})]}),t.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:t.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[t.jsx(ws,{size:16,className:"text-muted-foreground shrink-0"}),t.jsx(xe,{value:e,onChange:j=>n(j.target.value),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"})]})}),A&&t.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[o.map(j=>t.jsxs(F,{variant:"default",children:["#",j]},`selected-tag-${j}`)),a.map(j=>t.jsx(F,{variant:"outline",children:j},`selected-category-${j}`)),e.trim()&&t.jsxs(F,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),t.jsx(G,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{n(""),l([]),i([])},children:"Clear filters"})]})]}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[T.length===0?t.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:y.isLoading?t.jsxs(t.Fragment,{children:[t.jsx(et,{className:"size-5 animate-spin text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{className:"text-base font-medium",children:A?"No items found":"No MCPs in your registry"}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:A?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!A&&t.jsx(G,{size:"lg",onClick:()=>m(!0),children:"Add MCP Servers"})]})}):b==="cards"?t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:T.map(j=>t.jsx(_r,{item:j,onEdit:h,onDelete:v,onToggleVerified:O,onToggleOfficial:B},j.id))}),y.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"border rounded-lg overflow-auto",children:t.jsxs(vs,{children:[t.jsx(bs,{children:t.jsxs(Pt,{children:[t.jsx(Ie,{className:"w-[56px]",children:"Icon"}),t.jsx(Ie,{children:"Title"}),t.jsx(Ie,{children:"ID"}),t.jsx(Ie,{children:"Tags"}),t.jsx(Ie,{children:"Categories"}),t.jsx(Ie,{children:"Remote URL"}),t.jsx(Ie,{children:"Visibility"}),t.jsx(Ie,{className:"text-right w-[68px]",children:"Actions"})]})}),t.jsx(ys,{children:T.map(j=>t.jsxs(Pt,{children:[t.jsx(Me,{children:t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:j.server?.icons?.[0]?.src?t.jsx("img",{src:j.server.icons[0].src,alt:j.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:j.title.charAt(0).toUpperCase()})})}),t.jsx(Me,{children:j.title}),t.jsx(Me,{className:"font-mono",children:j.id}),t.jsx(Me,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:Ur(j).slice(0,3).map(U=>t.jsx(F,{variant:"outline",children:U},`${j.id}-tag-${U}`))})}),t.jsx(Me,{children:t.jsx("div",{className:"flex flex-wrap gap-1",children:qr(j).slice(0,3).map(U=>t.jsx(F,{variant:"outline",children:U},`${j.id}-category-${U}`))})}),t.jsx(Me,{children:Fr(j)}),t.jsx(Me,{children:j.is_public?t.jsxs(F,{variant:"default",className:"gap-1",children:[t.jsx(Ns,{size:10}),"Public"]}):t.jsx(F,{variant:"secondary",children:"Private"})}),t.jsx(Me,{className:"text-right",children:t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(Ht,{size:18})})}),t.jsxs(Mt,{align:"end",children:[t.jsx(Ee,{onClick:()=>h(j),children:"Edit"}),t.jsx(Ee,{variant:"destructive",onClick:()=>v(j),children:"Delete"})]})]})})]},j.id))})]})}),y.hasNextPage&&t.jsx("div",{ref:$,className:"h-2"})]}),y.isFetchingNextPage&&t.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[t.jsx(et,{className:"size-4 animate-spin"}),"Loading more items..."]})]}),t.jsx(zr,{open:d||!!p,onOpenChange:j=>{j||(m(!1),h(null))},item:p,availableTags:P.map(j=>j.value),availableCategories:D.map(j=>j.value),defaultLLMConnectionId:M,defaultLLMModelId:g,isSubmitting:w.isPending||R.isPending,onSubmit:z},p?.id??"create"),t.jsx(pr,{open:u,onOpenChange:x,isImporting:C.isPending,onImport:async j=>{try{const U=await C.mutateAsync(j);return H.success(`Imported ${U.created} item(s)`),U}catch(U){throw H.error(U instanceof Error?U.message:"Failed to import CSV"),U}}}),t.jsx(br,{open:!!c,onOpenChange:j=>{j||v(null)},title:c?.title??c?.id??"",isDeleting:E.isPending,onConfirm:Q})]})}function Gr(s,e,n=!1){const r=I.useRef(null),o=I.useRef(s),l=I.useRef(e),a=I.useRef(n);return o.current=s,l.current=e,a.current=n,d=>{r.current&&r.current.disconnect(),r.current=new IntersectionObserver(m=>{m[0]?.isIntersecting&&l.current&&!a.current&&o.current()}),d&&r.current.observe(d)}}const Qr=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function ps(s){const e=new Date(s);return Number.isNaN(e.getTime())?s:e.toLocaleDateString()}function fs(s){return{id:s.requested_id??s.server?.name,title:s.title,description:s.description??"",_meta:s._meta,server:s.server,is_public:!1}}function Yt(s){const e=s.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ut(s){const e=s._meta?.["mcp.mesh"];return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Vr(){const[s,e]=I.useState("pending"),[n,r]=I.useState("created_at"),[o,l]=I.useState("asc"),[a,i]=I.useState(new Set),[d,m]=I.useState(!1),[u,x]=I.useState("private"),[p,h]=I.useState(!1),[c,v]=I.useState(null),[b,k]=I.useState(null),[S,y]=I.useState(null),[f,M]=I.useState(null),[g,w]=I.useState(""),R=nr({status:s,sortBy:n,sortDirection:o}),{reviewMutation:E,deleteMutation:C}=ar(),{createMutation:T}=Xt(),N=R.data?.pages.flatMap(_=>_.items)??[],A=R.data?.pages[0]?.totalCount??0,L=R.isFetchingNextPage,P=!!R.hasNextPage,D=Gr(()=>{R.isFetchingNextPage||R.fetchNextPage()},P,L),$=new Set(N.filter(_=>_.status==="pending").map(_=>_.id)),z=N.filter(_=>$.has(_.id)),O=a.size,B=z.filter(_=>a.has(_.id)),Q=N.filter(_=>a.has(_.id)).length,j=z.length>0&&z.every(_=>a.has(_.id)),U=()=>i(new Set),K=(_,J)=>{i(Z=>{const ce=new Set(Z);return J?ce.add(_):ce.delete(_),ce})},te=_=>{i(J=>{const Z=new Set(J);return Z.has(_)?Z.delete(_):Z.add(_),Z})},se=()=>{i(_=>{const J=new Set(_);for(const Z of z)J.add(Z.id);return J})},le=async()=>{const _=b;if(_){k(null),v(_.id);try{await E.mutateAsync({id:_.id,status:"approved",reviewerNotes:void 0});const J=fs(_);await T.mutateAsync({id:J.id,title:J.title,description:J.description,_meta:J._meta,server:J.server,is_public:J.is_public}),H.success("Request approved and added to registry")}catch(J){const Z=J instanceof Error?J.message:"Failed to approve request";Z.includes("UNIQUE constraint")||Z.includes("already exists")?H.error("An item with this ID already exists in the registry. Delete or rename it first."):H.error(Z)}finally{v(null)}}},ae=async()=>{if(S)try{await E.mutateAsync({id:S.id,status:"rejected",reviewerNotes:g.trim()||void 0}),H.success("Request rejected"),y(null),w("")}catch(_){H.error(_ instanceof Error?_.message:"Failed to reject request")}},me=async _=>{try{await C.mutateAsync(_.id),H.success("Request deleted")}catch(J){H.error(J instanceof Error?J.message:"Failed to delete request")}},ue=async()=>{if(B.length===0||p)return;h(!0),m(!1);let _=0;const J=new Set;for(const ce of B)try{await E.mutateAsync({id:ce.id,status:"approved",reviewerNotes:void 0});const fe=fs(ce);await T.mutateAsync({id:fe.id,title:fe.title,description:fe.description,_meta:fe._meta,server:fe.server,is_public:u==="public"}),_++}catch{J.add(ce.id)}const Z=J.size;_>0&&Z===0?H.success(`${_} request${_>1?"s":""} approved as ${u}.`):_>0&&Z>0?H.warning(`Approved ${_}. Failed ${Z}. Failed items remain selected for retry.`):H.error("Bulk approve failed. Selected items were kept for retry."),i(J),h(!1)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"shrink-0 border-b border-border",children:t.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),t.jsx(F,{variant:"secondary",className:"text-xs",children:A})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:Qr.map(_=>t.jsx("button",{type:"button",className:ee("px-2.5 py-1 text-xs rounded-md transition-colors",s===_.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(_.value),onClickCapture:()=>U(),children:_.label},_.value))}),t.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${n}:${o}`,onChange:_=>{const[J,Z]=_.target.value.split(":");r(J),l(Z)},children:[t.jsx("option",{value:"created_at:asc",children:"Created at (oldest first)"}),t.jsx("option",{value:"created_at:desc",children:"Created at (newest first)"}),t.jsx("option",{value:"title:asc",children:"Alphabetical (A-Z)"}),t.jsx("option",{value:"title:desc",children:"Alphabetical (Z-A)"})]})]})]})}),t.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[R.isLoading?t.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):R.isError?t.jsxs(oe,{className:"p-8 text-center",children:[t.jsx("p",{className:"text-sm text-destructive",children:"Failed to load publish requests."}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:R.error instanceof Error?R.error.message:"Unknown error"})]}):N.length===0?t.jsx(oe,{className:"p-8 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:s==="pending"?"No pending publish requests.":s==="approved"?"No approved publish requests.":"No rejected publish requests."})}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:N.map(_=>{const J=Yt(_),Z=ut(_),ce=_._meta?.["mcp.mesh"]?.tags??[],fe=_._meta?.["mcp.mesh"]?.categories??[],ke=Z.hasReadmeContent||Z.hasReadmeLink||ce.length>0||fe.length>0,ye=[_.requester_name,_.requester_email].filter(Boolean).join(" · ");return t.jsxs(oe,{className:ee("p-3 grid gap-1.5",$.has(_.id)&&"cursor-pointer hover:bg-muted/30",a.has(_.id)&&"bg-accent/20"),onClick:()=>{$.has(_.id)&&te(_.id)},children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[$.has(_.id)&&t.jsx(Pn,{checked:a.has(_.id),className:"mt-0.5",onCheckedChange:ie=>K(_.id,ie===!0),onClick:ie=>ie.stopPropagation()}),t.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:J?t.jsx("img",{src:J,alt:_.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:_.title.slice(0,1).toUpperCase()})}),t.jsx("p",{className:"text-sm font-medium truncate",children:_.title})]}),t.jsx(F,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:_.status})]}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:_.description}),ke&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[Z.hasReadmeContent&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"README"}),Z.hasReadmeLink&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"README link"}),ce.slice(0,2).map(ie=>t.jsx(F,{variant:"secondary",className:"text-[10px]",children:ie},`${_.id}-tag-${ie}`)),fe.slice(0,1).map(ie=>t.jsx(F,{variant:"secondary",className:"text-[10px]",children:ie},`${_.id}-category-${ie}`))]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[ye&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"truncate",children:ye}),t.jsx("span",{children:"·"})]}),t.jsx("span",{className:"shrink-0",children:ps(_.created_at)})]}),t.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[t.jsxs(G,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),M(_)},children:[t.jsx(Ts,{size:13}),"View"]}),$.has(_.id)?t.jsxs(t.Fragment,{children:[t.jsxs(G,{size:"sm",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),k(_)},disabled:c!==null||p||a.has(_.id),children:[t.jsx(it,{size:13}),c===_.id?"Approving...":a.has(_.id)?"Selected":"Approve"]}),t.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),y(_),w("")},disabled:E.isPending,children:[t.jsx(Sn,{size:13}),"Reject"]})]}):t.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie=>{ie.stopPropagation(),me(_)},disabled:C.isPending,children:[t.jsx(wt,{size:13}),"Delete"]})]})]},_.id)})}),N.length>0&&P?t.jsx("div",{ref:D,className:"h-1 w-full"}):null,L&&N.length>0?t.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:"Loading more requests..."}):null]}),O>0?t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[t.jsxs("div",{className:"text-xs text-muted-foreground pr-1",children:[O," selected"]}),t.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:se,disabled:j,children:"Select all"}),t.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:U,children:"Clear selection"}),t.jsxs(G,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>m(!0),disabled:p,children:[t.jsx(it,{size:13}),"Approve selected"]})]})}):null,t.jsx(Ot,{open:!!f,onOpenChange:_=>{_||M(null)},children:t.jsxs(Lt,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[t.jsxs(Et,{children:[t.jsx(Dt,{children:f?.title??"Request details"}),t.jsx($t,{children:"Review all metadata sent by the requester before approving."})]}),f&&t.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[t.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Yt(f)?t.jsx("img",{src:Yt(f)||"",alt:f.title,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:f.title.slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:f.title}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:f.server?.name||f.id})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),t.jsx("span",{className:"capitalize",children:f.status})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),t.jsx("span",{children:ps(f.created_at)})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Requester"}),t.jsx("span",{children:f.requester_name||"-"})]}),t.jsxs("div",{className:"grid gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Email"}),t.jsx("span",{children:f.requester_email||"-"})]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Remote URL"}),t.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:f.server?.remotes?.[0]?.url??"-"})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Description"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:f.description||"No description provided."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(f._meta?.["mcp.mesh"]?.tags??[]).length?(f._meta?.["mcp.mesh"]?.tags??[]).map(_=>t.jsx(F,{variant:"secondary",children:_},`${f.id}-detail-tag-${_}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"Categories"}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:(f._meta?.["mcp.mesh"]?.categories??[]).length?(f._meta?.["mcp.mesh"]?.categories??[]).map(_=>t.jsx(F,{variant:"secondary",children:_},`${f.id}-detail-category-${_}`)):t.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{children:"README"}),ut(f).hasReadmeContent?t.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:ut(f).readmeContent}):ut(f).hasReadmeLink?t.jsxs("a",{href:ut(f).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:["Open README link",t.jsx(En,{size:14})]}):t.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),t.jsx(At,{children:t.jsx(G,{variant:"outline",onClick:()=>M(null),children:"Close"})})]})}),t.jsx(yt,{open:!!b,onOpenChange:_=>{_||k(null)},children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Approve publish request?"}),t.jsxs(ft,{children:["This will add"," ",t.jsx("span",{className:"font-medium text-foreground",children:b?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:le,children:"Approve"})]})]})}),t.jsx(yt,{open:d,onOpenChange:m,children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Approve selected requests?"}),t.jsxs(ft,{children:["This will approve ",B.length," request",B.length>1?"s":""," and create all resulting apps with the same visibility setting."]})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"bulk-visibility",children:"Visibility for all selected"}),t.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:u,onChange:_=>x(_.target.value),children:[t.jsx("option",{value:"private",children:"Private"}),t.jsx("option",{value:"public",children:"Public"})]})]}),t.jsxs(vt,{children:[t.jsx(gt,{disabled:p,children:"Cancel"}),t.jsx(jt,{onClick:ue,disabled:p||Q===0,children:p?"Approving...":"Approve selected"})]})]})}),t.jsx(Ot,{open:!!S,onOpenChange:_=>{_||(y(null),w(""))},children:t.jsxs(Lt,{children:[t.jsxs(Et,{children:[t.jsx(Dt,{children:"Reject publish request?"}),t.jsx($t,{children:"This request will move to rejected status. You can leave optional notes for context."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),t.jsx(zt,{id:"reject-notes",rows:4,value:g,onChange:_=>w(_.target.value),placeholder:"Reason for rejection..."})]}),t.jsxs(At,{children:[t.jsx(G,{variant:"outline",onClick:()=>{y(null),w("")},children:"Cancel"}),t.jsx(G,{onClick:ae,disabled:E.isPending,children:E.isPending?"Rejecting...":"Reject"})]})]})})]})}function Fs(s){const e=X.c(104),{connectionId:n,modelId:r,connections:o,models:l,onConnectionChange:a,onModelChange:i,connectionLabel:d,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:x,className:p}=s,h=d===void 0?"LLM Connection":d,c=m===void 0?"Model":m,v=u===void 0?"Select LLM connection":u,b=x===void 0?"Select model":x,[k,S]=I.useState(!1),[y,f]=I.useState("");let M;if(e[0]!==r||e[1]!==l){let ne;e[3]!==r?(ne=je=>je.id===r,e[3]=r,e[4]=ne):ne=e[4],M=l.find(ne),e[0]=r,e[1]=l,e[2]=M}else M=e[2];const g=M;let w;if(e[5]!==l||e[6]!==y){const ne=y.trim().toLowerCase();w=ne?l.filter(je=>je.title.toLowerCase().includes(ne)||je.id.toLowerCase().includes(ne)):l,e[5]=l,e[6]=y,e[7]=w}else w=e[7];const R=w;let E,C,T,N,A,L,P,D,$,z,O,B,Q,j,U,K,te,se,le,ae,me,ue;if(e[8]!==p||e[9]!==n||e[10]!==h||e[11]!==v||e[12]!==o||e[13]!==c||e[14]!==b||e[15]!==a||e[16]!==k||e[17]!==y||e[18]!==g?.title){let ne;e[41]!==n?(ne=Be=>Be.id===n,e[41]=n,e[42]=ne):ne=e[42];const je=o.find(ne);A=Yr,e[43]!==p?(se=ee("grid gap-1.5",p),e[43]=p,e[44]=se):se=e[44],e[45]!==c?(le=t.jsx(re,{children:c}),e[45]=c,e[46]=le):le=e[46],N=Dn,U=k,K=S;const Ne=g?.title||b;let be;e[47]!==Ne?(be=t.jsx("span",{className:"truncate text-left",children:Ne}),e[47]=Ne,e[48]=be):be=e[48];let Oe;e[49]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx(Rs,{className:"size-4 shrink-0 opacity-60"}),e[49]=Oe):Oe=e[49],e[50]!==c||e[51]!==be?(te=t.jsx($n,{asChild:!0,children:t.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":c,children:[be,Oe]})}),e[50]=c,e[51]=be,e[52]=te):te=e[52],T=An,B="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",Q="start",j=8,z="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Ae;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ae=t.jsx(ws,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Ae):Ae=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=Be=>f(Be.target.value),e[54]=Se):Se=e[54],e[55]!==y?(O=t.jsxs("div",{className:"relative flex-1 min-w-0",children:[Ae,t.jsx(xe,{value:y,onChange:Se,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=y,e[56]=O):O=e[56],$="w-auto shrink-0",C=Cs,P=n,D=a,E=_s,ae="llm-connection-select",me="h-9 min-w-[160px] max-w-[220px]",ue=h,L=je?t.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:je.icon?t.jsx("img",{src:je.icon,alt:je.title,className:"w-full h-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:je.title.slice(0,1).toUpperCase()})}),t.jsx("span",{className:"truncate",children:je.title})]}):t.jsx(ks,{placeholder:v}),e[8]=p,e[9]=n,e[10]=h,e[11]=v,e[12]=o,e[13]=c,e[14]=b,e[15]=a,e[16]=k,e[17]=y,e[18]=g?.title,e[19]=E,e[20]=C,e[21]=T,e[22]=N,e[23]=A,e[24]=L,e[25]=P,e[26]=D,e[27]=$,e[28]=z,e[29]=O,e[30]=B,e[31]=Q,e[32]=j,e[33]=U,e[34]=K,e[35]=te,e[36]=se,e[37]=le,e[38]=ae,e[39]=me,e[40]=ue}else E=e[19],C=e[20],T=e[21],N=e[22],A=e[23],L=e[24],P=e[25],D=e[26],$=e[27],z=e[28],O=e[29],B=e[30],Q=e[31],j=e[32],U=e[33],K=e[34],te=e[35],se=e[36],le=e[37],ae=e[38],me=e[39],ue=e[40];let _;e[57]!==E||e[58]!==L||e[59]!==ae||e[60]!==me||e[61]!==ue?(_=t.jsx(E,{id:ae,className:me,"aria-label":ue,children:L}),e[57]=E,e[58]=L,e[59]=ae,e[60]=me,e[61]=ue,e[62]=_):_=e[62];let J;e[63]!==o?(J=o.map(Kr),e[63]=o,e[64]=J):J=e[64];let Z;e[65]!==J?(Z=t.jsx(Ss,{children:J}),e[65]=J,e[66]=Z):Z=e[66];let ce;e[67]!==C||e[68]!==P||e[69]!==D||e[70]!==_||e[71]!==Z?(ce=t.jsxs(C,{value:P,onValueChange:D,children:[_,Z]}),e[67]=C,e[68]=P,e[69]=D,e[70]=_,e[71]=Z,e[72]=ce):ce=e[72];let fe;e[73]!==$||e[74]!==ce?(fe=t.jsx("div",{className:$,children:ce}),e[73]=$,e[74]=ce,e[75]=fe):fe=e[75];let ke;e[76]!==z||e[77]!==O||e[78]!==fe?(ke=t.jsxs("div",{className:z,children:[O,fe]}),e[76]=z,e[77]=O,e[78]=fe,e[79]=ke):ke=e[79];let ye;e[80]!==R||e[81]!==A||e[82]!==r||e[83]!==i?(ye=R.length===0?t.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):R.map(ne=>{const je=ne.id===r,Ne=A(ne.capabilities);return t.jsxs("button",{type:"button",className:ee("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",je?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{i(ne.id),S(!1)},children:[t.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/40 overflow-hidden shrink-0 flex items-center justify-center",children:ne.logo?t.jsx("img",{src:ne.logo,alt:ne.title,className:"w-full h-full object-contain"}):t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(ne.title||ne.id).slice(0,1).toUpperCase()})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate",children:ne.title}),ne.title!==ne.id&&t.jsx("div",{className:"text-xs text-muted-foreground truncate",children:ne.id})]}),Ne.length>0&&t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:Ne.map(be=>t.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:be},`${ne.id}-${be}`))})]},ne.id)}),e[80]=R,e[81]=A,e[82]=r,e[83]=i,e[84]=ye):ye=e[84];let ie;e[85]!==ye?(ie=t.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:ye}),e[85]=ye,e[86]=ie):ie=e[86];let De;e[87]!==T||e[88]!==B||e[89]!==Q||e[90]!==j||e[91]!==ke||e[92]!==ie?(De=t.jsxs(T,{className:B,align:Q,sideOffset:j,children:[ke,ie]}),e[87]=T,e[88]=B,e[89]=Q,e[90]=j,e[91]=ke,e[92]=ie,e[93]=De):De=e[93];let Te;e[94]!==N||e[95]!==U||e[96]!==K||e[97]!==te||e[98]!==De?(Te=t.jsxs(N,{open:U,onOpenChange:K,children:[te,De]}),e[94]=N,e[95]=U,e[96]=K,e[97]=te,e[98]=De,e[99]=Te):Te=e[99];let $e;return e[100]!==se||e[101]!==le||e[102]!==Te?($e=t.jsxs("div",{className:se,children:[le,Te]}),e[100]=se,e[101]=le,e[102]=Te,e[103]=$e):$e=e[103],$e}function Kr(s){return t.jsx(Rt,{value:s.id,children:t.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:s.icon?t.jsx("img",{src:s.icon,alt:s.title,className:"w-full h-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:s.title.slice(0,1).toUpperCase()})}),t.jsx("span",{className:"truncate",children:s.title})]})},s.id)}function Yr(s){const e=new Set((s??[]).map(Hr)),n=[];return e.has("text")&&n.push("Text"),e.has("vision")&&n.push("Vision"),e.has("tools")&&n.push("Tools"),n}function Hr(s){return s.toLowerCase()}function Wr({initialName:s,initialIcon:e,initialLLMConnectionId:n,initialLLMModelId:r,initialAcceptPublishRequests:o,initialRequireApiToken:l,initialStorePrivateOnly:a,initialRateLimitEnabled:i,initialRateLimitWindow:d,initialRateLimitMax:m,revealedKey:u,onRevealedKeyChange:x}){const{org:p}=de(),{uploadImage:h,isUploading:c}=Us(),{saveRegistryConfigMutation:v}=qt(Ke),[b,k]=I.useState(s),[S,y]=I.useState(e),[f,M]=I.useState(n),[g,w]=I.useState(r),[R,E]=I.useState(o),[C,T]=I.useState(l),[N,A]=I.useState(a),[L,P]=I.useState(i),[D,$]=I.useState(d),[z,O]=I.useState(String(m)),B=or(),{generateMutation:Q,revokeMutation:j}=cr(),[U,K]=I.useState(""),[te,se]=I.useState(!1),[le,ae]=I.useState(null),{handleCopy:me,copied:ue}=Qt(),{handleCopy:_,copied:J}=Qt(),{handleCopy:Z,copied:ce}=Qt(),fe=Ls({search:"",tags:[],categories:[],limit:50}),ye=(Ms()??[]).filter(V=>(V.tools??[]).some(ge=>ge.name==="LLM_DO_GENERATE")),ie=f||n||ye[0]?.id||"",De=gs({connectionId:ie||void 0,orgId:p.id}),Te=Is(ie||"no-llm-connection","LLM",De),$e=`${window.location.origin}/org/${p.slug}/registry/mcp`,je=(fe.data?.pages.flatMap(V=>V.items??[])??[]).filter(V=>V.is_public).length,Ne=`${window.location.origin}/org/${p.slug}/registry/publish-request`,be=u?.slice(0,12)??null,Oe=!!(be&&(B.data?.items??[]).some(V=>V.prefix===be)),Ae=b.trim()!==s.trim()||S.trim()!==e.trim()||f.trim()!==n.trim()||g.trim()!==r.trim()||R!==o||C!==l||N!==a||L!==i||D!==d||(Number.parseInt(z,10)||100)!==m,Se=v.isPending,Be=async V=>{if(!V)return;const ge=V.name.split(".").pop()||"png",st=`registry/${p.id}/identity/icon.${ge}`,Ge=await h(V,st);Ge?y(Ge):H.error("Failed to upload icon. Please try again.")},He=async()=>{const V=b.trim();if(!V)return;const ge=g.trim(),st=ge?f.trim()||ie||"":f.trim(),Ge=Number.parseInt(z,10),_t=Number.isFinite(Ge)&&Ge>=1?Ge:100;try{await v.mutateAsync({registryName:V,registryIcon:S.trim(),llmConnectionId:st,llmModelId:ge,acceptPublishRequests:R,requireApiToken:C,storePrivateOnly:N,rateLimitEnabled:L,rateLimitWindow:D,rateLimitMax:_t}),H.success("Registry settings updated")}catch(at){H.error(at instanceof Error?at.message:"Failed to save registry settings")}},lt=()=>{k(s),y(e),M(n),w(r),E(o),T(l),A(a),P(i),$(d),O(String(m))},we=async()=>{const V=U.trim();if(V)try{const ge=await Q.mutateAsync(V);ge?.key&&(x(ge.key),se(!1),K(""),H.success("API key generated. Copy it now — it won't be shown again!"))}catch(ge){H.error(ge instanceof Error?ge.message:"Failed to generate API key")}},tt=async V=>{try{await j.mutateAsync(V),x(null),ae(null),H.success("API key revoked")}catch(ge){H.error(ge instanceof Error?ge.message:"Failed to revoke API key")}};return t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[t.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4 min-h-[32px]",children:[Ae&&t.jsxs(G,{variant:"outline",size:"sm",onClick:lt,disabled:Se,children:[t.jsx(On,{size:14}),"Undo"]}),t.jsxs(G,{variant:"default",size:"sm",onClick:He,disabled:Se||!Ae,children:[Se?t.jsx(et,{size:14,className:"animate-spin"}):t.jsx(zn,{size:14}),"Save"]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(oe,{className:"min-w-0 p-4 grid gap-4 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Registry Identity"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the name and icon shown in the store selector."})]}),t.jsxs("div",{className:"grid gap-1.5",children:[t.jsx(re,{htmlFor:"identity-name",children:"Name"}),t.jsx(xe,{id:"identity-name",value:b,onChange:V=>k(V.target.value),placeholder:"Private Registry"})]}),t.jsx(Os,{value:S,onChange:y,onFileUpload:Be,isUploading:c})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"AI Configuration"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the default model used for AI suggestions."})]}),t.jsx(Fs,{connectionId:ie,modelId:g,connections:ye.map(V=>({id:V.id,title:V.title,icon:V.icon??null})),models:Te.map(V=>({id:V.id,title:V.title||V.id,logo:V.logo??null,capabilities:V.capabilities??[]})),onConnectionChange:V=>{M(V),w("")},onModelChange:w})]})]}),t.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Public Registry"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Public URL to consume this registry as an MCP."})]}),t.jsxs(F,{variant:"secondary",children:[je," ",je===1?"public item":"public items"]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:$e}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>me($e),children:ue?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Store Visibility"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what appears when users browse this registry in Store."})]}),t.jsx(Xe,{id:"store-private-only",checked:N,onCheckedChange:A})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Enabled: show only private apps. Disabled: show public and private apps together."}),N!==a&&t.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."})]}),t.jsxs(oe,{className:"min-w-0 p-4 grid gap-3 content-start",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-semibold",children:"Publish Requests"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow external users to submit MCP servers for review."})]}),t.jsx(Xe,{id:"accept-publish-requests",checked:R,onCheckedChange:E})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[t.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:Ne}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>_(Ne),children:J?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(re,{className:"text-sm font-medium",children:"Require API Token"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Requests without a valid token will be rejected."})]}),t.jsx(Xe,{id:"require-api-token",checked:C,onCheckedChange:T})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[t.jsxs("div",{children:[t.jsx(re,{className:"text-sm font-medium",children:"Rate Limit"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Limit publish requests per organization by time window."})]}),t.jsx(Xe,{id:"publish-rate-limit",checked:L,onCheckedChange:P})]}),L&&t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:"Max requests"}),t.jsx(xe,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:z,onChange:V=>O(V.target.value),placeholder:"100"})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:"Window"}),t.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:D,onChange:V=>$(V.target.value),children:[t.jsx("option",{value:"minute",children:"Per minute"}),t.jsx("option",{value:"hour",children:"Per hour"})]})]})]}),(R!==o||C!==l||L!==i||D!==d||(Number.parseInt(z,10)||100)!==m)&&t.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),R&&C&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[t.jsx(Un,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),u&&!Oe&&t.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"New key (refreshing list...)"}),t.jsx(xe,{readOnly:!0,value:u,className:"h-8 text-xs font-mono bg-background"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsxs("div",{className:"grid gap-1.5 flex-1",children:[t.jsx(re,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),t.jsx(xe,{id:"api-key-name",value:U,onChange:V=>K(V.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),t.jsxs(G,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!U.trim()||Q.isPending,onClick:we,children:[Q.isPending?t.jsx(et,{size:14,className:"animate-spin"}):t.jsx(qn,{size:14}),"Generate"]})]}),(B.data?.items?.length??0)>0&&t.jsx("div",{className:"grid gap-2",children:B.data?.items?.map(V=>t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[t.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-medium truncate leading-none",children:V.name}),be===V.prefix?t.jsx(xe,{readOnly:!0,value:te?u??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):t.jsx(xe,{readOnly:!0,value:`${V.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[be===V.prefix&&t.jsxs(t.Fragment,{children:[t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>se(ge=>!ge),children:te?t.jsx(Ln,{size:14}):t.jsx(Ts,{size:14})}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!u,onClick:()=>u&&Z(u),children:ce?t.jsx(Vt,{size:14}):t.jsx(Kt,{size:14})})]}),t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:j.isPending,onClick:()=>ae({id:V.id,name:V.name}),children:t.jsx(wt,{size:14})})]})]},V.id))})]})]})]})]}),t.jsx(yt,{open:!!le,onOpenChange:V=>{!V&&!j.isPending&&ae(null)},children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Revoke API key?"}),t.jsxs(ft,{children:["This action cannot be undone. The key",le?` "${le.name}"`:""," will stop working immediately."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{disabled:j.isPending,children:"Cancel"}),t.jsx(jt,{disabled:!le||j.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>le&&tt(le.id),children:j.isPending?"Revoking...":"Revoke key"})]})]})})]})}function Jr(s){const e=X.c(5),{results:n}=s;if(n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(oe,{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(Zr),e[1]=n,e[2]=r):r=e[2];let o;return e[3]!==r?(o=t.jsx("div",{className:"space-y-2",children:r}),e[3]=r,e[4]=o):o=e[4],o}function Zr(s){return t.jsx(Xr,{result:s},s.id)}function Xr(s){const e=X.c(49),{result:n}=s,[r,o]=I.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(si);let i;e[11]!==r?(i=()=>o(!r),e[11]=r,e[12]=i):i=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{className:"text-red-500 text-sm mt-0.5",children:"✗"}),e[13]=d):d=e[13];let m;e[14]!==n.item_title?(m=t.jsx("h4",{className:"text-sm font-medium truncate",children:n.item_title}),e[14]=n.item_title,e[15]=m):m=e[15];let u;e[16]!==n.status?(u=n.status.replace("_"," "),e[16]=n.status,e[17]=u):u=e[17];let x;e[18]!==u?(x=t.jsx(F,{variant:"destructive",className:"capitalize text-[10px] shrink-0",children:u}),e[18]=u,e[19]=x):x=e[19];let p;e[20]!==m||e[21]!==x?(p=t.jsxs("div",{className:"flex items-center gap-2",children:[m,x]}),e[20]=m,e[21]=x,e[22]=p):p=e[22];const h=n.connection_ok?"✓":"✗";let c;e[23]!==h?(c=t.jsxs("span",{children:["conn: ",h]}),e[23]=h,e[24]=c):c=e[24];const v=n.tools_listed?"✓":"✗";let b;e[25]!==v?(b=t.jsxs("span",{children:["tools listed: ",v]}),e[25]=v,e[26]=b):b=e[26];let k;e[27]!==n.duration_ms?(k=t.jsxs("span",{children:[n.duration_ms,"ms"]}),e[27]=n.duration_ms,e[28]=k):k=e[28];const S=a.length>0&&t.jsxs("span",{className:"text-red-600",children:[a.length," tool",a.length>1?"s":""," ","failed"]});let y;e[29]!==n.action_taken?(y=n.action_taken!=="none"&&t.jsx(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:n.action_taken.replace(/_/g," ")}),e[29]=n.action_taken,e[30]=y):y=e[30];let f;e[31]!==b||e[32]!==k||e[33]!==S||e[34]!==y||e[35]!==c?(f=t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[c,b,k,S,y]}),e[31]=b,e[32]=k,e[33]=S,e[34]=y,e[35]=c,e[36]=f):f=e[36];let M;e[37]!==n.error_message?(M=n.error_message&&t.jsx("p",{className:"text-xs text-red-600 line-clamp-2",children:n.error_message}),e[37]=n.error_message,e[38]=M):M=e[38];let g;e[39]!==f||e[40]!==M||e[41]!==p?(g=t.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p,f,M]}),e[39]=f,e[40]=M,e[41]=p,e[42]=g):g=e[42];const w=r?"▲":"▼";let R;e[43]!==w?(R=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:w}),e[43]=w,e[44]=R):R=e[44];let E;e[45]!==g||e[46]!==R||e[47]!==i?(E=t.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:[d,g,R]}),e[45]=g,e[46]=R,e[47]=i,e[48]=E):E=e[48],l=t.jsxs(oe,{className:"overflow-hidden",children:[E,r&&t.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[n.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Full Error"}),t.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})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),t.jsx("p",{className:ee("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),t.jsx("p",{className:ee("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),t.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]})]}),a.length>0&&t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-red-600",children:["Failed Tools (",a.length,")"]}),a.map(C=>t.jsxs("div",{className:"rounded border border-red-500/10 bg-red-500/5 px-2.5 py-1.5 space-y-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs font-mono font-medium text-red-700",children:C.toolName}),t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[C.durationMs,"ms"]})]}),C.error&&t.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-red-600",children:C.error})]},`${n.id}-${C.toolName}`))]}),n.tool_results.length>0&&n.tool_results.some(ti)&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Passing Tools"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:n.tool_results.filter(ei).map(C=>t.jsxs(F,{variant:"secondary",className:"text-[10px]",children:["✓ ",C.toolName]},`${n.id}-${C.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 ei(s){return s.success}function ti(s){return s.success}function si(s){return!s.success}const ni=[{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 ri(s){const n=s.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,d=Number(r),m=Number(o),u=Number(l),x=Number(i);return Number.isInteger(d)&&Number.isInteger(m)&&d>=0&&d<=59&&m>=0&&m<=23?l==="*"&&i==="*"?{frequency:"daily",minute:d,hour:m,weekDay:1,dayOfMonth:1}:l==="*/14"&&i==="*"?{frequency:"biweekly",minute:d,hour:m,weekDay:1,dayOfMonth:1}:l==="*"&&Number.isInteger(x)&&x>=0&&x<=6?{frequency:"weekly",minute:d,hour:m,weekDay:x,dayOfMonth:1}:i==="*"&&Number.isInteger(u)&&u>=1&&u<=31?{frequency:"monthly",minute:d,hour:m,weekDay:1,dayOfMonth:u}:{frequency:"custom",minute:d,hour:m,weekDay:1,dayOfMonth:1}:{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1}}function ii(s,e){return`${String(s).padStart(2,"0")}:${String(e).padStart(2,"0")}`}function St(s){return s.frequency==="daily"?`${s.minute} ${s.hour} * * *`:s.frequency==="weekly"?`${s.minute} ${s.hour} * * ${s.weekDay}`:s.frequency==="biweekly"?`${s.minute} ${s.hour} */14 * *`:s.frequency==="monthly"?`${s.minute} ${s.hour} ${s.dayOfMonth} * *`:s.currentValue}function li(s){const e=X.c(60),{value:n,onChange:r,disabled:o}=s,l=o===void 0?!1:o;let a;e[0]!==n?(a=ri(n),e[0]=n,e[1]=a):a=e[1];const i=a,d=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=D=>{if(D==="custom"){r(n);return}r(St({frequency:D,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 u=m;let x;e[9]!==r||e[10]!==i.dayOfMonth||e[11]!==i.frequency||e[12]!==i.weekDay||e[13]!==n?(x=D=>{const[$,z]=D.split(":"),O=Number($),B=Number(z);!Number.isInteger(O)||!Number.isInteger(B)||r(St({frequency:i.frequency,hour:O,minute:B,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]=x):x=e[14];const p=x;let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(re,{children:"Frequency"}),e[15]=h):h=e[15];let c;e[16]!==u?(c=D=>u(D.target.value),e[16]=u,e[17]=c):c=e[17];let v,b,k,S,y;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("option",{value:"daily",children:"Daily"}),S=t.jsx("option",{value:"weekly",children:"Weekly"}),y=t.jsx("option",{value:"biweekly",children:"Every 2 weeks"}),v=t.jsx("option",{value:"monthly",children:"Monthly"}),b=t.jsx("option",{value:"custom",children:"Custom (raw cron)"}),e[18]=v,e[19]=b,e[20]=k,e[21]=S,e[22]=y):(v=e[18],b=e[19],k=e[20],S=e[21],y=e[22]);let f;e[23]!==l||e[24]!==i.frequency||e[25]!==c?(f=t.jsxs("label",{className:"space-y-1",children:[h,t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.frequency,onChange:c,disabled:l,children:[k,S,y,v,b]})]}),e[23]=l,e[24]=i.frequency,e[25]=c,e[26]=f):f=e[26];let M;e[27]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(re,{children:"Time"}),e[27]=M):M=e[27];let g;e[28]!==i.hour||e[29]!==i.minute?(g=ii(i.hour,i.minute),e[28]=i.hour,e[29]=i.minute,e[30]=g):g=e[30];let w;e[31]!==p?(w=D=>p(D.target.value),e[31]=p,e[32]=w):w=e[32];const R=l||d;let E;e[33]!==g||e[34]!==w||e[35]!==R?(E=t.jsxs("label",{className:"space-y-1",children:[M,t.jsx(xe,{type:"time",value:g,onChange:w,disabled:R})]}),e[33]=g,e[34]=w,e[35]=R,e[36]=E):E=e[36];let C;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?(C=i.frequency==="weekly"?t.jsxs("label",{className:"space-y-1",children:[t.jsx(re,{children:"Day of week"}),t.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.weekDay,onChange:D=>r(St({frequency:"weekly",hour:i.hour,minute:i.minute,weekDay:Number(D.target.value),dayOfMonth:i.dayOfMonth,currentValue:n})),disabled:l,children:ni.map(ai)})]}):i.frequency==="monthly"?t.jsxs("label",{className:"space-y-1",children:[t.jsx(re,{children:"Day of month"}),t.jsx(xe,{type:"number",min:1,max:31,value:i.dayOfMonth,onChange:D=>{const $=Number(D.target.value);!Number.isInteger($)||$<1||$>31||r(St({frequency:"monthly",hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:$,currentValue:n}))},disabled:l})]}):t.jsxs("div",{className:"space-y-1",children:[t.jsx(re,{children:"Schedule notes"}),t.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]=C):C=e[45];let T;e[46]!==f||e[47]!==E||e[48]!==C?(T=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[f,E,C]}),e[46]=f,e[47]=E,e[48]=C,e[49]=T):T=e[49];let N;e[50]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(re,{children:"Raw cron expression"}),e[50]=N):N=e[50];let A;e[51]!==r?(A=D=>r(D.target.value),e[51]=r,e[52]=A):A=e[52];let L;e[53]!==l||e[54]!==A||e[55]!==n?(L=t.jsxs("label",{className:"space-y-1 block",children:[N,t.jsx(xe,{value:n,onChange:A,disabled:l,placeholder:"*/15 * * * *"})]}),e[53]=l,e[54]=A,e[55]=n,e[56]=L):L=e[56];let P;return e[57]!==T||e[58]!==L?(P=t.jsxs("div",{className:"space-y-2",children:[T,L]}),e[57]=T,e[58]=L,e[59]=P):P=e[59],P}function ai(s){return t.jsx("option",{value:s.value,children:s.label},s.value)}function oi(s,e){return s.onFailure!==e.onFailure||s.llmConnectionId!==e.llmConnectionId||s.llmModelId!==e.llmModelId||s.perMcpTimeoutMs!==e.perMcpTimeoutMs||s.perToolTimeoutMs!==e.perToolTimeoutMs||s.maxAgentSteps!==e.maxAgentSteps||s.testPublicOnly!==e.testPublicOnly||s.testPrivateOnly!==e.testPrivateOnly||s.includePendingRequests!==e.includePendingRequests||(s.agentContext??"")!==(e.agentContext??"")||s.schedule!==e.schedule||s.cronExpression!==e.cronExpression}function ci(){const{registryLLMConnectionId:s,registryLLMModelId:e}=qt(Ke),{settings:n,saveMutation:r}=$s(),o=Jn(),l=Zn(),a=I.useRef(n),[i,d]=I.useState(n),[m,u]=I.useState(!1),[x,p]=I.useState(!1),{org:h}=de(),v=(Ms()??[]).filter(g=>(g.tools??[]).some(w=>w.name==="LLM_DO_GENERATE")),b=i.llmConnectionId||s||v[0]?.id||"",k=gs({connectionId:b||void 0,orgId:h.id}),S=Is(b||"no-llm-connection","LLM",k);a.current!==n&&(a.current=n,d(n));const y=oi(i,n),f=g=>{u(!1),d(w=>({...w,...g}))},M=async()=>{const g=i.cronExpression?.trim()??"";let w=n.scheduleEventId??"";if(i.schedule==="cron"&&g.length>0){const T=g!==(n.cronExpression??"");T&&w&&await l.mutateAsync(w),(T||!w)&&(w=(await o.mutateAsync({cronExpression:g,config:i})).scheduleEventId)}else w&&(await l.mutateAsync(w),w="");const R=(i.llmModelId??"").trim(),E=R?(i.llmConnectionId||b||"").trim():(i.llmConnectionId??"").trim(),C={...i,cronExpression:g,scheduleEventId:w,agentContext:(i.agentContext??"").trim(),llmConnectionId:E,llmModelId:R};await r.mutateAsync(C),d(C),u(!0),setTimeout(()=>u(!1),3e3)};return t.jsxs(oe,{className:"p-4 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA Configuration"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure how the MCP QA agent validates registry entries."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[y&&t.jsx(F,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"Unsaved changes"}),m&&t.jsx(F,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 text-[10px]",children:"✓ Saved"}),t.jsx(G,{size:"sm",onClick:M,disabled:r.isPending||o.isPending||l.isPending||!y,children:r.isPending||o.isPending||l.isPending?"Saving...":"Save settings"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"On failure",hint:"Automatic action to apply when an MCP fails tests in a run."}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.onFailure,onChange:g=>f({onFailure:g.target.value}),children:[t.jsx("option",{value:"none",children:"Do nothing"}),t.jsx("option",{value:"unlisted",children:"Unlist from store (keep in registry)"}),t.jsx("option",{value:"remove_public",children:"Remove from public store"}),t.jsx("option",{value:"remove_private",children:"Remove from private registry"}),t.jsx("option",{value:"remove_all",children:"Remove from all (public + private)"})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Test scope",hint:"Choose whether tests should run for public items, private items, or both."}),t.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.testPublicOnly,onChange:g=>f({testPublicOnly:g.target.checked,testPrivateOnly:g.target.checked?!1:i.testPrivateOnly})}),"Public only"]}),t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.testPrivateOnly,onChange:g=>f({testPrivateOnly:g.target.checked,testPublicOnly:g.target.checked?!1:i.testPublicOnly})}),"Private only"]})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Publish requests",hint:"Include pending publish requests in QA runs to validate them before publishing to the store."}),t.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:t.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[t.jsx("input",{type:"checkbox",checked:i.includePendingRequests,onChange:g=>f({includePendingRequests:g.target.checked})}),"Include pending requests in tests"]})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsx(Ve,{label:"Model (LLM binding)",hint:"Used only in Agentic mode to decide and chain tool calls."}),t.jsx(Fs,{connectionId:b,modelId:i.llmModelId??"",connections:v.map(g=>({id:g.id,title:g.title,icon:g.icon??null})),models:S.map(g=>({id:g.id,title:g.title||g.id,logo:g.logo??null,capabilities:g.capabilities??[]})),onConnectionChange:g=>f({llmConnectionId:g,llmModelId:""}),onModelChange:g=>f({llmModelId:g})})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx(Ve,{label:"Additional test context (prompt)",hint:"Extra runtime context passed to the agent, such as valid emails, tenant IDs, or known test entities."}),t.jsxs(G,{size:"sm",variant:"outline",className:"h-7",onClick:()=>p(g=>!g),children:[x?"Hide":"View"," default system prompt"]})]}),t.jsx(zt,{value:i.agentContext??"",onChange:g=>f({agentContext:g.target.value}),placeholder:'Example: Use "my-user@company.com" as a valid email for Google Drive share/create_permission tests.',rows:3}),t.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)."}),x&&t.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:pn})]}),t.jsxs("div",{className:"space-y-1 md:col-span-2",children:[t.jsx(Ve,{label:"Schedule",hint:"Set automatic test runs. Manual mode runs only when you click Start QA run."}),t.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.schedule??"manual",onChange:g=>f({schedule:g.target.value}),children:[t.jsx("option",{value:"manual",children:"Manual only"}),t.jsx("option",{value:"cron",children:"Cron schedule"})]}),(i.schedule??"manual")==="cron"&&t.jsx(li,{value:i.cronExpression??"",onChange:g=>f({cronExpression:g})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Per MCP timeout (ms)",hint:"Max total time allowed to validate one MCP."}),t.jsx(xe,{type:"number",value:i.perMcpTimeoutMs,onChange:g=>f({perMcpTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Per tool timeout (ms)",hint:"Max time allowed for each individual tool call."}),t.jsx(xe,{type:"number",value:i.perToolTimeoutMs,onChange:g=>f({perToolTimeoutMs:Number(g.target.value)})})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx(Ve,{label:"Max agent steps",hint:"Maximum number of reasoning/tool steps in Agentic mode."}),t.jsx(xe,{type:"number",value:i.maxAgentSteps,onChange:g=>f({maxAgentSteps:Number(g.target.value)}),min:1,max:30})]})]}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:["LLM fallback from Settings:"," ",t.jsxs("span",{className:"font-mono",children:[s||"-"," / ",e||"-"]})]})]})}function Ve(s){const e=X.c(13),{label:n,hint:r}=s;let o;e[0]!==n?(o=t.jsx(re,{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=t.jsx(Rn,{size:14}),e[2]=a):a=e[2];let i;e[3]!==l?(i=t.jsx(Fn,{asChild:!0,children:t.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 d;e[5]!==r?(d=t.jsx(Bn,{side:"top",className:"max-w-72",children:r}),e[5]=r,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==d?(m=t.jsxs(Gn,{children:[i,d]}),e[7]=i,e[8]=d,e[9]=m):m=e[9];let u;return e[10]!==o||e[11]!==m?(u=t.jsxs("div",{className:"flex items-center gap-1.5",children:[o,m]}),e[10]=o,e[11]=m,e[12]=u):u=e[12],u}function di(s){switch(s){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 mi(s){switch(s){case"authenticated":return"Authenticated";case"needs_auth":return"Needs Auth";default:return"Not checked"}}function ui({entry:s,onAuthChanged:e,failedToolsCount:n,failedResultCount:r}){const[o,l]=I.useState(!1),[a,i]=I.useState(""),[d,m]=I.useState(!1),u=Wn(),{updateMutation:x}=Xt(),p=s.mapping.connection_id,h=s.mapping.auth_status,c=s.item?.title??s.mapping.item_id,v=s.item?.server?.icons?.[0]?.src??null,b=s.item?.is_public??!1,k=s.item?.is_unlisted??!1,S=s.source==="request",y=Fe({queryKey:W.monitorConnectionAuthProbe(p),queryFn:async()=>gn({url:`/mcp/${p}`,token:null}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),f=y.data,M=y.isLoading,g=f?.supportsOAuth??!1,w=f?.hasOAuthToken??!1,R=f?.isServerError??!1,E=f?.isAuthenticated??!1,C=M?"checking":R?"server_error":g?E?w?"oauth_connected":"connected":"oauth_available":E?"connected":"token_required",T=()=>{u.mutate({connectionId:p,authStatus:"authenticated"},{onSuccess:()=>e()})},N=async()=>{l(!0);try{const z=(await y.refetch()).data;if(!z){H.error(`Could not reach "${c}". The remote MCP may be down.`);return}if(z.isAuthenticated){H.success(`"${c}" is reachable. You can re-authenticate if needed.`);return}if(z.isServerError){H.error(`Server error for "${c}". The remote MCP may be down.`);return}if(!z.supportsOAuth){H.warning(`"${c}" does not support OAuth. Use the Token field to paste an API key.`);return}H.info(`Opening authentication window for "${c}"...`);const O=await fn({connectionId:p,clientName:`MCP Test - ${c}`,timeout:18e4});if(O.error){H.error(`OAuth failed for "${c}": ${O.error}`);return}O.tokenInfo?(await fetch(`/api/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:O.tokenInfo.accessToken,refreshToken:O.tokenInfo.refreshToken,expiresIn:O.tokenInfo.expiresIn,scope:O.tokenInfo.scope,clientId:O.tokenInfo.clientId,clientSecret:O.tokenInfo.clientSecret,tokenEndpoint:O.tokenInfo.tokenEndpoint})})).ok||O.token&&await A(O.token):O.token&&await A(O.token),H.success(`"${c}" authenticated!`),T(),await y.refetch()}catch($){console.error("[MonitorConnectionsPanel] Auth error:",$),H.error(`Error: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},A=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:p,data:{connection_token:$}}}})})).ok)throw new Error("Failed to save token")},L=async()=>{if(!a.trim()){H.error("Token cannot be empty.");return}l(!0);try{await A(a),H.success(`Token saved for "${c}"!`),m(!1),i(""),T(),await y.refetch()}catch($){H.error(`Error saving token: ${$ instanceof Error?$.message:String($)}`)}finally{l(!1)}},P=h==="authenticated"&&!w&&!d&&a.length===0,D=async $=>{if(S){H.info("Visibility controls are available only for store items.");return}if(!s.item){H.error("Registry item not found for this connection.");return}try{await x.mutateAsync({id:s.item.id,data:$}),H.success("Visibility updated"),e()}catch(z){H.error(z instanceof Error?z.message:"Failed to update visibility")}};return t.jsxs(oe,{className:"p-3 space-y-3 h-full",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:v?t.jsx("img",{src:v,alt:c,className:"h-full w-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:c.charAt(0).toUpperCase()})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:c}),t.jsx("p",{className:"text-xs text-muted-foreground break-all",children:s.remoteUrl??"-"}),t.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[t.jsx(F,{variant:"outline",className:ee("text-[10px]",di(h)),children:mi(h)}),t.jsx(F,{variant:b?"default":"secondary",className:"text-[10px]",children:b?"Public":"Not public"}),t.jsx(F,{variant:"outline",className:"text-[10px]",children:S?"Request":"Store"}),t.jsxs(F,{variant:"outline",className:ee("text-[10px]",C==="server_error"?"border-destructive/40 text-destructive":C==="oauth_connected"?"border-emerald-500/30 text-emerald-600":C==="oauth_available"?"border-sky-500/30 text-sky-600":C==="token_required"?"border-amber-500/30 text-amber-600":"text-muted-foreground"),children:[C==="checking"&&"Checking auth...",C==="server_error"&&"Server error",C==="oauth_connected"&&"OAuth connected",C==="oauth_available"&&"OAuth available",C==="token_required"&&"Token/manual auth",C==="connected"&&"Connected"]}),k&&t.jsx(F,{variant:"outline",className:"text-[10px]",children:"Hidden in private"}),(r>0||n>0)&&t.jsxs(F,{variant:"destructive",className:"text-[10px]",children:[r," failed MCP / ",n," failed tools"]})]})]})]}),t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:t.jsxs(It,{children:[t.jsx(Tt,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:t.jsx(Ht,{size:16})})}),t.jsx(Mt,{align:"end",children:S?t.jsx(Ee,{disabled:!0,children:"Request item (no store visibility controls)"}):t.jsxs(t.Fragment,{children:[t.jsx(Ee,{onClick:()=>D({is_public:!1}),children:"Hide from public store"}),t.jsx(Ee,{onClick:()=>D({is_unlisted:!0}),children:"Hide from private store"}),t.jsx(Ee,{onClick:()=>D({is_public:!0,is_unlisted:!1}),children:"Show in both stores"})]})})]})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[g&&t.jsx(G,{size:"sm",onClick:N,disabled:o,children:o?"...":w?"Re-auth OAuth":"OAuth"}),t.jsx(G,{size:"sm",variant:"outline",onClick:()=>y.refetch(),disabled:o||M,children:M?"Checking...":"Re-check"})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Token/API key (for MCPs that require manual auth)"}),P?t.jsxs("div",{className:"relative group",children:[t.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:"••••••••••••••••"}),t.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"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(xe,{type:"password",placeholder:"Paste API token / key...",value:a,onChange:$=>i($.target.value),className:"h-8 text-xs flex-1",onKeyDown:$=>{$.key==="Enter"&&L()}}),t.jsx(G,{size:"sm",className:"h-8 text-xs",onClick:L,disabled:o||!a.trim(),children:"Save"}),t.jsx(G,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{m(!1),i("")},children:"✕"})]})]})]})}function xi(){const s=X.c(55),e=Ds(),r=Ut("completed").data?.items?.[0],o=Ct(r?.id,void 0,r?.status),l=Hn(),[a,i]=I.useState("all");let d,m,u,x,p,h;if(s[0]!==e||s[1]!==o.data?.items||s[2]!==a||s[3]!==l){const b=e.data?.items??[];let k;s[10]!==o.data?.items?(k=(o.data?.items??[]).reduce(fi,{}),s[10]=o.data?.items,s[11]=k):k=s[11];const S=k;let y;s[12]!==a?(y=te=>a==="all"?!0:te.source===a,s[12]=a,s[13]=y):y=s[13];const f=b.filter(y);d=oe,p="p-4 space-y-3";let M,g,w,R;s[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("h3",{className:"text-sm font-semibold",children:"QA Connections"}),w=t.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."}),R=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Listing tools alone does not imply authenticated status."}),M=t.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Cards show MCP icon, auth status, and latest failed test counters."}),s[14]=M,s[15]=g,s[16]=w,s[17]=R):(M=s[14],g=s[15],w=s[16],R=s[17]);const E=a==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let C;s[18]!==E?(C=ee("px-2.5 py-1 text-xs rounded-md transition-colors",E),s[18]=E,s[19]=C):C=s[19];let T;s[20]===Symbol.for("react.memo_cache_sentinel")?(T=()=>i("all"),s[20]=T):T=s[20];let N;s[21]!==C?(N=t.jsx("button",{type:"button",className:C,onClick:T,children:"All"}),s[21]=C,s[22]=N):N=s[22];const A=a==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let L;s[23]!==A?(L=ee("px-2.5 py-1 text-xs rounded-md transition-colors",A),s[23]=A,s[24]=L):L=s[24];let P;s[25]===Symbol.for("react.memo_cache_sentinel")?(P=()=>i("store"),s[25]=P):P=s[25];let D;s[26]!==L?(D=t.jsx("button",{type:"button",className:L,onClick:P,children:"Store"}),s[26]=L,s[27]=D):D=s[27];const $=a==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let z;s[28]!==$?(z=ee("px-2.5 py-1 text-xs rounded-md transition-colors",$),s[28]=$,s[29]=z):z=s[29];let O;s[30]===Symbol.for("react.memo_cache_sentinel")?(O=()=>i("request"),s[30]=O):O=s[30];let B;s[31]!==z?(B=t.jsx("button",{type:"button",className:z,onClick:O,children:"Requests"}),s[31]=z,s[32]=B):B=s[32];let Q;s[33]!==N||s[34]!==D||s[35]!==B?(Q=t.jsxs("div",{children:[g,w,R,M,t.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[N,D,B]})]}),s[33]=N,s[34]=D,s[35]=B,s[36]=Q):Q=s[36];let j;s[37]!==l?(j=()=>{l.mutate(void 0,{onSuccess:pi,onError:hi})},s[37]=l,s[38]=j):j=s[38];const U=l.isPending?"Syncing...":"Sync";let K;s[39]!==l.isPending||s[40]!==j||s[41]!==U?(K=t.jsx(G,{size:"sm",variant:"outline",onClick:j,disabled:l.isPending,children:U}),s[39]=l.isPending,s[40]=j,s[41]=U,s[42]=K):K=s[42],s[43]!==Q||s[44]!==K?(h=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[Q,K]}),s[43]=Q,s[44]=K,s[45]=h):h=s[45],m="space-y-2",u=f.length===0&&t.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.'}),x=f.length>0&&t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:f.map(te=>{const se=S[te.mapping.item_id]??{failedTools:0,failedResults:0};return t.jsx(ui,{entry:te,onAuthChanged:()=>e.refetch(),failedToolsCount:se.failedTools,failedResultCount:se.failedResults},te.mapping.id)})}),s[0]=e,s[1]=o.data?.items,s[2]=a,s[3]=l,s[4]=d,s[5]=m,s[6]=u,s[7]=x,s[8]=p,s[9]=h}else d=s[4],m=s[5],u=s[6],x=s[7],p=s[8],h=s[9];let c;s[46]!==m||s[47]!==u||s[48]!==x?(c=t.jsxs("div",{className:m,children:[u,x]}),s[46]=m,s[47]=u,s[48]=x,s[49]=c):c=s[49];let v;return s[50]!==d||s[51]!==p||s[52]!==h||s[53]!==c?(v=t.jsxs(d,{className:p,children:[h,c]}),s[50]=d,s[51]=p,s[52]=h,s[53]=c,s[54]=v):v=s[54],v}function hi(s){return H.error(`Sync failed: ${s.message}`)}function pi(){return H.success("Connections synced (store + pending requests)")}function fi(s,e){const n=s[e.item_id]??{failedTools:0,failedResults:0},r=e.tool_results.filter(gi).length;return n.failedTools=n.failedTools+r,(e.status==="failed"||e.status==="error")&&(n.failedResults=n.failedResults+1),s[e.item_id]=n,s}function gi(s){return!s.success}function Bs(s){switch(s){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(s,e){if(!s)return null;const n=e?new Date(e).getTime():Date.now(),r=new Date(s).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(s){const e=new Map;for(const n of s)e.has(n.toolName)&&e.delete(n.toolName),e.set(n.toolName,n);return Array.from(e.values())}function ji(s){return s.total_items?Math.min(100,Math.round(s.tested_items/s.total_items*100)):0}function vi(s){if(!s)return null;const e=s.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 bi(s){const e=X.c(57),{result:n,index:r,icon:o}=s,[l,a]=I.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 d=Qs(n.tool_results),m=d.every(Ci),u=d.filter(wi),x=u.filter(Ni).length,p=u.filter(yi).length,h=u.length>0,c=u.length;let v;e[14]!==n.agent_summary?(v=vi(n.agent_summary),e[14]=n.agent_summary,e[15]=v):v=e[15];const b=v,k=Math.max(d.length,b??0),S=k>0?`${c}/${k} tools tested`:"0 tools";let y;e[16]!==l?(y=()=>a(!l),e[16]=l,e[17]=y):y=e[17];const f=r+1;let M;e[18]!==f?(M=t.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:f}),e[18]=f,e[19]=M):M=e[19];let g;e[20]!==o||e[21]!==n.item_title?(g=t.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:o?t.jsx("img",{src:o,alt:n.item_title,className:"h-full w-full object-cover",loading:"lazy"}):t.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]=g):g=e[22];const w=n.status==="passed"?"text-emerald-600":n.status==="needs_auth"?"text-amber-600":"text-red-600";let R;e[23]!==w?(R=ee("shrink-0",w),e[23]=w,e[24]=R):R=e[24];const E=n.status==="passed"?"✓":n.status==="needs_auth"?"🔑":"✗";let C;e[25]!==R||e[26]!==E?(C=t.jsx("span",{className:R,children:E}),e[25]=R,e[26]=E,e[27]=C):C=e[27];let T;e[28]!==n.item_title?(T=t.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:n.item_title}),e[28]=n.item_title,e[29]=T):T=e[29];let N;e[30]!==n.duration_ms?(N=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.duration_ms,"ms"]}),e[30]=n.duration_ms,e[31]=N):N=e[31];const A=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 L;e[32]!==A?(L=ee("text-[9px] capitalize shrink-0",A),e[32]=A,e[33]=L):L=e[33];let P;e[34]!==n.status?(P=n.status.replace("_"," "),e[34]=n.status,e[35]=P):P=e[35];let D;e[36]!==L||e[37]!==P?(D=t.jsx(F,{variant:"outline",className:L,children:P}),e[36]=L,e[37]=P,e[38]=D):D=e[38];let $;e[39]!==n.connection_ok?($=n.connection_ok?t.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"conn✓"}):t.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&&t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:h?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-emerald-600",children:[x,"✓"]})," ",t.jsxs("span",{className:ee(p>0?"text-red-600":""),children:[p,"✗"]})]}):m&&d.length>0?t.jsxs("span",{children:[d.length," tools found"]}):"no tools"});let O;e[41]!==S?(O=t.jsx(F,{variant:"outline",className:"text-[9px] shrink-0",children:S}),e[41]=S,e[42]=O):O=e[42];const B=l?"▲":"▼";let Q;e[43]!==B?(Q=t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:B}),e[43]=B,e[44]=Q):Q=e[44];let j;e[45]!==C||e[46]!==T||e[47]!==N||e[48]!==D||e[49]!==$||e[50]!==z||e[51]!==O||e[52]!==Q||e[53]!==y||e[54]!==M||e[55]!==g?(j=t.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:y,children:[M,g,C,T,N,D,$,z,O,Q]}),e[45]=C,e[46]=T,e[47]=N,e[48]=D,e[49]=$,e[50]=z,e[51]=O,e[52]=Q,e[53]=y,e[54]=M,e[55]=g,e[56]=j):j=e[56],i=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[j,l&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[n.error_message&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),t.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})]}),t.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[t.jsxs("span",{children:["Connection:"," ",t.jsx("span",{className:ee(n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),t.jsxs("span",{children:["Tools listed:"," ",t.jsx("span",{className:ee(n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),n.action_taken!=="none"&&t.jsxs(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]})]}),h?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools tested: ",x," passed, ",p," failed"]}),t.jsx("div",{className:"space-y-0.5",children:u.map((U,K)=>t.jsx(_i,{tool:U},`${n.id}-${U.toolName}-${K}`))})]}):m&&d.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",d.length,") - not individually tested (health-check mode)"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:d.map((U,K)=>t.jsx(F,{variant:"outline",className:"text-[10px] font-mono",children:U.toolName},`${n.id}-${U.toolName}-${K}`))})]}):n.tools_listed?t.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No tools found on this server."}):null,n.agent_summary&&t.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 yi(s){return!s.success}function Ni(s){return s.success}function wi(s){return s.outputPreview!=="health_check: not called"}function Ci(s){return s.outputPreview==="health_check: not called"}function _i(s){const e=X.c(30),{tool:n}=s,[r,o]=I.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=ee("font-bold",a),e[2]=a,e[3]=i):i=e[3];const d=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==d?(m=t.jsx("span",{className:i,children:d}),e[4]=i,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=t.jsx("span",{className:"font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=u):u=e[8];let x;e[9]!==n.durationMs?(x=t.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=x):x=e[10];let p;e[11]!==n.error?(p=n.error&&t.jsx("span",{className:"text-red-500 truncate max-w-28",title:n.error,children:n.error}),e[11]=n.error,e[12]=p):p=e[12];const h=r?"▲":"▼";let c;e[13]!==h?(c=t.jsx("span",{className:"text-muted-foreground",children:h}),e[13]=h,e[14]=c):c=e[14];let v;e[15]!==l||e[16]!==c||e[17]!==m||e[18]!==u||e[19]!==x||e[20]!==p?(v=t.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,u,x,p,c]}),e[15]=l,e[16]=c,e[17]=m,e[18]=u,e[19]=x,e[20]=p,e[21]=v):v=e[21];let b;e[22]!==r||e[23]!==n.error||e[24]!==n.input||e[25]!==n.outputPreview?(b=r&&t.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[n.error&&t.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&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),t.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&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output"}),t.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]=b):b=e[26];let k;return e[27]!==v||e[28]!==b?(k=t.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[v,b]}),e[27]=v,e[28]=b,e[29]=k):k=e[29],k}function ki({activeRunId:s,onRunChange:e}){const{settings:n}=$s(),[r,o]=I.useState(null),[l,a]=I.useState(!1),i=I.useRef(0),d=I.useRef(null),m=Vn(),u=Kn(),x=Zt(s),p=Ut(),h=Ds(),c=x.data?.run??null,v=c?.status,b=c?.config_snapshot?.monitorMode??c?.config_snapshot?.testMode,k=Ct(s,void 0,v),S=(p.data?.items??[]).find(N=>N.status==="running"),y=p.data?.items?.[0]?.id;!s&&y&&d.current!==y&&(d.current=y,queueMicrotask(()=>{e(y)}));const f=async()=>{const N=Date.now();if(N-i.current<1e3)return;i.current=N;const A=r??n.monitorMode,L=await m.mutateAsync({...n,monitorMode:A});e(L.run.id)},M=async()=>{if(S&&S.id!==s&&S.status==="running"){a(!0);return}await f()},g=async()=>{s&&await u.mutateAsync(s)},w=c?.status==="running",R=c?Gs(c.started_at,c.finished_at):null,E=k.data?.items??[],C=(h.data?.items??[]).reduce((N,A)=>(N[A.mapping.item_id]=A.item?.server?.icons?.[0]?.src??null,N),{}),T=r??n.monitorMode;return t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs("div",{className:"space-y-4 min-w-0",children:[t.jsxs(oe,{className:"p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Current QA Run"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a full QA validation run and track results in real time."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[S&&S.id!==s&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["Run in progress: ",S.id.slice(0,8)]}),t.jsxs(G,{size:"sm",onClick:M,disabled:m.isPending||w,className:"gap-1.5",children:[t.jsx(Qn,{size:14}),m.isPending?"Starting...":S&&S.id!==s?"Start another run":"Start QA run"]}),t.jsxs(G,{size:"sm",variant:"outline",onClick:g,disabled:!s||!w,className:"gap-1.5",children:[t.jsx(Es,{size:14}),"Cancel"]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA mode"}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:T,onChange:N=>o(N.target.value),disabled:w,children:[t.jsx("option",{value:"health_check",children:"Health check"}),t.jsx("option",{value:"tool_call",children:"Tool call"}),t.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),t.jsxs("label",{className:"space-y-1",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA run history (pick a previous run)"}),t.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:s??"",onChange:N=>e(N.target.value||void 0),children:[t.jsx("option",{value:"",children:"Auto-select latest run"}),(p.data?.items??[]).map(N=>t.jsxs("option",{value:N.id,children:[new Date(N.created_at).toLocaleString()," -"," ",N.status]},N.id))]})]})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:T==="health_check"?"Checks connectivity and tool listing only — no tool calls are made.":T==="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."}),c?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[t.jsx(F,{className:ee("capitalize",Bs(c.status),c.status==="running"?"animate-pulse":""),children:c.status}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.tested_items,"/",c.total_items," tested"]}),R&&t.jsx("span",{className:"text-xs text-muted-foreground",children:R}),w&&c.current_item_id&&t.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:["QA on:"," ",t.jsx("span",{className:"font-mono",children:c.current_item_id})]})]}),t.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:t.jsx("div",{className:ee("h-full transition-all duration-500",c.failed_items>0?"bg-orange-500":"bg-emerald-500",w?"animate-pulse":""),style:{width:`${ji(c)}%`}})}),t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),t.jsx("p",{className:"text-lg font-bold text-emerald-600",children:c.passed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),t.jsx("p",{className:"text-lg font-bold text-red-600",children:c.failed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),t.jsx("p",{className:"text-lg font-bold",children:c.skipped_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),t.jsx("p",{className:"text-lg font-bold",children:c.total_items})]})]})]}):t.jsx("p",{className:"text-xs text-muted-foreground",children:"No run selected yet. Start a new run to begin."})]}),t.jsxs(oe,{className:"p-4 space-y-2 min-h-[360px]",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("h3",{className:"text-sm font-semibold",children:["QA results log (",E.length,")"]}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Live per-MCP test output for the selected run."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[w&&t.jsx(F,{className:"bg-blue-500/10 text-blue-600 border-blue-500/20 animate-pulse",children:"run in progress"}),c&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["progress: ",c.tested_items," of ",c.total_items," MCPs"]}),b&&t.jsxs(F,{variant:"outline",className:"text-[10px]",children:["mode: ",b.replace("_"," ")]})]})]}),E.length===0?t.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."}):t.jsx("div",{ref:N=>{N&&w&&N.scrollHeight-N.scrollTop-N.clientHeight<120&&requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:E.map((N,A)=>t.jsx(bi,{result:N,index:A,icon:C[N.item_id]},N.id))})]})]}),t.jsx(yt,{open:l,onOpenChange:a,children:t.jsxs(bt,{children:[t.jsxs(pt,{children:[t.jsx(ht,{children:"Start another test run?"}),t.jsxs(ft,{children:["There is already a run in progress",S?` (${S.id})`:"",". Starting another run may increase database load and slow down both executions."]})]}),t.jsxs(vt,{children:[t.jsx(gt,{children:"Cancel"}),t.jsx(jt,{onClick:()=>{a(!1),f()},children:"Start anyway"})]})]})})]})}function Vs(s){switch(s){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 Si(s){switch(s){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function Ri(s){const e=X.c(27),{tool:n}=s,[r,o]=I.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=ee("text-xs font-bold",a),e[2]=a,e[3]=i):i=e[3];const d=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==d?(m=t.jsx("span",{className:i,children:d}),e[4]=i,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=t.jsx("span",{className:"text-xs font-mono truncate flex-1",children:n.toolName}),e[7]=n.toolName,e[8]=u):u=e[8];let x;e[9]!==n.durationMs?(x=t.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[n.durationMs,"ms"]}),e[9]=n.durationMs,e[10]=x):x=e[10];const p=r?"▲":"▼";let h;e[11]!==p?(h=t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p}),e[11]=p,e[12]=h):h=e[12];let c;e[13]!==l||e[14]!==m||e[15]!==u||e[16]!==x||e[17]!==h?(c=t.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,u,x,h]}),e[13]=l,e[14]=m,e[15]=u,e[16]=x,e[17]=h,e[18]=c):c=e[18];let v;e[19]!==r||e[20]!==n.error||e[21]!==n.input||e[22]!==n.outputPreview?(v=r&&t.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[n.error&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),t.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&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),t.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&&t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output preview"}),t.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)&&t.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]=v):v=e[23];let b;return e[24]!==c||e[25]!==v?(b=t.jsxs("div",{className:"rounded border border-border",children:[c,v]}),e[24]=c,e[25]=v,e[26]=b):b=e[26],b}function Ti(s){const e=X.c(52),{result:n}=s,[r,o]=I.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(Ei),d=a.filter(Pi),m=d.filter(Mi).length,u=d.filter(Ii).length,x=d.length>0;let p;e[12]!==r?(p=()=>o(!r),e[12]=r,e[13]=p):p=e[13];let h;e[14]!==n.status?(h=Si(n.status),e[14]=n.status,e[15]=h):h=e[15];let c;e[16]!==h?(c=t.jsx("span",{className:"text-base shrink-0",children:h}),e[16]=h,e[17]=c):c=e[17];let v;e[18]!==n.item_title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.item_title}),e[18]=n.item_title,e[19]=v):v=e[19];let b;e[20]!==n.duration_ms?(b=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.duration_ms,"ms"]}),e[20]=n.duration_ms,e[21]=b):b=e[21];const k=n.connection_ok?"✓":"✗";let S;e[22]!==k?(S=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["conn: ",k]}),e[22]=k,e[23]=S):S=e[23];const y=n.tools_listed?"✓":"✗";let f;e[24]!==y?(f=t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["tools listed: ",y]}),e[24]=y,e[25]=f):f=e[25];const M=a.length>0&&t.jsx("span",{className:"text-[10px] text-muted-foreground",children:x?t.jsxs(t.Fragment,{children:["tools: ",m,"✓ ",u,"✗"]}):t.jsxs(t.Fragment,{children:[a.length," tools found"]})});let g;e[26]!==n.action_taken?(g=n.action_taken!=="none"&&t.jsxs(F,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]}),e[26]=n.action_taken,e[27]=g):g=e[27];let w;e[28]!==f||e[29]!==M||e[30]!==g||e[31]!==b||e[32]!==S?(w=t.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[b,S,f,M,g]}),e[28]=f,e[29]=M,e[30]=g,e[31]=b,e[32]=S,e[33]=w):w=e[33];let R;e[34]!==w||e[35]!==v?(R=t.jsxs("div",{className:"min-w-0 flex-1",children:[v,w]}),e[34]=w,e[35]=v,e[36]=R):R=e[36];let E;e[37]!==n.status?(E=ee("capitalize shrink-0",Vs(n.status)),e[37]=n.status,e[38]=E):E=e[38];let C;e[39]!==n.status?(C=n.status.replace("_"," "),e[39]=n.status,e[40]=C):C=e[40];let T;e[41]!==E||e[42]!==C?(T=t.jsx(F,{className:E,children:C}),e[41]=E,e[42]=C,e[43]=T):T=e[43];const N=r?"▲":"▼";let A;e[44]!==N?(A=t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:N}),e[44]=N,e[45]=A):A=e[45];let L;e[46]!==R||e[47]!==T||e[48]!==A||e[49]!==p||e[50]!==c?(L=t.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:p,children:[c,R,T,A]}),e[46]=R,e[47]=T,e[48]=A,e[49]=p,e[50]=c,e[51]=L):L=e[51],l=t.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[L,r&&t.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),t.jsx("p",{className:ee("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"Connected":"Failed"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),t.jsx("p",{className:ee("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?`Yes (${a.length})`:"No"})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),t.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]}),t.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Action Taken"}),t.jsx("p",{className:"text-xs font-medium capitalize",children:n.action_taken.replace(/_/g," ")})]})]}),n.error_message&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error Message"}),t.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})]}),x?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tool Results (",m," passed, ",u," failed)"]}),t.jsx("div",{className:"space-y-1",children:d.map((P,D)=>t.jsx(Ri,{tool:P},`${n.id}-${P.toolName}-${D}`))})]}):i&&a.length>0?t.jsxs("div",{className:"space-y-1",children:[t.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",a.length,") — not individually tested (health-check mode)"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:a.map((P,D)=>t.jsx(F,{variant:"outline",className:"text-[10px] font-mono",children:P.toolName},`${n.id}-${P.toolName}-${D}`))})]}):null,n.agent_summary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Agent Summary"}),t.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 Ii(s){return!s.success}function Mi(s){return s.success}function Pi(s){return s.outputPreview!=="health_check: not called"}function Ei(s){return s.outputPreview==="health_check: not called"}function Di(s){const e=X.c(4),{value:n,onChange:r}=s;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=t.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(i=>t.jsx("button",{type:"button",className:ee("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 $i(s){const e=X.c(46),{runId:n}=s,[r,o]=I.useState("all"),l=Zt(n),a=l.data?.run,i=Ct(n,void 0,a?.status);let d;e[0]!==i.data?.items?(d=i.data?.items??[],e[0]=i.data?.items,e[1]=d):d=e[1];const m=d;let u;e[2]!==m||e[3]!==r?(u=r==="all"?m:m.filter(N=>N.status===r),e[2]=m,e[3]=r,e[4]=u):u=e[4];const x=u;if(!n){let N;return e[5]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(oe,{className:"p-6 text-center space-y-2",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a run to inspect details."})}),e[5]=N):N=e[5],N}let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("h3",{className:"text-sm font-semibold",children:"Run Detail"}),e[6]=p):p=e[6];let h;e[7]!==n?(h=t.jsxs("div",{children:[p,t.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:n})]}),e[7]=n,e[8]=h):h=e[8];let c;e[9]!==a?(c=a&&t.jsx(F,{className:ee("capitalize",Vs(a.status)),children:a.status}),e[9]=a,e[10]=c):c=e[10];let v;e[11]!==i||e[12]!==l?(v=t.jsx(G,{size:"sm",variant:"outline",onClick:()=>{l.refetch(),i.refetch()},children:"Refresh"}),e[11]=i,e[12]=l,e[13]=v):v=e[13];let b;e[14]!==c||e[15]!==v?(b=t.jsxs("div",{className:"flex items-center gap-2",children:[c,v]}),e[14]=c,e[15]=v,e[16]=b):b=e[16];let k;e[17]!==h||e[18]!==b?(k=t.jsx(oe,{className:"p-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,b]})}),e[17]=h,e[18]=b,e[19]=k):k=e[19];let S;e[20]!==a?(S=a&&t.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),t.jsx("p",{className:"text-lg font-bold",children:a.total_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tested"}),t.jsx("p",{className:"text-lg font-bold",children:a.tested_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),t.jsx("p",{className:"text-lg font-bold text-emerald-600",children:a.passed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),t.jsx("p",{className:"text-lg font-bold text-red-600",children:a.failed_items})]}),t.jsxs(oe,{className:"p-2.5 space-y-0.5",children:[t.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),t.jsx("p",{className:"text-lg font-bold",children:a.skipped_items})]})]}),e[20]=a,e[21]=S):S=e[21];let y;e[22]!==a?(y=a&&(a.started_at||a.finished_at)&&t.jsxs(oe,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[a.started_at&&t.jsxs("span",{children:["Started: ",new Date(a.started_at).toLocaleString()]}),a.finished_at&&t.jsxs("span",{children:["Finished: ",new Date(a.finished_at).toLocaleString()]}),a.started_at&&a.finished_at&&t.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]=y):y=e[23];let f;e[24]!==r?(f=t.jsx(Di,{value:r,onChange:o}),e[24]=r,e[25]=f):f=e[25];const M=x.length!==1?"s":"";let g;e[26]!==x.length||e[27]!==M?(g=t.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," result",M]}),e[26]=x.length,e[27]=M,e[28]=g):g=e[28];let w;e[29]!==f||e[30]!==g?(w=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f,g]}),e[29]=f,e[30]=g,e[31]=w):w=e[31];let R;e[32]!==m||e[33]!==x.length?(R=x.length===0&&t.jsx(oe,{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]=x.length,e[34]=R):R=e[34];let E;e[35]!==x?(E=x.map(Ai),e[35]=x,e[36]=E):E=e[36];let C;e[37]!==R||e[38]!==E?(C=t.jsxs("div",{className:"space-y-2",children:[R,E]}),e[37]=R,e[38]=E,e[39]=C):C=e[39];let T;return e[40]!==y||e[41]!==w||e[42]!==C||e[43]!==k||e[44]!==S?(T=t.jsxs("div",{className:"space-y-3",children:[k,S,y,w,C]}),e[40]=y,e[41]=w,e[42]=C,e[43]=k,e[44]=S,e[45]=T):T=e[45],T}function Ai(s){return t.jsx(Ti,{result:s},s.id)}function Li(s){return s.tested_items?`${Math.round(s.passed_items/s.tested_items*100)}%`:"-"}function Oi(s){const e=X.c(20),{selectedRunId:n,onSelectRun:r}=s,o=Ut();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=t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=i):i=e[2];let d;e[3]!==o?(d=t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i,t.jsx(G,{size:"sm",variant:"outline",onClick:()=>o.refetch(),children:"Refresh"})]}),e[3]=o,e[4]=d):d=e[4];let m;e[5]!==a.length?(m=a.length===0&&t.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 u;if(e[7]!==r||e[8]!==a||e[9]!==n){let h;e[11]!==r||e[12]!==n?(h=c=>{const v=Gs(c.started_at,c.finished_at),b=Li(c),k=n===c.id;return t.jsxs("button",{type:"button",onClick:()=>r(c.id),className:ee("w-full text-left rounded-lg border p-3 transition-colors",k?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(c.created_at).toLocaleString()})}),t.jsx(F,{className:ee("capitalize",Bs(c.status)),children:c.status})]}),t.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[t.jsxs("span",{className:"text-muted-foreground",children:[c.tested_items,"/",c.total_items," tested"]}),t.jsxs("span",{className:"text-emerald-600 font-medium",children:[c.passed_items," passed"]}),c.failed_items>0&&t.jsxs("span",{className:"text-red-600 font-medium",children:[c.failed_items," failed"]}),c.skipped_items>0&&t.jsxs("span",{className:"text-muted-foreground",children:[c.skipped_items," skipped"]}),t.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",b]}),v&&t.jsx("span",{className:"text-muted-foreground",children:v})]}),c.config_snapshot&&t.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[t.jsx(F,{variant:"outline",className:"text-[9px]",children:(c.config_snapshot.monitorMode??c.config_snapshot.testMode??"health_check").replace("_"," ")}),c.config_snapshot.onFailure!=="none"&&t.jsxs(F,{variant:"outline",className:"text-[9px] text-red-600",children:["on fail:"," ",c.config_snapshot.onFailure.replace(/_/g," ")]})]})]},c.id)},e[11]=r,e[12]=n,e[13]=h):h=e[13],u=a.map(h),e[7]=r,e[8]=a,e[9]=n,e[10]=u}else u=e[10];let x;e[14]!==m||e[15]!==u?(x=t.jsxs("div",{className:"space-y-2 max-h-[520px] overflow-auto",children:[m,u]}),e[14]=m,e[15]=u,e[16]=x):x=e[16];let p;return e[17]!==d||e[18]!==x?(p=t.jsx(oe,{className:"p-4",children:t.jsxs("div",{className:"space-y-3",children:[d,x]})}),e[17]=d,e[18]=x,e[19]=p):p=e[19],p}function zi(){const s=X.c(20),[e,n]=I.useState(void 0),[r,o]=I.useState("tests"),a=Zt(e).data?.run?.status,i=Ct(e,void 0,a);let d;s[0]!==i.data?.items?(d=i.data?.items??[],s[0]=i.data?.items,s[1]=d):d=s[1];let m;s[2]!==d?(m=d.filter(Ui),s[2]=d,s[3]=m):m=s[3];const u=m;let x;s[4]===Symbol.for("react.memo_cache_sentinel")?(x=[{id:"tests",label:"Tests"},{id:"configuration",label:"Configuration"},{id:"connections",label:"Connections"}],s[4]=x):x=s[4];let p;s[5]!==r?(p=t.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:x.map(k=>{const S=r===k.id;return t.jsx("button",{type:"button",className:ee("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",S?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>o(k.id),children:t.jsx("span",{children:k.label})},k.id)})}),s[5]=r,s[6]=p):p=s[6];let h;s[7]!==e||s[8]!==r||s[9]!==u?(h=r==="tests"&&t.jsxs("div",{className:"space-y-6",children:[t.jsx(ki,{activeRunId:e,onRunChange:n}),t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[t.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[e&&t.jsx($i,{runId:e}),t.jsx(Oi,{selectedRunId:e,onSelectRun:n})]}),t.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[t.jsxs("h3",{className:"text-sm font-semibold",children:["Broken MCPs"," ",u.length>0&&t.jsx(F,{variant:"destructive",className:"text-[10px] ml-1",children:u.length})]}),t.jsx(Jr,{results:u})]})]})]}),s[7]=e,s[8]=r,s[9]=u,s[10]=h):h=s[10];let c;s[11]!==r?(c=r==="configuration"&&t.jsx(ci,{}),s[11]=r,s[12]=c):c=s[12];let v;s[13]!==r?(v=r==="connections"&&t.jsx(xi,{}),s[13]=r,s[14]=v):v=s[14];let b;return s[15]!==p||s[16]!==h||s[17]!==c||s[18]!==v?(b=t.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[p,h,c,v]}),s[15]=p,s[16]=h,s[17]=c,s[18]=v,s[19]=b):b=s[19],b}function Ui(s){return s.status==="failed"||s.status==="error"}function qi(s){const e=X.c(9),{activeTab:n,onChange:r,items:o}=s;let l;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==r?(i=d=>{const m=n===d.tab,u=d.icon;return t.jsxs("button",{type:"button",className:ee("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(d.tab),children:[t.jsx(u,{size:14}),t.jsx("span",{children:d.label}),typeof d.count=="number"&&d.count>0&&t.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:d.count})]},d.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=t.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 Bl(){const s=X.c(55),[e,n]=I.useState("items"),[r,o]=I.useState(null),{registryName:l,registryIcon:a,registryLLMConnectionId:i,registryLLMModelId:d,acceptPublishRequests:m,requireApiToken:u,storePrivateOnly:x,rateLimitEnabled:p,rateLimitWindow:h,rateLimitMax:c}=qt(Ke),v=lr(),b=Xn(),k=`${l}|${a}|${i}|${d}|${m}|${u}|${x}|${p}|${h}|${c}`;!m&&e==="requests"&&n("items");const S=v.data?.pending??0,y=b.brokenCount>0?b.brokenCount:void 0;let f;s[0]!==y?(f={id:"items",label:"Items",icon:jn,tab:"items",count:y},s[0]=y,s[1]=f):f=s[1];let M;s[2]!==m||s[3]!==S?(M=m?[{id:"requests",label:"Requests",icon:it,tab:"requests",count:S}]:[],s[2]=m,s[3]=S,s[4]=M):M=s[4];let g,w;s[5]===Symbol.for("react.memo_cache_sentinel")?(g={id:"qa",label:"QA",icon:Jt,tab:"qa"},w={id:"settings",label:"Settings",icon:vn,tab:"settings"},s[5]=g,s[6]=w):(g=s[5],w=s[6]);let R;s[7]!==f||s[8]!==M?(R=[f,...M,g,w],s[7]=f,s[8]=M,s[9]=R):R=s[9];const E=R;let C;s[10]===Symbol.for("react.memo_cache_sentinel")?(C=()=>n("settings"),s[10]=C):C=s[10];let T;s[11]!==a||s[12]!==l?(T=t.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:a?t.jsx("img",{src:a,alt:l,className:"h-full w-full object-cover"}):t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:l.slice(0,1).toUpperCase()})}),s[11]=a,s[12]=l,s[13]=T):T=s[13];let N;s[14]!==l?(N=t.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:l}),s[14]=l,s[15]=N):N=s[15];let A;s[16]!==T||s[17]!==N?(A=t.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:C,children:[T,N]}),s[16]=T,s[17]=N,s[18]=A):A=s[18];let L;s[19]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),s[19]=L):L=s[19];let P;s[20]!==e||s[21]!==E?(P=t.jsx(qi,{activeTab:e,onChange:n,items:E}),s[20]=e,s[21]=E,s[22]=P):P=s[22];let D;s[23]!==P||s[24]!==A?(D=t.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:t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[A,L,P]})}),s[23]=P,s[24]=A,s[25]=D):D=s[25];let $;s[26]!==e?($=e==="items"&&t.jsx(Br,{}),s[26]=e,s[27]=$):$=s[27];let z;s[28]!==m||s[29]!==e?(z=e==="requests"&&m&&t.jsx(Vr,{}),s[28]=m,s[29]=e,s[30]=z):z=s[30];let O;s[31]!==e?(O=e==="qa"&&t.jsx(zi,{}),s[31]=e,s[32]=O):O=s[32];let B;s[33]!==m||s[34]!==e||s[35]!==p||s[36]!==c||s[37]!==h||s[38]!==a||s[39]!==i||s[40]!==d||s[41]!==l||s[42]!==u||s[43]!==r||s[44]!==k||s[45]!==x?(B=e==="settings"&&t.jsx(Wr,{initialName:l,initialIcon:a,initialLLMConnectionId:i,initialLLMModelId:d,initialAcceptPublishRequests:m,initialRequireApiToken:u,initialStorePrivateOnly:x,initialRateLimitEnabled:p,initialRateLimitWindow:h,initialRateLimitMax:c,revealedKey:r,onRevealedKeyChange:o},k),s[33]=m,s[34]=e,s[35]=p,s[36]=c,s[37]=h,s[38]=a,s[39]=i,s[40]=d,s[41]=l,s[42]=u,s[43]=r,s[44]=k,s[45]=x,s[46]=B):B=s[46];let Q;s[47]!==$||s[48]!==z||s[49]!==O||s[50]!==B?(Q=t.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[$,z,O,B]}),s[47]=$,s[48]=z,s[49]=O,s[50]=B,s[51]=Q):Q=s[51];let j;return s[52]!==D||s[53]!==Q?(j=t.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[D,Q]}),s[52]=D,s[53]=Q,s[54]=j):j=s[54],j}export{Bl as default};