import{getLineColLocation as u,isAbsoluteUrl as m}from"@redocly/openapi-core";import{getCodeframe as g}from"@redocly/openapi-core";import l from"node:path";import{gray as i}from"../../tools/notifiers/helpers/colors.js";function d(a,s){return`Config validation error:

`+c(a);function c(o){const t=o.location[0];if(!t)return o.message;if(!t.source){const n=t.pointer??"";return`${o.message}${n?` at ${n}`:""}`}const e=t.source?.absoluteRef,r=e&&m(e)?e:e?l.relative(s,e):"config";try{if(typeof t.source.getAst!="function"){const $=t.pointer?i(`at ${t.pointer}`):"";return`${r} ${$}

${o.message}

`}const n=u(t),f=t.pointer?i(`at ${t.pointer}`):"";return`${`${r}:${n.start.line}:${n.start.col}`} ${f}

${o.message}

`+g(n,!0)+`

`}catch{const n=t.pointer?i(`at ${t.pointer}`):"";return`${r} ${n}

${o.message}

`}}}export{d as formatConfigProblem};
