import{isTruthy as m}from"../../../utils/guards/is-truthy.js";import{normalizeRouteSlug as u}from"../../../utils/path/normalize-route-slug.js";import{getTemplatePath as p}from"./get-template-path.js";import{telemetryTraceStep as f}from"../../../cli/telemetry/helpers/trace-step.js";const o="catalog-custom-fields";async function y(){return{id:"CatalogClassic",requiredEntitlements:["catalogClassic"],async processContent(e,{getConfig:l}){await f("build.plugin.catalog_classic",async r=>{const c=e.createTemplate("catalogClassic","@redocly/theme/components/CatalogClassic/CatalogClassic");e.registerServerPropsGetter(o,p("./get-server-props.js"));const a=await l(),i=!!a.rules?.["custom-fields-schema"],g=a.catalogClassic??{};r?.setAttribute("config",JSON.stringify(a.catalogClassic));for(const[n,t]of Object.entries(g)){const s=u(t.slug);e.addRoute({duplicateInAllLocales:!0,slug:s,fsPath:s,templateId:c,excludeFromSidebar:!0,serverPropsGetterIds:i?[o]:[],getNavText:()=>Promise.resolve(t.title||"API Catalog"),getStaticData:async()=>({props:{catalogId:n,catalogConfig:{...t,filters:t.filters?.filter(m),items:void 0},seo:{title:t.title||"API Catalog"}}})})}})}}}export{o as CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID,y as catalogClassicPlugin};
