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