"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RedoclyOpenAPIDocsStandalone=exports.RedoclyOpenAPIDocs=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),theme_1=require("@redocly/theme"),UnsupportedFeatureScreen_1=require("../UnsupportedFeatureScreen"),Providers_1=require("./Providers"),Overlay_1=require("../Overlay"),styled_1=require("./styled"),StickySidebar_1=require("../StickySidebar"),SideMenu_1=require("../SideMenu"),Content_1=require("../Content"),hooks_1=require("../../hooks"),withRouter_1=require("../../hoc/withRouter"),withStore_1=require("../../hoc/withStore"),utils_1=require("../../utils"),useLicense_1=require("../../hooks/useLicense"),RedoclyOpenAPIDocsComponent=(0,utils_1.compose)(withRouter_1.withRouter,withStore_1.withStore,react_1.memo)((({licenseKey:e,onLoaded:o,children:t,options:i,layout:n,collapsedSidebar:r,parser:s,withCommonStyles:l})=>{var d,u,a,c,_;const m=(0,react_1.useRef)(null),{isValid:p,licenseInfo:h}=(0,useLicense_1.useLicense)(e);(0,hooks_1.useUppercase2LowercaseRedirect)(),(0,theme_1.useMount)((()=>{null==o||o()}));const{hideSidebar:v,scrollYOffset:x}=i||{},{contentItems:y}=(0,hooks_1.useContentItems)({parser:s,options:i}),S=null===(u=null===(d=s.definition)||void 0===d?void 0:d.info)||void 0===u?void 0:u["x-logo"];return(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[l&&(0,jsx_runtime_1.jsx)(theme_1.GlobalStyle,{}),(0,jsx_runtime_1.jsxs)(styled_1.RedocWrap,{className:"redoc-wrap",ref:m,children:[(0,jsx_runtime_1.jsx)(UnsupportedFeatureScreen_1.UnsupportedFeatureScreen,{}),!p&&(0,jsx_runtime_1.jsx)(Overlay_1.Overlay,{licenseInfo:h}),(0,jsx_runtime_1.jsx)(styled_1.CssFixes,{layout:n}),!v&&(0,jsx_runtime_1.jsxs)(StickySidebar_1.StickyResponsiveSidebar,{scrollYOffset:x,className:"menu-content",collapsedSidebar:!r,children:[(0,jsx_runtime_1.jsx)(theme_1.SidebarLogo,{imageUrl:null==S?void 0:S.url,href:(null==S?void 0:S.href)||(null===(_=null===(c=null===(a=s.definition)||void 0===a?void 0:a.info)||void 0===c?void 0:c.contact)||void 0===_?void 0:_.url),altText:null==S?void 0:S.altText,backgroundColor:null==S?void 0:S.backgroundColor}),(0,jsx_runtime_1.jsx)(SideMenu_1.SideMenu,{items:p?y:[]})]}),(0,jsx_runtime_1.jsxs)(theme_1.ThreePanelLayout,{className:"api-content",id:"api-content",layout:n===theme_1.LayoutVariant.THREE_PANEL?theme_1.LayoutVariant.THREE_PANEL:theme_1.LayoutVariant.STACKED,collapsedSidebar:r,children:[(0,jsx_runtime_1.jsx)(Content_1.Content,{items:p?y:[],routingBasePath:i.routingBasePath}),t]})]})]})}));function RedoclyOpenAPIDocs({onLoaded:e,children:o,store:t,withCommonStyles:i}){var n,r,s;return(null==t?void 0:t.definition)?(0,jsx_runtime_1.jsx)(Providers_1.StoreProvider,Object.assign({},t,{children:(0,jsx_runtime_1.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}function RedoclyOpenAPIDocsStandalone({definition:e,definitionUrl:o,options:t={},activeItemId:i,activeSampleLanguage:n,activeDeepLink:r}){return(0,jsx_runtime_1.jsx)(Providers_1.AppProvider,{definition:e,definitionUrl:o,options:t,activeItemId:i,activeSampleLanguage:n,activeDeepLink:r,children:(0,jsx_runtime_1.jsx)(RedoclyOpenAPIDocs,{withCommonStyles:!0})})}exports.RedoclyOpenAPIDocs=RedoclyOpenAPIDocs,exports.RedoclyOpenAPIDocsStandalone=RedoclyOpenAPIDocsStandalone;
//# sourceMappingURL=RedoclyOpenAPIDocs.js.map