@decocms/mesh 2.135.1 → 2.136.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/client/assets/{AlertCircle-C0eftc-S.js → AlertCircle-CXJCnY_R.js} +1 -1
  2. package/dist/client/assets/{AlignLeft-y_Ps49tB.js → AlignLeft-Ckpqqq7X.js} +1 -1
  3. package/dist/client/assets/{ArrowDown-BVK-2NZv.js → ArrowDown-BXCgJapO.js} +1 -1
  4. package/dist/client/assets/{ArrowLeft-BNX_fMaj.js → ArrowLeft-ihbjidrQ.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-N8lcMBug.js → ArrowUp-B3tPpNuu.js} +1 -1
  6. package/dist/client/assets/{Check-Cjs4C9GE.js → Check-G22LpKFd.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-KfoOm4QY.js → CheckCircle-Dl3Eh5mw.js} +1 -1
  8. package/dist/client/assets/{CheckDone01-BesDn4jt.js → CheckDone01-DQOA8kaK.js} +1 -1
  9. package/dist/client/assets/{CheckVerified02-dNCcvCnV.js → CheckVerified02-C58oaMz8.js} +1 -1
  10. package/dist/client/assets/{ChevronDown-jKZz68gN.js → ChevronDown-DAk1F2Sn.js} +1 -1
  11. package/dist/client/assets/{ChevronLeft-DrJ63fdN.js → ChevronLeft-CGPjZdmg.js} +1 -1
  12. package/dist/client/assets/{ChevronRight-O5hZNhHU.js → ChevronRight-BT7U8Kip.js} +1 -1
  13. package/dist/client/assets/{Clock-CZrEpwOM.js → Clock-CPO-Cqx6.js} +1 -1
  14. package/dist/client/assets/{Code01-DVgdcTZ1.js → Code01-UXkm6aqY.js} +1 -1
  15. package/dist/client/assets/{Container-BADgIox6.js → Container-CyEPuAYL.js} +1 -1
  16. package/dist/client/assets/{Copy01-CwZDv92A.js → Copy01-tzx60ICS.js} +1 -1
  17. package/dist/client/assets/{Dataflow03-BD9MOeSH.js → Dataflow03-mD5gBD1P.js} +1 -1
  18. package/dist/client/assets/{DotsHorizontal-M2BFmBhE.js → DotsHorizontal-9qiIYu_T.js} +1 -1
  19. package/dist/client/assets/{DotsVertical-B7FmF1Xu.js → DotsVertical-DHxrk-2J.js} +1 -1
  20. package/dist/client/assets/{Download01-9ocXQLzr.js → Download01-DM18IWVp.js} +1 -1
  21. package/dist/client/assets/{Edit01-kvm_TgXf.js → Edit01-D3PaS600.js} +1 -1
  22. package/dist/client/assets/{Edit05-D4Vt7tOt.js → Edit05-B64h7zay.js} +1 -1
  23. package/dist/client/assets/{Eye-BCmEvczH.js → Eye-C_LYW9jG.js} +1 -1
  24. package/dist/client/assets/{File02-CK_RNTh6.js → File02-CY9LI3Y-.js} +1 -1
  25. package/dist/client/assets/{File06-B3E-bjor.js → File06-Dy7xo8XS.js} +1 -1
  26. package/dist/client/assets/{FilterLines-DAyCv-Xk.js → FilterLines-BvkJQ7ij.js} +1 -1
  27. package/dist/client/assets/{Globe01-jKd57I4x.js → Globe01-39jWI59e.js} +1 -1
  28. package/dist/client/assets/{Globe02-D-yCMf5N.js → Globe02-X-Xm1ngz.js} +1 -1
  29. package/dist/client/assets/{Grid01-DRBx9FRw.js → Grid01-DTf5JuyC.js} +1 -1
  30. package/dist/client/assets/{Hash02-CyfLltcT.js → Hash02-AH6eTaow.js} +1 -1
  31. package/dist/client/assets/{Home02-BcZSV_S0.js → Home02-DzIcdgJH.js} +1 -1
  32. package/dist/client/assets/{Image01-Dg_KnZBd.js → Image01-Dvb2vnmH.js} +1 -1
  33. package/dist/client/assets/{Inbox01-nkL2-2Zq.js → Inbox01-CsvPcK33.js} +1 -1
  34. package/dist/client/assets/{InfoCircle-Ipgqrfv0.js → InfoCircle-D2mDfen0.js} +1 -1
  35. package/dist/client/assets/{Key01-CyP1-GBg.js → Key01-C3Fh3hes.js} +1 -1
  36. package/dist/client/assets/{LayersTwo01-rKs-Uww3.js → LayersTwo01-CRgWs3EX.js} +1 -1
  37. package/dist/client/assets/{LayoutLeft-BH3urRkN.js → LayoutLeft-C-0_xlw0.js} +1 -1
  38. package/dist/client/assets/{Link01-D-1AbdDy.js → Link01-C74Jreax.js} +1 -1
  39. package/dist/client/assets/{LinkExternal01-DIMSPk19.js → LinkExternal01-D6xwQf32.js} +1 -1
  40. package/dist/client/assets/{List-BzhQuBp2.js → List-DJEz6yKj.js} +1 -1
  41. package/dist/client/assets/{Loading01-BSgMOGt8.js → Loading01-B3gOoSbd.js} +1 -1
  42. package/dist/client/assets/{Lock01-T7BR0zuk.js → Lock01-CodP_ius.js} +1 -1
  43. package/dist/client/assets/{Play-CBKoaI1n.js → Play-CxAaQi_l.js} +1 -1
  44. package/dist/client/assets/{Plus-kcfCg7FH.js → Plus-Bo0L9uYY.js} +1 -1
  45. package/dist/client/assets/{RefreshCcw01-DiAOUquJ.js → RefreshCcw01-v6pXwg6P.js} +1 -1
  46. package/dist/client/assets/{Save01-CgyWcG00.js → Save01-CU3VjXKO.js} +1 -1
  47. package/dist/client/assets/{SearchMd-DyDznS8C.js → SearchMd-Cpf31N-H.js} +1 -1
  48. package/dist/client/assets/{Settings01-B90Jx8ZC.js → Settings01-BmEB9pVn.js} +1 -1
  49. package/dist/client/assets/{Shield01-B2Y9HIu6.js → Shield01-CqrrEAw-.js} +1 -1
  50. package/dist/client/assets/{Terminal-BxQK5nsd.js → Terminal-BS-6VR5p.js} +1 -1
  51. package/dist/client/assets/{Trash01-Dhrt1Goe.js → Trash01-HuK-pEft.js} +1 -1
  52. package/dist/client/assets/{Upload01-Dja0ZgIT.js → Upload01-DcyyJb_e.js} +1 -1
  53. package/dist/client/assets/{Users03-DHATZiFL.js → Users03-CPWgVi4r.js} +1 -1
  54. package/dist/client/assets/{X-BpJJDPzv.js → X-uHaUni9w.js} +1 -1
  55. package/dist/client/assets/{XCircle-D52fnGO6.js → XCircle-C4iqiznn.js} +1 -1
  56. package/dist/client/assets/{XClose-DcdK3w1e.js → XClose-DGYV-4S5.js} +1 -1
  57. package/dist/client/assets/{Zap-CP5UH1Dw.js → Zap-5c_DBEtK.js} +1 -1
  58. package/dist/client/assets/{agent-connections-preview-v4ndb6aJ.js → agent-connections-preview-BsjSZYGn.js} +1 -1
  59. package/dist/client/assets/agent-detail-BxRuQLTH.js +2 -0
  60. package/dist/client/assets/agents-KBFzt520.js +1 -0
  61. package/dist/client/assets/{alert-dialog-PSmHhGOE.js → alert-dialog-D3oCqQtu.js} +2 -2
  62. package/dist/client/assets/{auth-catchall-CplMsxXE.js → auth-catchall-bz6gJ41s.js} +1 -1
  63. package/dist/client/assets/{avatar-VPsqzp0K.js → avatar-rYlL0ZoJ.js} +1 -1
  64. package/dist/client/assets/{badge-DSAomO1_.js → badge-CxJArm69.js} +1 -1
  65. package/dist/client/assets/{binder-8_Oel13A.js → binder-BXDCztlr.js} +1 -1
  66. package/dist/client/assets/{breadcrumb-Dxn3nF83.js → breadcrumb-CGrLS5HH.js} +1 -1
  67. package/dist/client/assets/{card-CRGkE-QK.js → card-CAORA3L1.js} +1 -1
  68. package/dist/client/assets/{chart-B-ayLZ8-.js → chart-DX1_yJHY.js} +1 -1
  69. package/dist/client/assets/{checkbox-Dj6Qb3KC.js → checkbox-BCSzUsPR.js} +1 -1
  70. package/dist/client/assets/{circle-alert-DcuI5GGM.js → circle-alert-B4C3d1aQ.js} +1 -1
  71. package/dist/client/assets/{collapsible-D2Mpu85K.js → collapsible-sQONDG4w.js} +1 -1
  72. package/dist/client/assets/{collection-detail-FNWcZVfu.js → collection-detail-B42SRwNb.js} +3 -3
  73. package/dist/client/assets/collection-display-button-M7dfC2Rf.js +1 -0
  74. package/dist/client/assets/{collection-search-FSS_Lkwz.js → collection-search-q4T1hb73.js} +1 -1
  75. package/dist/client/assets/collection-tab-e-VwhAzh.js +1 -0
  76. package/dist/client/assets/collection-table-wrapper-DXH0yXJC.js +1 -0
  77. package/dist/client/assets/{collection-tabs-CK4hfCPZ.js → collection-tabs-BbVq4J-5.js} +1 -1
  78. package/dist/client/assets/{command-BK3ZFocj.js → command-CPQN970u.js} +1 -1
  79. package/dist/client/assets/{connect-D2cFEIR8.js → connect-BGH3KdkD.js} +1 -1
  80. package/dist/client/assets/{connection-card-GLkE1rwd.js → connection-card-DTiOZbAC.js} +1 -1
  81. package/dist/client/assets/connection-detail-DznxU3SC.js +1 -0
  82. package/dist/client/assets/connections-AQfSUAp3.js +1 -0
  83. package/dist/client/assets/{constants-3MhIA0pZ.js → constants-D9bRXDQp.js} +1 -1
  84. package/dist/client/assets/constants-DvJZMaim.js +1 -0
  85. package/dist/client/assets/{create-organization-dialog-CR8t2T4R.js → create-organization-dialog-Bs4zbKG7.js} +1 -1
  86. package/dist/client/assets/{create-project-dialog-DFaC5_HT.js → create-project-dialog-BkL7vqeo.js} +1 -1
  87. package/dist/client/assets/{danger-BEh_Y1ce.js → danger-C_vn0auF.js} +1 -1
  88. package/dist/client/assets/{danger-zone-CpwKIZ0p.js → danger-zone-CdUOoCFt.js} +1 -1
  89. package/dist/client/assets/{decopilot-events-CA9aFPSQ.js → decopilot-events-DHSwekTa.js} +1 -1
  90. package/dist/client/assets/dependencies-DTmw6OGT.js +1 -0
  91. package/dist/client/assets/{dialog-CPWJMuHX.js → dialog-Baq_fjtR.js} +1 -1
  92. package/dist/client/assets/{dropdown-menu-DW1GDWfN.js → dropdown-menu-CSqO4Mxn.js} +1 -1
  93. package/dist/client/assets/dynamic-plugin-layout-d0KDA7MF.js +1 -0
  94. package/dist/client/assets/{editable-task-title-D4gyoQ4x.js → editable-task-title-HUenZvZX.js} +1 -1
  95. package/dist/client/assets/{empty-state-boxcABsi.js → empty-state-BPClkF2j.js} +1 -1
  96. package/dist/client/assets/{env-vars-editor-x5YLFI-P.js → env-vars-editor-DDp7f4JN.js} +1 -1
  97. package/dist/client/assets/{extract-connection-data-D40JrSD8.js → extract-connection-data-BkJeK0tX.js} +1 -1
  98. package/dist/client/assets/{file-browser-CrcClgQC.js → file-browser-DVzV35Ko.js} +2 -2
  99. package/dist/client/assets/{form-7Q-FsNtX.js → form-C5R0_qWR.js} +1 -1
  100. package/dist/client/assets/{general-C0buekt8.js → general-mBNwCpsS.js} +1 -1
  101. package/dist/client/assets/{grid-view-J96VhXfb.js → grid-view-7eQhfO8f.js} +1 -1
  102. package/dist/client/assets/{home-H46nCwT5.js → home-okrTp5Gh.js} +1 -1
  103. package/dist/client/assets/{icon-picker-DPVWLIZ3.js → icon-picker-DevrZ9IQ.js} +1 -1
  104. package/dist/client/assets/{index-CsXxowFD.js → index-B-STjJpH.js} +1 -1
  105. package/dist/client/assets/{index-ZgdunwGI.js → index-BK6i23a9.js} +1 -1
  106. package/dist/client/assets/{index-D7M37zt-.js → index-BWSvBz7o.js} +1 -1
  107. package/dist/client/assets/{index-3zbyfLqi.js → index-B_0vsVr1.js} +3 -3
  108. package/dist/client/assets/{index-DqzqEzLf.js → index-ByA6j7_H.js} +1 -1
  109. package/dist/client/assets/{index-DziKeC8s.js → index-CvEIDmnk.js} +1 -1
  110. package/dist/client/assets/index-D6E08wfB.css +1 -0
  111. package/dist/client/assets/index-DYY56DJY.js +1 -0
  112. package/dist/client/assets/{index-DZgOYNf-.js → index-QCmdl8uj.js} +1 -1
  113. package/dist/client/assets/{index-CW624IAb.js → index-UbeVlDrq.js} +1 -1
  114. package/dist/client/assets/{infiniteQueryObserver-DkOiuhUg.js → infiniteQueryObserver-DKiK82rX.js} +1 -1
  115. package/dist/client/assets/{input-DVv1wKLp.js → input-CW7SVowR.js} +1 -1
  116. package/dist/client/assets/{integration-icon-_0Y5dukY.js → integration-icon-DAFtApWT.js} +1 -1
  117. package/dist/client/assets/{label-CfzCa7Vm.js → label-DWU1nKSS.js} +1 -1
  118. package/dist/client/assets/{layout-DemCWqB_.js → layout-CzVwolFw.js} +1 -1
  119. package/dist/client/assets/{layout-CFi42XXk.js → layout-DEcRD72T.js} +1 -1
  120. package/dist/client/assets/{localstorage-keys-D2dx16dH.js → localstorage-keys-BAzeyS9J.js} +1 -1
  121. package/dist/client/assets/{login-BXUbt1kV.js → login-OPfY3bsF.js} +1 -1
  122. package/dist/client/assets/{markdown-89WWPNXO.js → markdown-DCSB9ejV.js} +1 -1
  123. package/dist/client/assets/{mcp-app-renderer-MJ3LmhBP.js → mcp-app-renderer-BtuEhdWL.js} +1 -1
  124. package/dist/client/assets/{mcp-oauth-CPAKRpWT.js → mcp-oauth-D8pA0WRM.js} +1 -1
  125. package/dist/client/assets/{mcp-server-card-gl2xF4cu.js → mcp-server-card-D7xlSyX7.js} +1 -1
  126. package/dist/client/assets/mcp-server-detail-DdKXdUu2.js +2 -0
  127. package/dist/client/assets/members-YKyOsCaT.js +3 -0
  128. package/dist/client/assets/{monaco-editor-Qwuf1rYM.js → monaco-editor-zyWgiZEt.js} +1 -1
  129. package/dist/client/assets/{monitoring-C-vcUHdF.js → monitoring-SM_c8qxT.js} +2 -2
  130. package/dist/client/assets/monitoring-dashboard-edit-cexdjvMw.js +1 -0
  131. package/dist/client/assets/{monitoring-dashboard-view-D7MwbzDH.js → monitoring-dashboard-view-C3qQNwfm.js} +1 -1
  132. package/dist/client/assets/{oauth-callback-BnBZDVD6.js → oauth-callback-1SC3hH5y.js} +1 -1
  133. package/dist/client/assets/page-DfTTOYQt.js +1 -0
  134. package/dist/client/assets/page-hoODnFtN.js +1 -0
  135. package/dist/client/assets/{plugin-empty-state-DfdPh9Ts.js → plugin-empty-state-Cl_h_OgT.js} +1 -1
  136. package/dist/client/assets/{plugin-empty-state-BuLjcm9B.js → plugin-empty-state-Doboc7Tq.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CKLaOHoT.js → plugin-header-C4Dfehzm.js} +1 -1
  138. package/dist/client/assets/{plugin-header-Bi-8qclQ.js → plugin-header-DNeaPoeS.js} +1 -1
  139. package/dist/client/assets/plugins-H9eiCXso.js +1 -0
  140. package/dist/client/assets/popover-BNZ96bFv.js +1 -0
  141. package/dist/client/assets/project-app-view-Bsbq4Qf_.js +1 -0
  142. package/dist/client/assets/project-layout-B4cnkESa.js +1 -0
  143. package/dist/client/assets/{project-plugins-B1sb2cJf.js → project-plugins-CqDaIw1P.js} +1 -1
  144. package/dist/client/assets/{projects-list-D0DH8k1c.js → projects-list-CgsVuZof.js} +1 -1
  145. package/dist/client/assets/{readme-viewer-BvJA0DXw.js → readme-viewer-CKidIXa3.js} +1 -1
  146. package/dist/client/assets/{registry-layout-BJCo3ZwE.js → registry-layout-oUh5Zl7W.js} +2 -2
  147. package/dist/client/assets/{registry-utils-Cx5oa6Ne.js → registry-utils-DXJps8H7.js} +1 -1
  148. package/dist/client/assets/{reports-layout-DYTNa8h-.js → reports-layout-CFJRqv-Q.js} +2 -2
  149. package/dist/client/assets/{reset-password-DFzqJN6I.js → reset-password-ZQI9gTW6.js} +1 -1
  150. package/dist/client/assets/{resizable-PA9Y3YAt.js → resizable-CWRglWOX.js} +1 -1
  151. package/dist/client/assets/{save-actions-CXaB5WYr.js → save-actions-eGQZXGI3.js} +1 -1
  152. package/dist/client/assets/{scroll-area-DoXCMB9j.js → scroll-area-By1z4ZyY.js} +1 -1
  153. package/dist/client/assets/{select-DaTaxi5W.js → select-CYY4CENz.js} +1 -1
  154. package/dist/client/assets/shell-layout-DMKfJTmj.js +3 -0
  155. package/dist/client/assets/{sidebar-settings-BZwWXZuX.js → sidebar-settings-ILgspCqY.js} +1 -1
  156. package/dist/client/assets/{skeleton-C9OYLAME.js → skeleton-C4ZMp7sl.js} +1 -1
  157. package/dist/client/assets/{spinner-RGw-eBKN.js → spinner-oA3jiJW_.js} +1 -1
  158. package/dist/client/assets/{store-invite-Fvga4enp.js → store-invite-Bfy0Alsf.js} +1 -1
  159. package/dist/client/assets/{switch-CKTW0M5S.js → switch-BSc4dVNg.js} +1 -1
  160. package/dist/client/assets/{table-Dr33PlEJ.js → table-RFgqEt_E.js} +1 -1
  161. package/dist/client/assets/{tabs-t9dEapgX.js → tabs-BZ-xfLNG.js} +1 -1
  162. package/dist/client/assets/tasks-Cy-gkHRX.js +1 -0
  163. package/dist/client/assets/{tasks-panel-DLy55FSi.js → tasks-panel-C7RwVTDD.js} +1 -1
  164. package/dist/client/assets/{textarea-CNTbi5Nk.js → textarea-4HpXofT0.js} +1 -1
  165. package/dist/client/assets/{time-range-picker-Do8ix4-A.js → time-range-picker-Cx2A-Fs_.js} +1 -1
  166. package/dist/client/assets/{toggle-group-Ck1YCESf.js → toggle-group-CVFHcp8K.js} +1 -1
  167. package/dist/client/assets/tools-list-BYphEqhu.js +1 -0
  168. package/dist/client/assets/{tooltip-CzsT_Xmu.js → tooltip-Cz-bAWiO.js} +1 -1
  169. package/dist/client/assets/{topbar-portal-pZDSuDEC.js → topbar-portal-DOwsTUY4.js} +1 -1
  170. package/dist/client/assets/{types-BFBQ7LBo.js → types-B46wd5bS.js} +1 -1
  171. package/dist/client/assets/{use-binding-Cz4OU82g.js → use-binding-Dz1SRdBY.js} +1 -1
  172. package/dist/client/assets/use-collections-vccihohV.js +1 -0
  173. package/dist/client/assets/use-connection-DeEn4qfI.js +1 -0
  174. package/dist/client/assets/{use-copy-C0vtJ5Ye.js → use-copy-CykDvxn6.js} +1 -1
  175. package/dist/client/assets/{use-create-virtual-mcp-CsNENE7l.js → use-create-virtual-mcp-DB14T-Ft.js} +1 -1
  176. package/dist/client/assets/use-install-from-registry-BeHRHLDl.js +1 -0
  177. package/dist/client/assets/{use-list-state-DUq5hUJc.js → use-list-state-ykkfYLR3.js} +1 -1
  178. package/dist/client/assets/use-llm-B_iPCa-K.js +1 -0
  179. package/dist/client/assets/{use-mcp-resources-DjDOJ-nS.js → use-mcp-resources-Rqzq7A0J.js} +1 -1
  180. package/dist/client/assets/{use-mcp-tools-WZlm0cnW.js → use-mcp-tools-BXihKxpu.js} +1 -1
  181. package/dist/client/assets/{use-members-BLjJfltI.js → use-members-DAcqcxDX.js} +1 -1
  182. package/dist/client/assets/{use-mobile-CzcHKmhL.js → use-mobile-B2VAoWT2.js} +1 -1
  183. package/dist/client/assets/{use-project-CIyZUlkd.js → use-project-D96OXk4y.js} +1 -1
  184. package/dist/client/assets/{use-settings-modal-BU5fs4m_.js → use-settings-modal-CouKpdi3.js} +1 -1
  185. package/dist/client/assets/{use-view-mode-BadETRuZ.js → use-view-mode-DyK0fMBe.js} +1 -1
  186. package/dist/client/assets/use-virtual-mcp-OwU65kyR.js +1 -0
  187. package/dist/client/assets/useInfiniteQuery-Cl9EtkM0.js +1 -0
  188. package/dist/client/assets/{useMutation-CqJLXgOK.js → useMutation-lBFQDcxE.js} +1 -1
  189. package/dist/client/assets/useQuery-DcRkCB2j.js +1 -0
  190. package/dist/client/assets/useSuspenseInfiniteQuery-DdSDu-rZ.js +1 -0
  191. package/dist/client/assets/{user-vKqDbtP6.js → user-C73vNaiS.js} +1 -1
  192. package/dist/client/assets/workflow-S9BhswBs.js +1 -0
  193. package/dist/client/index.html +2 -2
  194. package/dist/server/cli.js +1 -1
  195. package/dist/server/migrate.js +1 -1
  196. package/dist/server/server.js +1 -1
  197. package/package.json +1 -1
  198. package/dist/client/assets/agent-detail-DyOlL9jH.js +0 -2
  199. package/dist/client/assets/agents-CB6IRof4.js +0 -1
  200. package/dist/client/assets/collection-tab-FKeWJS1r.js +0 -1
  201. package/dist/client/assets/collection-table-wrapper-C3jcR2VW.js +0 -1
  202. package/dist/client/assets/connection-detail-PegJ7rZR.js +0 -1
  203. package/dist/client/assets/connections-C18lG_Ow.js +0 -1
  204. package/dist/client/assets/constants-Csevqii0.js +0 -1
  205. package/dist/client/assets/dependencies-mwSdsJgD.js +0 -1
  206. package/dist/client/assets/dynamic-plugin-layout-CY4G5d8i.js +0 -1
  207. package/dist/client/assets/index-Cr3FYIgR.css +0 -1
  208. package/dist/client/assets/index-DFlYm7QG.js +0 -1
  209. package/dist/client/assets/mcp-server-detail-CzmUyYsJ.js +0 -2
  210. package/dist/client/assets/members-BjMeazP1.js +0 -3
  211. package/dist/client/assets/monitoring-dashboard-edit-DdMgOlQK.js +0 -1
  212. package/dist/client/assets/page-BNQcXJwH.js +0 -1
  213. package/dist/client/assets/page-DvC0ZQe5.js +0 -1
  214. package/dist/client/assets/plugins-cGh_gky2.js +0 -1
  215. package/dist/client/assets/popover-7xIJyxqf.js +0 -1
  216. package/dist/client/assets/project-app-view-C_PL72tZ.js +0 -1
  217. package/dist/client/assets/project-layout-DIwsntjO.js +0 -1
  218. package/dist/client/assets/shell-layout-BqF7J7La.js +0 -3
  219. package/dist/client/assets/tasks-OJAbxkK1.js +0 -1
  220. package/dist/client/assets/tools-list-DLfR0anP.js +0 -1
  221. package/dist/client/assets/use-connection-Dlr-wAwU.js +0 -1
  222. package/dist/client/assets/use-install-from-registry-C_roXw8y.js +0 -1
  223. package/dist/client/assets/use-llm-B6AzV9Iw.js +0 -1
  224. package/dist/client/assets/use-virtual-mcp-BjGr5L6n.js +0 -1
  225. package/dist/client/assets/useInfiniteQuery-CGGEgi5q.js +0 -1
  226. package/dist/client/assets/useQuery-DWLTdDjg.js +0 -1
  227. package/dist/client/assets/useSuspenseInfiniteQuery-YGfVGowO.js +0 -1
  228. package/dist/client/assets/workflow--wyybZpA.js +0 -1
@@ -1,5 +1,5 @@
1
- import{r as T,c as X,u as he,n as Qe,b$ as tt,j as s,B as F,v as ne,t as Z,cd as cn}from"./index-3zbyfLqi.js";import{i as ft}from"./CheckCircle-KfoOm4QY.js";import{n as dn}from"./Container-BADgIox6.js";import{t as mn}from"./Settings01-B90Jx8ZC.js";import{u as Ze}from"./useQuery-DWLTdDjg.js";import{u as $e}from"./useMutation-CqJLXgOK.js";import{a as ve,u as be,j as js}from"./constants-3MhIA0pZ.js";import{u as bs}from"./useInfiniteQuery-CGGEgi5q.js";import{B as G}from"./badge-DSAomO1_.js";import{I as je}from"./input-DVv1wKLp.js";import{a as Dt,c as Je,D as $t,b as At,h as ls,i as as,g as un}from"./dropdown-menu-DW1GDWfN.js";import{e as vs,a as ys,b as Lt,T as Oe,d as Ns,c as Ue}from"./table-Dr33PlEJ.js";import{a as os,T as xn}from"./toggle-group-Ck1YCESf.js";import{u as hn}from"./use-view-mode-BadETRuZ.js";import{i as Xt}from"./DotsVertical-B7FmF1Xu.js";import{i as pn}from"./FilterLines-DAyCv-Xk.js";import{i as ws}from"./Globe01-jKd57I4x.js";import{i as ut}from"./Loading01-BSgMOGt8.js";import{i as Cs}from"./SearchMd-DyDznS8C.js";import{b as zt,c as Ot,d as Ut,e as qt,a as Ft,D as Bt}from"./dialog-CPWJMuHX.js";import{i as vt}from"./AlertCircle-C0eftc-S.js";import{n as fn}from"./Download01-9ocXQLzr.js";import{i as cs}from"./Upload01-Dja0ZgIT.js";import{c as yt,b as Nt,d as wt,A as Ct,h as _t,e as kt,a as St,f as Rt}from"./alert-dialog-PSmHhGOE.js";import{C as me}from"./card-CRGkE-QK.js";import{s as It}from"./Trash01-Dhrt1Goe.js";import{L as le}from"./label-CfzCa7Vm.js";import{n as gn,S as _s,a as ks,b as Ss,c as Rs,d as Et}from"./select-DaTaxi5W.js";import{S as bt}from"./switch-CKTW0M5S.js";import{T as Gt}from"./textarea-CNTbi5Nk.js";import{i as jn}from"./ArrowLeft-BNX_fMaj.js";import{i as bn,u as Ht,t as vn}from"./use-copy-C0vtJ5Ye.js";import{s as es}from"./RefreshCcw01-DiAOUquJ.js";import{i as yn}from"./X-BpJJDPzv.js";import{i as Nn}from"./Link01-D-1AbdDy.js";import{t as Ts}from"./ChevronDown-jKZz68gN.js";import{C as wn}from"./checkbox-Dj6Qb3KC.js";import{s as Is}from"./Eye-BCmEvczH.js";import{n as Cn}from"./LinkExternal01-DIMSPk19.js";import{i as _n}from"./XCircle-D52fnGO6.js";import{h as Ms,e as Ps}from"./use-connection-Dlr-wAwU.js";import{a as kn,b as Sn,P as Rn}from"./popover-7xIJyxqf.js";import{i as Wt}from"./Check-Cjs4C9GE.js";import{a as Jt}from"./Copy01-CwZDv92A.js";import{i as Tn,a as In}from"./Save01-CgyWcG00.js";import{i as Mn}from"./Key01-CyP1-GBg.js";import{s as Pn}from"./Plus-kcfCg7FH.js";import{a as En,b as Dn,T as $n}from"./tooltip-CzsT_Xmu.js";import{a as An,i as Ln}from"./mcp-oauth-CPAKRpWT.js";import{i as zn}from"./Play-CBKoaI1n.js";import"./infiniteQueryObserver-DkOiuhUg.js";import"./ChevronRight-O5hZNhHU.js";import"./use-mobile-CzcHKmhL.js";import"./index-DziKeC8s.js";const Es=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.createElement("path",{d:"M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243"}));Es.displayName="EyeOff";const Ds=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.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"}));Ds.displayName="ImagePlus";const $s=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.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"}),T.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"}));$s.displayName="StopSquare";const ts=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.createElement("path",{d:"m6 6 4.5 4.5M6 6H3L2 3l1-1 3 1v3Zm13.259-3.259-2.628 2.628c-.396.396-.594.594-.668.822a1 1 0 0 0 0 .618c.074.228.272.426.668.822l.238.238c.396.396.594.594.822.668a1 1 0 0 0 .618 0c.228-.074.426-.272.822-.668L21.59 5.41a5.5 5.5 0 0 1-6.16 7.485c-.485-.096-.729-.144-.876-.13a.836.836 0 0 0-.373.114c-.13.07-.261.201-.523.463L6.5 20.5a2.121 2.121 0 0 1-3-3l7.157-7.157c.262-.262.393-.393.463-.524a.836.836 0 0 0 .113-.372c.015-.148-.033-.39-.129-.877a5.5 5.5 0 0 1 8.155-5.83ZM12 15l5.5 5.5a2.121 2.121 0 0 0 3-3l-4.525-4.525a5.475 5.475 0 0 1-.934-.17c-.39-.107-.816-.03-1.101.255L12 15Z"}));ts.displayName="Tool02";const H={all:["private-registry"],items:()=>[...H.all,"items"],itemsList:(t,e,n,r)=>[...H.items(),"list",{search:t,tags:e,categories:n,limit:r}],item:t=>[...H.items(),"item",t],filters:()=>[...H.all,"filters"],registryConfig:()=>[...H.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...H.registryConfig(),t,e],publishRequests:()=>[...H.all,"publish-requests"],publishRequestsByOrg:t=>[...H.publishRequests(),"org",t],publishRequestsList:(t,e,n)=>[...H.publishRequests(),"list",{status:t??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(t,e,n,r)=>[...H.publishRequestsByOrg(t),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...H.publishRequests(),"count"],publishRequestsCountByOrg:t=>[...H.publishRequestsByOrg(t),"count"],publishApiKeys:()=>[...H.all,"publish-api-keys"],monitor:()=>[...H.all,"monitor"],monitorRuns:()=>[...H.monitor(),"runs"],monitorRunsList:t=>[...H.monitorRuns(),"list",{status:t??"all"}],monitorRun:t=>[...H.monitorRuns(),"run",t??"none"],monitorResults:()=>[...H.monitor(),"results"],monitorResultsList:(t,e)=>[...H.monitorResults(),"list",{runId:t??"none",status:e??"all"}],monitorConnections:()=>[...H.monitor(),"connections"],monitorConnectionAuthProbe:t=>[...H.monitorConnections(),"auth-probe",t]};async function qe(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function On(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_START",{config:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorResults()})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Un(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async(c,m)=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorRun(m)})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qt(t){const e=X.c(10),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRunsList(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_LIST",{status:t,limit:100}),e[4]=o,e[5]=t,e[6]=a):a=e[6];let i;return e[7]!==l||e[8]!==a?(i={queryKey:l,queryFn:a,staleTime:5e3},e[7]=l,e[8]=a,e[9]=i):i=e[9],Ze(i)}function ss(t){const e=X.c(11),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRun(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_GET",{runId:t}),e[4]=o,e[5]=t,e[6]=a):a=e[6];const i=!!t;let c;return e[7]!==l||e[8]!==a||e[9]!==i?(c={queryKey:l,queryFn:a,enabled:i,refetchInterval:qn},e[7]=l,e[8]=a,e[9]=i,e[10]=c):c=e[10],Ze(c)}function qn(t){return t.state.data?.run?.status==="running"?5e3:!1}function Mt(t,e,n){const r=X.c(14),{org:o}=he();let l;r[0]!==o.id?(l={connectionId:ve,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=be(l);let i;r[2]!==t||r[3]!==e?(i=H.monitorResultsList(t,e),r[2]=t,r[3]=e,r[4]=i):i=r[4];let c;r[5]!==a||r[6]!==t||r[7]!==e?(c=async()=>qe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:t,status:e,limit:200,offset:0}),r[5]=a,r[6]=t,r[7]=e,r[8]=c):c=r[8];const m=!!t,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==c||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:c,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=c,r[11]=m,r[12]=u,r[13]=x):x=r[13],Ze(x)}function As(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.monitorConnections(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>qe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function Fn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async()=>qe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Bn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>{const{connectionId:m,authStatus:u}=c;return qe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}const ds={monitorMode:"health_check",onFailure:"none",schedule:"manual",cronExpression:"",scheduleEventId:"",perMcpTimeoutMs:3e4,perToolTimeoutMs:1e4,maxAgentSteps:15,testPublicOnly:!1,testPrivateOnly:!1,includePendingRequests:!1,agentContext:"",llmConnectionId:"",llmModelId:""};function Ls(){const t=X.c(33),{org:e,project:n}=he();let r;t[0]!==e.id?(r={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const o=be(r),l=Qe();let a;t[2]!==n.id?(a=H.registryConfigByPlugin(n.id??"",tt),t[2]=n.id,t[3]=a):a=t[3];let i;t[4]!==o||t[5]!==n.id?(i=async()=>qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}),t[4]=o,t[5]=n.id,t[6]=i):i=t[6];const c=!!n.id;let m;t[7]!==a||t[8]!==i||t[9]!==c?(m={queryKey:a,queryFn:i,enabled:c},t[7]=a,t[8]=i,t[9]=c,t[10]=m):m=t[10];const u=Ze(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,d=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let b;t[11]!==p?(b=p??{},t[11]=p,t[12]=b):b=t[12];let j;t[13]!==d||t[14]!==x||t[15]!==p?(j=d&&!p?x:{},t[13]=d,t[14]=x,t[15]=p,t[16]=j):j=t[16];let _;t[17]!==b||t[18]!==j?(_={...ds,...b,...j},t[17]=b,t[18]=j,t[19]=_):_=t[19];const k=_;let y;t[20]!==o||t[21]!==n.id?(y=async S=>{const N=(await qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}))?.config?.settings??{};return qe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:tt,settings:{...N,testConfig:{...ds,...N.testConfig??{},...S}}})},t[20]=o,t[21]=n.id,t[22]=y):y=t[22];let g;t[23]!==n.id||t[24]!==l?(g=async()=>{await l.invalidateQueries({queryKey:H.registryConfigByPlugin(n.id??"",tt)})},t[23]=n.id,t[24]=l,t[25]=g):g=t[25];let I;t[26]!==y||t[27]!==g?(I={mutationFn:y,onSuccess:g},t[26]=y,t[27]=g,t[28]=I):I=t[28];const f=$e(I);let w;return t[29]!==u.isLoading||t[30]!==f||t[31]!==k?(w={settings:k,isLoading:u.isLoading,saveMutation:f},t[29]=u.isLoading,t[30]=f,t[31]=k,t[32]=w):w=t[32],w}function Gn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_SET",c),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Kn(){const t=X.c(3),e=Qt("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Mt(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return t[0]!==l||t[1]!==a?(i={brokenCount:l,isLoading:a},t[0]=l,t[1]=a,t[2]=i):i=t[2],i}const zs=24;function Vn(t){return t.trim()}async function Ae(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function Os(t){const e=X.c(19),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l,a,i,c;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(a=Vn(t.search),l=t.limit??zs,c=bs,i=H.itemsList(a,t.tags,t.categories,l),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=c):(l=e[6],a=e[7],i=e[8],c=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==t.categories||e[13]!==t.tags||e[14]!==a?(m=async 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 Ae(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=t.categories,e[13]=t.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:Yn,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],c(u)}function Yn(t){return t.nextCursor}function Hn(){const t=X.c(8),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.filters(),t[2]=o):o=t[2];let l;t[3]!==r?(l=async()=>Ae(r,"REGISTRY_ITEM_FILTERS",{}),t[3]=r,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},t[5]=a):a=t[5];let i;return t[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},t[6]=l,t[7]=i):i=t[7],Ze(i)}function ns(){const t=X.c(29),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.items()}),e.invalidateQueries({queryKey:H.filters()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async g=>(await Ae(o,"REGISTRY_ITEM_CREATE",{data:g})).item,t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async g=>{const{id:I,data:f}=g;return(await Ae(o,"REGISTRY_ITEM_UPDATE",{id:I,data:f})).item},t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;t[14]!==o?(h=async g=>(await Ae(o,"REGISTRY_ITEM_DELETE",{id:g})).item,t[14]=o,t[15]=h):h=t[15];let d;t[16]!==a||t[17]!==h?(d={mutationFn:h,onSuccess:a},t[16]=a,t[17]=h,t[18]=d):d=t[18];const b=$e(d);let j;t[19]!==o?(j=async g=>Ae(o,"REGISTRY_ITEM_BULK_CREATE",{items:g}),t[19]=o,t[20]=j):j=t[20];let _;t[21]!==a||t[22]!==j?(_={mutationFn:j,onSuccess:a},t[21]=a,t[22]=j,t[23]=_):_=t[23];const k=$e(_);let y;return t[24]!==k||t[25]!==m||t[26]!==b||t[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:b,bulkCreateMutation:k},t[24]=k,t[25]=m,t[26]=b,t[27]=p,t[28]=y):y=t[28],y}function Kt(t){const e=X.c(37),{org:n,project:r}=he();let o;e[0]!==n.id?(o={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=be(o),a=Qe();let i;e[2]!==t||e[3]!==r.id?(i=H.registryConfigByPlugin(r.id??"",t),e[2]=t,e[3]=r.id,e[4]=i):i=e[4];let c;e[5]!==l||e[6]!==t||e[7]!==r.id?(c=async()=>Ae(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}),e[5]=l,e[6]=t,e[7]=r.id,e[8]=c):c=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==c||e[11]!==m?(u={queryKey:i,queryFn:c,enabled:m,staleTime:6e4},e[9]=i,e[10]=c,e[11]=m,e[12]=u):u=e[12];const x=Ze(u);let p;e[13]!==l||e[14]!==t||e[15]!==r.id?(p=async $=>{const M=(await Ae(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}))?.config?.settings??{};return Ae(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:t,settings:{...M,...$}})},e[13]=l,e[14]=t,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==t||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:H.registryConfigByPlugin(r.id??"",t)})},e[17]=t,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let d;e[21]!==p||e[22]!==h?(d={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=d):d=e[23];const b=$e(d),j=x.data?.config?.settings?.registryName??"Private Registry",_=x.data?.config?.settings?.registryIcon??"",k=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",g=x.data?.config?.settings?.acceptPublishRequests??!1,I=x.data?.config?.settings?.requireApiToken??!1,f=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,P=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",N=x.data?.config?.settings?.rateLimitMax,R=typeof N=="number"&&N>=1?Math.floor(N):100;let v;return e[24]!==g||e[25]!==x.isLoading||e[26]!==w||e[27]!==R||e[28]!==P||e[29]!==_||e[30]!==k||e[31]!==y||e[32]!==j||e[33]!==I||e[34]!==b||e[35]!==f?(v={registryName:j,registryIcon:_,registryLLMConnectionId:k,registryLLMModelId:y,acceptPublishRequests:g,requireApiToken:I,storePrivateOnly:f,rateLimitEnabled:w,rateLimitWindow:P,rateLimitMax:R,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:b},e[24]=g,e[25]=x.isLoading,e[26]=w,e[27]=R,e[28]=P,e[29]=_,e[30]=k,e[31]=y,e[32]=j,e[33]=I,e[34]=b,e[35]=f,e[36]=v):v=e[36],v}function Wn(t){const e=X.c(15),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==n.id||e[3]!==t.sortBy||e[4]!==t.sortDirection||e[5]!==t.status?(l=H.publishRequestsListByOrg(n.id,t.status,t.sortBy,t.sortDirection),e[2]=n.id,e[3]=t.sortBy,e[4]=t.sortDirection,e[5]=t.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==t.sortBy||e[9]!==t.sortDirection||e[10]!==t.status?(a=async c=>{const{pageParam:m}=c;return Ae(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t.status,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:zs,offset:m})},e[7]=o,e[8]=t.sortBy,e[9]=t.sortDirection,e[10]=t.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:Jn,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],bs(i)}function Jn(t,e){const n=e.reduce(Zn,0);return n<t.totalCount?n:void 0}function Zn(t,e){return t+e.items.length}function Xn(){const t=X.c(9),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]!==e.id?(o=H.publishRequestsCountByOrg(e.id),t[2]=e.id,t[3]=o):o=t[3];let l;t[4]!==r?(l=async()=>Ae(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),t[4]=r,t[5]=l):l=t[5];let a;return t[6]!==o||t[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},t[6]=o,t[7]=l,t[8]=a):a=t[8],Ze(a)}function er(){const t=X.c(17),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.publishRequests()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async d=>Ae(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",d),t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async d=>Ae(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:d}),t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;return t[14]!==p||t[15]!==m?(h={reviewMutation:m,deleteMutation:p},t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function tr(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.publishApiKeys(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>Ae(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function sr(){const t=X.c(19),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async d=>Ae(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:d}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[4]=e,t[5]=a):a=t[5];let i;t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8];const c=$e(i);let m;t[9]!==o?(m=async d=>Ae(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:d}),t[9]=o,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let x;t[13]!==m||t[14]!==u?(x={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=x):x=t[15];const p=$e(x);let h;return t[16]!==c||t[17]!==p?(h={generateMutation:c,revokeMutation:p},t[16]=c,t[17]=p,t[18]=h):h=t[18],h}function ms(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function us(t){const e=[];let n="",r=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(l==='"'){r&&a==='"'?(n+='"',o+=1):r=!r;continue}if(l===","&&!r){e.push(n.trim()),n="";continue}n+=l}return e.push(n.trim()),e}const nr=["id","title"],rr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ir(t){const e=t.split(/\r?\n/).map(m=>m.trim()).filter(Boolean);if(e.length<2)return{items:[],warnings:[{line:0,message:"CSV must have a header row and at least one data row"}],skipped:0};const n=us(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of nr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!rr.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 c=0;for(let m=1;m<e.length;m+=1){const u=us(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),c+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),c+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),c+=1;continue}i.add(x);const h=l(u,"description").trim(),d=l(u,"remote_url").trim(),j=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",_=ms(l(u,"tags")),k=ms(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),g=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:g,_meta:{"mcp.mesh":{..._.length>0?{tags:_}:{},...k.length>0?{categories:k}:{}}},server:{name:x,title:p,description:h||void 0,remotes:d?[{type:j,url:d}]:[]}})}return{items:a,warnings:o,skipped:c}}const lr=`id,title,description,remote_url,remote_type,tags,categories,is_public
1
+ import{r as T,c as X,u as he,n as Qe,b$ as tt,j as s,B as F,v as ne,t as Z,cd as cn}from"./index-B_0vsVr1.js";import{i as ft}from"./CheckCircle-Dl3Eh5mw.js";import{n as dn}from"./Container-CyEPuAYL.js";import{t as mn}from"./Settings01-BmEB9pVn.js";import{u as Ze}from"./useQuery-DcRkCB2j.js";import{u as $e}from"./useMutation-lBFQDcxE.js";import{a as ve,u as be,h as js}from"./constants-D9bRXDQp.js";import{u as bs}from"./useInfiniteQuery-Cl9EtkM0.js";import{B as G}from"./badge-CxJArm69.js";import{I as je}from"./input-CW7SVowR.js";import{a as Dt,c as Je,D as $t,b as At,h as ls,i as as,g as un}from"./dropdown-menu-CSqO4Mxn.js";import{e as vs,a as ys,b as Lt,T as Oe,d as Ns,c as Ue}from"./table-RFgqEt_E.js";import{a as os,T as xn}from"./toggle-group-CVFHcp8K.js";import{u as hn}from"./use-view-mode-DyK0fMBe.js";import{i as Xt}from"./DotsVertical-DHxrk-2J.js";import{i as pn}from"./FilterLines-BvkJQ7ij.js";import{i as ws}from"./Globe01-39jWI59e.js";import{i as ut}from"./Loading01-B3gOoSbd.js";import{i as Cs}from"./SearchMd-Cpf31N-H.js";import{b as zt,c as Ot,d as Ut,e as qt,a as Ft,D as Bt}from"./dialog-Baq_fjtR.js";import{i as vt}from"./AlertCircle-CXJCnY_R.js";import{n as fn}from"./Download01-DM18IWVp.js";import{i as cs}from"./Upload01-DcyyJb_e.js";import{c as yt,b as Nt,d as wt,A as Ct,h as _t,e as kt,a as St,f as Rt}from"./alert-dialog-D3oCqQtu.js";import{C as me}from"./card-CAORA3L1.js";import{s as It}from"./Trash01-HuK-pEft.js";import{L as le}from"./label-DWU1nKSS.js";import{n as gn,S as _s,a as ks,b as Ss,c as Rs,d as Et}from"./select-CYY4CENz.js";import{S as bt}from"./switch-BSc4dVNg.js";import{T as Gt}from"./textarea-4HpXofT0.js";import{i as jn}from"./ArrowLeft-ihbjidrQ.js";import{i as bn,u as Ht,t as vn}from"./use-copy-CykDvxn6.js";import{s as es}from"./RefreshCcw01-v6pXwg6P.js";import{i as yn}from"./X-uHaUni9w.js";import{i as Nn}from"./Link01-C74Jreax.js";import{t as Ts}from"./ChevronDown-DAk1F2Sn.js";import{C as wn}from"./checkbox-BCSzUsPR.js";import{s as Is}from"./Eye-C_LYW9jG.js";import{n as Cn}from"./LinkExternal01-D6xwQf32.js";import{i as _n}from"./XCircle-C4iqiznn.js";import{e as Ms}from"./use-collections-vccihohV.js";import{b as Ps}from"./use-connection-DeEn4qfI.js";import{a as kn,b as Sn,P as Rn}from"./popover-BNZ96bFv.js";import{i as Wt}from"./Check-G22LpKFd.js";import{a as Jt}from"./Copy01-tzx60ICS.js";import{i as Tn,a as In}from"./Save01-CU3VjXKO.js";import{i as Mn}from"./Key01-C3Fh3hes.js";import{s as Pn}from"./Plus-Bo0L9uYY.js";import{a as En,b as Dn,T as $n}from"./tooltip-Cz-bAWiO.js";import{a as An,i as Ln}from"./mcp-oauth-D8pA0WRM.js";import{i as zn}from"./Play-CxAaQi_l.js";import"./infiniteQueryObserver-DKiK82rX.js";import"./ChevronRight-BT7U8Kip.js";import"./use-mobile-B2VAoWT2.js";import"./index-CvEIDmnk.js";const Es=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.createElement("path",{d:"M10.743 5.092C11.149 5.032 11.569 5 12 5c5.105 0 8.455 4.505 9.58 6.287.137.215.205.323.243.49a1.16 1.16 0 0 1 0 .447c-.038.166-.107.274-.244.492-.3.474-.757 1.141-1.363 1.865M6.724 6.715c-2.162 1.467-3.63 3.504-4.303 4.57-.137.217-.205.325-.243.492a1.173 1.173 0 0 0 0 .446c.038.167.106.274.242.49C3.546 14.495 6.895 19 12 19c2.059 0 3.832-.732 5.289-1.723M3 3l18 18M9.88 9.879a3 3 0 1 0 4.243 4.243"}));Es.displayName="EyeOff";const Ds=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.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"}));Ds.displayName="ImagePlus";const $s=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.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"}),T.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"}));$s.displayName="StopSquare";const ts=({size:t=24,color:e="currentColor",...n})=>T.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},T.createElement("path",{d:"m6 6 4.5 4.5M6 6H3L2 3l1-1 3 1v3Zm13.259-3.259-2.628 2.628c-.396.396-.594.594-.668.822a1 1 0 0 0 0 .618c.074.228.272.426.668.822l.238.238c.396.396.594.594.822.668a1 1 0 0 0 .618 0c.228-.074.426-.272.822-.668L21.59 5.41a5.5 5.5 0 0 1-6.16 7.485c-.485-.096-.729-.144-.876-.13a.836.836 0 0 0-.373.114c-.13.07-.261.201-.523.463L6.5 20.5a2.121 2.121 0 0 1-3-3l7.157-7.157c.262-.262.393-.393.463-.524a.836.836 0 0 0 .113-.372c.015-.148-.033-.39-.129-.877a5.5 5.5 0 0 1 8.155-5.83ZM12 15l5.5 5.5a2.121 2.121 0 0 0 3-3l-4.525-4.525a5.475 5.475 0 0 1-.934-.17c-.39-.107-.816-.03-1.101.255L12 15Z"}));ts.displayName="Tool02";const H={all:["private-registry"],items:()=>[...H.all,"items"],itemsList:(t,e,n,r)=>[...H.items(),"list",{search:t,tags:e,categories:n,limit:r}],item:t=>[...H.items(),"item",t],filters:()=>[...H.all,"filters"],registryConfig:()=>[...H.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...H.registryConfig(),t,e],publishRequests:()=>[...H.all,"publish-requests"],publishRequestsByOrg:t=>[...H.publishRequests(),"org",t],publishRequestsList:(t,e,n)=>[...H.publishRequests(),"list",{status:t??"all",sortBy:e??"created_at",sortDirection:n??"desc"}],publishRequestsListByOrg:(t,e,n,r)=>[...H.publishRequestsByOrg(t),"list",{status:e??"all",sortBy:n??"created_at",sortDirection:r??"desc"}],publishRequestsCount:()=>[...H.publishRequests(),"count"],publishRequestsCountByOrg:t=>[...H.publishRequestsByOrg(t),"count"],publishApiKeys:()=>[...H.all,"publish-api-keys"],monitor:()=>[...H.all,"monitor"],monitorRuns:()=>[...H.monitor(),"runs"],monitorRunsList:t=>[...H.monitorRuns(),"list",{status:t??"all"}],monitorRun:t=>[...H.monitorRuns(),"run",t??"none"],monitorResults:()=>[...H.monitor(),"results"],monitorResultsList:(t,e)=>[...H.monitorResults(),"list",{runId:t??"none",status:e??"all"}],monitorConnections:()=>[...H.monitor(),"connections"],monitorConnectionAuthProbe:t=>[...H.monitorConnections(),"auth-probe",t]};async function qe(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function On(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_START",{config:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorResults()})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Un(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_RUN_CANCEL",{runId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async(c,m)=>{await Promise.all([e.invalidateQueries({queryKey:H.monitorRuns()}),e.invalidateQueries({queryKey:H.monitorRun(m)})])},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qt(t){const e=X.c(10),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRunsList(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_LIST",{status:t,limit:100}),e[4]=o,e[5]=t,e[6]=a):a=e[6];let i;return e[7]!==l||e[8]!==a?(i={queryKey:l,queryFn:a,staleTime:5e3},e[7]=l,e[8]=a,e[9]=i):i=e[9],Ze(i)}function ss(t){const e=X.c(11),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==t?(l=H.monitorRun(t),e[2]=t,e[3]=l):l=e[3];let a;e[4]!==o||e[5]!==t?(a=async()=>qe(o,"REGISTRY_MONITOR_RUN_GET",{runId:t}),e[4]=o,e[5]=t,e[6]=a):a=e[6];const i=!!t;let c;return e[7]!==l||e[8]!==a||e[9]!==i?(c={queryKey:l,queryFn:a,enabled:i,refetchInterval:qn},e[7]=l,e[8]=a,e[9]=i,e[10]=c):c=e[10],Ze(c)}function qn(t){return t.state.data?.run?.status==="running"?5e3:!1}function Mt(t,e,n){const r=X.c(14),{org:o}=he();let l;r[0]!==o.id?(l={connectionId:ve,orgId:o.id},r[0]=o.id,r[1]=l):l=r[1];const a=be(l);let i;r[2]!==t||r[3]!==e?(i=H.monitorResultsList(t,e),r[2]=t,r[3]=e,r[4]=i):i=r[4];let c;r[5]!==a||r[6]!==t||r[7]!==e?(c=async()=>qe(a,"REGISTRY_MONITOR_RESULT_LIST",{runId:t,status:e,limit:200,offset:0}),r[5]=a,r[6]=t,r[7]=e,r[8]=c):c=r[8];const m=!!t,u=n==="running"?2500:!1;let x;return r[9]!==i||r[10]!==c||r[11]!==m||r[12]!==u?(x={queryKey:i,queryFn:c,enabled:m,staleTime:5e3,refetchInterval:u},r[9]=i,r[10]=c,r[11]=m,r[12]=u,r[13]=x):x=r[13],Ze(x)}function As(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.monitorConnections(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>qe(r,"REGISTRY_MONITOR_CONNECTION_LIST",{}),staleTime:1e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function Fn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async()=>qe(o,"REGISTRY_MONITOR_CONNECTION_SYNC",{}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Bn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>{const{connectionId:m,authStatus:u}=c;return qe(o,"REGISTRY_MONITOR_CONNECTION_UPDATE_AUTH",{connectionId:m,authStatus:u})},t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.monitorConnections()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}const ds={monitorMode:"health_check",onFailure:"none",schedule:"manual",cronExpression:"",scheduleEventId:"",perMcpTimeoutMs:3e4,perToolTimeoutMs:1e4,maxAgentSteps:15,testPublicOnly:!1,testPrivateOnly:!1,includePendingRequests:!1,agentContext:"",llmConnectionId:"",llmModelId:""};function Ls(){const t=X.c(33),{org:e,project:n}=he();let r;t[0]!==e.id?(r={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const o=be(r),l=Qe();let a;t[2]!==n.id?(a=H.registryConfigByPlugin(n.id??"",tt),t[2]=n.id,t[3]=a):a=t[3];let i;t[4]!==o||t[5]!==n.id?(i=async()=>qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}),t[4]=o,t[5]=n.id,t[6]=i):i=t[6];const c=!!n.id;let m;t[7]!==a||t[8]!==i||t[9]!==c?(m={queryKey:a,queryFn:i,enabled:c},t[7]=a,t[8]=i,t[9]=c,t[10]=m):m=t[10];const u=Ze(m),x=u.data?.config?.settings,p=x&&typeof x=="object"?x.testConfig:void 0,d=typeof(x?x.monitorMode??x.testMode:void 0)=="string";let b;t[11]!==p?(b=p??{},t[11]=p,t[12]=b):b=t[12];let j;t[13]!==d||t[14]!==x||t[15]!==p?(j=d&&!p?x:{},t[13]=d,t[14]=x,t[15]=p,t[16]=j):j=t[16];let _;t[17]!==b||t[18]!==j?(_={...ds,...b,...j},t[17]=b,t[18]=j,t[19]=_):_=t[19];const k=_;let y;t[20]!==o||t[21]!==n.id?(y=async S=>{const N=(await qe(o,"PROJECT_PLUGIN_CONFIG_GET",{projectId:n.id,pluginId:tt}))?.config?.settings??{};return qe(o,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:n.id,pluginId:tt,settings:{...N,testConfig:{...ds,...N.testConfig??{},...S}}})},t[20]=o,t[21]=n.id,t[22]=y):y=t[22];let g;t[23]!==n.id||t[24]!==l?(g=async()=>{await l.invalidateQueries({queryKey:H.registryConfigByPlugin(n.id??"",tt)})},t[23]=n.id,t[24]=l,t[25]=g):g=t[25];let I;t[26]!==y||t[27]!==g?(I={mutationFn:y,onSuccess:g},t[26]=y,t[27]=g,t[28]=I):I=t[28];const f=$e(I);let w;return t[29]!==u.isLoading||t[30]!==f||t[31]!==k?(w={settings:k,isLoading:u.isLoading,saveMutation:f},t[29]=u.isLoading,t[30]=f,t[31]=k,t[32]=w):w=t[32],w}function Gn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_SET",c),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Qn(){const t=X.c(9),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async c=>qe(o,"REGISTRY_MONITOR_SCHEDULE_CANCEL",{scheduleEventId:c}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.registryConfig()})},t[4]=e,t[5]=a):a=t[5];let i;return t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8],$e(i)}function Kn(){const t=X.c(3),e=Qt("completed"),n=e.data?.items?.[0]?.id,r=e.data?.items?.[0]?.status,o=Mt(n,"failed",r),l=o.data?.items?.length??0,a=e.isLoading||o.isLoading;let i;return t[0]!==l||t[1]!==a?(i={brokenCount:l,isLoading:a},t[0]=l,t[1]=a,t[2]=i):i=t[2],i}const zs=24;function Vn(t){return t.trim()}async function Ae(t,e,n){const r=await t.callTool({name:e,arguments:n});if(!r||typeof r!="object")throw new Error(`Invalid tool response for ${e}`);if(r.isError){const o=r.content?.find(l=>l.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(o)}return r.structuredContent??r}function Os(t){const e=X.c(19),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l,a,i,c;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(a=Vn(t.search),l=t.limit??zs,c=bs,i=H.itemsList(a,t.tags,t.categories,l),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=l,e[7]=a,e[8]=i,e[9]=c):(l=e[6],a=e[7],i=e[8],c=e[9]);let m;e[10]!==o||e[11]!==l||e[12]!==t.categories||e[13]!==t.tags||e[14]!==a?(m=async 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 Ae(o,"REGISTRY_ITEM_LIST",{cursor:p,limit:l,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:h})},e[10]=o,e[11]=l,e[12]=t.categories,e[13]=t.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:Yn,staleTime:3e4},e[16]=i,e[17]=m,e[18]=u):u=e[18],c(u)}function Yn(t){return t.nextCursor}function Hn(){const t=X.c(8),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.filters(),t[2]=o):o=t[2];let l;t[3]!==r?(l=async()=>Ae(r,"REGISTRY_ITEM_FILTERS",{}),t[3]=r,t[4]=l):l=t[4];let a;t[5]===Symbol.for("react.memo_cache_sentinel")?(a={tags:[],categories:[]},t[5]=a):a=t[5];let i;return t[6]!==l?(i={queryKey:o,queryFn:l,placeholderData:a,staleTime:6e4},t[6]=l,t[7]=i):i=t[7],Ze(i)}function ns(){const t=X.c(29),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.items()}),e.invalidateQueries({queryKey:H.filters()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async g=>(await Ae(o,"REGISTRY_ITEM_CREATE",{data:g})).item,t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async g=>{const{id:I,data:f}=g;return(await Ae(o,"REGISTRY_ITEM_UPDATE",{id:I,data:f})).item},t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;t[14]!==o?(h=async g=>(await Ae(o,"REGISTRY_ITEM_DELETE",{id:g})).item,t[14]=o,t[15]=h):h=t[15];let d;t[16]!==a||t[17]!==h?(d={mutationFn:h,onSuccess:a},t[16]=a,t[17]=h,t[18]=d):d=t[18];const b=$e(d);let j;t[19]!==o?(j=async g=>Ae(o,"REGISTRY_ITEM_BULK_CREATE",{items:g}),t[19]=o,t[20]=j):j=t[20];let _;t[21]!==a||t[22]!==j?(_={mutationFn:j,onSuccess:a},t[21]=a,t[22]=j,t[23]=_):_=t[23];const k=$e(_);let y;return t[24]!==k||t[25]!==m||t[26]!==b||t[27]!==p?(y={createMutation:m,updateMutation:p,deleteMutation:b,bulkCreateMutation:k},t[24]=k,t[25]=m,t[26]=b,t[27]=p,t[28]=y):y=t[28],y}function Kt(t){const e=X.c(37),{org:n,project:r}=he();let o;e[0]!==n.id?(o={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=o):o=e[1];const l=be(o),a=Qe();let i;e[2]!==t||e[3]!==r.id?(i=H.registryConfigByPlugin(r.id??"",t),e[2]=t,e[3]=r.id,e[4]=i):i=e[4];let c;e[5]!==l||e[6]!==t||e[7]!==r.id?(c=async()=>Ae(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}),e[5]=l,e[6]=t,e[7]=r.id,e[8]=c):c=e[8];const m=!!r.id;let u;e[9]!==i||e[10]!==c||e[11]!==m?(u={queryKey:i,queryFn:c,enabled:m,staleTime:6e4},e[9]=i,e[10]=c,e[11]=m,e[12]=u):u=e[12];const x=Ze(u);let p;e[13]!==l||e[14]!==t||e[15]!==r.id?(p=async $=>{const M=(await Ae(l,"PROJECT_PLUGIN_CONFIG_GET",{projectId:r.id,pluginId:t}))?.config?.settings??{};return Ae(l,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:r.id,pluginId:t,settings:{...M,...$}})},e[13]=l,e[14]=t,e[15]=r.id,e[16]=p):p=e[16];let h;e[17]!==t||e[18]!==r.id||e[19]!==a?(h=async()=>{await a.invalidateQueries({queryKey:H.registryConfigByPlugin(r.id??"",t)})},e[17]=t,e[18]=r.id,e[19]=a,e[20]=h):h=e[20];let d;e[21]!==p||e[22]!==h?(d={mutationFn:p,onSuccess:h},e[21]=p,e[22]=h,e[23]=d):d=e[23];const b=$e(d),j=x.data?.config?.settings?.registryName??"Private Registry",_=x.data?.config?.settings?.registryIcon??"",k=x.data?.config?.settings?.llmConnectionId??"",y=x.data?.config?.settings?.llmModelId??"",g=x.data?.config?.settings?.acceptPublishRequests??!1,I=x.data?.config?.settings?.requireApiToken??!1,f=x.data?.config?.settings?.storePrivateOnly??!1,w=x.data?.config?.settings?.rateLimitEnabled??!0,P=x.data?.config?.settings?.rateLimitWindow==="minute"?"minute":"hour",N=x.data?.config?.settings?.rateLimitMax,R=typeof N=="number"&&N>=1?Math.floor(N):100;let v;return e[24]!==g||e[25]!==x.isLoading||e[26]!==w||e[27]!==R||e[28]!==P||e[29]!==_||e[30]!==k||e[31]!==y||e[32]!==j||e[33]!==I||e[34]!==b||e[35]!==f?(v={registryName:j,registryIcon:_,registryLLMConnectionId:k,registryLLMModelId:y,acceptPublishRequests:g,requireApiToken:I,storePrivateOnly:f,rateLimitEnabled:w,rateLimitWindow:P,rateLimitMax:R,isLoadingConfig:x.isLoading,saveRegistryConfigMutation:b},e[24]=g,e[25]=x.isLoading,e[26]=w,e[27]=R,e[28]=P,e[29]=_,e[30]=k,e[31]=y,e[32]=j,e[33]=I,e[34]=b,e[35]=f,e[36]=v):v=e[36],v}function Wn(t){const e=X.c(15),{org:n}=he();let r;e[0]!==n.id?(r={connectionId:ve,orgId:n.id},e[0]=n.id,e[1]=r):r=e[1];const o=be(r);let l;e[2]!==n.id||e[3]!==t.sortBy||e[4]!==t.sortDirection||e[5]!==t.status?(l=H.publishRequestsListByOrg(n.id,t.status,t.sortBy,t.sortDirection),e[2]=n.id,e[3]=t.sortBy,e[4]=t.sortDirection,e[5]=t.status,e[6]=l):l=e[6];let a;e[7]!==o||e[8]!==t.sortBy||e[9]!==t.sortDirection||e[10]!==t.status?(a=async c=>{const{pageParam:m}=c;return Ae(o,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t.status,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:zs,offset:m})},e[7]=o,e[8]=t.sortBy,e[9]=t.sortDirection,e[10]=t.status,e[11]=a):a=e[11];let i;return e[12]!==l||e[13]!==a?(i={queryKey:l,queryFn:a,initialPageParam:0,getNextPageParam:Jn,staleTime:3e4,refetchOnMount:!0},e[12]=l,e[13]=a,e[14]=i):i=e[14],bs(i)}function Jn(t,e){const n=e.reduce(Zn,0);return n<t.totalCount?n:void 0}function Zn(t,e){return t+e.items.length}function Xn(){const t=X.c(9),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]!==e.id?(o=H.publishRequestsCountByOrg(e.id),t[2]=e.id,t[3]=o):o=t[3];let l;t[4]!==r?(l=async()=>Ae(r,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),t[4]=r,t[5]=l):l=t[5];let a;return t[6]!==o||t[7]!==l?(a={queryKey:o,queryFn:l,staleTime:3e4},t[6]=o,t[7]=l,t[8]=a):a=t[8],Ze(a)}function er(){const t=X.c(17),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==e?(l=async()=>{await Promise.all([e.invalidateQueries({queryKey:H.publishRequests()})])},t[2]=e,t[3]=l):l=t[3];const a=l;let i;t[4]!==o?(i=async d=>Ae(o,"REGISTRY_PUBLISH_REQUEST_REVIEW",d),t[4]=o,t[5]=i):i=t[5];let c;t[6]!==a||t[7]!==i?(c={mutationFn:i,onSuccess:a},t[6]=a,t[7]=i,t[8]=c):c=t[8];const m=$e(c);let u;t[9]!==o?(u=async d=>Ae(o,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:d}),t[9]=o,t[10]=u):u=t[10];let x;t[11]!==a||t[12]!==u?(x={mutationFn:u,onSuccess:a},t[11]=a,t[12]=u,t[13]=x):x=t[13];const p=$e(x);let h;return t[14]!==p||t[15]!==m?(h={reviewMutation:m,deleteMutation:p},t[14]=p,t[15]=m,t[16]=h):h=t[16],h}function tr(){const t=X.c(5),{org:e}=he();let n;t[0]!==e.id?(n={connectionId:ve,orgId:e.id},t[0]=e.id,t[1]=n):n=t[1];const r=be(n);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=H.publishApiKeys(),t[2]=o):o=t[2];let l;return t[3]!==r?(l={queryKey:o,queryFn:async()=>Ae(r,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=r,t[4]=l):l=t[4],Ze(l)}function sr(){const t=X.c(19),e=Qe(),{org:n}=he();let r;t[0]!==n.id?(r={connectionId:ve,orgId:n.id},t[0]=n.id,t[1]=r):r=t[1];const o=be(r);let l;t[2]!==o?(l=async d=>Ae(o,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:d}),t[2]=o,t[3]=l):l=t[3];let a;t[4]!==e?(a=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[4]=e,t[5]=a):a=t[5];let i;t[6]!==l||t[7]!==a?(i={mutationFn:l,onSuccess:a},t[6]=l,t[7]=a,t[8]=i):i=t[8];const c=$e(i);let m;t[9]!==o?(m=async d=>Ae(o,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:d}),t[9]=o,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:H.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let x;t[13]!==m||t[14]!==u?(x={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=x):x=t[15];const p=$e(x);let h;return t[16]!==c||t[17]!==p?(h={generateMutation:c,revokeMutation:p},t[16]=c,t[17]=p,t[18]=h):h=t[18],h}function ms(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function us(t){const e=[];let n="",r=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(l==='"'){r&&a==='"'?(n+='"',o+=1):r=!r;continue}if(l===","&&!r){e.push(n.trim()),n="";continue}n+=l}return e.push(n.trim()),e}const nr=["id","title"],rr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function ir(t){const e=t.split(/\r?\n/).map(m=>m.trim()).filter(Boolean);if(e.length<2)return{items:[],warnings:[{line:0,message:"CSV must have a header row and at least one data row"}],skipped:0};const n=us(e[0]??""),r=new Map,o=[];n.forEach((m,u)=>{const x=m.toLowerCase().trim();x&&r.set(x,u)});for(const m of nr)r.has(m)||o.push({line:1,message:`Missing required column: "${m}"`});for(const m of n){const u=m.toLowerCase().trim();u&&!rr.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 c=0;for(let m=1;m<e.length;m+=1){const u=us(e[m]??""),x=l(u,"id").trim(),p=l(u,"title").trim();if(!x){o.push({line:m+1,message:"Missing id — row skipped"}),c+=1;continue}if(!p){o.push({line:m+1,message:`Missing title for id="${x}" — row skipped`}),c+=1;continue}if(i.has(x)){o.push({line:m+1,message:`Duplicate id="${x}" — row skipped`}),c+=1;continue}i.add(x);const h=l(u,"description").trim(),d=l(u,"remote_url").trim(),j=l(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",_=ms(l(u,"tags")),k=ms(l(u,"categories")),y=l(u,"is_public").trim().toLowerCase(),g=y==="true"||y==="1"||y==="yes";a.push({id:x,title:p,description:h||null,is_public:g,_meta:{"mcp.mesh":{..._.length>0?{tags:_}:{},...k.length>0?{categories:k}:{}}},server:{name:x,title:p,description:h||void 0,remotes:d?[{type:j,url:d}]:[]}})}return{items:a,warnings:o,skipped:c}}const lr=`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 ar(){const t=new Blob([lr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="registry-import-template.csv",n.click(),URL.revokeObjectURL(e)}function or(t){const e=X.c(63),{open:n,onOpenChange:r,isImporting:o,onImport:l}=t,a=o===void 0?!1:o,[i,c]=T.useState(null),[m,u]=T.useState(null),[x,p]=T.useState(null),h=T.useRef(null);let d;e[0]!==r?(d=V=>{r(V),V||(c(null),u(null),p(null),h.current&&(h.current.value=""))},e[0]=r,e[1]=d):d=e[1];const b=d;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=async V=>{if(!V)return;p(V.name),u(null);const ce=await V.text();c(ir(ce))},e[2]=j):j=e[2];const _=j;let k;e[3]!==l||e[4]!==i?(k=async()=>{if(!i?.items.length)return;const V=await l(i.items);u(V)},e[3]=l,e[4]=i,e[5]=k):k=e[5];const y=k;let g;e[6]!==i?.items?(g=i?.items??[],e[6]=i?.items,e[7]=g):g=e[7];const I=g;let f;e[8]!==i?.warnings?(f=i?.warnings??[],e[8]=i?.warnings,e[9]=f):f=e[9];const w=f;let S;e[10]!==w?(S=w.some(ur),e[10]=w,e[11]=S):S=e[11];const P=S,N=m!==null;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(zt,{children:[s.jsx(Ot,{children:"Import MCP Servers from CSV"}),s.jsx(Ut,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=R):R=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=()=>h.current?.click(),e[13]=v):v=e[13];let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(cs,{size:14}),e[14]=$):$=e[14];const D=x?"Change file":"Choose CSV file";let M;e[15]!==a||e[16]!==D?(M=s.jsxs(F,{variant:"outline",size:"sm",className:"gap-1.5",onClick:v,disabled:a,children:[$,D]}),e[15]=a,e[16]=D,e[17]=M):M=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("input",{ref:h,type:"file",accept:".csv,text/csv",className:"hidden",onChange:V=>_(V.target.files?.[0]??null)}),e[18]=E):E=e[18];let A;e[19]!==x?(A=x&&s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),e[19]=x,e[20]=A):A=e[20];let q;e[21]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx("div",{className:"flex-1"}),e[21]=q):q=e[21];let z;e[22]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsxs(F,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:ar,children:[s.jsx(fn,{size:14}),"Download template"]}),e[22]=z):z=e[22];let O;e[23]!==M||e[24]!==A?(O=s.jsxs("div",{className:"flex items-center gap-3",children:[M,E,A,q,z]}),e[23]=M,e[24]=A,e[25]=O):O=e[25];let B;e[26]!==w?(B=w.length>0&&s.jsx("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-950/30 p-3 grid gap-1",children:w.map(mr)}),e[26]=w,e[27]=B):B=e[27];let Q;e[28]!==I||e[29]!==i?(Q=I.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:"Preview"}),s.jsxs(G,{variant:"secondary",children:[I.length," items"]}),i?.skipped?s.jsxs(G,{variant:"outline",className:"text-yellow-600",children:[i.skipped," skipped"]}):null]}),s.jsx("div",{className:"border rounded-lg overflow-hidden",children:s.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:s.jsxs(vs,{children:[s.jsx(ys,{children:s.jsxs(Lt,{children:[s.jsx(Oe,{className:"w-[140px]",children:"ID"}),s.jsx(Oe,{children:"Title"}),s.jsx(Oe,{children:"Remote URL"}),s.jsx(Oe,{className:"w-[80px] text-center",children:"Public"}),s.jsx(Oe,{children:"Tags"})]})}),s.jsx(Ns,{children:I.map(dr)})]})})})]}),e[28]=I,e[29]=i,e[30]=Q):Q=e[30];let te;e[31]!==m?(te=m&&s.jsxs("div",{className:"rounded-lg border p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(ft,{size:16,className:"text-emerald-600"}),"Imported ",m.created," item(s) successfully"]}),m.errors.length>0&&s.jsx("div",{className:"grid gap-1 mt-1",children:m.errors.map(cr)})]}),e[31]=m,e[32]=te):te=e[32];let se;e[33]!==N||e[34]!==i?(se=!i&&!N&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(cs,{size:32,className:"text-muted-foreground/40 mb-3"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a CSV file or download the template to get started."}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Required columns: ",s.jsx("code",{children:"id"}),", ",s.jsx("code",{children:"title"}),". Optional:"," ",s.jsx("code",{children:"description"}),", ",s.jsx("code",{children:"remote_url"}),","," ",s.jsx("code",{children:"remote_type"}),", ",s.jsx("code",{children:"tags"}),","," ",s.jsx("code",{children:"categories"}),", ",s.jsx("code",{children:"is_public"}),"."]}),s.jsxs("p",{className:"text-xs text-muted-foreground/70 mt-1",children:["Use ",s.jsx("code",{children:"|"})," or ",s.jsx("code",{children:";"})," to separate multiple tags/categories within a cell."]})]}),e[33]=N,e[34]=i,e[35]=se):se=e[35];let re;e[36]!==O||e[37]!==B||e[38]!==Q||e[39]!==te||e[40]!==se?(re=s.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[O,B,Q,te,se]}),e[36]=O,e[37]=B,e[38]=Q,e[39]=te,e[40]=se,e[41]=re):re=e[41];let ie;e[42]!==b?(ie=()=>b(!1),e[42]=b,e[43]=ie):ie=e[43];const ae=N?"Done":"Cancel";let oe;e[44]!==ie||e[45]!==ae?(oe=s.jsx(F,{variant:"outline",onClick:ie,children:ae}),e[44]=ie,e[45]=ae,e[46]=oe):oe=e[46];let pe;e[47]!==y||e[48]!==P||e[49]!==N||e[50]!==a||e[51]!==I.length?(pe=!N&&s.jsx(F,{onClick:y,disabled:a||I.length===0||P,children:a?"Importing...":`Import ${I.length} item(s)`}),e[47]=y,e[48]=P,e[49]=N,e[50]=a,e[51]=I.length,e[52]=pe):pe=e[52];let ue;e[53]!==oe||e[54]!==pe?(ue=s.jsxs(qt,{className:"gap-2 sm:gap-0",children:[oe,pe]}),e[53]=oe,e[54]=pe,e[55]=ue):ue=e[55];let C;e[56]!==re||e[57]!==ue?(C=s.jsxs(Ft,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[R,re,ue]}),e[56]=re,e[57]=ue,e[58]=C):C=e[58];let K;return e[59]!==b||e[60]!==n||e[61]!==C?(K=s.jsx(Bt,{open:n,onOpenChange:b,children:C}),e[59]=b,e[60]=n,e[61]=C,e[62]=K):K=e[62],K}function cr(t){return s.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[s.jsx(vt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono",children:t.id}),": ",t.error]})]},t.id)}function dr(t){return s.jsxs(Lt,{children:[s.jsx(Ue,{className:"font-mono text-xs",children:t.id}),s.jsx(Ue,{className:"text-sm",children:t.title}),s.jsx(Ue,{className:"text-xs text-muted-foreground max-w-[200px] truncate",children:t.server.remotes?.[0]?.url??s.jsx("span",{className:"italic",children:"none"})}),s.jsx(Ue,{className:"text-center",children:t.is_public?s.jsx(G,{variant:"secondary",className:"text-[10px] bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:"Yes"}):s.jsx("span",{className:"text-xs text-muted-foreground",children:"No"})}),s.jsx(Ue,{className:"text-xs text-muted-foreground",children:(t._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},t.id)}function mr(t,e){return s.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-400 flex items-start gap-1.5",children:[s.jsx(vt,{size:12,className:"shrink-0 mt-0.5"}),s.jsxs("span",{children:[t.line>0&&s.jsxs("span",{className:"font-mono text-[10px] mr-1",children:["Line ",t.line,":"]}),t.message]})]},`${t.line}-${e}`)}function ur(t){return t.message.startsWith("Missing required column:")}function xr(t){const e=X.c(19),{open:n,onOpenChange:r,title:o,isDeleting:l,onConfirm:a}=t,i=l===void 0?!1:l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(yt,{children:"Delete registry item?"}),e[0]=c):c=e[0];let m;e[1]!==o?(m=s.jsxs(Nt,{children:[c,s.jsxs(wt,{children:["This action cannot be undone. Item ",s.jsx("strong",{children:o})," will be permanently removed from this private registry."]})]}),e[1]=o,e[2]=m):m=e[2];let u;e[3]!==i?(u=s.jsx(Ct,{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=s.jsx(_t,{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=s.jsxs(kt,{children:[u,p]}),e[9]=u,e[10]=p,e[11]=h):h=e[11];let d;e[12]!==m||e[13]!==h?(d=s.jsxs(St,{children:[m,h]}),e[12]=m,e[13]=h,e[14]=d):d=e[14];let b;return e[15]!==r||e[16]!==n||e[17]!==d?(b=s.jsx(Rt,{open:n,onOpenChange:r,children:d}),e[15]=r,e[16]=n,e[17]=d,e[18]=b):b=e[18],b}function hr(t){const[e]=t.id.split("/");return e??"provider"}function pr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function fr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function gr(t){return t.server?.icons?.[0]?.src??null}function jr(t){const e=X.c(56),{item:n,onEdit:r,onDelete:o}=t;let l;e[0]!==n?(l=gr(n),e[0]=n,e[1]=l):l=e[1];const a=l;let i;e[2]!==n?(i=[...pr(n),...fr(n)],e[2]=n,e[3]=i):i=e[3];const c=i;let m;e[4]!==c?(m=c.slice(0,3),e[4]=c,e[5]=m):m=e[5];const u=m,x=Math.max(0,c.length-u.length);let p;e[6]!==a||e[7]!==n.title?(p=s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:a?s.jsx("img",{src:a,alt:n.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:n.title.charAt(0).toUpperCase()})}),e[6]=a,e[7]=n.title,e[8]=p):p=e[8];let h;e[9]!==n.title?(h=s.jsx("p",{className:"font-medium truncate",children:n.title}),e[9]=n.title,e[10]=h):h=e[10];let d;e[11]!==n?(d=hr(n),e[11]=n,e[12]=d):d=e[12];let b;e[13]!==d?(b=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:d}),e[13]=d,e[14]=b):b=e[14];let j;e[15]!==n.is_public?(j=n.is_public?s.jsxs(G,{variant:"default",className:"gap-1",children:[s.jsx(ws,{size:10}),"Public"]}):s.jsx(G,{variant:"secondary",children:"Private"}),e[15]=n.is_public,e[16]=j):j=e[16];let _;e[17]!==b||e[18]!==j?(_=s.jsxs("div",{className:"flex items-center gap-2",children:[b,j]}),e[17]=b,e[18]=j,e[19]=_):_=e[19];let k;e[20]!==h||e[21]!==_?(k=s.jsxs("div",{className:"min-w-0 flex-1",children:[h,_]}),e[20]=h,e[21]=_,e[22]=k):k=e[22];let y;e[23]!==k||e[24]!==p?(y=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p,k]}),e[23]=k,e[24]=p,e[25]=y):y=e[25];let g;e[26]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),e[26]=g):g=e[26];let I;e[27]!==n||e[28]!==r?(I=s.jsx(Je,{onClick:()=>r(n),children:"Edit"}),e[27]=n,e[28]=r,e[29]=I):I=e[29];let f;e[30]!==n||e[31]!==o?(f=()=>o(n),e[30]=n,e[31]=o,e[32]=f):f=e[32];let w;e[33]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(It,{size:14}),e[33]=w):w=e[33];let S;e[34]!==f?(S=s.jsxs(Je,{variant:"destructive",onClick:f,children:[w,"Delete"]}),e[34]=f,e[35]=S):S=e[35];let P;e[36]!==I||e[37]!==S?(P=s.jsxs($t,{children:[g,s.jsxs(At,{align:"end",children:[I,S]})]}),e[36]=I,e[37]=S,e[38]=P):P=e[38];let N;e[39]!==y||e[40]!==P?(N=s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[y,P]}),e[39]=y,e[40]=P,e[41]=N):N=e[41];const R=n._meta?.["mcp.mesh"]?.short_description||n.description||n.server.description||"No description provided.";let v;e[42]!==R?(v=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:R}),e[42]=R,e[43]=v):v=e[43];let $;e[44]!==n.id||e[45]!==u?($=u.map(A=>s.jsx(G,{variant:"secondary",children:A},`${n.id}-badge-${A}`)),e[44]=n.id,e[45]=u,e[46]=$):$=e[46];let D;e[47]!==x?(D=x>0&&s.jsxs(G,{variant:"outline",children:["+",x]}),e[47]=x,e[48]=D):D=e[48];let M;e[49]!==$||e[50]!==D?(M=s.jsxs("div",{className:"flex flex-wrap gap-1",children:[$,D]}),e[49]=$,e[50]=D,e[51]=M):M=e[51];let E;return e[52]!==N||e[53]!==v||e[54]!==M?(E=s.jsxs(me,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[N,v,M]}),e[52]=N,e[53]=v,e[54]=M,e[55]=E):E=e[55],E}function Us(t){const e=X.c(27),{value:n,onChange:r,onFileUpload:o,error:l,isUploading:a}=t,i=a===void 0?!1:a,[c,m]=T.useState(!1),[u,x]=T.useState(!1),p=T.useRef(null);let h;e[0]!==i?(h=R=>{R.preventDefault(),i||m(!0)},e[0]=i,e[1]=h):h=e[1];const d=h;let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=R=>{R.preventDefault(),m(!1)},e[2]=b):b=e[2];const j=b;let _;e[3]!==i||e[4]!==o?(_=async R=>{if(R.preventDefault(),m(!1),i)return;const v=R.dataTransfer.files[0];v&&await o(v)},e[3]=i,e[4]=o,e[5]=_):_=e[5];const k=_;let y;e[6]!==i||e[7]!==o?(y=async R=>{const v=R.target.files?.[0];v&&!i&&await o(v),R.target.value=""},e[6]=i,e[7]=o,e[8]=y):y=e[8];const g=y,I=n.length>0;let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(le,{children:"Image"}),e[9]=f):f=e[9];let w;e[10]!==d||e[11]!==k||e[12]!==I||e[13]!==c||e[14]!==i||e[15]!==r||e[16]!==u||e[17]!==n?(w=I?s.jsx("div",{className:"relative group min-h-[180px] rounded-xl border border-border overflow-hidden bg-muted/10",children:s.jsxs("div",{className:"flex items-center gap-3 p-3 h-full",children:[s.jsx("div",{className:"size-20 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0",children:s.jsx("img",{src:n,alt:"Preview",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>p.current?.click(),disabled:i,children:[s.jsx(es,{className:"size-3"}),"Change"]}),s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{r(""),x(!1)},disabled:i,children:[s.jsx(It,{className:"size-3"}),"Remove"]})]})]})]})}):i?s.jsxs("div",{className:"relative min-h-[180px] rounded-xl border border-border bg-muted/10 flex flex-col items-center justify-center gap-3",children:[s.jsx(ut,{className:"size-8 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):s.jsxs("div",{className:ne("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",c?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:d,onDragLeave:j,onDrop:k,onClick:()=>p.current?.click(),children:[s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6 px-4 flex-1",children:[s.jsx("div",{className:ne("size-10 rounded-lg flex items-center justify-center transition-colors",c?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:s.jsx(Ds,{size:20})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:c?"Drop image here":"Click or drag to upload"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"PNG, JPG, SVG up to 2MB"})]})]}),u?s.jsx("div",{className:"border-t border-border px-3 py-2",onClick:br,children:s.jsx(je,{placeholder:"https://example.com/logo.png",value:n,className:"text-xs h-8",onChange:R=>r(R.target.value)})}):s.jsx("div",{className:"border-t border-border px-4 py-2",children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors w-full justify-center",onClick:R=>{R.stopPropagation(),x(!0)},children:[s.jsx(Nn,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=d,e[11]=k,e[12]=I,e[13]=c,e[14]=i,e[15]=r,e[16]=u,e[17]=n,e[18]=w):w=e[18];let S;e[19]!==g?(S=s.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:g}),e[19]=g,e[20]=S):S=e[20];let P;e[21]!==l?(P=l&&s.jsx("p",{className:"text-xs text-destructive",children:l}),e[21]=l,e[22]=P):P=e[22];let N;return e[23]!==w||e[24]!==S||e[25]!==P?(N=s.jsxs("div",{className:"grid gap-1.5",children:[f,w,S,P]}),e[23]=w,e[24]=S,e[25]=P,e[26]=N):N=e[26],N}function br(t){return t.stopPropagation()}function qs(){const[t,e]=T.useState("idle"),[n,r]=T.useState(null),{org:o}=he(),l=be({connectionId:ve,orgId:o.id});return{discover:async(c,m)=>{if(!c)return null;e("loading"),r(null);try{const u=await l.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:c,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?vr(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:t,discoverError:n,resetDiscover:()=>{e("idle"),r(null)}}}function vr(t){const e=t.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function yr(t){const e=X.c(54),{tools:n,onChange:r,remoteUrl:o,remoteType:l,externalDiscoverStatus:a,externalDiscoverError:i}=t,[c,m]=T.useState(n.length>0),{discover:u,discoverStatus:x,discoverError:p,resetDiscover:h}=qs(),d=a??x,b=i??p;let j;e[0]!==u||e[1]!==r||e[2]!==l||e[3]!==o?(j=async()=>{if(!o)return;const z=await u(o,l??"http");z&&(r(z),m(!0))},e[0]=u,e[1]=r,e[2]=l,e[3]=o,e[4]=j):j=e[4];const _=j;let k;e[5]!==r||e[6]!==h?(k=()=>{r([]),h()},e[5]=r,e[6]=h,e[7]=k):k=e[7];const y=k;let g;e[8]!==c?(g=()=>m(!c),e[8]=c,e[9]=g):g=e[9];let I,f;e[10]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(ts,{size:14,className:"text-muted-foreground"}),f=s.jsx("span",{children:"Tools"}),e[10]=I,e[11]=f):(I=e[10],f=e[11]);let w;e[12]!==n.length?(w=n.length>0&&s.jsx(G,{variant:"secondary",className:"text-xs px-1.5 py-0",children:n.length}),e[12]=n.length,e[13]=w):w=e[13];let S;e[14]!==c?(S=c?s.jsx(gn,{size:14,className:"text-muted-foreground"}):s.jsx(Ts,{size:14,className:"text-muted-foreground"}),e[14]=c,e[15]=S):S=e[15];let P;e[16]!==g||e[17]!==w||e[18]!==S?(P=s.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:g,children:[I,f,w,S]}),e[16]=g,e[17]=w,e[18]=S,e[19]=P):P=e[19];let N;e[20]!==y||e[21]!==n.length?(N=n.length>0&&s.jsxs(F,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:y,children:[s.jsx(It,{size:12}),"Clear"]}),e[20]=y,e[21]=n.length,e[22]=N):N=e[22];let R;e[23]!==d||e[24]!==_||e[25]!==o||e[26]!==n.length?(R=o&&s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all",onClick:_,disabled:d==="loading",children:[d==="loading"?s.jsx(ut,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),d==="loading"?"Discovering...":n.length>0?"Refresh":"Auto-discover"]}),e[23]=d,e[24]=_,e[25]=o,e[26]=n.length,e[27]=R):R=e[27];let v;e[28]!==R||e[29]!==N?(v=s.jsxs("div",{className:"flex items-center gap-2",children:[N,R]}),e[28]=R,e[29]=N,e[30]=v):v=e[30];let $;e[31]!==v||e[32]!==P?($=s.jsxs("div",{className:"flex items-center justify-between",children:[P,v]}),e[31]=v,e[32]=P,e[33]=$):$=e[33];let D;e[34]!==d||e[35]!==n.length?(D=d==="success"&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400 bg-green-50 dark:bg-green-950/30 rounded-lg px-3 py-2",children:[s.jsx(ft,{size:14,className:"shrink-0"}),s.jsxs("span",{children:["Discovered ",n.length," tool",n.length!==1?"s":""," ","successfully."]})]}),e[34]=d,e[35]=n.length,e[36]=D):D=e[36];let M;e[37]!==b||e[38]!==d?(M=d==="error"&&b&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:b})]}),e[37]=b,e[38]=d,e[39]=M):M=e[39];let E;e[40]!==c||e[41]!==n?(E=c&&n.length>0&&s.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:n.map(Nr)}),e[40]=c,e[41]=n,e[42]=E):E=e[42];let A;e[43]!==d||e[44]!==c||e[45]!==o||e[46]!==n.length?(A=c&&n.length===0&&d==="idle"&&s.jsx("p",{className:"text-xs text-muted-foreground px-1",children:o?'Click "Auto-discover" to load tools from the MCP server.':"Add a Remote URL first, then tools can be auto-discovered."}),e[43]=d,e[44]=c,e[45]=o,e[46]=n.length,e[47]=A):A=e[47];let q;return e[48]!==$||e[49]!==D||e[50]!==M||e[51]!==E||e[52]!==A?(q=s.jsxs("div",{className:"space-y-3",children:[$,D,M,E,A]}),e[48]=$,e[49]=D,e[50]=M,e[51]=E,e[52]=A,e[53]=q):q=e[53],q}function Nr(t){return s.jsx("div",{className:"flex items-center gap-3 px-3 py-2",children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-mono truncate",children:t.name}),t.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.description})]})},t.name)}function Fs(t){const{org:e}=he(),[n,r]=T.useState(!1),l=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,a=be({connectionId:l??"noop",orgId:e.id});return{uploadImage:async(c,m)=>{if(!l)return Z.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!c.type.startsWith("image/"))return Z.error("Only image files are supported"),null;if(c.size>5*1024*1024)return Z.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:c.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:c,headers:{"Content-Type":c.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}}),d=h.structuredContent?.url||h.url;if(!d)throw new Error("Failed to get public URL");return d}catch(u){return console.error("Image upload failed:",u),Z.error(u instanceof Error?u.message:"Failed to upload image. Please try again."),null}finally{r(!1)}},isUploading:n}}function wr(){const{org:t}=he(),[e,n]=T.useState(null),r=T.useRef(0),o=be({connectionId:ve,orgId:t.id});return{generate:async a=>{r.current+=1,n(a.type);try{const i=await o.callTool({name:"REGISTRY_AI_GENERATE",arguments:a});if(i.isError){const c=i.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(c)}return i.structuredContent??i}finally{r.current-=1,r.current===0&&n(null)}},loadingType:e,isGenerating:e!==null}}const Cr=new Set(["http","sse","stdio"]),_r=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,xs=["internal","automation","support","sales","ops","ai"],Bs=["productivity","communication","customer-support","development","data","operations"],kr=["Essentials","Details","Advanced"],ht="h-7 text-xs border-green-500/30 text-green-600 dark:text-green-400 shadow-[0_0_8px_rgba(34,197,94,0.3)] hover:shadow-[0_0_14px_rgba(34,197,94,0.5)] hover:border-green-500/50 transition-all";function hs(t){return t.replace(/^https?:\/\//i,"").trim()}function pt(t){const e=t.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function ot(t){return t.trim().toLowerCase()}function Tt(t){return Array.from(new Set(t.map(ot).filter(e=>e.length>0)))}function mt(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Sr(t){const e=X.c(4),{current:n}=t;let r;e[0]!==n?(r=kr.map((l,a)=>{const i=a+1,c=i===n,m=i<n;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[a>0&&s.jsx("div",{className:ne("w-4 h-px",m?"bg-primary":"bg-border")}),s.jsxs("div",{className:ne("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",c?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[s.jsx("span",{className:ne("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",c?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:i}),s.jsx("span",{className:"hidden sm:inline",children:l})]})]},l)}),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center gap-1.5",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Rr(t){const e=X.c(28),{id:n,label:r,values:o,availableOptions:l,placeholder:a,onChange:i}=t,[c,m]=T.useState(""),[u,x]=T.useState(!1);let p,h,d,b,j;if(e[0]!==l||e[1]!==n||e[2]!==c||e[3]!==u||e[4]!==r||e[5]!==i||e[6]!==a||e[7]!==o){const y=Tt(l),g=Tt(o),I=new Set(g),f=ot(c),w=y.filter(M=>!I.has(M)).filter(M=>f?M.includes(f):!0).slice(0,8),S=M=>{const E=ot(M);!E||I.has(E)||i([...g,E])},P=M=>{i(g.filter(E=>E!==M))},N=()=>{const M=c.split(/[,\n;]/).map(ot).filter(Boolean);if(M.length===0)return;const E=[...g];for(const A of M)E.includes(A)||E.push(A);i(E),m("")},R=f;b="grid gap-2",e[13]!==n||e[14]!==r?(j=s.jsx(le,{htmlFor:n,children:r}),e[13]=n,e[14]=r,e[15]=j):j=e[15],p="relative";let v;e[16]!==n?(v=()=>{const M=document.getElementById(n);M instanceof HTMLInputElement&&M.focus()},e[16]=n,e[17]=v):v=e[17];let $;e[18]===Symbol.for("react.memo_cache_sentinel")?($=()=>x(!0),e[18]=$):$=e[18];let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=M=>m(M.target.value),e[19]=D):D=e[19],h=s.jsx("div",{className:"min-h-9 w-full rounded-xl border border-input bg-background px-2.5 py-1.5 text-sm focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",onClick:v,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[g.map(M=>s.jsxs(G,{variant:"secondary",className:"gap-1",children:[M,s.jsx("button",{type:"button",onClick:E=>{E.preventDefault(),E.stopPropagation(),P(M)},children:s.jsx(yn,{size:12})})]},`${n}-${M}`)),s.jsx("input",{id:n,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:g.length?"":a,value:c,onFocus:$,onBlur:()=>{x(!1),N()},onChange:D,onKeyDown:M=>{if(M.key==="Enter"||M.key===","){M.preventDefault(),N();return}M.key==="Backspace"&&!c&&g.length&&P(g[g.length-1]??"")}})]})}),d=u&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:w.length>0?w.map(M=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Ir,onClick:()=>{S(M),m("")},children:M},`${n}-suggestion-${M}`)):R?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Tr,onClick:()=>{S(R),m("")},children:['Create "',R,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})}),e[0]=l,e[1]=n,e[2]=c,e[3]=u,e[4]=r,e[5]=i,e[6]=a,e[7]=o,e[8]=p,e[9]=h,e[10]=d,e[11]=b,e[12]=j}else p=e[8],h=e[9],d=e[10],b=e[11],j=e[12];let _;e[20]!==p||e[21]!==h||e[22]!==d?(_=s.jsxs("div",{className:p,children:[h,d]}),e[20]=p,e[21]=h,e[22]=d,e[23]=_):_=e[23];let k;return e[24]!==b||e[25]!==j||e[26]!==_?(k=s.jsxs("div",{className:b,children:[j,_]}),e[24]=b,e[25]=j,e[26]=_,e[27]=k):k=e[27],k}function Tr(t){return t.preventDefault()}function Ir(t){return t.preventDefault()}function Mr({id:t,value:e,availableOptions:n,onChange:r}){const[o,l]=T.useState(e),[a,i]=T.useState(!1),c=T.useRef(e);c.current!==e&&(c.current=e,l(e));const m=Tt([...Bs,...n,e]).filter(Boolean),u=ot(o),x=m.filter(h=>u?h.includes(u):!0).slice(0,8),p=h=>{const d=ot(h);r(d),l(d),i(!1)};return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(le,{htmlFor:t,children:"Category"}),s.jsxs("div",{className:"relative",children:[s.jsx(je,{id:t,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&&s.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground hover:text-foreground",onMouseDown:h=>h.preventDefault(),onClick:()=>{r(""),l("")},children:"clear"}),a&&s.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-border bg-background shadow-lg max-h-56 overflow-y-auto",children:x.length>0?x.map(h=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:d=>d.preventDefault(),onClick:()=>p(h),children:h},`${t}-${h}`)):u?s.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,'"']}):s.jsx("div",{className:"px-2.5 py-1.5 text-sm text-muted-foreground",children:"Type to search or create."})})]})]})}function Pr({open:t,onOpenChange:e,item:n,draft:r,availableTags:o=[],availableCategories:l=[],defaultLLMConnectionId:a="",defaultLLMModelId:i="",isSubmitting:c=!1,onSubmit:m}){const{org:u}=he(),{uploadImage:x,isUploading:p}=Fs(),{generate:h,loadingType:d}=wr(),{discover:b,discoverStatus:j,discoverError:_,resetDiscover:k}=qs(),y=!!n,g=r?._meta?.["mcp.mesh"],I=n?.title??r?.title??"",f=n?.id?.split("/")[0]??r?.id?.split("/")[0]??"",w=n?.description??r?.description??"",S=n?._meta?.["mcp.mesh"]?.short_description??g?.short_description??"",P=n?._meta?.["mcp.mesh"]?.owner??g?.owner??"",N=n?.server?.repository?.url??r?.server?.repository?.url??"",R=n?._meta?.["mcp.mesh"]?.readme??g?.readme??"",v=n?._meta?.["mcp.mesh"]?.readme_url??g?.readme_url??"",$=hs(n?.server?.remotes?.[0]?.url??r?.server?.remotes?.[0]?.url??""),D=n?.server?.remotes?.[0]?.type??r?.server?.remotes?.[0]?.type??"http",M=n?._meta?.["mcp.mesh"]?.tags??g?.tags??[],E=n?._meta?.["mcp.mesh"]?.categories?.[0]??g?.categories?.[0]??"",A=n?.server?.icons?.[0]?.src??r?.server?.icons?.[0]?.src??"",q=n?._meta?.["mcp.mesh"]?.tools??g?.tools??[],z=n?.is_public??r?.is_public??!1,[O,B]=T.useState(1),[Q,te]=T.useState(I),[se,re]=T.useState(f),[ie,ae]=T.useState(w),[oe,pe]=T.useState(S),[ue,C]=T.useState(P),[K,V]=T.useState(N),[ce,fe]=T.useState(R),[we,Ce]=T.useState(v),[J,_e]=T.useState(R?"content":"link"),[xe,ke]=T.useState($),[ee,ge]=T.useState(D),[Re,ye]=T.useState(M),[Me,Ee]=T.useState(E),[Se,ze]=T.useState(A),[Ne,Fe]=T.useState(q),[Be,Xe]=T.useState(z),[L,de]=T.useState({}),Te=!!(a&&i),De=()=>{B(1),te(I),re(f),ae(w),pe(S),C(P),V(N),fe(R),Ce(v),_e(R?"content":"link"),ke($),ge(D),ye(M),Ee(E),ze(A),Fe(q),Xe(z),de({}),k(),Ge.current="",Pe.current&&(clearTimeout(Pe.current),Pe.current=null)},st=async U=>{if(!U)return;const Y=y?n?.id:`${se}/${Q}`.toLowerCase(),Le=mt(Y||"temp"),Ye=U.name.split(".").pop()||"png",He=`registry/${u.id}/${Le}/icon.${Ye}`,dt=await x(U,He);dt?(ze(dt),de(We=>({...We,imageUrl:void 0}))):de(We=>({...We,imageUrl:"Failed to upload image. Please try again."}))},Pe=T.useRef(null),Ge=T.useRef(""),nt=T.useRef(ee);nt.current=ee;const ct=U=>{!U&&Pe.current&&(clearTimeout(Pe.current),Pe.current=null),e(U),U||De()},rt=async()=>{const U=pt(xe);if(!U)return;Ge.current=U;const Y=await b(U,nt.current);Y&&Fe(Y)},it=U=>{Pe.current&&clearTimeout(Pe.current);const Y=pt(U);!Y||Y===Ge.current||U.includes(".")&&(Pe.current=setTimeout(async()=>{Ge.current=Y;const Le=await b(Y,nt.current);Le&&Fe(Le)},800))},Ke=()=>Te?{llmConnectionId:a,modelId:i}:null,Ve=()=>({name:Q.trim(),provider:se.trim(),url:pt(xe),owner:ue.trim(),repositoryUrl:K.trim(),description:ie.trim(),shortDescription:oe.trim(),tags:Re,categories:Me?[Me]:[],availableTags:[...xs,...o],availableCategories:[...Bs,...l],tools:Ne}),lt=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"description",context:Ve()});Y.result&&ae(Y.result.slice(0,1500))},at=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"short_description",context:Ve()});Y.result&&pe(Y.result.slice(0,160))},W=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"tags",context:Ve()});Y.items?.length&&ye(Tt(Y.items))},Ie=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"categories",context:Ve()});Y.items?.[0]&&Ee(ot(Y.items[0]))},xt=async()=>{const U=Ke();if(!U)return;const Y=await h({...U,type:"readme",context:Ve()});Y.result&&(fe(Y.result.slice(0,5e4)),_e("content"))},rs=U=>{const Y={};if(U===1){const Le=mt(se),Ye=mt(Q),He=`${Le}/${Ye}`;Q.trim()||(Y.title="Name is required."),y||(Le?Ye?_r.test(He)||(Y.provider="Use lowercase letters/numbers and separators '/' or '-'."):Y.title="Name must contain valid characters.":Y.provider="Provider is required.");const dt=pt(xe),We=ee.trim().toLowerCase();if(We!=="stdio"&&dt)try{const gt=new URL(dt);["http:","https:"].includes(gt.protocol)||(Y.remoteUrl="Remote URL must be http(s).")}catch{Y.remoteUrl="Remote URL is invalid."}if(We&&!Cr.has(We)&&(Y.remoteType="Remote type must be: http, sse or stdio."),Se.trim()&&!Se.trim().startsWith("data:image/"))try{const Vt=new URL(Se.trim());["http:","https:"].includes(Vt.protocol)||(Y.imageUrl="Image URL must be http(s).")}catch{Y.imageUrl="Image URL is invalid."}}if(U===2&&(ie.length>1500&&(Y.description="Description must be 1500 characters or less."),oe.trim().length>160&&(Y.shortDescription="Short description must be 160 characters or less.")),U===3){const Le=we.trim();if(Le)try{const He=new URL(Le);["http:","https:"].includes(He.protocol)||(Y.readmeUrl="README URL must be http(s).")}catch{Y.readmeUrl="README URL is invalid."}ce.trim().length>5e4&&(Y.readme="README must be 50 000 characters or less.");const Ye=K.trim();if(Ye)try{const He=new URL(Ye);["http:","https:"].includes(He.protocol)||(Y.repositoryUrl="Repository URL must be http(s).")}catch{Y.repositoryUrl="Repository URL is invalid."}}return de(Y),Object.values(Y).every(Le=>Le===void 0)},Hs=()=>{rs(O)&&O<3&&B(O+1)},Ws=()=>{O>1&&B(O-1)},Js=async()=>{if(!rs(3))return;const U=Q.trim(),Y=mt(se),Le=mt(U),Ye=`${Y}/${Le}`,He=pt(xe),dt=ee.trim().toLowerCase(),We=Se.trim(),gt=K.trim(),Vt=oe.trim(),tn=ce.trim(),sn=we.trim(),nn=Tt(Re),rn=Me?[ot(Me)]:[],ln=n?n.server?.name??n.id:"",an=(y?ln:Ye).trim(),Yt=ie.trim(),on=ue.trim(),is={title:U,description:Yt.length>0?Yt:null,is_public:Be,_meta:{"mcp.mesh":{tags:nn,categories:rn,short_description:Vt||null,owner:on||null,readme:tn||null,readme_url:sn||null,...Ne.length>0?{tools:Ne}:{}}},server:{name:an,title:U,description:Yt||void 0,icons:We?[{src:We}]:[],repository:gt?{url:gt}:void 0,remotes:He?[{type:dt||"http",url:He}]:[]}};if(y&&n){await m({id:n.id,data:is}),e(!1);return}await m({id:Ye,...is}),e(!1),De()},Zs=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"row-span-2 grid gap-3 content-start",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-provider",children:"Provider"}),s.jsx(je,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:se,onChange:U=>re(U.target.value),disabled:y}),!y&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",s.jsx("span",{className:"font-mono",children:`${mt(se)||"provider"}/${mt(Q)||"name"}`})]}),L.provider&&s.jsx("p",{className:"text-xs text-destructive",children:L.provider})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-title",children:"Name"}),s.jsx(je,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:Q,onChange:U=>te(U.target.value)}),L.title&&s.jsx("p",{className:"text-xs text-destructive",children:L.title})]})]}),s.jsx("div",{className:"row-span-2 content-start",children:s.jsx(Us,{value:Se,onChange:U=>{ze(U),de(Y=>({...Y,imageUrl:void 0}))},onFileUpload:st,error:L.imageUrl,isUploading:p})}),s.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-remote-url",children:"Remote URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex-1 flex items-center rounded-xl border border-input px-3",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground mr-1",children:"https://"}),s.jsx("input",{id:"registry-remote-url",className:"flex-1 h-9 bg-transparent outline-none text-sm",placeholder:"example.com/mcp",value:xe,onChange:U=>{const Y=hs(U.target.value);ke(Y),it(Y)}})]}),s.jsxs(_s,{value:ee,onValueChange:ge,children:[s.jsx(ks,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:s.jsx(Ss,{placeholder:"Type"})}),s.jsxs(Rs,{children:[s.jsx(Et,{value:"http",children:"http"}),s.jsx(Et,{value:"sse",children:"sse"}),s.jsx(Et,{value:"stdio",children:"stdio"})]})]})]}),L.remoteUrl&&s.jsx("p",{className:"text-xs text-destructive",children:L.remoteUrl}),L.remoteType&&s.jsx("p",{className:"text-xs text-destructive",children:L.remoteType})]}),xe.trim()&&s.jsxs("div",{className:"col-span-2 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"gap-1.5"),onClick:rt,disabled:j==="loading",children:[j==="loading"?s.jsx(ut,{size:12,className:"animate-spin"}):s.jsx(es,{size:12}),j==="loading"?"Discovering tools...":Ne.length>0?"Re-discover tools":"Discover tools from URL"]}),Ne.length>0&&j!=="loading"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ne.length," tool",Ne.length!==1?"s":""," loaded"]})]}),j==="success"&&Ne.length>0&&s.jsxs("div",{className:"rounded-lg border border-green-500/20 bg-green-50 dark:bg-green-950/20 px-3 py-2 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-green-600 dark:text-green-400",children:[s.jsx(ft,{size:14,className:"shrink-0"}),s.jsxs("span",{className:"font-medium",children:[Ne.length," tool",Ne.length!==1?"s":""," discovered"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[Ne.slice(0,8).map(U=>s.jsx(G,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:U.name},U.name)),Ne.length>8&&s.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",Ne.length-8," more"]})]}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"These tools will enrich AI-generated descriptions, tags and categories in the next step."})]}),j==="auth_required"&&_&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/20 border border-amber-500/20 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:"This server requires authentication. The connection is valid but tools cannot be listed without credentials."})]}),j==="error"&&_&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive bg-destructive/10 rounded-lg px-3 py-2",children:[s.jsx(vt,{size:14,className:"shrink-0"}),s.jsx("span",{children:_})]})]})]}),Xs=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{htmlFor:"registry-item-short-description",children:"Short Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[oe.length,"/160"]}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="short_description",onClick:at,children:d==="short_description"?"Generating...":"AI Generate"})]})]}),s.jsx(je,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:oe,maxLength:160,onChange:U=>pe(U.target.value)}),L.shortDescription&&s.jsx("p",{className:"text-xs text-destructive",children:L.shortDescription})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{htmlFor:"registry-item-description",children:"Description"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ie.length,"/1500"]}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="description",onClick:lt,children:d==="description"?"Generating...":"AI Generate"})]})]}),s.jsx(Gt,{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:ie,onChange:U=>ae(U.target.value)}),L.description&&s.jsx("p",{className:"text-xs text-destructive",children:L.description})]}),s.jsx("div",{className:"border-t border-border"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Mr,{id:"registry-category",value:Me,availableOptions:l,onChange:Ee}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"justify-self-start"),disabled:d==="categories",onClick:Ie,children:d==="categories"?"Suggesting...":"AI Suggest"})]}),s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Rr,{id:"registry-tags",label:"Tags",values:Re,availableOptions:[...xs,...o],placeholder:"Type and press Enter or comma",onChange:ye}),Te&&s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ne(ht,"justify-self-start"),disabled:d==="tags",onClick:W,children:d==="tags"?"Suggesting...":"AI Suggest"})]})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border px-4 py-3",children:[s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx(le,{htmlFor:"registry-is-public",className:"text-sm",children:"Public"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Make this MCP visible in the public store URL."})]}),s.jsx(bt,{id:"registry-is-public",checked:Be,onCheckedChange:Xe})]})]}),en=s.jsxs("div",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),s.jsx(je,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:ue,onChange:U=>C(U.target.value)})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),s.jsx(je,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:K,onChange:U=>V(U.target.value)}),L.repositoryUrl&&s.jsx("p",{className:"text-xs text-destructive",children:L.repositoryUrl})]})]}),s.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(le,{children:"README"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[ce.length,"/50000"]})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(Te?["link","content","generate"]:["link","content"]).map(U=>s.jsx("button",{type:"button",className:ne("px-2.5 py-1 text-xs rounded-md",J===U?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>_e(U),children:U==="link"?"Link":U==="content"?"Content":"Generate"},U))}),J==="link"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(je,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:we,onChange:U=>Ce(U.target.value)}),L.readmeUrl&&s.jsx("p",{className:"text-xs text-destructive",children:L.readmeUrl})]}),J==="content"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Gt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
4
4
 
5
- Describe your MCP here...`,rows:6,value:ce,onChange:U=>fe(U.target.value)}),L.readme&&s.jsx("p",{className:"text-xs text-destructive",children:L.readme})]}),Te&&J==="generate"&&s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Generates a README using name, description, tools, category and tags as context."}),s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="readme",onClick:xt,children:d==="readme"?"Generating...":"Generate with AI"})]})]}),s.jsx(yr,{tools:Ne,onChange:Fe,remoteUrl:pt(xe)||void 0,remoteType:ee,externalDiscoverStatus:j,externalDiscoverError:_})]});return s.jsx(Bt,{open:t,onOpenChange:ct,children:s.jsxs(Ft,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(zt,{className:"space-y-3",children:[s.jsx(Ot,{children:y?"Edit MCP Server":"Add MCP Server"}),s.jsx(Sr,{current:O}),s.jsxs(Ut,{children:[O===1&&"Set up the identity, connection and discover available tools.",O===2&&"Add descriptions, categories and tags to help discovery.",O===3&&"Configure optional metadata, README and tools."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[O===1&&Zs,O===2&&Xs,O===3&&en]}),s.jsxs(qt,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[s.jsx("div",{children:O>1&&s.jsxs(F,{variant:"ghost",size:"sm",onClick:Ws,children:[s.jsx(jn,{size:14}),"Back"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(F,{variant:"outline",size:"sm",onClick:()=>ct(!1),disabled:c,children:"Cancel"}),O<3?s.jsxs(F,{size:"sm",onClick:Hs,children:["Next",s.jsx(bn,{size:14})]}):s.jsx(F,{size:"sm",onClick:Js,disabled:c,children:c?"Saving...":y?"Save changes":"Create"})]})]})]})})}function ps(t,e){return t.includes(e)?t.filter(n=>n!==e):[...t,e]}function Er(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Dr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function $r(t){return t.server?.remotes?.[0]?.url??"-"}function Ar(){const t=X.c(120),[e,n]=T.useState(""),r=T.useDeferredValue(e);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[l,a]=T.useState(o);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[1]=i):i=t[1];const[c,m]=T.useState(i),[u,x]=T.useState(!1),[p,h]=T.useState(!1),[d,b]=T.useState(null),[j,_]=T.useState(null),[k,y]=hn("private-registry-list","cards"),g=T.useRef(null);let I;t[2]!==r||t[3]!==c||t[4]!==l?(I={search:r,tags:l,categories:c},t[2]=r,t[3]=c,t[4]=l,t[5]=I):I=t[5];const f=Os(I),w=Hn(),{registryLLMConnectionId:S,registryLLMModelId:P}=Kt(tt),{createMutation:N,updateMutation:R,deleteMutation:v,bulkCreateMutation:$}=ns();let D,M,E,A,q,z,O,B;if(t[6]!==N||t[7]!==v||t[8]!==j||t[9]!==w.data||t[10]!==f||t[11]!==r||t[12]!==e||t[13]!==c||t[14]!==l||t[15]!==y||t[16]!==R||t[17]!==k){const J=f.data?.pages.flatMap(qr).filter(Boolean)??[],_e=f.data?.pages[0]?.totalCount??J.length,xe=l.length>0||c.length>0||r.length>0,ke=w.data;let ee;t[26]!==ke?(ee=Array.isArray(ke?.tags)?ke.tags:[],t[26]=ke,t[27]=ee):ee=t[27],B=ee;let ge;t[28]!==ke?(ge=Array.isArray(ke?.categories)?ke.categories:[],t[28]=ke,t[29]=ge):ge=t[29],D=ge;let Re;t[30]!==f?(Re=W=>{g.current&&(g.current.disconnect(),g.current=null),!(!W||!f.hasNextPage||f.isFetchingNextPage)&&(g.current=new IntersectionObserver(Ie=>{Ie[0]?.isIntersecting&&f.hasNextPage&&!f.isFetchingNextPage&&f.fetchNextPage()},{rootMargin:"240px 0px"}),g.current.observe(W))},t[30]=f,t[31]=Re):Re=t[31];const ye=Re;let Me;t[32]!==N||t[33]!==R?(Me=async W=>{try{"data"in W?(await R.mutateAsync(W),Z.success("Registry item updated")):(await N.mutateAsync(W),Z.success("Registry item created"))}catch(Ie){const xt=Ie;throw Z.error(xt instanceof Error?xt.message:"Failed to save item"),xt}},t[32]=N,t[33]=R,t[34]=Me):Me=t[34],M=Me;let Ee;t[35]!==v||t[36]!==j?(Ee=async()=>{if(j)try{await v.mutateAsync(j.id),Z.success("Registry item deleted"),_(null)}catch(W){const Ie=W;Z.error(Ie instanceof Error?Ie.message:"Failed to delete item")}},t[35]=v,t[36]=j,t[37]=Ee):Ee=t[37],E=Ee,z="h-full flex flex-col";let Se;t[38]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t[38]=Se):Se=t[38];const ze=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[Se,s.jsx(G,{variant:"secondary",className:"text-xs",children:_e})]});let Ne;t[39]===Symbol.for("react.memo_cache_sentinel")?(Ne=s.jsx(Dt,{asChild:!0,children:s.jsxs(F,{variant:"outline",size:"sm",className:ne("h-8","gap-1.5"),children:[s.jsx(pn,{size:14}),"Filters"]})}),t[39]=Ne):Ne=t[39];let Fe;t[40]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsx(as,{children:"Tags"}),t[40]=Fe):Fe=t[40];let Be;t[41]!==l||t[42]!==B?(Be=B.length>0?B.map(W=>s.jsxs(ls,{checked:l.includes(W.value),onCheckedChange:()=>a(Ie=>ps(Ie,W.value)),children:[W.value," (",W.count,")"]},W.value)):s.jsx(Je,{disabled:!0,children:"No tags available"}),t[41]=l,t[42]=B,t[43]=Be):Be=t[43];let Xe,L;t[44]===Symbol.for("react.memo_cache_sentinel")?(Xe=s.jsx(un,{}),L=s.jsx(as,{children:"Categories"}),t[44]=Xe,t[45]=L):(Xe=t[44],L=t[45]);let de;t[46]!==D||t[47]!==c?(de=D.length>0?D.map(W=>s.jsxs(ls,{checked:c.includes(W.value),onCheckedChange:()=>m(Ie=>ps(Ie,W.value)),children:[W.value," (",W.count,")"]},W.value)):s.jsx(Je,{disabled:!0,children:"No categories available"}),t[46]=D,t[47]=c,t[48]=de):de=t[48];let Te;t[49]!==Be||t[50]!==de?(Te=s.jsxs($t,{children:[Ne,s.jsxs(At,{align:"end",className:"w-[260px]",children:[Fe,Be,Xe,L,de]})]}),t[49]=Be,t[50]=de,t[51]=Te):Te=t[51];let De;t[52]!==y?(De=W=>{(W==="cards"||W==="table")&&y(W)},t[52]=y,t[53]=De):De=t[53];let st,Pe;t[54]===Symbol.for("react.memo_cache_sentinel")?(st=s.jsx(os,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),Pe=s.jsx(os,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"}),t[54]=st,t[55]=Pe):(st=t[54],Pe=t[55]);let Ge;t[56]!==De||t[57]!==k?(Ge=s.jsxs(xn,{type:"single",value:k,onValueChange:De,variant:"outline",className:"h-8",children:[st,Pe]}),t[56]=De,t[57]=k,t[58]=Ge):Ge=t[58];let nt;t[59]===Symbol.for("react.memo_cache_sentinel")?(nt=s.jsx(F,{variant:"outline",size:"sm",className:"h-8",onClick:()=>h(!0),children:"Import CSV"}),t[59]=nt):nt=t[59];let ct;t[60]===Symbol.for("react.memo_cache_sentinel")?(ct=s.jsx(F,{size:"sm",className:"h-8",onClick:()=>x(!0),children:"Add MCP Servers"}),t[60]=ct):ct=t[60];let rt;t[61]!==Te||t[62]!==Ge?(rt=s.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[Te,Ge,nt,ct]}),t[61]=Te,t[62]=Ge,t[63]=rt):rt=t[63];let it;t[64]!==ze||t[65]!==rt?(it=s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[ze,rt]}),t[64]=ze,t[65]=rt,t[66]=it):it=t[66];let Ke;t[67]===Symbol.for("react.memo_cache_sentinel")?(Ke=s.jsx(Cs,{size:16,className:"text-muted-foreground shrink-0"}),t[67]=Ke):Ke=t[67];let Ve;t[68]===Symbol.for("react.memo_cache_sentinel")?(Ve=W=>n(W.target.value),t[68]=Ve):Ve=t[68];let lt;t[69]!==e?(lt=s.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[Ke,s.jsx(je,{value:e,onChange:Ve,placeholder:"Search by id, title, description, or server name",className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),t[69]=e,t[70]=lt):lt=t[70];let at;t[71]!==xe||t[72]!==e||t[73]!==c||t[74]!==l?(at=xe&&s.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[l.map(Ur),c.map(Or),e.trim()&&s.jsxs(G,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{n(""),a([]),m([])},children:"Clear filters"})]}),t[71]=xe,t[72]=e,t[73]=c,t[74]=l,t[75]=at):at=t[75],t[76]!==it||t[77]!==lt||t[78]!==at?(O=s.jsxs("div",{className:"shrink-0 border-b border-border",children:[it,lt,at]}),t[76]=it,t[77]=lt,t[78]=at,t[79]=O):O=t[79],A="flex-1 overflow-auto px-4 md:px-6 py-4",q=J.length===0?s.jsx("div",{className:"min-h-[320px] rounded-xl border border-dashed border-border flex flex-col items-center justify-center gap-3 p-6 text-center",children:f.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"size-5 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-medium",children:xe?"No items found":"No MCPs in your registry"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:xe?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!xe&&s.jsx(F,{size:"lg",onClick:()=>x(!0),children:"Add MCP Servers"})]})}):k==="cards"?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:J.map(W=>s.jsx(jr,{item:W,onEdit:b,onDelete:_},W.id))}),f.hasNextPage&&s.jsx("div",{ref:ye,className:"h-2"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"border rounded-lg overflow-auto",children:s.jsxs(vs,{children:[s.jsx(ys,{children:s.jsxs(Lt,{children:[s.jsx(Oe,{className:"w-[56px]",children:"Icon"}),s.jsx(Oe,{children:"Title"}),s.jsx(Oe,{children:"ID"}),s.jsx(Oe,{children:"Tags"}),s.jsx(Oe,{children:"Categories"}),s.jsx(Oe,{children:"Remote URL"}),s.jsx(Oe,{children:"Visibility"}),s.jsx(Oe,{className:"text-right w-[68px]",children:"Actions"})]})}),s.jsx(Ns,{children:J.map(W=>s.jsxs(Lt,{children:[s.jsx(Ue,{children:s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:W.server?.icons?.[0]?.src?s.jsx("img",{src:W.server.icons[0].src,alt:W.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:W.title.charAt(0).toUpperCase()})})}),s.jsx(Ue,{children:W.title}),s.jsx(Ue,{className:"font-mono",children:W.id}),s.jsx(Ue,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Er(W).slice(0,3).map(Ie=>s.jsx(G,{variant:"outline",children:Ie},`${W.id}-tag-${Ie}`))})}),s.jsx(Ue,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Dr(W).slice(0,3).map(Ie=>s.jsx(G,{variant:"outline",children:Ie},`${W.id}-category-${Ie}`))})}),s.jsx(Ue,{children:$r(W)}),s.jsx(Ue,{children:W.is_public?s.jsxs(G,{variant:"default",className:"gap-1",children:[s.jsx(ws,{size:10}),"Public"]}):s.jsx(G,{variant:"secondary",children:"Private"})}),s.jsx(Ue,{className:"text-right",children:s.jsxs($t,{children:[s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),s.jsxs(At,{align:"end",children:[s.jsx(Je,{onClick:()=>b(W),children:"Edit"}),s.jsx(Je,{variant:"destructive",onClick:()=>_(W),children:"Delete"})]})]})})]},W.id))})]})}),f.hasNextPage&&s.jsx("div",{ref:ye,className:"h-2"})]}),t[6]=N,t[7]=v,t[8]=j,t[9]=w.data,t[10]=f,t[11]=r,t[12]=e,t[13]=c,t[14]=l,t[15]=y,t[16]=R,t[17]=k,t[18]=D,t[19]=M,t[20]=E,t[21]=A,t[22]=q,t[23]=z,t[24]=O,t[25]=B}else D=t[18],M=t[19],E=t[20],A=t[21],q=t[22],z=t[23],O=t[24],B=t[25];let Q;t[80]!==f.isFetchingNextPage?(Q=f.isFetchingNextPage&&s.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(ut,{className:"size-4 animate-spin"}),"Loading more items..."]}),t[80]=f.isFetchingNextPage,t[81]=Q):Q=t[81];let te;t[82]!==A||t[83]!==q||t[84]!==Q?(te=s.jsxs("div",{className:A,children:[q,Q]}),t[82]=A,t[83]=q,t[84]=Q,t[85]=te):te=t[85];const se=d?.id??"create",re=u||!!d;let ie;t[86]===Symbol.for("react.memo_cache_sentinel")?(ie=J=>{J||(x(!1),b(null))},t[86]=ie):ie=t[86];let ae;t[87]!==B?(ae=B.map(zr),t[87]=B,t[88]=ae):ae=t[88];let oe;t[89]!==D?(oe=D.map(Lr),t[89]=D,t[90]=oe):oe=t[90];const pe=N.isPending||R.isPending;let ue;t[91]!==d||t[92]!==M||t[93]!==S||t[94]!==P||t[95]!==re||t[96]!==ae||t[97]!==oe||t[98]!==pe||t[99]!==se?(ue=s.jsx(Pr,{open:re,onOpenChange:ie,item:d,availableTags:ae,availableCategories:oe,defaultLLMConnectionId:S,defaultLLMModelId:P,isSubmitting:pe,onSubmit:M},se),t[91]=d,t[92]=M,t[93]=S,t[94]=P,t[95]=re,t[96]=ae,t[97]=oe,t[98]=pe,t[99]=se,t[100]=ue):ue=t[100];let C;t[101]!==$?(C=async J=>{try{const _e=await $.mutateAsync(J);return Z.success(`Imported ${_e.created} item(s)`),_e}catch(_e){const xe=_e;throw Z.error(xe instanceof Error?xe.message:"Failed to import CSV"),xe}},t[101]=$,t[102]=C):C=t[102];let K;t[103]!==$.isPending||t[104]!==p||t[105]!==C?(K=s.jsx(or,{open:p,onOpenChange:h,isImporting:$.isPending,onImport:C}),t[103]=$.isPending,t[104]=p,t[105]=C,t[106]=K):K=t[106];const V=!!j;let ce;t[107]===Symbol.for("react.memo_cache_sentinel")?(ce=J=>{J||_(null)},t[107]=ce):ce=t[107];const fe=j?.title??j?.id??"";let we;t[108]!==v.isPending||t[109]!==E||t[110]!==V||t[111]!==fe?(we=s.jsx(xr,{open:V,onOpenChange:ce,title:fe,isDeleting:v.isPending,onConfirm:E}),t[108]=v.isPending,t[109]=E,t[110]=V,t[111]=fe,t[112]=we):we=t[112];let Ce;return t[113]!==ue||t[114]!==K||t[115]!==we||t[116]!==z||t[117]!==O||t[118]!==te?(Ce=s.jsxs("div",{className:z,children:[O,te,ue,K,we]}),t[113]=ue,t[114]=K,t[115]=we,t[116]=z,t[117]=O,t[118]=te,t[119]=Ce):Ce=t[119],Ce}function Lr(t){return t.value}function zr(t){return t.value}function Or(t){return s.jsx(G,{variant:"outline",children:t},`selected-category-${t}`)}function Ur(t){return s.jsxs(G,{variant:"default",children:["#",t]},`selected-tag-${t}`)}function qr(t){return t.items??[]}function Fr(t,e,n=!1){const r=T.useRef(null),o=T.useRef(t),l=T.useRef(e),a=T.useRef(n);return o.current=t,l.current=e,a.current=n,c=>{r.current&&r.current.disconnect(),r.current=new IntersectionObserver(m=>{m[0]?.isIntersecting&&l.current&&!a.current&&o.current()}),c&&r.current.observe(c)}}const Br=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function fs(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleDateString()}function gs(t){return{id:t.requested_id??t.server?.name,title:t.title,description:t.description??"",_meta:t._meta,server:t.server,is_public:!1}}function Zt(t){const e=t.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function jt(t){const e=t._meta?.["mcp.mesh"];return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Gr(){const[t,e]=T.useState("pending"),[n,r]=T.useState("created_at"),[o,l]=T.useState("asc"),[a,i]=T.useState(new Set),[c,m]=T.useState(!1),[u,x]=T.useState("private"),[p,h]=T.useState(!1),[d,b]=T.useState(null),[j,_]=T.useState(null),[k,y]=T.useState(null),[g,I]=T.useState(null),[f,w]=T.useState(""),S=Wn({status:t,sortBy:n,sortDirection:o}),{reviewMutation:P,deleteMutation:N}=er(),{createMutation:R}=ns(),v=S.data?.pages.flatMap(C=>C.items)??[],$=S.data?.pages[0]?.totalCount??0,D=S.isFetchingNextPage,M=!!S.hasNextPage,E=Fr(()=>{S.isFetchingNextPage||S.fetchNextPage()},M,D),A=new Set(v.filter(C=>C.status==="pending").map(C=>C.id)),q=v.filter(C=>A.has(C.id)),z=a.size,O=q.filter(C=>a.has(C.id)),B=v.filter(C=>a.has(C.id)).length,Q=q.length>0&&q.every(C=>a.has(C.id)),te=()=>i(new Set),se=(C,K)=>{i(V=>{const ce=new Set(V);return K?ce.add(C):ce.delete(C),ce})},re=C=>{i(K=>{const V=new Set(K);return V.has(C)?V.delete(C):V.add(C),V})},ie=()=>{i(C=>{const K=new Set(C);for(const V of q)K.add(V.id);return K})},ae=async()=>{const C=j;if(C){_(null),b(C.id);try{await P.mutateAsync({id:C.id,status:"approved",reviewerNotes:void 0});const K=gs(C);await R.mutateAsync({id:K.id,title:K.title,description:K.description,_meta:K._meta,server:K.server,is_public:K.is_public}),Z.success("Request approved and added to registry")}catch(K){const V=K instanceof Error?K.message:"Failed to approve request";V.includes("UNIQUE constraint")||V.includes("already exists")?Z.error("An item with this ID already exists in the registry. Delete or rename it first."):Z.error(V)}finally{b(null)}}},oe=async()=>{if(k)try{await P.mutateAsync({id:k.id,status:"rejected",reviewerNotes:f.trim()||void 0}),Z.success("Request rejected"),y(null),w("")}catch(C){Z.error(C instanceof Error?C.message:"Failed to reject request")}},pe=async C=>{try{await N.mutateAsync(C.id),Z.success("Request deleted")}catch(K){Z.error(K instanceof Error?K.message:"Failed to delete request")}},ue=async()=>{if(O.length===0||p)return;h(!0),m(!1);let C=0;const K=new Set;for(const ce of O)try{await P.mutateAsync({id:ce.id,status:"approved",reviewerNotes:void 0});const fe=gs(ce);await R.mutateAsync({id:fe.id,title:fe.title,description:fe.description,_meta:fe._meta,server:fe.server,is_public:u==="public"}),C++}catch{K.add(ce.id)}const V=K.size;C>0&&V===0?Z.success(`${C} request${C>1?"s":""} approved as ${u}.`):C>0&&V>0?Z.warning(`Approved ${C}. Failed ${V}. Failed items remain selected for retry.`):Z.error("Bulk approve failed. Selected items were kept for retry."),i(K),h(!1)};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border",children:s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),s.jsx(G,{variant:"secondary",className:"text-xs",children:$})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:Br.map(C=>s.jsx("button",{type:"button",className:ne("px-2.5 py-1 text-xs rounded-md transition-colors",t===C.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(C.value),onClickCapture:()=>te(),children:C.label},C.value))}),s.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${n}:${o}`,onChange:C=>{const[K,V]=C.target.value.split(":");r(K),l(V)},children:[s.jsx("option",{value:"created_at:asc",children:"Created at (oldest first)"}),s.jsx("option",{value:"created_at:desc",children:"Created at (newest first)"}),s.jsx("option",{value:"title:asc",children:"Alphabetical (A-Z)"}),s.jsx("option",{value:"title:desc",children:"Alphabetical (Z-A)"})]})]})]})}),s.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.isLoading?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):S.isError?s.jsxs(me,{className:"p-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:"Failed to load publish requests."}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.error instanceof Error?S.error.message:"Unknown error"})]}):v.length===0?s.jsx(me,{className:"p-8 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:t==="pending"?"No pending publish requests.":t==="approved"?"No approved publish requests.":"No rejected publish requests."})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:v.map(C=>{const K=Zt(C),V=jt(C),ce=C._meta?.["mcp.mesh"]?.tags??[],fe=C._meta?.["mcp.mesh"]?.categories??[],we=V.hasReadmeContent||V.hasReadmeLink||ce.length>0||fe.length>0,Ce=[C.requester_name,C.requester_email].filter(Boolean).join(" · ");return s.jsxs(me,{className:ne("p-3 grid gap-1.5",A.has(C.id)&&"cursor-pointer hover:bg-muted/30",a.has(C.id)&&"bg-accent/20"),onClick:()=>{A.has(C.id)&&re(C.id)},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[A.has(C.id)&&s.jsx(wn,{checked:a.has(C.id),className:"mt-0.5",onCheckedChange:J=>se(C.id,J===!0),onClick:J=>J.stopPropagation()}),s.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:K?s.jsx("img",{src:K,alt:C.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:C.title.slice(0,1).toUpperCase()})}),s.jsx("p",{className:"text-sm font-medium truncate",children:C.title})]}),s.jsx(G,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:C.status})]}),C.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:C.description}),we&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[V.hasReadmeContent&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"README"}),V.hasReadmeLink&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"README link"}),ce.slice(0,2).map(J=>s.jsx(G,{variant:"secondary",className:"text-[10px]",children:J},`${C.id}-tag-${J}`)),fe.slice(0,1).map(J=>s.jsx(G,{variant:"secondary",className:"text-[10px]",children:J},`${C.id}-category-${J}`))]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[Ce&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate",children:Ce}),s.jsx("span",{children:"·"})]}),s.jsx("span",{className:"shrink-0",children:fs(C.created_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[s.jsxs(F,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),I(C)},children:[s.jsx(Is,{size:13}),"View"]}),A.has(C.id)?s.jsxs(s.Fragment,{children:[s.jsxs(F,{size:"sm",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),_(C)},disabled:d!==null||p||a.has(C.id),children:[s.jsx(ft,{size:13}),d===C.id?"Approving...":a.has(C.id)?"Selected":"Approve"]}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),y(C),w("")},disabled:P.isPending,children:[s.jsx(_n,{size:13}),"Reject"]})]}):s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),pe(C)},disabled:N.isPending,children:[s.jsx(It,{size:13}),"Delete"]})]})]},C.id)})}),v.length>0&&M?s.jsx("div",{ref:E,className:"h-1 w-full"}):null,D&&v.length>0?s.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:"Loading more requests..."}):null]}),z>0?s.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:s.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:[s.jsxs("div",{className:"text-xs text-muted-foreground pr-1",children:[z," selected"]}),s.jsx(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie,disabled:Q,children:"Select all"}),s.jsx(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:te,children:"Clear selection"}),s.jsxs(F,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>m(!0),disabled:p,children:[s.jsx(ft,{size:13}),"Approve selected"]})]})}):null,s.jsx(Bt,{open:!!g,onOpenChange:C=>{C||I(null)},children:s.jsxs(Ft,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[s.jsxs(zt,{children:[s.jsx(Ot,{children:g?.title??"Request details"}),s.jsx(Ut,{children:"Review all metadata sent by the requester before approving."})]}),g&&s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[s.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Zt(g)?s.jsx("img",{src:Zt(g)||"",alt:g.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:g.title.slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:g.title}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:g.server?.name||g.id})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),s.jsx("span",{className:"capitalize",children:g.status})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:fs(g.created_at)})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Requester"}),s.jsx("span",{children:g.requester_name||"-"})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Email"}),s.jsx("span",{children:g.requester_email||"-"})]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Remote URL"}),s.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:g.server?.remotes?.[0]?.url??"-"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:g.description||"No description provided."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(g._meta?.["mcp.mesh"]?.tags??[]).length?(g._meta?.["mcp.mesh"]?.tags??[]).map(C=>s.jsx(G,{variant:"secondary",children:C},`${g.id}-detail-tag-${C}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(g._meta?.["mcp.mesh"]?.categories??[]).length?(g._meta?.["mcp.mesh"]?.categories??[]).map(C=>s.jsx(G,{variant:"secondary",children:C},`${g.id}-detail-category-${C}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"README"}),jt(g).hasReadmeContent?s.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap max-h-40 overflow-y-auto rounded-md border border-border bg-muted/20 px-2.5 py-2",children:jt(g).readmeContent}):jt(g).hasReadmeLink?s.jsxs("a",{href:jt(g).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:["Open README link",s.jsx(Cn,{size:14})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),s.jsx(qt,{children:s.jsx(F,{variant:"outline",onClick:()=>I(null),children:"Close"})})]})}),s.jsx(Rt,{open:!!j,onOpenChange:C=>{C||_(null)},children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Approve publish request?"}),s.jsxs(wt,{children:["This will add"," ",s.jsx("span",{className:"font-medium text-foreground",children:j?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{children:"Cancel"}),s.jsx(_t,{onClick:ae,children:"Approve"})]})]})}),s.jsx(Rt,{open:c,onOpenChange:m,children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Approve selected requests?"}),s.jsxs(wt,{children:["This will approve ",O.length," request",O.length>1?"s":""," and create all resulting apps with the same visibility setting."]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"bulk-visibility",children:"Visibility for all selected"}),s.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:u,onChange:C=>x(C.target.value),children:[s.jsx("option",{value:"private",children:"Private"}),s.jsx("option",{value:"public",children:"Public"})]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{disabled:p,children:"Cancel"}),s.jsx(_t,{onClick:ue,disabled:p||B===0,children:p?"Approving...":"Approve selected"})]})]})}),s.jsx(Bt,{open:!!k,onOpenChange:C=>{C||(y(null),w(""))},children:s.jsxs(Ft,{children:[s.jsxs(zt,{children:[s.jsx(Ot,{children:"Reject publish request?"}),s.jsx(Ut,{children:"This request will move to rejected status. You can leave optional notes for context."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),s.jsx(Gt,{id:"reject-notes",rows:4,value:f,onChange:C=>w(C.target.value),placeholder:"Reason for rejection..."})]}),s.jsxs(qt,{children:[s.jsx(F,{variant:"outline",onClick:()=>{y(null),w("")},children:"Cancel"}),s.jsx(F,{onClick:oe,disabled:P.isPending,children:P.isPending?"Rejecting...":"Reject"})]})]})})]})}function Gs(t){const e=X.c(104),{connectionId:n,modelId:r,connections:o,models:l,onConnectionChange:a,onModelChange:i,connectionLabel:c,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:x,className:p}=t,h=c===void 0?"LLM Connection":c,d=m===void 0?"Model":m,b=u===void 0?"Select LLM connection":u,j=x===void 0?"Select model":x,[_,k]=T.useState(!1),[y,g]=T.useState("");let I;if(e[0]!==r||e[1]!==l){let ee;e[3]!==r?(ee=ge=>ge.id===r,e[3]=r,e[4]=ee):ee=e[4],I=l.find(ee),e[0]=r,e[1]=l,e[2]=I}else I=e[2];const f=I;let w;if(e[5]!==l||e[6]!==y){const ee=y.trim().toLowerCase();w=ee?l.filter(ge=>ge.title.toLowerCase().includes(ee)||ge.id.toLowerCase().includes(ee)):l,e[5]=l,e[6]=y,e[7]=w}else w=e[7];const S=w;let P,N,R,v,$,D,M,E,A,q,z,O,B,Q,te,se,re,ie,ae,oe,pe,ue;if(e[8]!==p||e[9]!==n||e[10]!==h||e[11]!==b||e[12]!==o||e[13]!==d||e[14]!==j||e[15]!==a||e[16]!==_||e[17]!==y||e[18]!==f?.title){let ee;e[41]!==n?(ee=ze=>ze.id===n,e[41]=n,e[42]=ee):ee=e[42];const ge=o.find(ee);$=Kr,e[43]!==p?(ie=ne("grid gap-1.5",p),e[43]=p,e[44]=ie):ie=e[44],e[45]!==d?(ae=s.jsx(le,{children:d}),e[45]=d,e[46]=ae):ae=e[46],v=kn,te=_,se=k;const Re=f?.title||j;let ye;e[47]!==Re?(ye=s.jsx("span",{className:"truncate text-left",children:Re}),e[47]=Re,e[48]=ye):ye=e[48];let Me;e[49]===Symbol.for("react.memo_cache_sentinel")?(Me=s.jsx(Ts,{className:"size-4 shrink-0 opacity-60"}),e[49]=Me):Me=e[49],e[50]!==d||e[51]!==ye?(re=s.jsx(Sn,{asChild:!0,children:s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":d,children:[ye,Me]})}),e[50]=d,e[51]=ye,e[52]=re):re=e[52],R=Rn,O="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",B="start",Q=8,q="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Ee;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Cs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Ee):Ee=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=ze=>g(ze.target.value),e[54]=Se):Se=e[54],e[55]!==y?(z=s.jsxs("div",{className:"relative flex-1 min-w-0",children:[Ee,s.jsx(je,{value:y,onChange:Se,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=y,e[56]=z):z=e[56],A="w-auto shrink-0",N=_s,M=n,E=a,P=ks,oe="llm-connection-select",pe="h-9 min-w-[160px] max-w-[220px]",ue=h,D=ge?s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:ge.icon?s.jsx("img",{src:ge.icon,alt:ge.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:ge.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:ge.title})]}):s.jsx(Ss,{placeholder:b}),e[8]=p,e[9]=n,e[10]=h,e[11]=b,e[12]=o,e[13]=d,e[14]=j,e[15]=a,e[16]=_,e[17]=y,e[18]=f?.title,e[19]=P,e[20]=N,e[21]=R,e[22]=v,e[23]=$,e[24]=D,e[25]=M,e[26]=E,e[27]=A,e[28]=q,e[29]=z,e[30]=O,e[31]=B,e[32]=Q,e[33]=te,e[34]=se,e[35]=re,e[36]=ie,e[37]=ae,e[38]=oe,e[39]=pe,e[40]=ue}else P=e[19],N=e[20],R=e[21],v=e[22],$=e[23],D=e[24],M=e[25],E=e[26],A=e[27],q=e[28],z=e[29],O=e[30],B=e[31],Q=e[32],te=e[33],se=e[34],re=e[35],ie=e[36],ae=e[37],oe=e[38],pe=e[39],ue=e[40];let C;e[57]!==P||e[58]!==D||e[59]!==oe||e[60]!==pe||e[61]!==ue?(C=s.jsx(P,{id:oe,className:pe,"aria-label":ue,children:D}),e[57]=P,e[58]=D,e[59]=oe,e[60]=pe,e[61]=ue,e[62]=C):C=e[62];let K;e[63]!==o?(K=o.map(Qr),e[63]=o,e[64]=K):K=e[64];let V;e[65]!==K?(V=s.jsx(Rs,{children:K}),e[65]=K,e[66]=V):V=e[66];let ce;e[67]!==N||e[68]!==M||e[69]!==E||e[70]!==C||e[71]!==V?(ce=s.jsxs(N,{value:M,onValueChange:E,children:[C,V]}),e[67]=N,e[68]=M,e[69]=E,e[70]=C,e[71]=V,e[72]=ce):ce=e[72];let fe;e[73]!==A||e[74]!==ce?(fe=s.jsx("div",{className:A,children:ce}),e[73]=A,e[74]=ce,e[75]=fe):fe=e[75];let we;e[76]!==q||e[77]!==z||e[78]!==fe?(we=s.jsxs("div",{className:q,children:[z,fe]}),e[76]=q,e[77]=z,e[78]=fe,e[79]=we):we=e[79];let Ce;e[80]!==S||e[81]!==$||e[82]!==r||e[83]!==i?(Ce=S.length===0?s.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):S.map(ee=>{const ge=ee.id===r,Re=$(ee.capabilities);return s.jsxs("button",{type:"button",className:ne("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",ge?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{i(ee.id),k(!1)},children:[s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/40 overflow-hidden shrink-0 flex items-center justify-center",children:ee.logo?s.jsx("img",{src:ee.logo,alt:ee.title,className:"w-full h-full object-contain"}):s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(ee.title||ee.id).slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:ee.title}),ee.title!==ee.id&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:ee.id})]}),Re.length>0&&s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:Re.map(ye=>s.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:ye},`${ee.id}-${ye}`))})]},ee.id)}),e[80]=S,e[81]=$,e[82]=r,e[83]=i,e[84]=Ce):Ce=e[84];let J;e[85]!==Ce?(J=s.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:Ce}),e[85]=Ce,e[86]=J):J=e[86];let _e;e[87]!==R||e[88]!==O||e[89]!==B||e[90]!==Q||e[91]!==we||e[92]!==J?(_e=s.jsxs(R,{className:O,align:B,sideOffset:Q,children:[we,J]}),e[87]=R,e[88]=O,e[89]=B,e[90]=Q,e[91]=we,e[92]=J,e[93]=_e):_e=e[93];let xe;e[94]!==v||e[95]!==te||e[96]!==se||e[97]!==re||e[98]!==_e?(xe=s.jsxs(v,{open:te,onOpenChange:se,children:[re,_e]}),e[94]=v,e[95]=te,e[96]=se,e[97]=re,e[98]=_e,e[99]=xe):xe=e[99];let ke;return e[100]!==ie||e[101]!==ae||e[102]!==xe?(ke=s.jsxs("div",{className:ie,children:[ae,xe]}),e[100]=ie,e[101]=ae,e[102]=xe,e[103]=ke):ke=e[103],ke}function Qr(t){return s.jsx(Et,{value:t.id,children:s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:t.icon?s.jsx("img",{src:t.icon,alt:t.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:t.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:t.title})]})},t.id)}function Kr(t){const e=new Set((t??[]).map(Vr)),n=[];return e.has("text")&&n.push("Text"),e.has("vision")&&n.push("Vision"),e.has("tools")&&n.push("Tools"),n}function Vr(t){return t.toLowerCase()}function Yr({initialName:t,initialIcon:e,initialLLMConnectionId:n,initialLLMModelId:r,initialAcceptPublishRequests:o,initialRequireApiToken:l,initialStorePrivateOnly:a,initialRateLimitEnabled:i,initialRateLimitWindow:c,initialRateLimitMax:m,revealedKey:u,onRevealedKeyChange:x}){const{org:p}=he(),{uploadImage:h,isUploading:d}=Fs(),{saveRegistryConfigMutation:b}=Kt(tt),[j,_]=T.useState(t),[k,y]=T.useState(e),[g,I]=T.useState(n),[f,w]=T.useState(r),[S,P]=T.useState(o),[N,R]=T.useState(l),[v,$]=T.useState(a),[D,M]=T.useState(i),[E,A]=T.useState(c),[q,z]=T.useState(String(m)),O=tr(),{generateMutation:B,revokeMutation:Q}=sr(),[te,se]=T.useState(""),[re,ie]=T.useState(!1),[ae,oe]=T.useState(null),{handleCopy:pe,copied:ue}=Ht(),{handleCopy:C,copied:K}=Ht(),{handleCopy:V,copied:ce}=Ht(),fe=Os({search:"",tags:[],categories:[],limit:50}),Ce=(Ms()??[]).filter(L=>(L.tools??[]).some(de=>de.name==="LLM_DO_GENERATE")),J=g||n||Ce[0]?.id||"",_e=js({connectionId:J||void 0,orgId:p.id}),xe=Ps(J||"no-llm-connection","LLM",_e),ke=`${window.location.origin}/org/${p.slug}/registry/mcp`,ge=(fe.data?.pages.flatMap(L=>L.items??[])??[]).filter(L=>L.is_public).length,Re=`${window.location.origin}/org/${p.slug}/registry/publish-request`,ye=u?.slice(0,12)??null,Me=!!(ye&&(O.data?.items??[]).some(L=>L.prefix===ye)),Ee=j.trim()!==t.trim()||k.trim()!==e.trim()||g.trim()!==n.trim()||f.trim()!==r.trim()||S!==o||N!==l||v!==a||D!==i||E!==c||(Number.parseInt(q,10)||100)!==m,Se=b.isPending,ze=async L=>{if(!L)return;const de=L.name.split(".").pop()||"png",Te=`registry/${p.id}/identity/icon.${de}`,De=await h(L,Te);De?y(De):Z.error("Failed to upload icon. Please try again.")},Ne=async()=>{const L=j.trim();if(!L)return;const de=f.trim(),Te=de?g.trim()||J||"":g.trim(),De=Number.parseInt(q,10),st=Number.isFinite(De)&&De>=1?De:100;try{await b.mutateAsync({registryName:L,registryIcon:k.trim(),llmConnectionId:Te,llmModelId:de,acceptPublishRequests:S,requireApiToken:N,storePrivateOnly:v,rateLimitEnabled:D,rateLimitWindow:E,rateLimitMax:st}),Z.success("Registry settings updated")}catch(Pe){Z.error(Pe instanceof Error?Pe.message:"Failed to save registry settings")}},Fe=()=>{_(t),y(e),I(n),w(r),P(o),R(l),$(a),M(i),A(c),z(String(m))},Be=async()=>{const L=te.trim();if(L)try{const de=await B.mutateAsync(L);de?.key&&(x(de.key),ie(!1),se(""),Z.success("API key generated. Copy it now — it won't be shown again!"))}catch(de){Z.error(de instanceof Error?de.message:"Failed to generate API key")}},Xe=async L=>{try{await Q.mutateAsync(L),x(null),oe(null),Z.success("API key revoked")}catch(de){Z.error(de instanceof Error?de.message:"Failed to revoke API key")}};return s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4 min-h-[32px]",children:[Ee&&s.jsxs(F,{variant:"outline",size:"sm",onClick:Fe,disabled:Se,children:[s.jsx(Tn,{size:14}),"Undo"]}),s.jsxs(F,{variant:"default",size:"sm",onClick:Ne,disabled:Se||!Ee,children:[Se?s.jsx(ut,{size:14,className:"animate-spin"}):s.jsx(In,{size:14}),"Save"]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(me,{className:"min-w-0 p-4 grid gap-4 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Registry Identity"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the name and icon shown in the store selector."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"identity-name",children:"Name"}),s.jsx(je,{id:"identity-name",value:j,onChange:L=>_(L.target.value),placeholder:"Private Registry"})]}),s.jsx(Us,{value:k,onChange:y,onFileUpload:ze,isUploading:d})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"AI Configuration"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the default model used for AI suggestions."})]}),s.jsx(Gs,{connectionId:J,modelId:f,connections:Ce.map(L=>({id:L.id,title:L.title,icon:L.icon??null})),models:xe.map(L=>({id:L.id,title:L.title||L.id,logo:L.logo??null,capabilities:L.capabilities??[]})),onConnectionChange:L=>{I(L),w("")},onModelChange:w})]})]}),s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Public Registry"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Public URL to consume this registry as an MCP."})]}),s.jsxs(G,{variant:"secondary",children:[ge," ",ge===1?"public item":"public items"]})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:ke}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>pe(ke),children:ue?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Store Visibility"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what appears when users browse this registry in Store."})]}),s.jsx(bt,{id:"store-private-only",checked:v,onCheckedChange:$})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Enabled: show only private apps. Disabled: show public and private apps together."}),v!==a&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Publish Requests"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow external users to submit MCP servers for review."})]}),s.jsx(bt,{id:"accept-publish-requests",checked:S,onCheckedChange:P})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:Re}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>C(Re),children:K?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[s.jsxs("div",{children:[s.jsx(le,{className:"text-sm font-medium",children:"Require API Token"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Requests without a valid token will be rejected."})]}),s.jsx(bt,{id:"require-api-token",checked:N,onCheckedChange:R})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[s.jsxs("div",{children:[s.jsx(le,{className:"text-sm font-medium",children:"Rate Limit"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Limit publish requests per organization by time window."})]}),s.jsx(bt,{id:"publish-rate-limit",checked:D,onCheckedChange:M})]}),D&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:"Max requests"}),s.jsx(je,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:q,onChange:L=>z(L.target.value),placeholder:"100"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:"Window"}),s.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:E,onChange:L=>A(L.target.value),children:[s.jsx("option",{value:"minute",children:"Per minute"}),s.jsx("option",{value:"hour",children:"Per hour"})]})]})]}),(S!==o||N!==l||D!==i||E!==c||(Number.parseInt(q,10)||100)!==m)&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),S&&N&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx(Mn,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),u&&!Me&&s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"New key (refreshing list...)"}),s.jsx(je,{readOnly:!0,value:u,className:"h-8 text-xs font-mono bg-background"})]}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"grid gap-1.5 flex-1",children:[s.jsx(le,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),s.jsx(je,{id:"api-key-name",value:te,onChange:L=>se(L.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),s.jsxs(F,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!te.trim()||B.isPending,onClick:Be,children:[B.isPending?s.jsx(ut,{size:14,className:"animate-spin"}):s.jsx(Pn,{size:14}),"Generate"]})]}),(O.data?.items?.length??0)>0&&s.jsx("div",{className:"grid gap-2",children:O.data?.items?.map(L=>s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[s.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium truncate leading-none",children:L.name}),ye===L.prefix?s.jsx(je,{readOnly:!0,value:re?u??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):s.jsx(je,{readOnly:!0,value:`${L.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[ye===L.prefix&&s.jsxs(s.Fragment,{children:[s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ie(de=>!de),children:re?s.jsx(Es,{size:14}):s.jsx(Is,{size:14})}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!u,onClick:()=>u&&V(u),children:ce?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:Q.isPending,onClick:()=>oe({id:L.id,name:L.name}),children:s.jsx(It,{size:14})})]})]},L.id))})]})]})]})]}),s.jsx(Rt,{open:!!ae,onOpenChange:L=>{!L&&!Q.isPending&&oe(null)},children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Revoke API key?"}),s.jsxs(wt,{children:["This action cannot be undone. The key",ae?` "${ae.name}"`:""," will stop working immediately."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{disabled:Q.isPending,children:"Cancel"}),s.jsx(_t,{disabled:!ae||Q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>ae&&Xe(ae.id),children:Q.isPending?"Revoking...":"Revoke key"})]})]})})]})}function Hr(t){const e=X.c(5),{results:n}=t;if(n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(me,{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(Wr),e[1]=n,e[2]=r):r=e[2];let o;return e[3]!==r?(o=s.jsx("div",{className:"space-y-2",children:r}),e[3]=r,e[4]=o):o=e[4],o}function Wr(t){return s.jsx(Jr,{result:t},t.id)}function Jr(t){const e=X.c(49),{result:n}=t,[r,o]=T.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(ei);let i;e[11]!==r?(i=()=>o(!r),e[11]=r,e[12]=i):i=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-red-500 text-sm mt-0.5",children:"✗"}),e[13]=c):c=e[13];let m;e[14]!==n.item_title?(m=s.jsx("h4",{className:"text-sm font-medium truncate",children:n.item_title}),e[14]=n.item_title,e[15]=m):m=e[15];let 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=s.jsx(G,{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=s.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 d;e[23]!==h?(d=s.jsxs("span",{children:["conn: ",h]}),e[23]=h,e[24]=d):d=e[24];const b=n.tools_listed?"✓":"✗";let j;e[25]!==b?(j=s.jsxs("span",{children:["tools listed: ",b]}),e[25]=b,e[26]=j):j=e[26];let _;e[27]!==n.duration_ms?(_=s.jsxs("span",{children:[n.duration_ms,"ms"]}),e[27]=n.duration_ms,e[28]=_):_=e[28];const k=a.length>0&&s.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"&&s.jsx(G,{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 g;e[31]!==j||e[32]!==_||e[33]!==k||e[34]!==y||e[35]!==d?(g=s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[d,j,_,k,y]}),e[31]=j,e[32]=_,e[33]=k,e[34]=y,e[35]=d,e[36]=g):g=e[36];let I;e[37]!==n.error_message?(I=n.error_message&&s.jsx("p",{className:"text-xs text-red-600 line-clamp-2",children:n.error_message}),e[37]=n.error_message,e[38]=I):I=e[38];let f;e[39]!==g||e[40]!==I||e[41]!==p?(f=s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p,g,I]}),e[39]=g,e[40]=I,e[41]=p,e[42]=f):f=e[42];const w=r?"▲":"▼";let S;e[43]!==w?(S=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:w}),e[43]=w,e[44]=S):S=e[44];let P;e[45]!==f||e[46]!==S||e[47]!==i?(P=s.jsxs("button",{type:"button",className:"w-full text-left p-3 flex items-start gap-3 hover:bg-muted/30 transition-colors",onClick:i,children:[c,f,S]}),e[45]=f,e[46]=S,e[47]=i,e[48]=P):P=e[48],l=s.jsxs(me,{className:"overflow-hidden",children:[P,r&&s.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Full Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2.5 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:ne("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:ne("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]})]}),a.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-red-600",children:["Failed Tools (",a.length,")"]}),a.map(N=>s.jsxs("div",{className:"rounded border border-red-500/10 bg-red-500/5 px-2.5 py-1.5 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono font-medium text-red-700",children:N.toolName}),s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[N.durationMs,"ms"]})]}),N.error&&s.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-red-600",children:N.error})]},`${n.id}-${N.toolName}`))]}),n.tool_results.length>0&&n.tool_results.some(Xr)&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Passing Tools"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:n.tool_results.filter(Zr).map(N=>s.jsxs(G,{variant:"secondary",className:"text-[10px]",children:["✓ ",N.toolName]},`${n.id}-${N.toolName}-pass`))})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.connection_ok,e[3]=n.duration_ms,e[4]=n.error_message,e[5]=n.id,e[6]=n.item_title,e[7]=n.status,e[8]=n.tool_results,e[9]=n.tools_listed,e[10]=l}else l=e[10];return l}function Zr(t){return t.success}function Xr(t){return t.success}function ei(t){return!t.success}const ti=[{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 si(t){const n=t.trim().split(/\s+/);if(n.length!==5)return{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1};const[r,o,l,a,i]=n,c=Number(r),m=Number(o),u=Number(l),x=Number(i);return Number.isInteger(c)&&Number.isInteger(m)&&c>=0&&c<=59&&m>=0&&m<=23?l==="*"&&i==="*"?{frequency:"daily",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*/14"&&i==="*"?{frequency:"biweekly",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*"&&Number.isInteger(x)&&x>=0&&x<=6?{frequency:"weekly",minute:c,hour:m,weekDay:x,dayOfMonth:1}:i==="*"&&Number.isInteger(u)&&u>=1&&u<=31?{frequency:"monthly",minute:c,hour:m,weekDay:1,dayOfMonth:u}:{frequency:"custom",minute:c,hour:m,weekDay:1,dayOfMonth:1}:{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1}}function ni(t,e){return`${String(t).padStart(2,"0")}:${String(e).padStart(2,"0")}`}function Pt(t){return t.frequency==="daily"?`${t.minute} ${t.hour} * * *`:t.frequency==="weekly"?`${t.minute} ${t.hour} * * ${t.weekDay}`:t.frequency==="biweekly"?`${t.minute} ${t.hour} */14 * *`:t.frequency==="monthly"?`${t.minute} ${t.hour} ${t.dayOfMonth} * *`:t.currentValue}function ri(t){const e=X.c(60),{value:n,onChange:r,disabled:o}=t,l=o===void 0?!1:o;let a;e[0]!==n?(a=si(n),e[0]=n,e[1]=a):a=e[1];const i=a,c=i.frequency==="custom";let m;e[2]!==r||e[3]!==i.dayOfMonth||e[4]!==i.hour||e[5]!==i.minute||e[6]!==i.weekDay||e[7]!==n?(m=E=>{if(E==="custom"){r(n);return}r(Pt({frequency:E,hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:i.dayOfMonth,currentValue:n}))},e[2]=r,e[3]=i.dayOfMonth,e[4]=i.hour,e[5]=i.minute,e[6]=i.weekDay,e[7]=n,e[8]=m):m=e[8];const u=m;let x;e[9]!==r||e[10]!==i.dayOfMonth||e[11]!==i.frequency||e[12]!==i.weekDay||e[13]!==n?(x=E=>{const[A,q]=E.split(":"),z=Number(A),O=Number(q);!Number.isInteger(z)||!Number.isInteger(O)||r(Pt({frequency:i.frequency,hour:z,minute:O,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=s.jsx(le,{children:"Frequency"}),e[15]=h):h=e[15];let d;e[16]!==u?(d=E=>u(E.target.value),e[16]=u,e[17]=d):d=e[17];let b,j,_,k,y;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("option",{value:"daily",children:"Daily"}),k=s.jsx("option",{value:"weekly",children:"Weekly"}),y=s.jsx("option",{value:"biweekly",children:"Every 2 weeks"}),b=s.jsx("option",{value:"monthly",children:"Monthly"}),j=s.jsx("option",{value:"custom",children:"Custom (raw cron)"}),e[18]=b,e[19]=j,e[20]=_,e[21]=k,e[22]=y):(b=e[18],j=e[19],_=e[20],k=e[21],y=e[22]);let g;e[23]!==l||e[24]!==i.frequency||e[25]!==d?(g=s.jsxs("label",{className:"space-y-1",children:[h,s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.frequency,onChange:d,disabled:l,children:[_,k,y,b,j]})]}),e[23]=l,e[24]=i.frequency,e[25]=d,e[26]=g):g=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(le,{children:"Time"}),e[27]=I):I=e[27];let f;e[28]!==i.hour||e[29]!==i.minute?(f=ni(i.hour,i.minute),e[28]=i.hour,e[29]=i.minute,e[30]=f):f=e[30];let w;e[31]!==p?(w=E=>p(E.target.value),e[31]=p,e[32]=w):w=e[32];const S=l||c;let P;e[33]!==f||e[34]!==w||e[35]!==S?(P=s.jsxs("label",{className:"space-y-1",children:[I,s.jsx(je,{type:"time",value:f,onChange:w,disabled:S})]}),e[33]=f,e[34]=w,e[35]=S,e[36]=P):P=e[36];let N;e[37]!==l||e[38]!==r||e[39]!==i.dayOfMonth||e[40]!==i.frequency||e[41]!==i.hour||e[42]!==i.minute||e[43]!==i.weekDay||e[44]!==n?(N=i.frequency==="weekly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(le,{children:"Day of week"}),s.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.weekDay,onChange:E=>r(Pt({frequency:"weekly",hour:i.hour,minute:i.minute,weekDay:Number(E.target.value),dayOfMonth:i.dayOfMonth,currentValue:n})),disabled:l,children:ti.map(ii)})]}):i.frequency==="monthly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(le,{children:"Day of month"}),s.jsx(je,{type:"number",min:1,max:31,value:i.dayOfMonth,onChange:E=>{const A=Number(E.target.value);!Number.isInteger(A)||A<1||A>31||r(Pt({frequency:"monthly",hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:A,currentValue:n}))},disabled:l})]}):s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{children:"Schedule notes"}),s.jsx("div",{className:"h-9 rounded-md border border-input bg-muted/20 px-3 text-xs text-muted-foreground flex items-center",children:i.frequency==="biweekly"?"Biweekly uses an every-14-days cron approximation.":i.frequency==="custom"?"Edit raw cron directly below.":"Runs in your server timezone."})]}),e[37]=l,e[38]=r,e[39]=i.dayOfMonth,e[40]=i.frequency,e[41]=i.hour,e[42]=i.minute,e[43]=i.weekDay,e[44]=n,e[45]=N):N=e[45];let R;e[46]!==g||e[47]!==P||e[48]!==N?(R=s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[g,P,N]}),e[46]=g,e[47]=P,e[48]=N,e[49]=R):R=e[49];let v;e[50]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(le,{children:"Raw cron expression"}),e[50]=v):v=e[50];let $;e[51]!==r?($=E=>r(E.target.value),e[51]=r,e[52]=$):$=e[52];let D;e[53]!==l||e[54]!==$||e[55]!==n?(D=s.jsxs("label",{className:"space-y-1 block",children:[v,s.jsx(je,{value:n,onChange:$,disabled:l,placeholder:"*/15 * * * *"})]}),e[53]=l,e[54]=$,e[55]=n,e[56]=D):D=e[56];let M;return e[57]!==R||e[58]!==D?(M=s.jsxs("div",{className:"space-y-2",children:[R,D]}),e[57]=R,e[58]=D,e[59]=M):M=e[59],M}function ii(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function li(t,e){return t.onFailure!==e.onFailure||t.llmConnectionId!==e.llmConnectionId||t.llmModelId!==e.llmModelId||t.perMcpTimeoutMs!==e.perMcpTimeoutMs||t.perToolTimeoutMs!==e.perToolTimeoutMs||t.maxAgentSteps!==e.maxAgentSteps||t.testPublicOnly!==e.testPublicOnly||t.testPrivateOnly!==e.testPrivateOnly||t.includePendingRequests!==e.includePendingRequests||(t.agentContext??"")!==(e.agentContext??"")||t.schedule!==e.schedule||t.cronExpression!==e.cronExpression}function ai(){const{registryLLMConnectionId:t,registryLLMModelId:e}=Kt(tt),{settings:n,saveMutation:r}=Ls(),o=Gn(),l=Qn(),a=T.useRef(n),[i,c]=T.useState(n),[m,u]=T.useState(!1),[x,p]=T.useState(!1),{org:h}=he(),b=(Ms()??[]).filter(f=>(f.tools??[]).some(w=>w.name==="LLM_DO_GENERATE")),j=i.llmConnectionId||t||b[0]?.id||"",_=js({connectionId:j||void 0,orgId:h.id}),k=Ps(j||"no-llm-connection","LLM",_);a.current!==n&&(a.current=n,c(n));const y=li(i,n),g=f=>{u(!1),c(w=>({...w,...f}))},I=async()=>{const f=i.cronExpression?.trim()??"";let w=n.scheduleEventId??"";if(i.schedule==="cron"&&f.length>0){const R=f!==(n.cronExpression??"");R&&w&&await l.mutateAsync(w),(R||!w)&&(w=(await o.mutateAsync({cronExpression:f,config:i})).scheduleEventId)}else w&&(await l.mutateAsync(w),w="");const S=(i.llmModelId??"").trim(),P=S?(i.llmConnectionId||j||"").trim():(i.llmConnectionId??"").trim(),N={...i,cronExpression:f,scheduleEventId:w,agentContext:(i.agentContext??"").trim(),llmConnectionId:P,llmModelId:S};await r.mutateAsync(N),c(N),u(!0),setTimeout(()=>u(!1),3e3)};return s.jsxs(me,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA Configuration"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure how the MCP QA agent validates registry entries."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[y&&s.jsx(G,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"Unsaved changes"}),m&&s.jsx(G,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 text-[10px]",children:"✓ Saved"}),s.jsx(F,{size:"sm",onClick:I,disabled:r.isPending||o.isPending||l.isPending||!y,children:r.isPending||o.isPending||l.isPending?"Saving...":"Save settings"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"On failure",hint:"Automatic action to apply when an MCP fails tests in a run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.onFailure,onChange:f=>g({onFailure:f.target.value}),children:[s.jsx("option",{value:"none",children:"Do nothing"}),s.jsx("option",{value:"unlisted",children:"Unlist from store (keep in registry)"}),s.jsx("option",{value:"remove_public",children:"Remove from public store"}),s.jsx("option",{value:"remove_private",children:"Remove from private registry"}),s.jsx("option",{value:"remove_all",children:"Remove from all (public + private)"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Test scope",hint:"Choose whether tests should run for public items, private items, or both."}),s.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPublicOnly,onChange:f=>g({testPublicOnly:f.target.checked,testPrivateOnly:f.target.checked?!1:i.testPrivateOnly})}),"Public only"]}),s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPrivateOnly,onChange:f=>g({testPrivateOnly:f.target.checked,testPublicOnly:f.target.checked?!1:i.testPublicOnly})}),"Private only"]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Publish requests",hint:"Include pending publish requests in QA runs to validate them before publishing to the store."}),s.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.includePendingRequests,onChange:f=>g({includePendingRequests:f.target.checked})}),"Include pending requests in tests"]})})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(et,{label:"Model (LLM binding)",hint:"Used only in Agentic mode to decide and chain tool calls."}),s.jsx(Gs,{connectionId:j,modelId:i.llmModelId??"",connections:b.map(f=>({id:f.id,title:f.title,icon:f.icon??null})),models:k.map(f=>({id:f.id,title:f.title||f.id,logo:f.logo??null,capabilities:f.capabilities??[]})),onConnectionChange:f=>g({llmConnectionId:f,llmModelId:""}),onModelChange:f=>g({llmModelId:f})})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(et,{label:"Additional test context (prompt)",hint:"Extra runtime context passed to the agent, such as valid emails, tenant IDs, or known test entities."}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7",onClick:()=>p(f=>!f),children:[x?"Hide":"View"," default system prompt"]})]}),s.jsx(Gt,{value:i.agentContext??"",onChange:f=>g({agentContext:f.target.value}),placeholder:'Example: Use "my-user@company.com" as a valid email for Google Drive share/create_permission tests.',rows:3}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use this field for real data required by some tools (valid email, fixed IDs, test environment details, etc)."}),x&&s.jsx("pre",{className:"text-[11px] bg-muted/50 border border-border rounded px-3 py-2 whitespace-pre-wrap max-h-64 overflow-auto",children:cn})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(et,{label:"Schedule",hint:"Set automatic test runs. Manual mode runs only when you click Start QA run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.schedule??"manual",onChange:f=>g({schedule:f.target.value}),children:[s.jsx("option",{value:"manual",children:"Manual only"}),s.jsx("option",{value:"cron",children:"Cron schedule"})]}),(i.schedule??"manual")==="cron"&&s.jsx(ri,{value:i.cronExpression??"",onChange:f=>g({cronExpression:f})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Per MCP timeout (ms)",hint:"Max total time allowed to validate one MCP."}),s.jsx(je,{type:"number",value:i.perMcpTimeoutMs,onChange:f=>g({perMcpTimeoutMs:Number(f.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Per tool timeout (ms)",hint:"Max time allowed for each individual tool call."}),s.jsx(je,{type:"number",value:i.perToolTimeoutMs,onChange:f=>g({perToolTimeoutMs:Number(f.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Max agent steps",hint:"Maximum number of reasoning/tool steps in Agentic mode."}),s.jsx(je,{type:"number",value:i.maxAgentSteps,onChange:f=>g({maxAgentSteps:Number(f.target.value)}),min:1,max:30})]})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["LLM fallback from Settings:"," ",s.jsxs("span",{className:"font-mono",children:[t||"-"," / ",e||"-"]})]})]})}function et(t){const e=X.c(13),{label:n,hint:r}=t;let o;e[0]!==n?(o=s.jsx(le,{children:n}),e[0]=n,e[1]=o):o=e[1];const l=`About ${n}`;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(vn,{size:14}),e[2]=a):a=e[2];let i;e[3]!==l?(i=s.jsx(En,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":l,children:a})}),e[3]=l,e[4]=i):i=e[4];let c;e[5]!==r?(c=s.jsx(Dn,{side:"top",className:"max-w-72",children:r}),e[5]=r,e[6]=c):c=e[6];let m;e[7]!==i||e[8]!==c?(m=s.jsxs($n,{children:[i,c]}),e[7]=i,e[8]=c,e[9]=m):m=e[9];let u;return e[10]!==o||e[11]!==m?(u=s.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 oi(t){switch(t){case"authenticated":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20"}}function ci(t){switch(t){case"authenticated":return"Authenticated";case"needs_auth":return"Needs Auth";default:return"Not checked"}}function di({entry:t,onAuthChanged:e,failedToolsCount:n,failedResultCount:r}){const[o,l]=T.useState(!1),[a,i]=T.useState(""),[c,m]=T.useState(!1),u=Bn(),{updateMutation:x}=ns(),p=t.mapping.connection_id,h=t.mapping.auth_status,d=t.item?.title??t.mapping.item_id,b=t.item?.server?.icons?.[0]?.src??null,j=t.item?.is_public??!1,_=t.item?.is_unlisted??!1,k=t.source==="request",y=Ze({queryKey:H.monitorConnectionAuthProbe(p),queryFn:async()=>Ln({url:`/mcp/${p}`,token:null}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),g=y.data,I=y.isLoading,f=g?.supportsOAuth??!1,w=g?.hasOAuthToken??!1,S=g?.isServerError??!1,P=g?.isAuthenticated??!1,N=I?"checking":S?"server_error":f?P?w?"oauth_connected":"connected":"oauth_available":P?"connected":"token_required",R=()=>{u.mutate({connectionId:p,authStatus:"authenticated"},{onSuccess:()=>e()})},v=async()=>{l(!0);try{const q=(await y.refetch()).data;if(!q){Z.error(`Could not reach "${d}". The remote MCP may be down.`);return}if(q.isAuthenticated){Z.success(`"${d}" is reachable. You can re-authenticate if needed.`);return}if(q.isServerError){Z.error(`Server error for "${d}". The remote MCP may be down.`);return}if(!q.supportsOAuth){Z.warning(`"${d}" does not support OAuth. Use the Token field to paste an API key.`);return}Z.info(`Opening authentication window for "${d}"...`);const z=await An({connectionId:p,clientName:`MCP Test - ${d}`,timeout:18e4});if(z.error){Z.error(`OAuth failed for "${d}": ${z.error}`);return}z.tokenInfo?(await fetch(`/api/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:z.tokenInfo.accessToken,refreshToken:z.tokenInfo.refreshToken,expiresIn:z.tokenInfo.expiresIn,scope:z.tokenInfo.scope,clientId:z.tokenInfo.clientId,clientSecret:z.tokenInfo.clientSecret,tokenEndpoint:z.tokenInfo.tokenEndpoint})})).ok||z.token&&await $(z.token):z.token&&await $(z.token),Z.success(`"${d}" authenticated!`),R(),await y.refetch()}catch(A){console.error("[MonitorConnectionsPanel] Auth error:",A),Z.error(`Error: ${A instanceof Error?A.message:String(A)}`)}finally{l(!1)}},$=async A=>{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:A}}}})})).ok)throw new Error("Failed to save token")},D=async()=>{if(!a.trim()){Z.error("Token cannot be empty.");return}l(!0);try{await $(a),Z.success(`Token saved for "${d}"!`),m(!1),i(""),R(),await y.refetch()}catch(A){Z.error(`Error saving token: ${A instanceof Error?A.message:String(A)}`)}finally{l(!1)}},M=h==="authenticated"&&!w&&!c&&a.length===0,E=async A=>{if(k){Z.info("Visibility controls are available only for store items.");return}if(!t.item){Z.error("Registry item not found for this connection.");return}try{await x.mutateAsync({id:t.item.id,data:A}),Z.success("Visibility updated"),e()}catch(q){Z.error(q instanceof Error?q.message:"Failed to update visibility")}};return s.jsxs(me,{className:"p-3 space-y-3 h-full",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:b?s.jsx("img",{src:b,alt:d,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:d.charAt(0).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:d}),s.jsx("p",{className:"text-xs text-muted-foreground break-all",children:t.remoteUrl??"-"}),s.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[s.jsx(G,{variant:"outline",className:ne("text-[10px]",oi(h)),children:ci(h)}),s.jsx(G,{variant:j?"default":"secondary",className:"text-[10px]",children:j?"Public":"Not public"}),s.jsx(G,{variant:"outline",className:"text-[10px]",children:k?"Request":"Store"}),s.jsxs(G,{variant:"outline",className:ne("text-[10px]",N==="server_error"?"border-destructive/40 text-destructive":N==="oauth_connected"?"border-emerald-500/30 text-emerald-600":N==="oauth_available"?"border-sky-500/30 text-sky-600":N==="token_required"?"border-amber-500/30 text-amber-600":"text-muted-foreground"),children:[N==="checking"&&"Checking auth...",N==="server_error"&&"Server error",N==="oauth_connected"&&"OAuth connected",N==="oauth_available"&&"OAuth available",N==="token_required"&&"Token/manual auth",N==="connected"&&"Connected"]}),_&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"Hidden in private"}),(r>0||n>0)&&s.jsxs(G,{variant:"destructive",className:"text-[10px]",children:[r," failed MCP / ",n," failed tools"]})]})]})]}),s.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:s.jsxs($t,{children:[s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:16})})}),s.jsx(At,{align:"end",children:k?s.jsx(Je,{disabled:!0,children:"Request item (no store visibility controls)"}):s.jsxs(s.Fragment,{children:[s.jsx(Je,{onClick:()=>E({is_public:!1}),children:"Hide from public store"}),s.jsx(Je,{onClick:()=>E({is_unlisted:!0}),children:"Hide from private store"}),s.jsx(Je,{onClick:()=>E({is_public:!0,is_unlisted:!1}),children:"Show in both stores"})]})})]})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[f&&s.jsx(F,{size:"sm",onClick:v,disabled:o,children:o?"...":w?"Re-auth OAuth":"OAuth"}),s.jsx(F,{size:"sm",variant:"outline",onClick:()=>y.refetch(),disabled:o||I,children:I?"Checking...":"Re-check"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Token/API key (for MCPs that require manual auth)"}),M?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/50 text-muted-foreground font-mono text-xs",children:"••••••••••••••••"}),s.jsx("button",{type:"button",onClick:()=>m(!0),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted",title:"Replace token",children:"Edit"})]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(je,{type:"password",placeholder:"Paste API token / key...",value:a,onChange:A=>i(A.target.value),className:"h-8 text-xs flex-1",onKeyDown:A=>{A.key==="Enter"&&D()}}),s.jsx(F,{size:"sm",className:"h-8 text-xs",onClick:D,disabled:o||!a.trim(),children:"Save"}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{m(!1),i("")},children:"✕"})]})]})]})}function mi(){const t=X.c(55),e=As(),r=Qt("completed").data?.items?.[0],o=Mt(r?.id,void 0,r?.status),l=Fn(),[a,i]=T.useState("all");let c,m,u,x,p,h;if(t[0]!==e||t[1]!==o.data?.items||t[2]!==a||t[3]!==l){const j=e.data?.items??[];let _;t[10]!==o.data?.items?(_=(o.data?.items??[]).reduce(hi,{}),t[10]=o.data?.items,t[11]=_):_=t[11];const k=_;let y;t[12]!==a?(y=re=>a==="all"?!0:re.source===a,t[12]=a,t[13]=y):y=t[13];const g=j.filter(y);c=me,p="p-4 space-y-3";let I,f,w,S;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("h3",{className:"text-sm font-semibold",children:"QA Connections"}),w=s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"We auto-detect auth type. Use OAuth when available, or always paste a Token/API key for manual auth MCPs."}),S=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Listing tools alone does not imply authenticated status."}),I=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Cards show MCP icon, auth status, and latest failed test counters."}),t[14]=I,t[15]=f,t[16]=w,t[17]=S):(I=t[14],f=t[15],w=t[16],S=t[17]);const P=a==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let N;t[18]!==P?(N=ne("px-2.5 py-1 text-xs rounded-md transition-colors",P),t[18]=P,t[19]=N):N=t[19];let R;t[20]===Symbol.for("react.memo_cache_sentinel")?(R=()=>i("all"),t[20]=R):R=t[20];let v;t[21]!==N?(v=s.jsx("button",{type:"button",className:N,onClick:R,children:"All"}),t[21]=N,t[22]=v):v=t[22];const $=a==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let D;t[23]!==$?(D=ne("px-2.5 py-1 text-xs rounded-md transition-colors",$),t[23]=$,t[24]=D):D=t[24];let M;t[25]===Symbol.for("react.memo_cache_sentinel")?(M=()=>i("store"),t[25]=M):M=t[25];let E;t[26]!==D?(E=s.jsx("button",{type:"button",className:D,onClick:M,children:"Store"}),t[26]=D,t[27]=E):E=t[27];const A=a==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let q;t[28]!==A?(q=ne("px-2.5 py-1 text-xs rounded-md transition-colors",A),t[28]=A,t[29]=q):q=t[29];let z;t[30]===Symbol.for("react.memo_cache_sentinel")?(z=()=>i("request"),t[30]=z):z=t[30];let O;t[31]!==q?(O=s.jsx("button",{type:"button",className:q,onClick:z,children:"Requests"}),t[31]=q,t[32]=O):O=t[32];let B;t[33]!==v||t[34]!==E||t[35]!==O?(B=s.jsxs("div",{children:[f,w,S,I,s.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[v,E,O]})]}),t[33]=v,t[34]=E,t[35]=O,t[36]=B):B=t[36];let Q;t[37]!==l?(Q=()=>{l.mutate(void 0,{onSuccess:xi,onError:ui})},t[37]=l,t[38]=Q):Q=t[38];const te=l.isPending?"Syncing...":"Sync";let se;t[39]!==l.isPending||t[40]!==Q||t[41]!==te?(se=s.jsx(F,{size:"sm",variant:"outline",onClick:Q,disabled:l.isPending,children:te}),t[39]=l.isPending,t[40]=Q,t[41]=te,t[42]=se):se=t[42],t[43]!==B||t[44]!==se?(h=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[B,se]}),t[43]=B,t[44]=se,t[45]=h):h=t[45],m="space-y-2",u=g.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:'No QA connections for this filter. Click "Sync" to create mappings from store items and pending requests.'}),x=g.length>0&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:g.map(re=>{const ie=k[re.mapping.item_id]??{failedTools:0,failedResults:0};return s.jsx(di,{entry:re,onAuthChanged:()=>e.refetch(),failedToolsCount:ie.failedTools,failedResultCount:ie.failedResults},re.mapping.id)})}),t[0]=e,t[1]=o.data?.items,t[2]=a,t[3]=l,t[4]=c,t[5]=m,t[6]=u,t[7]=x,t[8]=p,t[9]=h}else c=t[4],m=t[5],u=t[6],x=t[7],p=t[8],h=t[9];let d;t[46]!==m||t[47]!==u||t[48]!==x?(d=s.jsxs("div",{className:m,children:[u,x]}),t[46]=m,t[47]=u,t[48]=x,t[49]=d):d=t[49];let b;return t[50]!==c||t[51]!==p||t[52]!==h||t[53]!==d?(b=s.jsxs(c,{className:p,children:[h,d]}),t[50]=c,t[51]=p,t[52]=h,t[53]=d,t[54]=b):b=t[54],b}function ui(t){return Z.error(`Sync failed: ${t.message}`)}function xi(){return Z.success("Connections synced (store + pending requests)")}function hi(t,e){const n=t[e.item_id]??{failedTools:0,failedResults:0},r=e.tool_results.filter(pi).length;return n.failedTools=n.failedTools+r,(e.status==="failed"||e.status==="error")&&(n.failedResults=n.failedResults+1),t[e.item_id]=n,t}function pi(t){return!t.success}function Qs(t){switch(t){case"running":return"bg-blue-500/10 text-blue-600 border-blue-500/20";case"completed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"cancelled":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";case"pending":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return""}}function Ks(t,e){if(!t)return null;const n=e?new Date(e).getTime():Date.now(),r=new Date(t).getTime(),o=n-r;return o<1e3?`${o}ms`:o<6e4?`${(o/1e3).toFixed(1)}s`:`${Math.floor(o/6e4)}m ${Math.round(o%6e4/1e3)}s`}function Vs(t){const e=new Map;for(const n of t)e.has(n.toolName)&&e.delete(n.toolName),e.set(n.toolName,n);return Array.from(e.values())}function fi(t){return t.total_items?Math.min(100,Math.round(t.tested_items/t.total_items*100)):0}function gi(t){if(!t)return null;const e=t.match(/Not executed tools \((\d+)\/(\d+)\):/i);if(!e)return null;const n=Number(e[2]);return Number.isFinite(n)&&n>=0?n:null}function ji(t){const e=X.c(57),{result:n,index:r,icon:o}=t,[l,a]=T.useState(!1);let i;if(e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n.action_taken||e[4]!==n.agent_summary||e[5]!==n.connection_ok||e[6]!==n.duration_ms||e[7]!==n.error_message||e[8]!==n.id||e[9]!==n.item_title||e[10]!==n.status||e[11]!==n.tool_results||e[12]!==n.tools_listed){const c=Vs(n.tool_results),m=c.every(Ni),u=c.filter(yi),x=u.filter(vi).length,p=u.filter(bi).length,h=u.length>0,d=u.length;let b;e[14]!==n.agent_summary?(b=gi(n.agent_summary),e[14]=n.agent_summary,e[15]=b):b=e[15];const j=b,_=Math.max(c.length,j??0),k=_>0?`${d}/${_} tools tested`:"0 tools";let y;e[16]!==l?(y=()=>a(!l),e[16]=l,e[17]=y):y=e[17];const g=r+1;let I;e[18]!==g?(I=s.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:g}),e[18]=g,e[19]=I):I=e[19];let f;e[20]!==o||e[21]!==n.item_title?(f=s.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:o?s.jsx("img",{src:o,alt:n.item_title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:n.item_title.charAt(0).toUpperCase()})}),e[20]=o,e[21]=n.item_title,e[22]=f):f=e[22];const w=n.status==="passed"?"text-emerald-600":n.status==="needs_auth"?"text-amber-600":"text-red-600";let S;e[23]!==w?(S=ne("shrink-0",w),e[23]=w,e[24]=S):S=e[24];const P=n.status==="passed"?"✓":n.status==="needs_auth"?"🔑":"✗";let N;e[25]!==S||e[26]!==P?(N=s.jsx("span",{className:S,children:P}),e[25]=S,e[26]=P,e[27]=N):N=e[27];let R;e[28]!==n.item_title?(R=s.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:n.item_title}),e[28]=n.item_title,e[29]=R):R=e[29];let v;e[30]!==n.duration_ms?(v=s.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.duration_ms,"ms"]}),e[30]=n.duration_ms,e[31]=v):v=e[31];const $=n.status==="passed"?"text-emerald-600 border-emerald-500/20":n.status==="needs_auth"?"text-amber-600 border-amber-500/20":"text-red-600 border-red-500/20";let D;e[32]!==$?(D=ne("text-[9px] capitalize shrink-0",$),e[32]=$,e[33]=D):D=e[33];let M;e[34]!==n.status?(M=n.status.replace("_"," "),e[34]=n.status,e[35]=M):M=e[35];let E;e[36]!==D||e[37]!==M?(E=s.jsx(G,{variant:"outline",className:D,children:M}),e[36]=D,e[37]=M,e[38]=E):E=e[38];let A;e[39]!==n.connection_ok?(A=n.connection_ok?s.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"conn✓"}):s.jsx("span",{className:"text-[10px] text-red-600 shrink-0",children:"conn✗"}),e[39]=n.connection_ok,e[40]=A):A=e[40];const q=n.tools_listed&&s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:h?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-emerald-600",children:[x,"✓"]})," ",s.jsxs("span",{className:ne(p>0?"text-red-600":""),children:[p,"✗"]})]}):m&&c.length>0?s.jsxs("span",{children:[c.length," tools found"]}):"no tools"});let z;e[41]!==k?(z=s.jsx(G,{variant:"outline",className:"text-[9px] shrink-0",children:k}),e[41]=k,e[42]=z):z=e[42];const O=l?"▲":"▼";let B;e[43]!==O?(B=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:O}),e[43]=O,e[44]=B):B=e[44];let Q;e[45]!==N||e[46]!==R||e[47]!==v||e[48]!==E||e[49]!==A||e[50]!==q||e[51]!==z||e[52]!==B||e[53]!==y||e[54]!==I||e[55]!==f?(Q=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors",onClick:y,children:[I,f,N,R,v,E,A,q,z,B]}),e[45]=N,e[46]=R,e[47]=v,e[48]=E,e[49]=A,e[50]=q,e[51]=z,e[52]=B,e[53]=y,e[54]=I,e[55]=f,e[56]=Q):Q=e[56],i=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[Q,l&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error_message})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[s.jsxs("span",{children:["Connection:"," ",s.jsx("span",{className:ne(n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("span",{children:["Tools listed:"," ",s.jsx("span",{className:ne(n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),n.action_taken!=="none"&&s.jsxs(G,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]})]}),h?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools tested: ",x," passed, ",p," failed"]}),s.jsx("div",{className:"space-y-0.5",children:u.map((te,se)=>s.jsx(wi,{tool:te},`${n.id}-${te.toolName}-${se}`))})]}):m&&c.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",c.length,") - not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:c.map((te,se)=>s.jsx(G,{variant:"outline",className:"text-[10px] font-mono",children:te.toolName},`${n.id}-${te.toolName}-${se}`))})]}):n.tools_listed?s.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No tools found on this server."}):null,n.agent_summary&&s.jsx("p",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5",children:n.agent_summary})]})]}),e[0]=l,e[1]=o,e[2]=r,e[3]=n.action_taken,e[4]=n.agent_summary,e[5]=n.connection_ok,e[6]=n.duration_ms,e[7]=n.error_message,e[8]=n.id,e[9]=n.item_title,e[10]=n.status,e[11]=n.tool_results,e[12]=n.tools_listed,e[13]=i}else i=e[13];return i}function bi(t){return!t.success}function vi(t){return t.success}function yi(t){return t.outputPreview!=="health_check: not called"}function Ni(t){return t.outputPreview==="health_check: not called"}function wi(t){const e=X.c(30),{tool:n}=t,[r,o]=T.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=ne("font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=s.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=s.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&&s.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 d;e[13]!==h?(d=s.jsx("span",{className:"text-muted-foreground",children:h}),e[13]=h,e[14]=d):d=e[14];let b;e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==u||e[19]!==x||e[20]!==p?(b=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1 text-[11px] hover:bg-muted/30 transition-colors",onClick:l,children:[m,u,x,p,d]}),e[15]=l,e[16]=d,e[17]=m,e[18]=u,e[19]=x,e[20]=p,e[21]=b):b=e[21];let j;e[22]!==r||e[23]!==n.error||e[24]!==n.input||e[25]!==n.outputPreview?(j=r&&s.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[n.error&&s.jsx("pre",{className:"bg-red-500/5 border border-red-500/10 rounded px-2 py-1 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:n.outputPreview})]})]}),e[22]=r,e[23]=n.error,e[24]=n.input,e[25]=n.outputPreview,e[26]=j):j=e[26];let _;return e[27]!==b||e[28]!==j?(_=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[b,j]}),e[27]=b,e[28]=j,e[29]=_):_=e[29],_}function Ci({activeRunId:t,onRunChange:e}){const{settings:n}=Ls(),[r,o]=T.useState(null),[l,a]=T.useState(!1),i=T.useRef(0),c=T.useRef(null),m=On(),u=Un(),x=ss(t),p=Qt(),h=As(),d=x.data?.run??null,b=d?.status,j=d?.config_snapshot?.monitorMode??d?.config_snapshot?.testMode,_=Mt(t,void 0,b),k=(p.data?.items??[]).find(v=>v.status==="running"),y=p.data?.items?.[0]?.id;!t&&y&&c.current!==y&&(c.current=y,queueMicrotask(()=>{e(y)}));const g=async()=>{const v=Date.now();if(v-i.current<1e3)return;i.current=v;const $=r??n.monitorMode,D=await m.mutateAsync({...n,monitorMode:$});e(D.run.id)},I=async()=>{if(k&&k.id!==t&&k.status==="running"){a(!0);return}await g()},f=async()=>{t&&await u.mutateAsync(t)},w=d?.status==="running",S=d?Ks(d.started_at,d.finished_at):null,P=_.data?.items??[],N=(h.data?.items??[]).reduce((v,$)=>(v[$.mapping.item_id]=$.item?.server?.icons?.[0]?.src??null,v),{}),R=r??n.monitorMode;return s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs(me,{className:"p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Current QA Run"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a full QA validation run and track results in real time."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[k&&k.id!==t&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["Run in progress: ",k.id.slice(0,8)]}),s.jsxs(F,{size:"sm",onClick:I,disabled:m.isPending||w,className:"gap-1.5",children:[s.jsx(zn,{size:14}),m.isPending?"Starting...":k&&k.id!==t?"Start another run":"Start QA run"]}),s.jsxs(F,{size:"sm",variant:"outline",onClick:f,disabled:!t||!w,className:"gap-1.5",children:[s.jsx($s,{size:14}),"Cancel"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA mode"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:R,onChange:v=>o(v.target.value),disabled:w,children:[s.jsx("option",{value:"health_check",children:"Health check"}),s.jsx("option",{value:"tool_call",children:"Tool call"}),s.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA run history (pick a previous run)"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:t??"",onChange:v=>e(v.target.value||void 0),children:[s.jsx("option",{value:"",children:"Auto-select latest run"}),(p.data?.items??[]).map(v=>s.jsxs("option",{value:v.id,children:[new Date(v.created_at).toLocaleString()," -"," ",v.status]},v.id))]})]})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:R==="health_check"?"Checks connectivity and tool listing only — no tool calls are made.":R==="tool_call"?"Calls each tool with empty inputs to verify it responds without errors.":"Uses an LLM model to execute chained tool calls and validate outputs."}),d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsx(G,{className:ne("capitalize",Qs(d.status),d.status==="running"?"animate-pulse":""),children:d.status}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),S&&s.jsx("span",{className:"text-xs text-muted-foreground",children:S}),w&&d.current_item_id&&s.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:["QA on:"," ",s.jsx("span",{className:"font-mono",children:d.current_item_id})]})]}),s.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ne("h-full transition-all duration-500",d.failed_items>0?"bg-orange-500":"bg-emerald-500",w?"animate-pulse":""),style:{width:`${fi(d)}%`}})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:d.passed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:d.failed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:d.skipped_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:d.total_items})]})]})]}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"No run selected yet. Start a new run to begin."})]}),s.jsxs(me,{className:"p-4 space-y-2 min-h-[360px]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["QA results log (",P.length,")"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Live per-MCP test output for the selected run."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[w&&s.jsx(G,{className:"bg-blue-500/10 text-blue-600 border-blue-500/20 animate-pulse",children:"run in progress"}),d&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["progress: ",d.tested_items," of ",d.total_items," MCPs"]}),j&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["mode: ",j.replace("_"," ")]})]})]}),P.length===0?s.jsx("div",{className:"h-[280px] rounded border border-dashed border-border flex items-center justify-center text-xs text-muted-foreground",children:"No results yet. Start a run to see live logs here."}):s.jsx("div",{ref:v=>{v&&w&&v.scrollHeight-v.scrollTop-v.clientHeight<120&&requestAnimationFrame(()=>{v.scrollTop=v.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:P.map((v,$)=>s.jsx(ji,{result:v,index:$,icon:N[v.item_id]},v.id))})]})]}),s.jsx(Rt,{open:l,onOpenChange:a,children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Start another test run?"}),s.jsxs(wt,{children:["There is already a run in progress",k?` (${k.id})`:"",". Starting another run may increase database load and slow down both executions."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{children:"Cancel"}),s.jsx(_t,{onClick:()=>{a(!1),g()},children:"Start anyway"})]})]})})]})}function Ys(t){switch(t){case"passed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"error":return"bg-orange-500/10 text-orange-600 border-orange-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";case"skipped":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";default:return""}}function _i(t){switch(t){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function ki(t){const e=X.c(27),{tool:n}=t,[r,o]=T.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=ne("text-xs font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=s.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=s.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=s.jsx("span",{className:"text-[10px] text-muted-foreground",children:p}),e[11]=p,e[12]=h):h=e[12];let d;e[13]!==l||e[14]!==m||e[15]!==u||e[16]!==x||e[17]!==h?(d=s.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",onClick:l,children:[m,u,x,h]}),e[13]=l,e[14]=m,e[15]=u,e[16]=x,e[17]=h,e[18]=d):d=e[18];let b;e[19]!==r||e[20]!==n.error||e[21]!==n.input||e[22]!==n.outputPreview?(b=r&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[n.error&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error})]}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output preview"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:n.outputPreview})]}),!n.error&&!n.outputPreview&&(!n.input||Object.keys(n.input).length===0)&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"No additional details."})]}),e[19]=r,e[20]=n.error,e[21]=n.input,e[22]=n.outputPreview,e[23]=b):b=e[23];let j;return e[24]!==d||e[25]!==b?(j=s.jsxs("div",{className:"rounded border border-border",children:[d,b]}),e[24]=d,e[25]=b,e[26]=j):j=e[26],j}function Si(t){const e=X.c(52),{result:n}=t,[r,o]=T.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=Vs(n.tool_results),i=a.every(Mi),c=a.filter(Ii),m=c.filter(Ti).length,u=c.filter(Ri).length,x=c.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=_i(n.status),e[14]=n.status,e[15]=h):h=e[15];let d;e[16]!==h?(d=s.jsx("span",{className:"text-base shrink-0",children:h}),e[16]=h,e[17]=d):d=e[17];let b;e[18]!==n.item_title?(b=s.jsx("p",{className:"text-sm font-medium truncate",children:n.item_title}),e[18]=n.item_title,e[19]=b):b=e[19];let j;e[20]!==n.duration_ms?(j=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.duration_ms,"ms"]}),e[20]=n.duration_ms,e[21]=j):j=e[21];const _=n.connection_ok?"✓":"✗";let k;e[22]!==_?(k=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["conn: ",_]}),e[22]=_,e[23]=k):k=e[23];const y=n.tools_listed?"✓":"✗";let g;e[24]!==y?(g=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["tools listed: ",y]}),e[24]=y,e[25]=g):g=e[25];const I=a.length>0&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:x?s.jsxs(s.Fragment,{children:["tools: ",m,"✓ ",u,"✗"]}):s.jsxs(s.Fragment,{children:[a.length," tools found"]})});let f;e[26]!==n.action_taken?(f=n.action_taken!=="none"&&s.jsxs(G,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]}),e[26]=n.action_taken,e[27]=f):f=e[27];let w;e[28]!==g||e[29]!==I||e[30]!==f||e[31]!==j||e[32]!==k?(w=s.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[j,k,g,I,f]}),e[28]=g,e[29]=I,e[30]=f,e[31]=j,e[32]=k,e[33]=w):w=e[33];let S;e[34]!==w||e[35]!==b?(S=s.jsxs("div",{className:"min-w-0 flex-1",children:[b,w]}),e[34]=w,e[35]=b,e[36]=S):S=e[36];let P;e[37]!==n.status?(P=ne("capitalize shrink-0",Ys(n.status)),e[37]=n.status,e[38]=P):P=e[38];let N;e[39]!==n.status?(N=n.status.replace("_"," "),e[39]=n.status,e[40]=N):N=e[40];let R;e[41]!==P||e[42]!==N?(R=s.jsx(G,{className:P,children:N}),e[41]=P,e[42]=N,e[43]=R):R=e[43];const v=r?"▲":"▼";let $;e[44]!==v?($=s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:v}),e[44]=v,e[45]=$):$=e[45];let D;e[46]!==S||e[47]!==R||e[48]!==$||e[49]!==p||e[50]!==d?(D=s.jsxs("button",{type:"button",className:"w-full text-left px-4 py-3 flex items-center gap-3 hover:bg-muted/30 transition-colors",onClick:p,children:[d,S,R,$]}),e[46]=S,e[47]=R,e[48]=$,e[49]=p,e[50]=d,e[51]=D):D=e[51],l=s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[D,r&&s.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:ne("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"Connected":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:ne("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?`Yes (${a.length})`:"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Action Taken"}),s.jsx("p",{className:"text-xs font-medium capitalize",children:n.action_taken.replace(/_/g," ")})]})]}),n.error_message&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error Message"}),s.jsx("pre",{className:"text-xs bg-red-500/5 border border-red-500/10 rounded px-3 py-2 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),x?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tool Results (",m," passed, ",u," failed)"]}),s.jsx("div",{className:"space-y-1",children:c.map((M,E)=>s.jsx(ki,{tool:M},`${n.id}-${M.toolName}-${E}`))})]}):i&&a.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",a.length,") — not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:a.map((M,E)=>s.jsx(G,{variant:"outline",className:"text-[10px] font-mono",children:M.toolName},`${n.id}-${M.toolName}-${E}`))})]}):null,n.agent_summary&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Agent Summary"}),s.jsx("p",{className:"text-xs bg-muted/50 rounded px-3 py-2",children:n.agent_summary})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.agent_summary,e[3]=n.connection_ok,e[4]=n.duration_ms,e[5]=n.error_message,e[6]=n.id,e[7]=n.item_title,e[8]=n.status,e[9]=n.tool_results,e[10]=n.tools_listed,e[11]=l}else l=e[11];return l}function Ri(t){return!t.success}function Ti(t){return t.success}function Ii(t){return t.outputPreview!=="health_check: not called"}function Mi(t){return t.outputPreview==="health_check: not called"}function Pi(t){const e=X.c(4),{value:n,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[{value:"all",label:"All"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"},{value:"error",label:"Error"},{value:"needs_auth",label:"Needs Auth"},{value:"skipped",label:"Skipped"}],e[0]=o):o=e[0];const l=o;let a;return e[1]!==r||e[2]!==n?(a=s.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(i=>s.jsx("button",{type:"button",className:ne("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 Ei(t){const e=X.c(46),{runId:n}=t,[r,o]=T.useState("all"),l=ss(n),a=l.data?.run,i=Mt(n,void 0,a?.status);let c;e[0]!==i.data?.items?(c=i.data?.items??[],e[0]=i.data?.items,e[1]=c):c=e[1];const m=c;let u;e[2]!==m||e[3]!==r?(u=r==="all"?m:m.filter(v=>v.status===r),e[2]=m,e[3]=r,e[4]=u):u=e[4];const x=u;if(!n){let v;return e[5]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(me,{className:"p-6 text-center space-y-2",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a run to inspect details."})}),e[5]=v):v=e[5],v}let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("h3",{className:"text-sm font-semibold",children:"Run Detail"}),e[6]=p):p=e[6];let h;e[7]!==n?(h=s.jsxs("div",{children:[p,s.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:n})]}),e[7]=n,e[8]=h):h=e[8];let d;e[9]!==a?(d=a&&s.jsx(G,{className:ne("capitalize",Ys(a.status)),children:a.status}),e[9]=a,e[10]=d):d=e[10];let b;e[11]!==i||e[12]!==l?(b=s.jsx(F,{size:"sm",variant:"outline",onClick:()=>{l.refetch(),i.refetch()},children:"Refresh"}),e[11]=i,e[12]=l,e[13]=b):b=e[13];let j;e[14]!==d||e[15]!==b?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[d,b]}),e[14]=d,e[15]=b,e[16]=j):j=e[16];let _;e[17]!==h||e[18]!==j?(_=s.jsx(me,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,j]})}),e[17]=h,e[18]=j,e[19]=_):_=e[19];let k;e[20]!==a?(k=a&&s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:a.total_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tested"}),s.jsx("p",{className:"text-lg font-bold",children:a.tested_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:a.passed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:a.failed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:a.skipped_items})]})]}),e[20]=a,e[21]=k):k=e[21];let y;e[22]!==a?(y=a&&(a.started_at||a.finished_at)&&s.jsxs(me,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[a.started_at&&s.jsxs("span",{children:["Started: ",new Date(a.started_at).toLocaleString()]}),a.finished_at&&s.jsxs("span",{children:["Finished: ",new Date(a.finished_at).toLocaleString()]}),a.started_at&&a.finished_at&&s.jsxs("span",{className:"font-medium text-foreground",children:["Duration:"," ",((new Date(a.finished_at).getTime()-new Date(a.started_at).getTime())/1e3).toFixed(1),"s"]})]}),e[22]=a,e[23]=y):y=e[23];let g;e[24]!==r?(g=s.jsx(Pi,{value:r,onChange:o}),e[24]=r,e[25]=g):g=e[25];const I=x.length!==1?"s":"";let f;e[26]!==x.length||e[27]!==I?(f=s.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," result",I]}),e[26]=x.length,e[27]=I,e[28]=f):f=e[28];let w;e[29]!==g||e[30]!==f?(w=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,f]}),e[29]=g,e[30]=f,e[31]=w):w=e[31];let S;e[32]!==m||e[33]!==x.length?(S=x.length===0&&s.jsx(me,{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]=S):S=e[34];let P;e[35]!==x?(P=x.map(Di),e[35]=x,e[36]=P):P=e[36];let N;e[37]!==S||e[38]!==P?(N=s.jsxs("div",{className:"space-y-2",children:[S,P]}),e[37]=S,e[38]=P,e[39]=N):N=e[39];let R;return e[40]!==y||e[41]!==w||e[42]!==N||e[43]!==_||e[44]!==k?(R=s.jsxs("div",{className:"space-y-3",children:[_,k,y,w,N]}),e[40]=y,e[41]=w,e[42]=N,e[43]=_,e[44]=k,e[45]=R):R=e[45],R}function Di(t){return s.jsx(Si,{result:t},t.id)}function $i(t){return t.tested_items?`${Math.round(t.passed_items/t.tested_items*100)}%`:"-"}function Ai(t){const e=X.c(20),{selectedRunId:n,onSelectRun:r}=t,o=Qt();let l;e[0]!==o.data?.items?(l=o.data?.items??[],e[0]=o.data?.items,e[1]=l):l=e[1];const a=l;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=i):i=e[2];let c;e[3]!==o?(c=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i,s.jsx(F,{size:"sm",variant:"outline",onClick:()=>o.refetch(),children:"Refresh"})]}),e[3]=o,e[4]=c):c=e[4];let m;e[5]!==a.length?(m=a.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs yet. Start QA from the Dashboard tab."}),e[5]=a.length,e[6]=m):m=e[6];let u;if(e[7]!==r||e[8]!==a||e[9]!==n){let h;e[11]!==r||e[12]!==n?(h=d=>{const b=Ks(d.started_at,d.finished_at),j=$i(d),_=n===d.id;return s.jsxs("button",{type:"button",onClick:()=>r(d.id),className:ne("w-full text-left rounded-lg border p-3 transition-colors",_?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(d.created_at).toLocaleString()})}),s.jsx(G,{className:ne("capitalize",Qs(d.status)),children:d.status})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[s.jsxs("span",{className:"text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),s.jsxs("span",{className:"text-emerald-600 font-medium",children:[d.passed_items," passed"]}),d.failed_items>0&&s.jsxs("span",{className:"text-red-600 font-medium",children:[d.failed_items," failed"]}),d.skipped_items>0&&s.jsxs("span",{className:"text-muted-foreground",children:[d.skipped_items," skipped"]}),s.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",j]}),b&&s.jsx("span",{className:"text-muted-foreground",children:b})]}),d.config_snapshot&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[s.jsx(G,{variant:"outline",className:"text-[9px]",children:(d.config_snapshot.monitorMode??d.config_snapshot.testMode??"health_check").replace("_"," ")}),d.config_snapshot.onFailure!=="none"&&s.jsxs(G,{variant:"outline",className:"text-[9px] text-red-600",children:["on fail:"," ",d.config_snapshot.onFailure.replace(/_/g," ")]})]})]},d.id)},e[11]=r,e[12]=n,e[13]=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=s.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]!==c||e[18]!==x?(p=s.jsx(me,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[c,x]})}),e[17]=c,e[18]=x,e[19]=p):p=e[19],p}function Li(){const t=X.c(20),[e,n]=T.useState(void 0),[r,o]=T.useState("tests"),a=ss(e).data?.run?.status,i=Mt(e,void 0,a);let c;t[0]!==i.data?.items?(c=i.data?.items??[],t[0]=i.data?.items,t[1]=c):c=t[1];let m;t[2]!==c?(m=c.filter(zi),t[2]=c,t[3]=m):m=t[3];const u=m;let x;t[4]===Symbol.for("react.memo_cache_sentinel")?(x=[{id:"tests",label:"Tests"},{id:"configuration",label:"Configuration"},{id:"connections",label:"Connections"}],t[4]=x):x=t[4];let p;t[5]!==r?(p=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:x.map(_=>{const k=r===_.id;return s.jsx("button",{type:"button",className:ne("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",k?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>o(_.id),children:s.jsx("span",{children:_.label})},_.id)})}),t[5]=r,t[6]=p):p=t[6];let h;t[7]!==e||t[8]!==r||t[9]!==u?(h=r==="tests"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ci,{activeRunId:e,onRunChange:n}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[s.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[e&&s.jsx(Ei,{runId:e}),s.jsx(Ai,{selectedRunId:e,onSelectRun:n})]}),s.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["Broken MCPs"," ",u.length>0&&s.jsx(G,{variant:"destructive",className:"text-[10px] ml-1",children:u.length})]}),s.jsx(Hr,{results:u})]})]})]}),t[7]=e,t[8]=r,t[9]=u,t[10]=h):h=t[10];let d;t[11]!==r?(d=r==="configuration"&&s.jsx(ai,{}),t[11]=r,t[12]=d):d=t[12];let b;t[13]!==r?(b=r==="connections"&&s.jsx(mi,{}),t[13]=r,t[14]=b):b=t[14];let j;return t[15]!==p||t[16]!==h||t[17]!==d||t[18]!==b?(j=s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[p,h,d,b]}),t[15]=p,t[16]=h,t[17]=d,t[18]=b,t[19]=j):j=t[19],j}function zi(t){return t.status==="failed"||t.status==="error"}function Oi(t){const e=X.c(9),{activeTab:n,onChange:r,items:o}=t;let l;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==r?(i=c=>{const m=n===c.tab,u=c.icon;return s.jsxs("button",{type:"button",className:ne("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",m?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>r(c.tab),children:[s.jsx(u,{size:14}),s.jsx("span",{children:c.label}),typeof c.count=="number"&&c.count>0&&s.jsx("span",{className:"min-w-4 h-4 px-1 inline-flex items-center justify-center rounded-full bg-primary/15 text-[10px] font-semibold",children:c.count})]},c.id)},e[4]=n,e[5]=r,e[6]=i):i=e[6],l=o.map(i),e[0]=n,e[1]=o,e[2]=r,e[3]=l}else l=e[3];let a;return e[7]!==l?(a=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:l}),e[7]=l,e[8]=a):a=e[8],a}function Ul(){const t=X.c(55),[e,n]=T.useState("items"),[r,o]=T.useState(null),{registryName:l,registryIcon:a,registryLLMConnectionId:i,registryLLMModelId:c,acceptPublishRequests:m,requireApiToken:u,storePrivateOnly:x,rateLimitEnabled:p,rateLimitWindow:h,rateLimitMax:d}=Kt(tt),b=Xn(),j=Kn(),_=`${l}|${a}|${i}|${c}|${m}|${u}|${x}|${p}|${h}|${d}`;!m&&e==="requests"&&n("items");const k=b.data?.pending??0,y=j.brokenCount>0?j.brokenCount:void 0;let g;t[0]!==y?(g={id:"items",label:"Items",icon:dn,tab:"items",count:y},t[0]=y,t[1]=g):g=t[1];let I;t[2]!==m||t[3]!==k?(I=m?[{id:"requests",label:"Requests",icon:ft,tab:"requests",count:k}]:[],t[2]=m,t[3]=k,t[4]=I):I=t[4];let f,w;t[5]===Symbol.for("react.memo_cache_sentinel")?(f={id:"qa",label:"QA",icon:ts,tab:"qa"},w={id:"settings",label:"Settings",icon:mn,tab:"settings"},t[5]=f,t[6]=w):(f=t[5],w=t[6]);let S;t[7]!==g||t[8]!==I?(S=[g,...I,f,w],t[7]=g,t[8]=I,t[9]=S):S=t[9];const P=S;let N;t[10]===Symbol.for("react.memo_cache_sentinel")?(N=()=>n("settings"),t[10]=N):N=t[10];let R;t[11]!==a||t[12]!==l?(R=s.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:a?s.jsx("img",{src:a,alt:l,className:"h-full w-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:l.slice(0,1).toUpperCase()})}),t[11]=a,t[12]=l,t[13]=R):R=t[13];let v;t[14]!==l?(v=s.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:l}),t[14]=l,t[15]=v):v=t[15];let $;t[16]!==R||t[17]!==v?($=s.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:N,children:[R,v]}),t[16]=R,t[17]=v,t[18]=$):$=t[18];let D;t[19]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),t[19]=D):D=t[19];let M;t[20]!==e||t[21]!==P?(M=s.jsx(Oi,{activeTab:e,onChange:n,items:P}),t[20]=e,t[21]=P,t[22]=M):M=t[22];let E;t[23]!==M||t[24]!==$?(E=s.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[$,D,M]})}),t[23]=M,t[24]=$,t[25]=E):E=t[25];let A;t[26]!==e?(A=e==="items"&&s.jsx(Ar,{}),t[26]=e,t[27]=A):A=t[27];let q;t[28]!==m||t[29]!==e?(q=e==="requests"&&m&&s.jsx(Gr,{}),t[28]=m,t[29]=e,t[30]=q):q=t[30];let z;t[31]!==e?(z=e==="qa"&&s.jsx(Li,{}),t[31]=e,t[32]=z):z=t[32];let O;t[33]!==m||t[34]!==e||t[35]!==p||t[36]!==d||t[37]!==h||t[38]!==a||t[39]!==i||t[40]!==c||t[41]!==l||t[42]!==u||t[43]!==r||t[44]!==_||t[45]!==x?(O=e==="settings"&&s.jsx(Yr,{initialName:l,initialIcon:a,initialLLMConnectionId:i,initialLLMModelId:c,initialAcceptPublishRequests:m,initialRequireApiToken:u,initialStorePrivateOnly:x,initialRateLimitEnabled:p,initialRateLimitWindow:h,initialRateLimitMax:d,revealedKey:r,onRevealedKeyChange:o},_),t[33]=m,t[34]=e,t[35]=p,t[36]=d,t[37]=h,t[38]=a,t[39]=i,t[40]=c,t[41]=l,t[42]=u,t[43]=r,t[44]=_,t[45]=x,t[46]=O):O=t[46];let B;t[47]!==A||t[48]!==q||t[49]!==z||t[50]!==O?(B=s.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[A,q,z,O]}),t[47]=A,t[48]=q,t[49]=z,t[50]=O,t[51]=B):B=t[51];let Q;return t[52]!==E||t[53]!==B?(Q=s.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[E,B]}),t[52]=E,t[53]=B,t[54]=Q):Q=t[54],Q}export{Ul as default};
5
+ Describe your MCP here...`,rows:6,value:ce,onChange:U=>fe(U.target.value)}),L.readme&&s.jsx("p",{className:"text-xs text-destructive",children:L.readme})]}),Te&&J==="generate"&&s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed border-border p-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Generates a README using name, description, tools, category and tags as context."}),s.jsx(F,{type:"button",variant:"outline",size:"sm",className:ht,disabled:d==="readme",onClick:xt,children:d==="readme"?"Generating...":"Generate with AI"})]})]}),s.jsx(yr,{tools:Ne,onChange:Fe,remoteUrl:pt(xe)||void 0,remoteType:ee,externalDiscoverStatus:j,externalDiscoverError:_})]});return s.jsx(Bt,{open:t,onOpenChange:ct,children:s.jsxs(Ft,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(zt,{className:"space-y-3",children:[s.jsx(Ot,{children:y?"Edit MCP Server":"Add MCP Server"}),s.jsx(Sr,{current:O}),s.jsxs(Ut,{children:[O===1&&"Set up the identity, connection and discover available tools.",O===2&&"Add descriptions, categories and tags to help discovery.",O===3&&"Configure optional metadata, README and tools."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[O===1&&Zs,O===2&&Xs,O===3&&en]}),s.jsxs(qt,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[s.jsx("div",{children:O>1&&s.jsxs(F,{variant:"ghost",size:"sm",onClick:Ws,children:[s.jsx(jn,{size:14}),"Back"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(F,{variant:"outline",size:"sm",onClick:()=>ct(!1),disabled:c,children:"Cancel"}),O<3?s.jsxs(F,{size:"sm",onClick:Hs,children:["Next",s.jsx(bn,{size:14})]}):s.jsx(F,{size:"sm",onClick:Js,disabled:c,children:c?"Saving...":y?"Save changes":"Create"})]})]})]})})}function ps(t,e){return t.includes(e)?t.filter(n=>n!==e):[...t,e]}function Er(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Dr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function $r(t){return t.server?.remotes?.[0]?.url??"-"}function Ar(){const t=X.c(120),[e,n]=T.useState(""),r=T.useDeferredValue(e);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[l,a]=T.useState(o);let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[1]=i):i=t[1];const[c,m]=T.useState(i),[u,x]=T.useState(!1),[p,h]=T.useState(!1),[d,b]=T.useState(null),[j,_]=T.useState(null),[k,y]=hn("private-registry-list","cards"),g=T.useRef(null);let I;t[2]!==r||t[3]!==c||t[4]!==l?(I={search:r,tags:l,categories:c},t[2]=r,t[3]=c,t[4]=l,t[5]=I):I=t[5];const f=Os(I),w=Hn(),{registryLLMConnectionId:S,registryLLMModelId:P}=Kt(tt),{createMutation:N,updateMutation:R,deleteMutation:v,bulkCreateMutation:$}=ns();let D,M,E,A,q,z,O,B;if(t[6]!==N||t[7]!==v||t[8]!==j||t[9]!==w.data||t[10]!==f||t[11]!==r||t[12]!==e||t[13]!==c||t[14]!==l||t[15]!==y||t[16]!==R||t[17]!==k){const J=f.data?.pages.flatMap(qr).filter(Boolean)??[],_e=f.data?.pages[0]?.totalCount??J.length,xe=l.length>0||c.length>0||r.length>0,ke=w.data;let ee;t[26]!==ke?(ee=Array.isArray(ke?.tags)?ke.tags:[],t[26]=ke,t[27]=ee):ee=t[27],B=ee;let ge;t[28]!==ke?(ge=Array.isArray(ke?.categories)?ke.categories:[],t[28]=ke,t[29]=ge):ge=t[29],D=ge;let Re;t[30]!==f?(Re=W=>{g.current&&(g.current.disconnect(),g.current=null),!(!W||!f.hasNextPage||f.isFetchingNextPage)&&(g.current=new IntersectionObserver(Ie=>{Ie[0]?.isIntersecting&&f.hasNextPage&&!f.isFetchingNextPage&&f.fetchNextPage()},{rootMargin:"240px 0px"}),g.current.observe(W))},t[30]=f,t[31]=Re):Re=t[31];const ye=Re;let Me;t[32]!==N||t[33]!==R?(Me=async W=>{try{"data"in W?(await R.mutateAsync(W),Z.success("Registry item updated")):(await N.mutateAsync(W),Z.success("Registry item created"))}catch(Ie){const xt=Ie;throw Z.error(xt instanceof Error?xt.message:"Failed to save item"),xt}},t[32]=N,t[33]=R,t[34]=Me):Me=t[34],M=Me;let Ee;t[35]!==v||t[36]!==j?(Ee=async()=>{if(j)try{await v.mutateAsync(j.id),Z.success("Registry item deleted"),_(null)}catch(W){const Ie=W;Z.error(Ie instanceof Error?Ie.message:"Failed to delete item")}},t[35]=v,t[36]=j,t[37]=Ee):Ee=t[37],E=Ee,z="h-full flex flex-col";let Se;t[38]===Symbol.for("react.memo_cache_sentinel")?(Se=s.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t[38]=Se):Se=t[38];const ze=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[Se,s.jsx(G,{variant:"secondary",className:"text-xs",children:_e})]});let Ne;t[39]===Symbol.for("react.memo_cache_sentinel")?(Ne=s.jsx(Dt,{asChild:!0,children:s.jsxs(F,{variant:"outline",size:"sm",className:ne("h-8","gap-1.5"),children:[s.jsx(pn,{size:14}),"Filters"]})}),t[39]=Ne):Ne=t[39];let Fe;t[40]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsx(as,{children:"Tags"}),t[40]=Fe):Fe=t[40];let Be;t[41]!==l||t[42]!==B?(Be=B.length>0?B.map(W=>s.jsxs(ls,{checked:l.includes(W.value),onCheckedChange:()=>a(Ie=>ps(Ie,W.value)),children:[W.value," (",W.count,")"]},W.value)):s.jsx(Je,{disabled:!0,children:"No tags available"}),t[41]=l,t[42]=B,t[43]=Be):Be=t[43];let Xe,L;t[44]===Symbol.for("react.memo_cache_sentinel")?(Xe=s.jsx(un,{}),L=s.jsx(as,{children:"Categories"}),t[44]=Xe,t[45]=L):(Xe=t[44],L=t[45]);let de;t[46]!==D||t[47]!==c?(de=D.length>0?D.map(W=>s.jsxs(ls,{checked:c.includes(W.value),onCheckedChange:()=>m(Ie=>ps(Ie,W.value)),children:[W.value," (",W.count,")"]},W.value)):s.jsx(Je,{disabled:!0,children:"No categories available"}),t[46]=D,t[47]=c,t[48]=de):de=t[48];let Te;t[49]!==Be||t[50]!==de?(Te=s.jsxs($t,{children:[Ne,s.jsxs(At,{align:"end",className:"w-[260px]",children:[Fe,Be,Xe,L,de]})]}),t[49]=Be,t[50]=de,t[51]=Te):Te=t[51];let De;t[52]!==y?(De=W=>{(W==="cards"||W==="table")&&y(W)},t[52]=y,t[53]=De):De=t[53];let st,Pe;t[54]===Symbol.for("react.memo_cache_sentinel")?(st=s.jsx(os,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),Pe=s.jsx(os,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"}),t[54]=st,t[55]=Pe):(st=t[54],Pe=t[55]);let Ge;t[56]!==De||t[57]!==k?(Ge=s.jsxs(xn,{type:"single",value:k,onValueChange:De,variant:"outline",className:"h-8",children:[st,Pe]}),t[56]=De,t[57]=k,t[58]=Ge):Ge=t[58];let nt;t[59]===Symbol.for("react.memo_cache_sentinel")?(nt=s.jsx(F,{variant:"outline",size:"sm",className:"h-8",onClick:()=>h(!0),children:"Import CSV"}),t[59]=nt):nt=t[59];let ct;t[60]===Symbol.for("react.memo_cache_sentinel")?(ct=s.jsx(F,{size:"sm",className:"h-8",onClick:()=>x(!0),children:"Add MCP Servers"}),t[60]=ct):ct=t[60];let rt;t[61]!==Te||t[62]!==Ge?(rt=s.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[Te,Ge,nt,ct]}),t[61]=Te,t[62]=Ge,t[63]=rt):rt=t[63];let it;t[64]!==ze||t[65]!==rt?(it=s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[ze,rt]}),t[64]=ze,t[65]=rt,t[66]=it):it=t[66];let Ke;t[67]===Symbol.for("react.memo_cache_sentinel")?(Ke=s.jsx(Cs,{size:16,className:"text-muted-foreground shrink-0"}),t[67]=Ke):Ke=t[67];let Ve;t[68]===Symbol.for("react.memo_cache_sentinel")?(Ve=W=>n(W.target.value),t[68]=Ve):Ve=t[68];let lt;t[69]!==e?(lt=s.jsx("div",{className:"border-t border-border h-12 px-4 md:px-6 flex items-center",children:s.jsxs("label",{className:"flex items-center gap-2.5 h-12 w-full cursor-text",children:[Ke,s.jsx(je,{value:e,onChange:Ve,placeholder:"Search by id, title, description, or server name",className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),t[69]=e,t[70]=lt):lt=t[70];let at;t[71]!==xe||t[72]!==e||t[73]!==c||t[74]!==l?(at=xe&&s.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[l.map(Ur),c.map(Or),e.trim()&&s.jsxs(G,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{n(""),a([]),m([])},children:"Clear filters"})]}),t[71]=xe,t[72]=e,t[73]=c,t[74]=l,t[75]=at):at=t[75],t[76]!==it||t[77]!==lt||t[78]!==at?(O=s.jsxs("div",{className:"shrink-0 border-b border-border",children:[it,lt,at]}),t[76]=it,t[77]=lt,t[78]=at,t[79]=O):O=t[79],A="flex-1 overflow-auto px-4 md:px-6 py-4",q=J.length===0?s.jsx("div",{className:"min-h-[320px] rounded-xl border border-dashed border-border flex flex-col items-center justify-center gap-3 p-6 text-center",children:f.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"size-5 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading items..."})]}):s.jsxs(s.Fragment,{children:[s.jsx("h3",{className:"text-base font-medium",children:xe?"No items found":"No MCPs in your registry"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:xe?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!xe&&s.jsx(F,{size:"lg",onClick:()=>x(!0),children:"Add MCP Servers"})]})}):k==="cards"?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:J.map(W=>s.jsx(jr,{item:W,onEdit:b,onDelete:_},W.id))}),f.hasNextPage&&s.jsx("div",{ref:ye,className:"h-2"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"border rounded-lg overflow-auto",children:s.jsxs(vs,{children:[s.jsx(ys,{children:s.jsxs(Lt,{children:[s.jsx(Oe,{className:"w-[56px]",children:"Icon"}),s.jsx(Oe,{children:"Title"}),s.jsx(Oe,{children:"ID"}),s.jsx(Oe,{children:"Tags"}),s.jsx(Oe,{children:"Categories"}),s.jsx(Oe,{children:"Remote URL"}),s.jsx(Oe,{children:"Visibility"}),s.jsx(Oe,{className:"text-right w-[68px]",children:"Actions"})]})}),s.jsx(Ns,{children:J.map(W=>s.jsxs(Lt,{children:[s.jsx(Ue,{children:s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:W.server?.icons?.[0]?.src?s.jsx("img",{src:W.server.icons[0].src,alt:W.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:W.title.charAt(0).toUpperCase()})})}),s.jsx(Ue,{children:W.title}),s.jsx(Ue,{className:"font-mono",children:W.id}),s.jsx(Ue,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Er(W).slice(0,3).map(Ie=>s.jsx(G,{variant:"outline",children:Ie},`${W.id}-tag-${Ie}`))})}),s.jsx(Ue,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Dr(W).slice(0,3).map(Ie=>s.jsx(G,{variant:"outline",children:Ie},`${W.id}-category-${Ie}`))})}),s.jsx(Ue,{children:$r(W)}),s.jsx(Ue,{children:W.is_public?s.jsxs(G,{variant:"default",className:"gap-1",children:[s.jsx(ws,{size:10}),"Public"]}):s.jsx(G,{variant:"secondary",children:"Private"})}),s.jsx(Ue,{className:"text-right",children:s.jsxs($t,{children:[s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:18})})}),s.jsxs(At,{align:"end",children:[s.jsx(Je,{onClick:()=>b(W),children:"Edit"}),s.jsx(Je,{variant:"destructive",onClick:()=>_(W),children:"Delete"})]})]})})]},W.id))})]})}),f.hasNextPage&&s.jsx("div",{ref:ye,className:"h-2"})]}),t[6]=N,t[7]=v,t[8]=j,t[9]=w.data,t[10]=f,t[11]=r,t[12]=e,t[13]=c,t[14]=l,t[15]=y,t[16]=R,t[17]=k,t[18]=D,t[19]=M,t[20]=E,t[21]=A,t[22]=q,t[23]=z,t[24]=O,t[25]=B}else D=t[18],M=t[19],E=t[20],A=t[21],q=t[22],z=t[23],O=t[24],B=t[25];let Q;t[80]!==f.isFetchingNextPage?(Q=f.isFetchingNextPage&&s.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(ut,{className:"size-4 animate-spin"}),"Loading more items..."]}),t[80]=f.isFetchingNextPage,t[81]=Q):Q=t[81];let te;t[82]!==A||t[83]!==q||t[84]!==Q?(te=s.jsxs("div",{className:A,children:[q,Q]}),t[82]=A,t[83]=q,t[84]=Q,t[85]=te):te=t[85];const se=d?.id??"create",re=u||!!d;let ie;t[86]===Symbol.for("react.memo_cache_sentinel")?(ie=J=>{J||(x(!1),b(null))},t[86]=ie):ie=t[86];let ae;t[87]!==B?(ae=B.map(zr),t[87]=B,t[88]=ae):ae=t[88];let oe;t[89]!==D?(oe=D.map(Lr),t[89]=D,t[90]=oe):oe=t[90];const pe=N.isPending||R.isPending;let ue;t[91]!==d||t[92]!==M||t[93]!==S||t[94]!==P||t[95]!==re||t[96]!==ae||t[97]!==oe||t[98]!==pe||t[99]!==se?(ue=s.jsx(Pr,{open:re,onOpenChange:ie,item:d,availableTags:ae,availableCategories:oe,defaultLLMConnectionId:S,defaultLLMModelId:P,isSubmitting:pe,onSubmit:M},se),t[91]=d,t[92]=M,t[93]=S,t[94]=P,t[95]=re,t[96]=ae,t[97]=oe,t[98]=pe,t[99]=se,t[100]=ue):ue=t[100];let C;t[101]!==$?(C=async J=>{try{const _e=await $.mutateAsync(J);return Z.success(`Imported ${_e.created} item(s)`),_e}catch(_e){const xe=_e;throw Z.error(xe instanceof Error?xe.message:"Failed to import CSV"),xe}},t[101]=$,t[102]=C):C=t[102];let K;t[103]!==$.isPending||t[104]!==p||t[105]!==C?(K=s.jsx(or,{open:p,onOpenChange:h,isImporting:$.isPending,onImport:C}),t[103]=$.isPending,t[104]=p,t[105]=C,t[106]=K):K=t[106];const V=!!j;let ce;t[107]===Symbol.for("react.memo_cache_sentinel")?(ce=J=>{J||_(null)},t[107]=ce):ce=t[107];const fe=j?.title??j?.id??"";let we;t[108]!==v.isPending||t[109]!==E||t[110]!==V||t[111]!==fe?(we=s.jsx(xr,{open:V,onOpenChange:ce,title:fe,isDeleting:v.isPending,onConfirm:E}),t[108]=v.isPending,t[109]=E,t[110]=V,t[111]=fe,t[112]=we):we=t[112];let Ce;return t[113]!==ue||t[114]!==K||t[115]!==we||t[116]!==z||t[117]!==O||t[118]!==te?(Ce=s.jsxs("div",{className:z,children:[O,te,ue,K,we]}),t[113]=ue,t[114]=K,t[115]=we,t[116]=z,t[117]=O,t[118]=te,t[119]=Ce):Ce=t[119],Ce}function Lr(t){return t.value}function zr(t){return t.value}function Or(t){return s.jsx(G,{variant:"outline",children:t},`selected-category-${t}`)}function Ur(t){return s.jsxs(G,{variant:"default",children:["#",t]},`selected-tag-${t}`)}function qr(t){return t.items??[]}function Fr(t,e,n=!1){const r=T.useRef(null),o=T.useRef(t),l=T.useRef(e),a=T.useRef(n);return o.current=t,l.current=e,a.current=n,c=>{r.current&&r.current.disconnect(),r.current=new IntersectionObserver(m=>{m[0]?.isIntersecting&&l.current&&!a.current&&o.current()}),c&&r.current.observe(c)}}const Br=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function fs(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleDateString()}function gs(t){return{id:t.requested_id??t.server?.name,title:t.title,description:t.description??"",_meta:t._meta,server:t.server,is_public:!1}}function Zt(t){const e=t.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function jt(t){const e=t._meta?.["mcp.mesh"];return{hasReadmeContent:!!e?.readme?.trim(),hasReadmeLink:!!e?.readme_url?.trim(),readmeContent:e?.readme?.trim()??"",readmeUrl:e?.readme_url?.trim()??""}}function Gr(){const[t,e]=T.useState("pending"),[n,r]=T.useState("created_at"),[o,l]=T.useState("asc"),[a,i]=T.useState(new Set),[c,m]=T.useState(!1),[u,x]=T.useState("private"),[p,h]=T.useState(!1),[d,b]=T.useState(null),[j,_]=T.useState(null),[k,y]=T.useState(null),[g,I]=T.useState(null),[f,w]=T.useState(""),S=Wn({status:t,sortBy:n,sortDirection:o}),{reviewMutation:P,deleteMutation:N}=er(),{createMutation:R}=ns(),v=S.data?.pages.flatMap(C=>C.items)??[],$=S.data?.pages[0]?.totalCount??0,D=S.isFetchingNextPage,M=!!S.hasNextPage,E=Fr(()=>{S.isFetchingNextPage||S.fetchNextPage()},M,D),A=new Set(v.filter(C=>C.status==="pending").map(C=>C.id)),q=v.filter(C=>A.has(C.id)),z=a.size,O=q.filter(C=>a.has(C.id)),B=v.filter(C=>a.has(C.id)).length,Q=q.length>0&&q.every(C=>a.has(C.id)),te=()=>i(new Set),se=(C,K)=>{i(V=>{const ce=new Set(V);return K?ce.add(C):ce.delete(C),ce})},re=C=>{i(K=>{const V=new Set(K);return V.has(C)?V.delete(C):V.add(C),V})},ie=()=>{i(C=>{const K=new Set(C);for(const V of q)K.add(V.id);return K})},ae=async()=>{const C=j;if(C){_(null),b(C.id);try{await P.mutateAsync({id:C.id,status:"approved",reviewerNotes:void 0});const K=gs(C);await R.mutateAsync({id:K.id,title:K.title,description:K.description,_meta:K._meta,server:K.server,is_public:K.is_public}),Z.success("Request approved and added to registry")}catch(K){const V=K instanceof Error?K.message:"Failed to approve request";V.includes("UNIQUE constraint")||V.includes("already exists")?Z.error("An item with this ID already exists in the registry. Delete or rename it first."):Z.error(V)}finally{b(null)}}},oe=async()=>{if(k)try{await P.mutateAsync({id:k.id,status:"rejected",reviewerNotes:f.trim()||void 0}),Z.success("Request rejected"),y(null),w("")}catch(C){Z.error(C instanceof Error?C.message:"Failed to reject request")}},pe=async C=>{try{await N.mutateAsync(C.id),Z.success("Request deleted")}catch(K){Z.error(K instanceof Error?K.message:"Failed to delete request")}},ue=async()=>{if(O.length===0||p)return;h(!0),m(!1);let C=0;const K=new Set;for(const ce of O)try{await P.mutateAsync({id:ce.id,status:"approved",reviewerNotes:void 0});const fe=gs(ce);await R.mutateAsync({id:fe.id,title:fe.title,description:fe.description,_meta:fe._meta,server:fe.server,is_public:u==="public"}),C++}catch{K.add(ce.id)}const V=K.size;C>0&&V===0?Z.success(`${C} request${C>1?"s":""} approved as ${u}.`):C>0&&V>0?Z.warning(`Approved ${C}. Failed ${V}. Failed items remain selected for retry.`):Z.error("Bulk approve failed. Selected items were kept for retry."),i(K),h(!1)};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border",children:s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),s.jsx(G,{variant:"secondary",className:"text-xs",children:$})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:Br.map(C=>s.jsx("button",{type:"button",className:ne("px-2.5 py-1 text-xs rounded-md transition-colors",t===C.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(C.value),onClickCapture:()=>te(),children:C.label},C.value))}),s.jsxs("select",{className:"h-7 rounded-md border border-input bg-background px-2 text-xs",value:`${n}:${o}`,onChange:C=>{const[K,V]=C.target.value.split(":");r(K),l(V)},children:[s.jsx("option",{value:"created_at:asc",children:"Created at (oldest first)"}),s.jsx("option",{value:"created_at:desc",children:"Created at (newest first)"}),s.jsx("option",{value:"title:asc",children:"Alphabetical (A-Z)"}),s.jsx("option",{value:"title:desc",children:"Alphabetical (Z-A)"})]})]})]})}),s.jsxs("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:[S.isLoading?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):S.isError?s.jsxs(me,{className:"p-8 text-center",children:[s.jsx("p",{className:"text-sm text-destructive",children:"Failed to load publish requests."}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.error instanceof Error?S.error.message:"Unknown error"})]}):v.length===0?s.jsx(me,{className:"p-8 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:t==="pending"?"No pending publish requests.":t==="approved"?"No approved publish requests.":"No rejected publish requests."})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:v.map(C=>{const K=Zt(C),V=jt(C),ce=C._meta?.["mcp.mesh"]?.tags??[],fe=C._meta?.["mcp.mesh"]?.categories??[],we=V.hasReadmeContent||V.hasReadmeLink||ce.length>0||fe.length>0,Ce=[C.requester_name,C.requester_email].filter(Boolean).join(" · ");return s.jsxs(me,{className:ne("p-3 grid gap-1.5",A.has(C.id)&&"cursor-pointer hover:bg-muted/30",a.has(C.id)&&"bg-accent/20"),onClick:()=>{A.has(C.id)&&re(C.id)},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[A.has(C.id)&&s.jsx(wn,{checked:a.has(C.id),className:"mt-0.5",onCheckedChange:J=>se(C.id,J===!0),onClick:J=>J.stopPropagation()}),s.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:K?s.jsx("img",{src:K,alt:C.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:C.title.slice(0,1).toUpperCase()})}),s.jsx("p",{className:"text-sm font-medium truncate",children:C.title})]}),s.jsx(G,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:C.status})]}),C.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:C.description}),we&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[V.hasReadmeContent&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"README"}),V.hasReadmeLink&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"README link"}),ce.slice(0,2).map(J=>s.jsx(G,{variant:"secondary",className:"text-[10px]",children:J},`${C.id}-tag-${J}`)),fe.slice(0,1).map(J=>s.jsx(G,{variant:"secondary",className:"text-[10px]",children:J},`${C.id}-category-${J}`))]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[Ce&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate",children:Ce}),s.jsx("span",{children:"·"})]}),s.jsx("span",{className:"shrink-0",children:fs(C.created_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[s.jsxs(F,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),I(C)},children:[s.jsx(Is,{size:13}),"View"]}),A.has(C.id)?s.jsxs(s.Fragment,{children:[s.jsxs(F,{size:"sm",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),_(C)},disabled:d!==null||p||a.has(C.id),children:[s.jsx(ft,{size:13}),d===C.id?"Approving...":a.has(C.id)?"Selected":"Approve"]}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),y(C),w("")},disabled:P.isPending,children:[s.jsx(_n,{size:13}),"Reject"]})]}):s.jsxs(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:J=>{J.stopPropagation(),pe(C)},disabled:N.isPending,children:[s.jsx(It,{size:13}),"Delete"]})]})]},C.id)})}),v.length>0&&M?s.jsx("div",{ref:E,className:"h-1 w-full"}):null,D&&v.length>0?s.jsx("div",{className:"pt-3 text-xs text-muted-foreground",children:"Loading more requests..."}):null]}),z>0?s.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:s.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:[s.jsxs("div",{className:"text-xs text-muted-foreground pr-1",children:[z," selected"]}),s.jsx(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:ie,disabled:Q,children:"Select all"}),s.jsx(F,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:te,children:"Clear selection"}),s.jsxs(F,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>m(!0),disabled:p,children:[s.jsx(ft,{size:13}),"Approve selected"]})]})}):null,s.jsx(Bt,{open:!!g,onOpenChange:C=>{C||I(null)},children:s.jsxs(Ft,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[s.jsxs(zt,{children:[s.jsx(Ot,{children:g?.title??"Request details"}),s.jsx(Ut,{children:"Review all metadata sent by the requester before approving."})]}),g&&s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 space-y-4",children:[s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3 flex items-center gap-3",children:[s.jsx("div",{className:"size-16 rounded-lg border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:Zt(g)?s.jsx("img",{src:Zt(g)||"",alt:g.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:g.title.slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:g.title}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:g.server?.name||g.id})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),s.jsx("span",{className:"capitalize",children:g.status})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:fs(g.created_at)})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Requester"}),s.jsx("span",{children:g.requester_name||"-"})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Email"}),s.jsx("span",{children:g.requester_email||"-"})]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Remote URL"}),s.jsx("code",{className:"text-xs rounded-md border border-border bg-muted/30 px-2.5 py-2 break-all",children:g.server?.remotes?.[0]?.url??"-"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:g.description||"No description provided."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(g._meta?.["mcp.mesh"]?.tags??[]).length?(g._meta?.["mcp.mesh"]?.tags??[]).map(C=>s.jsx(G,{variant:"secondary",children:C},`${g.id}-detail-tag-${C}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(g._meta?.["mcp.mesh"]?.categories??[]).length?(g._meta?.["mcp.mesh"]?.categories??[]).map(C=>s.jsx(G,{variant:"secondary",children:C},`${g.id}-detail-category-${C}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{children:"README"}),jt(g).hasReadmeContent?s.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap max-h-40 overflow-y-auto rounded-md border border-border bg-muted/20 px-2.5 py-2",children:jt(g).readmeContent}):jt(g).hasReadmeLink?s.jsxs("a",{href:jt(g).readmeUrl,target:"_blank",rel:"noreferrer",className:"text-sm inline-flex items-center gap-1.5 text-primary hover:underline",children:["Open README link",s.jsx(Cn,{size:14})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),s.jsx(qt,{children:s.jsx(F,{variant:"outline",onClick:()=>I(null),children:"Close"})})]})}),s.jsx(Rt,{open:!!j,onOpenChange:C=>{C||_(null)},children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Approve publish request?"}),s.jsxs(wt,{children:["This will add"," ",s.jsx("span",{className:"font-medium text-foreground",children:j?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{children:"Cancel"}),s.jsx(_t,{onClick:ae,children:"Approve"})]})]})}),s.jsx(Rt,{open:c,onOpenChange:m,children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Approve selected requests?"}),s.jsxs(wt,{children:["This will approve ",O.length," request",O.length>1?"s":""," and create all resulting apps with the same visibility setting."]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"bulk-visibility",children:"Visibility for all selected"}),s.jsxs("select",{id:"bulk-visibility",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:u,onChange:C=>x(C.target.value),children:[s.jsx("option",{value:"private",children:"Private"}),s.jsx("option",{value:"public",children:"Public"})]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{disabled:p,children:"Cancel"}),s.jsx(_t,{onClick:ue,disabled:p||B===0,children:p?"Approving...":"Approve selected"})]})]})}),s.jsx(Bt,{open:!!k,onOpenChange:C=>{C||(y(null),w(""))},children:s.jsxs(Ft,{children:[s.jsxs(zt,{children:[s.jsx(Ot,{children:"Reject publish request?"}),s.jsx(Ut,{children:"This request will move to rejected status. You can leave optional notes for context."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),s.jsx(Gt,{id:"reject-notes",rows:4,value:f,onChange:C=>w(C.target.value),placeholder:"Reason for rejection..."})]}),s.jsxs(qt,{children:[s.jsx(F,{variant:"outline",onClick:()=>{y(null),w("")},children:"Cancel"}),s.jsx(F,{onClick:oe,disabled:P.isPending,children:P.isPending?"Rejecting...":"Reject"})]})]})})]})}function Gs(t){const e=X.c(104),{connectionId:n,modelId:r,connections:o,models:l,onConnectionChange:a,onModelChange:i,connectionLabel:c,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:x,className:p}=t,h=c===void 0?"LLM Connection":c,d=m===void 0?"Model":m,b=u===void 0?"Select LLM connection":u,j=x===void 0?"Select model":x,[_,k]=T.useState(!1),[y,g]=T.useState("");let I;if(e[0]!==r||e[1]!==l){let ee;e[3]!==r?(ee=ge=>ge.id===r,e[3]=r,e[4]=ee):ee=e[4],I=l.find(ee),e[0]=r,e[1]=l,e[2]=I}else I=e[2];const f=I;let w;if(e[5]!==l||e[6]!==y){const ee=y.trim().toLowerCase();w=ee?l.filter(ge=>ge.title.toLowerCase().includes(ee)||ge.id.toLowerCase().includes(ee)):l,e[5]=l,e[6]=y,e[7]=w}else w=e[7];const S=w;let P,N,R,v,$,D,M,E,A,q,z,O,B,Q,te,se,re,ie,ae,oe,pe,ue;if(e[8]!==p||e[9]!==n||e[10]!==h||e[11]!==b||e[12]!==o||e[13]!==d||e[14]!==j||e[15]!==a||e[16]!==_||e[17]!==y||e[18]!==f?.title){let ee;e[41]!==n?(ee=ze=>ze.id===n,e[41]=n,e[42]=ee):ee=e[42];const ge=o.find(ee);$=Kr,e[43]!==p?(ie=ne("grid gap-1.5",p),e[43]=p,e[44]=ie):ie=e[44],e[45]!==d?(ae=s.jsx(le,{children:d}),e[45]=d,e[46]=ae):ae=e[46],v=kn,te=_,se=k;const Re=f?.title||j;let ye;e[47]!==Re?(ye=s.jsx("span",{className:"truncate text-left",children:Re}),e[47]=Re,e[48]=ye):ye=e[48];let Me;e[49]===Symbol.for("react.memo_cache_sentinel")?(Me=s.jsx(Ts,{className:"size-4 shrink-0 opacity-60"}),e[49]=Me):Me=e[49],e[50]!==d||e[51]!==ye?(re=s.jsx(Sn,{asChild:!0,children:s.jsxs(F,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":d,children:[ye,Me]})}),e[50]=d,e[51]=ye,e[52]=re):re=e[52],R=Rn,O="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",B="start",Q=8,q="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Ee;e[53]===Symbol.for("react.memo_cache_sentinel")?(Ee=s.jsx(Cs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Ee):Ee=e[53];let Se;e[54]===Symbol.for("react.memo_cache_sentinel")?(Se=ze=>g(ze.target.value),e[54]=Se):Se=e[54],e[55]!==y?(z=s.jsxs("div",{className:"relative flex-1 min-w-0",children:[Ee,s.jsx(je,{value:y,onChange:Se,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=y,e[56]=z):z=e[56],A="w-auto shrink-0",N=_s,M=n,E=a,P=ks,oe="llm-connection-select",pe="h-9 min-w-[160px] max-w-[220px]",ue=h,D=ge?s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:ge.icon?s.jsx("img",{src:ge.icon,alt:ge.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:ge.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:ge.title})]}):s.jsx(Ss,{placeholder:b}),e[8]=p,e[9]=n,e[10]=h,e[11]=b,e[12]=o,e[13]=d,e[14]=j,e[15]=a,e[16]=_,e[17]=y,e[18]=f?.title,e[19]=P,e[20]=N,e[21]=R,e[22]=v,e[23]=$,e[24]=D,e[25]=M,e[26]=E,e[27]=A,e[28]=q,e[29]=z,e[30]=O,e[31]=B,e[32]=Q,e[33]=te,e[34]=se,e[35]=re,e[36]=ie,e[37]=ae,e[38]=oe,e[39]=pe,e[40]=ue}else P=e[19],N=e[20],R=e[21],v=e[22],$=e[23],D=e[24],M=e[25],E=e[26],A=e[27],q=e[28],z=e[29],O=e[30],B=e[31],Q=e[32],te=e[33],se=e[34],re=e[35],ie=e[36],ae=e[37],oe=e[38],pe=e[39],ue=e[40];let C;e[57]!==P||e[58]!==D||e[59]!==oe||e[60]!==pe||e[61]!==ue?(C=s.jsx(P,{id:oe,className:pe,"aria-label":ue,children:D}),e[57]=P,e[58]=D,e[59]=oe,e[60]=pe,e[61]=ue,e[62]=C):C=e[62];let K;e[63]!==o?(K=o.map(Qr),e[63]=o,e[64]=K):K=e[64];let V;e[65]!==K?(V=s.jsx(Rs,{children:K}),e[65]=K,e[66]=V):V=e[66];let ce;e[67]!==N||e[68]!==M||e[69]!==E||e[70]!==C||e[71]!==V?(ce=s.jsxs(N,{value:M,onValueChange:E,children:[C,V]}),e[67]=N,e[68]=M,e[69]=E,e[70]=C,e[71]=V,e[72]=ce):ce=e[72];let fe;e[73]!==A||e[74]!==ce?(fe=s.jsx("div",{className:A,children:ce}),e[73]=A,e[74]=ce,e[75]=fe):fe=e[75];let we;e[76]!==q||e[77]!==z||e[78]!==fe?(we=s.jsxs("div",{className:q,children:[z,fe]}),e[76]=q,e[77]=z,e[78]=fe,e[79]=we):we=e[79];let Ce;e[80]!==S||e[81]!==$||e[82]!==r||e[83]!==i?(Ce=S.length===0?s.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):S.map(ee=>{const ge=ee.id===r,Re=$(ee.capabilities);return s.jsxs("button",{type:"button",className:ne("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",ge?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{i(ee.id),k(!1)},children:[s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/40 overflow-hidden shrink-0 flex items-center justify-center",children:ee.logo?s.jsx("img",{src:ee.logo,alt:ee.title,className:"w-full h-full object-contain"}):s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(ee.title||ee.id).slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:ee.title}),ee.title!==ee.id&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:ee.id})]}),Re.length>0&&s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:Re.map(ye=>s.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:ye},`${ee.id}-${ye}`))})]},ee.id)}),e[80]=S,e[81]=$,e[82]=r,e[83]=i,e[84]=Ce):Ce=e[84];let J;e[85]!==Ce?(J=s.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:Ce}),e[85]=Ce,e[86]=J):J=e[86];let _e;e[87]!==R||e[88]!==O||e[89]!==B||e[90]!==Q||e[91]!==we||e[92]!==J?(_e=s.jsxs(R,{className:O,align:B,sideOffset:Q,children:[we,J]}),e[87]=R,e[88]=O,e[89]=B,e[90]=Q,e[91]=we,e[92]=J,e[93]=_e):_e=e[93];let xe;e[94]!==v||e[95]!==te||e[96]!==se||e[97]!==re||e[98]!==_e?(xe=s.jsxs(v,{open:te,onOpenChange:se,children:[re,_e]}),e[94]=v,e[95]=te,e[96]=se,e[97]=re,e[98]=_e,e[99]=xe):xe=e[99];let ke;return e[100]!==ie||e[101]!==ae||e[102]!==xe?(ke=s.jsxs("div",{className:ie,children:[ae,xe]}),e[100]=ie,e[101]=ae,e[102]=xe,e[103]=ke):ke=e[103],ke}function Qr(t){return s.jsx(Et,{value:t.id,children:s.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"size-4 rounded-sm overflow-hidden bg-muted/30 shrink-0 flex items-center justify-center",children:t.icon?s.jsx("img",{src:t.icon,alt:t.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:t.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:t.title})]})},t.id)}function Kr(t){const e=new Set((t??[]).map(Vr)),n=[];return e.has("text")&&n.push("Text"),e.has("vision")&&n.push("Vision"),e.has("tools")&&n.push("Tools"),n}function Vr(t){return t.toLowerCase()}function Yr({initialName:t,initialIcon:e,initialLLMConnectionId:n,initialLLMModelId:r,initialAcceptPublishRequests:o,initialRequireApiToken:l,initialStorePrivateOnly:a,initialRateLimitEnabled:i,initialRateLimitWindow:c,initialRateLimitMax:m,revealedKey:u,onRevealedKeyChange:x}){const{org:p}=he(),{uploadImage:h,isUploading:d}=Fs(),{saveRegistryConfigMutation:b}=Kt(tt),[j,_]=T.useState(t),[k,y]=T.useState(e),[g,I]=T.useState(n),[f,w]=T.useState(r),[S,P]=T.useState(o),[N,R]=T.useState(l),[v,$]=T.useState(a),[D,M]=T.useState(i),[E,A]=T.useState(c),[q,z]=T.useState(String(m)),O=tr(),{generateMutation:B,revokeMutation:Q}=sr(),[te,se]=T.useState(""),[re,ie]=T.useState(!1),[ae,oe]=T.useState(null),{handleCopy:pe,copied:ue}=Ht(),{handleCopy:C,copied:K}=Ht(),{handleCopy:V,copied:ce}=Ht(),fe=Os({search:"",tags:[],categories:[],limit:50}),Ce=(Ps()??[]).filter(L=>(L.tools??[]).some(de=>de.name==="LLM_DO_GENERATE")),J=g||n||Ce[0]?.id||"",_e=js({connectionId:J||void 0,orgId:p.id}),xe=Ms(J||"no-llm-connection","LLM",_e),ke=`${window.location.origin}/org/${p.slug}/registry/mcp`,ge=(fe.data?.pages.flatMap(L=>L.items??[])??[]).filter(L=>L.is_public).length,Re=`${window.location.origin}/org/${p.slug}/registry/publish-request`,ye=u?.slice(0,12)??null,Me=!!(ye&&(O.data?.items??[]).some(L=>L.prefix===ye)),Ee=j.trim()!==t.trim()||k.trim()!==e.trim()||g.trim()!==n.trim()||f.trim()!==r.trim()||S!==o||N!==l||v!==a||D!==i||E!==c||(Number.parseInt(q,10)||100)!==m,Se=b.isPending,ze=async L=>{if(!L)return;const de=L.name.split(".").pop()||"png",Te=`registry/${p.id}/identity/icon.${de}`,De=await h(L,Te);De?y(De):Z.error("Failed to upload icon. Please try again.")},Ne=async()=>{const L=j.trim();if(!L)return;const de=f.trim(),Te=de?g.trim()||J||"":g.trim(),De=Number.parseInt(q,10),st=Number.isFinite(De)&&De>=1?De:100;try{await b.mutateAsync({registryName:L,registryIcon:k.trim(),llmConnectionId:Te,llmModelId:de,acceptPublishRequests:S,requireApiToken:N,storePrivateOnly:v,rateLimitEnabled:D,rateLimitWindow:E,rateLimitMax:st}),Z.success("Registry settings updated")}catch(Pe){Z.error(Pe instanceof Error?Pe.message:"Failed to save registry settings")}},Fe=()=>{_(t),y(e),I(n),w(r),P(o),R(l),$(a),M(i),A(c),z(String(m))},Be=async()=>{const L=te.trim();if(L)try{const de=await B.mutateAsync(L);de?.key&&(x(de.key),ie(!1),se(""),Z.success("API key generated. Copy it now — it won't be shown again!"))}catch(de){Z.error(de instanceof Error?de.message:"Failed to generate API key")}},Xe=async L=>{try{await Q.mutateAsync(L),x(null),oe(null),Z.success("API key revoked")}catch(de){Z.error(de instanceof Error?de.message:"Failed to revoke API key")}};return s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4 min-h-[32px]",children:[Ee&&s.jsxs(F,{variant:"outline",size:"sm",onClick:Fe,disabled:Se,children:[s.jsx(Tn,{size:14}),"Undo"]}),s.jsxs(F,{variant:"default",size:"sm",onClick:Ne,disabled:Se||!Ee,children:[Se?s.jsx(ut,{size:14,className:"animate-spin"}):s.jsx(In,{size:14}),"Save"]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 items-start xl:grid-cols-2",children:[s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(me,{className:"min-w-0 p-4 grid gap-4 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Registry Identity"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the name and icon shown in the store selector."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(le,{htmlFor:"identity-name",children:"Name"}),s.jsx(je,{id:"identity-name",value:j,onChange:L=>_(L.target.value),placeholder:"Private Registry"})]}),s.jsx(Us,{value:k,onChange:y,onFileUpload:ze,isUploading:d})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"AI Configuration"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the default model used for AI suggestions."})]}),s.jsx(Gs,{connectionId:J,modelId:f,connections:Ce.map(L=>({id:L.id,title:L.title,icon:L.icon??null})),models:xe.map(L=>({id:L.id,title:L.title||L.id,logo:L.logo??null,capabilities:L.capabilities??[]})),onConnectionChange:L=>{I(L),w("")},onModelChange:w})]})]}),s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Public Registry"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Public URL to consume this registry as an MCP."})]}),s.jsxs(G,{variant:"secondary",children:[ge," ",ge===1?"public item":"public items"]})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:ke}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>pe(ke),children:ue?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Store Visibility"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what appears when users browse this registry in Store."})]}),s.jsx(bt,{id:"store-private-only",checked:v,onCheckedChange:$})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Enabled: show only private apps. Disabled: show public and private apps together."}),v!==a&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."})]}),s.jsxs(me,{className:"min-w-0 p-4 grid gap-3 content-start",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-semibold",children:"Publish Requests"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Allow external users to submit MCP servers for review."})]}),s.jsx(bt,{id:"accept-publish-requests",checked:S,onCheckedChange:P})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2 flex items-center gap-2 min-w-0",children:[s.jsx("code",{className:"text-xs font-mono break-all leading-5 min-w-0 flex-1 select-all",children:Re}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>C(Re),children:K?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[s.jsxs("div",{children:[s.jsx(le,{className:"text-sm font-medium",children:"Require API Token"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Requests without a valid token will be rejected."})]}),s.jsx(bt,{id:"require-api-token",checked:N,onCheckedChange:R})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border",children:[s.jsxs("div",{children:[s.jsx(le,{className:"text-sm font-medium",children:"Rate Limit"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Limit publish requests per organization by time window."})]}),s.jsx(bt,{id:"publish-rate-limit",checked:D,onCheckedChange:M})]}),D&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{htmlFor:"rate-limit-max",className:"text-sm font-medium",children:"Max requests"}),s.jsx(je,{id:"rate-limit-max",inputMode:"numeric",min:1,type:"number",value:q,onChange:L=>z(L.target.value),placeholder:"100"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{htmlFor:"rate-limit-window",className:"text-sm font-medium",children:"Window"}),s.jsxs("select",{id:"rate-limit-window",className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:E,onChange:L=>A(L.target.value),children:[s.jsx("option",{value:"minute",children:"Per minute"}),s.jsx("option",{value:"hour",children:"Per hour"})]})]})]}),(S!==o||N!==l||D!==i||E!==c||(Number.parseInt(q,10)||100)!==m)&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),S&&N&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx(Mn,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),u&&!Me&&s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 grid gap-1.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"New key (refreshing list...)"}),s.jsx(je,{readOnly:!0,value:u,className:"h-8 text-xs font-mono bg-background"})]}),s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"grid gap-1.5 flex-1",children:[s.jsx(le,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),s.jsx(je,{id:"api-key-name",value:te,onChange:L=>se(L.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),s.jsxs(F,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!te.trim()||B.isPending,onClick:Be,children:[B.isPending?s.jsx(ut,{size:14,className:"animate-spin"}):s.jsx(Pn,{size:14}),"Generate"]})]}),(O.data?.items?.length??0)>0&&s.jsx("div",{className:"grid gap-2",children:O.data?.items?.map(L=>s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2",children:[s.jsxs("div",{className:"grid gap-1 min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium truncate leading-none",children:L.name}),ye===L.prefix?s.jsx(je,{readOnly:!0,value:re?u??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):s.jsx(je,{readOnly:!0,value:`${L.prefix}••••••••`,className:"h-8 text-xs font-mono bg-muted/20 text-muted-foreground"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[ye===L.prefix&&s.jsxs(s.Fragment,{children:[s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ie(de=>!de),children:re?s.jsx(Es,{size:14}):s.jsx(Is,{size:14})}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!u,onClick:()=>u&&V(u),children:ce?s.jsx(Wt,{size:14}):s.jsx(Jt,{size:14})})]}),s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:Q.isPending,onClick:()=>oe({id:L.id,name:L.name}),children:s.jsx(It,{size:14})})]})]},L.id))})]})]})]})]}),s.jsx(Rt,{open:!!ae,onOpenChange:L=>{!L&&!Q.isPending&&oe(null)},children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Revoke API key?"}),s.jsxs(wt,{children:["This action cannot be undone. The key",ae?` "${ae.name}"`:""," will stop working immediately."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{disabled:Q.isPending,children:"Cancel"}),s.jsx(_t,{disabled:!ae||Q.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>ae&&Xe(ae.id),children:Q.isPending?"Revoking...":"Revoke key"})]})]})})]})}function Hr(t){const e=X.c(5),{results:n}=t;if(n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(me,{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(Wr),e[1]=n,e[2]=r):r=e[2];let o;return e[3]!==r?(o=s.jsx("div",{className:"space-y-2",children:r}),e[3]=r,e[4]=o):o=e[4],o}function Wr(t){return s.jsx(Jr,{result:t},t.id)}function Jr(t){const e=X.c(49),{result:n}=t,[r,o]=T.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(ei);let i;e[11]!==r?(i=()=>o(!r),e[11]=r,e[12]=i):i=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("span",{className:"text-red-500 text-sm mt-0.5",children:"✗"}),e[13]=c):c=e[13];let m;e[14]!==n.item_title?(m=s.jsx("h4",{className:"text-sm font-medium truncate",children:n.item_title}),e[14]=n.item_title,e[15]=m):m=e[15];let 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=s.jsx(G,{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=s.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 d;e[23]!==h?(d=s.jsxs("span",{children:["conn: ",h]}),e[23]=h,e[24]=d):d=e[24];const b=n.tools_listed?"✓":"✗";let j;e[25]!==b?(j=s.jsxs("span",{children:["tools listed: ",b]}),e[25]=b,e[26]=j):j=e[26];let _;e[27]!==n.duration_ms?(_=s.jsxs("span",{children:[n.duration_ms,"ms"]}),e[27]=n.duration_ms,e[28]=_):_=e[28];const k=a.length>0&&s.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"&&s.jsx(G,{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 g;e[31]!==j||e[32]!==_||e[33]!==k||e[34]!==y||e[35]!==d?(g=s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground flex-wrap",children:[d,j,_,k,y]}),e[31]=j,e[32]=_,e[33]=k,e[34]=y,e[35]=d,e[36]=g):g=e[36];let I;e[37]!==n.error_message?(I=n.error_message&&s.jsx("p",{className:"text-xs text-red-600 line-clamp-2",children:n.error_message}),e[37]=n.error_message,e[38]=I):I=e[38];let f;e[39]!==g||e[40]!==I||e[41]!==p?(f=s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p,g,I]}),e[39]=g,e[40]=I,e[41]=p,e[42]=f):f=e[42];const w=r?"▲":"▼";let S;e[43]!==w?(S=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-1",children:w}),e[43]=w,e[44]=S):S=e[44];let P;e[45]!==f||e[46]!==S||e[47]!==i?(P=s.jsxs("button",{type:"button",className:"w-full text-left p-3 flex items-start gap-3 hover:bg-muted/30 transition-colors",onClick:i,children:[c,f,S]}),e[45]=f,e[46]=S,e[47]=i,e[48]=P):P=e[48],l=s.jsxs(me,{className:"overflow-hidden",children:[P,r&&s.jsxs("div",{className:"border-t border-border p-3 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Full Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2.5 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:ne("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:ne("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]})]}),a.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-red-600",children:["Failed Tools (",a.length,")"]}),a.map(N=>s.jsxs("div",{className:"rounded border border-red-500/10 bg-red-500/5 px-2.5 py-1.5 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono font-medium text-red-700",children:N.toolName}),s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[N.durationMs,"ms"]})]}),N.error&&s.jsx("pre",{className:"text-[11px] whitespace-pre-wrap break-all text-red-600",children:N.error})]},`${n.id}-${N.toolName}`))]}),n.tool_results.length>0&&n.tool_results.some(Xr)&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Passing Tools"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:n.tool_results.filter(Zr).map(N=>s.jsxs(G,{variant:"secondary",className:"text-[10px]",children:["✓ ",N.toolName]},`${n.id}-${N.toolName}-pass`))})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.connection_ok,e[3]=n.duration_ms,e[4]=n.error_message,e[5]=n.id,e[6]=n.item_title,e[7]=n.status,e[8]=n.tool_results,e[9]=n.tools_listed,e[10]=l}else l=e[10];return l}function Zr(t){return t.success}function Xr(t){return t.success}function ei(t){return!t.success}const ti=[{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 si(t){const n=t.trim().split(/\s+/);if(n.length!==5)return{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1};const[r,o,l,a,i]=n,c=Number(r),m=Number(o),u=Number(l),x=Number(i);return Number.isInteger(c)&&Number.isInteger(m)&&c>=0&&c<=59&&m>=0&&m<=23?l==="*"&&i==="*"?{frequency:"daily",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*/14"&&i==="*"?{frequency:"biweekly",minute:c,hour:m,weekDay:1,dayOfMonth:1}:l==="*"&&Number.isInteger(x)&&x>=0&&x<=6?{frequency:"weekly",minute:c,hour:m,weekDay:x,dayOfMonth:1}:i==="*"&&Number.isInteger(u)&&u>=1&&u<=31?{frequency:"monthly",minute:c,hour:m,weekDay:1,dayOfMonth:u}:{frequency:"custom",minute:c,hour:m,weekDay:1,dayOfMonth:1}:{frequency:"custom",minute:0,hour:9,weekDay:1,dayOfMonth:1}}function ni(t,e){return`${String(t).padStart(2,"0")}:${String(e).padStart(2,"0")}`}function Pt(t){return t.frequency==="daily"?`${t.minute} ${t.hour} * * *`:t.frequency==="weekly"?`${t.minute} ${t.hour} * * ${t.weekDay}`:t.frequency==="biweekly"?`${t.minute} ${t.hour} */14 * *`:t.frequency==="monthly"?`${t.minute} ${t.hour} ${t.dayOfMonth} * *`:t.currentValue}function ri(t){const e=X.c(60),{value:n,onChange:r,disabled:o}=t,l=o===void 0?!1:o;let a;e[0]!==n?(a=si(n),e[0]=n,e[1]=a):a=e[1];const i=a,c=i.frequency==="custom";let m;e[2]!==r||e[3]!==i.dayOfMonth||e[4]!==i.hour||e[5]!==i.minute||e[6]!==i.weekDay||e[7]!==n?(m=E=>{if(E==="custom"){r(n);return}r(Pt({frequency:E,hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:i.dayOfMonth,currentValue:n}))},e[2]=r,e[3]=i.dayOfMonth,e[4]=i.hour,e[5]=i.minute,e[6]=i.weekDay,e[7]=n,e[8]=m):m=e[8];const u=m;let x;e[9]!==r||e[10]!==i.dayOfMonth||e[11]!==i.frequency||e[12]!==i.weekDay||e[13]!==n?(x=E=>{const[A,q]=E.split(":"),z=Number(A),O=Number(q);!Number.isInteger(z)||!Number.isInteger(O)||r(Pt({frequency:i.frequency,hour:z,minute:O,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=s.jsx(le,{children:"Frequency"}),e[15]=h):h=e[15];let d;e[16]!==u?(d=E=>u(E.target.value),e[16]=u,e[17]=d):d=e[17];let b,j,_,k,y;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("option",{value:"daily",children:"Daily"}),k=s.jsx("option",{value:"weekly",children:"Weekly"}),y=s.jsx("option",{value:"biweekly",children:"Every 2 weeks"}),b=s.jsx("option",{value:"monthly",children:"Monthly"}),j=s.jsx("option",{value:"custom",children:"Custom (raw cron)"}),e[18]=b,e[19]=j,e[20]=_,e[21]=k,e[22]=y):(b=e[18],j=e[19],_=e[20],k=e[21],y=e[22]);let g;e[23]!==l||e[24]!==i.frequency||e[25]!==d?(g=s.jsxs("label",{className:"space-y-1",children:[h,s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.frequency,onChange:d,disabled:l,children:[_,k,y,b,j]})]}),e[23]=l,e[24]=i.frequency,e[25]=d,e[26]=g):g=e[26];let I;e[27]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(le,{children:"Time"}),e[27]=I):I=e[27];let f;e[28]!==i.hour||e[29]!==i.minute?(f=ni(i.hour,i.minute),e[28]=i.hour,e[29]=i.minute,e[30]=f):f=e[30];let w;e[31]!==p?(w=E=>p(E.target.value),e[31]=p,e[32]=w):w=e[32];const S=l||c;let P;e[33]!==f||e[34]!==w||e[35]!==S?(P=s.jsxs("label",{className:"space-y-1",children:[I,s.jsx(je,{type:"time",value:f,onChange:w,disabled:S})]}),e[33]=f,e[34]=w,e[35]=S,e[36]=P):P=e[36];let N;e[37]!==l||e[38]!==r||e[39]!==i.dayOfMonth||e[40]!==i.frequency||e[41]!==i.hour||e[42]!==i.minute||e[43]!==i.weekDay||e[44]!==n?(N=i.frequency==="weekly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(le,{children:"Day of week"}),s.jsx("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.weekDay,onChange:E=>r(Pt({frequency:"weekly",hour:i.hour,minute:i.minute,weekDay:Number(E.target.value),dayOfMonth:i.dayOfMonth,currentValue:n})),disabled:l,children:ti.map(ii)})]}):i.frequency==="monthly"?s.jsxs("label",{className:"space-y-1",children:[s.jsx(le,{children:"Day of month"}),s.jsx(je,{type:"number",min:1,max:31,value:i.dayOfMonth,onChange:E=>{const A=Number(E.target.value);!Number.isInteger(A)||A<1||A>31||r(Pt({frequency:"monthly",hour:i.hour,minute:i.minute,weekDay:i.weekDay,dayOfMonth:A,currentValue:n}))},disabled:l})]}):s.jsxs("div",{className:"space-y-1",children:[s.jsx(le,{children:"Schedule notes"}),s.jsx("div",{className:"h-9 rounded-md border border-input bg-muted/20 px-3 text-xs text-muted-foreground flex items-center",children:i.frequency==="biweekly"?"Biweekly uses an every-14-days cron approximation.":i.frequency==="custom"?"Edit raw cron directly below.":"Runs in your server timezone."})]}),e[37]=l,e[38]=r,e[39]=i.dayOfMonth,e[40]=i.frequency,e[41]=i.hour,e[42]=i.minute,e[43]=i.weekDay,e[44]=n,e[45]=N):N=e[45];let R;e[46]!==g||e[47]!==P||e[48]!==N?(R=s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2",children:[g,P,N]}),e[46]=g,e[47]=P,e[48]=N,e[49]=R):R=e[49];let v;e[50]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(le,{children:"Raw cron expression"}),e[50]=v):v=e[50];let $;e[51]!==r?($=E=>r(E.target.value),e[51]=r,e[52]=$):$=e[52];let D;e[53]!==l||e[54]!==$||e[55]!==n?(D=s.jsxs("label",{className:"space-y-1 block",children:[v,s.jsx(je,{value:n,onChange:$,disabled:l,placeholder:"*/15 * * * *"})]}),e[53]=l,e[54]=$,e[55]=n,e[56]=D):D=e[56];let M;return e[57]!==R||e[58]!==D?(M=s.jsxs("div",{className:"space-y-2",children:[R,D]}),e[57]=R,e[58]=D,e[59]=M):M=e[59],M}function ii(t){return s.jsx("option",{value:t.value,children:t.label},t.value)}function li(t,e){return t.onFailure!==e.onFailure||t.llmConnectionId!==e.llmConnectionId||t.llmModelId!==e.llmModelId||t.perMcpTimeoutMs!==e.perMcpTimeoutMs||t.perToolTimeoutMs!==e.perToolTimeoutMs||t.maxAgentSteps!==e.maxAgentSteps||t.testPublicOnly!==e.testPublicOnly||t.testPrivateOnly!==e.testPrivateOnly||t.includePendingRequests!==e.includePendingRequests||(t.agentContext??"")!==(e.agentContext??"")||t.schedule!==e.schedule||t.cronExpression!==e.cronExpression}function ai(){const{registryLLMConnectionId:t,registryLLMModelId:e}=Kt(tt),{settings:n,saveMutation:r}=Ls(),o=Gn(),l=Qn(),a=T.useRef(n),[i,c]=T.useState(n),[m,u]=T.useState(!1),[x,p]=T.useState(!1),{org:h}=he(),b=(Ps()??[]).filter(f=>(f.tools??[]).some(w=>w.name==="LLM_DO_GENERATE")),j=i.llmConnectionId||t||b[0]?.id||"",_=js({connectionId:j||void 0,orgId:h.id}),k=Ms(j||"no-llm-connection","LLM",_);a.current!==n&&(a.current=n,c(n));const y=li(i,n),g=f=>{u(!1),c(w=>({...w,...f}))},I=async()=>{const f=i.cronExpression?.trim()??"";let w=n.scheduleEventId??"";if(i.schedule==="cron"&&f.length>0){const R=f!==(n.cronExpression??"");R&&w&&await l.mutateAsync(w),(R||!w)&&(w=(await o.mutateAsync({cronExpression:f,config:i})).scheduleEventId)}else w&&(await l.mutateAsync(w),w="");const S=(i.llmModelId??"").trim(),P=S?(i.llmConnectionId||j||"").trim():(i.llmConnectionId??"").trim(),N={...i,cronExpression:f,scheduleEventId:w,agentContext:(i.agentContext??"").trim(),llmConnectionId:P,llmModelId:S};await r.mutateAsync(N),c(N),u(!0),setTimeout(()=>u(!1),3e3)};return s.jsxs(me,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA Configuration"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure how the MCP QA agent validates registry entries."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[y&&s.jsx(G,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"Unsaved changes"}),m&&s.jsx(G,{className:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 text-[10px]",children:"✓ Saved"}),s.jsx(F,{size:"sm",onClick:I,disabled:r.isPending||o.isPending||l.isPending||!y,children:r.isPending||o.isPending||l.isPending?"Saving...":"Save settings"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"On failure",hint:"Automatic action to apply when an MCP fails tests in a run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.onFailure,onChange:f=>g({onFailure:f.target.value}),children:[s.jsx("option",{value:"none",children:"Do nothing"}),s.jsx("option",{value:"unlisted",children:"Unlist from store (keep in registry)"}),s.jsx("option",{value:"remove_public",children:"Remove from public store"}),s.jsx("option",{value:"remove_private",children:"Remove from private registry"}),s.jsx("option",{value:"remove_all",children:"Remove from all (public + private)"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Test scope",hint:"Choose whether tests should run for public items, private items, or both."}),s.jsxs("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:[s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPublicOnly,onChange:f=>g({testPublicOnly:f.target.checked,testPrivateOnly:f.target.checked?!1:i.testPrivateOnly})}),"Public only"]}),s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.testPrivateOnly,onChange:f=>g({testPrivateOnly:f.target.checked,testPublicOnly:f.target.checked?!1:i.testPublicOnly})}),"Private only"]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Publish requests",hint:"Include pending publish requests in QA runs to validate them before publishing to the store."}),s.jsx("div",{className:"flex items-center gap-4 rounded-md border border-input px-3 py-2",children:s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:i.includePendingRequests,onChange:f=>g({includePendingRequests:f.target.checked})}),"Include pending requests in tests"]})})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(et,{label:"Model (LLM binding)",hint:"Used only in Agentic mode to decide and chain tool calls."}),s.jsx(Gs,{connectionId:j,modelId:i.llmModelId??"",connections:b.map(f=>({id:f.id,title:f.title,icon:f.icon??null})),models:k.map(f=>({id:f.id,title:f.title||f.id,logo:f.logo??null,capabilities:f.capabilities??[]})),onConnectionChange:f=>g({llmConnectionId:f,llmModelId:""}),onModelChange:f=>g({llmModelId:f})})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(et,{label:"Additional test context (prompt)",hint:"Extra runtime context passed to the agent, such as valid emails, tenant IDs, or known test entities."}),s.jsxs(F,{size:"sm",variant:"outline",className:"h-7",onClick:()=>p(f=>!f),children:[x?"Hide":"View"," default system prompt"]})]}),s.jsx(Gt,{value:i.agentContext??"",onChange:f=>g({agentContext:f.target.value}),placeholder:'Example: Use "my-user@company.com" as a valid email for Google Drive share/create_permission tests.',rows:3}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use this field for real data required by some tools (valid email, fixed IDs, test environment details, etc)."}),x&&s.jsx("pre",{className:"text-[11px] bg-muted/50 border border-border rounded px-3 py-2 whitespace-pre-wrap max-h-64 overflow-auto",children:cn})]}),s.jsxs("div",{className:"space-y-1 md:col-span-2",children:[s.jsx(et,{label:"Schedule",hint:"Set automatic test runs. Manual mode runs only when you click Start QA run."}),s.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm",value:i.schedule??"manual",onChange:f=>g({schedule:f.target.value}),children:[s.jsx("option",{value:"manual",children:"Manual only"}),s.jsx("option",{value:"cron",children:"Cron schedule"})]}),(i.schedule??"manual")==="cron"&&s.jsx(ri,{value:i.cronExpression??"",onChange:f=>g({cronExpression:f})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Per MCP timeout (ms)",hint:"Max total time allowed to validate one MCP."}),s.jsx(je,{type:"number",value:i.perMcpTimeoutMs,onChange:f=>g({perMcpTimeoutMs:Number(f.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Per tool timeout (ms)",hint:"Max time allowed for each individual tool call."}),s.jsx(je,{type:"number",value:i.perToolTimeoutMs,onChange:f=>g({perToolTimeoutMs:Number(f.target.value)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(et,{label:"Max agent steps",hint:"Maximum number of reasoning/tool steps in Agentic mode."}),s.jsx(je,{type:"number",value:i.maxAgentSteps,onChange:f=>g({maxAgentSteps:Number(f.target.value)}),min:1,max:30})]})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["LLM fallback from Settings:"," ",s.jsxs("span",{className:"font-mono",children:[t||"-"," / ",e||"-"]})]})]})}function et(t){const e=X.c(13),{label:n,hint:r}=t;let o;e[0]!==n?(o=s.jsx(le,{children:n}),e[0]=n,e[1]=o):o=e[1];const l=`About ${n}`;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(vn,{size:14}),e[2]=a):a=e[2];let i;e[3]!==l?(i=s.jsx(En,{asChild:!0,children:s.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":l,children:a})}),e[3]=l,e[4]=i):i=e[4];let c;e[5]!==r?(c=s.jsx(Dn,{side:"top",className:"max-w-72",children:r}),e[5]=r,e[6]=c):c=e[6];let m;e[7]!==i||e[8]!==c?(m=s.jsxs($n,{children:[i,c]}),e[7]=i,e[8]=c,e[9]=m):m=e[9];let u;return e[10]!==o||e[11]!==m?(u=s.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 oi(t){switch(t){case"authenticated":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20"}}function ci(t){switch(t){case"authenticated":return"Authenticated";case"needs_auth":return"Needs Auth";default:return"Not checked"}}function di({entry:t,onAuthChanged:e,failedToolsCount:n,failedResultCount:r}){const[o,l]=T.useState(!1),[a,i]=T.useState(""),[c,m]=T.useState(!1),u=Bn(),{updateMutation:x}=ns(),p=t.mapping.connection_id,h=t.mapping.auth_status,d=t.item?.title??t.mapping.item_id,b=t.item?.server?.icons?.[0]?.src??null,j=t.item?.is_public??!1,_=t.item?.is_unlisted??!1,k=t.source==="request",y=Ze({queryKey:H.monitorConnectionAuthProbe(p),queryFn:async()=>Ln({url:`/mcp/${p}`,token:null}),staleTime:1e4,retry:1,refetchOnWindowFocus:!1}),g=y.data,I=y.isLoading,f=g?.supportsOAuth??!1,w=g?.hasOAuthToken??!1,S=g?.isServerError??!1,P=g?.isAuthenticated??!1,N=I?"checking":S?"server_error":f?P?w?"oauth_connected":"connected":"oauth_available":P?"connected":"token_required",R=()=>{u.mutate({connectionId:p,authStatus:"authenticated"},{onSuccess:()=>e()})},v=async()=>{l(!0);try{const q=(await y.refetch()).data;if(!q){Z.error(`Could not reach "${d}". The remote MCP may be down.`);return}if(q.isAuthenticated){Z.success(`"${d}" is reachable. You can re-authenticate if needed.`);return}if(q.isServerError){Z.error(`Server error for "${d}". The remote MCP may be down.`);return}if(!q.supportsOAuth){Z.warning(`"${d}" does not support OAuth. Use the Token field to paste an API key.`);return}Z.info(`Opening authentication window for "${d}"...`);const z=await An({connectionId:p,clientName:`MCP Test - ${d}`,timeout:18e4});if(z.error){Z.error(`OAuth failed for "${d}": ${z.error}`);return}z.tokenInfo?(await fetch(`/api/connections/${p}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:z.tokenInfo.accessToken,refreshToken:z.tokenInfo.refreshToken,expiresIn:z.tokenInfo.expiresIn,scope:z.tokenInfo.scope,clientId:z.tokenInfo.clientId,clientSecret:z.tokenInfo.clientSecret,tokenEndpoint:z.tokenInfo.tokenEndpoint})})).ok||z.token&&await $(z.token):z.token&&await $(z.token),Z.success(`"${d}" authenticated!`),R(),await y.refetch()}catch(A){console.error("[MonitorConnectionsPanel] Auth error:",A),Z.error(`Error: ${A instanceof Error?A.message:String(A)}`)}finally{l(!1)}},$=async A=>{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:A}}}})})).ok)throw new Error("Failed to save token")},D=async()=>{if(!a.trim()){Z.error("Token cannot be empty.");return}l(!0);try{await $(a),Z.success(`Token saved for "${d}"!`),m(!1),i(""),R(),await y.refetch()}catch(A){Z.error(`Error saving token: ${A instanceof Error?A.message:String(A)}`)}finally{l(!1)}},M=h==="authenticated"&&!w&&!c&&a.length===0,E=async A=>{if(k){Z.info("Visibility controls are available only for store items.");return}if(!t.item){Z.error("Registry item not found for this connection.");return}try{await x.mutateAsync({id:t.item.id,data:A}),Z.success("Visibility updated"),e()}catch(q){Z.error(q instanceof Error?q.message:"Failed to update visibility")}};return s.jsxs(me,{className:"p-3 space-y-3 h-full",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:b?s.jsx("img",{src:b,alt:d,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:d.charAt(0).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:d}),s.jsx("p",{className:"text-xs text-muted-foreground break-all",children:t.remoteUrl??"-"}),s.jsxs("div",{className:"mt-1 flex items-center gap-1.5 flex-wrap",children:[s.jsx(G,{variant:"outline",className:ne("text-[10px]",oi(h)),children:ci(h)}),s.jsx(G,{variant:j?"default":"secondary",className:"text-[10px]",children:j?"Public":"Not public"}),s.jsx(G,{variant:"outline",className:"text-[10px]",children:k?"Request":"Store"}),s.jsxs(G,{variant:"outline",className:ne("text-[10px]",N==="server_error"?"border-destructive/40 text-destructive":N==="oauth_connected"?"border-emerald-500/30 text-emerald-600":N==="oauth_available"?"border-sky-500/30 text-sky-600":N==="token_required"?"border-amber-500/30 text-amber-600":"text-muted-foreground"),children:[N==="checking"&&"Checking auth...",N==="server_error"&&"Server error",N==="oauth_connected"&&"OAuth connected",N==="oauth_available"&&"OAuth available",N==="token_required"&&"Token/manual auth",N==="connected"&&"Connected"]}),_&&s.jsx(G,{variant:"outline",className:"text-[10px]",children:"Hidden in private"}),(r>0||n>0)&&s.jsxs(G,{variant:"destructive",className:"text-[10px]",children:[r," failed MCP / ",n," failed tools"]})]})]})]}),s.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:s.jsxs($t,{children:[s.jsx(Dt,{asChild:!0,children:s.jsx(F,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(Xt,{size:16})})}),s.jsx(At,{align:"end",children:k?s.jsx(Je,{disabled:!0,children:"Request item (no store visibility controls)"}):s.jsxs(s.Fragment,{children:[s.jsx(Je,{onClick:()=>E({is_public:!1}),children:"Hide from public store"}),s.jsx(Je,{onClick:()=>E({is_unlisted:!0}),children:"Hide from private store"}),s.jsx(Je,{onClick:()=>E({is_public:!0,is_unlisted:!1}),children:"Show in both stores"})]})})]})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 flex-wrap",children:[f&&s.jsx(F,{size:"sm",onClick:v,disabled:o,children:o?"...":w?"Re-auth OAuth":"OAuth"}),s.jsx(F,{size:"sm",variant:"outline",onClick:()=>y.refetch(),disabled:o||I,children:I?"Checking...":"Re-check"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Token/API key (for MCPs that require manual auth)"}),M?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-8 px-3 flex items-center rounded-md border border-border bg-muted/50 text-muted-foreground font-mono text-xs",children:"••••••••••••••••"}),s.jsx("button",{type:"button",onClick:()=>m(!0),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted",title:"Replace token",children:"Edit"})]}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(je,{type:"password",placeholder:"Paste API token / key...",value:a,onChange:A=>i(A.target.value),className:"h-8 text-xs flex-1",onKeyDown:A=>{A.key==="Enter"&&D()}}),s.jsx(F,{size:"sm",className:"h-8 text-xs",onClick:D,disabled:o||!a.trim(),children:"Save"}),s.jsx(F,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{m(!1),i("")},children:"✕"})]})]})]})}function mi(){const t=X.c(55),e=As(),r=Qt("completed").data?.items?.[0],o=Mt(r?.id,void 0,r?.status),l=Fn(),[a,i]=T.useState("all");let c,m,u,x,p,h;if(t[0]!==e||t[1]!==o.data?.items||t[2]!==a||t[3]!==l){const j=e.data?.items??[];let _;t[10]!==o.data?.items?(_=(o.data?.items??[]).reduce(hi,{}),t[10]=o.data?.items,t[11]=_):_=t[11];const k=_;let y;t[12]!==a?(y=re=>a==="all"?!0:re.source===a,t[12]=a,t[13]=y):y=t[13];const g=j.filter(y);c=me,p="p-4 space-y-3";let I,f,w,S;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("h3",{className:"text-sm font-semibold",children:"QA Connections"}),w=s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"We auto-detect auth type. Use OAuth when available, or always paste a Token/API key for manual auth MCPs."}),S=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Listing tools alone does not imply authenticated status."}),I=s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Cards show MCP icon, auth status, and latest failed test counters."}),t[14]=I,t[15]=f,t[16]=w,t[17]=S):(I=t[14],f=t[15],w=t[16],S=t[17]);const P=a==="all"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let N;t[18]!==P?(N=ne("px-2.5 py-1 text-xs rounded-md transition-colors",P),t[18]=P,t[19]=N):N=t[19];let R;t[20]===Symbol.for("react.memo_cache_sentinel")?(R=()=>i("all"),t[20]=R):R=t[20];let v;t[21]!==N?(v=s.jsx("button",{type:"button",className:N,onClick:R,children:"All"}),t[21]=N,t[22]=v):v=t[22];const $=a==="store"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let D;t[23]!==$?(D=ne("px-2.5 py-1 text-xs rounded-md transition-colors",$),t[23]=$,t[24]=D):D=t[24];let M;t[25]===Symbol.for("react.memo_cache_sentinel")?(M=()=>i("store"),t[25]=M):M=t[25];let E;t[26]!==D?(E=s.jsx("button",{type:"button",className:D,onClick:M,children:"Store"}),t[26]=D,t[27]=E):E=t[27];const A=a==="request"?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground";let q;t[28]!==A?(q=ne("px-2.5 py-1 text-xs rounded-md transition-colors",A),t[28]=A,t[29]=q):q=t[29];let z;t[30]===Symbol.for("react.memo_cache_sentinel")?(z=()=>i("request"),t[30]=z):z=t[30];let O;t[31]!==q?(O=s.jsx("button",{type:"button",className:q,onClick:z,children:"Requests"}),t[31]=q,t[32]=O):O=t[32];let B;t[33]!==v||t[34]!==E||t[35]!==O?(B=s.jsxs("div",{children:[f,w,S,I,s.jsxs("div",{className:"mt-2 inline-flex rounded-lg border border-border p-0.5",children:[v,E,O]})]}),t[33]=v,t[34]=E,t[35]=O,t[36]=B):B=t[36];let Q;t[37]!==l?(Q=()=>{l.mutate(void 0,{onSuccess:xi,onError:ui})},t[37]=l,t[38]=Q):Q=t[38];const te=l.isPending?"Syncing...":"Sync";let se;t[39]!==l.isPending||t[40]!==Q||t[41]!==te?(se=s.jsx(F,{size:"sm",variant:"outline",onClick:Q,disabled:l.isPending,children:te}),t[39]=l.isPending,t[40]=Q,t[41]=te,t[42]=se):se=t[42],t[43]!==B||t[44]!==se?(h=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[B,se]}),t[43]=B,t[44]=se,t[45]=h):h=t[45],m="space-y-2",u=g.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:'No QA connections for this filter. Click "Sync" to create mappings from store items and pending requests.'}),x=g.length>0&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:g.map(re=>{const ie=k[re.mapping.item_id]??{failedTools:0,failedResults:0};return s.jsx(di,{entry:re,onAuthChanged:()=>e.refetch(),failedToolsCount:ie.failedTools,failedResultCount:ie.failedResults},re.mapping.id)})}),t[0]=e,t[1]=o.data?.items,t[2]=a,t[3]=l,t[4]=c,t[5]=m,t[6]=u,t[7]=x,t[8]=p,t[9]=h}else c=t[4],m=t[5],u=t[6],x=t[7],p=t[8],h=t[9];let d;t[46]!==m||t[47]!==u||t[48]!==x?(d=s.jsxs("div",{className:m,children:[u,x]}),t[46]=m,t[47]=u,t[48]=x,t[49]=d):d=t[49];let b;return t[50]!==c||t[51]!==p||t[52]!==h||t[53]!==d?(b=s.jsxs(c,{className:p,children:[h,d]}),t[50]=c,t[51]=p,t[52]=h,t[53]=d,t[54]=b):b=t[54],b}function ui(t){return Z.error(`Sync failed: ${t.message}`)}function xi(){return Z.success("Connections synced (store + pending requests)")}function hi(t,e){const n=t[e.item_id]??{failedTools:0,failedResults:0},r=e.tool_results.filter(pi).length;return n.failedTools=n.failedTools+r,(e.status==="failed"||e.status==="error")&&(n.failedResults=n.failedResults+1),t[e.item_id]=n,t}function pi(t){return!t.success}function Qs(t){switch(t){case"running":return"bg-blue-500/10 text-blue-600 border-blue-500/20";case"completed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"cancelled":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";case"pending":return"bg-amber-500/10 text-amber-600 border-amber-500/20";default:return""}}function Ks(t,e){if(!t)return null;const n=e?new Date(e).getTime():Date.now(),r=new Date(t).getTime(),o=n-r;return o<1e3?`${o}ms`:o<6e4?`${(o/1e3).toFixed(1)}s`:`${Math.floor(o/6e4)}m ${Math.round(o%6e4/1e3)}s`}function Vs(t){const e=new Map;for(const n of t)e.has(n.toolName)&&e.delete(n.toolName),e.set(n.toolName,n);return Array.from(e.values())}function fi(t){return t.total_items?Math.min(100,Math.round(t.tested_items/t.total_items*100)):0}function gi(t){if(!t)return null;const e=t.match(/Not executed tools \((\d+)\/(\d+)\):/i);if(!e)return null;const n=Number(e[2]);return Number.isFinite(n)&&n>=0?n:null}function ji(t){const e=X.c(57),{result:n,index:r,icon:o}=t,[l,a]=T.useState(!1);let i;if(e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n.action_taken||e[4]!==n.agent_summary||e[5]!==n.connection_ok||e[6]!==n.duration_ms||e[7]!==n.error_message||e[8]!==n.id||e[9]!==n.item_title||e[10]!==n.status||e[11]!==n.tool_results||e[12]!==n.tools_listed){const c=Vs(n.tool_results),m=c.every(Ni),u=c.filter(yi),x=u.filter(vi).length,p=u.filter(bi).length,h=u.length>0,d=u.length;let b;e[14]!==n.agent_summary?(b=gi(n.agent_summary),e[14]=n.agent_summary,e[15]=b):b=e[15];const j=b,_=Math.max(c.length,j??0),k=_>0?`${d}/${_} tools tested`:"0 tools";let y;e[16]!==l?(y=()=>a(!l),e[16]=l,e[17]=y):y=e[17];const g=r+1;let I;e[18]!==g?(I=s.jsx("span",{className:"text-muted-foreground w-5 text-right shrink-0",children:g}),e[18]=g,e[19]=I):I=e[19];let f;e[20]!==o||e[21]!==n.item_title?(f=s.jsx("div",{className:"size-5 rounded border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:o?s.jsx("img",{src:o,alt:n.item_title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[9px] font-semibold text-muted-foreground",children:n.item_title.charAt(0).toUpperCase()})}),e[20]=o,e[21]=n.item_title,e[22]=f):f=e[22];const w=n.status==="passed"?"text-emerald-600":n.status==="needs_auth"?"text-amber-600":"text-red-600";let S;e[23]!==w?(S=ne("shrink-0",w),e[23]=w,e[24]=S):S=e[24];const P=n.status==="passed"?"✓":n.status==="needs_auth"?"🔑":"✗";let N;e[25]!==S||e[26]!==P?(N=s.jsx("span",{className:S,children:P}),e[25]=S,e[26]=P,e[27]=N):N=e[27];let R;e[28]!==n.item_title?(R=s.jsx("span",{className:"font-medium truncate flex-1 min-w-0",children:n.item_title}),e[28]=n.item_title,e[29]=R):R=e[29];let v;e[30]!==n.duration_ms?(v=s.jsxs("span",{className:"text-muted-foreground shrink-0",children:[n.duration_ms,"ms"]}),e[30]=n.duration_ms,e[31]=v):v=e[31];const $=n.status==="passed"?"text-emerald-600 border-emerald-500/20":n.status==="needs_auth"?"text-amber-600 border-amber-500/20":"text-red-600 border-red-500/20";let D;e[32]!==$?(D=ne("text-[9px] capitalize shrink-0",$),e[32]=$,e[33]=D):D=e[33];let M;e[34]!==n.status?(M=n.status.replace("_"," "),e[34]=n.status,e[35]=M):M=e[35];let E;e[36]!==D||e[37]!==M?(E=s.jsx(G,{variant:"outline",className:D,children:M}),e[36]=D,e[37]=M,e[38]=E):E=e[38];let A;e[39]!==n.connection_ok?(A=n.connection_ok?s.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"conn✓"}):s.jsx("span",{className:"text-[10px] text-red-600 shrink-0",children:"conn✗"}),e[39]=n.connection_ok,e[40]=A):A=e[40];const q=n.tools_listed&&s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:h?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-emerald-600",children:[x,"✓"]})," ",s.jsxs("span",{className:ne(p>0?"text-red-600":""),children:[p,"✗"]})]}):m&&c.length>0?s.jsxs("span",{children:[c.length," tools found"]}):"no tools"});let z;e[41]!==k?(z=s.jsx(G,{variant:"outline",className:"text-[9px] shrink-0",children:k}),e[41]=k,e[42]=z):z=e[42];const O=l?"▲":"▼";let B;e[43]!==O?(B=s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:O}),e[43]=O,e[44]=B):B=e[44];let Q;e[45]!==N||e[46]!==R||e[47]!==v||e[48]!==E||e[49]!==A||e[50]!==q||e[51]!==z||e[52]!==B||e[53]!==y||e[54]!==I||e[55]!==f?(Q=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors",onClick:y,children:[I,f,N,R,v,E,A,q,z,B]}),e[45]=N,e[46]=R,e[47]=v,e[48]=E,e[49]=A,e[50]=q,e[51]=z,e[52]=B,e[53]=y,e[54]=I,e[55]=f,e[56]=Q):Q=e[56],i=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[Q,l&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-2 bg-muted/10",children:[n.error_message&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error_message})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:[s.jsxs("span",{children:["Connection:"," ",s.jsx("span",{className:ne(n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"OK":"Failed"})]}),s.jsxs("span",{children:["Tools listed:"," ",s.jsx("span",{className:ne(n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?"Yes":"No"})]}),n.action_taken!=="none"&&s.jsxs(G,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]})]}),h?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools tested: ",x," passed, ",p," failed"]}),s.jsx("div",{className:"space-y-0.5",children:u.map((te,se)=>s.jsx(wi,{tool:te},`${n.id}-${te.toolName}-${se}`))})]}):m&&c.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",c.length,") - not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:c.map((te,se)=>s.jsx(G,{variant:"outline",className:"text-[10px] font-mono",children:te.toolName},`${n.id}-${te.toolName}-${se}`))})]}):n.tools_listed?s.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"No tools found on this server."}):null,n.agent_summary&&s.jsx("p",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5",children:n.agent_summary})]})]}),e[0]=l,e[1]=o,e[2]=r,e[3]=n.action_taken,e[4]=n.agent_summary,e[5]=n.connection_ok,e[6]=n.duration_ms,e[7]=n.error_message,e[8]=n.id,e[9]=n.item_title,e[10]=n.status,e[11]=n.tool_results,e[12]=n.tools_listed,e[13]=i}else i=e[13];return i}function bi(t){return!t.success}function vi(t){return t.success}function yi(t){return t.outputPreview!=="health_check: not called"}function Ni(t){return t.outputPreview==="health_check: not called"}function wi(t){const e=X.c(30),{tool:n}=t,[r,o]=T.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=ne("font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=s.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=s.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&&s.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 d;e[13]!==h?(d=s.jsx("span",{className:"text-muted-foreground",children:h}),e[13]=h,e[14]=d):d=e[14];let b;e[15]!==l||e[16]!==d||e[17]!==m||e[18]!==u||e[19]!==x||e[20]!==p?(b=s.jsxs("button",{type:"button",className:"w-full text-left flex items-center gap-2 px-2 py-1 text-[11px] hover:bg-muted/30 transition-colors",onClick:l,children:[m,u,x,p,d]}),e[15]=l,e[16]=d,e[17]=m,e[18]=u,e[19]=x,e[20]=p,e[21]=b):b=e[21];let j;e[22]!==r||e[23]!==n.error||e[24]!==n.input||e[25]!==n.outputPreview?(j=r&&s.jsxs("div",{className:"border-t border-border px-2 py-1.5 space-y-1 bg-muted/10 text-[11px]",children:[n.error&&s.jsx("pre",{className:"bg-red-500/5 border border-red-500/10 rounded px-2 py-1 whitespace-pre-wrap break-all text-red-700 max-h-20 overflow-auto",children:n.error}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output"}),s.jsx("pre",{className:"bg-muted/50 rounded px-2 py-1 whitespace-pre-wrap break-all max-h-16 overflow-auto",children:n.outputPreview})]})]}),e[22]=r,e[23]=n.error,e[24]=n.input,e[25]=n.outputPreview,e[26]=j):j=e[26];let _;return e[27]!==b||e[28]!==j?(_=s.jsxs("div",{className:"rounded border border-border overflow-hidden",children:[b,j]}),e[27]=b,e[28]=j,e[29]=_):_=e[29],_}function Ci({activeRunId:t,onRunChange:e}){const{settings:n}=Ls(),[r,o]=T.useState(null),[l,a]=T.useState(!1),i=T.useRef(0),c=T.useRef(null),m=On(),u=Un(),x=ss(t),p=Qt(),h=As(),d=x.data?.run??null,b=d?.status,j=d?.config_snapshot?.monitorMode??d?.config_snapshot?.testMode,_=Mt(t,void 0,b),k=(p.data?.items??[]).find(v=>v.status==="running"),y=p.data?.items?.[0]?.id;!t&&y&&c.current!==y&&(c.current=y,queueMicrotask(()=>{e(y)}));const g=async()=>{const v=Date.now();if(v-i.current<1e3)return;i.current=v;const $=r??n.monitorMode,D=await m.mutateAsync({...n,monitorMode:$});e(D.run.id)},I=async()=>{if(k&&k.id!==t&&k.status==="running"){a(!0);return}await g()},f=async()=>{t&&await u.mutateAsync(t)},w=d?.status==="running",S=d?Ks(d.started_at,d.finished_at):null,P=_.data?.items??[],N=(h.data?.items??[]).reduce((v,$)=>(v[$.mapping.item_id]=$.item?.server?.icons?.[0]?.src??null,v),{}),R=r??n.monitorMode;return s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs("div",{className:"space-y-4 min-w-0",children:[s.jsxs(me,{className:"p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Current QA Run"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a full QA validation run and track results in real time."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[k&&k.id!==t&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["Run in progress: ",k.id.slice(0,8)]}),s.jsxs(F,{size:"sm",onClick:I,disabled:m.isPending||w,className:"gap-1.5",children:[s.jsx(zn,{size:14}),m.isPending?"Starting...":k&&k.id!==t?"Start another run":"Start QA run"]}),s.jsxs(F,{size:"sm",variant:"outline",onClick:f,disabled:!t||!w,className:"gap-1.5",children:[s.jsx($s,{size:14}),"Cancel"]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA mode"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:R,onChange:v=>o(v.target.value),disabled:w,children:[s.jsx("option",{value:"health_check",children:"Health check"}),s.jsx("option",{value:"tool_call",children:"Tool call"}),s.jsx("option",{value:"full_agent",children:"Agentic (LLM model)"})]})]}),s.jsxs("label",{className:"space-y-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"QA run history (pick a previous run)"}),s.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:t??"",onChange:v=>e(v.target.value||void 0),children:[s.jsx("option",{value:"",children:"Auto-select latest run"}),(p.data?.items??[]).map(v=>s.jsxs("option",{value:v.id,children:[new Date(v.created_at).toLocaleString()," -"," ",v.status]},v.id))]})]})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground rounded-md bg-muted/30 px-2.5 py-2",children:R==="health_check"?"Checks connectivity and tool listing only — no tool calls are made.":R==="tool_call"?"Calls each tool with empty inputs to verify it responds without errors.":"Uses an LLM model to execute chained tool calls and validate outputs."}),d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsx(G,{className:ne("capitalize",Qs(d.status),d.status==="running"?"animate-pulse":""),children:d.status}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),S&&s.jsx("span",{className:"text-xs text-muted-foreground",children:S}),w&&d.current_item_id&&s.jsxs("span",{className:"text-xs text-muted-foreground truncate max-w-64",children:["QA on:"," ",s.jsx("span",{className:"font-mono",children:d.current_item_id})]})]}),s.jsx("div",{className:"h-2.5 rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ne("h-full transition-all duration-500",d.failed_items>0?"bg-orange-500":"bg-emerald-500",w?"animate-pulse":""),style:{width:`${fi(d)}%`}})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:d.passed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:d.failed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:d.skipped_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:d.total_items})]})]})]}):s.jsx("p",{className:"text-xs text-muted-foreground",children:"No run selected yet. Start a new run to begin."})]}),s.jsxs(me,{className:"p-4 space-y-2 min-h-[360px]",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["QA results log (",P.length,")"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Live per-MCP test output for the selected run."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[w&&s.jsx(G,{className:"bg-blue-500/10 text-blue-600 border-blue-500/20 animate-pulse",children:"run in progress"}),d&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["progress: ",d.tested_items," of ",d.total_items," MCPs"]}),j&&s.jsxs(G,{variant:"outline",className:"text-[10px]",children:["mode: ",j.replace("_"," ")]})]})]}),P.length===0?s.jsx("div",{className:"h-[280px] rounded border border-dashed border-border flex items-center justify-center text-xs text-muted-foreground",children:"No results yet. Start a run to see live logs here."}):s.jsx("div",{ref:v=>{v&&w&&v.scrollHeight-v.scrollTop-v.clientHeight<120&&requestAnimationFrame(()=>{v.scrollTop=v.scrollHeight})},className:"space-y-1 max-h-[60vh] overflow-auto pr-1",children:P.map((v,$)=>s.jsx(ji,{result:v,index:$,icon:N[v.item_id]},v.id))})]})]}),s.jsx(Rt,{open:l,onOpenChange:a,children:s.jsxs(St,{children:[s.jsxs(Nt,{children:[s.jsx(yt,{children:"Start another test run?"}),s.jsxs(wt,{children:["There is already a run in progress",k?` (${k.id})`:"",". Starting another run may increase database load and slow down both executions."]})]}),s.jsxs(kt,{children:[s.jsx(Ct,{children:"Cancel"}),s.jsx(_t,{onClick:()=>{a(!1),g()},children:"Start anyway"})]})]})})]})}function Ys(t){switch(t){case"passed":return"bg-emerald-500/10 text-emerald-600 border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-600 border-red-500/20";case"error":return"bg-orange-500/10 text-orange-600 border-orange-500/20";case"needs_auth":return"bg-amber-500/10 text-amber-600 border-amber-500/20";case"skipped":return"bg-zinc-500/10 text-zinc-500 border-zinc-500/20";default:return""}}function _i(t){switch(t){case"passed":return"✓";case"failed":return"✗";case"error":return"⚠";case"needs_auth":return"🔑";case"skipped":return"⏭";default:return"?"}}function ki(t){const e=X.c(27),{tool:n}=t,[r,o]=T.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=ne("text-xs font-bold",a),e[2]=a,e[3]=i):i=e[3];const c=n.success?"✓":"✗";let m;e[4]!==i||e[5]!==c?(m=s.jsx("span",{className:i,children:c}),e[4]=i,e[5]=c,e[6]=m):m=e[6];let u;e[7]!==n.toolName?(u=s.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=s.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=s.jsx("span",{className:"text-[10px] text-muted-foreground",children:p}),e[11]=p,e[12]=h):h=e[12];let d;e[13]!==l||e[14]!==m||e[15]!==u||e[16]!==x||e[17]!==h?(d=s.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",onClick:l,children:[m,u,x,h]}),e[13]=l,e[14]=m,e[15]=u,e[16]=x,e[17]=h,e[18]=d):d=e[18];let b;e[19]!==r||e[20]!==n.error||e[21]!==n.input||e[22]!==n.outputPreview?(b=r&&s.jsxs("div",{className:"border-t border-border px-3 py-2 space-y-1.5 bg-muted/20",children:[n.error&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error"}),s.jsx("pre",{className:"text-[11px] bg-red-500/5 border border-red-500/10 rounded px-2 py-1.5 whitespace-pre-wrap break-all text-red-700",children:n.error})]}),n.input&&Object.keys(n.input).length>0&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Input"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:JSON.stringify(n.input,null,2)})]}),n.outputPreview&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Output preview"}),s.jsx("pre",{className:"text-[11px] bg-muted/50 rounded px-2 py-1.5 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:n.outputPreview})]}),!n.error&&!n.outputPreview&&(!n.input||Object.keys(n.input).length===0)&&s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"No additional details."})]}),e[19]=r,e[20]=n.error,e[21]=n.input,e[22]=n.outputPreview,e[23]=b):b=e[23];let j;return e[24]!==d||e[25]!==b?(j=s.jsxs("div",{className:"rounded border border-border",children:[d,b]}),e[24]=d,e[25]=b,e[26]=j):j=e[26],j}function Si(t){const e=X.c(52),{result:n}=t,[r,o]=T.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=Vs(n.tool_results),i=a.every(Mi),c=a.filter(Ii),m=c.filter(Ti).length,u=c.filter(Ri).length,x=c.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=_i(n.status),e[14]=n.status,e[15]=h):h=e[15];let d;e[16]!==h?(d=s.jsx("span",{className:"text-base shrink-0",children:h}),e[16]=h,e[17]=d):d=e[17];let b;e[18]!==n.item_title?(b=s.jsx("p",{className:"text-sm font-medium truncate",children:n.item_title}),e[18]=n.item_title,e[19]=b):b=e[19];let j;e[20]!==n.duration_ms?(j=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.duration_ms,"ms"]}),e[20]=n.duration_ms,e[21]=j):j=e[21];const _=n.connection_ok?"✓":"✗";let k;e[22]!==_?(k=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["conn: ",_]}),e[22]=_,e[23]=k):k=e[23];const y=n.tools_listed?"✓":"✗";let g;e[24]!==y?(g=s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["tools listed: ",y]}),e[24]=y,e[25]=g):g=e[25];const I=a.length>0&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:x?s.jsxs(s.Fragment,{children:["tools: ",m,"✓ ",u,"✗"]}):s.jsxs(s.Fragment,{children:[a.length," tools found"]})});let f;e[26]!==n.action_taken?(f=n.action_taken!=="none"&&s.jsxs(G,{variant:"destructive",className:"text-[9px] px-1.5 py-0",children:["action: ",n.action_taken]}),e[26]=n.action_taken,e[27]=f):f=e[27];let w;e[28]!==g||e[29]!==I||e[30]!==f||e[31]!==j||e[32]!==k?(w=s.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[j,k,g,I,f]}),e[28]=g,e[29]=I,e[30]=f,e[31]=j,e[32]=k,e[33]=w):w=e[33];let S;e[34]!==w||e[35]!==b?(S=s.jsxs("div",{className:"min-w-0 flex-1",children:[b,w]}),e[34]=w,e[35]=b,e[36]=S):S=e[36];let P;e[37]!==n.status?(P=ne("capitalize shrink-0",Ys(n.status)),e[37]=n.status,e[38]=P):P=e[38];let N;e[39]!==n.status?(N=n.status.replace("_"," "),e[39]=n.status,e[40]=N):N=e[40];let R;e[41]!==P||e[42]!==N?(R=s.jsx(G,{className:P,children:N}),e[41]=P,e[42]=N,e[43]=R):R=e[43];const v=r?"▲":"▼";let $;e[44]!==v?($=s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:v}),e[44]=v,e[45]=$):$=e[45];let D;e[46]!==S||e[47]!==R||e[48]!==$||e[49]!==p||e[50]!==d?(D=s.jsxs("button",{type:"button",className:"w-full text-left px-4 py-3 flex items-center gap-3 hover:bg-muted/30 transition-colors",onClick:p,children:[d,S,R,$]}),e[46]=S,e[47]=R,e[48]=$,e[49]=p,e[50]=d,e[51]=D):D=e[51],l=s.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[D,r&&s.jsxs("div",{className:"border-t border-border px-4 py-3 space-y-2 bg-muted/10",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Connection"}),s.jsx("p",{className:ne("text-xs font-medium",n.connection_ok?"text-emerald-600":"text-red-600"),children:n.connection_ok?"Connected":"Failed"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tools Listed"}),s.jsx("p",{className:ne("text-xs font-medium",n.tools_listed?"text-emerald-600":"text-red-600"),children:n.tools_listed?`Yes (${a.length})`:"No"})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Duration"}),s.jsxs("p",{className:"text-xs font-medium",children:[n.duration_ms,"ms"]})]}),s.jsxs("div",{className:"rounded border border-border px-2 py-1.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Action Taken"}),s.jsx("p",{className:"text-xs font-medium capitalize",children:n.action_taken.replace(/_/g," ")})]})]}),n.error_message&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-red-600",children:"Error Message"}),s.jsx("pre",{className:"text-xs bg-red-500/5 border border-red-500/10 rounded px-3 py-2 whitespace-pre-wrap break-all text-red-700",children:n.error_message})]}),x?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tool Results (",m," passed, ",u," failed)"]}),s.jsx("div",{className:"space-y-1",children:c.map((M,E)=>s.jsx(ki,{tool:M},`${n.id}-${M.toolName}-${E}`))})]}):i&&a.length>0?s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-[10px] font-semibold text-muted-foreground",children:["Tools discovered (",a.length,") — not individually tested (health-check mode)"]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:a.map((M,E)=>s.jsx(G,{variant:"outline",className:"text-[10px] font-mono",children:M.toolName},`${n.id}-${M.toolName}-${E}`))})]}):null,n.agent_summary&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground",children:"Agent Summary"}),s.jsx("p",{className:"text-xs bg-muted/50 rounded px-3 py-2",children:n.agent_summary})]})]})]}),e[0]=r,e[1]=n.action_taken,e[2]=n.agent_summary,e[3]=n.connection_ok,e[4]=n.duration_ms,e[5]=n.error_message,e[6]=n.id,e[7]=n.item_title,e[8]=n.status,e[9]=n.tool_results,e[10]=n.tools_listed,e[11]=l}else l=e[11];return l}function Ri(t){return!t.success}function Ti(t){return t.success}function Ii(t){return t.outputPreview!=="health_check: not called"}function Mi(t){return t.outputPreview==="health_check: not called"}function Pi(t){const e=X.c(4),{value:n,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[{value:"all",label:"All"},{value:"passed",label:"Passed"},{value:"failed",label:"Failed"},{value:"error",label:"Error"},{value:"needs_auth",label:"Needs Auth"},{value:"skipped",label:"Skipped"}],e[0]=o):o=e[0];const l=o;let a;return e[1]!==r||e[2]!==n?(a=s.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:l.map(i=>s.jsx("button",{type:"button",className:ne("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 Ei(t){const e=X.c(46),{runId:n}=t,[r,o]=T.useState("all"),l=ss(n),a=l.data?.run,i=Mt(n,void 0,a?.status);let c;e[0]!==i.data?.items?(c=i.data?.items??[],e[0]=i.data?.items,e[1]=c):c=e[1];const m=c;let u;e[2]!==m||e[3]!==r?(u=r==="all"?m:m.filter(v=>v.status===r),e[2]=m,e[3]=r,e[4]=u):u=e[4];const x=u;if(!n){let v;return e[5]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(me,{className:"p-6 text-center space-y-2",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a run to inspect details."})}),e[5]=v):v=e[5],v}let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("h3",{className:"text-sm font-semibold",children:"Run Detail"}),e[6]=p):p=e[6];let h;e[7]!==n?(h=s.jsxs("div",{children:[p,s.jsx("p",{className:"text-[10px] text-muted-foreground font-mono",children:n})]}),e[7]=n,e[8]=h):h=e[8];let d;e[9]!==a?(d=a&&s.jsx(G,{className:ne("capitalize",Ys(a.status)),children:a.status}),e[9]=a,e[10]=d):d=e[10];let b;e[11]!==i||e[12]!==l?(b=s.jsx(F,{size:"sm",variant:"outline",onClick:()=>{l.refetch(),i.refetch()},children:"Refresh"}),e[11]=i,e[12]=l,e[13]=b):b=e[13];let j;e[14]!==d||e[15]!==b?(j=s.jsxs("div",{className:"flex items-center gap-2",children:[d,b]}),e[14]=d,e[15]=b,e[16]=j):j=e[16];let _;e[17]!==h||e[18]!==j?(_=s.jsx(me,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,j]})}),e[17]=h,e[18]=j,e[19]=_):_=e[19];let k;e[20]!==a?(k=a&&s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-lg font-bold",children:a.total_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tested"}),s.jsx("p",{className:"text-lg font-bold",children:a.tested_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-emerald-600",children:"Passed"}),s.jsx("p",{className:"text-lg font-bold text-emerald-600",children:a.passed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-red-600",children:"Failed"}),s.jsx("p",{className:"text-lg font-bold text-red-600",children:a.failed_items})]}),s.jsxs(me,{className:"p-2.5 space-y-0.5",children:[s.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Skipped"}),s.jsx("p",{className:"text-lg font-bold",children:a.skipped_items})]})]}),e[20]=a,e[21]=k):k=e[21];let y;e[22]!==a?(y=a&&(a.started_at||a.finished_at)&&s.jsxs(me,{className:"p-3 flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[a.started_at&&s.jsxs("span",{children:["Started: ",new Date(a.started_at).toLocaleString()]}),a.finished_at&&s.jsxs("span",{children:["Finished: ",new Date(a.finished_at).toLocaleString()]}),a.started_at&&a.finished_at&&s.jsxs("span",{className:"font-medium text-foreground",children:["Duration:"," ",((new Date(a.finished_at).getTime()-new Date(a.started_at).getTime())/1e3).toFixed(1),"s"]})]}),e[22]=a,e[23]=y):y=e[23];let g;e[24]!==r?(g=s.jsx(Pi,{value:r,onChange:o}),e[24]=r,e[25]=g):g=e[25];const I=x.length!==1?"s":"";let f;e[26]!==x.length||e[27]!==I?(f=s.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.length," result",I]}),e[26]=x.length,e[27]=I,e[28]=f):f=e[28];let w;e[29]!==g||e[30]!==f?(w=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g,f]}),e[29]=g,e[30]=f,e[31]=w):w=e[31];let S;e[32]!==m||e[33]!==x.length?(S=x.length===0&&s.jsx(me,{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]=S):S=e[34];let P;e[35]!==x?(P=x.map(Di),e[35]=x,e[36]=P):P=e[36];let N;e[37]!==S||e[38]!==P?(N=s.jsxs("div",{className:"space-y-2",children:[S,P]}),e[37]=S,e[38]=P,e[39]=N):N=e[39];let R;return e[40]!==y||e[41]!==w||e[42]!==N||e[43]!==_||e[44]!==k?(R=s.jsxs("div",{className:"space-y-3",children:[_,k,y,w,N]}),e[40]=y,e[41]=w,e[42]=N,e[43]=_,e[44]=k,e[45]=R):R=e[45],R}function Di(t){return s.jsx(Si,{result:t},t.id)}function $i(t){return t.tested_items?`${Math.round(t.passed_items/t.tested_items*100)}%`:"-"}function Ai(t){const e=X.c(20),{selectedRunId:n,onSelectRun:r}=t,o=Qt();let l;e[0]!==o.data?.items?(l=o.data?.items??[],e[0]=o.data?.items,e[1]=l):l=e[1];const a=l;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"QA run history"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Browse previous QA executions and reopen their logs."})]}),e[2]=i):i=e[2];let c;e[3]!==o?(c=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i,s.jsx(F,{size:"sm",variant:"outline",onClick:()=>o.refetch(),children:"Refresh"})]}),e[3]=o,e[4]=c):c=e[4];let m;e[5]!==a.length?(m=a.length===0&&s.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No runs yet. Start QA from the Dashboard tab."}),e[5]=a.length,e[6]=m):m=e[6];let u;if(e[7]!==r||e[8]!==a||e[9]!==n){let h;e[11]!==r||e[12]!==n?(h=d=>{const b=Ks(d.started_at,d.finished_at),j=$i(d),_=n===d.id;return s.jsxs("button",{type:"button",onClick:()=>r(d.id),className:ne("w-full text-left rounded-lg border p-3 transition-colors",_?"border-primary bg-primary/5":"border-border hover:bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(d.created_at).toLocaleString()})}),s.jsx(G,{className:ne("capitalize",Qs(d.status)),children:d.status})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs flex-wrap",children:[s.jsxs("span",{className:"text-muted-foreground",children:[d.tested_items,"/",d.total_items," tested"]}),s.jsxs("span",{className:"text-emerald-600 font-medium",children:[d.passed_items," passed"]}),d.failed_items>0&&s.jsxs("span",{className:"text-red-600 font-medium",children:[d.failed_items," failed"]}),d.skipped_items>0&&s.jsxs("span",{className:"text-muted-foreground",children:[d.skipped_items," skipped"]}),s.jsxs("span",{className:"text-muted-foreground",children:["pass rate: ",j]}),b&&s.jsx("span",{className:"text-muted-foreground",children:b})]}),d.config_snapshot&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[s.jsx(G,{variant:"outline",className:"text-[9px]",children:(d.config_snapshot.monitorMode??d.config_snapshot.testMode??"health_check").replace("_"," ")}),d.config_snapshot.onFailure!=="none"&&s.jsxs(G,{variant:"outline",className:"text-[9px] text-red-600",children:["on fail:"," ",d.config_snapshot.onFailure.replace(/_/g," ")]})]})]},d.id)},e[11]=r,e[12]=n,e[13]=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=s.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]!==c||e[18]!==x?(p=s.jsx(me,{className:"p-4",children:s.jsxs("div",{className:"space-y-3",children:[c,x]})}),e[17]=c,e[18]=x,e[19]=p):p=e[19],p}function Li(){const t=X.c(20),[e,n]=T.useState(void 0),[r,o]=T.useState("tests"),a=ss(e).data?.run?.status,i=Mt(e,void 0,a);let c;t[0]!==i.data?.items?(c=i.data?.items??[],t[0]=i.data?.items,t[1]=c):c=t[1];let m;t[2]!==c?(m=c.filter(zi),t[2]=c,t[3]=m):m=t[3];const u=m;let x;t[4]===Symbol.for("react.memo_cache_sentinel")?(x=[{id:"tests",label:"Tests"},{id:"configuration",label:"Configuration"},{id:"connections",label:"Connections"}],t[4]=x):x=t[4];let p;t[5]!==r?(p=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:x.map(_=>{const k=r===_.id;return s.jsx("button",{type:"button",className:ne("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",k?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>o(_.id),children:s.jsx("span",{children:_.label})},_.id)})}),t[5]=r,t[6]=p):p=t[6];let h;t[7]!==e||t[8]!==r||t[9]!==u?(h=r==="tests"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ci,{activeRunId:e,onRunChange:n}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4 items-start",children:[s.jsxs("div",{className:"xl:col-span-8 space-y-6 min-w-0",children:[e&&s.jsx(Ei,{runId:e}),s.jsx(Ai,{selectedRunId:e,onSelectRun:n})]}),s.jsxs("div",{className:"xl:col-span-4 space-y-2 min-w-0",children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["Broken MCPs"," ",u.length>0&&s.jsx(G,{variant:"destructive",className:"text-[10px] ml-1",children:u.length})]}),s.jsx(Hr,{results:u})]})]})]}),t[7]=e,t[8]=r,t[9]=u,t[10]=h):h=t[10];let d;t[11]!==r?(d=r==="configuration"&&s.jsx(ai,{}),t[11]=r,t[12]=d):d=t[12];let b;t[13]!==r?(b=r==="connections"&&s.jsx(mi,{}),t[13]=r,t[14]=b):b=t[14];let j;return t[15]!==p||t[16]!==h||t[17]!==d||t[18]!==b?(j=s.jsxs("div",{className:"h-full overflow-auto px-4 md:px-6 py-4 space-y-6",children:[p,h,d,b]}),t[15]=p,t[16]=h,t[17]=d,t[18]=b,t[19]=j):j=t[19],j}function zi(t){return t.status==="failed"||t.status==="error"}function Oi(t){const e=X.c(9),{activeTab:n,onChange:r,items:o}=t;let l;if(e[0]!==n||e[1]!==o||e[2]!==r){let i;e[4]!==n||e[5]!==r?(i=c=>{const m=n===c.tab,u=c.icon;return s.jsxs("button",{type:"button",className:ne("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center whitespace-nowrap",m?"bg-accent border-border text-foreground":"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),onClick:()=>r(c.tab),children:[s.jsx(u,{size:14}),s.jsx("span",{children:c.label}),typeof c.count=="number"&&c.count>0&&s.jsx("span",{className:"min-w-4 h-4 px-1 inline-flex items-center justify-center rounded-full bg-primary/15 text-[10px] font-semibold",children:c.count})]},c.id)},e[4]=n,e[5]=r,e[6]=i):i=e[6],l=o.map(i),e[0]=n,e[1]=o,e[2]=r,e[3]=l}else l=e[3];let a;return e[7]!==l?(a=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:l}),e[7]=l,e[8]=a):a=e[8],a}function ql(){const t=X.c(55),[e,n]=T.useState("items"),[r,o]=T.useState(null),{registryName:l,registryIcon:a,registryLLMConnectionId:i,registryLLMModelId:c,acceptPublishRequests:m,requireApiToken:u,storePrivateOnly:x,rateLimitEnabled:p,rateLimitWindow:h,rateLimitMax:d}=Kt(tt),b=Xn(),j=Kn(),_=`${l}|${a}|${i}|${c}|${m}|${u}|${x}|${p}|${h}|${d}`;!m&&e==="requests"&&n("items");const k=b.data?.pending??0,y=j.brokenCount>0?j.brokenCount:void 0;let g;t[0]!==y?(g={id:"items",label:"Items",icon:dn,tab:"items",count:y},t[0]=y,t[1]=g):g=t[1];let I;t[2]!==m||t[3]!==k?(I=m?[{id:"requests",label:"Requests",icon:ft,tab:"requests",count:k}]:[],t[2]=m,t[3]=k,t[4]=I):I=t[4];let f,w;t[5]===Symbol.for("react.memo_cache_sentinel")?(f={id:"qa",label:"QA",icon:ts,tab:"qa"},w={id:"settings",label:"Settings",icon:mn,tab:"settings"},t[5]=f,t[6]=w):(f=t[5],w=t[6]);let S;t[7]!==g||t[8]!==I?(S=[g,...I,f,w],t[7]=g,t[8]=I,t[9]=S):S=t[9];const P=S;let N;t[10]===Symbol.for("react.memo_cache_sentinel")?(N=()=>n("settings"),t[10]=N):N=t[10];let R;t[11]!==a||t[12]!==l?(R=s.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:a?s.jsx("img",{src:a,alt:l,className:"h-full w-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:l.slice(0,1).toUpperCase()})}),t[11]=a,t[12]=l,t[13]=R):R=t[13];let v;t[14]!==l?(v=s.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:l}),t[14]=l,t[15]=v):v=t[15];let $;t[16]!==R||t[17]!==v?($=s.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:N,children:[R,v]}),t[16]=R,t[17]=v,t[18]=$):$=t[18];let D;t[19]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),t[19]=D):D=t[19];let M;t[20]!==e||t[21]!==P?(M=s.jsx(Oi,{activeTab:e,onChange:n,items:P}),t[20]=e,t[21]=P,t[22]=M):M=t[22];let E;t[23]!==M||t[24]!==$?(E=s.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[$,D,M]})}),t[23]=M,t[24]=$,t[25]=E):E=t[25];let A;t[26]!==e?(A=e==="items"&&s.jsx(Ar,{}),t[26]=e,t[27]=A):A=t[27];let q;t[28]!==m||t[29]!==e?(q=e==="requests"&&m&&s.jsx(Gr,{}),t[28]=m,t[29]=e,t[30]=q):q=t[30];let z;t[31]!==e?(z=e==="qa"&&s.jsx(Li,{}),t[31]=e,t[32]=z):z=t[32];let O;t[33]!==m||t[34]!==e||t[35]!==p||t[36]!==d||t[37]!==h||t[38]!==a||t[39]!==i||t[40]!==c||t[41]!==l||t[42]!==u||t[43]!==r||t[44]!==_||t[45]!==x?(O=e==="settings"&&s.jsx(Yr,{initialName:l,initialIcon:a,initialLLMConnectionId:i,initialLLMModelId:c,initialAcceptPublishRequests:m,initialRequireApiToken:u,initialStorePrivateOnly:x,initialRateLimitEnabled:p,initialRateLimitWindow:h,initialRateLimitMax:d,revealedKey:r,onRevealedKeyChange:o},_),t[33]=m,t[34]=e,t[35]=p,t[36]=d,t[37]=h,t[38]=a,t[39]=i,t[40]=c,t[41]=l,t[42]=u,t[43]=r,t[44]=_,t[45]=x,t[46]=O):O=t[46];let B;t[47]!==A||t[48]!==q||t[49]!==z||t[50]!==O?(B=s.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[A,q,z,O]}),t[47]=A,t[48]=q,t[49]=z,t[50]=O,t[51]=B):B=t[51];let Q;return t[52]!==E||t[53]!==B?(Q=s.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[E,B]}),t[52]=E,t[53]=B,t[54]=Q):Q=t[54],Q}export{ql as default};