//#region ../../node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
var e = /^[A-Za-z]:\//;
function t(t = "") {
	return t && t.replace(/\\/g, "/").replace(e, (e) => e.toUpperCase());
}
var n = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
function r() {
	return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
}
var i = function(...e) {
	e = e.map((e) => t(e));
	let n = "", i = !1;
	for (let t = e.length - 1; t >= -1 && !i; t--) {
		let a = t >= 0 ? e[t] : r();
		!a || a.length === 0 || (n = `${a}/${n}`, i = o(a));
	}
	return n = a(n, !i), i && !o(n) ? `/${n}` : n.length > 0 ? n : ".";
};
function a(e, t) {
	let n = "", r = 0, i = -1, a = 0, o = null;
	for (let s = 0; s <= e.length; ++s) {
		if (s < e.length) o = e[s];
		else if (o === "/") break;
		else o = "/";
		if (o === "/") {
			if (!(i === s - 1 || a === 1)) if (a === 2) {
				if (n.length < 2 || r !== 2 || n[n.length - 1] !== "." || n[n.length - 2] !== ".") {
					if (n.length > 2) {
						let e = n.lastIndexOf("/");
						e === -1 ? (n = "", r = 0) : (n = n.slice(0, e), r = n.length - 1 - n.lastIndexOf("/")), i = s, a = 0;
						continue;
					} else if (n.length > 0) {
						n = "", r = 0, i = s, a = 0;
						continue;
					}
				}
				t && (n += n.length > 0 ? "/.." : "..", r = 2);
			} else n.length > 0 ? n += `/${e.slice(i + 1, s)}` : n = e.slice(i + 1, s), r = s - i - 1;
			i = s, a = 0;
		} else o === "." && a !== -1 ? ++a : a = -1;
	}
	return n;
}
var o = function(e) {
	return n.test(e);
};
//#endregion
export { i as resolve };

//# sourceMappingURL=chunk-pathe.M-eThtNZ.js.map