import{reporter as c}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as a}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as m}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{FileNotFoundError as p,resolveSrcSet as u}from"../../../utils/index.js";import{getLinkOriginalAttrName as g}from"./utils.js";import{MdResolveError as v}from"./md-resolve-error.js";async function k(r,e,l,{actions:{contentDir:n,outdir:s},context:f}){if(a(r,e)){const i=g(e),o=r[i]||a(r,e);if(r[i]=o,!o)return;try{const t=await u(o,f.fs,{fromFileRelativePath:l,contentDir:n,outdir:s});m(r,e,t)}catch(t){if(t instanceof p)throw new v(`File ${t.filePath} does not exist`,{rawLink:t.filePath,link:t.filePath});await c.panicOnBuild(`Cannot resolve 'srcSet' attribute: ${t.message}`)}}}export{k as resolveImageSrcSet};
