"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecurityButton=SecurityButton;const jsx_runtime_1=require("react/jsx-runtime"),styled_components_1=__importDefault(require("styled-components")),theme_1=require("@redocly/theme"),react_1=require("react"),hooks_1=require("../../hooks");function SecurityButton({securities:e,onClick:t}){const r=(0,hooks_1.useTranslate)();return(0,jsx_runtime_1.jsx)(SecurityPanel,{header:()=>(0,jsx_runtime_1.jsxs)(SecurityHeader,{children:[(0,jsx_runtime_1.jsx)(theme_1.SecurityIcon,{}),(0,jsx_runtime_1.jsx)(Title,{children:"Security"}),(0,jsx_runtime_1.jsx)(ViewDetailsButton,{onClick:t,variant:"link",children:r("openapi.viewDetails","View details")})]}),isExpandable:!1,children:(0,jsx_runtime_1.jsx)(SecurityList,{children:e.map(((t,r)=>{const n=e.length>1&&t.schemes.length>1,i=t.schemes.map((({id:e},r)=>(0,jsx_runtime_1.jsxs)(react_1.Fragment,{children:[e,r<t.schemes.length-1&&(0,jsx_runtime_1.jsx)(Conjunction,{children:" and "})]},e)));return(0,jsx_runtime_1.jsxs)(react_1.Fragment,{children:[n?"(":"",i,n?")":"",r<e.length-1&&(0,jsx_runtime_1.jsx)(Conjunction,{children:" or "})]},r)}))})})}const SecurityPanel=(0,styled_components_1.default)(theme_1.Panel)`
  margin-top: var(--spacing-base);
  border: var(--panel-border);
  border-radius: var(--panel-border-radius);
`,SecurityHeader=styled_components_1.default.div`
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-xs);
  color: var(--link-color-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--layer-color);
  border-bottom: var(--panel-border);
  border-radius: var(--panel-border-radius) var(--panel-border-radius) 0 0;
`,ViewDetailsButton=(0,styled_components_1.default)(theme_1.Button)`
  margin-left: auto;
  font-size: var(--font-size-sm);
`,Title=styled_components_1.default.span`
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-medium);
  color: var(--text-color-primary);
`,SecurityList=styled_components_1.default.div`
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  padding: var(--spacing-xs) var(--spacing-sm);
  color: var(--text-color-primary);
`,Conjunction=styled_components_1.default.span`
  color: var(--text-color-description);
`;
//# sourceMappingURL=SecurityButton.js.map