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