import{r as e,j as r}from"./vendor-react-AXa6hZO5.js";import{a8 as n,a9 as c,aa as o,ab as i,ac as a,ad as s,ae as t,af as u,ag as y}from"./index-D35RxkWr.js";import{S as d,p as m}from"./c6eedc03a-C8LSdtro.js";function S(e){return e.directoryServer?.name??(e.syncSourceType?d[e.syncSourceType]:void 0)??e.connector?.name??e.name}function p(e){return n(e)||(e.connector?.isConnected??!1)||(e.firstPartyIntegration?.connected??!1)}function f(e){return"mcp"===e.kind?e.name:`cli:${e.cliName}`}function l(e){if(e.syncSourceType)return{iconType:"syncSource",iconSrc:e.syncSourceType};const r=e.directoryServer?o(e.directoryServer.iconUrl,e.directoryServer.url):void 0;return{iconType:e.connector?.iconType??r?.iconType??"favicon",iconSrc:e.connector?.iconSrc??r?.iconSrc??e.url??void 0}}const v=e.memo(function({server:e,size:n,imageSize:o}){const i=S(e),a=l(e);return"syncSource"===a.iconType?r.jsx(c,{size:n,imageSize:o,type:"syncSource",src:a.iconSrc,name:i}):r.jsx(c,{size:n,imageSize:o,type:a.iconType,src:a.iconSrc,name:i})}),T=new Set(Object.values(m));function g(r){const c=i(),o=a(),{servers:d,isLoading:m}=s(),S=t();return{mcpServers:e.useMemo(()=>r?r.map(e=>{const r=d.find(r=>u(r,e.url)||!e.url&&!n(e)&&e.name.toLowerCase()===r.name.toLowerCase()),o=c.find(n=>!!n.url&&(e.url?n.url===e.url:!!r&&u(r,n.url))),i=function(e){if(e.url){const r=y[e.url];if(r)return r}if(T.has(e.name))return e.name}(e),a=i?S.find(e=>e.type===i):void 0;return{...e,connector:o,directoryServer:r,syncSourceType:i,firstPartyIntegration:a?{syncSourceType:a.type,connected:a.connected??!1,enabledForOrg:a.enabledForOrg}:void 0}}):[],[r,c,d,S]),isLoading:o||m}}export{v as P,f as a,S as g,p as i,l as r,g as u};
