import f from"node:path";import{createConfig as l}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as g}from"../../../../constants/index.js";import{getScorecardConfig as u}from"../get-scorecard-config.js";async function w(s,e){const n=await e.getConfig(),r=u(n),o=r.levels??[],t=f.join(e.fs.cwd,g),i=await c(o,n.plugins,t),a=await m(r.targets,o,n.plugins,t);return{levelsConfig:o,configs:i,targets:a}}async function c(s,e=[],n){const r={};for(const o of s)r[o.name]=await l({...o,plugins:e},{configPath:n});return r}async function m(s,e,n=[],r){return s?Promise.all(s?.filter(o=>!!o.rules).map(async o=>{const t=e.map(i=>({...i,rules:{...i.rules,...o.rules}}));return{...o,configs:await c(t,n,r)}})||[]):[]}export{w as scorecardConfigLoader};
