@decocms/mesh 2.96.2 → 2.96.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/client/assets/{AlertCircle-4DBdKyiN.js → AlertCircle-B74h0Me5.js} +1 -1
  2. package/dist/client/assets/{AlertOctagon-CJ4814e4.js → AlertOctagon-ChhphFDk.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BbUXsmjT.js → ArrowLeft-ruL5WSCw.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Cf0ZCNqn.js → ArrowUp-BTMunjeO.js} +1 -1
  5. package/dist/client/assets/{Check-DVZrDl7E.js → Check-Dy1kSzwX.js} +1 -1
  6. package/dist/client/assets/{CheckCircle-CA3HsvdF.js → CheckCircle-BFGOeCKZ.js} +1 -1
  7. package/dist/client/assets/{CheckDone01-CDAeIQ63.js → CheckDone01-CIq1TziU.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-BrnUqul2.js → ChevronDown-CEjoikg0.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-lTpPQGwH.js → ChevronRight-CVpzq9SE.js} +1 -1
  10. package/dist/client/assets/{Clock-BpIUYvY9.js → Clock-BFqtZfyI.js} +1 -1
  11. package/dist/client/assets/{Code01-CgOGThgh.js → Code01-ztcPrUdW.js} +1 -1
  12. package/dist/client/assets/{Container-CMQiv6Ns.js → Container-D5gdKEFc.js} +1 -1
  13. package/dist/client/assets/{Copy01-CMA5_oKx.js → Copy01-eBFwMxtu.js} +1 -1
  14. package/dist/client/assets/{Dataflow03-CJHUSZDC.js → Dataflow03-By6KEPGS.js} +1 -1
  15. package/dist/client/assets/{DotsHorizontal-bihG3j6i.js → DotsHorizontal-BHB6MwwO.js} +1 -1
  16. package/dist/client/assets/{DotsVertical-XqPeTgM4.js → DotsVertical-DDpixXKv.js} +1 -1
  17. package/dist/client/assets/{Download01-COYP-wbM.js → Download01-B-vJTp2a.js} +1 -1
  18. package/dist/client/assets/{Edit01-CN-BVNm7.js → Edit01-DS8TXF8v.js} +1 -1
  19. package/dist/client/assets/{Eye-DBhpblAN.js → Eye-DFOdFQT-.js} +1 -1
  20. package/dist/client/assets/{File02-C2olsFnm.js → File02-CY_WqD-0.js} +1 -1
  21. package/dist/client/assets/{File06-CyuQ1kk7.js → File06-uox_o6En.js} +1 -1
  22. package/dist/client/assets/{FilterLines-DNMtf_47.js → FilterLines-DcDy1u8y.js} +1 -1
  23. package/dist/client/assets/{Globe01-S1shXduq.js → Globe01-W_ezcOw6.js} +1 -1
  24. package/dist/client/assets/{Grid01-BB6GzE_H.js → Grid01-pmpn_yyH.js} +1 -1
  25. package/dist/client/assets/{Home02-9-Cl82ip.js → Home02-BK4iA9ga.js} +1 -1
  26. package/dist/client/assets/{Image01-Bllq3U2e.js → Image01-CjBWTpk6.js} +1 -1
  27. package/dist/client/assets/{Inbox01-_QG6HIJd.js → Inbox01-1y9TGDAK.js} +1 -1
  28. package/dist/client/assets/{InfoCircle-BzKPKNIV.js → InfoCircle-B2WmuOEX.js} +1 -1
  29. package/dist/client/assets/{Key01-kq7PX1YS.js → Key01-DXWjoaTE.js} +1 -1
  30. package/dist/client/assets/{LinkExternal01-B7R1mSP2.js → LinkExternal01-CiZoO6oB.js} +1 -1
  31. package/dist/client/assets/{List-ByKRHbSO.js → List-Yy4oZaIm.js} +1 -1
  32. package/dist/client/assets/{Loading01-C30bDA9h.js → Loading01-BclS8iWV.js} +1 -1
  33. package/dist/client/assets/{Lock01-CMTkVFHx.js → Lock01-D8RoH81a.js} +1 -1
  34. package/dist/client/assets/{Pin01-DpTPW-9K.js → Pin01-DaSjWctK.js} +1 -1
  35. package/dist/client/assets/{Play-BweooOYS.js → Play-P0DrvK6F.js} +1 -1
  36. package/dist/client/assets/{Plus-q5YWe4us.js → Plus-C5LR6cck.js} +1 -1
  37. package/dist/client/assets/{RefreshCcw01-DRWlmqw5.js → RefreshCcw01-DxpF0pWy.js} +1 -1
  38. package/dist/client/assets/{RefreshCw01-Bb8t9XLS.js → RefreshCw01-Cvn_Sesf.js} +1 -1
  39. package/dist/client/assets/{Save01-DXWV5nj4.js → Save01-CAo15i_T.js} +1 -1
  40. package/dist/client/assets/{SearchMd-hERLZOdx.js → SearchMd-DhDCnDEk.js} +1 -1
  41. package/dist/client/assets/{Settings01-K_PXf5Q7.js → Settings01-Di__7g37.js} +1 -1
  42. package/dist/client/assets/{Settings02-ZV7r5q4D.js → Settings02-Cs4oKE9x.js} +1 -1
  43. package/dist/client/assets/{Share07-Dx2Rb32N.js → Share07-CNOl6few.js} +1 -1
  44. package/dist/client/assets/{Terminal-VY7qOx_i.js → Terminal-DhXZE8tI.js} +1 -1
  45. package/dist/client/assets/{Tool01-BP_mkdy3.js → Tool01-D6uiZqcI.js} +1 -1
  46. package/dist/client/assets/{Trash01-Dk9pv506.js → Trash01-fpfGO2En.js} +1 -1
  47. package/dist/client/assets/{Upload01-BokmTptz.js → Upload01-BK6OrHOB.js} +1 -1
  48. package/dist/client/assets/{Users03-C_ymlzx3.js → Users03-9Yj1Oct5.js} +1 -1
  49. package/dist/client/assets/{X-BofIsacr.js → X-D-vCW-FP.js} +1 -1
  50. package/dist/client/assets/{XClose-B9jvydA5.js → XClose-CwzH0SGu.js} +1 -1
  51. package/dist/client/assets/{agent-connections-preview-CcWJACAV.js → agent-connections-preview-Bm7_QMu6.js} +1 -1
  52. package/dist/client/assets/{agent-detail-BTNxaZph.js → agent-detail-C4sYOZn2.js} +1 -1
  53. package/dist/client/assets/{agents-isWhMnyk.js → agents-UG-TRZOf.js} +1 -1
  54. package/dist/client/assets/alert-dialog-C2eeNa17.js +7 -0
  55. package/dist/client/assets/{auth-catchall-BmUeke0B.js → auth-catchall-DsmRXLAK.js} +1 -1
  56. package/dist/client/assets/{avatar-DbtnoOEU.js → avatar-DVIfFxjv.js} +1 -1
  57. package/dist/client/assets/{badge-D_aixLlt.js → badge-Ce8oucop.js} +1 -1
  58. package/dist/client/assets/{binder-BeHB3-7Y.js → binder-B_Z7E1sw.js} +1 -1
  59. package/dist/client/assets/{breadcrumb-ClGbT9Pe.js → breadcrumb-DTOs2A-I.js} +1 -1
  60. package/dist/client/assets/{button-D-PerQqC.js → button-Cxd9D7GZ.js} +1 -1
  61. package/dist/client/assets/{card-ZafkYtyj.js → card-U5Qqs_wY.js} +1 -1
  62. package/dist/client/assets/{checkbox-DGTMQZYw.js → checkbox-QmtfqLqJ.js} +1 -1
  63. package/dist/client/assets/{circle-alert-B5MH-I2D.js → circle-alert-p06JWO6x.js} +1 -1
  64. package/dist/client/assets/{collection-detail-D7K7KZ3j.js → collection-detail-WxZ2NZBP.js} +1 -1
  65. package/dist/client/assets/{collection-search-CFO7XWxi.js → collection-search-BEKSlJnh.js} +1 -1
  66. package/dist/client/assets/{collection-tab-ZK9qGzbi.js → collection-tab-CXhYQfuQ.js} +1 -1
  67. package/dist/client/assets/{collection-table-wrapper-aEUpSjNT.js → collection-table-wrapper-Bq9YQNWy.js} +1 -1
  68. package/dist/client/assets/{collection-tabs-zYgpPtAl.js → collection-tabs-D6wgvS1J.js} +1 -1
  69. package/dist/client/assets/{command-riBVGEeS.js → command-17BNeKxr.js} +1 -1
  70. package/dist/client/assets/{connect-CxlD4pzc.js → connect-D6XC7UNZ.js} +1 -1
  71. package/dist/client/assets/{connection-card-DibEpgAJ.js → connection-card-CHDbSQUC.js} +1 -1
  72. package/dist/client/assets/{connection-detail-VawJXFkM.js → connection-detail-91YS9aaX.js} +1 -1
  73. package/dist/client/assets/{connections-rTehwMXP.js → connections-CH561e8o.js} +1 -1
  74. package/dist/client/assets/{constants-CH9byiKA.js → constants-7tHIXjuz.js} +1 -1
  75. package/dist/client/assets/constants-B1QaD4GY.js +1 -0
  76. package/dist/client/assets/{create-organization-dialog-DBHZfDPt.js → create-organization-dialog-BIJfN6rY.js} +1 -1
  77. package/dist/client/assets/{create-project-dialog-Yqgc0Gmy.js → create-project-dialog-W-9Wb58U.js} +1 -1
  78. package/dist/client/assets/{dialog-CFptoDdD.js → dialog-D36Sp9vM.js} +1 -1
  79. package/dist/client/assets/{dropdown-menu-C8QhWQVm.js → dropdown-menu-D1SDd-O9.js} +1 -1
  80. package/dist/client/assets/{dynamic-plugin-layout-DYwd3Z58.js → dynamic-plugin-layout-iqk4NK_8.js} +1 -1
  81. package/dist/client/assets/{empty-state-DyXzPX9E.js → empty-state-DmFtndPA.js} +1 -1
  82. package/dist/client/assets/{empty-state-DoBcZdM-.js → empty-state-x18Ct7Bg.js} +1 -1
  83. package/dist/client/assets/{env-vars-editor-DyPP_8RR.js → env-vars-editor-CxTFyVmJ.js} +1 -1
  84. package/dist/client/assets/{error-boundary-8guJh7VT.js → error-boundary-BuSNQDm9.js} +1 -1
  85. package/dist/client/assets/{extract-connection-data-DkrrvIEC.js → extract-connection-data-Bxl9-N57.js} +1 -1
  86. package/dist/client/assets/{file-browser-Fvr2IbiZ.js → file-browser-Ca7lIx_M.js} +2 -2
  87. package/dist/client/assets/{form-CtFhf1V_.js → form-C7gcuapm.js} +1 -1
  88. package/dist/client/assets/{grid-view-Ce3NoRpj.js → grid-view-CioJM2m4.js} +1 -1
  89. package/dist/client/assets/{home-BjMglPl-.js → home-CO_-lcJ6.js} +1 -1
  90. package/dist/client/assets/{index-D1S818JH.js → index-APqurMYH.js} +1 -1
  91. package/dist/client/assets/{index-B29giag9.js → index-B0lAKtRh.js} +2 -2
  92. package/dist/client/assets/{index-V777tuW4.js → index-C1cLa9Gd.js} +1 -1
  93. package/dist/client/assets/{index-CwR6GYR2.js → index-C4SaT72q.js} +1 -1
  94. package/dist/client/assets/{index-CrTEMTct.js → index-CuPKLB9d.js} +1 -1
  95. package/dist/client/assets/{index-BCTs9n6O.js → index-CypvbRZN.js} +1 -1
  96. package/dist/client/assets/{index-Bourcgd_.js → index-DCBC9Z8D.js} +1 -1
  97. package/dist/client/assets/{index-BlBYI35m.js → index-Da6ccH2V.js} +1 -1
  98. package/dist/client/assets/{index-D8tHe059.js → index-uvODQDQz.js} +1 -1
  99. package/dist/client/assets/{infiniteQueryObserver-Dzcc9UjY.js → infiniteQueryObserver-B5jHce9f.js} +1 -1
  100. package/dist/client/assets/{input-Cxci79To.js → input-BTRdl8wU.js} +1 -1
  101. package/dist/client/assets/{integration-icon-ByKWru2D.js → integration-icon-Qol0n8Yu.js} +1 -1
  102. package/dist/client/assets/{label-BN7IWnf6.js → label-B-xKop8p.js} +1 -1
  103. package/dist/client/assets/{layout-DUHhpHXf.js → layout-DQVjOYgA.js} +1 -1
  104. package/dist/client/assets/{localstorage-keys-CwGoMvvj.js → localstorage-keys-DE1N3_0b.js} +1 -1
  105. package/dist/client/assets/{login-Ty0R4DxW.js → login-CEoLgQ5J.js} +1 -1
  106. package/dist/client/assets/{mcp-oauth-ChVLA9f3.js → mcp-oauth-fVu6jtVi.js} +1 -1
  107. package/dist/client/assets/{mcp-server-card-DBYZ33HR.js → mcp-server-card-DUsbBMD4.js} +1 -1
  108. package/dist/client/assets/{mcp-server-detail-Du-GkpxI.js → mcp-server-detail-Dc_FNQcM.js} +2 -2
  109. package/dist/client/assets/{members-DsiwYbO8.js → members-6JeadSC6.js} +1 -1
  110. package/dist/client/assets/{monitoring-BlxCJU8J.js → monitoring-B6aMBTbK.js} +2 -2
  111. package/dist/client/assets/{monitoring-dashboard-edit-DSM3xa4Q.js → monitoring-dashboard-edit-D0LJi6WO.js} +1 -1
  112. package/dist/client/assets/{monitoring-dashboard-view-CJ1f1bB7.js → monitoring-dashboard-view-B9KgxuRn.js} +2 -2
  113. package/dist/client/assets/{oauth-callback-DmySymdW.js → oauth-callback-Bao0-Lp_.js} +1 -1
  114. package/dist/client/assets/{page-D0Sa9mFI.js → page-D3AoRnua.js} +1 -1
  115. package/dist/client/assets/{page-Tih4SWMI.js → page-tBi1gMVm.js} +1 -1
  116. package/dist/client/assets/{plugin-empty-state-D05hsZ5h.js → plugin-empty-state-DgG7XCmo.js} +1 -1
  117. package/dist/client/assets/{plugin-empty-state-hheYGSVX.js → plugin-empty-state-KJVP3Tbc.js} +1 -1
  118. package/dist/client/assets/{plugin-header-CE-bMrP6.js → plugin-header-CRttRDjI.js} +1 -1
  119. package/dist/client/assets/{plugin-header-CmN2-mKw.js → plugin-header-gmQgvWvo.js} +1 -1
  120. package/dist/client/assets/{popover-Bq8aZ27v.js → popover-CdY9eVBh.js} +1 -1
  121. package/dist/client/assets/{project-layout-ByRKYVau.js → project-layout-CIS1pzpd.js} +1 -1
  122. package/dist/client/assets/{project-settings-ByYa3pFP.js → project-settings-Dpll6cAV.js} +1 -1
  123. package/dist/client/assets/{projects-list-CDpKF2Ed.js → projects-list-D8CKizs8.js} +1 -1
  124. package/dist/client/assets/{registry-layout-CfGazoo8.js → registry-layout-DV5n9jEh.js} +3 -3
  125. package/dist/client/assets/{registry-utils-6Y4tQn0C.js → registry-utils-icgkdXTH.js} +1 -1
  126. package/dist/client/assets/{resizable-DfSFqzWY.js → resizable-CQB3xYuP.js} +1 -1
  127. package/dist/client/assets/{save-actions-htT4YoqX.js → save-actions-BCWYpxCn.js} +1 -1
  128. package/dist/client/assets/{scroll-area-BJ5bePQ1.js → scroll-area-B6cIs4dW.js} +1 -1
  129. package/dist/client/assets/{select-D6oaQfJS.js → select-vvkW2wBk.js} +1 -1
  130. package/dist/client/assets/{shell-layout-GR3VdFoR.js → shell-layout-Do1GEQEt.js} +3 -3
  131. package/dist/client/assets/{spinner-BstVffOp.js → spinner-BsQXvc2Y.js} +1 -1
  132. package/dist/client/assets/{store-invite-C4VxiywO.js → store-invite-CfCVsnuu.js} +1 -1
  133. package/dist/client/assets/{switch-Bi5F4S-5.js → switch-BezvOOLk.js} +1 -1
  134. package/dist/client/assets/{table-C576YCZw.js → table-Bhjp6CI9.js} +1 -1
  135. package/dist/client/assets/{tasks-BDnJjeaX.js → tasks-DGTypMJH.js} +1 -1
  136. package/dist/client/assets/{textarea-DhETf1og.js → textarea-D0RfPnUt.js} +1 -1
  137. package/dist/client/assets/{time-range-picker-CG48KHqL.js → time-range-picker-BTAPhqft.js} +1 -1
  138. package/dist/client/assets/{toggle-group-BdU9v1nm.js → toggle-group-CTeIuV4q.js} +1 -1
  139. package/dist/client/assets/{tools-list-DhfY_SNs.js → tools-list-K8xKTQ3C.js} +1 -1
  140. package/dist/client/assets/{tooltip-D-FT-fCa.js → tooltip-DkOvFQ7D.js} +1 -1
  141. package/dist/client/assets/{topbar-portal-IUe4pf8g.js → topbar-portal-B2pXZeiz.js} +1 -1
  142. package/dist/client/assets/{typewriter-title-cc0Pz_LM.js → typewriter-title-fOoA67kV.js} +1 -1
  143. package/dist/client/assets/{use-binding-B7W2mOcc.js → use-binding-Dvp-m6Vz.js} +1 -1
  144. package/dist/client/assets/{use-connection-DrWeJHXu.js → use-connection-t2lORAui.js} +1 -1
  145. package/dist/client/assets/{use-copy-BNoj9l5V.js → use-copy-tAcjwV9Y.js} +1 -1
  146. package/dist/client/assets/{use-create-virtual-mcp-DhPfPD_b.js → use-create-virtual-mcp-BUseoHRu.js} +1 -1
  147. package/dist/client/assets/{use-deco-chat-open-B0b2QgDS.js → use-deco-chat-open-BVQclAcG.js} +5 -5
  148. package/dist/client/assets/{use-install-from-registry-BMfOY5TA.js → use-install-from-registry-BcVvP9yq.js} +1 -1
  149. package/dist/client/assets/{use-list-state-qDaPNHfK.js → use-list-state-Lbcc4L0H.js} +1 -1
  150. package/dist/client/assets/{use-llm-DjYTM2HW.js → use-llm-CJX1SR85.js} +1 -1
  151. package/dist/client/assets/{use-mcp-prompts-BMZQCyj7.js → use-mcp-prompts-BjSsl1qM.js} +1 -1
  152. package/dist/client/assets/{use-mcp-tools-CdAhr98j.js → use-mcp-tools-BPlzUo29.js} +1 -1
  153. package/dist/client/assets/{use-mobile-DcwTOp-X.js → use-mobile-BKPcRCzM.js} +1 -1
  154. package/dist/client/assets/{use-organization-settings-6xOluKFM.js → use-organization-settings-CUcA5y45.js} +1 -1
  155. package/dist/client/assets/{use-project-DY_ihdkL.js → use-project-BTuyMFkB.js} +1 -1
  156. package/dist/client/assets/{use-view-mode-CY4TLkHz.js → use-view-mode-CDTkXCJs.js} +1 -1
  157. package/dist/client/assets/{use-virtual-mcp-IiP1g_wm.js → use-virtual-mcp-BPuNbW-j.js} +1 -1
  158. package/dist/client/assets/useInfiniteQuery-Cb7WWrkC.js +1 -0
  159. package/dist/client/assets/{useMutation-WNJB1RXH.js → useMutation-DTtaBOsy.js} +1 -1
  160. package/dist/client/assets/useQuery-Cx1KUbzW.js +1 -0
  161. package/dist/client/assets/useSuspenseInfiniteQuery-CeqWcmOh.js +1 -0
  162. package/dist/client/assets/{view-mode-toggle-CRrDEnZy.js → view-mode-toggle-CPbxqbKZ.js} +1 -1
  163. package/dist/client/assets/{workflow-CD5ePGpY.js → workflow-BOVimVc9.js} +1 -1
  164. package/dist/client/index.html +1 -1
  165. package/package.json +1 -1
  166. package/dist/client/assets/alert-dialog-Cl76sYVz.js +0 -7
  167. package/dist/client/assets/constants-kLsxGUtY.js +0 -1
  168. package/dist/client/assets/useInfiniteQuery-eF9xXIkq.js +0 -1
  169. package/dist/client/assets/useQuery-BO0TdkAU.js +0 -1
  170. package/dist/client/assets/useSuspenseInfiniteQuery-DfH90Jor.js +0 -1
