import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";import{useRef,memo}from"react";import{SidebarLogo,GlobalStyle as ThemeCommonStyle,useMount,LayoutVariant,ThreePanelLayout}from"@redocly/theme";import{UnsupportedFeatureScreen}from"../UnsupportedFeatureScreen";import{AppProvider,StoreProvider}from"./Providers";import{Overlay}from"../Overlay";import{RedocWrap,CssFixes}from"./styled";import{StickyResponsiveSidebar}from"../StickySidebar";import{SideMenu}from"../SideMenu";import{Content}from"../Content";import{useContentItems,useUppercase2LowercaseRedirect}from"../../hooks";import{withRouter}from"../../hoc/withRouter";import{withStore}from"../../hoc/withStore";import{compose}from"../../utils";import{useLicense}from"../../hooks/useLicense";const RedoclyOpenAPIDocsComponent=compose(withRouter,withStore,memo)((({licenseKey:e,onLoaded:o,children:t,options:i,layout:n,collapsedSidebar:r,parser:s,withCommonStyles:a})=>{var l,d,c,m,u;const p=useRef(null),{isValid:v,licenseInfo:f}=useLicense(e);useUppercase2LowercaseRedirect(),useMount((()=>{null==o||o()}));const{hideSidebar:h,scrollYOffset:S}=i||{},{contentItems:y}=useContentItems({parser:s,options:i}),x=null===(d=null===(l=s.definition)||void 0===l?void 0:l.info)||void 0===d?void 0:d["x-logo"];return _jsxs(_Fragment,{children:[a&&_jsx(ThemeCommonStyle,{}),_jsxs(RedocWrap,{className:"redoc-wrap",ref:p,children:[_jsx(UnsupportedFeatureScreen,{}),!v&&_jsx(Overlay,{licenseInfo:f}),_jsx(CssFixes,{layout:n}),!h&&_jsxs(StickyResponsiveSidebar,{scrollYOffset:S,className:"menu-content",collapsedSidebar:!r,children:[_jsx(SidebarLogo,{imageUrl:null==x?void 0:x.url,href:(null==x?void 0:x.href)||(null===(u=null===(m=null===(c=s.definition)||void 0===c?void 0:c.info)||void 0===m?void 0:m.contact)||void 0===u?void 0:u.url),altText:null==x?void 0:x.altText,backgroundColor:null==x?void 0:x.backgroundColor}),_jsx(SideMenu,{items:v?y:[]})]}),_jsxs(ThreePanelLayout,{className:"api-content",id:"api-content",layout:n===LayoutVariant.THREE_PANEL?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED,collapsedSidebar:r,children:[_jsx(Content,{items:v?y:[],routingBasePath:i.routingBasePath}),t]})]})]})}));export function RedoclyOpenAPIDocs({onLoaded:e,children:o,store:t,withCommonStyles:i}){var n,r,s;return(null==t?void 0:t.definition)?_jsx(StoreProvider,Object.assign({},t,{children:_jsx(RedoclyOpenAPIDocsComponent,{onLoaded:e,basePath:null===(n=t.options)||void 0===n?void 0:n.routingBasePath,licenseKey:null===(r=t.options)||void 0===r?void 0:r.licenseKey,disableRouter:null===(s=t.options)||void 0===s?void 0:s.disableRouter,withCommonStyles:i,children:o})})):null}export function RedoclyOpenAPIDocsStandalone({definition:e,definitionUrl:o,options:t={},activeItemId:i,activeSampleLanguage:n,activeDeepLink:r}){return _jsx(AppProvider,{definition:e,definitionUrl:o,options:t,activeItemId:i,activeSampleLanguage:n,activeDeepLink:r,children:_jsx(RedoclyOpenAPIDocs,{withCommonStyles:!0})})}
//# sourceMappingURL=RedoclyOpenAPIDocs.js.map