import{LayoutVariant as d}from"@redocly/config";import{isUndefined as m,addTrailingSlash as r}from"@redocly/theme/core/openapi";import{WindowReferenceOptions as n}from"../../constants.js";import{argValueToBoolean as o,argValueToExpandLevel as i,argValueToInt as p,argValueToNumber as c,getWindowReferenceOptions as a,normalizePath as h}from"../../utils/index.js";import{normalizeShowExtensions as u,normalizeScrollYOffset as f,normalizeCodeSamples as S}from"./helpers.js";function y(e,s){e={...s,...e,markdocOptions:{...e?.markdocOptions,components:{...s?.markdocOptions?.components,...e?.markdocOptions?.components},tags:{...s?.markdocOptions?.tags,...e?.markdocOptions?.tags},nodes:{...s?.markdocOptions?.nodes,...e?.markdocOptions?.nodes,heading:s?.markdocOptions?.nodes?.heading||e?.markdocOptions?.nodes.heading}}};const t=Array.isArray(e.ignoreNamedSchemas)?e.ignoreNamedSchemas:e.ignoreNamedSchemas?.split(",").map(l=>l.trim());return{downloadUrls:e.downloadUrls,schemaDefinitionsTagName:e.schemaDefinitionsTagName,corsProxyUrl:e.corsProxyUrl&&r(e.corsProxyUrl),hideSidebar:o(e.hideSidebar,!1),jsonSamplesExpandLevel:i(e.jsonSamplesExpandLevel,2),generatedSamplesMaxDepth:p(e.generatedSamplesMaxDepth,8),hideDownloadButtons:o(e.hideDownloadButtons,!1),hideInfoMetadata:o(e.hideInfoMetadata,!1),hideLoading:o(e.hideLoading,!1),hideSchemaTitles:o(e.hideSchemaTitles,!1),maxDisplayedEnumValues:c(e.maxDisplayedEnumValues),mockServer:e.mockServer?.url?{url:e.mockServer.url,position:e.mockServer.position||"first",description:e.mockServer.description||"Mock server"}:void 0,hideReplay:o(e.hideReplay,!1),oAuth2RedirectURI:e.oAuth2RedirectURI||null,onlyRequiredInSamples:o(e.onlyRequiredInSamples,!1),onDeepLinkClick:e.onDeepLinkClick||a(n.ON_DEEP_LINK_CLICK),routingBasePath:m(e.disableRouter)?"":e.routingBasePath&&h(e.routingBasePath)||"",schemasExpansionLevel:i(e.schemasExpansionLevel),feedback:e.feedback||{hide:!1},sortRequiredPropsFirst:o(e.sortRequiredPropsFirst,!1),scrollYOffset:f(e.scrollYOffset),showExtensions:u(e.showExtensions),sanitize:o(e.sanitize,!1),skipBundle:o(e.skipBundle,!1),ignoreNamedSchemas:new Set(t),markdocOptions:e?.markdocOptions,codeSamples:S(e.codeSamples),layout:e.layout||d.THREE_PANEL,events:e.events||{},unstable_hooks:e.unstable_hooks||a(n.HOOKS)||{},unstable_skipSamples:o(e.unstable_skipSamples,!1),unstable_externalCodeSamples:e.unstable_externalCodeSamples||[],hidePropertiesPrefix:o(e?.hidePropertiesPrefix,!1)}}export{y as normalizeOptions};