@@ -1,5 +1,5 @@
1
- import{r as v,c as he,u as _e,z as Rt,j as s,t as ne,bA as At}from"./index-B29giag9.js";import{B as $,c as Pe}from"./button-D-PerQqC.js";import{i as pt}from"./CheckCircle-CA3HsvdF.js";import{n as qs}from"./Container-CMQiv6Ns.js";import{t as Bs}from"./Settings01-K_PXf5Q7.js";import{u as gt}from"./useQuery-BO0TdkAU.js";import{u as Qe}from"./useMutation-WNJB1RXH.js";import{u as Gs}from"./useInfiniteQuery-eF9xXIkq.js";import{a as Ae,u as ze,j as Ks}from"./constants-CH9byiKA.js";import{B as Z}from"./badge-D_aixLlt.js";import{I as Se}from"./input-Cxci79To.js";import{a as Pt,c as dt,D as Lt,b as zt,h as Zt,i as Jt,g as Vs}from"./dropdown-menu-C8QhWQVm.js";import{e as as,a as os,b as vt,T as Ee,d as cs,c as De}from"./table-C576YCZw.js";import{a as Xt,T as Qs}from"./toggle-group-BdU9v1nm.js";import{u as Ys}from"./use-view-mode-CY4TLkHz.js";import{i as ds}from"./DotsVertical-XqPeTgM4.js";import{i as Hs}from"./FilterLines-DNMtf_47.js";import{i as ms}from"./Globe01-S1shXduq.js";import{i as nt}from"./Loading01-C30bDA9h.js";import{i as us}from"./SearchMd-hERLZOdx.js";import{b as yt,c as bt,d as Nt,e as wt,a as Ct,D as St}from"./dialog-CFptoDdD.js";import{i as xt}from"./AlertCircle-4DBdKyiN.js";import{n as Ws}from"./Download01-COYP-wbM.js";import{i as es}from"./Upload01-BokmTptz.js";import{c as $t,b as Ft,d as Ot,A as qt,g as Bt,e as Gt,a as Kt,f as Vt}from"./alert-dialog-Cl76sYVz.js";import{C as it}from"./card-ZafkYtyj.js";import{s as ft}from"./Trash01-Dk9pv506.js";import{L as me}from"./label-BN7IWnf6.js";import{n as Zs,S as xs,a as hs,b as ps,c as gs,d as jt}from"./select-D6oaQfJS.js";import{S as Ut}from"./switch-Bi5F4S-5.js";import{T as Mt}from"./textarea-DhETf1og.js";import{i as Js}from"./ArrowLeft-BbUXsmjT.js";import{i as Xs,a as er,u as _t}from"./use-copy-BNoj9l5V.js";import{s as Qt}from"./RefreshCcw01-DRWlmqw5.js";import{i as tr}from"./X-BofIsacr.js";import{t as fs}from"./ChevronDown-BrnUqul2.js";import{s as js}from"./Eye-DBhpblAN.js";import{n as sr}from"./LinkExternal01-B7R1mSP2.js";import{h as rr,e as ir}from"./use-connection-DrWeJHXu.js";import{b as nr,P as lr,a as ar}from"./popover-Bq8aZ27v.js";import{i as Tt}from"./Check-DVZrDl7E.js";import{a as Et}from"./Copy01-CMA5_oKx.js";import{i as or,a as cr}from"./Save01-DXWV5nj4.js";import{i as dr}from"./Key01-kq7PX1YS.js";import{s as mr}from"./Plus-q5YWe4us.js";import"./infiniteQueryObserver-Dzcc9UjY.js";import"./ChevronRight-lTpPQGwH.js";import"./use-mobile-DcwTOp-X.js";import"./index-V777tuW4.js";const vs=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.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"}));vs.displayName="EyeOff";const ys=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.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"}));ys.displayName="ImagePlus";const bs=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));bs.displayName="Link01";const Ns=({size:t=24,color:e="currentColor",...r})=>v.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},v.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"}));Ns.displayName="Tool02";const de={all:["private-registry"],items:()=>[...de.all,"items"],itemsList:(t,e,r,i)=>[...de.items(),"list",{search:t,tags:e,categories:r,limit:i}],item:t=>[...de.items(),"item",t],filters:()=>[...de.all,"filters"],registryConfig:()=>[...de.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...de.registryConfig(),t,e],publishRequests:()=>[...de.all,"publish-requests"],publishRequestsList:t=>[...de.publishRequests(),"list",{status:t??"all"}],publishRequestsCount:()=>[...de.publishRequests(),"count"],publishApiKeys:()=>[...de.all,"publish-api-keys"]},ur=24;function xr(t){return t.trim()}async function Ne(t,e,r){const i=await t.callTool({name:e,arguments:r});if(!i||typeof i!="object")throw new Error(`Invalid tool response for ${e}`);if(i.isError){const a=i.content?.find(n=>n.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(a)}return i.structuredContent??i}function ws(t){const e=he.c(19),{org:r}=_e();let i;e[0]!==r.id?(i={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=i):i=e[1];const a=ze(i);let n,c,o,l;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(c=xr(t.search),n=t.limit??ur,l=Gs,o=de.itemsList(c,t.tags,t.categories,n),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=n,e[7]=c,e[8]=o,e[9]=l):(n=e[6],c=e[7],o=e[8],l=e[9]);let m;e[10]!==a||e[11]!==n||e[12]!==t.categories||e[13]!==t.tags||e[14]!==c?(m=async p=>{const{pageParam:g}=p,x=c.length>0?{operator:"or",conditions:[{field:["title"],operator:"contains",value:c},{field:["description"],operator:"contains",value:c},{field:["id"],operator:"contains",value:c},{field:["server","name"],operator:"contains",value:c}]}:void 0;return Ne(a,"COLLECTION_REGISTRY_APP_LIST",{cursor:g,limit:n,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:x})},e[10]=a,e[11]=n,e[12]=t.categories,e[13]=t.tags,e[14]=c,e[15]=m):m=e[15];let u;return e[16]!==o||e[17]!==m?(u={queryKey:o,queryFn:m,initialPageParam:void 0,getNextPageParam:hr,staleTime:3e4},e[16]=o,e[17]=m,e[18]=u):u=e[18],l(u)}function hr(t){return t.nextCursor}function pr(){const t=he.c(8),{org:e}=_e();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.filters(),t[2]=a):a=t[2];let n;t[3]!==i?(n=async()=>Ne(i,"COLLECTION_REGISTRY_APP_FILTERS",{}),t[3]=i,t[4]=n):n=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c={tags:[],categories:[]},t[5]=c):c=t[5];let o;return t[6]!==n?(o={queryKey:a,queryFn:n,placeholderData:c,staleTime:6e4},t[6]=n,t[7]=o):o=t[7],gt(o)}function Cs(){const t=he.c(29),e=Rt(),{org:r}=_e();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==e?(n=async()=>{await Promise.all([e.invalidateQueries({queryKey:de.items()}),e.invalidateQueries({queryKey:de.filters()})])},t[2]=e,t[3]=n):n=t[3];const c=n;let o;t[4]!==a?(o=async y=>(await Ne(a,"COLLECTION_REGISTRY_APP_CREATE",{data:y})).item,t[4]=a,t[5]=o):o=t[5];let l;t[6]!==c||t[7]!==o?(l={mutationFn:o,onSuccess:c},t[6]=c,t[7]=o,t[8]=l):l=t[8];const m=Qe(l);let u;t[9]!==a?(u=async y=>{const{id:I,data:d}=y;return(await Ne(a,"COLLECTION_REGISTRY_APP_UPDATE",{id:I,data:d})).item},t[9]=a,t[10]=u):u=t[10];let p;t[11]!==c||t[12]!==u?(p={mutationFn:u,onSuccess:c},t[11]=c,t[12]=u,t[13]=p):p=t[13];const g=Qe(p);let x;t[14]!==a?(x=async y=>(await Ne(a,"COLLECTION_REGISTRY_APP_DELETE",{id:y})).item,t[14]=a,t[15]=x):x=t[15];let h;t[16]!==c||t[17]!==x?(h={mutationFn:x,onSuccess:c},t[16]=c,t[17]=x,t[18]=h):h=t[18];const w=Qe(h);let j;t[19]!==a?(j=async y=>Ne(a,"COLLECTION_REGISTRY_APP_BULK_CREATE",{items:y}),t[19]=a,t[20]=j):j=t[20];let E;t[21]!==c||t[22]!==j?(E={mutationFn:j,onSuccess:c},t[21]=c,t[22]=j,t[23]=E):E=t[23];const D=Qe(E);let N;return t[24]!==D||t[25]!==m||t[26]!==w||t[27]!==g?(N={createMutation:m,updateMutation:g,deleteMutation:w,bulkCreateMutation:D},t[24]=D,t[25]=m,t[26]=w,t[27]=g,t[28]=N):N=t[28],N}function Yt(t){const e=he.c(33),{org:r,project:i}=_e();let a;e[0]!==r.id?(a={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=a):a=e[1];const n=ze(a),c=Rt();let o;e[2]!==t||e[3]!==i.id?(o=de.registryConfigByPlugin(i.id??"",t),e[2]=t,e[3]=i.id,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==t||e[7]!==i.id?(l=async()=>Ne(n,"PROJECT_PLUGIN_CONFIG_GET",{projectId:i.id,pluginId:t}),e[5]=n,e[6]=t,e[7]=i.id,e[8]=l):l=e[8];const m=!!i.id;let u;e[9]!==o||e[10]!==l||e[11]!==m?(u={queryKey:o,queryFn:l,enabled:m,staleTime:6e4},e[9]=o,e[10]=l,e[11]=m,e[12]=u):u=e[12];const p=gt(u);let g;e[13]!==n||e[14]!==t||e[15]!==i.id?(g=async C=>{const P=(await Ne(n,"PROJECT_PLUGIN_CONFIG_GET",{projectId:i.id,pluginId:t}))?.config?.settings??{};return Ne(n,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:i.id,pluginId:t,settings:{...P,...C}})},e[13]=n,e[14]=t,e[15]=i.id,e[16]=g):g=e[16];let x;e[17]!==t||e[18]!==i.id||e[19]!==c?(x=async()=>{await c.invalidateQueries({queryKey:de.registryConfigByPlugin(i.id??"",t)})},e[17]=t,e[18]=i.id,e[19]=c,e[20]=x):x=e[20];let h;e[21]!==g||e[22]!==x?(h={mutationFn:g,onSuccess:x},e[21]=g,e[22]=x,e[23]=h):h=e[23];const w=Qe(h),j=p.data?.config?.settings?.registryName??"Private Registry",E=p.data?.config?.settings?.registryIcon??"",D=p.data?.config?.settings?.llmConnectionId??"",N=p.data?.config?.settings?.llmModelId??"",y=p.data?.config?.settings?.acceptPublishRequests??!1,I=p.data?.config?.settings?.requireApiToken??!1;let d;return e[24]!==y||e[25]!==p.isLoading||e[26]!==E||e[27]!==D||e[28]!==N||e[29]!==j||e[30]!==I||e[31]!==w?(d={registryName:j,registryIcon:E,registryLLMConnectionId:D,registryLLMModelId:N,acceptPublishRequests:y,requireApiToken:I,isLoadingConfig:p.isLoading,saveRegistryConfigMutation:w},e[24]=y,e[25]=p.isLoading,e[26]=E,e[27]=D,e[28]=N,e[29]=j,e[30]=I,e[31]=w,e[32]=d):d=e[32],d}function gr(t){const e=he.c(10),{org:r}=_e();let i;e[0]!==r.id?(i={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=i):i=e[1];const a=ze(i);let n;e[2]!==t?(n=de.publishRequestsList(t),e[2]=t,e[3]=n):n=e[3];let c;e[4]!==a||e[5]!==t?(c=async()=>Ne(a,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t}),e[4]=a,e[5]=t,e[6]=c):c=e[6];let o;return e[7]!==n||e[8]!==c?(o={queryKey:n,queryFn:c,staleTime:3e4},e[7]=n,e[8]=c,e[9]=o):o=e[9],gt(o)}function fr(){const t=he.c(5),{org:e}=_e();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.publishRequestsCount(),t[2]=a):a=t[2];let n;return t[3]!==i?(n={queryKey:a,queryFn:async()=>Ne(i,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),staleTime:3e4},t[3]=i,t[4]=n):n=t[4],gt(n)}function jr(){const t=he.c(17),e=Rt(),{org:r}=_e();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==e?(n=async()=>{await Promise.all([e.invalidateQueries({queryKey:de.publishRequests()})])},t[2]=e,t[3]=n):n=t[3];const c=n;let o;t[4]!==a?(o=async h=>Ne(a,"REGISTRY_PUBLISH_REQUEST_REVIEW",h),t[4]=a,t[5]=o):o=t[5];let l;t[6]!==c||t[7]!==o?(l={mutationFn:o,onSuccess:c},t[6]=c,t[7]=o,t[8]=l):l=t[8];const m=Qe(l);let u;t[9]!==a?(u=async h=>Ne(a,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:h}),t[9]=a,t[10]=u):u=t[10];let p;t[11]!==c||t[12]!==u?(p={mutationFn:u,onSuccess:c},t[11]=c,t[12]=u,t[13]=p):p=t[13];const g=Qe(p);let x;return t[14]!==g||t[15]!==m?(x={reviewMutation:m,deleteMutation:g},t[14]=g,t[15]=m,t[16]=x):x=t[16],x}function vr(){const t=he.c(5),{org:e}=_e();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.publishApiKeys(),t[2]=a):a=t[2];let n;return t[3]!==i?(n={queryKey:a,queryFn:async()=>Ne(i,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=i,t[4]=n):n=t[4],gt(n)}function yr(){const t=he.c(19),e=Rt(),{org:r}=_e();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==a?(n=async h=>Ne(a,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:h}),t[2]=a,t[3]=n):n=t[3];let c;t[4]!==e?(c=async()=>{await e.invalidateQueries({queryKey:de.publishApiKeys()})},t[4]=e,t[5]=c):c=t[5];let o;t[6]!==n||t[7]!==c?(o={mutationFn:n,onSuccess:c},t[6]=n,t[7]=c,t[8]=o):o=t[8];const l=Qe(o);let m;t[9]!==a?(m=async h=>Ne(a,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:h}),t[9]=a,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:de.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let p;t[13]!==m||t[14]!==u?(p={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=p):p=t[15];const g=Qe(p);let x;return t[16]!==l||t[17]!==g?(x={generateMutation:l,revokeMutation:g},t[16]=l,t[17]=g,t[18]=x):x=t[18],x}function ts(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function ss(t){const e=[];let r="",i=!1;for(let a=0;a<t.length;a+=1){const n=t[a],c=t[a+1];if(n==='"'){i&&c==='"'?(r+='"',a+=1):i=!i;continue}if(n===","&&!i){e.push(r.trim()),r="";continue}r+=n}return e.push(r.trim()),e}const br=["id","title"],Nr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function wr(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 r=ss(e[0]??""),i=new Map,a=[];r.forEach((m,u)=>{const p=m.toLowerCase().trim();p&&i.set(p,u)});for(const m of br)i.has(m)||a.push({line:1,message:`Missing required column: "${m}"`});for(const m of r){const u=m.toLowerCase().trim();u&&!Nr.includes(u)&&a.push({line:1,message:`Unknown column "${m}" will be ignored`})}if(!i.has("id")||!i.has("title"))return{items:[],warnings:a,skipped:0};const n=(m,u)=>{const p=i.get(u);return typeof p=="number"?m[p]??"":""},c=[],o=new Set;let l=0;for(let m=1;m<e.length;m+=1){const u=ss(e[m]??""),p=n(u,"id").trim(),g=n(u,"title").trim();if(!p){a.push({line:m+1,message:"Missing id — row skipped"}),l+=1;continue}if(!g){a.push({line:m+1,message:`Missing title for id="${p}" — row skipped`}),l+=1;continue}if(o.has(p)){a.push({line:m+1,message:`Duplicate id="${p}" — row skipped`}),l+=1;continue}o.add(p);const x=n(u,"description").trim(),h=n(u,"remote_url").trim(),j=n(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",E=ts(n(u,"tags")),D=ts(n(u,"categories")),N=n(u,"is_public").trim().toLowerCase(),y=N==="true"||N==="1"||N==="yes";c.push({id:p,title:g,description:x||null,is_public:y,_meta:{"mcp.mesh":{...E.length>0?{tags:E}:{},...D.length>0?{categories:D}:{}}},server:{name:p,title:g,description:x||void 0,remotes:h?[{type:j,url:h}]:[]}})}return{items:c,warnings:a,skipped:l}}const Cr=`id,title,description,remote_url,remote_type,tags,categories,is_public
1
+ import{r as y,c as he,u as Te,z as Rt,j as s,t as ne,bz as At}from"./index-B0lAKtRh.js";import{B as $,c as _e}from"./button-Cxd9D7GZ.js";import{i as pt}from"./CheckCircle-BFGOeCKZ.js";import{n as qs}from"./Container-D5gdKEFc.js";import{t as Bs}from"./Settings01-Di__7g37.js";import{u as gt}from"./useQuery-Cx1KUbzW.js";import{u as Qe}from"./useMutation-DTtaBOsy.js";import{u as Gs}from"./useInfiniteQuery-Cb7WWrkC.js";import{a as Ae,u as ze,j as Ks}from"./constants-7tHIXjuz.js";import{B as Z}from"./badge-Ce8oucop.js";import{I as Se}from"./input-BTRdl8wU.js";import{a as Pt,c as dt,D as Lt,b as zt,h as Zt,i as Jt,g as Vs}from"./dropdown-menu-D1SDd-O9.js";import{e as as,a as os,b as vt,T as De,d as cs,c as Pe}from"./table-Bhjp6CI9.js";import{a as Xt,T as Qs}from"./toggle-group-CTeIuV4q.js";import{u as Ys}from"./use-view-mode-CDTkXCJs.js";import{i as ds}from"./DotsVertical-DDpixXKv.js";import{i as Hs}from"./FilterLines-DcDy1u8y.js";import{i as ms}from"./Globe01-W_ezcOw6.js";import{i as nt}from"./Loading01-BclS8iWV.js";import{i as us}from"./SearchMd-DhDCnDEk.js";import{b as yt,c as bt,d as Nt,e as wt,a as Ct,D as St}from"./dialog-D36Sp9vM.js";import{i as xt}from"./AlertCircle-B74h0Me5.js";import{n as Ws}from"./Download01-B-vJTp2a.js";import{i as es}from"./Upload01-BK6OrHOB.js";import{c as $t,b as Ft,d as Ot,A as qt,g as Bt,e as Gt,a as Kt,f as Vt}from"./alert-dialog-C2eeNa17.js";import{C as it}from"./card-U5Qqs_wY.js";import{s as ft}from"./Trash01-fpfGO2En.js";import{L as me}from"./label-B-xKop8p.js";import{n as Zs,S as xs,a as hs,b as ps,c as gs,d as jt}from"./select-vvkW2wBk.js";import{S as Ut}from"./switch-BezvOOLk.js";import{T as Mt}from"./textarea-D0RfPnUt.js";import{i as Js}from"./ArrowLeft-ruL5WSCw.js";import{i as Xs,a as er,u as _t}from"./use-copy-tAcjwV9Y.js";import{s as Qt}from"./RefreshCcw01-DxpF0pWy.js";import{i as tr}from"./X-D-vCW-FP.js";import{t as fs}from"./ChevronDown-CEjoikg0.js";import{s as js}from"./Eye-DFOdFQT-.js";import{n as sr}from"./LinkExternal01-CiZoO6oB.js";import{h as rr,e as ir}from"./use-connection-t2lORAui.js";import{b as nr,P as lr,a as ar}from"./popover-CdY9eVBh.js";import{i as Tt}from"./Check-Dy1kSzwX.js";import{a as Et}from"./Copy01-eBFwMxtu.js";import{i as or,a as cr}from"./Save01-CAo15i_T.js";import{i as dr}from"./Key01-DXWjoaTE.js";import{s as mr}from"./Plus-C5LR6cck.js";import"./infiniteQueryObserver-B5jHce9f.js";import"./ChevronRight-CVpzq9SE.js";import"./use-mobile-BKPcRCzM.js";import"./index-C1cLa9Gd.js";const vs=({size:t=24,color:e="currentColor",...r})=>y.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},y.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"}));vs.displayName="EyeOff";const ys=({size:t=24,color:e="currentColor",...r})=>y.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},y.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"}));ys.displayName="ImagePlus";const bs=({size:t=24,color:e="currentColor",...r})=>y.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},y.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));bs.displayName="Link01";const Ns=({size:t=24,color:e="currentColor",...r})=>y.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},y.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"}));Ns.displayName="Tool02";const de={all:["private-registry"],items:()=>[...de.all,"items"],itemsList:(t,e,r,i)=>[...de.items(),"list",{search:t,tags:e,categories:r,limit:i}],item:t=>[...de.items(),"item",t],filters:()=>[...de.all,"filters"],registryConfig:()=>[...de.all,"registry-config"],registryConfigByPlugin:(t,e)=>[...de.registryConfig(),t,e],publishRequests:()=>[...de.all,"publish-requests"],publishRequestsList:t=>[...de.publishRequests(),"list",{status:t??"all"}],publishRequestsCount:()=>[...de.publishRequests(),"count"],publishApiKeys:()=>[...de.all,"publish-api-keys"]},ur=24;function xr(t){return t.trim()}async function Ne(t,e,r){const i=await t.callTool({name:e,arguments:r});if(!i||typeof i!="object")throw new Error(`Invalid tool response for ${e}`);if(i.isError){const a=i.content?.find(n=>n.type==="text")?.text??`Tool ${e} returned an error`;throw new Error(a)}return i.structuredContent??i}function ws(t){const e=he.c(19),{org:r}=Te();let i;e[0]!==r.id?(i={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=i):i=e[1];const a=ze(i);let n,c,o,l;e[2]!==t.categories||e[3]!==t.limit||e[4]!==t.search||e[5]!==t.tags?(c=xr(t.search),n=t.limit??ur,l=Gs,o=de.itemsList(c,t.tags,t.categories,n),e[2]=t.categories,e[3]=t.limit,e[4]=t.search,e[5]=t.tags,e[6]=n,e[7]=c,e[8]=o,e[9]=l):(n=e[6],c=e[7],o=e[8],l=e[9]);let m;e[10]!==a||e[11]!==n||e[12]!==t.categories||e[13]!==t.tags||e[14]!==c?(m=async p=>{const{pageParam:g}=p,x=c.length>0?{operator:"or",conditions:[{field:["title"],operator:"contains",value:c},{field:["description"],operator:"contains",value:c},{field:["id"],operator:"contains",value:c},{field:["server","name"],operator:"contains",value:c}]}:void 0;return Ne(a,"COLLECTION_REGISTRY_APP_LIST",{cursor:g,limit:n,tags:t.tags.length?t.tags:void 0,categories:t.categories.length?t.categories:void 0,where:x})},e[10]=a,e[11]=n,e[12]=t.categories,e[13]=t.tags,e[14]=c,e[15]=m):m=e[15];let u;return e[16]!==o||e[17]!==m?(u={queryKey:o,queryFn:m,initialPageParam:void 0,getNextPageParam:hr,staleTime:3e4},e[16]=o,e[17]=m,e[18]=u):u=e[18],l(u)}function hr(t){return t.nextCursor}function pr(){const t=he.c(8),{org:e}=Te();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.filters(),t[2]=a):a=t[2];let n;t[3]!==i?(n=async()=>Ne(i,"COLLECTION_REGISTRY_APP_FILTERS",{}),t[3]=i,t[4]=n):n=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c={tags:[],categories:[]},t[5]=c):c=t[5];let o;return t[6]!==n?(o={queryKey:a,queryFn:n,placeholderData:c,staleTime:6e4},t[6]=n,t[7]=o):o=t[7],gt(o)}function Cs(){const t=he.c(29),e=Rt(),{org:r}=Te();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==e?(n=async()=>{await Promise.all([e.invalidateQueries({queryKey:de.items()}),e.invalidateQueries({queryKey:de.filters()})])},t[2]=e,t[3]=n):n=t[3];const c=n;let o;t[4]!==a?(o=async v=>(await Ne(a,"COLLECTION_REGISTRY_APP_CREATE",{data:v})).item,t[4]=a,t[5]=o):o=t[5];let l;t[6]!==c||t[7]!==o?(l={mutationFn:o,onSuccess:c},t[6]=c,t[7]=o,t[8]=l):l=t[8];const m=Qe(l);let u;t[9]!==a?(u=async v=>{const{id:I,data:d}=v;return(await Ne(a,"COLLECTION_REGISTRY_APP_UPDATE",{id:I,data:d})).item},t[9]=a,t[10]=u):u=t[10];let p;t[11]!==c||t[12]!==u?(p={mutationFn:u,onSuccess:c},t[11]=c,t[12]=u,t[13]=p):p=t[13];const g=Qe(p);let x;t[14]!==a?(x=async v=>(await Ne(a,"COLLECTION_REGISTRY_APP_DELETE",{id:v})).item,t[14]=a,t[15]=x):x=t[15];let h;t[16]!==c||t[17]!==x?(h={mutationFn:x,onSuccess:c},t[16]=c,t[17]=x,t[18]=h):h=t[18];const w=Qe(h);let j;t[19]!==a?(j=async v=>Ne(a,"COLLECTION_REGISTRY_APP_BULK_CREATE",{items:v}),t[19]=a,t[20]=j):j=t[20];let E;t[21]!==c||t[22]!==j?(E={mutationFn:j,onSuccess:c},t[21]=c,t[22]=j,t[23]=E):E=t[23];const D=Qe(E);let N;return t[24]!==D||t[25]!==m||t[26]!==w||t[27]!==g?(N={createMutation:m,updateMutation:g,deleteMutation:w,bulkCreateMutation:D},t[24]=D,t[25]=m,t[26]=w,t[27]=g,t[28]=N):N=t[28],N}function Yt(t){const e=he.c(33),{org:r,project:i}=Te();let a;e[0]!==r.id?(a={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=a):a=e[1];const n=ze(a),c=Rt();let o;e[2]!==t||e[3]!==i.id?(o=de.registryConfigByPlugin(i.id??"",t),e[2]=t,e[3]=i.id,e[4]=o):o=e[4];let l;e[5]!==n||e[6]!==t||e[7]!==i.id?(l=async()=>Ne(n,"PROJECT_PLUGIN_CONFIG_GET",{projectId:i.id,pluginId:t}),e[5]=n,e[6]=t,e[7]=i.id,e[8]=l):l=e[8];const m=!!i.id;let u;e[9]!==o||e[10]!==l||e[11]!==m?(u={queryKey:o,queryFn:l,enabled:m,staleTime:6e4},e[9]=o,e[10]=l,e[11]=m,e[12]=u):u=e[12];const p=gt(u);let g;e[13]!==n||e[14]!==t||e[15]!==i.id?(g=async C=>{const P=(await Ne(n,"PROJECT_PLUGIN_CONFIG_GET",{projectId:i.id,pluginId:t}))?.config?.settings??{};return Ne(n,"PROJECT_PLUGIN_CONFIG_UPDATE",{projectId:i.id,pluginId:t,settings:{...P,...C}})},e[13]=n,e[14]=t,e[15]=i.id,e[16]=g):g=e[16];let x;e[17]!==t||e[18]!==i.id||e[19]!==c?(x=async()=>{await c.invalidateQueries({queryKey:de.registryConfigByPlugin(i.id??"",t)})},e[17]=t,e[18]=i.id,e[19]=c,e[20]=x):x=e[20];let h;e[21]!==g||e[22]!==x?(h={mutationFn:g,onSuccess:x},e[21]=g,e[22]=x,e[23]=h):h=e[23];const w=Qe(h),j=p.data?.config?.settings?.registryName??"Private Registry",E=p.data?.config?.settings?.registryIcon??"",D=p.data?.config?.settings?.llmConnectionId??"",N=p.data?.config?.settings?.llmModelId??"",v=p.data?.config?.settings?.acceptPublishRequests??!1,I=p.data?.config?.settings?.requireApiToken??!1;let d;return e[24]!==v||e[25]!==p.isLoading||e[26]!==E||e[27]!==D||e[28]!==N||e[29]!==j||e[30]!==I||e[31]!==w?(d={registryName:j,registryIcon:E,registryLLMConnectionId:D,registryLLMModelId:N,acceptPublishRequests:v,requireApiToken:I,isLoadingConfig:p.isLoading,saveRegistryConfigMutation:w},e[24]=v,e[25]=p.isLoading,e[26]=E,e[27]=D,e[28]=N,e[29]=j,e[30]=I,e[31]=w,e[32]=d):d=e[32],d}function gr(t){const e=he.c(10),{org:r}=Te();let i;e[0]!==r.id?(i={connectionId:Ae,orgId:r.id},e[0]=r.id,e[1]=i):i=e[1];const a=ze(i);let n;e[2]!==t?(n=de.publishRequestsList(t),e[2]=t,e[3]=n):n=e[3];let c;e[4]!==a||e[5]!==t?(c=async()=>Ne(a,"REGISTRY_PUBLISH_REQUEST_LIST",{status:t}),e[4]=a,e[5]=t,e[6]=c):c=e[6];let o;return e[7]!==n||e[8]!==c?(o={queryKey:n,queryFn:c,staleTime:3e4},e[7]=n,e[8]=c,e[9]=o):o=e[9],gt(o)}function fr(){const t=he.c(5),{org:e}=Te();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.publishRequestsCount(),t[2]=a):a=t[2];let n;return t[3]!==i?(n={queryKey:a,queryFn:async()=>Ne(i,"REGISTRY_PUBLISH_REQUEST_COUNT",{}),staleTime:3e4},t[3]=i,t[4]=n):n=t[4],gt(n)}function jr(){const t=he.c(17),e=Rt(),{org:r}=Te();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==e?(n=async()=>{await Promise.all([e.invalidateQueries({queryKey:de.publishRequests()})])},t[2]=e,t[3]=n):n=t[3];const c=n;let o;t[4]!==a?(o=async h=>Ne(a,"REGISTRY_PUBLISH_REQUEST_REVIEW",h),t[4]=a,t[5]=o):o=t[5];let l;t[6]!==c||t[7]!==o?(l={mutationFn:o,onSuccess:c},t[6]=c,t[7]=o,t[8]=l):l=t[8];const m=Qe(l);let u;t[9]!==a?(u=async h=>Ne(a,"REGISTRY_PUBLISH_REQUEST_DELETE",{id:h}),t[9]=a,t[10]=u):u=t[10];let p;t[11]!==c||t[12]!==u?(p={mutationFn:u,onSuccess:c},t[11]=c,t[12]=u,t[13]=p):p=t[13];const g=Qe(p);let x;return t[14]!==g||t[15]!==m?(x={reviewMutation:m,deleteMutation:g},t[14]=g,t[15]=m,t[16]=x):x=t[16],x}function vr(){const t=he.c(5),{org:e}=Te();let r;t[0]!==e.id?(r={connectionId:Ae,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const i=ze(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=de.publishApiKeys(),t[2]=a):a=t[2];let n;return t[3]!==i?(n={queryKey:a,queryFn:async()=>Ne(i,"REGISTRY_PUBLISH_API_KEY_LIST",{}),staleTime:3e4},t[3]=i,t[4]=n):n=t[4],gt(n)}function yr(){const t=he.c(19),e=Rt(),{org:r}=Te();let i;t[0]!==r.id?(i={connectionId:Ae,orgId:r.id},t[0]=r.id,t[1]=i):i=t[1];const a=ze(i);let n;t[2]!==a?(n=async h=>Ne(a,"REGISTRY_PUBLISH_API_KEY_GENERATE",{name:h}),t[2]=a,t[3]=n):n=t[3];let c;t[4]!==e?(c=async()=>{await e.invalidateQueries({queryKey:de.publishApiKeys()})},t[4]=e,t[5]=c):c=t[5];let o;t[6]!==n||t[7]!==c?(o={mutationFn:n,onSuccess:c},t[6]=n,t[7]=c,t[8]=o):o=t[8];const l=Qe(o);let m;t[9]!==a?(m=async h=>Ne(a,"REGISTRY_PUBLISH_API_KEY_REVOKE",{keyId:h}),t[9]=a,t[10]=m):m=t[10];let u;t[11]!==e?(u=async()=>{await e.invalidateQueries({queryKey:de.publishApiKeys()})},t[11]=e,t[12]=u):u=t[12];let p;t[13]!==m||t[14]!==u?(p={mutationFn:m,onSuccess:u},t[13]=m,t[14]=u,t[15]=p):p=t[15];const g=Qe(p);let x;return t[16]!==l||t[17]!==g?(x={generateMutation:l,revokeMutation:g},t[16]=l,t[17]=g,t[18]=x):x=t[18],x}function ts(t){return t?t.split(/[;|]/).map(e=>e.trim()).filter(Boolean):[]}function ss(t){const e=[];let r="",i=!1;for(let a=0;a<t.length;a+=1){const n=t[a],c=t[a+1];if(n==='"'){i&&c==='"'?(r+='"',a+=1):i=!i;continue}if(n===","&&!i){e.push(r.trim()),r="";continue}r+=n}return e.push(r.trim()),e}const br=["id","title"],Nr=["id","title","description","remote_url","remote_type","tags","categories","is_public"];function wr(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 r=ss(e[0]??""),i=new Map,a=[];r.forEach((m,u)=>{const p=m.toLowerCase().trim();p&&i.set(p,u)});for(const m of br)i.has(m)||a.push({line:1,message:`Missing required column: "${m}"`});for(const m of r){const u=m.toLowerCase().trim();u&&!Nr.includes(u)&&a.push({line:1,message:`Unknown column "${m}" will be ignored`})}if(!i.has("id")||!i.has("title"))return{items:[],warnings:a,skipped:0};const n=(m,u)=>{const p=i.get(u);return typeof p=="number"?m[p]??"":""},c=[],o=new Set;let l=0;for(let m=1;m<e.length;m+=1){const u=ss(e[m]??""),p=n(u,"id").trim(),g=n(u,"title").trim();if(!p){a.push({line:m+1,message:"Missing id — row skipped"}),l+=1;continue}if(!g){a.push({line:m+1,message:`Missing title for id="${p}" — row skipped`}),l+=1;continue}if(o.has(p)){a.push({line:m+1,message:`Duplicate id="${p}" — row skipped`}),l+=1;continue}o.add(p);const x=n(u,"description").trim(),h=n(u,"remote_url").trim(),j=n(u,"remote_type").trim().toLowerCase()==="sse"?"sse":"http",E=ts(n(u,"tags")),D=ts(n(u,"categories")),N=n(u,"is_public").trim().toLowerCase(),v=N==="true"||N==="1"||N==="yes";c.push({id:p,title:g,description:x||null,is_public:v,_meta:{"mcp.mesh":{...E.length>0?{tags:E}:{},...D.length>0?{categories:D}:{}}},server:{name:p,title:g,description:x||void 0,remotes:h?[{type:j,url:h}]:[]}})}return{items:c,warnings:a,skipped:l}}const Cr=`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
- another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function Sr(){const t=new Blob([Cr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),r=document.createElement("a");r.href=e,r.download="registry-import-template.csv",r.click(),URL.revokeObjectURL(e)}function Rr(t){const e=he.c(63),{open:r,onOpenChange:i,isImporting:a,onImport:n}=t,c=a===void 0?!1:a,[o,l]=v.useState(null),[m,u]=v.useState(null),[p,g]=v.useState(null),x=v.useRef(null);let h;e[0]!==i?(h=V=>{i(V),V||(l(null),u(null),g(null),x.current&&(x.current.value=""))},e[0]=i,e[1]=h):h=e[1];const w=h;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=async V=>{if(!V)return;g(V.name),u(null);const xe=await V.text();l(wr(xe))},e[2]=j):j=e[2];const E=j;let D;e[3]!==n||e[4]!==o?(D=async()=>{if(!o?.items.length)return;const V=await n(o.items);u(V)},e[3]=n,e[4]=o,e[5]=D):D=e[5];const N=D;let y;e[6]!==o?.items?(y=o?.items??[],e[6]=o?.items,e[7]=y):y=e[7];const I=y;let d;e[8]!==o?.warnings?(d=o?.warnings??[],e[8]=o?.warnings,e[9]=d):d=e[9];const C=d;let _;e[10]!==C?(_=C.some(Tr),e[10]=C,e[11]=_):_=e[11];const P=_,k=m!==null;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(yt,{children:[s.jsx(bt,{children:"Import MCP Servers from CSV"}),s.jsx(Nt,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=R):R=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=()=>x.current?.click(),e[13]=T):T=e[13];let L;e[14]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(es,{size:14}),e[14]=L):L=e[14];const z=p?"Change file":"Choose CSV file";let b;e[15]!==c||e[16]!==z?(b=s.jsxs($,{variant:"outline",size:"sm",className:"gap-1.5",onClick:T,disabled:c,children:[L,z]}),e[15]=c,e[16]=z,e[17]=b):b=e[17];let U;e[18]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx("input",{ref:x,type:"file",accept:".csv,text/csv",className:"hidden",onChange:V=>E(V.target.files?.[0]??null)}),e[18]=U):U=e[18];let q;e[19]!==p?(q=p&&s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:p}),e[19]=p,e[20]=q):q=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 Y;e[22]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsxs($,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:Sr,children:[s.jsx(Ws,{size:14}),"Download template"]}),e[22]=Y):Y=e[22];let F;e[23]!==b||e[24]!==q?(F=s.jsxs("div",{className:"flex items-center gap-3",children:[b,U,q,Q,Y]}),e[23]=b,e[24]=q,e[25]=F):F=e[25];let G;e[26]!==C?(G=C.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:C.map(_r)}),e[26]=C,e[27]=G):G=e[27];let K;e[28]!==I||e[29]!==o?(K=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(Z,{variant:"secondary",children:[I.length," items"]}),o?.skipped?s.jsxs(Z,{variant:"outline",className:"text-yellow-600",children:[o.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(as,{children:[s.jsx(os,{children:s.jsxs(vt,{children:[s.jsx(Ee,{className:"w-[140px]",children:"ID"}),s.jsx(Ee,{children:"Title"}),s.jsx(Ee,{children:"Remote URL"}),s.jsx(Ee,{className:"w-[80px] text-center",children:"Public"}),s.jsx(Ee,{children:"Tags"})]})}),s.jsx(cs,{children:I.map(Ir)})]})})})]}),e[28]=I,e[29]=o,e[30]=K):K=e[30];let ee;e[31]!==m?(ee=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(pt,{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(kr)})]}),e[31]=m,e[32]=ee):ee=e[32];let te;e[33]!==k||e[34]!==o?(te=!o&&!k&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(es,{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]=k,e[34]=o,e[35]=te):te=e[35];let se;e[36]!==F||e[37]!==G||e[38]!==K||e[39]!==ee||e[40]!==te?(se=s.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[F,G,K,ee,te]}),e[36]=F,e[37]=G,e[38]=K,e[39]=ee,e[40]=te,e[41]=se):se=e[41];let B;e[42]!==w?(B=()=>w(!1),e[42]=w,e[43]=B):B=e[43];const re=k?"Done":"Cancel";let H;e[44]!==B||e[45]!==re?(H=s.jsx($,{variant:"outline",onClick:B,children:re}),e[44]=B,e[45]=re,e[46]=H):H=e[46];let le;e[47]!==N||e[48]!==P||e[49]!==k||e[50]!==c||e[51]!==I.length?(le=!k&&s.jsx($,{onClick:N,disabled:c||I.length===0||P,children:c?"Importing...":`Import ${I.length} item(s)`}),e[47]=N,e[48]=P,e[49]=k,e[50]=c,e[51]=I.length,e[52]=le):le=e[52];let ie;e[53]!==H||e[54]!==le?(ie=s.jsxs(wt,{className:"gap-2 sm:gap-0",children:[H,le]}),e[53]=H,e[54]=le,e[55]=ie):ie=e[55];let J;e[56]!==se||e[57]!==ie?(J=s.jsxs(Ct,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[R,se,ie]}),e[56]=se,e[57]=ie,e[58]=J):J=e[58];let X;return e[59]!==w||e[60]!==r||e[61]!==J?(X=s.jsx(St,{open:r,onOpenChange:w,children:J}),e[59]=w,e[60]=r,e[61]=J,e[62]=X):X=e[62],X}function kr(t){return s.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[s.jsx(xt,{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 Ir(t){return s.jsxs(vt,{children:[s.jsx(De,{className:"font-mono text-xs",children:t.id}),s.jsx(De,{className:"text-sm",children:t.title}),s.jsx(De,{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(De,{className:"text-center",children:t.is_public?s.jsx(Z,{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(De,{className:"text-xs text-muted-foreground",children:(t._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},t.id)}function _r(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(xt,{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 Tr(t){return t.message.startsWith("Missing required column:")}function Er(t){const e=he.c(19),{open:r,onOpenChange:i,title:a,isDeleting:n,onConfirm:c}=t,o=n===void 0?!1:n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx($t,{children:"Delete registry item?"}),e[0]=l):l=e[0];let m;e[1]!==a?(m=s.jsxs(Ft,{children:[l,s.jsxs(Ot,{children:["This action cannot be undone. Item ",s.jsx("strong",{children:a})," will be permanently removed from this private registry."]})]}),e[1]=a,e[2]=m):m=e[2];let u;e[3]!==o?(u=s.jsx(qt,{disabled:o,children:"Cancel"}),e[3]=o,e[4]=u):u=e[4];const p=o?"Deleting...":"Delete";let g;e[5]!==o||e[6]!==c||e[7]!==p?(g=s.jsx(Bt,{disabled:o,onClick:c,children:p}),e[5]=o,e[6]=c,e[7]=p,e[8]=g):g=e[8];let x;e[9]!==u||e[10]!==g?(x=s.jsxs(Gt,{children:[u,g]}),e[9]=u,e[10]=g,e[11]=x):x=e[11];let h;e[12]!==m||e[13]!==x?(h=s.jsxs(Kt,{children:[m,x]}),e[12]=m,e[13]=x,e[14]=h):h=e[14];let w;return e[15]!==i||e[16]!==r||e[17]!==h?(w=s.jsx(Vt,{open:r,onOpenChange:i,children:h}),e[15]=i,e[16]=r,e[17]=h,e[18]=w):w=e[18],w}function Dr(t){const[e]=t.id.split("/");return e??"provider"}function Pr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Lr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function zr(t){return t.server?.icons?.[0]?.src??null}function Ur(t){const e=he.c(56),{item:r,onEdit:i,onDelete:a}=t;let n;e[0]!==r?(n=zr(r),e[0]=r,e[1]=n):n=e[1];const c=n;let o;e[2]!==r?(o=[...Pr(r),...Lr(r)],e[2]=r,e[3]=o):o=e[3];const l=o;let m;e[4]!==l?(m=l.slice(0,3),e[4]=l,e[5]=m):m=e[5];const u=m,p=Math.max(0,l.length-u.length);let g;e[6]!==c||e[7]!==r.title?(g=s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:c?s.jsx("img",{src:c,alt:r.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:r.title.charAt(0).toUpperCase()})}),e[6]=c,e[7]=r.title,e[8]=g):g=e[8];let x;e[9]!==r.title?(x=s.jsx("p",{className:"font-medium truncate",children:r.title}),e[9]=r.title,e[10]=x):x=e[10];let h;e[11]!==r?(h=Dr(r),e[11]=r,e[12]=h):h=e[12];let w;e[13]!==h?(w=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h}),e[13]=h,e[14]=w):w=e[14];let j;e[15]!==r.is_public?(j=r.is_public?s.jsxs(Z,{variant:"default",className:"gap-1",children:[s.jsx(ms,{size:10}),"Public"]}):s.jsx(Z,{variant:"secondary",children:"Private"}),e[15]=r.is_public,e[16]=j):j=e[16];let E;e[17]!==w||e[18]!==j?(E=s.jsxs("div",{className:"flex items-center gap-2",children:[w,j]}),e[17]=w,e[18]=j,e[19]=E):E=e[19];let D;e[20]!==x||e[21]!==E?(D=s.jsxs("div",{className:"min-w-0 flex-1",children:[x,E]}),e[20]=x,e[21]=E,e[22]=D):D=e[22];let N;e[23]!==D||e[24]!==g?(N=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g,D]}),e[23]=D,e[24]=g,e[25]=N):N=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(Pt,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ds,{size:18})})}),e[26]=y):y=e[26];let I;e[27]!==r||e[28]!==i?(I=s.jsx(dt,{onClick:()=>i(r),children:"Edit"}),e[27]=r,e[28]=i,e[29]=I):I=e[29];let d;e[30]!==r||e[31]!==a?(d=()=>a(r),e[30]=r,e[31]=a,e[32]=d):d=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(ft,{size:14}),e[33]=C):C=e[33];let _;e[34]!==d?(_=s.jsxs(dt,{variant:"destructive",onClick:d,children:[C,"Delete"]}),e[34]=d,e[35]=_):_=e[35];let P;e[36]!==I||e[37]!==_?(P=s.jsxs(Lt,{children:[y,s.jsxs(zt,{align:"end",children:[I,_]})]}),e[36]=I,e[37]=_,e[38]=P):P=e[38];let k;e[39]!==N||e[40]!==P?(k=s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[N,P]}),e[39]=N,e[40]=P,e[41]=k):k=e[41];const R=r._meta?.["mcp.mesh"]?.short_description||r.description||r.server.description||"No description provided.";let T;e[42]!==R?(T=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:R}),e[42]=R,e[43]=T):T=e[43];let L;e[44]!==r.id||e[45]!==u?(L=u.map(q=>s.jsx(Z,{variant:"secondary",children:q},`${r.id}-badge-${q}`)),e[44]=r.id,e[45]=u,e[46]=L):L=e[46];let z;e[47]!==p?(z=p>0&&s.jsxs(Z,{variant:"outline",children:["+",p]}),e[47]=p,e[48]=z):z=e[48];let b;e[49]!==L||e[50]!==z?(b=s.jsxs("div",{className:"flex flex-wrap gap-1",children:[L,z]}),e[49]=L,e[50]=z,e[51]=b):b=e[51];let U;return e[52]!==k||e[53]!==T||e[54]!==b?(U=s.jsxs(it,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[k,T,b]}),e[52]=k,e[53]=T,e[54]=b,e[55]=U):U=e[55],U}function Ss(t){const e=he.c(27),{value:r,onChange:i,onFileUpload:a,error:n,isUploading:c}=t,o=c===void 0?!1:c,[l,m]=v.useState(!1),[u,p]=v.useState(!1),g=v.useRef(null);let x;e[0]!==o?(x=R=>{R.preventDefault(),o||m(!0)},e[0]=o,e[1]=x):x=e[1];const h=x;let w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=R=>{R.preventDefault(),m(!1)},e[2]=w):w=e[2];const j=w;let E;e[3]!==o||e[4]!==a?(E=async R=>{if(R.preventDefault(),m(!1),o)return;const T=R.dataTransfer.files[0];T&&await a(T)},e[3]=o,e[4]=a,e[5]=E):E=e[5];const D=E;let N;e[6]!==o||e[7]!==a?(N=async R=>{const T=R.target.files?.[0];T&&!o&&await a(T),R.target.value=""},e[6]=o,e[7]=a,e[8]=N):N=e[8];const y=N,I=r.length>0;let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(me,{children:"Image"}),e[9]=d):d=e[9];let C;e[10]!==h||e[11]!==D||e[12]!==I||e[13]!==l||e[14]!==o||e[15]!==i||e[16]!==u||e[17]!==r?(C=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:r,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:r}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>g.current?.click(),disabled:o,children:[s.jsx(Qt,{className:"size-3"}),"Change"]}),s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{i(""),p(!1)},disabled:o,children:[s.jsx(ft,{className:"size-3"}),"Remove"]})]})]})]})}):o?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(nt,{className:"size-8 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):s.jsxs("div",{className:Pe("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",l?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:h,onDragLeave:j,onDrop:D,onClick:()=>g.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:Pe("size-10 rounded-lg flex items-center justify-center transition-colors",l?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:s.jsx(ys,{size:20})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:l?"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:Mr,children:s.jsx(Se,{placeholder:"https://example.com/logo.png",value:r,className:"text-xs h-8",onChange:R=>i(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(),p(!0)},children:[s.jsx(bs,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=h,e[11]=D,e[12]=I,e[13]=l,e[14]=o,e[15]=i,e[16]=u,e[17]=r,e[18]=C):C=e[18];let _;e[19]!==y?(_=s.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:y}),e[19]=y,e[20]=_):_=e[20];let P;e[21]!==n?(P=n&&s.jsx("p",{className:"text-xs text-destructive",children:n}),e[21]=n,e[22]=P):P=e[22];let k;return e[23]!==C||e[24]!==_||e[25]!==P?(k=s.jsxs("div",{className:"grid gap-1.5",children:[d,C,_,P]}),e[23]=C,e[24]=_,e[25]=P,e[26]=k):k=e[26],k}function Mr(t){return t.stopPropagation()}function Rs(){const[t,e]=v.useState("idle"),[r,i]=v.useState(null),{org:a}=_e(),n=ze({connectionId:Ae,orgId:a.id});return{discover:async(l,m)=>{if(!l)return null;e("loading"),i(null);try{const u=await n.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:l,type:m==="sse"?"sse":"http"}}),p=u.structuredContent??u;if(u.isError){const g=u.content?.find(x=>x.type==="text")?.text??"Tool returned an error";return i(g),e("error"),null}return p.error?Ar(p.error)?(i(p.error),e("auth_required"),null):(i(p.error),e("error"),null):!p.tools||p.tools.length===0?(i("No tools found on this MCP server."),e("error"),null):(e("success"),p.tools)}catch(u){const p=u instanceof Error?u.message:String(u);return i(p||"Could not discover tools."),e("error"),null}},discoverStatus:t,discoverError:r,resetDiscover:()=>{e("idle"),i(null)}}}function Ar(t){const e=t.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function $r(t){const e=he.c(54),{tools:r,onChange:i,remoteUrl:a,remoteType:n,externalDiscoverStatus:c,externalDiscoverError:o}=t,[l,m]=v.useState(r.length>0),{discover:u,discoverStatus:p,discoverError:g,resetDiscover:x}=Rs(),h=c??p,w=o??g;let j;e[0]!==u||e[1]!==i||e[2]!==n||e[3]!==a?(j=async()=>{if(!a)return;const Y=await u(a,n??"http");Y&&(i(Y),m(!0))},e[0]=u,e[1]=i,e[2]=n,e[3]=a,e[4]=j):j=e[4];const E=j;let D;e[5]!==i||e[6]!==x?(D=()=>{i([]),x()},e[5]=i,e[6]=x,e[7]=D):D=e[7];const N=D;let y;e[8]!==l?(y=()=>m(!l),e[8]=l,e[9]=y):y=e[9];let I,d;e[10]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Ns,{size:14,className:"text-muted-foreground"}),d=s.jsx("span",{children:"Tools"}),e[10]=I,e[11]=d):(I=e[10],d=e[11]);let C;e[12]!==r.length?(C=r.length>0&&s.jsx(Z,{variant:"secondary",className:"text-xs px-1.5 py-0",children:r.length}),e[12]=r.length,e[13]=C):C=e[13];let _;e[14]!==l?(_=l?s.jsx(Zs,{size:14,className:"text-muted-foreground"}):s.jsx(fs,{size:14,className:"text-muted-foreground"}),e[14]=l,e[15]=_):_=e[15];let P;e[16]!==y||e[17]!==C||e[18]!==_?(P=s.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:y,children:[I,d,C,_]}),e[16]=y,e[17]=C,e[18]=_,e[19]=P):P=e[19];let k;e[20]!==N||e[21]!==r.length?(k=r.length>0&&s.jsxs($,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:N,children:[s.jsx(ft,{size:12}),"Clear"]}),e[20]=N,e[21]=r.length,e[22]=k):k=e[22];let R;e[23]!==h||e[24]!==E||e[25]!==a||e[26]!==r.length?(R=a&&s.jsxs($,{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:E,disabled:h==="loading",children:[h==="loading"?s.jsx(nt,{size:12,className:"animate-spin"}):s.jsx(Qt,{size:12}),h==="loading"?"Discovering...":r.length>0?"Refresh":"Auto-discover"]}),e[23]=h,e[24]=E,e[25]=a,e[26]=r.length,e[27]=R):R=e[27];let T;e[28]!==R||e[29]!==k?(T=s.jsxs("div",{className:"flex items-center gap-2",children:[k,R]}),e[28]=R,e[29]=k,e[30]=T):T=e[30];let L;e[31]!==T||e[32]!==P?(L=s.jsxs("div",{className:"flex items-center justify-between",children:[P,T]}),e[31]=T,e[32]=P,e[33]=L):L=e[33];let z;e[34]!==h||e[35]!==r.length?(z=h==="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(pt,{size:14,className:"shrink-0"}),s.jsxs("span",{children:["Discovered ",r.length," tool",r.length!==1?"s":""," ","successfully."]})]}),e[34]=h,e[35]=r.length,e[36]=z):z=e[36];let b;e[37]!==w||e[38]!==h?(b=h==="error"&&w&&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(xt,{size:14,className:"shrink-0"}),s.jsx("span",{children:w})]}),e[37]=w,e[38]=h,e[39]=b):b=e[39];let U;e[40]!==l||e[41]!==r?(U=l&&r.length>0&&s.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:r.map(Fr)}),e[40]=l,e[41]=r,e[42]=U):U=e[42];let q;e[43]!==h||e[44]!==l||e[45]!==a||e[46]!==r.length?(q=l&&r.length===0&&h==="idle"&&s.jsx("p",{className:"text-xs text-muted-foreground px-1",children:a?'Click "Auto-discover" to load tools from the MCP server.':"Add a Remote URL first, then tools can be auto-discovered."}),e[43]=h,e[44]=l,e[45]=a,e[46]=r.length,e[47]=q):q=e[47];let Q;return e[48]!==L||e[49]!==z||e[50]!==b||e[51]!==U||e[52]!==q?(Q=s.jsxs("div",{className:"space-y-3",children:[L,z,b,U,q]}),e[48]=L,e[49]=z,e[50]=b,e[51]=U,e[52]=q,e[53]=Q):Q=e[53],Q}function Fr(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 ks(t){const{org:e}=_e(),[r,i]=v.useState(!1),n=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,c=ze({connectionId:n??"noop",orgId:e.id});return{uploadImage:async(l,m)=>{if(!n)return ne.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!l.type.startsWith("image/"))return ne.error("Only image files are supported"),null;if(l.size>5*1024*1024)return ne.error("Image size must be less than 5MB"),null;i(!0);try{const u=await c.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:m,contentType:l.type}}),p=u.structuredContent?.url||u.url;if(!p)throw new Error("Failed to get presigned URL");const g=await fetch(p,{method:"PUT",body:l,headers:{"Content-Type":l.type}});if(!g.ok)throw new Error(`Upload failed: ${g.statusText}`);const x=await c.callTool({name:"GET_PRESIGNED_URL",arguments:{key:m,expiresIn:31536e3}}),h=x.structuredContent?.url||x.url;if(!h)throw new Error("Failed to get public URL");return h}catch(u){return console.error("Image upload failed:",u),ne.error(u instanceof Error?u.message:"Failed to upload image. Please try again."),null}finally{i(!1)}},isUploading:r}}function Or(){const{org:t}=_e(),[e,r]=v.useState(null),i=v.useRef(0),a=ze({connectionId:Ae,orgId:t.id});return{generate:async c=>{i.current+=1,r(c.type);try{const o=await a.callTool({name:"REGISTRY_AI_GENERATE",arguments:c});if(o.isError){const l=o.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(l)}return o.structuredContent??o}finally{i.current-=1,i.current===0&&r(null)}},loadingType:e,isGenerating:e!==null}}const qr=new Set(["http","sse","stdio"]),Br=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,rs=["internal","automation","support","sales","ops","ai"],Is=["productivity","communication","customer-support","development","data","operations"],Gr=["Essentials","Details","Advanced"],ot="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 is(t){return t.replace(/^https?:\/\//i,"").trim()}function ct(t){const e=t.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function Xe(t){return t.trim().toLowerCase()}function ht(t){return Array.from(new Set(t.map(Xe).filter(e=>e.length>0)))}function rt(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Kr(t){const e=he.c(4),{current:r}=t;let i;e[0]!==r?(i=Gr.map((n,c)=>{const o=c+1,l=o===r,m=o<r;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[c>0&&s.jsx("div",{className:Pe("w-4 h-px",m?"bg-primary":"bg-border")}),s.jsxs("div",{className:Pe("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",l?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[s.jsx("span",{className:Pe("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",l?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:o}),s.jsx("span",{className:"hidden sm:inline",children:n})]})]},n)}),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==i?(a=s.jsx("div",{className:"flex items-center gap-1.5",children:i}),e[2]=i,e[3]=a):a=e[3],a}function Vr(t){const e=he.c(28),{id:r,label:i,values:a,availableOptions:n,placeholder:c,onChange:o}=t,[l,m]=v.useState(""),[u,p]=v.useState(!1);let g,x,h,w,j;if(e[0]!==n||e[1]!==r||e[2]!==l||e[3]!==u||e[4]!==i||e[5]!==o||e[6]!==c||e[7]!==a){const N=ht(n),y=ht(a),I=new Set(y),d=Xe(l),C=N.filter(b=>!I.has(b)).filter(b=>d?b.includes(d):!0).slice(0,8),_=b=>{const U=Xe(b);!U||I.has(U)||o([...y,U])},P=b=>{o(y.filter(U=>U!==b))},k=()=>{const b=l.split(/[,\n;]/).map(Xe).filter(Boolean);if(b.length===0)return;const U=[...y];for(const q of b)U.includes(q)||U.push(q);o(U),m("")},R=d;w="grid gap-2",e[13]!==r||e[14]!==i?(j=s.jsx(me,{htmlFor:r,children:i}),e[13]=r,e[14]=i,e[15]=j):j=e[15],g="relative";let T;e[16]!==r?(T=()=>{const b=document.getElementById(r);b instanceof HTMLInputElement&&b.focus()},e[16]=r,e[17]=T):T=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=()=>p(!0),e[18]=L):L=e[18];let z;e[19]===Symbol.for("react.memo_cache_sentinel")?(z=b=>m(b.target.value),e[19]=z):z=e[19],x=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:T,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[y.map(b=>s.jsxs(Z,{variant:"secondary",className:"gap-1",children:[b,s.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),P(b)},children:s.jsx(tr,{size:12})})]},`${r}-${b}`)),s.jsx("input",{id:r,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:y.length?"":c,value:l,onFocus:L,onBlur:()=>{p(!1),k()},onChange:z,onKeyDown:b=>{if(b.key==="Enter"||b.key===","){b.preventDefault(),k();return}b.key==="Backspace"&&!l&&y.length&&P(y[y.length-1]??"")}})]})}),h=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:C.length>0?C.map(b=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Yr,onClick:()=>{_(b),m("")},children:b},`${r}-suggestion-${b}`)):R?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Qr,onClick:()=>{_(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]=n,e[1]=r,e[2]=l,e[3]=u,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=g,e[9]=x,e[10]=h,e[11]=w,e[12]=j}else g=e[8],x=e[9],h=e[10],w=e[11],j=e[12];let E;e[20]!==g||e[21]!==x||e[22]!==h?(E=s.jsxs("div",{className:g,children:[x,h]}),e[20]=g,e[21]=x,e[22]=h,e[23]=E):E=e[23];let D;return e[24]!==w||e[25]!==j||e[26]!==E?(D=s.jsxs("div",{className:w,children:[j,E]}),e[24]=w,e[25]=j,e[26]=E,e[27]=D):D=e[27],D}function Qr(t){return t.preventDefault()}function Yr(t){return t.preventDefault()}function Hr({id:t,value:e,availableOptions:r,onChange:i}){const[a,n]=v.useState(e),[c,o]=v.useState(!1),l=v.useRef(e);l.current!==e&&(l.current=e,n(e));const m=ht([...Is,...r,e]).filter(Boolean),u=Xe(a),p=m.filter(x=>u?x.includes(u):!0).slice(0,8),g=x=>{const h=Xe(x);i(h),n(h),o(!1)};return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(me,{htmlFor:t,children:"Category"}),s.jsxs("div",{className:"relative",children:[s.jsx(Se,{id:t,className:"h-9 text-sm",placeholder:"Select or create category",value:a,onFocus:()=>{n(e),o(!0)},onBlur:()=>{g(a)},onChange:x=>n(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),g(a))}}),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:x=>x.preventDefault(),onClick:()=>{i(""),n("")},children:"clear"}),c&&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:p.length>0?p.map(x=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:h=>h.preventDefault(),onClick:()=>g(x),children:x},`${t}-${x}`)):u?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:x=>x.preventDefault(),onClick:()=>g(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 Wr({open:t,onOpenChange:e,item:r,draft:i,availableTags:a=[],availableCategories:n=[],defaultLLMConnectionId:c="",defaultLLMModelId:o="",isSubmitting:l=!1,onSubmit:m}){const{org:u}=_e(),{uploadImage:p,isUploading:g}=ks(),{generate:x,loadingType:h}=Or(),{discover:w,discoverStatus:j,discoverError:E,resetDiscover:D}=Rs(),N=!!r,y=i?._meta?.["mcp.mesh"],I=r?.title??i?.title??"",d=r?.id?.split("/")[0]??i?.id?.split("/")[0]??"",C=r?.description??i?.description??"",_=r?._meta?.["mcp.mesh"]?.short_description??y?.short_description??"",P=r?._meta?.["mcp.mesh"]?.owner??y?.owner??"",k=r?.server?.repository?.url??i?.server?.repository?.url??"",R=r?._meta?.["mcp.mesh"]?.readme??y?.readme??"",T=r?._meta?.["mcp.mesh"]?.readme_url??y?.readme_url??"",L=is(r?.server?.remotes?.[0]?.url??i?.server?.remotes?.[0]?.url??""),z=r?.server?.remotes?.[0]?.type??i?.server?.remotes?.[0]?.type??"http",b=r?._meta?.["mcp.mesh"]?.tags??y?.tags??[],U=r?._meta?.["mcp.mesh"]?.categories?.[0]??y?.categories?.[0]??"",q=r?.server?.icons?.[0]?.src??i?.server?.icons?.[0]?.src??"",Q=r?._meta?.["mcp.mesh"]?.tools??y?.tools??[],Y=r?.is_public??i?.is_public??!1,[F,G]=v.useState(1),[K,ee]=v.useState(I),[te,se]=v.useState(d),[B,re]=v.useState(C),[H,le]=v.useState(_),[ie,J]=v.useState(P),[X,V]=v.useState(k),[xe,ye]=v.useState(R),[ue,be]=v.useState(T),[ae,pe]=v.useState(R?"content":"link"),[W,je]=v.useState(L),[f,O]=v.useState(z),[ge,ce]=v.useState(b),[we,Te]=v.useState(U),[Ce,Ue]=v.useState(q),[fe,Ge]=v.useState(Q),[Ke,et]=v.useState(Y),[oe,Le]=v.useState({}),Re=!!(c&&o),Ve=()=>{G(1),ee(I),se(d),re(C),le(_),J(P),V(k),ye(R),be(T),pe(R?"content":"link"),je(L),O(z),ce(b),Te(U),Ue(q),Ge(Q),et(Y),Le({}),D(),Me.current="",ke.current&&(clearTimeout(ke.current),ke.current=null)},lt=async S=>{if(!S)return;const M=N?r?.id:`${te}/${K}`.toLowerCase(),Ie=rt(M||"temp"),Oe=S.name.split(".").pop()||"png",qe=`registry/${u.id}/${Ie}/icon.${Oe}`,st=await p(S,qe);st?(Ue(st),Le(Be=>({...Be,imageUrl:void 0}))):Le(Be=>({...Be,imageUrl:"Failed to upload image. Please try again."}))},ke=v.useRef(null),Me=v.useRef(""),Ye=v.useRef(f);Ye.current=f;const tt=S=>{!S&&ke.current&&(clearTimeout(ke.current),ke.current=null),e(S),S||Ve()},He=async()=>{const S=ct(W);if(!S)return;Me.current=S;const M=await w(S,Ye.current);M&&Ge(M)},We=S=>{ke.current&&clearTimeout(ke.current);const M=ct(S);!M||M===Me.current||S.includes(".")&&(ke.current=setTimeout(async()=>{Me.current=M;const Ie=await w(M,Ye.current);Ie&&Ge(Ie)},800))},$e=()=>Re?{llmConnectionId:c,modelId:o}:null,Fe=()=>({name:K.trim(),provider:te.trim(),url:ct(W),owner:ie.trim(),repositoryUrl:X.trim(),description:B.trim(),shortDescription:H.trim(),tags:ge,categories:we?[we]:[],availableTags:[...rs,...a],availableCategories:[...Is,...n],tools:fe}),Ze=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"description",context:Fe()});M.result&&re(M.result.slice(0,1500))},Je=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"short_description",context:Fe()});M.result&&le(M.result.slice(0,160))},A=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"tags",context:Fe()});M.items?.length&&ce(ht(M.items))},ve=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"categories",context:Fe()});M.items?.[0]&&Te(Xe(M.items[0]))},at=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"readme",context:Fe()});M.result&&(ye(M.result.slice(0,5e4)),pe("content"))},Ht=S=>{const M={};if(S===1){const Ie=rt(te),Oe=rt(K),qe=`${Ie}/${Oe}`;K.trim()||(M.title="Name is required."),N||(Ie?Oe?Br.test(qe)||(M.provider="Use lowercase letters/numbers and separators '/' or '-'."):M.title="Name must contain valid characters.":M.provider="Provider is required.");const st=ct(W),Be=f.trim().toLowerCase();if(Be!=="stdio"&&st)try{const mt=new URL(st);["http:","https:"].includes(mt.protocol)||(M.remoteUrl="Remote URL must be http(s).")}catch{M.remoteUrl="Remote URL is invalid."}if(Be&&!qr.has(Be)&&(M.remoteType="Remote type must be: http, sse or stdio."),Ce.trim()&&!Ce.trim().startsWith("data:image/"))try{const kt=new URL(Ce.trim());["http:","https:"].includes(kt.protocol)||(M.imageUrl="Image URL must be http(s).")}catch{M.imageUrl="Image URL is invalid."}}if(S===2&&(B.length>1500&&(M.description="Description must be 1500 characters or less."),H.trim().length>160&&(M.shortDescription="Short description must be 160 characters or less.")),S===3){const Ie=ue.trim();if(Ie)try{const qe=new URL(Ie);["http:","https:"].includes(qe.protocol)||(M.readmeUrl="README URL must be http(s).")}catch{M.readmeUrl="README URL is invalid."}xe.trim().length>5e4&&(M.readme="README must be 50 000 characters or less.");const Oe=X.trim();if(Oe)try{const qe=new URL(Oe);["http:","https:"].includes(qe.protocol)||(M.repositoryUrl="Repository URL must be http(s).")}catch{M.repositoryUrl="Repository URL is invalid."}}return Le(M),Object.values(M).every(Ie=>Ie===void 0)},_s=()=>{Ht(F)&&F<3&&G(F+1)},Ts=()=>{F>1&&G(F-1)},Es=async()=>{if(!Ht(3))return;const S=K.trim(),M=rt(te),Ie=rt(S),Oe=`${M}/${Ie}`,qe=ct(W),st=f.trim().toLowerCase(),Be=Ce.trim(),mt=X.trim(),kt=H.trim(),zs=xe.trim(),Us=ue.trim(),Ms=ht(ge),As=we?[Xe(we)]:[],$s=r?r.server?.name??r.id:"",Fs=(N?$s:Oe).trim(),It=B.trim(),Os=ie.trim(),Wt={title:S,description:It.length>0?It:null,is_public:Ke,_meta:{"mcp.mesh":{tags:Ms,categories:As,short_description:kt||null,owner:Os||null,readme:zs||null,readme_url:Us||null,...fe.length>0?{tools:fe}:{}}},server:{name:Fs,title:S,description:It||void 0,icons:Be?[{src:Be}]:[],repository:mt?{url:mt}:void 0,remotes:qe?[{type:st||"http",url:qe}]:[]}};if(N&&r){await m({id:r.id,data:Wt}),e(!1);return}await m({id:Oe,...Wt}),e(!1),Ve()},Ds=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(me,{htmlFor:"registry-item-provider",children:"Provider"}),s.jsx(Se,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:te,onChange:S=>se(S.target.value),disabled:N}),!N&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",s.jsx("span",{className:"font-mono",children:`${rt(te)||"provider"}/${rt(K)||"name"}`})]}),oe.provider&&s.jsx("p",{className:"text-xs text-destructive",children:oe.provider})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{htmlFor:"registry-item-title",children:"Name"}),s.jsx(Se,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:K,onChange:S=>ee(S.target.value)}),oe.title&&s.jsx("p",{className:"text-xs text-destructive",children:oe.title})]})]}),s.jsx("div",{className:"row-span-2 content-start",children:s.jsx(Ss,{value:Ce,onChange:S=>{Ue(S),Le(M=>({...M,imageUrl:void 0}))},onFileUpload:lt,error:oe.imageUrl,isUploading:g})}),s.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[s.jsx(me,{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:W,onChange:S=>{const M=is(S.target.value);je(M),We(M)}})]}),s.jsxs(xs,{value:f,onValueChange:O,children:[s.jsx(hs,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:s.jsx(ps,{placeholder:"Type"})}),s.jsxs(gs,{children:[s.jsx(jt,{value:"http",children:"http"}),s.jsx(jt,{value:"sse",children:"sse"}),s.jsx(jt,{value:"stdio",children:"stdio"})]})]})]}),oe.remoteUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.remoteUrl}),oe.remoteType&&s.jsx("p",{className:"text-xs text-destructive",children:oe.remoteType})]}),W.trim()&&s.jsxs("div",{className:"col-span-2 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs($,{type:"button",variant:"outline",size:"sm",className:Pe(ot,"gap-1.5"),onClick:He,disabled:j==="loading",children:[j==="loading"?s.jsx(nt,{size:12,className:"animate-spin"}):s.jsx(Qt,{size:12}),j==="loading"?"Discovering tools...":fe.length>0?"Re-discover tools":"Discover tools from URL"]}),fe.length>0&&j!=="loading"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[fe.length," tool",fe.length!==1?"s":""," loaded"]})]}),j==="success"&&fe.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(pt,{size:14,className:"shrink-0"}),s.jsxs("span",{className:"font-medium",children:[fe.length," tool",fe.length!==1?"s":""," discovered"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[fe.slice(0,8).map(S=>s.jsx(Z,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:S.name},S.name)),fe.length>8&&s.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",fe.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"&&E&&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(xt,{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"&&E&&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(xt,{size:14,className:"shrink-0"}),s.jsx("span",{children:E})]})]})]}),Ps=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(me,{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:[H.length,"/160"]}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="short_description",onClick:Je,children:h==="short_description"?"Generating...":"AI Generate"})]})]}),s.jsx(Se,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:H,maxLength:160,onChange:S=>le(S.target.value)}),oe.shortDescription&&s.jsx("p",{className:"text-xs text-destructive",children:oe.shortDescription})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(me,{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:[B.length,"/1500"]}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="description",onClick:Ze,children:h==="description"?"Generating...":"AI Generate"})]})]}),s.jsx(Mt,{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:B,onChange:S=>re(S.target.value)}),oe.description&&s.jsx("p",{className:"text-xs text-destructive",children:oe.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(Hr,{id:"registry-category",value:we,availableOptions:n,onChange:Te}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:Pe(ot,"justify-self-start"),disabled:h==="categories",onClick:ve,children:h==="categories"?"Suggesting...":"AI Suggest"})]}),s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Vr,{id:"registry-tags",label:"Tags",values:ge,availableOptions:[...rs,...a],placeholder:"Type and press Enter or comma",onChange:ce}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:Pe(ot,"justify-self-start"),disabled:h==="tags",onClick:A,children:h==="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(me,{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(Ut,{id:"registry-is-public",checked:Ke,onCheckedChange:et})]})]}),Ls=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(me,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),s.jsx(Se,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:ie,onChange:S=>J(S.target.value)})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),s.jsx(Se,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:X,onChange:S=>V(S.target.value)}),oe.repositoryUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.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(me,{children:"README"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[xe.length,"/50000"]})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(Re?["link","content","generate"]:["link","content"]).map(S=>s.jsx("button",{type:"button",className:Pe("px-2.5 py-1 text-xs rounded-md",ae===S?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>pe(S),children:S==="link"?"Link":S==="content"?"Content":"Generate"},S))}),ae==="link"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Se,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:ue,onChange:S=>be(S.target.value)}),oe.readmeUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.readmeUrl})]}),ae==="content"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Mt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
3
+ another-server,Another Server,Another useful server,https://example2.com/mcp,http,data|analytics,data-processing,false`;function Sr(){const t=new Blob([Cr],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),r=document.createElement("a");r.href=e,r.download="registry-import-template.csv",r.click(),URL.revokeObjectURL(e)}function Rr(t){const e=he.c(63),{open:r,onOpenChange:i,isImporting:a,onImport:n}=t,c=a===void 0?!1:a,[o,l]=y.useState(null),[m,u]=y.useState(null),[p,g]=y.useState(null),x=y.useRef(null);let h;e[0]!==i?(h=V=>{i(V),V||(l(null),u(null),g(null),x.current&&(x.current.value=""))},e[0]=i,e[1]=h):h=e[1];const w=h;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=async V=>{if(!V)return;g(V.name),u(null);const xe=await V.text();l(wr(xe))},e[2]=j):j=e[2];const E=j;let D;e[3]!==n||e[4]!==o?(D=async()=>{if(!o?.items.length)return;const V=await n(o.items);u(V)},e[3]=n,e[4]=o,e[5]=D):D=e[5];const N=D;let v;e[6]!==o?.items?(v=o?.items??[],e[6]=o?.items,e[7]=v):v=e[7];const I=v;let d;e[8]!==o?.warnings?(d=o?.warnings??[],e[8]=o?.warnings,e[9]=d):d=e[9];const C=d;let _;e[10]!==C?(_=C.some(Tr),e[10]=C,e[11]=_):_=e[11];const P=_,k=m!==null;let R;e[12]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsxs(yt,{children:[s.jsx(bt,{children:"Import MCP Servers from CSV"}),s.jsx(Nt,{children:"Upload a CSV file to bulk-import MCP servers into the registry."})]}),e[12]=R):R=e[12];let T;e[13]===Symbol.for("react.memo_cache_sentinel")?(T=()=>x.current?.click(),e[13]=T):T=e[13];let L;e[14]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(es,{size:14}),e[14]=L):L=e[14];const z=p?"Change file":"Choose CSV file";let b;e[15]!==c||e[16]!==z?(b=s.jsxs($,{variant:"outline",size:"sm",className:"gap-1.5",onClick:T,disabled:c,children:[L,z]}),e[15]=c,e[16]=z,e[17]=b):b=e[17];let U;e[18]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx("input",{ref:x,type:"file",accept:".csv,text/csv",className:"hidden",onChange:V=>E(V.target.files?.[0]??null)}),e[18]=U):U=e[18];let q;e[19]!==p?(q=p&&s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:p}),e[19]=p,e[20]=q):q=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 Y;e[22]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsxs($,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground",onClick:Sr,children:[s.jsx(Ws,{size:14}),"Download template"]}),e[22]=Y):Y=e[22];let F;e[23]!==b||e[24]!==q?(F=s.jsxs("div",{className:"flex items-center gap-3",children:[b,U,q,Q,Y]}),e[23]=b,e[24]=q,e[25]=F):F=e[25];let G;e[26]!==C?(G=C.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:C.map(_r)}),e[26]=C,e[27]=G):G=e[27];let K;e[28]!==I||e[29]!==o?(K=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(Z,{variant:"secondary",children:[I.length," items"]}),o?.skipped?s.jsxs(Z,{variant:"outline",className:"text-yellow-600",children:[o.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(as,{children:[s.jsx(os,{children:s.jsxs(vt,{children:[s.jsx(De,{className:"w-[140px]",children:"ID"}),s.jsx(De,{children:"Title"}),s.jsx(De,{children:"Remote URL"}),s.jsx(De,{className:"w-[80px] text-center",children:"Public"}),s.jsx(De,{children:"Tags"})]})}),s.jsx(cs,{children:I.map(Ir)})]})})})]}),e[28]=I,e[29]=o,e[30]=K):K=e[30];let ee;e[31]!==m?(ee=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(pt,{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(kr)})]}),e[31]=m,e[32]=ee):ee=e[32];let te;e[33]!==k||e[34]!==o?(te=!o&&!k&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx(es,{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]=k,e[34]=o,e[35]=te):te=e[35];let se;e[36]!==F||e[37]!==G||e[38]!==K||e[39]!==ee||e[40]!==te?(se=s.jsxs("div",{className:"flex-1 overflow-y-auto grid gap-4 pr-1",children:[F,G,K,ee,te]}),e[36]=F,e[37]=G,e[38]=K,e[39]=ee,e[40]=te,e[41]=se):se=e[41];let B;e[42]!==w?(B=()=>w(!1),e[42]=w,e[43]=B):B=e[43];const re=k?"Done":"Cancel";let H;e[44]!==B||e[45]!==re?(H=s.jsx($,{variant:"outline",onClick:B,children:re}),e[44]=B,e[45]=re,e[46]=H):H=e[46];let le;e[47]!==N||e[48]!==P||e[49]!==k||e[50]!==c||e[51]!==I.length?(le=!k&&s.jsx($,{onClick:N,disabled:c||I.length===0||P,children:c?"Importing...":`Import ${I.length} item(s)`}),e[47]=N,e[48]=P,e[49]=k,e[50]=c,e[51]=I.length,e[52]=le):le=e[52];let ie;e[53]!==H||e[54]!==le?(ie=s.jsxs(wt,{className:"gap-2 sm:gap-0",children:[H,le]}),e[53]=H,e[54]=le,e[55]=ie):ie=e[55];let J;e[56]!==se||e[57]!==ie?(J=s.jsxs(Ct,{className:"sm:max-w-3xl max-h-[85vh] flex flex-col",children:[R,se,ie]}),e[56]=se,e[57]=ie,e[58]=J):J=e[58];let X;return e[59]!==w||e[60]!==r||e[61]!==J?(X=s.jsx(St,{open:r,onOpenChange:w,children:J}),e[59]=w,e[60]=r,e[61]=J,e[62]=X):X=e[62],X}function kr(t){return s.jsxs("p",{className:"text-xs text-destructive flex items-start gap-1.5",children:[s.jsx(xt,{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 Ir(t){return s.jsxs(vt,{children:[s.jsx(Pe,{className:"font-mono text-xs",children:t.id}),s.jsx(Pe,{className:"text-sm",children:t.title}),s.jsx(Pe,{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(Pe,{className:"text-center",children:t.is_public?s.jsx(Z,{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(Pe,{className:"text-xs text-muted-foreground",children:(t._meta?.["mcp.mesh"]?.tags??[]).join(", ")||"-"})]},t.id)}function _r(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(xt,{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 Tr(t){return t.message.startsWith("Missing required column:")}function Er(t){const e=he.c(19),{open:r,onOpenChange:i,title:a,isDeleting:n,onConfirm:c}=t,o=n===void 0?!1:n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx($t,{children:"Delete registry item?"}),e[0]=l):l=e[0];let m;e[1]!==a?(m=s.jsxs(Ft,{children:[l,s.jsxs(Ot,{children:["This action cannot be undone. Item ",s.jsx("strong",{children:a})," will be permanently removed from this private registry."]})]}),e[1]=a,e[2]=m):m=e[2];let u;e[3]!==o?(u=s.jsx(qt,{disabled:o,children:"Cancel"}),e[3]=o,e[4]=u):u=e[4];const p=o?"Deleting...":"Delete";let g;e[5]!==o||e[6]!==c||e[7]!==p?(g=s.jsx(Bt,{disabled:o,onClick:c,children:p}),e[5]=o,e[6]=c,e[7]=p,e[8]=g):g=e[8];let x;e[9]!==u||e[10]!==g?(x=s.jsxs(Gt,{children:[u,g]}),e[9]=u,e[10]=g,e[11]=x):x=e[11];let h;e[12]!==m||e[13]!==x?(h=s.jsxs(Kt,{children:[m,x]}),e[12]=m,e[13]=x,e[14]=h):h=e[14];let w;return e[15]!==i||e[16]!==r||e[17]!==h?(w=s.jsx(Vt,{open:r,onOpenChange:i,children:h}),e[15]=i,e[16]=r,e[17]=h,e[18]=w):w=e[18],w}function Dr(t){const[e]=t.id.split("/");return e??"provider"}function Pr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Lr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function zr(t){return t.server?.icons?.[0]?.src??null}function Ur(t){const e=he.c(56),{item:r,onEdit:i,onDelete:a}=t;let n;e[0]!==r?(n=zr(r),e[0]=r,e[1]=n):n=e[1];const c=n;let o;e[2]!==r?(o=[...Pr(r),...Lr(r)],e[2]=r,e[3]=o):o=e[3];const l=o;let m;e[4]!==l?(m=l.slice(0,3),e[4]=l,e[5]=m):m=e[5];const u=m,p=Math.max(0,l.length-u.length);let g;e[6]!==c||e[7]!==r.title?(g=s.jsx("div",{className:"size-10 rounded-lg border border-border bg-muted/20 overflow-hidden shrink-0 flex items-center justify-center",children:c?s.jsx("img",{src:c,alt:r.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:r.title.charAt(0).toUpperCase()})}),e[6]=c,e[7]=r.title,e[8]=g):g=e[8];let x;e[9]!==r.title?(x=s.jsx("p",{className:"font-medium truncate",children:r.title}),e[9]=r.title,e[10]=x):x=e[10];let h;e[11]!==r?(h=Dr(r),e[11]=r,e[12]=h):h=e[12];let w;e[13]!==h?(w=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h}),e[13]=h,e[14]=w):w=e[14];let j;e[15]!==r.is_public?(j=r.is_public?s.jsxs(Z,{variant:"default",className:"gap-1",children:[s.jsx(ms,{size:10}),"Public"]}):s.jsx(Z,{variant:"secondary",children:"Private"}),e[15]=r.is_public,e[16]=j):j=e[16];let E;e[17]!==w||e[18]!==j?(E=s.jsxs("div",{className:"flex items-center gap-2",children:[w,j]}),e[17]=w,e[18]=j,e[19]=E):E=e[19];let D;e[20]!==x||e[21]!==E?(D=s.jsxs("div",{className:"min-w-0 flex-1",children:[x,E]}),e[20]=x,e[21]=E,e[22]=D):D=e[22];let N;e[23]!==D||e[24]!==g?(N=s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g,D]}),e[23]=D,e[24]=g,e[25]=N):N=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Pt,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ds,{size:18})})}),e[26]=v):v=e[26];let I;e[27]!==r||e[28]!==i?(I=s.jsx(dt,{onClick:()=>i(r),children:"Edit"}),e[27]=r,e[28]=i,e[29]=I):I=e[29];let d;e[30]!==r||e[31]!==a?(d=()=>a(r),e[30]=r,e[31]=a,e[32]=d):d=e[32];let C;e[33]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(ft,{size:14}),e[33]=C):C=e[33];let _;e[34]!==d?(_=s.jsxs(dt,{variant:"destructive",onClick:d,children:[C,"Delete"]}),e[34]=d,e[35]=_):_=e[35];let P;e[36]!==I||e[37]!==_?(P=s.jsxs(Lt,{children:[v,s.jsxs(zt,{align:"end",children:[I,_]})]}),e[36]=I,e[37]=_,e[38]=P):P=e[38];let k;e[39]!==N||e[40]!==P?(k=s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[N,P]}),e[39]=N,e[40]=P,e[41]=k):k=e[41];const R=r._meta?.["mcp.mesh"]?.short_description||r.description||r.server.description||"No description provided.";let T;e[42]!==R?(T=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 min-h-10",children:R}),e[42]=R,e[43]=T):T=e[43];let L;e[44]!==r.id||e[45]!==u?(L=u.map(q=>s.jsx(Z,{variant:"secondary",children:q},`${r.id}-badge-${q}`)),e[44]=r.id,e[45]=u,e[46]=L):L=e[46];let z;e[47]!==p?(z=p>0&&s.jsxs(Z,{variant:"outline",children:["+",p]}),e[47]=p,e[48]=z):z=e[48];let b;e[49]!==L||e[50]!==z?(b=s.jsxs("div",{className:"flex flex-wrap gap-1",children:[L,z]}),e[49]=L,e[50]=z,e[51]=b):b=e[51];let U;return e[52]!==k||e[53]!==T||e[54]!==b?(U=s.jsxs(it,{className:"p-4 gap-4 transition-colors hover:bg-muted/50",children:[k,T,b]}),e[52]=k,e[53]=T,e[54]=b,e[55]=U):U=e[55],U}function Ss(t){const e=he.c(27),{value:r,onChange:i,onFileUpload:a,error:n,isUploading:c}=t,o=c===void 0?!1:c,[l,m]=y.useState(!1),[u,p]=y.useState(!1),g=y.useRef(null);let x;e[0]!==o?(x=R=>{R.preventDefault(),o||m(!0)},e[0]=o,e[1]=x):x=e[1];const h=x;let w;e[2]===Symbol.for("react.memo_cache_sentinel")?(w=R=>{R.preventDefault(),m(!1)},e[2]=w):w=e[2];const j=w;let E;e[3]!==o||e[4]!==a?(E=async R=>{if(R.preventDefault(),m(!1),o)return;const T=R.dataTransfer.files[0];T&&await a(T)},e[3]=o,e[4]=a,e[5]=E):E=e[5];const D=E;let N;e[6]!==o||e[7]!==a?(N=async R=>{const T=R.target.files?.[0];T&&!o&&await a(T),R.target.value=""},e[6]=o,e[7]=a,e[8]=N):N=e[8];const v=N,I=r.length>0;let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(me,{children:"Image"}),e[9]=d):d=e[9];let C;e[10]!==h||e[11]!==D||e[12]!==I||e[13]!==l||e[14]!==o||e[15]!==i||e[16]!==u||e[17]!==r?(C=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:r,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:r}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>g.current?.click(),disabled:o,children:[s.jsx(Qt,{className:"size-3"}),"Change"]}),s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 text-destructive hover:text-destructive",onClick:()=>{i(""),p(!1)},disabled:o,children:[s.jsx(ft,{className:"size-3"}),"Remove"]})]})]})]})}):o?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(nt,{className:"size-8 animate-spin text-muted-foreground"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading image..."})]}):s.jsxs("div",{className:_e("relative min-h-[180px] rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col",l?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30"),onDragOver:h,onDragLeave:j,onDrop:D,onClick:()=>g.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:_e("size-10 rounded-lg flex items-center justify-center transition-colors",l?"bg-primary/10 text-primary":"bg-muted/50 text-muted-foreground"),children:s.jsx(ys,{size:20})}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:l?"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:Mr,children:s.jsx(Se,{placeholder:"https://example.com/logo.png",value:r,className:"text-xs h-8",onChange:R=>i(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(),p(!0)},children:[s.jsx(bs,{className:"size-3"}),"Or paste an image URL"]})})]}),e[10]=h,e[11]=D,e[12]=I,e[13]=l,e[14]=o,e[15]=i,e[16]=u,e[17]=r,e[18]=C):C=e[18];let _;e[19]!==v?(_=s.jsx("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:v}),e[19]=v,e[20]=_):_=e[20];let P;e[21]!==n?(P=n&&s.jsx("p",{className:"text-xs text-destructive",children:n}),e[21]=n,e[22]=P):P=e[22];let k;return e[23]!==C||e[24]!==_||e[25]!==P?(k=s.jsxs("div",{className:"grid gap-1.5",children:[d,C,_,P]}),e[23]=C,e[24]=_,e[25]=P,e[26]=k):k=e[26],k}function Mr(t){return t.stopPropagation()}function Rs(){const[t,e]=y.useState("idle"),[r,i]=y.useState(null),{org:a}=Te(),n=ze({connectionId:Ae,orgId:a.id});return{discover:async(l,m)=>{if(!l)return null;e("loading"),i(null);try{const u=await n.callTool({name:"REGISTRY_DISCOVER_TOOLS",arguments:{url:l,type:m==="sse"?"sse":"http"}}),p=u.structuredContent??u;if(u.isError){const g=u.content?.find(x=>x.type==="text")?.text??"Tool returned an error";return i(g),e("error"),null}return p.error?Ar(p.error)?(i(p.error),e("auth_required"),null):(i(p.error),e("error"),null):!p.tools||p.tools.length===0?(i("No tools found on this MCP server."),e("error"),null):(e("success"),p.tools)}catch(u){const p=u instanceof Error?u.message:String(u);return i(p||"Could not discover tools."),e("error"),null}},discoverStatus:t,discoverError:r,resetDiscover:()=>{e("idle"),i(null)}}}function Ar(t){const e=t.toLowerCase();return e.includes("authentication")||e.includes("unauthorized")||e.includes("credentials")}function $r(t){const e=he.c(54),{tools:r,onChange:i,remoteUrl:a,remoteType:n,externalDiscoverStatus:c,externalDiscoverError:o}=t,[l,m]=y.useState(r.length>0),{discover:u,discoverStatus:p,discoverError:g,resetDiscover:x}=Rs(),h=c??p,w=o??g;let j;e[0]!==u||e[1]!==i||e[2]!==n||e[3]!==a?(j=async()=>{if(!a)return;const Y=await u(a,n??"http");Y&&(i(Y),m(!0))},e[0]=u,e[1]=i,e[2]=n,e[3]=a,e[4]=j):j=e[4];const E=j;let D;e[5]!==i||e[6]!==x?(D=()=>{i([]),x()},e[5]=i,e[6]=x,e[7]=D):D=e[7];const N=D;let v;e[8]!==l?(v=()=>m(!l),e[8]=l,e[9]=v):v=e[9];let I,d;e[10]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx(Ns,{size:14,className:"text-muted-foreground"}),d=s.jsx("span",{children:"Tools"}),e[10]=I,e[11]=d):(I=e[10],d=e[11]);let C;e[12]!==r.length?(C=r.length>0&&s.jsx(Z,{variant:"secondary",className:"text-xs px-1.5 py-0",children:r.length}),e[12]=r.length,e[13]=C):C=e[13];let _;e[14]!==l?(_=l?s.jsx(Zs,{size:14,className:"text-muted-foreground"}):s.jsx(fs,{size:14,className:"text-muted-foreground"}),e[14]=l,e[15]=_):_=e[15];let P;e[16]!==v||e[17]!==C||e[18]!==_?(P=s.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm font-medium cursor-pointer",onClick:v,children:[I,d,C,_]}),e[16]=v,e[17]=C,e[18]=_,e[19]=P):P=e[19];let k;e[20]!==N||e[21]!==r.length?(k=r.length>0&&s.jsxs($,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 text-muted-foreground",onClick:N,children:[s.jsx(ft,{size:12}),"Clear"]}),e[20]=N,e[21]=r.length,e[22]=k):k=e[22];let R;e[23]!==h||e[24]!==E||e[25]!==a||e[26]!==r.length?(R=a&&s.jsxs($,{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:E,disabled:h==="loading",children:[h==="loading"?s.jsx(nt,{size:12,className:"animate-spin"}):s.jsx(Qt,{size:12}),h==="loading"?"Discovering...":r.length>0?"Refresh":"Auto-discover"]}),e[23]=h,e[24]=E,e[25]=a,e[26]=r.length,e[27]=R):R=e[27];let T;e[28]!==R||e[29]!==k?(T=s.jsxs("div",{className:"flex items-center gap-2",children:[k,R]}),e[28]=R,e[29]=k,e[30]=T):T=e[30];let L;e[31]!==T||e[32]!==P?(L=s.jsxs("div",{className:"flex items-center justify-between",children:[P,T]}),e[31]=T,e[32]=P,e[33]=L):L=e[33];let z;e[34]!==h||e[35]!==r.length?(z=h==="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(pt,{size:14,className:"shrink-0"}),s.jsxs("span",{children:["Discovered ",r.length," tool",r.length!==1?"s":""," ","successfully."]})]}),e[34]=h,e[35]=r.length,e[36]=z):z=e[36];let b;e[37]!==w||e[38]!==h?(b=h==="error"&&w&&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(xt,{size:14,className:"shrink-0"}),s.jsx("span",{children:w})]}),e[37]=w,e[38]=h,e[39]=b):b=e[39];let U;e[40]!==l||e[41]!==r?(U=l&&r.length>0&&s.jsx("div",{className:"rounded-xl border border-border divide-y divide-border overflow-hidden max-h-48 overflow-y-auto",children:r.map(Fr)}),e[40]=l,e[41]=r,e[42]=U):U=e[42];let q;e[43]!==h||e[44]!==l||e[45]!==a||e[46]!==r.length?(q=l&&r.length===0&&h==="idle"&&s.jsx("p",{className:"text-xs text-muted-foreground px-1",children:a?'Click "Auto-discover" to load tools from the MCP server.':"Add a Remote URL first, then tools can be auto-discovered."}),e[43]=h,e[44]=l,e[45]=a,e[46]=r.length,e[47]=q):q=e[47];let Q;return e[48]!==L||e[49]!==z||e[50]!==b||e[51]!==U||e[52]!==q?(Q=s.jsxs("div",{className:"space-y-3",children:[L,z,b,U,q]}),e[48]=L,e[49]=z,e[50]=b,e[51]=U,e[52]=q,e[53]=Q):Q=e[53],Q}function Fr(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 ks(t){const{org:e}=Te(),[r,i]=y.useState(!1),n=typeof window<"u"&&window.location.hostname==="localhost"?`${e.id}_dev-assets`:null,c=ze({connectionId:n??"noop",orgId:e.id});return{uploadImage:async(l,m)=>{if(!n)return ne.error("Image upload requires an object-storage connection. Configure one in plugin settings."),null;if(!l.type.startsWith("image/"))return ne.error("Only image files are supported"),null;if(l.size>5*1024*1024)return ne.error("Image size must be less than 5MB"),null;i(!0);try{const u=await c.callTool({name:"PUT_PRESIGNED_URL",arguments:{key:m,contentType:l.type}}),p=u.structuredContent?.url||u.url;if(!p)throw new Error("Failed to get presigned URL");const g=await fetch(p,{method:"PUT",body:l,headers:{"Content-Type":l.type}});if(!g.ok)throw new Error(`Upload failed: ${g.statusText}`);const x=await c.callTool({name:"GET_PRESIGNED_URL",arguments:{key:m,expiresIn:31536e3}}),h=x.structuredContent?.url||x.url;if(!h)throw new Error("Failed to get public URL");return h}catch(u){return console.error("Image upload failed:",u),ne.error(u instanceof Error?u.message:"Failed to upload image. Please try again."),null}finally{i(!1)}},isUploading:r}}function Or(){const{org:t}=Te(),[e,r]=y.useState(null),i=y.useRef(0),a=ze({connectionId:Ae,orgId:t.id});return{generate:async c=>{i.current+=1,r(c.type);try{const o=await a.callTool({name:"REGISTRY_AI_GENERATE",arguments:c});if(o.isError){const l=o.content?.find(m=>m.type==="text")?.text??"Failed to generate content";throw new Error(l)}return o.structuredContent??o}finally{i.current-=1,i.current===0&&r(null)}},loadingType:e,isGenerating:e!==null}}const qr=new Set(["http","sse","stdio"]),Br=/^[a-z0-9]+(?:[/-][a-z0-9._-]+)*$/,rs=["internal","automation","support","sales","ops","ai"],Is=["productivity","communication","customer-support","development","data","operations"],Gr=["Essentials","Details","Advanced"],ot="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 is(t){return t.replace(/^https?:\/\//i,"").trim()}function ct(t){const e=t.trim();return e?/^https?:\/\//i.test(e)?e:`https://${e}`:""}function Xe(t){return t.trim().toLowerCase()}function ht(t){return Array.from(new Set(t.map(Xe).filter(e=>e.length>0)))}function rt(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Kr(t){const e=he.c(4),{current:r}=t;let i;e[0]!==r?(i=Gr.map((n,c)=>{const o=c+1,l=o===r,m=o<r;return s.jsxs("div",{className:"flex items-center gap-1.5",children:[c>0&&s.jsx("div",{className:_e("w-4 h-px",m?"bg-primary":"bg-border")}),s.jsxs("div",{className:_e("flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs transition-colors",l?"bg-primary/10 text-primary font-medium":m?"text-primary":"text-muted-foreground"),children:[s.jsx("span",{className:_e("size-5 rounded-full inline-flex items-center justify-center text-[10px] font-semibold shrink-0",l?"bg-primary text-primary-foreground":m?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:o}),s.jsx("span",{className:"hidden sm:inline",children:n})]})]},n)}),e[0]=r,e[1]=i):i=e[1];let a;return e[2]!==i?(a=s.jsx("div",{className:"flex items-center gap-1.5",children:i}),e[2]=i,e[3]=a):a=e[3],a}function Vr(t){const e=he.c(28),{id:r,label:i,values:a,availableOptions:n,placeholder:c,onChange:o}=t,[l,m]=y.useState(""),[u,p]=y.useState(!1);let g,x,h,w,j;if(e[0]!==n||e[1]!==r||e[2]!==l||e[3]!==u||e[4]!==i||e[5]!==o||e[6]!==c||e[7]!==a){const N=ht(n),v=ht(a),I=new Set(v),d=Xe(l),C=N.filter(b=>!I.has(b)).filter(b=>d?b.includes(d):!0).slice(0,8),_=b=>{const U=Xe(b);!U||I.has(U)||o([...v,U])},P=b=>{o(v.filter(U=>U!==b))},k=()=>{const b=l.split(/[,\n;]/).map(Xe).filter(Boolean);if(b.length===0)return;const U=[...v];for(const q of b)U.includes(q)||U.push(q);o(U),m("")},R=d;w="grid gap-2",e[13]!==r||e[14]!==i?(j=s.jsx(me,{htmlFor:r,children:i}),e[13]=r,e[14]=i,e[15]=j):j=e[15],g="relative";let T;e[16]!==r?(T=()=>{const b=document.getElementById(r);b instanceof HTMLInputElement&&b.focus()},e[16]=r,e[17]=T):T=e[17];let L;e[18]===Symbol.for("react.memo_cache_sentinel")?(L=()=>p(!0),e[18]=L):L=e[18];let z;e[19]===Symbol.for("react.memo_cache_sentinel")?(z=b=>m(b.target.value),e[19]=z):z=e[19],x=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:T,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[v.map(b=>s.jsxs(Z,{variant:"secondary",className:"gap-1",children:[b,s.jsx("button",{type:"button",onClick:U=>{U.preventDefault(),U.stopPropagation(),P(b)},children:s.jsx(tr,{size:12})})]},`${r}-${b}`)),s.jsx("input",{id:r,className:"flex-1 min-w-[120px] bg-transparent outline-none border-none text-sm",placeholder:v.length?"":c,value:l,onFocus:L,onBlur:()=>{p(!1),k()},onChange:z,onKeyDown:b=>{if(b.key==="Enter"||b.key===","){b.preventDefault(),k();return}b.key==="Backspace"&&!l&&v.length&&P(v[v.length-1]??"")}})]})}),h=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:C.length>0?C.map(b=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Yr,onClick:()=>{_(b),m("")},children:b},`${r}-suggestion-${b}`)):R?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:Qr,onClick:()=>{_(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]=n,e[1]=r,e[2]=l,e[3]=u,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=g,e[9]=x,e[10]=h,e[11]=w,e[12]=j}else g=e[8],x=e[9],h=e[10],w=e[11],j=e[12];let E;e[20]!==g||e[21]!==x||e[22]!==h?(E=s.jsxs("div",{className:g,children:[x,h]}),e[20]=g,e[21]=x,e[22]=h,e[23]=E):E=e[23];let D;return e[24]!==w||e[25]!==j||e[26]!==E?(D=s.jsxs("div",{className:w,children:[j,E]}),e[24]=w,e[25]=j,e[26]=E,e[27]=D):D=e[27],D}function Qr(t){return t.preventDefault()}function Yr(t){return t.preventDefault()}function Hr({id:t,value:e,availableOptions:r,onChange:i}){const[a,n]=y.useState(e),[c,o]=y.useState(!1),l=y.useRef(e);l.current!==e&&(l.current=e,n(e));const m=ht([...Is,...r,e]).filter(Boolean),u=Xe(a),p=m.filter(x=>u?x.includes(u):!0).slice(0,8),g=x=>{const h=Xe(x);i(h),n(h),o(!1)};return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(me,{htmlFor:t,children:"Category"}),s.jsxs("div",{className:"relative",children:[s.jsx(Se,{id:t,className:"h-9 text-sm",placeholder:"Select or create category",value:a,onFocus:()=>{n(e),o(!0)},onBlur:()=>{g(a)},onChange:x=>n(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),g(a))}}),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:x=>x.preventDefault(),onClick:()=>{i(""),n("")},children:"clear"}),c&&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:p.length>0?p.map(x=>s.jsx("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:h=>h.preventDefault(),onClick:()=>g(x),children:x},`${t}-${x}`)):u?s.jsxs("button",{type:"button",className:"w-full text-left px-2.5 py-1.5 text-sm hover:bg-muted",onMouseDown:x=>x.preventDefault(),onClick:()=>g(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 Wr({open:t,onOpenChange:e,item:r,draft:i,availableTags:a=[],availableCategories:n=[],defaultLLMConnectionId:c="",defaultLLMModelId:o="",isSubmitting:l=!1,onSubmit:m}){const{org:u}=Te(),{uploadImage:p,isUploading:g}=ks(),{generate:x,loadingType:h}=Or(),{discover:w,discoverStatus:j,discoverError:E,resetDiscover:D}=Rs(),N=!!r,v=i?._meta?.["mcp.mesh"],I=r?.title??i?.title??"",d=r?.id?.split("/")[0]??i?.id?.split("/")[0]??"",C=r?.description??i?.description??"",_=r?._meta?.["mcp.mesh"]?.short_description??v?.short_description??"",P=r?._meta?.["mcp.mesh"]?.owner??v?.owner??"",k=r?.server?.repository?.url??i?.server?.repository?.url??"",R=r?._meta?.["mcp.mesh"]?.readme??v?.readme??"",T=r?._meta?.["mcp.mesh"]?.readme_url??v?.readme_url??"",L=is(r?.server?.remotes?.[0]?.url??i?.server?.remotes?.[0]?.url??""),z=r?.server?.remotes?.[0]?.type??i?.server?.remotes?.[0]?.type??"http",b=r?._meta?.["mcp.mesh"]?.tags??v?.tags??[],U=r?._meta?.["mcp.mesh"]?.categories?.[0]??v?.categories?.[0]??"",q=r?.server?.icons?.[0]?.src??i?.server?.icons?.[0]?.src??"",Q=r?._meta?.["mcp.mesh"]?.tools??v?.tools??[],Y=r?.is_public??i?.is_public??!1,[F,G]=y.useState(1),[K,ee]=y.useState(I),[te,se]=y.useState(d),[B,re]=y.useState(C),[H,le]=y.useState(_),[ie,J]=y.useState(P),[X,V]=y.useState(k),[xe,ye]=y.useState(R),[ue,be]=y.useState(T),[ae,pe]=y.useState(R?"content":"link"),[W,je]=y.useState(L),[f,O]=y.useState(z),[ge,ce]=y.useState(b),[we,Ee]=y.useState(U),[Ce,Ue]=y.useState(q),[fe,Ge]=y.useState(Q),[Ke,et]=y.useState(Y),[oe,Le]=y.useState({}),Re=!!(c&&o),Ve=()=>{G(1),ee(I),se(d),re(C),le(_),J(P),V(k),ye(R),be(T),pe(R?"content":"link"),je(L),O(z),ce(b),Ee(U),Ue(q),Ge(Q),et(Y),Le({}),D(),Me.current="",ke.current&&(clearTimeout(ke.current),ke.current=null)},lt=async S=>{if(!S)return;const M=N?r?.id:`${te}/${K}`.toLowerCase(),Ie=rt(M||"temp"),Oe=S.name.split(".").pop()||"png",qe=`registry/${u.id}/${Ie}/icon.${Oe}`,st=await p(S,qe);st?(Ue(st),Le(Be=>({...Be,imageUrl:void 0}))):Le(Be=>({...Be,imageUrl:"Failed to upload image. Please try again."}))},ke=y.useRef(null),Me=y.useRef(""),Ye=y.useRef(f);Ye.current=f;const tt=S=>{!S&&ke.current&&(clearTimeout(ke.current),ke.current=null),e(S),S||Ve()},He=async()=>{const S=ct(W);if(!S)return;Me.current=S;const M=await w(S,Ye.current);M&&Ge(M)},We=S=>{ke.current&&clearTimeout(ke.current);const M=ct(S);!M||M===Me.current||S.includes(".")&&(ke.current=setTimeout(async()=>{Me.current=M;const Ie=await w(M,Ye.current);Ie&&Ge(Ie)},800))},$e=()=>Re?{llmConnectionId:c,modelId:o}:null,Fe=()=>({name:K.trim(),provider:te.trim(),url:ct(W),owner:ie.trim(),repositoryUrl:X.trim(),description:B.trim(),shortDescription:H.trim(),tags:ge,categories:we?[we]:[],availableTags:[...rs,...a],availableCategories:[...Is,...n],tools:fe}),Ze=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"description",context:Fe()});M.result&&re(M.result.slice(0,1500))},Je=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"short_description",context:Fe()});M.result&&le(M.result.slice(0,160))},A=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"tags",context:Fe()});M.items?.length&&ce(ht(M.items))},ve=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"categories",context:Fe()});M.items?.[0]&&Ee(Xe(M.items[0]))},at=async()=>{const S=$e();if(!S)return;const M=await x({...S,type:"readme",context:Fe()});M.result&&(ye(M.result.slice(0,5e4)),pe("content"))},Ht=S=>{const M={};if(S===1){const Ie=rt(te),Oe=rt(K),qe=`${Ie}/${Oe}`;K.trim()||(M.title="Name is required."),N||(Ie?Oe?Br.test(qe)||(M.provider="Use lowercase letters/numbers and separators '/' or '-'."):M.title="Name must contain valid characters.":M.provider="Provider is required.");const st=ct(W),Be=f.trim().toLowerCase();if(Be!=="stdio"&&st)try{const mt=new URL(st);["http:","https:"].includes(mt.protocol)||(M.remoteUrl="Remote URL must be http(s).")}catch{M.remoteUrl="Remote URL is invalid."}if(Be&&!qr.has(Be)&&(M.remoteType="Remote type must be: http, sse or stdio."),Ce.trim()&&!Ce.trim().startsWith("data:image/"))try{const kt=new URL(Ce.trim());["http:","https:"].includes(kt.protocol)||(M.imageUrl="Image URL must be http(s).")}catch{M.imageUrl="Image URL is invalid."}}if(S===2&&(B.length>1500&&(M.description="Description must be 1500 characters or less."),H.trim().length>160&&(M.shortDescription="Short description must be 160 characters or less.")),S===3){const Ie=ue.trim();if(Ie)try{const qe=new URL(Ie);["http:","https:"].includes(qe.protocol)||(M.readmeUrl="README URL must be http(s).")}catch{M.readmeUrl="README URL is invalid."}xe.trim().length>5e4&&(M.readme="README must be 50 000 characters or less.");const Oe=X.trim();if(Oe)try{const qe=new URL(Oe);["http:","https:"].includes(qe.protocol)||(M.repositoryUrl="Repository URL must be http(s).")}catch{M.repositoryUrl="Repository URL is invalid."}}return Le(M),Object.values(M).every(Ie=>Ie===void 0)},_s=()=>{Ht(F)&&F<3&&G(F+1)},Ts=()=>{F>1&&G(F-1)},Es=async()=>{if(!Ht(3))return;const S=K.trim(),M=rt(te),Ie=rt(S),Oe=`${M}/${Ie}`,qe=ct(W),st=f.trim().toLowerCase(),Be=Ce.trim(),mt=X.trim(),kt=H.trim(),zs=xe.trim(),Us=ue.trim(),Ms=ht(ge),As=we?[Xe(we)]:[],$s=r?r.server?.name??r.id:"",Fs=(N?$s:Oe).trim(),It=B.trim(),Os=ie.trim(),Wt={title:S,description:It.length>0?It:null,is_public:Ke,_meta:{"mcp.mesh":{tags:Ms,categories:As,short_description:kt||null,owner:Os||null,readme:zs||null,readme_url:Us||null,...fe.length>0?{tools:fe}:{}}},server:{name:Fs,title:S,description:It||void 0,icons:Be?[{src:Be}]:[],repository:mt?{url:mt}:void 0,remotes:qe?[{type:st||"http",url:qe}]:[]}};if(N&&r){await m({id:r.id,data:Wt}),e(!1);return}await m({id:Oe,...Wt}),e(!1),Ve()},Ds=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(me,{htmlFor:"registry-item-provider",children:"Provider"}),s.jsx(Se,{id:"registry-item-provider",className:"h-9 text-sm",placeholder:"acme",value:te,onChange:S=>se(S.target.value),disabled:N}),!N&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Item ID:"," ",s.jsx("span",{className:"font-mono",children:`${rt(te)||"provider"}/${rt(K)||"name"}`})]}),oe.provider&&s.jsx("p",{className:"text-xs text-destructive",children:oe.provider})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{htmlFor:"registry-item-title",children:"Name"}),s.jsx(Se,{id:"registry-item-title",className:"h-9 text-sm",placeholder:"Internal MCP",value:K,onChange:S=>ee(S.target.value)}),oe.title&&s.jsx("p",{className:"text-xs text-destructive",children:oe.title})]})]}),s.jsx("div",{className:"row-span-2 content-start",children:s.jsx(Ss,{value:Ce,onChange:S=>{Ue(S),Le(M=>({...M,imageUrl:void 0}))},onFileUpload:lt,error:oe.imageUrl,isUploading:g})}),s.jsxs("div",{className:"col-span-2 grid gap-1.5",children:[s.jsx(me,{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:W,onChange:S=>{const M=is(S.target.value);je(M),We(M)}})]}),s.jsxs(xs,{value:f,onValueChange:O,children:[s.jsx(hs,{id:"registry-remote-type",className:"w-[90px] h-9 shrink-0",children:s.jsx(ps,{placeholder:"Type"})}),s.jsxs(gs,{children:[s.jsx(jt,{value:"http",children:"http"}),s.jsx(jt,{value:"sse",children:"sse"}),s.jsx(jt,{value:"stdio",children:"stdio"})]})]})]}),oe.remoteUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.remoteUrl}),oe.remoteType&&s.jsx("p",{className:"text-xs text-destructive",children:oe.remoteType})]}),W.trim()&&s.jsxs("div",{className:"col-span-2 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs($,{type:"button",variant:"outline",size:"sm",className:_e(ot,"gap-1.5"),onClick:He,disabled:j==="loading",children:[j==="loading"?s.jsx(nt,{size:12,className:"animate-spin"}):s.jsx(Qt,{size:12}),j==="loading"?"Discovering tools...":fe.length>0?"Re-discover tools":"Discover tools from URL"]}),fe.length>0&&j!=="loading"&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:[fe.length," tool",fe.length!==1?"s":""," loaded"]})]}),j==="success"&&fe.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(pt,{size:14,className:"shrink-0"}),s.jsxs("span",{className:"font-medium",children:[fe.length," tool",fe.length!==1?"s":""," discovered"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[fe.slice(0,8).map(S=>s.jsx(Z,{variant:"secondary",className:"text-[10px] px-1.5 py-0 font-mono",children:S.name},S.name)),fe.length>8&&s.jsxs("span",{className:"text-[10px] text-muted-foreground self-center",children:["+",fe.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"&&E&&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(xt,{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"&&E&&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(xt,{size:14,className:"shrink-0"}),s.jsx("span",{children:E})]})]})]}),Ps=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(me,{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:[H.length,"/160"]}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="short_description",onClick:Je,children:h==="short_description"?"Generating...":"AI Generate"})]})]}),s.jsx(Se,{id:"registry-item-short-description",className:"h-9 text-sm",placeholder:"Short summary for the store card",value:H,maxLength:160,onChange:S=>le(S.target.value)}),oe.shortDescription&&s.jsx("p",{className:"text-xs text-destructive",children:oe.shortDescription})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(me,{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:[B.length,"/1500"]}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="description",onClick:Ze,children:h==="description"?"Generating...":"AI Generate"})]})]}),s.jsx(Mt,{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:B,onChange:S=>re(S.target.value)}),oe.description&&s.jsx("p",{className:"text-xs text-destructive",children:oe.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(Hr,{id:"registry-category",value:we,availableOptions:n,onChange:Ee}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:_e(ot,"justify-self-start"),disabled:h==="categories",onClick:ve,children:h==="categories"?"Suggesting...":"AI Suggest"})]}),s.jsxs("div",{className:"grid content-start gap-2",children:[s.jsx(Vr,{id:"registry-tags",label:"Tags",values:ge,availableOptions:[...rs,...a],placeholder:"Type and press Enter or comma",onChange:ce}),Re&&s.jsx($,{type:"button",variant:"outline",size:"sm",className:_e(ot,"justify-self-start"),disabled:h==="tags",onClick:A,children:h==="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(me,{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(Ut,{id:"registry-is-public",checked:Ke,onCheckedChange:et})]})]}),Ls=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(me,{htmlFor:"registry-item-owner",children:"Owner (optional)"}),s.jsx(Se,{id:"registry-item-owner",className:"h-9 text-sm",placeholder:"Team, company, or responsible person",value:ie,onChange:S=>J(S.target.value)})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{htmlFor:"registry-item-repository-url",children:"Repository URL (optional)"}),s.jsx(Se,{id:"registry-item-repository-url",className:"h-9 text-sm",placeholder:"https://github.com/org/repo",value:X,onChange:S=>V(S.target.value)}),oe.repositoryUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.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(me,{children:"README"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[xe.length,"/50000"]})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:(Re?["link","content","generate"]:["link","content"]).map(S=>s.jsx("button",{type:"button",className:_e("px-2.5 py-1 text-xs rounded-md",ae===S?"bg-primary text-primary-foreground":"text-muted-foreground"),onClick:()=>pe(S),children:S==="link"?"Link":S==="content"?"Content":"Generate"},S))}),ae==="link"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Se,{className:"h-9 text-sm",placeholder:"https://raw.githubusercontent.com/org/repo/main/README.md",value:ue,onChange:S=>be(S.target.value)}),oe.readmeUrl&&s.jsx("p",{className:"text-xs text-destructive",children:oe.readmeUrl})]}),ae==="content"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(Mt,{className:"text-sm max-h-48 overflow-y-auto resize-none",placeholder:`# README
4
4
 
5
- Describe your MCP here...`,rows:6,value:xe,onChange:S=>ye(S.target.value)}),oe.readme&&s.jsx("p",{className:"text-xs text-destructive",children:oe.readme})]}),Re&&ae==="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($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="readme",onClick:at,children:h==="readme"?"Generating...":"Generate with AI"})]})]}),s.jsx($r,{tools:fe,onChange:Ge,remoteUrl:ct(W)||void 0,remoteType:f,externalDiscoverStatus:j,externalDiscoverError:E})]});return s.jsx(St,{open:t,onOpenChange:tt,children:s.jsxs(Ct,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(yt,{className:"space-y-3",children:[s.jsx(bt,{children:N?"Edit MCP Server":"Add MCP Server"}),s.jsx(Kr,{current:F}),s.jsxs(Nt,{children:[F===1&&"Set up the identity, connection and discover available tools.",F===2&&"Add descriptions, categories and tags to help discovery.",F===3&&"Configure optional metadata, README and tools."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[F===1&&Ds,F===2&&Ps,F===3&&Ls]}),s.jsxs(wt,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[s.jsx("div",{children:F>1&&s.jsxs($,{variant:"ghost",size:"sm",onClick:Ts,children:[s.jsx(Js,{size:14}),"Back"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($,{variant:"outline",size:"sm",onClick:()=>tt(!1),disabled:l,children:"Cancel"}),F<3?s.jsxs($,{size:"sm",onClick:_s,children:["Next",s.jsx(Xs,{size:14})]}):s.jsx($,{size:"sm",onClick:Es,disabled:l,children:l?"Saving...":N?"Save changes":"Create"})]})]})]})})}function ns(t,e){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Zr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Jr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function Xr(t){return t.server?.remotes?.[0]?.url??"-"}function ei(){const t=he.c(120),[e,r]=v.useState(""),i=v.useDeferredValue(e);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[n,c]=v.useState(a);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[1]=o):o=t[1];const[l,m]=v.useState(o),[u,p]=v.useState(!1),[g,x]=v.useState(!1),[h,w]=v.useState(null),[j,E]=v.useState(null),[D,N]=Ys("private-registry-list","cards"),y=v.useRef(null);let I;t[2]!==i||t[3]!==l||t[4]!==n?(I={search:i,tags:n,categories:l},t[2]=i,t[3]=l,t[4]=n,t[5]=I):I=t[5];const d=ws(I),C=pr(),{registryLLMConnectionId:_,registryLLMModelId:P}=Yt(At),{createMutation:k,updateMutation:R,deleteMutation:T,bulkCreateMutation:L}=Cs();let z,b,U,q,Q,Y,F,G;if(t[6]!==k||t[7]!==T||t[8]!==j||t[9]!==C.data||t[10]!==d||t[11]!==i||t[12]!==e||t[13]!==l||t[14]!==n||t[15]!==N||t[16]!==R||t[17]!==D){const ae=d.data?.pages.flatMap(ni).filter(Boolean)??[],pe=d.data?.pages[0]?.totalCount??ae.length,W=n.length>0||l.length>0||i.length>0,je=C.data;let f;t[26]!==je?(f=Array.isArray(je?.tags)?je.tags:[],t[26]=je,t[27]=f):f=t[27],G=f;let O;t[28]!==je?(O=Array.isArray(je?.categories)?je.categories:[],t[28]=je,t[29]=O):O=t[29],z=O;let ge;t[30]!==d?(ge=A=>{y.current&&(y.current.disconnect(),y.current=null),!(!A||!d.hasNextPage||d.isFetchingNextPage)&&(y.current=new IntersectionObserver(ve=>{ve[0]?.isIntersecting&&d.hasNextPage&&!d.isFetchingNextPage&&d.fetchNextPage()},{rootMargin:"240px 0px"}),y.current.observe(A))},t[30]=d,t[31]=ge):ge=t[31];const ce=ge;let we;t[32]!==k||t[33]!==R?(we=async A=>{try{"data"in A?(await R.mutateAsync(A),ne.success("Registry item updated")):(await k.mutateAsync(A),ne.success("Registry item created"))}catch(ve){const at=ve;throw ne.error(at instanceof Error?at.message:"Failed to save item"),at}},t[32]=k,t[33]=R,t[34]=we):we=t[34],b=we;let Te;t[35]!==T||t[36]!==j?(Te=async()=>{if(j)try{await T.mutateAsync(j.id),ne.success("Registry item deleted"),E(null)}catch(A){const ve=A;ne.error(ve instanceof Error?ve.message:"Failed to delete item")}},t[35]=T,t[36]=j,t[37]=Te):Te=t[37],U=Te,Y="h-full flex flex-col";let Ce;t[38]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t[38]=Ce):Ce=t[38];const Ue=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[Ce,s.jsx(Z,{variant:"secondary",className:"text-xs",children:pe})]});let fe;t[39]===Symbol.for("react.memo_cache_sentinel")?(fe=s.jsx(Pt,{asChild:!0,children:s.jsxs($,{variant:"outline",size:"sm",className:Pe("h-8","gap-1.5"),children:[s.jsx(Hs,{size:14}),"Filters"]})}),t[39]=fe):fe=t[39];let Ge;t[40]===Symbol.for("react.memo_cache_sentinel")?(Ge=s.jsx(Jt,{children:"Tags"}),t[40]=Ge):Ge=t[40];let Ke;t[41]!==n||t[42]!==G?(Ke=G.length>0?G.map(A=>s.jsxs(Zt,{checked:n.includes(A.value),onCheckedChange:()=>c(ve=>ns(ve,A.value)),children:[A.value," (",A.count,")"]},A.value)):s.jsx(dt,{disabled:!0,children:"No tags available"}),t[41]=n,t[42]=G,t[43]=Ke):Ke=t[43];let et,oe;t[44]===Symbol.for("react.memo_cache_sentinel")?(et=s.jsx(Vs,{}),oe=s.jsx(Jt,{children:"Categories"}),t[44]=et,t[45]=oe):(et=t[44],oe=t[45]);let Le;t[46]!==z||t[47]!==l?(Le=z.length>0?z.map(A=>s.jsxs(Zt,{checked:l.includes(A.value),onCheckedChange:()=>m(ve=>ns(ve,A.value)),children:[A.value," (",A.count,")"]},A.value)):s.jsx(dt,{disabled:!0,children:"No categories available"}),t[46]=z,t[47]=l,t[48]=Le):Le=t[48];let Re;t[49]!==Ke||t[50]!==Le?(Re=s.jsxs(Lt,{children:[fe,s.jsxs(zt,{align:"end",className:"w-[260px]",children:[Ge,Ke,et,oe,Le]})]}),t[49]=Ke,t[50]=Le,t[51]=Re):Re=t[51];let Ve;t[52]!==N?(Ve=A=>{(A==="cards"||A==="table")&&N(A)},t[52]=N,t[53]=Ve):Ve=t[53];let lt,ke;t[54]===Symbol.for("react.memo_cache_sentinel")?(lt=s.jsx(Xt,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),ke=s.jsx(Xt,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"}),t[54]=lt,t[55]=ke):(lt=t[54],ke=t[55]);let Me;t[56]!==Ve||t[57]!==D?(Me=s.jsxs(Qs,{type:"single",value:D,onValueChange:Ve,variant:"outline",className:"h-8",children:[lt,ke]}),t[56]=Ve,t[57]=D,t[58]=Me):Me=t[58];let Ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(Ye=s.jsx($,{variant:"outline",size:"sm",className:"h-8",onClick:()=>x(!0),children:"Import CSV"}),t[59]=Ye):Ye=t[59];let tt;t[60]===Symbol.for("react.memo_cache_sentinel")?(tt=s.jsx($,{size:"sm",className:"h-8",onClick:()=>p(!0),children:"Add MCP Servers"}),t[60]=tt):tt=t[60];let He;t[61]!==Re||t[62]!==Me?(He=s.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[Re,Me,Ye,tt]}),t[61]=Re,t[62]=Me,t[63]=He):He=t[63];let We;t[64]!==Ue||t[65]!==He?(We=s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[Ue,He]}),t[64]=Ue,t[65]=He,t[66]=We):We=t[66];let $e;t[67]===Symbol.for("react.memo_cache_sentinel")?($e=s.jsx(us,{size:16,className:"text-muted-foreground shrink-0"}),t[67]=$e):$e=t[67];let Fe;t[68]===Symbol.for("react.memo_cache_sentinel")?(Fe=A=>r(A.target.value),t[68]=Fe):Fe=t[68];let Ze;t[69]!==e?(Ze=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:[$e,s.jsx(Se,{value:e,onChange:Fe,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]=Ze):Ze=t[70];let Je;t[71]!==W||t[72]!==e||t[73]!==l||t[74]!==n?(Je=W&&s.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[n.map(ii),l.map(ri),e.trim()&&s.jsxs(Z,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),s.jsx($,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{r(""),c([]),m([])},children:"Clear filters"})]}),t[71]=W,t[72]=e,t[73]=l,t[74]=n,t[75]=Je):Je=t[75],t[76]!==We||t[77]!==Ze||t[78]!==Je?(F=s.jsxs("div",{className:"shrink-0 border-b border-border",children:[We,Ze,Je]}),t[76]=We,t[77]=Ze,t[78]=Je,t[79]=F):F=t[79],q="flex-1 overflow-auto px-4 md:px-6 py-4",Q=ae.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:d.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(nt,{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:W?"No items found":"No MCPs in your registry"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:W?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!W&&s.jsx($,{size:"lg",onClick:()=>p(!0),children:"Add MCP Servers"})]})}):D==="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:ae.map(A=>s.jsx(Ur,{item:A,onEdit:w,onDelete:E},A.id))}),d.hasNextPage&&s.jsx("div",{ref:ce,className:"h-2"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"border rounded-lg overflow-auto",children:s.jsxs(as,{children:[s.jsx(os,{children:s.jsxs(vt,{children:[s.jsx(Ee,{className:"w-[56px]",children:"Icon"}),s.jsx(Ee,{children:"Title"}),s.jsx(Ee,{children:"ID"}),s.jsx(Ee,{children:"Tags"}),s.jsx(Ee,{children:"Categories"}),s.jsx(Ee,{children:"Remote URL"}),s.jsx(Ee,{children:"Visibility"}),s.jsx(Ee,{className:"text-right w-[68px]",children:"Actions"})]})}),s.jsx(cs,{children:ae.map(A=>s.jsxs(vt,{children:[s.jsx(De,{children:s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:A.server?.icons?.[0]?.src?s.jsx("img",{src:A.server.icons[0].src,alt:A.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:A.title.charAt(0).toUpperCase()})})}),s.jsx(De,{children:A.title}),s.jsx(De,{className:"font-mono",children:A.id}),s.jsx(De,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Zr(A).slice(0,3).map(ve=>s.jsx(Z,{variant:"outline",children:ve},`${A.id}-tag-${ve}`))})}),s.jsx(De,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Jr(A).slice(0,3).map(ve=>s.jsx(Z,{variant:"outline",children:ve},`${A.id}-category-${ve}`))})}),s.jsx(De,{children:Xr(A)}),s.jsx(De,{children:A.is_public?s.jsxs(Z,{variant:"default",className:"gap-1",children:[s.jsx(ms,{size:10}),"Public"]}):s.jsx(Z,{variant:"secondary",children:"Private"})}),s.jsx(De,{className:"text-right",children:s.jsxs(Lt,{children:[s.jsx(Pt,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ds,{size:18})})}),s.jsxs(zt,{align:"end",children:[s.jsx(dt,{onClick:()=>w(A),children:"Edit"}),s.jsx(dt,{variant:"destructive",onClick:()=>E(A),children:"Delete"})]})]})})]},A.id))})]})}),d.hasNextPage&&s.jsx("div",{ref:ce,className:"h-2"})]}),t[6]=k,t[7]=T,t[8]=j,t[9]=C.data,t[10]=d,t[11]=i,t[12]=e,t[13]=l,t[14]=n,t[15]=N,t[16]=R,t[17]=D,t[18]=z,t[19]=b,t[20]=U,t[21]=q,t[22]=Q,t[23]=Y,t[24]=F,t[25]=G}else z=t[18],b=t[19],U=t[20],q=t[21],Q=t[22],Y=t[23],F=t[24],G=t[25];let K;t[80]!==d.isFetchingNextPage?(K=d.isFetchingNextPage&&s.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(nt,{className:"size-4 animate-spin"}),"Loading more items..."]}),t[80]=d.isFetchingNextPage,t[81]=K):K=t[81];let ee;t[82]!==q||t[83]!==Q||t[84]!==K?(ee=s.jsxs("div",{className:q,children:[Q,K]}),t[82]=q,t[83]=Q,t[84]=K,t[85]=ee):ee=t[85];const te=h?.id??"create",se=u||!!h;let B;t[86]===Symbol.for("react.memo_cache_sentinel")?(B=ae=>{ae||(p(!1),w(null))},t[86]=B):B=t[86];let re;t[87]!==G?(re=G.map(si),t[87]=G,t[88]=re):re=t[88];let H;t[89]!==z?(H=z.map(ti),t[89]=z,t[90]=H):H=t[90];const le=k.isPending||R.isPending;let ie;t[91]!==h||t[92]!==b||t[93]!==_||t[94]!==P||t[95]!==se||t[96]!==re||t[97]!==H||t[98]!==le||t[99]!==te?(ie=s.jsx(Wr,{open:se,onOpenChange:B,item:h,availableTags:re,availableCategories:H,defaultLLMConnectionId:_,defaultLLMModelId:P,isSubmitting:le,onSubmit:b},te),t[91]=h,t[92]=b,t[93]=_,t[94]=P,t[95]=se,t[96]=re,t[97]=H,t[98]=le,t[99]=te,t[100]=ie):ie=t[100];let J;t[101]!==L?(J=async ae=>{try{const pe=await L.mutateAsync(ae);return ne.success(`Imported ${pe.created} item(s)`),pe}catch(pe){const W=pe;throw ne.error(W instanceof Error?W.message:"Failed to import CSV"),W}},t[101]=L,t[102]=J):J=t[102];let X;t[103]!==L.isPending||t[104]!==g||t[105]!==J?(X=s.jsx(Rr,{open:g,onOpenChange:x,isImporting:L.isPending,onImport:J}),t[103]=L.isPending,t[104]=g,t[105]=J,t[106]=X):X=t[106];const V=!!j;let xe;t[107]===Symbol.for("react.memo_cache_sentinel")?(xe=ae=>{ae||E(null)},t[107]=xe):xe=t[107];const ye=j?.title??j?.id??"";let ue;t[108]!==T.isPending||t[109]!==U||t[110]!==V||t[111]!==ye?(ue=s.jsx(Er,{open:V,onOpenChange:xe,title:ye,isDeleting:T.isPending,onConfirm:U}),t[108]=T.isPending,t[109]=U,t[110]=V,t[111]=ye,t[112]=ue):ue=t[112];let be;return t[113]!==ie||t[114]!==X||t[115]!==ue||t[116]!==Y||t[117]!==F||t[118]!==ee?(be=s.jsxs("div",{className:Y,children:[F,ee,ie,X,ue]}),t[113]=ie,t[114]=X,t[115]=ue,t[116]=Y,t[117]=F,t[118]=ee,t[119]=be):be=t[119],be}function ti(t){return t.value}function si(t){return t.value}function ri(t){return s.jsx(Z,{variant:"outline",children:t},`selected-category-${t}`)}function ii(t){return s.jsxs(Z,{variant:"default",children:["#",t]},`selected-tag-${t}`)}function ni(t){return t.items??[]}const li=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function ls(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleDateString()}function ai(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 Dt(t){const e=t.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ut(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 oi(){const[t,e]=v.useState("pending"),[r,i]=v.useState(null),[a,n]=v.useState(null),[c,o]=v.useState(null),[l,m]=v.useState(null),[u,p]=v.useState(""),g=gr(t),{reviewMutation:x,deleteMutation:h}=jr(),{createMutation:w}=Cs(),j=g.data?.items??[],E=g.data?.totalCount??0,D=v.useMemo(()=>new Set(j.filter(d=>d.status==="pending").map(d=>d.id)),[j]),N=async()=>{const d=a;if(d){n(null),i(d.id);try{await x.mutateAsync({id:d.id,status:"approved",reviewerNotes:void 0});const C=ai(d);await w.mutateAsync({id:C.id,title:C.title,description:C.description,_meta:C._meta,server:C.server,is_public:C.is_public}),ne.success("Request approved and added to registry")}catch(C){const _=C instanceof Error?C.message:"Failed to approve request";_.includes("UNIQUE constraint")||_.includes("already exists")?ne.error("An item with this ID already exists in the registry. Delete or rename it first."):ne.error(_)}finally{i(null)}}},y=async()=>{if(c)try{await x.mutateAsync({id:c.id,status:"rejected",reviewerNotes:u.trim()||void 0}),ne.success("Request rejected"),o(null),p("")}catch(d){ne.error(d instanceof Error?d.message:"Failed to reject request")}},I=async d=>{try{await h.mutateAsync(d.id),ne.success("Request deleted")}catch(C){ne.error(C instanceof Error?C.message:"Failed to delete request")}};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border",children:s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),s.jsx(Z,{variant:"secondary",className:"text-xs",children:E})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:li.map(d=>s.jsx("button",{type:"button",className:`px-2.5 py-1 text-xs rounded-md transition-colors ${t===d.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>e(d.value),children:d.label},d.value))})]})}),s.jsx("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:g.isLoading?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):j.length===0?s.jsx(it,{className:"p-8 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No publish requests yet."})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:j.map(d=>{const C=Dt(d),_=ut(d),P=d._meta?.["mcp.mesh"]?.tags??[],k=d._meta?.["mcp.mesh"]?.categories??[],R=_.hasReadmeContent||_.hasReadmeLink||P.length>0||k.length>0,T=[d.requester_name,d.requester_email].filter(Boolean).join(" · ");return s.jsxs(it,{className:"p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[s.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:C?s.jsx("img",{src:C,alt:d.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:d.title.slice(0,1).toUpperCase()})}),s.jsx("p",{className:"text-sm font-medium truncate",children:d.title})]}),s.jsx(Z,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:d.status})]}),d.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:d.description}),R&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[_.hasReadmeContent&&s.jsx(Z,{variant:"outline",className:"text-[10px]",children:"README"}),_.hasReadmeLink&&s.jsx(Z,{variant:"outline",className:"text-[10px]",children:"README link"}),P.slice(0,2).map(L=>s.jsx(Z,{variant:"secondary",className:"text-[10px]",children:L},`${d.id}-tag-${L}`)),k.slice(0,1).map(L=>s.jsx(Z,{variant:"secondary",className:"text-[10px]",children:L},`${d.id}-category-${L}`))]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[T&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate",children:T}),s.jsx("span",{children:"·"})]}),s.jsx("span",{className:"shrink-0",children:ls(d.created_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[s.jsxs($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>m(d),children:[s.jsx(js,{size:13}),"View"]}),D.has(d.id)?s.jsxs(s.Fragment,{children:[s.jsxs($,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>n(d),disabled:r!==null,children:[s.jsx(pt,{size:13}),r===d.id?"Approving...":"Approve"]}),s.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>{o(d),p("")},disabled:x.isPending,children:[s.jsx(er,{size:13}),"Reject"]})]}):s.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>I(d),disabled:h.isPending,children:[s.jsx(ft,{size:13}),"Delete"]})]})]},d.id)})})}),s.jsx(St,{open:!!l,onOpenChange:d=>{d||m(null)},children:s.jsxs(Ct,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[s.jsxs(yt,{children:[s.jsx(bt,{children:l?.title??"Request details"}),s.jsx(Nt,{children:"Review all metadata sent by the requester before approving."})]}),l&&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:Dt(l)?s.jsx("img",{src:Dt(l)||"",alt:l.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:l.title.slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:l.title}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:l.server?.name||l.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:l.status})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:ls(l.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:l.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:l.requester_email||"-"})]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{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:l.server?.remotes?.[0]?.url??"-"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.description||"No description provided."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(l._meta?.["mcp.mesh"]?.tags??[]).length?(l._meta?.["mcp.mesh"]?.tags??[]).map(d=>s.jsx(Z,{variant:"secondary",children:d},`${l.id}-detail-tag-${d}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(l._meta?.["mcp.mesh"]?.categories??[]).length?(l._meta?.["mcp.mesh"]?.categories??[]).map(d=>s.jsx(Z,{variant:"secondary",children:d},`${l.id}-detail-category-${d}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"README"}),ut(l).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:ut(l).readmeContent}):ut(l).hasReadmeLink?s.jsxs("a",{href:ut(l).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(sr,{size:14})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),s.jsx(wt,{children:s.jsx($,{variant:"outline",onClick:()=>m(null),children:"Close"})})]})}),s.jsx(Vt,{open:!!a,onOpenChange:d=>{d||n(null)},children:s.jsxs(Kt,{children:[s.jsxs(Ft,{children:[s.jsx($t,{children:"Approve publish request?"}),s.jsxs(Ot,{children:["This will add"," ",s.jsx("span",{className:"font-medium text-foreground",children:a?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),s.jsxs(Gt,{children:[s.jsx(qt,{children:"Cancel"}),s.jsx(Bt,{onClick:N,children:"Approve"})]})]})}),s.jsx(St,{open:!!c,onOpenChange:d=>{d||(o(null),p(""))},children:s.jsxs(Ct,{children:[s.jsxs(yt,{children:[s.jsx(bt,{children:"Reject publish request?"}),s.jsx(Nt,{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(me,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),s.jsx(Mt,{id:"reject-notes",rows:4,value:u,onChange:d=>p(d.target.value),placeholder:"Reason for rejection..."})]}),s.jsxs(wt,{children:[s.jsx($,{variant:"outline",onClick:()=>{o(null),p("")},children:"Cancel"}),s.jsx($,{onClick:y,disabled:x.isPending,children:x.isPending?"Rejecting...":"Reject"})]})]})})]})}function ci(t){const e=he.c(104),{connectionId:r,modelId:i,connections:a,models:n,onConnectionChange:c,onModelChange:o,connectionLabel:l,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:p,className:g}=t,x=l===void 0?"LLM Connection":l,h=m===void 0?"Model":m,w=u===void 0?"Select LLM connection":u,j=p===void 0?"Select model":p,[E,D]=v.useState(!1),[N,y]=v.useState("");let I;if(e[0]!==i||e[1]!==n){let f;e[3]!==i?(f=O=>O.id===i,e[3]=i,e[4]=f):f=e[4],I=n.find(f),e[0]=i,e[1]=n,e[2]=I}else I=e[2];const d=I;let C;if(e[5]!==n||e[6]!==N){const f=N.trim().toLowerCase();C=f?n.filter(O=>O.title.toLowerCase().includes(f)||O.id.toLowerCase().includes(f)):n,e[5]=n,e[6]=N,e[7]=C}else C=e[7];const _=C;let P,k,R,T,L,z,b,U,q,Q,Y,F,G,K,ee,te,se,B,re,H,le,ie;if(e[8]!==g||e[9]!==r||e[10]!==x||e[11]!==w||e[12]!==a||e[13]!==h||e[14]!==j||e[15]!==c||e[16]!==E||e[17]!==N||e[18]!==d?.title){let f;e[41]!==r?(f=Ue=>Ue.id===r,e[41]=r,e[42]=f):f=e[42];const O=a.find(f);L=mi,e[43]!==g?(B=Pe("grid gap-1.5",g),e[43]=g,e[44]=B):B=e[44],e[45]!==h?(re=s.jsx(me,{children:h}),e[45]=h,e[46]=re):re=e[46],T=nr,ee=E,te=D;const ge=d?.title||j;let ce;e[47]!==ge?(ce=s.jsx("span",{className:"truncate text-left",children:ge}),e[47]=ge,e[48]=ce):ce=e[48];let we;e[49]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(fs,{className:"size-4 shrink-0 opacity-60"}),e[49]=we):we=e[49],e[50]!==h||e[51]!==ce?(se=s.jsx(lr,{asChild:!0,children:s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":h,children:[ce,we]})}),e[50]=h,e[51]=ce,e[52]=se):se=e[52],R=ar,F="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",G="start",K=8,Q="p-3 border-b border-border grid grid-cols-[1fr_auto] items-center gap-3";let Te;e[53]===Symbol.for("react.memo_cache_sentinel")?(Te=s.jsx(us,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Te):Te=e[53];let Ce;e[54]===Symbol.for("react.memo_cache_sentinel")?(Ce=Ue=>y(Ue.target.value),e[54]=Ce):Ce=e[54],e[55]!==N?(Y=s.jsxs("div",{className:"relative flex-1 min-w-0",children:[Te,s.jsx(Se,{value:N,onChange:Ce,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=N,e[56]=Y):Y=e[56],q="w-auto shrink-0",k=xs,b=r,U=c,P=hs,H="llm-connection-select",le="h-9 min-w-[160px] max-w-[220px]",ie=x,z=O?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:O.icon?s.jsx("img",{src:O.icon,alt:O.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:O.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:O.title})]}):s.jsx(ps,{placeholder:w}),e[8]=g,e[9]=r,e[10]=x,e[11]=w,e[12]=a,e[13]=h,e[14]=j,e[15]=c,e[16]=E,e[17]=N,e[18]=d?.title,e[19]=P,e[20]=k,e[21]=R,e[22]=T,e[23]=L,e[24]=z,e[25]=b,e[26]=U,e[27]=q,e[28]=Q,e[29]=Y,e[30]=F,e[31]=G,e[32]=K,e[33]=ee,e[34]=te,e[35]=se,e[36]=B,e[37]=re,e[38]=H,e[39]=le,e[40]=ie}else P=e[19],k=e[20],R=e[21],T=e[22],L=e[23],z=e[24],b=e[25],U=e[26],q=e[27],Q=e[28],Y=e[29],F=e[30],G=e[31],K=e[32],ee=e[33],te=e[34],se=e[35],B=e[36],re=e[37],H=e[38],le=e[39],ie=e[40];let J;e[57]!==P||e[58]!==z||e[59]!==H||e[60]!==le||e[61]!==ie?(J=s.jsx(P,{id:H,className:le,"aria-label":ie,children:z}),e[57]=P,e[58]=z,e[59]=H,e[60]=le,e[61]=ie,e[62]=J):J=e[62];let X;e[63]!==a?(X=a.map(di),e[63]=a,e[64]=X):X=e[64];let V;e[65]!==X?(V=s.jsx(gs,{children:X}),e[65]=X,e[66]=V):V=e[66];let xe;e[67]!==k||e[68]!==b||e[69]!==U||e[70]!==J||e[71]!==V?(xe=s.jsxs(k,{value:b,onValueChange:U,children:[J,V]}),e[67]=k,e[68]=b,e[69]=U,e[70]=J,e[71]=V,e[72]=xe):xe=e[72];let ye;e[73]!==q||e[74]!==xe?(ye=s.jsx("div",{className:q,children:xe}),e[73]=q,e[74]=xe,e[75]=ye):ye=e[75];let ue;e[76]!==Q||e[77]!==Y||e[78]!==ye?(ue=s.jsxs("div",{className:Q,children:[Y,ye]}),e[76]=Q,e[77]=Y,e[78]=ye,e[79]=ue):ue=e[79];let be;e[80]!==_||e[81]!==L||e[82]!==i||e[83]!==o?(be=_.length===0?s.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):_.map(f=>{const O=f.id===i,ge=L(f.capabilities);return s.jsxs("button",{type:"button",className:Pe("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",O?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{o(f.id),D(!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:f.logo?s.jsx("img",{src:f.logo,alt:f.title,className:"w-full h-full object-contain"}):s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(f.title||f.id).slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:f.title}),f.title!==f.id&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.id})]}),ge.length>0&&s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:ge.map(ce=>s.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:ce},`${f.id}-${ce}`))})]},f.id)}),e[80]=_,e[81]=L,e[82]=i,e[83]=o,e[84]=be):be=e[84];let ae;e[85]!==be?(ae=s.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:be}),e[85]=be,e[86]=ae):ae=e[86];let pe;e[87]!==R||e[88]!==F||e[89]!==G||e[90]!==K||e[91]!==ue||e[92]!==ae?(pe=s.jsxs(R,{className:F,align:G,sideOffset:K,children:[ue,ae]}),e[87]=R,e[88]=F,e[89]=G,e[90]=K,e[91]=ue,e[92]=ae,e[93]=pe):pe=e[93];let W;e[94]!==T||e[95]!==ee||e[96]!==te||e[97]!==se||e[98]!==pe?(W=s.jsxs(T,{open:ee,onOpenChange:te,children:[se,pe]}),e[94]=T,e[95]=ee,e[96]=te,e[97]=se,e[98]=pe,e[99]=W):W=e[99];let je;return e[100]!==B||e[101]!==re||e[102]!==W?(je=s.jsxs("div",{className:B,children:[re,W]}),e[100]=B,e[101]=re,e[102]=W,e[103]=je):je=e[103],je}function di(t){return s.jsx(jt,{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 mi(t){const e=new Set((t??[]).map(ui)),r=[];return e.has("text")&&r.push("Text"),e.has("vision")&&r.push("Vision"),e.has("tools")&&r.push("Tools"),r}function ui(t){return t.toLowerCase()}function xi({initialName:t,initialIcon:e,initialLLMConnectionId:r,initialLLMModelId:i,initialAcceptPublishRequests:a,initialRequireApiToken:n,revealedKey:c,onRevealedKeyChange:o}){const{org:l}=_e(),{uploadImage:m,isUploading:u}=ks(),{saveRegistryConfigMutation:p}=Yt(At),[g,x]=v.useState(t),[h,w]=v.useState(e),[j,E]=v.useState(r),[D,N]=v.useState(i),[y,I]=v.useState(a),[d,C]=v.useState(n),_=vr(),{generateMutation:P,revokeMutation:k}=yr(),[R,T]=v.useState(""),[L,z]=v.useState(!1),[b,U]=v.useState(null),{handleCopy:q,copied:Q}=_t(),{handleCopy:Y,copied:F}=_t(),{handleCopy:G,copied:K}=_t(),ee=ws({search:"",tags:[],categories:[],limit:50}),se=(rr()??[]).filter(f=>(f.tools??[]).some(O=>O.name==="LLM_DO_GENERATE")),B=j||r||se[0]?.id||"",re=Ks({connectionId:B||void 0,orgId:l.id}),H=ir(B||"no-llm-connection","LLM",re),le=`${window.location.origin}/org/${l.slug}/registry/mcp`,J=(ee.data?.pages.flatMap(f=>f.items??[])??[]).filter(f=>f.is_public).length,X=`${window.location.origin}/org/${l.slug}/registry/publish-request`,V=c?.slice(0,12)??null,xe=!!(V&&(_.data?.items??[]).some(f=>f.prefix===V)),ye=g.trim()!==t.trim()||h.trim()!==e.trim()||j.trim()!==r.trim()||D.trim()!==i.trim()||y!==a||d!==n,ue=p.isPending,be=async f=>{if(!f)return;const O=f.name.split(".").pop()||"png",ge=`registry/${l.id}/identity/icon.${O}`,ce=await m(f,ge);ce?w(ce):ne.error("Failed to upload icon. Please try again.")},ae=async()=>{const f=g.trim();if(!f)return;const O=D.trim(),ge=O?j.trim()||B||"":j.trim();try{await p.mutateAsync({registryName:f,registryIcon:h.trim(),llmConnectionId:ge,llmModelId:O,acceptPublishRequests:y,requireApiToken:d}),ne.success("Registry settings updated")}catch(ce){ne.error(ce instanceof Error?ce.message:"Failed to save registry settings")}},pe=()=>{x(t),w(e),E(r),N(i),I(a),C(n)},W=async()=>{const f=R.trim();if(f)try{const O=await P.mutateAsync(f);O?.key&&(o(O.key),z(!1),T(""),ne.success("API key generated. Copy it now — it won't be shown again!"))}catch(O){ne.error(O instanceof Error?O.message:"Failed to generate API key")}},je=async f=>{try{await k.mutateAsync(f),o(null),U(null),ne.success("API key revoked")}catch(O){ne.error(O instanceof Error?O.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:[ye&&s.jsxs($,{variant:"outline",size:"sm",onClick:pe,disabled:ue,children:[s.jsx(or,{size:14}),"Undo"]}),s.jsxs($,{variant:"default",size:"sm",onClick:ae,disabled:ue||!ye,children:[ue?s.jsx(nt,{size:14,className:"animate-spin"}):s.jsx(cr,{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(it,{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(me,{htmlFor:"identity-name",children:"Name"}),s.jsx(Se,{id:"identity-name",value:g,onChange:f=>x(f.target.value),placeholder:"Private Registry"})]}),s.jsx(Ss,{value:h,onChange:w,onFileUpload:be,isUploading:u})]}),s.jsxs(it,{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(ci,{connectionId:B,modelId:D,connections:se.map(f=>({id:f.id,title:f.title,icon:f.icon??null})),models:H.map(f=>({id:f.id,title:f.title||f.id,logo:f.logo??null,capabilities:f.capabilities??[]})),onConnectionChange:f=>{E(f),N("")},onModelChange:N})]})]}),s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(it,{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(Z,{variant:"secondary",children:[J," ",J===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:le}),s.jsx($,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>q(le),children:Q?s.jsx(Tt,{size:14}):s.jsx(Et,{size:14})})]})]}),s.jsxs(it,{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(Ut,{id:"accept-publish-requests",checked:y,onCheckedChange:I})]}),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:X}),s.jsx($,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>Y(X),children:F?s.jsx(Tt,{size:14}):s.jsx(Et,{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(me,{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(Ut,{id:"require-api-token",checked:d,onCheckedChange:C})]}),(y!==a||d!==n)&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),y&&d&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx(dr,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),c&&!xe&&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(Se,{readOnly:!0,value:c,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(me,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),s.jsx(Se,{id:"api-key-name",value:R,onChange:f=>T(f.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),s.jsxs($,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!R.trim()||P.isPending,onClick:W,children:[P.isPending?s.jsx(nt,{size:14,className:"animate-spin"}):s.jsx(mr,{size:14}),"Generate"]})]}),(_.data?.items?.length??0)>0&&s.jsx("div",{className:"grid gap-2",children:_.data?.items?.map(f=>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:f.name}),V===f.prefix?s.jsx(Se,{readOnly:!0,value:L?c??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):s.jsx(Se,{readOnly:!0,value:`${f.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:[V===f.prefix&&s.jsxs(s.Fragment,{children:[s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>z(O=>!O),children:L?s.jsx(vs,{size:14}):s.jsx(js,{size:14})}),s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!c,onClick:()=>c&&G(c),children:K?s.jsx(Tt,{size:14}):s.jsx(Et,{size:14})})]}),s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:k.isPending,onClick:()=>U({id:f.id,name:f.name}),children:s.jsx(ft,{size:14})})]})]},f.id))})]})]})]})]}),s.jsx(Vt,{open:!!b,onOpenChange:f=>{!f&&!k.isPending&&U(null)},children:s.jsxs(Kt,{children:[s.jsxs(Ft,{children:[s.jsx($t,{children:"Revoke API key?"}),s.jsxs(Ot,{children:["This action cannot be undone. The key",b?` "${b.name}"`:""," will stop working immediately."]})]}),s.jsxs(Gt,{children:[s.jsx(qt,{disabled:k.isPending,children:"Cancel"}),s.jsx(Bt,{disabled:!b||k.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>b&&je(b.id),children:k.isPending?"Revoking...":"Revoke key"})]})]})})]})}function hi(t){const e=he.c(9),{activeTab:r,onChange:i,items:a}=t;let n;if(e[0]!==r||e[1]!==a||e[2]!==i){let o;e[4]!==r||e[5]!==i?(o=l=>{const m=r===l.tab,u=l.icon;return s.jsxs("button",{type:"button",className:Pe("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:()=>i(l.tab),children:[s.jsx(u,{size:14}),s.jsx("span",{children:l.label}),typeof l.count=="number"&&l.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:l.count})]},l.id)},e[4]=r,e[5]=i,e[6]=o):o=e[6],n=a.map(o),e[0]=r,e[1]=a,e[2]=i,e[3]=n}else n=e[3];let c;return e[7]!==n?(c=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:n}),e[7]=n,e[8]=c):c=e[8],c}function mn(){const t=he.c(45),[e,r]=v.useState("items"),[i,a]=v.useState(null),{registryName:n,registryIcon:c,registryLLMConnectionId:o,registryLLMModelId:l,acceptPublishRequests:m,requireApiToken:u}=Yt(At),p=fr(),g=`${n}|${c}|${o}|${l}|${m}|${u}`;!m&&e==="requests"&&r("items");const x=p.data?.pending??0;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={id:"items",label:"Items",icon:qs,tab:"items"},t[0]=h):h=t[0];let w;t[1]!==m||t[2]!==x?(w=m?[{id:"requests",label:"Requests",icon:pt,tab:"requests",count:x}]:[],t[1]=m,t[2]=x,t[3]=w):w=t[3];let j;t[4]===Symbol.for("react.memo_cache_sentinel")?(j={id:"settings",label:"Settings",icon:Bs,tab:"settings"},t[4]=j):j=t[4];let E;t[5]!==w?(E=[h,...w,j],t[5]=w,t[6]=E):E=t[6];const D=E;let N;t[7]===Symbol.for("react.memo_cache_sentinel")?(N=()=>r("settings"),t[7]=N):N=t[7];let y;t[8]!==c||t[9]!==n?(y=s.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:c?s.jsx("img",{src:c,alt:n,className:"h-full w-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:n.slice(0,1).toUpperCase()})}),t[8]=c,t[9]=n,t[10]=y):y=t[10];let I;t[11]!==n?(I=s.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:n}),t[11]=n,t[12]=I):I=t[12];let d;t[13]!==y||t[14]!==I?(d=s.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:N,children:[y,I]}),t[13]=y,t[14]=I,t[15]=d):d=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),t[16]=C):C=t[16];let _;t[17]!==e||t[18]!==D?(_=s.jsx(hi,{activeTab:e,onChange:r,items:D}),t[17]=e,t[18]=D,t[19]=_):_=t[19];let P;t[20]!==d||t[21]!==_?(P=s.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d,C,_]})}),t[20]=d,t[21]=_,t[22]=P):P=t[22];let k;t[23]!==e?(k=e==="items"&&s.jsx(ei,{}),t[23]=e,t[24]=k):k=t[24];let R;t[25]!==m||t[26]!==e?(R=e==="requests"&&m&&s.jsx(oi,{}),t[25]=m,t[26]=e,t[27]=R):R=t[27];let T;t[28]!==m||t[29]!==e||t[30]!==c||t[31]!==o||t[32]!==l||t[33]!==n||t[34]!==u||t[35]!==i||t[36]!==g?(T=e==="settings"&&s.jsx(xi,{initialName:n,initialIcon:c,initialLLMConnectionId:o,initialLLMModelId:l,initialAcceptPublishRequests:m,initialRequireApiToken:u,revealedKey:i,onRevealedKeyChange:a},g),t[28]=m,t[29]=e,t[30]=c,t[31]=o,t[32]=l,t[33]=n,t[34]=u,t[35]=i,t[36]=g,t[37]=T):T=t[37];let L;t[38]!==k||t[39]!==R||t[40]!==T?(L=s.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[k,R,T]}),t[38]=k,t[39]=R,t[40]=T,t[41]=L):L=t[41];let z;return t[42]!==P||t[43]!==L?(z=s.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[P,L]}),t[42]=P,t[43]=L,t[44]=z):z=t[44],z}export{mn as default};
5
+ Describe your MCP here...`,rows:6,value:xe,onChange:S=>ye(S.target.value)}),oe.readme&&s.jsx("p",{className:"text-xs text-destructive",children:oe.readme})]}),Re&&ae==="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($,{type:"button",variant:"outline",size:"sm",className:ot,disabled:h==="readme",onClick:at,children:h==="readme"?"Generating...":"Generate with AI"})]})]}),s.jsx($r,{tools:fe,onChange:Ge,remoteUrl:ct(W)||void 0,remoteType:f,externalDiscoverStatus:j,externalDiscoverError:E})]});return s.jsx(St,{open:t,onOpenChange:tt,children:s.jsxs(Ct,{className:"sm:max-w-[820px] max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsxs(yt,{className:"space-y-3",children:[s.jsx(bt,{children:N?"Edit MCP Server":"Add MCP Server"}),s.jsx(Kr,{current:F}),s.jsxs(Nt,{children:[F===1&&"Set up the identity, connection and discover available tools.",F===2&&"Add descriptions, categories and tags to help discovery.",F===3&&"Configure optional metadata, README and tools."]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto pr-1 py-2",children:[F===1&&Ds,F===2&&Ps,F===3&&Ls]}),s.jsxs(wt,{className:"flex items-center justify-between gap-2 sm:justify-between",children:[s.jsx("div",{children:F>1&&s.jsxs($,{variant:"ghost",size:"sm",onClick:Ts,children:[s.jsx(Js,{size:14}),"Back"]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($,{variant:"outline",size:"sm",onClick:()=>tt(!1),disabled:l,children:"Cancel"}),F<3?s.jsxs($,{size:"sm",onClick:_s,children:["Next",s.jsx(Xs,{size:14})]}):s.jsx($,{size:"sm",onClick:Es,disabled:l,children:l?"Saving...":N?"Save changes":"Create"})]})]})]})})}function ns(t,e){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Zr(t){return t._meta?.["mcp.mesh"]?.tags??[]}function Jr(t){return t._meta?.["mcp.mesh"]?.categories??[]}function Xr(t){return t.server?.remotes?.[0]?.url??"-"}function ei(){const t=he.c(120),[e,r]=y.useState(""),i=y.useDeferredValue(e);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[n,c]=y.useState(a);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[1]=o):o=t[1];const[l,m]=y.useState(o),[u,p]=y.useState(!1),[g,x]=y.useState(!1),[h,w]=y.useState(null),[j,E]=y.useState(null),[D,N]=Ys("private-registry-list","cards"),v=y.useRef(null);let I;t[2]!==i||t[3]!==l||t[4]!==n?(I={search:i,tags:n,categories:l},t[2]=i,t[3]=l,t[4]=n,t[5]=I):I=t[5];const d=ws(I),C=pr(),{registryLLMConnectionId:_,registryLLMModelId:P}=Yt(At),{createMutation:k,updateMutation:R,deleteMutation:T,bulkCreateMutation:L}=Cs();let z,b,U,q,Q,Y,F,G;if(t[6]!==k||t[7]!==T||t[8]!==j||t[9]!==C.data||t[10]!==d||t[11]!==i||t[12]!==e||t[13]!==l||t[14]!==n||t[15]!==N||t[16]!==R||t[17]!==D){const ae=d.data?.pages.flatMap(ni).filter(Boolean)??[],pe=d.data?.pages[0]?.totalCount??ae.length,W=n.length>0||l.length>0||i.length>0,je=C.data;let f;t[26]!==je?(f=Array.isArray(je?.tags)?je.tags:[],t[26]=je,t[27]=f):f=t[27],G=f;let O;t[28]!==je?(O=Array.isArray(je?.categories)?je.categories:[],t[28]=je,t[29]=O):O=t[29],z=O;let ge;t[30]!==d?(ge=A=>{v.current&&(v.current.disconnect(),v.current=null),!(!A||!d.hasNextPage||d.isFetchingNextPage)&&(v.current=new IntersectionObserver(ve=>{ve[0]?.isIntersecting&&d.hasNextPage&&!d.isFetchingNextPage&&d.fetchNextPage()},{rootMargin:"240px 0px"}),v.current.observe(A))},t[30]=d,t[31]=ge):ge=t[31];const ce=ge;let we;t[32]!==k||t[33]!==R?(we=async A=>{try{"data"in A?(await R.mutateAsync(A),ne.success("Registry item updated")):(await k.mutateAsync(A),ne.success("Registry item created"))}catch(ve){const at=ve;throw ne.error(at instanceof Error?at.message:"Failed to save item"),at}},t[32]=k,t[33]=R,t[34]=we):we=t[34],b=we;let Ee;t[35]!==T||t[36]!==j?(Ee=async()=>{if(j)try{await T.mutateAsync(j.id),ne.success("Registry item deleted"),E(null)}catch(A){const ve=A;ne.error(ve instanceof Error?ve.message:"Failed to delete item")}},t[35]=T,t[36]=j,t[37]=Ee):Ee=t[37],U=Ee,Y="h-full flex flex-col";let Ce;t[38]===Symbol.for("react.memo_cache_sentinel")?(Ce=s.jsx("h2",{className:"text-sm font-medium",children:"Items"}),t[38]=Ce):Ce=t[38];const Ue=s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[Ce,s.jsx(Z,{variant:"secondary",className:"text-xs",children:pe})]});let fe;t[39]===Symbol.for("react.memo_cache_sentinel")?(fe=s.jsx(Pt,{asChild:!0,children:s.jsxs($,{variant:"outline",size:"sm",className:_e("h-8","gap-1.5"),children:[s.jsx(Hs,{size:14}),"Filters"]})}),t[39]=fe):fe=t[39];let Ge;t[40]===Symbol.for("react.memo_cache_sentinel")?(Ge=s.jsx(Jt,{children:"Tags"}),t[40]=Ge):Ge=t[40];let Ke;t[41]!==n||t[42]!==G?(Ke=G.length>0?G.map(A=>s.jsxs(Zt,{checked:n.includes(A.value),onCheckedChange:()=>c(ve=>ns(ve,A.value)),children:[A.value," (",A.count,")"]},A.value)):s.jsx(dt,{disabled:!0,children:"No tags available"}),t[41]=n,t[42]=G,t[43]=Ke):Ke=t[43];let et,oe;t[44]===Symbol.for("react.memo_cache_sentinel")?(et=s.jsx(Vs,{}),oe=s.jsx(Jt,{children:"Categories"}),t[44]=et,t[45]=oe):(et=t[44],oe=t[45]);let Le;t[46]!==z||t[47]!==l?(Le=z.length>0?z.map(A=>s.jsxs(Zt,{checked:l.includes(A.value),onCheckedChange:()=>m(ve=>ns(ve,A.value)),children:[A.value," (",A.count,")"]},A.value)):s.jsx(dt,{disabled:!0,children:"No categories available"}),t[46]=z,t[47]=l,t[48]=Le):Le=t[48];let Re;t[49]!==Ke||t[50]!==Le?(Re=s.jsxs(Lt,{children:[fe,s.jsxs(zt,{align:"end",className:"w-[260px]",children:[Ge,Ke,et,oe,Le]})]}),t[49]=Ke,t[50]=Le,t[51]=Re):Re=t[51];let Ve;t[52]!==N?(Ve=A=>{(A==="cards"||A==="table")&&N(A)},t[52]=N,t[53]=Ve):Ve=t[53];let lt,ke;t[54]===Symbol.for("react.memo_cache_sentinel")?(lt=s.jsx(Xt,{value:"cards","aria-label":"Cards view",className:"h-8",children:"Cards"}),ke=s.jsx(Xt,{value:"table","aria-label":"Table view",className:"h-8",children:"Table"}),t[54]=lt,t[55]=ke):(lt=t[54],ke=t[55]);let Me;t[56]!==Ve||t[57]!==D?(Me=s.jsxs(Qs,{type:"single",value:D,onValueChange:Ve,variant:"outline",className:"h-8",children:[lt,ke]}),t[56]=Ve,t[57]=D,t[58]=Me):Me=t[58];let Ye;t[59]===Symbol.for("react.memo_cache_sentinel")?(Ye=s.jsx($,{variant:"outline",size:"sm",className:"h-8",onClick:()=>x(!0),children:"Import CSV"}),t[59]=Ye):Ye=t[59];let tt;t[60]===Symbol.for("react.memo_cache_sentinel")?(tt=s.jsx($,{size:"sm",className:"h-8",onClick:()=>p(!0),children:"Add MCP Servers"}),t[60]=tt):tt=t[60];let He;t[61]!==Re||t[62]!==Me?(He=s.jsxs("div",{className:"flex items-center gap-2 self-stretch",children:[Re,Me,Ye,tt]}),t[61]=Re,t[62]=Me,t[63]=He):He=t[63];let We;t[64]!==Ue||t[65]!==He?(We=s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[Ue,He]}),t[64]=Ue,t[65]=He,t[66]=We):We=t[66];let $e;t[67]===Symbol.for("react.memo_cache_sentinel")?($e=s.jsx(us,{size:16,className:"text-muted-foreground shrink-0"}),t[67]=$e):$e=t[67];let Fe;t[68]===Symbol.for("react.memo_cache_sentinel")?(Fe=A=>r(A.target.value),t[68]=Fe):Fe=t[68];let Ze;t[69]!==e?(Ze=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:[$e,s.jsx(Se,{value:e,onChange:Fe,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]=Ze):Ze=t[70];let Je;t[71]!==W||t[72]!==e||t[73]!==l||t[74]!==n?(Je=W&&s.jsxs("div",{className:"border-t border-border px-4 md:px-6 py-2 flex flex-wrap items-center gap-2",children:[n.map(ii),l.map(ri),e.trim()&&s.jsxs(Z,{variant:"secondary",className:"max-w-[280px] truncate",children:["Search: ",e]}),s.jsx($,{size:"sm",variant:"ghost",className:"h-7 ml-auto",onClick:()=>{r(""),c([]),m([])},children:"Clear filters"})]}),t[71]=W,t[72]=e,t[73]=l,t[74]=n,t[75]=Je):Je=t[75],t[76]!==We||t[77]!==Ze||t[78]!==Je?(F=s.jsxs("div",{className:"shrink-0 border-b border-border",children:[We,Ze,Je]}),t[76]=We,t[77]=Ze,t[78]=Je,t[79]=F):F=t[79],q="flex-1 overflow-auto px-4 md:px-6 py-4",Q=ae.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:d.isLoading?s.jsxs(s.Fragment,{children:[s.jsx(nt,{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:W?"No items found":"No MCPs in your registry"}),s.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:W?"Try removing filters or changing your search to find matching MCPs.":"Add your first MCP item to start building your private registry catalog."}),!W&&s.jsx($,{size:"lg",onClick:()=>p(!0),children:"Add MCP Servers"})]})}):D==="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:ae.map(A=>s.jsx(Ur,{item:A,onEdit:w,onDelete:E},A.id))}),d.hasNextPage&&s.jsx("div",{ref:ce,className:"h-2"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"border rounded-lg overflow-auto",children:s.jsxs(as,{children:[s.jsx(os,{children:s.jsxs(vt,{children:[s.jsx(De,{className:"w-[56px]",children:"Icon"}),s.jsx(De,{children:"Title"}),s.jsx(De,{children:"ID"}),s.jsx(De,{children:"Tags"}),s.jsx(De,{children:"Categories"}),s.jsx(De,{children:"Remote URL"}),s.jsx(De,{children:"Visibility"}),s.jsx(De,{className:"text-right w-[68px]",children:"Actions"})]})}),s.jsx(cs,{children:ae.map(A=>s.jsxs(vt,{children:[s.jsx(Pe,{children:s.jsx("div",{className:"size-8 rounded-md border border-border bg-muted/20 overflow-hidden flex items-center justify-center",children:A.server?.icons?.[0]?.src?s.jsx("img",{src:A.server.icons[0].src,alt:A.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:A.title.charAt(0).toUpperCase()})})}),s.jsx(Pe,{children:A.title}),s.jsx(Pe,{className:"font-mono",children:A.id}),s.jsx(Pe,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Zr(A).slice(0,3).map(ve=>s.jsx(Z,{variant:"outline",children:ve},`${A.id}-tag-${ve}`))})}),s.jsx(Pe,{children:s.jsx("div",{className:"flex flex-wrap gap-1",children:Jr(A).slice(0,3).map(ve=>s.jsx(Z,{variant:"outline",children:ve},`${A.id}-category-${ve}`))})}),s.jsx(Pe,{children:Xr(A)}),s.jsx(Pe,{children:A.is_public?s.jsxs(Z,{variant:"default",className:"gap-1",children:[s.jsx(ms,{size:10}),"Public"]}):s.jsx(Z,{variant:"secondary",children:"Private"})}),s.jsx(Pe,{className:"text-right",children:s.jsxs(Lt,{children:[s.jsx(Pt,{asChild:!0,children:s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ds,{size:18})})}),s.jsxs(zt,{align:"end",children:[s.jsx(dt,{onClick:()=>w(A),children:"Edit"}),s.jsx(dt,{variant:"destructive",onClick:()=>E(A),children:"Delete"})]})]})})]},A.id))})]})}),d.hasNextPage&&s.jsx("div",{ref:ce,className:"h-2"})]}),t[6]=k,t[7]=T,t[8]=j,t[9]=C.data,t[10]=d,t[11]=i,t[12]=e,t[13]=l,t[14]=n,t[15]=N,t[16]=R,t[17]=D,t[18]=z,t[19]=b,t[20]=U,t[21]=q,t[22]=Q,t[23]=Y,t[24]=F,t[25]=G}else z=t[18],b=t[19],U=t[20],q=t[21],Q=t[22],Y=t[23],F=t[24],G=t[25];let K;t[80]!==d.isFetchingNextPage?(K=d.isFetchingNextPage&&s.jsxs("div",{className:"py-4 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(nt,{className:"size-4 animate-spin"}),"Loading more items..."]}),t[80]=d.isFetchingNextPage,t[81]=K):K=t[81];let ee;t[82]!==q||t[83]!==Q||t[84]!==K?(ee=s.jsxs("div",{className:q,children:[Q,K]}),t[82]=q,t[83]=Q,t[84]=K,t[85]=ee):ee=t[85];const te=h?.id??"create",se=u||!!h;let B;t[86]===Symbol.for("react.memo_cache_sentinel")?(B=ae=>{ae||(p(!1),w(null))},t[86]=B):B=t[86];let re;t[87]!==G?(re=G.map(si),t[87]=G,t[88]=re):re=t[88];let H;t[89]!==z?(H=z.map(ti),t[89]=z,t[90]=H):H=t[90];const le=k.isPending||R.isPending;let ie;t[91]!==h||t[92]!==b||t[93]!==_||t[94]!==P||t[95]!==se||t[96]!==re||t[97]!==H||t[98]!==le||t[99]!==te?(ie=s.jsx(Wr,{open:se,onOpenChange:B,item:h,availableTags:re,availableCategories:H,defaultLLMConnectionId:_,defaultLLMModelId:P,isSubmitting:le,onSubmit:b},te),t[91]=h,t[92]=b,t[93]=_,t[94]=P,t[95]=se,t[96]=re,t[97]=H,t[98]=le,t[99]=te,t[100]=ie):ie=t[100];let J;t[101]!==L?(J=async ae=>{try{const pe=await L.mutateAsync(ae);return ne.success(`Imported ${pe.created} item(s)`),pe}catch(pe){const W=pe;throw ne.error(W instanceof Error?W.message:"Failed to import CSV"),W}},t[101]=L,t[102]=J):J=t[102];let X;t[103]!==L.isPending||t[104]!==g||t[105]!==J?(X=s.jsx(Rr,{open:g,onOpenChange:x,isImporting:L.isPending,onImport:J}),t[103]=L.isPending,t[104]=g,t[105]=J,t[106]=X):X=t[106];const V=!!j;let xe;t[107]===Symbol.for("react.memo_cache_sentinel")?(xe=ae=>{ae||E(null)},t[107]=xe):xe=t[107];const ye=j?.title??j?.id??"";let ue;t[108]!==T.isPending||t[109]!==U||t[110]!==V||t[111]!==ye?(ue=s.jsx(Er,{open:V,onOpenChange:xe,title:ye,isDeleting:T.isPending,onConfirm:U}),t[108]=T.isPending,t[109]=U,t[110]=V,t[111]=ye,t[112]=ue):ue=t[112];let be;return t[113]!==ie||t[114]!==X||t[115]!==ue||t[116]!==Y||t[117]!==F||t[118]!==ee?(be=s.jsxs("div",{className:Y,children:[F,ee,ie,X,ue]}),t[113]=ie,t[114]=X,t[115]=ue,t[116]=Y,t[117]=F,t[118]=ee,t[119]=be):be=t[119],be}function ti(t){return t.value}function si(t){return t.value}function ri(t){return s.jsx(Z,{variant:"outline",children:t},`selected-category-${t}`)}function ii(t){return s.jsxs(Z,{variant:"default",children:["#",t]},`selected-tag-${t}`)}function ni(t){return t.items??[]}const li=[{value:"pending",label:"Pending"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"}];function ls(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleDateString()}function ai(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 Dt(t){const e=t.server?.icons?.[0]?.src;return typeof e=="string"&&e.length>0?e:null}function ut(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 oi(){const[t,e]=y.useState("pending"),[r,i]=y.useState(null),[a,n]=y.useState(null),[c,o]=y.useState(null),[l,m]=y.useState(null),[u,p]=y.useState(""),g=gr(t),{reviewMutation:x,deleteMutation:h}=jr(),{createMutation:w}=Cs(),j=g.data?.items??[],E=g.data?.totalCount??0,D=new Set(j.filter(d=>d.status==="pending").map(d=>d.id)),N=async()=>{const d=a;if(d){n(null),i(d.id);try{await x.mutateAsync({id:d.id,status:"approved",reviewerNotes:void 0});const C=ai(d);await w.mutateAsync({id:C.id,title:C.title,description:C.description,_meta:C._meta,server:C.server,is_public:C.is_public}),ne.success("Request approved and added to registry")}catch(C){const _=C instanceof Error?C.message:"Failed to approve request";_.includes("UNIQUE constraint")||_.includes("already exists")?ne.error("An item with this ID already exists in the registry. Delete or rename it first."):ne.error(_)}finally{i(null)}}},v=async()=>{if(c)try{await x.mutateAsync({id:c.id,status:"rejected",reviewerNotes:u.trim()||void 0}),ne.success("Request rejected"),o(null),p("")}catch(d){ne.error(d instanceof Error?d.message:"Failed to reject request")}},I=async d=>{try{await h.mutateAsync(d.id),ne.success("Request deleted")}catch(C){ne.error(C instanceof Error?C.message:"Failed to delete request")}};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border",children:s.jsxs("div",{className:"h-12 px-4 md:px-6 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("h2",{className:"text-sm font-medium",children:"Requests to Publish"}),s.jsx(Z,{variant:"secondary",className:"text-xs",children:E})]}),s.jsx("div",{className:"inline-flex rounded-lg border border-border p-0.5",children:li.map(d=>s.jsx("button",{type:"button",className:_e("px-2.5 py-1 text-xs rounded-md transition-colors",t===d.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>e(d.value),children:d.label},d.value))})]})}),s.jsx("div",{className:"flex-1 overflow-auto px-4 md:px-6 py-4",children:g.isLoading?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading requests..."}):j.length===0?s.jsx(it,{className:"p-8 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No publish requests yet."})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-2",children:j.map(d=>{const C=Dt(d),_=ut(d),P=d._meta?.["mcp.mesh"]?.tags??[],k=d._meta?.["mcp.mesh"]?.categories??[],R=_.hasReadmeContent||_.hasReadmeLink||P.length>0||k.length>0,T=[d.requester_name,d.requester_email].filter(Boolean).join(" · ");return s.jsxs(it,{className:"p-3 grid gap-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[s.jsx("div",{className:"size-7 rounded-md border border-border bg-muted/30 overflow-hidden shrink-0 flex items-center justify-center",children:C?s.jsx("img",{src:C,alt:d.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:d.title.slice(0,1).toUpperCase()})}),s.jsx("p",{className:"text-sm font-medium truncate",children:d.title})]}),s.jsx(Z,{variant:"secondary",className:"capitalize text-[11px] shrink-0",children:d.status})]}),d.description&&s.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 pl-9",children:d.description}),R&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1 pl-9",children:[_.hasReadmeContent&&s.jsx(Z,{variant:"outline",className:"text-[10px]",children:"README"}),_.hasReadmeLink&&s.jsx(Z,{variant:"outline",className:"text-[10px]",children:"README link"}),P.slice(0,2).map(L=>s.jsx(Z,{variant:"secondary",className:"text-[10px]",children:L},`${d.id}-tag-${L}`)),k.slice(0,1).map(L=>s.jsx(Z,{variant:"secondary",className:"text-[10px]",children:L},`${d.id}-category-${L}`))]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground pl-9",children:[T&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate",children:T}),s.jsx("span",{children:"·"})]}),s.jsx("span",{className:"shrink-0",children:ls(d.created_at)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pt-0.5",children:[s.jsxs($,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>m(d),children:[s.jsx(js,{size:13}),"View"]}),D.has(d.id)?s.jsxs(s.Fragment,{children:[s.jsxs($,{size:"sm",className:"h-7 text-xs px-2",onClick:()=>n(d),disabled:r!==null,children:[s.jsx(pt,{size:13}),r===d.id?"Approving...":"Approve"]}),s.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>{o(d),p("")},disabled:x.isPending,children:[s.jsx(er,{size:13}),"Reject"]})]}):s.jsxs($,{size:"sm",variant:"outline",className:"h-7 text-xs px-2",onClick:()=>I(d),disabled:h.isPending,children:[s.jsx(ft,{size:13}),"Delete"]})]})]},d.id)})})}),s.jsx(St,{open:!!l,onOpenChange:d=>{d||m(null)},children:s.jsxs(Ct,{className:"sm:max-w-[720px] max-h-[85vh] overflow-hidden flex flex-col",children:[s.jsxs(yt,{children:[s.jsx(bt,{children:l?.title??"Request details"}),s.jsx(Nt,{children:"Review all metadata sent by the requester before approving."})]}),l&&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:Dt(l)?s.jsx("img",{src:Dt(l)||"",alt:l.title,className:"h-full w-full object-cover",loading:"lazy"}):s.jsx("span",{className:"text-lg font-semibold text-muted-foreground",children:l.title.slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:l.title}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:l.server?.name||l.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:l.status})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Submitted"}),s.jsx("span",{children:ls(l.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:l.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:l.requester_email||"-"})]})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{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:l.server?.remotes?.[0]?.url??"-"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Description"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.description||"No description provided."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(l._meta?.["mcp.mesh"]?.tags??[]).length?(l._meta?.["mcp.mesh"]?.tags??[]).map(d=>s.jsx(Z,{variant:"secondary",children:d},`${l.id}-detail-tag-${d}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"Categories"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:(l._meta?.["mcp.mesh"]?.categories??[]).length?(l._meta?.["mcp.mesh"]?.categories??[]).map(d=>s.jsx(Z,{variant:"secondary",children:d},`${l.id}-detail-category-${d}`)):s.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(me,{children:"README"}),ut(l).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:ut(l).readmeContent}):ut(l).hasReadmeLink?s.jsxs("a",{href:ut(l).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(sr,{size:14})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"No README provided."})]})]}),s.jsx(wt,{children:s.jsx($,{variant:"outline",onClick:()=>m(null),children:"Close"})})]})}),s.jsx(Vt,{open:!!a,onOpenChange:d=>{d||n(null)},children:s.jsxs(Kt,{children:[s.jsxs(Ft,{children:[s.jsx($t,{children:"Approve publish request?"}),s.jsxs(Ot,{children:["This will add"," ",s.jsx("span",{className:"font-medium text-foreground",children:a?.title})," ","to your private registry. The requester will be notified of the approval."]})]}),s.jsxs(Gt,{children:[s.jsx(qt,{children:"Cancel"}),s.jsx(Bt,{onClick:N,children:"Approve"})]})]})}),s.jsx(St,{open:!!c,onOpenChange:d=>{d||(o(null),p(""))},children:s.jsxs(Ct,{children:[s.jsxs(yt,{children:[s.jsx(bt,{children:"Reject publish request?"}),s.jsx(Nt,{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(me,{htmlFor:"reject-notes",children:"Reviewer notes (optional)"}),s.jsx(Mt,{id:"reject-notes",rows:4,value:u,onChange:d=>p(d.target.value),placeholder:"Reason for rejection..."})]}),s.jsxs(wt,{children:[s.jsx($,{variant:"outline",onClick:()=>{o(null),p("")},children:"Cancel"}),s.jsx($,{onClick:v,disabled:x.isPending,children:x.isPending?"Rejecting...":"Reject"})]})]})})]})}function ci(t){const e=he.c(104),{connectionId:r,modelId:i,connections:a,models:n,onConnectionChange:c,onModelChange:o,connectionLabel:l,modelLabel:m,connectionPlaceholder:u,modelPlaceholder:p,className:g}=t,x=l===void 0?"LLM Connection":l,h=m===void 0?"Model":m,w=u===void 0?"Select LLM connection":u,j=p===void 0?"Select model":p,[E,D]=y.useState(!1),[N,v]=y.useState("");let I;if(e[0]!==i||e[1]!==n){let f;e[3]!==i?(f=O=>O.id===i,e[3]=i,e[4]=f):f=e[4],I=n.find(f),e[0]=i,e[1]=n,e[2]=I}else I=e[2];const d=I;let C;if(e[5]!==n||e[6]!==N){const f=N.trim().toLowerCase();C=f?n.filter(O=>O.title.toLowerCase().includes(f)||O.id.toLowerCase().includes(f)):n,e[5]=n,e[6]=N,e[7]=C}else C=e[7];const _=C;let P,k,R,T,L,z,b,U,q,Q,Y,F,G,K,ee,te,se,B,re,H,le,ie;if(e[8]!==g||e[9]!==r||e[10]!==x||e[11]!==w||e[12]!==a||e[13]!==h||e[14]!==j||e[15]!==c||e[16]!==E||e[17]!==N||e[18]!==d?.title){let f;e[41]!==r?(f=Ue=>Ue.id===r,e[41]=r,e[42]=f):f=e[42];const O=a.find(f);L=mi,e[43]!==g?(B=_e("grid gap-1.5",g),e[43]=g,e[44]=B):B=e[44],e[45]!==h?(re=s.jsx(me,{children:h}),e[45]=h,e[46]=re):re=e[46],T=nr,ee=E,te=D;const ge=d?.title||j;let ce;e[47]!==ge?(ce=s.jsx("span",{className:"truncate text-left",children:ge}),e[47]=ge,e[48]=ce):ce=e[48];let we;e[49]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx(fs,{className:"size-4 shrink-0 opacity-60"}),e[49]=we):we=e[49],e[50]!==h||e[51]!==ce?(se=s.jsx(lr,{asChild:!0,children:s.jsxs($,{type:"button",variant:"outline",size:"sm",className:"h-9 w-full justify-between px-3","aria-label":h,children:[ce,we]})}),e[50]=h,e[51]=ce,e[52]=se):se=e[52],R=ar,F="w-[calc(100vw-2rem)] sm:w-[460px] lg:w-[500px] max-w-[92vw] p-0",G="start",K=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(us,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground"}),e[53]=Ee):Ee=e[53];let Ce;e[54]===Symbol.for("react.memo_cache_sentinel")?(Ce=Ue=>v(Ue.target.value),e[54]=Ce):Ce=e[54],e[55]!==N?(Y=s.jsxs("div",{className:"relative flex-1 min-w-0",children:[Ee,s.jsx(Se,{value:N,onChange:Ce,className:"h-9 pl-8",placeholder:"Search for a model..."})]}),e[55]=N,e[56]=Y):Y=e[56],q="w-auto shrink-0",k=xs,b=r,U=c,P=hs,H="llm-connection-select",le="h-9 min-w-[160px] max-w-[220px]",ie=x,z=O?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:O.icon?s.jsx("img",{src:O.icon,alt:O.title,className:"w-full h-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:O.title.slice(0,1).toUpperCase()})}),s.jsx("span",{className:"truncate",children:O.title})]}):s.jsx(ps,{placeholder:w}),e[8]=g,e[9]=r,e[10]=x,e[11]=w,e[12]=a,e[13]=h,e[14]=j,e[15]=c,e[16]=E,e[17]=N,e[18]=d?.title,e[19]=P,e[20]=k,e[21]=R,e[22]=T,e[23]=L,e[24]=z,e[25]=b,e[26]=U,e[27]=q,e[28]=Q,e[29]=Y,e[30]=F,e[31]=G,e[32]=K,e[33]=ee,e[34]=te,e[35]=se,e[36]=B,e[37]=re,e[38]=H,e[39]=le,e[40]=ie}else P=e[19],k=e[20],R=e[21],T=e[22],L=e[23],z=e[24],b=e[25],U=e[26],q=e[27],Q=e[28],Y=e[29],F=e[30],G=e[31],K=e[32],ee=e[33],te=e[34],se=e[35],B=e[36],re=e[37],H=e[38],le=e[39],ie=e[40];let J;e[57]!==P||e[58]!==z||e[59]!==H||e[60]!==le||e[61]!==ie?(J=s.jsx(P,{id:H,className:le,"aria-label":ie,children:z}),e[57]=P,e[58]=z,e[59]=H,e[60]=le,e[61]=ie,e[62]=J):J=e[62];let X;e[63]!==a?(X=a.map(di),e[63]=a,e[64]=X):X=e[64];let V;e[65]!==X?(V=s.jsx(gs,{children:X}),e[65]=X,e[66]=V):V=e[66];let xe;e[67]!==k||e[68]!==b||e[69]!==U||e[70]!==J||e[71]!==V?(xe=s.jsxs(k,{value:b,onValueChange:U,children:[J,V]}),e[67]=k,e[68]=b,e[69]=U,e[70]=J,e[71]=V,e[72]=xe):xe=e[72];let ye;e[73]!==q||e[74]!==xe?(ye=s.jsx("div",{className:q,children:xe}),e[73]=q,e[74]=xe,e[75]=ye):ye=e[75];let ue;e[76]!==Q||e[77]!==Y||e[78]!==ye?(ue=s.jsxs("div",{className:Q,children:[Y,ye]}),e[76]=Q,e[77]=Y,e[78]=ye,e[79]=ue):ue=e[79];let be;e[80]!==_||e[81]!==L||e[82]!==i||e[83]!==o?(be=_.length===0?s.jsx("p",{className:"text-xs text-muted-foreground px-2 py-3",children:"No models found."}):_.map(f=>{const O=f.id===i,ge=L(f.capabilities);return s.jsxs("button",{type:"button",className:_e("w-full text-left px-3 py-3 rounded-lg text-sm flex items-center gap-3",O?"bg-accent text-accent-foreground":"hover:bg-muted"),onClick:()=>{o(f.id),D(!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:f.logo?s.jsx("img",{src:f.logo,alt:f.title,className:"w-full h-full object-contain"}):s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:(f.title||f.id).slice(0,1).toUpperCase()})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:f.title}),f.title!==f.id&&s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.id})]}),ge.length>0&&s.jsx("div",{className:"flex items-center gap-2 shrink-0",children:ge.map(ce=>s.jsx("span",{className:"text-xs font-medium px-2.5 py-1 rounded-md bg-primary/12 text-primary",children:ce},`${f.id}-${ce}`))})]},f.id)}),e[80]=_,e[81]=L,e[82]=i,e[83]=o,e[84]=be):be=e[84];let ae;e[85]!==be?(ae=s.jsx("div",{className:"max-h-[55vh] sm:max-h-[420px] overflow-y-auto p-2",children:be}),e[85]=be,e[86]=ae):ae=e[86];let pe;e[87]!==R||e[88]!==F||e[89]!==G||e[90]!==K||e[91]!==ue||e[92]!==ae?(pe=s.jsxs(R,{className:F,align:G,sideOffset:K,children:[ue,ae]}),e[87]=R,e[88]=F,e[89]=G,e[90]=K,e[91]=ue,e[92]=ae,e[93]=pe):pe=e[93];let W;e[94]!==T||e[95]!==ee||e[96]!==te||e[97]!==se||e[98]!==pe?(W=s.jsxs(T,{open:ee,onOpenChange:te,children:[se,pe]}),e[94]=T,e[95]=ee,e[96]=te,e[97]=se,e[98]=pe,e[99]=W):W=e[99];let je;return e[100]!==B||e[101]!==re||e[102]!==W?(je=s.jsxs("div",{className:B,children:[re,W]}),e[100]=B,e[101]=re,e[102]=W,e[103]=je):je=e[103],je}function di(t){return s.jsx(jt,{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 mi(t){const e=new Set((t??[]).map(ui)),r=[];return e.has("text")&&r.push("Text"),e.has("vision")&&r.push("Vision"),e.has("tools")&&r.push("Tools"),r}function ui(t){return t.toLowerCase()}function xi({initialName:t,initialIcon:e,initialLLMConnectionId:r,initialLLMModelId:i,initialAcceptPublishRequests:a,initialRequireApiToken:n,revealedKey:c,onRevealedKeyChange:o}){const{org:l}=Te(),{uploadImage:m,isUploading:u}=ks(),{saveRegistryConfigMutation:p}=Yt(At),[g,x]=y.useState(t),[h,w]=y.useState(e),[j,E]=y.useState(r),[D,N]=y.useState(i),[v,I]=y.useState(a),[d,C]=y.useState(n),_=vr(),{generateMutation:P,revokeMutation:k}=yr(),[R,T]=y.useState(""),[L,z]=y.useState(!1),[b,U]=y.useState(null),{handleCopy:q,copied:Q}=_t(),{handleCopy:Y,copied:F}=_t(),{handleCopy:G,copied:K}=_t(),ee=ws({search:"",tags:[],categories:[],limit:50}),se=(rr()??[]).filter(f=>(f.tools??[]).some(O=>O.name==="LLM_DO_GENERATE")),B=j||r||se[0]?.id||"",re=Ks({connectionId:B||void 0,orgId:l.id}),H=ir(B||"no-llm-connection","LLM",re),le=`${window.location.origin}/org/${l.slug}/registry/mcp`,J=(ee.data?.pages.flatMap(f=>f.items??[])??[]).filter(f=>f.is_public).length,X=`${window.location.origin}/org/${l.slug}/registry/publish-request`,V=c?.slice(0,12)??null,xe=!!(V&&(_.data?.items??[]).some(f=>f.prefix===V)),ye=g.trim()!==t.trim()||h.trim()!==e.trim()||j.trim()!==r.trim()||D.trim()!==i.trim()||v!==a||d!==n,ue=p.isPending,be=async f=>{if(!f)return;const O=f.name.split(".").pop()||"png",ge=`registry/${l.id}/identity/icon.${O}`,ce=await m(f,ge);ce?w(ce):ne.error("Failed to upload icon. Please try again.")},ae=async()=>{const f=g.trim();if(!f)return;const O=D.trim(),ge=O?j.trim()||B||"":j.trim();try{await p.mutateAsync({registryName:f,registryIcon:h.trim(),llmConnectionId:ge,llmModelId:O,acceptPublishRequests:v,requireApiToken:d}),ne.success("Registry settings updated")}catch(ce){ne.error(ce instanceof Error?ce.message:"Failed to save registry settings")}},pe=()=>{x(t),w(e),E(r),N(i),I(a),C(n)},W=async()=>{const f=R.trim();if(f)try{const O=await P.mutateAsync(f);O?.key&&(o(O.key),z(!1),T(""),ne.success("API key generated. Copy it now — it won't be shown again!"))}catch(O){ne.error(O instanceof Error?O.message:"Failed to generate API key")}},je=async f=>{try{await k.mutateAsync(f),o(null),U(null),ne.success("API key revoked")}catch(O){ne.error(O instanceof Error?O.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:[ye&&s.jsxs($,{variant:"outline",size:"sm",onClick:pe,disabled:ue,children:[s.jsx(or,{size:14}),"Undo"]}),s.jsxs($,{variant:"default",size:"sm",onClick:ae,disabled:ue||!ye,children:[ue?s.jsx(nt,{size:14,className:"animate-spin"}):s.jsx(cr,{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(it,{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(me,{htmlFor:"identity-name",children:"Name"}),s.jsx(Se,{id:"identity-name",value:g,onChange:f=>x(f.target.value),placeholder:"Private Registry"})]}),s.jsx(Ss,{value:h,onChange:w,onFileUpload:be,isUploading:u})]}),s.jsxs(it,{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(ci,{connectionId:B,modelId:D,connections:se.map(f=>({id:f.id,title:f.title,icon:f.icon??null})),models:H.map(f=>({id:f.id,title:f.title||f.id,logo:f.logo??null,capabilities:f.capabilities??[]})),onConnectionChange:f=>{E(f),N("")},onModelChange:N})]})]}),s.jsxs("div",{className:"grid gap-4 min-w-0 content-start",children:[s.jsxs(it,{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(Z,{variant:"secondary",children:[J," ",J===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:le}),s.jsx($,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>q(le),children:Q?s.jsx(Tt,{size:14}):s.jsx(Et,{size:14})})]})]}),s.jsxs(it,{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(Ut,{id:"accept-publish-requests",checked:v,onCheckedChange:I})]}),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:X}),s.jsx($,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>Y(X),children:F?s.jsx(Tt,{size:14}):s.jsx(Et,{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(me,{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(Ut,{id:"require-api-token",checked:d,onCheckedChange:C})]}),(v!==a||d!==n)&&s.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Unsaved changes — click Save to apply."}),v&&d&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[s.jsx(dr,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"API Keys"})]}),c&&!xe&&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(Se,{readOnly:!0,value:c,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(me,{htmlFor:"api-key-name",className:"text-xs",children:"Key name"}),s.jsx(Se,{id:"api-key-name",value:R,onChange:f=>T(f.target.value),placeholder:"e.g. CI/CD Pipeline",className:"h-8 text-sm"})]}),s.jsxs($,{variant:"outline",size:"sm",className:"h-8 gap-1.5",disabled:!R.trim()||P.isPending,onClick:W,children:[P.isPending?s.jsx(nt,{size:14,className:"animate-spin"}):s.jsx(mr,{size:14}),"Generate"]})]}),(_.data?.items?.length??0)>0&&s.jsx("div",{className:"grid gap-2",children:_.data?.items?.map(f=>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:f.name}),V===f.prefix?s.jsx(Se,{readOnly:!0,value:L?c??"":"••••••••••••••••••••••••••••••••••••••••••••••••••••",className:"h-8 text-xs font-mono bg-muted/20"}):s.jsx(Se,{readOnly:!0,value:`${f.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:[V===f.prefix&&s.jsxs(s.Fragment,{children:[s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>z(O=>!O),children:L?s.jsx(vs,{size:14}):s.jsx(js,{size:14})}),s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!c,onClick:()=>c&&G(c),children:K?s.jsx(Tt,{size:14}):s.jsx(Et,{size:14})})]}),s.jsx($,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive hover:text-destructive",disabled:k.isPending,onClick:()=>U({id:f.id,name:f.name}),children:s.jsx(ft,{size:14})})]})]},f.id))})]})]})]})]}),s.jsx(Vt,{open:!!b,onOpenChange:f=>{!f&&!k.isPending&&U(null)},children:s.jsxs(Kt,{children:[s.jsxs(Ft,{children:[s.jsx($t,{children:"Revoke API key?"}),s.jsxs(Ot,{children:["This action cannot be undone. The key",b?` "${b.name}"`:""," will stop working immediately."]})]}),s.jsxs(Gt,{children:[s.jsx(qt,{disabled:k.isPending,children:"Cancel"}),s.jsx(Bt,{disabled:!b||k.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>b&&je(b.id),children:k.isPending?"Revoking...":"Revoke key"})]})]})})]})}function hi(t){const e=he.c(9),{activeTab:r,onChange:i,items:a}=t;let n;if(e[0]!==r||e[1]!==a||e[2]!==i){let o;e[4]!==r||e[5]!==i?(o=l=>{const m=r===l.tab,u=l.icon;return s.jsxs("button",{type:"button",className:_e("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:()=>i(l.tab),children:[s.jsx(u,{size:14}),s.jsx("span",{children:l.label}),typeof l.count=="number"&&l.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:l.count})]},l.id)},e[4]=r,e[5]=i,e[6]=o):o=e[6],n=a.map(o),e[0]=r,e[1]=a,e[2]=i,e[3]=n}else n=e[3];let c;return e[7]!==n?(c=s.jsx("nav",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar",children:n}),e[7]=n,e[8]=c):c=e[8],c}function mn(){const t=he.c(45),[e,r]=y.useState("items"),[i,a]=y.useState(null),{registryName:n,registryIcon:c,registryLLMConnectionId:o,registryLLMModelId:l,acceptPublishRequests:m,requireApiToken:u}=Yt(At),p=fr(),g=`${n}|${c}|${o}|${l}|${m}|${u}`;!m&&e==="requests"&&r("items");const x=p.data?.pending??0;let h;t[0]===Symbol.for("react.memo_cache_sentinel")?(h={id:"items",label:"Items",icon:qs,tab:"items"},t[0]=h):h=t[0];let w;t[1]!==m||t[2]!==x?(w=m?[{id:"requests",label:"Requests",icon:pt,tab:"requests",count:x}]:[],t[1]=m,t[2]=x,t[3]=w):w=t[3];let j;t[4]===Symbol.for("react.memo_cache_sentinel")?(j={id:"settings",label:"Settings",icon:Bs,tab:"settings"},t[4]=j):j=t[4];let E;t[5]!==w?(E=[h,...w,j],t[5]=w,t[6]=E):E=t[6];const D=E;let N;t[7]===Symbol.for("react.memo_cache_sentinel")?(N=()=>r("settings"),t[7]=N):N=t[7];let v;t[8]!==c||t[9]!==n?(v=s.jsx("div",{className:"size-7 rounded-lg border border-border overflow-hidden bg-muted/20 flex items-center justify-center shrink-0",children:c?s.jsx("img",{src:c,alt:n,className:"h-full w-full object-cover"}):s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:n.slice(0,1).toUpperCase()})}),t[8]=c,t[9]=n,t[10]=v):v=t[10];let I;t[11]!==n?(I=s.jsx("span",{className:"text-sm font-medium truncate max-w-[220px]",children:n}),t[11]=n,t[12]=I):I=t[12];let d;t[13]!==v||t[14]!==I?(d=s.jsxs("button",{type:"button",className:"min-w-0 flex items-center gap-2 hover:opacity-90 transition-opacity cursor-pointer",onClick:N,children:[v,I]}),t[13]=v,t[14]=I,t[15]=d):d=t[15];let C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"h-6 w-px bg-border shrink-0"}),t[16]=C):C=t[16];let _;t[17]!==e||t[18]!==D?(_=s.jsx(hi,{activeTab:e,onChange:r,items:D}),t[17]=e,t[18]=D,t[19]=_):_=t[19];let P;t[20]!==d||t[21]!==_?(P=s.jsx("header",{className:"shrink-0 w-full border-b border-border h-12 overflow-x-auto flex items-center justify-between gap-3 px-4 min-w-max",children:s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[d,C,_]})}),t[20]=d,t[21]=_,t[22]=P):P=t[22];let k;t[23]!==e?(k=e==="items"&&s.jsx(ei,{}),t[23]=e,t[24]=k):k=t[24];let R;t[25]!==m||t[26]!==e?(R=e==="requests"&&m&&s.jsx(oi,{}),t[25]=m,t[26]=e,t[27]=R):R=t[27];let T;t[28]!==m||t[29]!==e||t[30]!==c||t[31]!==o||t[32]!==l||t[33]!==n||t[34]!==u||t[35]!==i||t[36]!==g?(T=e==="settings"&&s.jsx(xi,{initialName:n,initialIcon:c,initialLLMConnectionId:o,initialLLMModelId:l,initialAcceptPublishRequests:m,initialRequireApiToken:u,revealedKey:i,onRevealedKeyChange:a},g),t[28]=m,t[29]=e,t[30]=c,t[31]=o,t[32]=l,t[33]=n,t[34]=u,t[35]=i,t[36]=g,t[37]=T):T=t[37];let L;t[38]!==k||t[39]!==R||t[40]!==T?(L=s.jsxs("main",{className:"flex-1 min-w-0 overflow-hidden",children:[k,R,T]}),t[38]=k,t[39]=R,t[40]=T,t[41]=L):L=t[41];let z;return t[42]!==P||t[43]!==L?(z=s.jsxs("div",{className:"h-full flex flex-col bg-background overflow-hidden",children:[P,L]}),t[42]=P,t[43]=L,t[44]=z):z=t[44],z}export{mn as default};
@@ -1 +1 @@
1
- import"./index-B29giag9.js";import{c}from"./constants-CH9byiKA.js";function u(n){if(!n)return"";const r=n.find(t=>t.name==="COLLECTION_REGISTRY_APP_LIST");if(r)return r.name;const e=n.find(t=>t.name.startsWith("COLLECTION_REGISTRY_APP_")&&t.name.endsWith("_LIST"));return e?e.name:n.find(t=>t.name.endsWith("_LIST"))?.name??""}function m(n){if(!n)return"";const r=n.find(t=>t.name==="COLLECTION_REGISTRY_APP_FILTERS");if(r)return r.name;const e=n.find(t=>t.name.startsWith("COLLECTION_REGISTRY_APP_")&&t.name.endsWith("_FILTERS"));return e?e.name:n.find(t=>t.name.endsWith("_FILTERS"))?.name??""}function T(n,r){if(!n)return"";const e=n.find(i=>i.name===`COLLECTION_REGISTRY_APP${r}`);if(e)return e.name;const a=n.find(i=>i.name.startsWith("COLLECTION_REGISTRY_APP_")&&i.name.endsWith(r));return a?a.name:n.find(i=>i.name.endsWith(r))?.name??""}function l(n){if(!n)return[];const r=[];for(const e of n){let a=[];if(Array.isArray(e))a=e;else if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(i=>Array.isArray(e[i]));t&&(a=e[t])}r.push(...a)}return r}const s={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function d(n){return n?s[n]??n.toUpperCase():null}function I(n){return n?n.match(/schemas\/([\d-]+)/)?.[1]??null:null}function _(n){if(!n)return[];if(Array.isArray(n))return n;if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(e=>Array.isArray(n[e]));if(r)return n[r]}return[]}async function y(n,r,e,a){const t=await c({connectionId:n,orgId:r});try{const i=await t.callTool({name:e,arguments:a});return i.structuredContent??i}finally{await t.close().catch(console.error)}}export{l as a,m as b,y as c,T as d,_ as e,u as f,d as g,I as h};
1
+ import"./index-B0lAKtRh.js";import{c}from"./constants-7tHIXjuz.js";function u(n){if(!n)return"";const r=n.find(t=>t.name==="COLLECTION_REGISTRY_APP_LIST");if(r)return r.name;const e=n.find(t=>t.name.startsWith("COLLECTION_REGISTRY_APP_")&&t.name.endsWith("_LIST"));return e?e.name:n.find(t=>t.name.endsWith("_LIST"))?.name??""}function m(n){if(!n)return"";const r=n.find(t=>t.name==="COLLECTION_REGISTRY_APP_FILTERS");if(r)return r.name;const e=n.find(t=>t.name.startsWith("COLLECTION_REGISTRY_APP_")&&t.name.endsWith("_FILTERS"));return e?e.name:n.find(t=>t.name.endsWith("_FILTERS"))?.name??""}function T(n,r){if(!n)return"";const e=n.find(i=>i.name===`COLLECTION_REGISTRY_APP${r}`);if(e)return e.name;const a=n.find(i=>i.name.startsWith("COLLECTION_REGISTRY_APP_")&&i.name.endsWith(r));return a?a.name:n.find(i=>i.name.endsWith(r))?.name??""}function l(n){if(!n)return[];const r=[];for(const e of n){let a=[];if(Array.isArray(e))a=e;else if(typeof e=="object"&&e!==null){const t=Object.keys(e).find(i=>Array.isArray(e[i]));t&&(a=e[t])}r.push(...a)}return r}const s={"streamable-http":"HTTP",http:"HTTP",sse:"SSE",stdio:"STDIO",websocket:"Websocket"};function d(n){return n?s[n]??n.toUpperCase():null}function I(n){return n?n.match(/schemas\/([\d-]+)/)?.[1]??null:null}function _(n){if(!n)return[];if(Array.isArray(n))return n;if(typeof n=="object"&&n!==null){const r=Object.keys(n).find(e=>Array.isArray(n[e]));if(r)return n[r]}return[]}async function y(n,r,e,a){const t=await c({connectionId:n,orgId:r});try{const i=await t.callTool({name:e,arguments:a});return i.structuredContent??i}finally{await t.close().catch(console.error)}}export{l as a,m as b,y as c,T as d,_ as e,u as f,d as g,I as h};