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