"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiInfo=void 0;const jsx_runtime_1=require("react/jsx-runtime"),jotai_1=require("jotai"),theme_1=require("@redocly/theme"),styled_components_1=__importDefault(require("styled-components")),app_1=require("../../jotai/app"),common_1=require("../common"),ExternalDocumentation_1=require("../ExternalDocumentation"),Markdown_1=require("../Markdown"),styled_1=require("./styled"),store_1=require("../../jotai/store"),saveTextBeforeHeading_1=require("../../utils/saveTextBeforeHeading"),helpers_1=require("../../utils/helpers"),RenderHook_1=require("../RenderHook"),Metadata_1=require("./Metadata"),RightPanel_1=require("../RightPanel/RightPanel");function ApiInfo({item:e}){const{options:{unstable_hooks:t,hideInfoMetadata:r},parser:{definition:o}}=(0,jotai_1.useAtomValue)(store_1.globalStoreAtom),i=(0,jotai_1.useAtomValue)(app_1.layoutAtom),n=e.infoDefinition;if(!n)return null;const a=(0,saveTextBeforeHeading_1.saveTextBeforeHeading)((0,helpers_1.getValueFromMdParsedExtension)(n,"description")||""),s=(0,helpers_1.getValueFromMdParsedExtension)(n,"summary")||void 0,_=null==o?void 0:o.externalDocs,l=n.version&&(0,jsx_runtime_1.jsxs)("span",{children:["(",n.version,")"]})||null,u=i===theme_1.LayoutVariant.STACKED;return(0,jsx_runtime_1.jsxs)(common_1.Row,{layout:i,children:[(0,jsx_runtime_1.jsxs)(common_1.SamplesMiddlePanel,{fullWidth:!0,className:"api-info",isStacked:u,children:[(0,jsx_runtime_1.jsxs)(styled_1.ApiHeader,{children:[n.title," ",l]}),(0,jsx_runtime_1.jsx)(RenderHook_1.RenderHook,{Hook:theme_1.AfterOpenApiTitle||(null==t?void 0:t.AfterApiTitle),props:{info:n}}),s&&(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:s,"data-role":"redoc-summary"}),a&&(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:a,"data-role":"redoc-description"}),_&&(0,jsx_runtime_1.jsx)(ExternalDocumentation_1.ExternalDocumentation,{externalDocs:_}),!r&&(0,jsx_runtime_1.jsx)(Metadata_1.Metadata,{metadata:n["x-metadata"]})]}),u&&(0,jsx_runtime_1.jsx)(RightPanelContainer,{isStacked:u,children:(0,jsx_runtime_1.jsx)(RightPanel_1.RightPanel,{item:e})})]})}exports.ApiInfo=ApiInfo;const RightPanelContainer=(0,styled_components_1.default)(common_1.SamplesPanel)`
  position: static;
`;
//# sourceMappingURL=ApiInfo.js.map