import { format as e, formatRegExp as t, objDisplay as n } from "../../utils/dist/display.js";
import { assertTypes as r, createDefer as i, filterOutComments as a, isNegativeNaN as o, isObject as s, objectAttr as c, ordinal as l, toArray as u, unique as d } from "../../utils/dist/helpers.js";
import { getSafeTimers as f } from "../../utils/dist/timers.js";
import { parseSingleStack as p } from "../../utils/dist/source-map.js";
//#region ../../node_modules/@vitest/runner/dist/chunk-artifact.js
var m = class extends Error {
	code = "VITEST_PENDING";
	taskId;
	constructor(e, t, n) {
		super(e), this.message = e, this.note = n, this.taskId = t.id;
	}
}, h = class extends Error {
	name = "FixtureDependencyError";
}, g = class extends Error {
	name = "FixtureAccessError";
}, _ = class extends Error {
	name = "FixtureParseError";
}, v = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap();
function ne(e, t) {
	v.set(e, t);
}
function re(e, t) {
	ee.set(e, t);
}
function ie(e) {
	return ee.get(e);
}
function ae(e, t) {
	te.set(e, t);
}
function oe(e) {
	return te.get(e);
}
var y = Symbol.for("VITEST_FIXTURE_STACK_TRACE"), b = class e {
	_suiteContexts;
	_overrides = /* @__PURE__ */ new WeakMap();
	_registrations;
	static _definitions = [];
	static _builtinFixtures = [
		"task",
		"signal",
		"onTestFailed",
		"onTestFinished",
		"skip",
		"annotate"
	];
	static _fixtureOptionKeys = [
		"auto",
		"injected",
		"scope"
	];
	static _fixtureScopes = [
		"test",
		"file",
		"worker"
	];
	static _workerContextSuite = { type: "worker" };
	static clearDefinitions() {
		e._definitions.length = 0;
	}
	static getWorkerContexts() {
		return e._definitions.map((e) => e.getWorkerContext());
	}
	static getFileContexts(t) {
		return e._definitions.map((e) => e.getFileContext(t));
	}
	static isFixtureOptions(t) {
		return s(t) && Object.keys(t).some((t) => e._fixtureOptionKeys.includes(t));
	}
	constructor(t) {
		this._registrations = t ?? /* @__PURE__ */ new Map(), this._suiteContexts = /* @__PURE__ */ new WeakMap(), e._definitions.push(this);
	}
	extend(t, n) {
		let { suite: r } = B(), i = !r || r.file === r;
		return new e(this.parseUserFixtures(t, n, i));
	}
	get(e) {
		let t = e;
		for (; t;) {
			let e = this._overrides.get(t);
			if (e) return e;
			if (t === t.file) break;
			t = t.suite || t.file;
		}
		return this._registrations;
	}
	override(e, t) {
		let { suite: n, file: r } = B(), i = n || r, a = !n || n.file === n, o = new Map(this.get(i)), s = this.parseUserFixtures(e, t, a, o);
		a ? this._registrations = s : this._overrides.set(i, s);
	}
	getFileContext(e) {
		return this._suiteContexts.has(e) || this._suiteContexts.set(e, Object.create(null)), this._suiteContexts.get(e);
	}
	getWorkerContext() {
		return this._suiteContexts.has(e._workerContextSuite) || this._suiteContexts.set(e._workerContextSuite, Object.create(null)), this._suiteContexts.get(e._workerContextSuite);
	}
	parseUserFixtures(t, n, r, i = new Map(this._registrations)) {
		let a = [];
		Object.entries(n).forEach(([n, o]) => {
			let s, c, l;
			Array.isArray(o) && o.length >= 2 && e.isFixtureOptions(o[1]) ? (l = o[1], s = {
				auto: l.auto ?? !1,
				scope: l.scope ?? "test",
				injected: l.injected ?? !1
			}, c = s.injected ? t.injectValue?.(n) ?? o[0] : o[0]) : c = o;
			let u = i.get(n);
			u && s ? (u.scope !== s.scope && a.push(new h(`The "${n}" fixture was already registered with a "${s.scope}" scope.`)), u.auto !== s.auto && a.push(new h(`The "${n}" fixture was already registered as { auto: ${s.auto} }.`))) : u ? s = {
				auto: u.auto,
				scope: u.scope,
				injected: u.injected
			} : s ||= {
				auto: !1,
				injected: !1,
				scope: "test"
			}, s.scope && !e._fixtureScopes.includes(s.scope) && a.push(new h(`The "${n}" fixture has unknown scope "${s.scope}".`)), !r && s.scope !== "test" && a.push(new h(`The "${n}" fixture cannot be defined with a ${s.scope} scope${!l?.scope && u?.scope ? " (inherited from the base fixture)" : ""} inside the describe block. Define it at the top level of the file instead.`));
			let d = w(c) ? A(c) : /* @__PURE__ */ new Set(), f = {
				name: n,
				value: c,
				auto: s.auto ?? !1,
				injected: s.injected ?? !1,
				scope: s.scope ?? "test",
				deps: d,
				parent: u
			};
			w(c) && Object.assign(c, { [y]: /* @__PURE__ */ Error("STACK_TRACE_ERROR") }), i.set(n, f), f.scope === "worker" && (t.pool === "vmThreads" || t.pool === "vmForks") && (f.scope = "file");
		});
		for (let t of i.values()) for (let n of t.deps) {
			if (e._builtinFixtures.includes(n)) continue;
			let r = i.get(n);
			if (!r) {
				a.push(new h(`The "${t.name}" fixture depends on unknown fixture "${n}".`));
				continue;
			}
			if (n === t.name && !t.parent) {
				a.push(new h(`The "${t.name}" fixture depends on itself, but does not have a base implementation.`));
				continue;
			}
			if (e._fixtureScopes.indexOf(t.scope) > e._fixtureScopes.indexOf(r.scope)) {
				a.push(new h(`The ${t.scope} "${t.name}" fixture cannot depend on a ${r.scope} fixture "${r.name}".`));
				continue;
			}
		}
		if (a.length === 1) throw a[0];
		if (a.length > 1) throw AggregateError(a, "Cannot resolve user fixtures. See errors for more information.");
		return i;
	}
}, x = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap();
function C(e, t) {
	let n = B(), r = t?.suite || n.suite || n.file;
	return async (n) => {
		let i = n || t?.context;
		if (!i) return t?.suiteHook && fe(e, t.suiteHook, t.stackTraceError), e({});
		let a = t?.fixtures || ie(i);
		if (!a) return e(i);
		let o = a.get(r);
		if (!o.size) return e(i);
		let s = [], c = A(e);
		for (let e of o.values()) (se(e, t) || c.has(e.name)) && s.push(e);
		if (!s.length) return e(i);
		x.has(i) || x.set(i, []);
		let l = x.get(i), u = de(s, o);
		if (!u.length) return e(i);
		if (t?.suiteHook) {
			let e = u.filter((e) => e.scope === "test");
			if (e.length > 0) {
				let n = e.map((e) => `"${e.name}"`).join(", "), r = new h(`Test-scoped fixtures cannot be used inside ${t.suiteHook} hook. The following fixtures are test-scoped: ${n}. Use { scope: 'file' } or { scope: 'worker' } fixtures instead, or move the logic to ${{
					aroundAll: "aroundEach",
					beforeAll: "beforeEach",
					afterAll: "afterEach"
				}[t.suiteHook]} hook.`);
				throw t.stackTraceError?.stack && (r.stack = r.message + t.stackTraceError.stack.replace(t.stackTraceError.message, "")), r;
			}
		}
		S.has(i) || S.set(i, /* @__PURE__ */ new WeakSet());
		let d = S.get(i);
		for (let e of u) if (e.scope === "test") {
			if (d.has(e)) continue;
			d.add(e);
			let t = await ce(e, i, l);
			i[e.name] = t, l.push(() => {
				d.delete(e);
			});
		} else {
			let t = await le(a, r, e);
			i[e.name] = t;
		}
		return e(i);
	};
}
function se(e, t) {
	return !(!e.auto || t?.suiteHook && e.scope === "test");
}
function w(e) {
	return typeof e == "function";
}
function ce(e, t, n) {
	return w(e.value) ? ue(e.value, e.name, t, n) : e.value;
}
var T = /* @__PURE__ */ new WeakMap();
async function le(e, t, n) {
	let r = e.getWorkerContext(), i = e.getFileContext(t.file), a = n.scope === "worker" ? r : i;
	if (!w(n.value)) return a[n.name] = n.value, n.value;
	if (n.name in a) return a[n.name];
	if (T.has(n)) return T.get(n);
	x.has(a) || x.set(a, []);
	let o = x.get(a), s = ue(n.value, n.name, n.scope === "file" ? {
		...r,
		...i
	} : a, o).then((e) => (a[n.name] = e, T.delete(n), e));
	return T.set(n, s), s;
}
async function ue(e, t, n, r) {
	let a = i(), o = y in e && e[y] instanceof Error ? e[y] : void 0, s = !1, c = e(n, async (e) => {
		s = !0, a.resolve(e);
		let t = i();
		r.push(async () => {
			t.resolve(), await c;
		}), await t;
	}).then(() => {
		if (!s) {
			let e = /* @__PURE__ */ Error(`Fixture "${t}" returned without calling "use". Make sure to call "use" in every code path of the fixture function.`);
			o?.stack && (e.stack = e.message + o.stack.replace(o.message, "")), a.reject(e);
		}
	}).catch((e) => {
		if (!s) {
			a.reject(e);
			return;
		}
		throw e;
	});
	return a;
}
function de(e, t, n = /* @__PURE__ */ new Set(), r = []) {
	return e.forEach((e) => {
		if (!r.includes(e)) {
			if (!w(e.value) || !e.deps) {
				r.push(e);
				return;
			}
			if (n.has(e)) if (e.parent) e = e.parent;
			else throw Error(`Circular fixture dependency detected: ${e.name} <- ${[...n].reverse().map((e) => e.name).join(" <- ")}`);
			n.add(e), de([...e.deps].map((n) => n === e.name ? e.parent : t.get(n)).filter((e) => !!e), t, n, r), r.push(e), n.clear();
		}
	}), r;
}
function fe(e, t, n) {
	let r = A(e, {
		sourceError: n,
		suiteHook: t
	});
	if (r.size) {
		let e = new g(`The ${t} hook uses fixtures "${[...r].join("\", \"")}", but has no access to context. Did you forget to call it as "test.${t}()" instead of "${t}()"?\nIf you used internal "suite" task as the first argument previously, access it in the second argument instead. See https://vitest.dev/guide/test-context#suite-level-hooks`);
		throw n && (e.stack = n.stack?.replace(n.message, e.message)), e;
	}
}
var E = Symbol("$vitest:fixture-props"), D = Symbol("$vitest:fixture-prop-names");
function O(e, t) {
	Object.defineProperty(e, E, {
		value: t,
		enumerable: !1
	});
}
function k(e, t) {
	return e[D] = t, t;
}
function A(e, { sourceError: t, suiteHook: n } = {}) {
	if (D in e) return e[D];
	let { index: r = 0, original: i = e } = E in e ? e[E] : {}, o = a(i.toString());
	/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(o) && (o = o.split(/__async\((?:this|null),/)[1]);
	let s = o.match(/[^(]*\(([^)]*)/);
	if (!s) return k(e, /* @__PURE__ */ new Set());
	let c = pe(s[1]);
	if (!c.length) return k(e, /* @__PURE__ */ new Set());
	let u = c[r];
	if (!u) return k(e, /* @__PURE__ */ new Set());
	if (!(u[0] === "{" && u.endsWith("}"))) {
		let e = l(r + 1), i = new _(`The ${e} argument inside a fixture must use object destructuring pattern, e.g. ({ task } => {}). Instead, received "${u}".${n ? ` If you used internal "suite" task as the ${e} argument previously, access it in the ${l(r + 2)} argument instead.` : ""}`);
		throw t && (i.stack = t.stack?.replace(t.message, i.message)), i;
	}
	let d = pe(u.slice(1, -1).replace(/\s/g, "")).map((e) => e.replace(/:.*|=.*/g, "")), f = d.at(-1);
	if (f && f.startsWith("...")) {
		let e = new _(`Rest parameters are not supported in fixtures, received "${f}".`);
		throw t && (e.stack = t.stack?.replace(t.message, e.message)), e;
	}
	return k(e, new Set(d));
}
function pe(e) {
	let t = [], n = [], r = 0;
	for (let i = 0; i < e.length; i++) if (e[i] === "{" || e[i] === "[") n.push(e[i] === "{" ? "}" : "]");
	else if (e[i] === n.at(-1)) n.pop();
	else if (!n.length && e[i] === ",") {
		let n = e.substring(r, i).trim();
		n && t.push(n), r = i + 1;
	}
	let i = e.substring(r).trim();
	return i && t.push(i), t;
}
var me;
function j() {
	return me;
}
var he = Symbol("kChainableContext");
function M(e) {
	return e?.[he];
}
function ge(e, t, n) {
	function r(n) {
		let i = function(...e) {
			return t.apply(n, e);
		};
		Object.assign(i, t), Object.defineProperty(i, he, {
			value: {
				withContext: () => i.bind(n),
				getFixtures: () => n.fixtures,
				setContext: (e, t) => {
					n[e] = t;
				},
				mergeContext: (e) => {
					Object.assign(n, e);
				}
			},
			enumerable: !1
		});
		for (let t of e) Object.defineProperty(i, t, { get() {
			return r({
				...n,
				[t]: !0
			});
		} });
		return i;
	}
	let i = r(n ?? {});
	return Object.defineProperty(i, "fn", {
		value: t,
		enumerable: !1
	}), i;
}
function N() {
	return z().config.hookTimeout;
}
var _e = Symbol.for("VITEST_CLEANUP_TIMEOUT"), ve = Symbol.for("VITEST_CLEANUP_STACK_TRACE"), ye = Symbol.for("VITEST_AROUND_TIMEOUT"), be = Symbol.for("VITEST_AROUND_STACK_TRACE");
function xe(e, t = N()) {
	r(e, "\"beforeAll\" callback", ["function"]);
	let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), i = M(this);
	return B().on("beforeAll", Object.assign(q(P("beforeAll", e, i, n), t, !0, n), {
		[_e]: t,
		[ve]: n
	}));
}
function Se(e, t) {
	r(e, "\"afterAll\" callback", ["function"]);
	let n = M(this), i = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
	return B().on("afterAll", q(P("afterAll", e, n, i), t ?? N(), !0, i));
}
function Ce(e, t = N()) {
	r(e, "\"beforeEach\" callback", ["function"]);
	let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
	return B().on("beforeEach", Object.assign(q((t, n) => C(e, { suite: n })(t), t ?? N(), !0, n, Y), {
		[_e]: t,
		[ve]: n
	}));
}
function we(e, t) {
	return r(e, "\"afterEach\" callback", ["function"]), B().on("afterEach", q((t, n) => C(e, { suite: n })(t), t ?? N(), !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), Y));
}
function Te(e, t) {
	r(e, "\"aroundAll\" callback", ["function"]);
	let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), i = t ?? N(), a = M(this);
	return B().on("aroundAll", Object.assign(P("aroundAll", e, a, n, 1), {
		[ye]: i,
		[be]: n
	}));
}
function Ee(e, t) {
	r(e, "\"aroundEach\" callback", ["function"]);
	let n = /* @__PURE__ */ Error("STACK_TRACE_ERROR"), i = t ?? N();
	return B().on("aroundEach", Object.assign((t, n, r) => {
		let i = (n) => e(t, n, r);
		return O(i, {
			index: 1,
			original: e
		}), C(i, { suite: r })(n);
	}, {
		[ye]: i,
		[be]: n
	}));
}
function P(e, t, n, r, i = 0) {
	return (...a) => {
		let o = a.at(-1), s = a.slice(0, -1), c = (e) => t(...s, e, o);
		O(c, {
			index: i,
			original: t
		});
		let l = n?.getFixtures(), u = l?.getFileContext(o.file);
		return C(c, {
			suiteHook: e,
			fixtures: l,
			context: u,
			stackTraceError: r
		})();
	};
}
function F(e, t) {
	let n = t.split("\n").slice(1);
	for (let t of n) {
		let n = p(t);
		if (n && n.file === e) return n;
	}
}
function De(e, t) {
	if (!e.strictTags) return;
	let n = new Set(e.tags.map((e) => e.name));
	for (let r of t) if (!n.has(r)) throw Oe(e.tags, r);
}
function Oe(e, t, n = "tag") {
	throw e.length ? Error(`The ${n} "${t}" is not defined in the configuration. Available tags are:\n${e.map((e) => `- ${e.name}${e.description ? `: ${e.description}` : ""}`).join("\n")}`) : Error(`The Vitest config does't define any "tags", cannot apply "${t}" ${n} for this test. See: https://vitest.dev/guide/test-tags`);
}
function I(e, t = " > ") {
	return e.filter((e) => e !== void 0).join(t);
}
var L = Ie();
H(function(e, t, n) {
	if (j()) throw Error("Calling the test function inside another test function is not allowed. Please put it inside \"describe\" or \"suite\" so it can be properly collected.");
	B().test.fn.call(this, U(e), t, n);
});
var R, ke, Ae;
function je(e, t) {
	if (!e) throw Error(`Vitest failed to find ${t}. One of the following is possible:
- "vitest" is imported directly without running "vitest" command
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
- "vitest" is imported inside Vite / Vitest config file
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
`);
}
function z() {
	return je(R, "the runner"), R;
}
function B() {
	let e = K.currentSuite || ke;
	return je(e, "the current suite"), e;
}
function Me() {
	return {
		beforeAll: [],
		afterAll: [],
		beforeEach: [],
		afterEach: [],
		aroundEach: [],
		aroundAll: []
	};
}
var Ne = Infinity;
function V(e, t) {
	if (typeof t == "object" && t) throw TypeError("Signature \"test(name, fn, { ... })\" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.");
	let n = {}, r;
	if (typeof t == "number" ? n = { timeout: t } : typeof e == "object" && (n = e), typeof e == "function") {
		if (typeof t == "function") throw TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
		r = e;
	} else typeof t == "function" && (r = t);
	return {
		options: n,
		handler: r
	};
}
function Pe(e, t = () => {}, n, r, i) {
	let a = [], o;
	p(!0);
	let s = function(e = "", t = {}) {
		let n = K.currentSuite?.suite, r = d([...(n ?? K.currentSuite?.file)?.tags || [], ...u(t.tags)]), o = r.map((e) => {
			let t = R.config.tags?.find((t) => t.name === e);
			if (!t && R.config.strictTags) throw Oe(R.config.tags, e);
			return t;
		}).filter((e) => e != null).sort((e, t) => (t.priority ?? Ne) - (e.priority ?? Ne)).reduce((e, t) => {
			let { name: n, description: r, priority: i, meta: a, ...o } = t;
			return Object.assign(e, o), a && (e.meta = Object.assign(e.meta ?? Object.create(null), a)), e;
		}, {}), s = t.meta;
		t = {
			...o,
			...t
		};
		let c = t.timeout ?? R.config.testTimeout, l = n?.meta, f = o.meta, p = Object.create(null);
		f && Object.assign(p, f), l && Object.assign(p, l), s && Object.assign(p, s);
		let m = {
			id: "",
			name: e,
			fullName: I([n?.fullName ?? K.currentSuite?.file?.fullName, e]),
			fullTestName: I([n?.fullTestName, e]),
			suite: n,
			each: t.each,
			fails: t.fails,
			context: void 0,
			type: "test",
			file: n?.file ?? K.currentSuite?.file,
			timeout: c,
			retry: t.retry ?? R.config.retry,
			repeats: t.repeats,
			mode: t.only ? "only" : t.skip ? "skip" : t.todo ? "todo" : "run",
			meta: p,
			annotations: [],
			artifacts: [],
			tags: r
		}, h = t.handler;
		m.mode === "run" && !h && (m.mode = "todo"), (t.concurrent ?? (!t.sequential && R.config.sequence.concurrent)) && (m.concurrent = !0), m.shuffle = i?.shuffle;
		let g = We(m, R);
		Object.defineProperty(m, "context", {
			value: g,
			enumerable: !1
		}), re(g, t.fixtures ?? new b());
		let _ = Error.stackTraceLimit;
		Error.stackTraceLimit = 10;
		let v = /* @__PURE__ */ Error("STACK_TRACE_ERROR");
		if (Error.stackTraceLimit = _, h && ne(m, q(He(Fe(C(h, { context: g }), m), m.context.signal), c, !1, v, (e, t) => Y([g], t))), R.config.includeTaskLocation) {
			let e = v.stack, t = F(Ae, e);
			t && (m.location = {
				line: t.line,
				column: t.column
			});
		}
		return a.push(m), m;
	}, c = H(function(e, t, n) {
		let { options: r, handler: a } = V(t, n);
		typeof i == "object" && (r = Object.assign({}, i, r));
		let o = this.concurrent ?? (!this.sequential && r?.concurrent);
		r.concurrent != null && o != null && (r.concurrent = o);
		let c = this.sequential ?? (!this.concurrent && r?.sequential);
		r.sequential != null && c != null && (r.sequential = c);
		let l = s(U(e), {
			...this,
			...r,
			handler: a
		});
		l.type = "test";
	}), l = {
		type: "collector",
		name: e,
		mode: n,
		suite: o,
		options: i,
		test: c,
		file: o.file,
		tasks: a,
		collect: h,
		task: s,
		clear: m,
		on: f
	};
	function f(e, ...t) {
		oe(o)[e].push(...t);
	}
	function p(t) {
		typeof i == "number" && (i = { timeout: i });
		let a = K.currentSuite?.suite, s = a ?? K.currentSuite?.file, c = u(i?.tags);
		if (De(R.config, c), o = {
			id: "",
			type: "suite",
			name: e,
			fullName: I([a?.fullName ?? K.currentSuite?.file?.fullName, e]),
			fullTestName: I([a?.fullTestName, e]),
			suite: a,
			mode: n,
			each: r,
			file: a?.file ?? K.currentSuite?.file,
			shuffle: i?.shuffle,
			tasks: [],
			meta: i?.meta ?? Object.create(null),
			concurrent: i?.concurrent,
			tags: d([...s?.tags || [], ...c])
		}, R && t && R.config.includeTaskLocation) {
			let e = Error.stackTraceLimit;
			Error.stackTraceLimit = 15;
			let t = (/* @__PURE__ */ Error("stacktrace")).stack;
			Error.stackTraceLimit = e;
			let n = F(Ae, t);
			n && (o.location = {
				line: n.line,
				column: n.column
			});
		}
		ae(o, Me());
	}
	function m() {
		a.length = 0, p(!1);
	}
	async function h(e) {
		if (!e) throw TypeError("File is required to collect tasks.");
		t && await Ve(l, () => t(c));
		let n = [];
		for (let t of a) n.push(t.type === "collector" ? await t.collect(e) : t);
		return o.tasks = n, o;
	}
	return Be(l), l;
}
function Fe(e, t) {
	return (async (...n) => {
		let r = await e(...n);
		if (t.promises) {
			let e = (await Promise.allSettled(t.promises)).map((e) => e.status === "rejected" ? e.reason : void 0).filter(Boolean);
			if (e.length) throw e;
		}
		return r;
	});
}
function Ie() {
	function e(e, t, n) {
		if (j()) throw Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
		let r = K.currentSuite || ke, { options: i, handler: a } = V(t, n), o = i.concurrent || this.concurrent || i.sequential === !1, s = i.sequential || this.sequential || i.concurrent === !1, { meta: c, ...l } = r?.options || {};
		i = {
			...l,
			...i
		};
		let u = this.shuffle ?? i.shuffle ?? r?.options?.shuffle ?? R?.config.sequence.shuffle;
		u != null && (i.shuffle = u);
		let d = this.only ?? i.only ? "only" : this.skip ?? i.skip ? "skip" : this.todo ?? i.todo ? "todo" : "run";
		d === "run" && !a && (d = "todo");
		let f = o || i.concurrent && !s, p = s || i.sequential && !o;
		return f != null && (i.concurrent = f && !p), p != null && (i.sequential = p && !f), c && (i.meta = Object.assign(Object.create(null), c, i.meta)), Pe(U(e), a, d, this.each, i);
	}
	return e.each = function(e, ...t) {
		let n = M(this), r = n.withContext();
		return n.setContext("each", !0), Array.isArray(e) && t.length && (e = G(e, t)), (t, i, a) => {
			let o = U(t), s = e.every(Array.isArray), { options: c, handler: l } = V(i, a), u = typeof i == "function";
			e.forEach((e, t) => {
				let n = Array.isArray(e) ? e : [e];
				u ? s ? r(W(o, n, t), l ? () => l(...n) : void 0, c.timeout) : r(W(o, n, t), l ? () => l(e) : void 0, c.timeout) : s ? r(W(o, n, t), c, l ? () => l(...n) : void 0) : r(W(o, n, t), c, l ? () => l(e) : void 0);
			}), n.setContext("each", void 0);
		};
	}, e.for = function(e, ...t) {
		return Array.isArray(e) && t.length && (e = G(e, t)), (t, n, r) => {
			let i = U(t), { options: a, handler: o } = V(n, r);
			e.forEach((e, t) => {
				L(W(i, u(e), t), a, o ? () => o(e) : void 0);
			});
		};
	}, e.skipIf = (e) => e ? L.skip : L, e.runIf = (e) => e ? L : L.skip, ge([
		"concurrent",
		"sequential",
		"shuffle",
		"skip",
		"only",
		"todo"
	], e);
}
function Le(e) {
	let t = e;
	t.each = function(e, ...t) {
		let n = M(this), r = n.withContext();
		return n.setContext("each", !0), Array.isArray(e) && t.length && (e = G(e, t)), (t, i, a) => {
			let o = U(t), s = e.every(Array.isArray), { options: c, handler: l } = V(i, a), u = typeof i == "function";
			e.forEach((e, t) => {
				let n = Array.isArray(e) ? e : [e];
				u ? s ? r(W(o, n, t), l ? () => l(...n) : void 0, c.timeout) : r(W(o, n, t), l ? () => l(e) : void 0, c.timeout) : s ? r(W(o, n, t), c, l ? () => l(...n) : void 0) : r(W(o, n, t), c, l ? () => l(e) : void 0);
			}), n.setContext("each", void 0);
		};
	}, t.for = function(e, ...t) {
		let n = M(this).withContext();
		return Array.isArray(e) && t.length && (e = G(e, t)), (t, r, i) => {
			let a = U(t), { options: o, handler: s } = V(r, i);
			e.forEach((e, t) => {
				let r = s ? (t) => s(e, t) : void 0;
				r && O(r, {
					index: 1,
					original: s
				}), n(W(a, u(e), t), o, r);
			});
		};
	}, t.skipIf = function(e) {
		return e ? this.skip : this;
	}, t.runIf = function(e) {
		return e ? this : this.skip;
	};
	function n(e, t, n) {
		if (typeof e != "string") return e;
		let r = e, i, a;
		if (n === void 0 ? typeof t == "object" && t && !Array.isArray(t) && b.isFixtureOptions(t) ? (i = t, a = {}) : (i = void 0, a = t) : (i = t, a = n), typeof a == "function") {
			let e = a, t = async (t, n) => {
				let r;
				await n(await e(t, { onCleanup: (e) => {
					if (r !== void 0) throw Error("onCleanup can only be called once per fixture. Define separate fixtures if you need multiple cleanup functions.");
					r = e;
				} })), r && await r();
			};
			return O(t, { original: e }), i ? { [r]: [t, i] } : { [r]: t };
		}
		return i ? { [r]: [a, i] } : { [r]: a };
	}
	return t.override = function(e, t, r) {
		let i = n(e, t, r);
		return M(this).getFixtures().override(R, i), this;
	}, t.scoped = function(e) {
		return console.warn("test.scoped() is deprecated and will be removed in future versions. Please use test.override() instead."), this.override(e);
	}, t.extend = function(t, r, i) {
		let a = n(t, r, i), o = M(this).getFixtures().extend(R, a), s = H(function(t, n, r) {
			e.call(this, U(t), n, r);
		});
		return M(s).mergeContext({ fixtures: o }), s;
	}, t.describe = L, t.suite = L, t.beforeEach = Ce, t.afterEach = we, t.beforeAll = xe, t.afterAll = Se, t.aroundEach = Ee, t.aroundAll = Te, ge([
		"concurrent",
		"sequential",
		"skip",
		"only",
		"todo",
		"fails"
	], t, { fixtures: new b() });
}
function H(e) {
	return Le(e);
}
function U(e) {
	return typeof e == "string" ? e : typeof e == "function" ? e.name || "<anonymous>" : String(e);
}
function W(r, i, a) {
	(r.includes("%#") || r.includes("%$")) && (r = r.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${a}`).replace(/%\$/g, `${a + 1}`).replace(/__vitest_escaped_%__/g, "%%"));
	let l = r.split("%").length - 1;
	r.includes("%f") && (r.match(/%f/g) || []).forEach((e, t) => {
		if (o(i[t]) || Object.is(i[t], -0)) {
			let e = 0;
			r = r.replace(/%f/g, (n) => (e++, e === t + 1 ? "-%f" : n));
		}
	});
	let u = s(i[0]);
	function d(e) {
		return e.replace(/\$([$\w.]+)/g, (e, t) => {
			let r = /^\d+$/.test(t);
			if (!u && !r) return `$${t}`;
			let a = r ? c(i, t) : void 0;
			return n(u ? c(i[0], t, a) : a, { truncate: R?.config?.chaiConfig?.truncateThreshold });
		});
	}
	let f = "", p = 0;
	return Re(r, t, (t) => {
		p < l ? f += e(t[0], i[p++]) : f += t[0];
	}, (e) => {
		f += d(e);
	}), f;
}
function Re(e, t, n, r) {
	let i = 0;
	for (let a of e.matchAll(t)) i < a.index && r(e.slice(i, a.index)), n(a), i = a.index + a[0].length;
	i < e.length && r(e.slice(i));
}
function G(e, t) {
	let n = e.join("").trim().replace(/ /g, "").split("\n").map((e) => e.split("|"))[0], r = [];
	for (let e = 0; e < Math.floor(t.length / n.length); e++) {
		let i = {};
		for (let r = 0; r < n.length; r++) i[n[r]] = t[e * n.length + r];
		r.push(i);
	}
	return r;
}
var ze = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, K = {
	tasks: [],
	currentSuite: null
};
function Be(e) {
	K.currentSuite?.tasks.push(e);
}
async function Ve(e, t) {
	let n = K.currentSuite;
	K.currentSuite = e, await t(), K.currentSuite = n;
}
function q(e, t, n = !1, r, i) {
	if (t <= 0 || t === Infinity) return e;
	let { setTimeout: a, clearTimeout: o } = f();
	return (function(...s) {
		let c = ze(), l = z();
		return l._currentTaskStartTime = c, l._currentTaskTimeout = t, new Promise((u, d) => {
			let f = a(() => {
				o(f), p();
			}, t);
			f.unref?.();
			function p() {
				let e = Ge(n, t, r);
				i?.(s, e), d(e);
			}
			function m(e) {
				if (l._currentTaskStartTime = void 0, l._currentTaskTimeout = void 0, o(f), ze() - c >= t) {
					p();
					return;
				}
				u(e);
			}
			function h(e) {
				l._currentTaskStartTime = void 0, l._currentTaskTimeout = void 0, o(f), d(e);
			}
			try {
				let t = e(...s);
				typeof t == "object" && t && typeof t.then == "function" ? t.then(m, h) : m(t);
			} catch (e) {
				h(e);
			}
		});
	});
}
function He(e, t) {
	return (function(...n) {
		return new Promise((r, i) => {
			t.addEventListener("abort", () => i(t.reason));
			try {
				let t = e(...n);
				typeof t == "object" && t && typeof t.then == "function" ? t.then(r, i) : r(t);
			} catch (e) {
				i(e);
			}
		});
	});
}
var J = /* @__PURE__ */ new WeakMap();
function Y([e], t) {
	e && Ue(e, t);
}
function Ue(e, t) {
	J.get(e)?.abort(t);
}
function We(e, t) {
	let n = function() {
		throw Error("done() callback is deprecated, use promise instead");
	}, r = J.get(n);
	return r || (r = new AbortController(), J.set(n, r)), n.signal = r.signal, n.task = e, n.skip = (t, n) => {
		if (t !== !1) throw e.result ??= { state: "skip" }, e.result.pending = !0, new m("test is skipped; abort execution", e, typeof t == "string" ? t : n);
	}, n.annotate = ((n, r, i) => {
		if (e.result && e.result.state !== "run") throw Error(`Cannot annotate tests outside of the test run. The test "${e.name}" finished running with the "${e.result.state}" state already.`);
		let a = {
			message: n,
			type: typeof r == "object" || r === void 0 ? "notice" : r
		}, o = typeof r == "object" ? r : i;
		return o && (a.attachment = o, $e(a.attachment)), Qe(e, Xe(e, {
			type: "internal:annotation",
			annotation: a
		}).then(async ({ annotation: n }) => {
			if (!t.onTestAnnotate) throw Error("Test runner doesn't support test annotations.");
			await Ye(t);
			let r = await t.onTestAnnotate(e, n);
			return e.annotations.push(r), r;
		}));
	}), n.onTestFailed = (n, i) => {
		e.onFailed ||= [], e.onFailed.push(q(n, i ?? t.config.hookTimeout, !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), (e, t) => r.abort(t)));
	}, n.onTestFinished = (n, i) => {
		e.onFinished ||= [], e.onFinished.push(q(n, i ?? t.config.hookTimeout, !0, /* @__PURE__ */ Error("STACK_TRACE_ERROR"), (e, t) => r.abort(t)));
	}, t.extendTaskContext?.(n) || n;
}
function Ge(e, t, n) {
	let r = `${e ? "Hook" : "Test"} timed out in ${t}ms.\nIf this is a long-running ${e ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${e ? "hookTimeout" : "testTimeout"}".`, i = Error(r);
	return n?.stack && (i.stack = n.stack.replace(i.message, n.message)), i;
}
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now, Date.now;
var { clearTimeout: Ke, setTimeout: qe } = f(), X = /* @__PURE__ */ new Map(), Z = [], Q = [];
function Je(e) {
	if (X.size) {
		let t = Array.from(X).map(([e, t]) => [
			e,
			t[0],
			t[1]
		]), n = e.onTaskUpdate?.(t, Z);
		n && (Q.push(n), n.then(() => Q.splice(Q.indexOf(n), 1), () => {})), Z.length = 0, X.clear();
	}
}
async function Ye(e) {
	Je(e), await Promise.all(Q);
}
async function Xe(e, t) {
	let n = z(), r = F(e.file.filepath, (/* @__PURE__ */ Error("STACK_TRACE")).stack);
	if (r && (t.location = {
		file: r.file,
		line: r.line,
		column: r.column
	}, t.type === "internal:annotation" && (t.annotation.location = t.location)), Array.isArray(t.attachments)) for (let e of t.attachments) $e(e);
	if (t.type === "internal:annotation") return t;
	if (!n.onTestArtifactRecord) throw Error("Test runner doesn't support test artifacts.");
	await Ye(n);
	let i = await n.onTestArtifactRecord(e, t);
	return e.artifacts.push(i), i;
}
var $ = [];
for (let e = 65; e < 91; e++) $.push(String.fromCharCode(e));
for (let e = 97; e < 123; e++) $.push(String.fromCharCode(e));
for (let e = 0; e < 10; e++) $.push(e.toString(10));
$.push("+", "/");
function Ze(e) {
	let t = "", n = e.byteLength;
	for (let r = 0; r < n; r += 3) if (n === r + 1) {
		let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4;
		t += $[n], t += $[i], t += "==";
	} else if (n === r + 2) {
		let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4 | (e[r + 1] & 240) >> 4, a = (e[r + 1] & 15) << 2;
		t += $[n], t += $[i], t += $[a], t += "=";
	} else {
		let n = (e[r] & 252) >> 2, i = (e[r] & 3) << 4 | (e[r + 1] & 240) >> 4, a = (e[r + 1] & 15) << 2 | (e[r + 2] & 192) >> 6, o = e[r + 2] & 63;
		t += $[n], t += $[i], t += $[a], t += $[o];
	}
	return t;
}
function Qe(e, t) {
	return t = t.finally(() => {
		if (!e.promises) return;
		let n = e.promises.indexOf(t);
		n !== -1 && e.promises.splice(n, 1);
	}), e.promises ||= [], e.promises.push(t), t;
}
function $e(e) {
	if (e.body == null && !e.path) throw TypeError("Test attachment requires \"body\" or \"path\" to be set. Both are missing.");
	if (e.body && e.path) throw TypeError("Test attachment requires only one of \"body\" or \"path\" to be set. Both are specified.");
	if (e.path && e.bodyEncoding) throw TypeError("Test attachment with \"path\" should not have \"bodyEncoding\" specified.");
	e.body instanceof Uint8Array && (e.body = Ze(e.body)), e.body != null && (e.bodyEncoding ??= "base64");
}
//#endregion
export { Se as afterAll, we as afterEach, Te as aroundAll, Ee as aroundEach, xe as beforeAll, Ce as beforeEach, Le as createTaskCollector, B as getCurrentSuite, j as getCurrentTest, oe as getHooks, Xe as recordArtifact, ne as setFn, ae as setHooks, L as suite };

//# sourceMappingURL=chunk-artifact.js.map