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