import{jsx as t,jsxs as s,Fragment as l}from"react/jsx-runtime";import*as h from"react";import{NewTabButton as u}from"@redocly/theme/components/Buttons/NewTabButton";import{PageActions as f}from"@redocly/theme/components/PageActions/PageActions";import{Tag as p}from"@redocly/theme/components/Tag/Tag";import{CheckmarkIcon as g}from"@redocly/theme/icons/CheckmarkIcon/CheckmarkIcon";import{MCP_SERVER_CAPABILITIES as E,MCP_SERVER_EXPERIMENTAL_CAPABILITIES as P,PAGE_ACTIONS_MCP as C}from"../../utils/mcp.js";import{replaceVariables as _}from"../../utils/index.js";import{PanelItem as r}from"../PanelItem/PanelItem.js";import{PanelItemsList as j}from"../PanelItem/styled.js";import{useTranslate as x}from"../../hooks/index.js";import{styled as c}from"../../styled-components.js";function G({mcpInfo:e,mcpServers:a}){const o=x(),d=a[0]?_(a[0]):void 0;function m(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.listChanged}function b(i){return typeof e?.capabilities[i]=="object"&&e?.capabilities[i]?.subscribe}return s(j,{children:[e?.protocolVersion&&t(r,{header:o("openapi.mcp.protocolVersion","Protocol version"),title:e.protocolVersion}),e?.capabilities&&t(r,{header:o("openapi.mcp.capabilities","Capabilities"),title:t(l,{children:E.map(i=>e?.capabilities[i]?s(p,{size:"small",icon:t(g,{}),children:[i,m(i)?" (list changed)":"",b(i)?" (subscribe)":""]},i):null)})}),e?.capabilities[P]&&t(r,{header:o("openapi.mcp.experimentalCapabilities","Experimental capabilities"),title:t(T,{children:Object.entries(e?.capabilities.experimental||{}).map(([i,n])=>s(h.Fragment,{children:[s("span",{children:[i,":"]}),t(p,{children:typeof n=="object"?JSON.stringify(n):String(n)})]},i))})}),t(r,{header:o("openapi.mcp.endpoint","Endpoint"),title:t(l,{children:a[0]?.url}),actions:[t(u,{data:a[0]?.url},"NewTabButton")]}),t(r,{title:t(A,{children:t(f,{actions:C,mcpUrl:d})})})]})}const A=c.div`
  & button {
    width: 100%;
  }
  > div {
    padding: 0;
  }
`,T=c.div`
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;

  > * {
    justify-self: start;
  }
`;export{G as McpOverview};
