import{n as e}from"./chunk-DR8-3Aex.js";import{_ as t,h as n}from"./debug-otxXY3j-.js";import{n as r,t as i}from"./cwd--iizewsn.js";import{i as a,o}from"./platform-mh9ypxS8.js";import{n as s,r as c}from"./windowsPaths-BeDSnJ23.js";import{l}from"./sessionStoragePortable-CJUZrbIq.js";import{homedir as u}from"os";import{dirname as d,isAbsolute as f,join as p,normalize as m,posix as h,relative as g,resolve as _}from"path";function v(e,t){let r=t??i()??n().cwd();if(typeof e!=`string`)throw TypeError(`Path must be a string, received ${typeof e}`);if(typeof r!=`string`)throw TypeError(`Base directory must be a string, received ${typeof r}`);if(e.includes(`\0`)||r.includes(`\0`))throw Error(`Path contains null bytes`);let o=e=>e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e),s=e.trim();if(!s)return a()===`windows`&&o(r)?h.normalize(r).normalize(`NFC`):m(r).normalize(`NFC`);if(s===`~`)return u().normalize(`NFC`);if(s.startsWith(`~/`))return p(u(),s.slice(2)).normalize(`NFC`);let l=s;if(a()===`windows`&&s.match(/^\/[a-z]\//i))try{l=c(s)}catch{l=s}return f(l)?a()===`windows`&&o(l)?h.normalize(l).normalize(`NFC`):m(l).normalize(`NFC`):a()===`windows`&&o(r)&&!/^[A-Za-z]:/.test(l)&&!l.startsWith(`\\\\`)?h.resolve(r,l).normalize(`NFC`):_(r,l).normalize(`NFC`)}function y(e){let t=g(i(),e);return t.startsWith(`..`)?e:t}function b(e){let t=v(e);if(t.startsWith(`\\\\`)||t.startsWith(`//`))return d(t);try{if(n().statSync(t).isDirectory())return t}catch{}return d(t)}function x(e){return/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(e)}function S(e){return m(e).replace(/\\/g,`/`)}var C=e((()=>{r(),t(),o(),s(),l()}));export{S as a,C as i,v as n,y as o,b as r,x as t};