import e from"node:path";import{getNodeAttribute as g,setNodeAttributeValue as h}from"../../../../shared/markdoc.js";import{isL10nPath as m}from"../../../fs/utils/is-l10n-path.js";import{getLocaleFromRelativePath as v}from"../../../fs/utils/get-locale-from-relative-path.js";import{slash as A}from"../../../../shared/utils.js";import{getLinkOriginalAttrName as d}from"./utils.js";async function N(o,i,r,n){const s=g(o,i);if(!s)return;const l=n.actions.contentDir,a=d(i),t=o[a]||s;o[a]=t;const c=m(r)?v(r):void 0,f=n.context.fs,p=c&&!m(t.slice(1))?`${f.localizationFolder}/${c}/`:"",u=t.startsWith("/")?p+t.slice(1):A(e.relative(l,e.resolve(l,e.dirname(r),t)));h(o,i,u)}export{N as resolveRelativePath};
