import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useAtomValue as A}from"jotai";import{LayoutVariant as g}from"@redocly/config";import{AfterOpenApiTitle as h}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle";import{PageActions as D}from"@redocly/theme/components/PageActions/PageActions";import{SamplesMiddlePanel as k,Row as S}from"../common/index.js";import{ExternalDocumentation as M}from"../ExternalDocumentation/index.js";import{Markdown as s}from"../Markdown/index.js";import{ApiHeader as T}from"./styled.js";import{globalStoreAtom as j}from"../../jotai/store.js";import{saveTextBeforeHeading as y}from"../../utils/saveTextBeforeHeading.js";import{getValueFromMdParsedExtension as m}from"../../utils/helpers.js";import{RenderHook as H}from"../RenderHook/index.js";import{Metadata as P}from"./Metadata.js";import{useTranslate as v}from"../../hooks/index.js";function $({item:p,layout:r}){const l=v(),{options:{unstable_hooks:d,hideInfoMetadata:f,routingBasePath:c},parser:{definition:u}}=A(j),o=p.infoDefinition;if(!o)return null;const e=y(m(o,"description")||""),i=m(o,"summary")||void 0,a=u?.externalDocs||o?.externalDocs,x=r===g.STACKED;return t(S,{layout:r,children:n(k,{fullWidth:!0,className:"api-info",isStacked:x,children:[n(T,{children:[(o.title||"")+(o.version?` (${o.version})`:""),t(D,{pageSlug:c})]}),t(H,{Hook:h||d?.AfterApiTitle,props:{info:o}}),i&&t(s,{source:i,"data-role":"redoc-summary"}),e&&t(s,{source:e,"data-role":"redoc-description"}),a&&t(M,{externalDocs:a}),!f&&t(P,{metadata:o["x-metadata"],translate:l})]})})}export{$ as ApiInfo};
