import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{CopyButton}from"@redocly/theme";import styled from"styled-components";import{PanelItemDescription,Title}from"../PanelItem";import{ViewNested}from"../ViewNested";import{Tag}from"../common";import{Markdown}from"../Markdown";export const ServerList=({servers:e,path:r})=>_jsx(ItemsList,{children:e.map((e=>{const i=e.url+r,a=Object.keys(e.variables||{}).length,t=`${1===Number(a)?"":a} ${1!==a?"variables":"variable"}`;return _jsxs("div",{children:[_jsx(PanelItemDescription,{children:e.description}),_jsxs(TitleWrap,{children:[_jsx(Title,{suppressHydrationWarning:!0,children:i}),_jsx(CopyButton,{data:i},i)]}),e.variables&&_jsx(ViewNested,{expandText:`Show ${t}`,hideText:`Hide ${t}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:_jsx(ServerVariablesContainer,{children:Object.entries(e.variables||{}).map((([e,r])=>_jsxs(ServerVariableContainer,{children:[_jsx(ServerVariableName,{children:e}),_jsxs(Variable,{children:["Default ",_jsx(StyledTag,{children:r.default})]}),_jsx(Description,{source:r.description}),r.enum&&_jsxs(Variable,{children:["Enum",_jsx(TagWrapper,{children:r.enum.map((e=>_jsx(StyledTag,{children:e},e)))})]})]},e)))})})]},e.url)}))});const ItemsList=styled.div`
  & > div {
    border-bottom: 1px solid var(--border-color-secondary);
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-sm);
  }

  & > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
`,ServerVariablesContainer=styled.div`
  padding-left: var(--spacing-xxs);
  & > div {
    border-bottom: 1px solid var(--border-color-secondary);
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-sm);
  }

  & > div:first-child {
    margin-top: var(--spacing-sm);
    padding-top: 0;
  }

  & > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
`,ServerVariableContainer=styled.div`
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
`,Description=styled(Markdown)`
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--text-color-primary);
`,Variable=styled.span`
  display: flex;
  gap: var(--spacing-xxs);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--text-color-primary);
`,ServerVariableName=styled(Variable)`
  padding-bottom: var(--spacing-xxs);
  font-weight: var(--font-weight-semibold);
`,TagWrapper=styled.span`
  display: flex;
  gap: var(--spacing-xxs);
  flex-wrap: wrap;
`,StyledTag=styled(Tag)`
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
`,TitleWrap=styled.div`
  display: flex;
  justify-content: space-between;
  align-items: center;
`;
//# sourceMappingURL=ServerList.js.map