import*as e from"node:fs";import*as t from"node:path";function n(e){if(!e||e===`/`)return`/`;let t=e.endsWith(`/`)&&e!==`/`?e.slice(0,-1):e;t.startsWith(`/`)||(t=`/${t}`);let n=t.split(`/`).filter(e=>e&&e!==`.`),r=[];for(let e of n)e===`..`?r.pop():r.push(e);return`/${r.join(`/`)}`||`/`}function r(e,t){if(e.includes(`\0`))throw Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function i(e){let t=n(e);if(t===`/`)return`/`;let r=t.lastIndexOf(`/`);return r===0?`/`:t.slice(0,r)}function a(e,t){return t.startsWith(`/`)?n(t):n(e===`/`?`/${t}`:`${e}/${t}`)}function o(e,t){return e===`/`?`/${t}`:`${e}/${t}`}function s(e,t){return t.startsWith(`/`)?n(t):n(o(i(e),t))}function c(e,t){return e===t||e.startsWith(`${t}/`)}function l(n,r){try{let t=e.realpathSync(n);return c(t,r)?t:null}catch(i){if(i.code===`ENOENT`){let i=t.dirname(n);if(i===n)return null;let a=l(i,r);if(a===null)return null;try{if(e.lstatSync(n).isSymbolicLink()){let i=e.readlinkSync(n);if(l(t.isAbsolute(i)?i:t.resolve(t.dirname(n),i),r)===null)return null}}catch{}return t.join(a,t.basename(n))}return null}}function u(n,r,i){let a=l(n,i);if(a===null)return null;let o=t.resolve(n);if(o.slice(r.length)!==a.slice(i.length))return null;try{if(e.lstatSync(o).isSymbolicLink())return null}catch{}return a}function d(t,n){if(!e.existsSync(t))throw Error(`${n} root does not exist`);if(!e.statSync(t).isDirectory())throw Error(`${n} root is not a directory`)}function f(e,t,n,r){let i=e;if(i.path===void 0){for(let t of r)if(i.message?.includes(t))throw e}let a=i.code||`EIO`;throw Error(`${a}: ${n} '${t}'`)}export{c as a,i as c,a as d,n as i,o as l,f as n,l as o,u as r,r as s,d as t,s as u};
//# sourceMappingURL=chunk-XHM67O4N-C_wCK9HT.mjs.map