"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecurityFlow=void 0;const jsx_runtime_1=require("react/jsx-runtime"),styled_components_1=__importDefault(require("styled-components")),SecuritySchemeItem_1=require("./SecuritySchemeItem"),utils_1=require("../../utils"),OAuthFlow_1=require("./OAuthFlow"),styled_1=require("./styled"),Markdown_1=require("../Markdown"),helper_1=require("./helper");function SecurityFlow({type:e,bearerFormat:r,name:t,flows:i,openIdConnectUrl:s,description:n,id:u,securities:a,in:l}){if(!e||!u)return null;const o=(0,helper_1.getRequiredScopes)(u,a),c={http:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:"HTTP Authorization Scheme",value:e}),(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:"Bearer Format",value:r})]}),apiKey:(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:`${(0,utils_1.titleize)(l||"")} parameter name:`,value:t}),oauth2:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:"Flow type:",value:e}),i&&Object.keys(i).map((e=>(0,jsx_runtime_1.jsx)(OAuthFlow_1.OAuthFlow,{flow:i[e]},e)))]}),openIdConnect:(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:"Connect URL:",value:s&&(0,jsx_runtime_1.jsx)(styled_1.StyledLink,{target:"_blank",rel:"noopener noreferrer",href:s,children:s})})};return(0,jsx_runtime_1.jsxs)(Wrapper,{children:[(0,jsx_runtime_1.jsx)(TitleSchema,{children:u}),(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:n}),(0,jsx_runtime_1.jsxs)(List,{children:[c[e]||null,(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:"Required scopes",value:o.length&&(0,jsx_runtime_1.jsx)(Row,{children:o.map((e=>(0,jsx_runtime_1.jsx)(styled_1.Tag,{className:"tag-grey",children:e},e)))})})]})]})}exports.SecurityFlow=SecurityFlow;const Wrapper=styled_components_1.default.div`
  background: var(--layer-color);
  padding: var(--spacing-base);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color-secondary);
  width: 100%;
  margin-top: var(--spacing-base);
`,List=styled_components_1.default.div`
  width: 100%;
  margin-top: var(--spacing-md);
`,Row=styled_components_1.default.div`
  display: flex;
  gap: var(--spacing-xxs);
  word-break: normal;
`,TitleSchema=styled_components_1.default.p`
  font-size: var(--font-size-base);
  margin: 0 0 var(--spacing-xs);
  text-transform: capitalize;
  font-weight: var(--font-weight-semibold);
`;
//# sourceMappingURL=SecurityFlow.js.map