import { v as e } from "./parser-9pXf3QZR.js";
import { a as t, k as n, m as r, u as i } from "./xmlui-parser-feKTBlgv.js";
import { devices as a, expect as o, test as s } from "@playwright/test";
import "chroma-js";
//#region src/testing/component-test-helpers.ts
function c(e) {
	return typeof e == "string" ? t(e) : {
		component: e,
		errors: [],
		warnings: [],
		erroneousCompoundComponentName: void 0
	};
}
function l(e, t, n) {
	return e instanceof u && (e = e.component), t = Array.isArray(t) ? t : [t], e.evaluate((e, t) => Object.fromEntries(t.style.map((n) => [n.trim().split("-").map((e, t) => t === 0 ? e : e[0].toUpperCase() + e.slice(1)).join(""), window.getComputedStyle(e, t.pseudoElement).getPropertyValue(n)])), {
		style: t,
		pseudoElement: n
	});
}
new class {
	addAnnotation(e, t) {
		return { annotation: {
			type: e,
			description: t ?? ""
		} };
	}
	NOT_IMPLEMENTED_XMLUI(e) {
		return this.addAnnotation("not implemented in xmlui", e);
	}
	TO_BE_IMPLEMENTED(e) {
		return this.addAnnotation("to be implemented", e);
	}
	XMLUI_BUG(e) {
		return this.addAnnotation("xmlui bug", e);
	}
	TEST_INFRA_BUG(e) {
		return this.addAnnotation("test infra bug", e);
	}
	TEST_NOT_WORKING(e) {
		return this.addAnnotation("test not working", e);
	}
	TEST_INFRA_NOT_IMPLEMENTED(e) {
		return this.addAnnotation("test infra not implemented", e);
	}
	REFACTOR(e) {
		return this.addAnnotation("refactor", e);
	}
	UNSURE(e) {
		return this.addAnnotation("unsure", e);
	}
}();
//#endregion
//#region src/testing/ComponentDrivers.ts
var u = class {
	constructor({ locator: e, page: t }) {
		this.click = async (e) => {
			await this.locator.click(e);
		}, this.dblclick = async (e) => {
			await this.locator.dblclick(e);
		}, this.focus = async (e) => {
			await this.locator.focus(e);
		}, this.blur = async (e) => {
			await this.locator.blur(e);
		}, this.hover = async (e) => {
			await this.locator.hover(e);
		}, this.locator = e, this.page = t;
	}
	get component() {
		return this.locator;
	}
	getByTestId(e) {
		return this.component.getByTestId(e).first();
	}
	getByPartName(e) {
		return this.component.locator(`[data-part-id="${e}"]`).first();
	}
	getIcons() {
		return this.component.locator("[data-icon-name=\"*\"]");
	}
	getIconsByName(e) {
		return this.component.locator(`[data-icon-name="${e}"]`);
	}
	getIconByName(e) {
		return this.component.locator(`[data-icon-name="${e}"]`).first();
	}
	getComponentTagName() {
		return this.component.evaluate((e) => e.tagName.toLowerCase());
	}
}, d = class extends u {
	get field() {
		return this.getByPartName("input");
	}
	get label() {
		return this.getByPartName("label");
	}
	get placeholder() {
		return this.field.getAttribute("placeholder");
	}
	get requiredIndicator() {
		return this.component.getByText("*");
	}
}, f = class {
	constructor(e) {
		this.testStateLocator = e;
	}
	get testState() {
		return async () => {
			let e = await this.testStateLocator.textContent();
			return e === "undefined" ? void 0 : JSON.parse(e);
		};
	}
}, p = class extends u {
	getFirstNonTextNode() {
		return this.locator.locator("> *").first();
	}
	getIcons() {
		return this.locator.locator("[data-icon-name]");
	}
}, m = class extends u {
	get separator() {
		return this.component;
	}
	async getOrientation() {
		let e = await this.separator.evaluate((e) => e.className);
		return e.includes("horizontal") ? "horizontal" : e.includes("vertical") ? "vertical" : "unknown";
	}
	async getComputedHeight() {
		return await this.separator.evaluate((e) => window.getComputedStyle(e).height);
	}
	async getComputedWidth() {
		return await this.separator.evaluate((e) => window.getComputedStyle(e).width);
	}
	async getBackgroundColor() {
		return await this.separator.evaluate((e) => window.getComputedStyle(e).backgroundColor);
	}
}, h = class extends u {}, g = class extends u {
	async getResizer() {
		let e = this.locator.locator("[class*=\"resizer\"]"), t = await e.count();
		for (let n = 0; n < t; n++) {
			let t = e.nth(n), r = await t.getAttribute("class");
			if (r && r.includes("resizer") && !r.includes("floating")) return t;
		}
		return e.first();
	}
	async getFloatingResizer() {
		let e = this.locator.locator("[class*=\"resizer\"]"), t = await e.count();
		for (let n = 0; n < t; n++) {
			let t = e.nth(n), r = await t.getAttribute("class");
			if (r && r.includes("floating")) return t;
		}
		return this.locator.locator("[class*=\"floating\"][class*=\"resizer\"]").first();
	}
	async hoverNearResizer() {
		let e = await this.locator.boundingBox();
		e && (await this.page.mouse.move(e.x + e.width / 2, e.y + e.height / 2), await this.page.waitForTimeout(200));
	}
	async dragResizer(e, t) {
		let n = await this.getResizer(), r = await this.getFloatingResizer(), i = n;
		try {
			let e = await n.isVisible(), t = await r.isVisible();
			!e && t ? i = r : e || (await this.hoverNearResizer(), i = r);
		} catch {
			i = n;
		}
		let a = await i.boundingBox();
		if (!a) throw Error("Could not get resizer bounds for drag operation");
		let o = a.x + a.width / 2, s = a.y + a.height / 2, c = o + e, l = s + t;
		await this.page.mouse.move(o, s), await this.page.mouse.down(), await this.page.mouse.move(c, l, { steps: 5 }), await this.page.mouse.up(), await this.page.waitForTimeout(100);
	}
	getPrimaryPanel() {
		return this.locator.locator("[class*=\"primaryPanel\"]").first();
	}
	getSecondaryPanel() {
		return this.locator.locator("[class*=\"secondaryPanel\"]").first();
	}
}, _ = class extends u {
	getSummary() {
		return this.component.locator("[data-part-id=\"summary\"]");
	}
	getSummaryContent() {
		return this.component.locator("[class*=\"_summaryContent_\"]");
	}
	getContent() {
		return this.component.locator("[data-part-id=\"content\"]");
	}
	getIcon() {
		return this.component.locator("[class*=\"_icon_\"] svg");
	}
	getSwitch() {
		return this.component.getByRole("switch");
	}
	async isExpanded() {
		return await this.component.locator("[class*=\"_content_\"]").isVisible();
	}
	async isDisabled() {
		return await this.component.evaluate((e) => e.className.includes("disabled"));
	}
	async expand() {
		await this.isExpanded() || await this.getSummary().click();
	}
	async collapse() {
		await this.isExpanded() && await this.getSummary().click();
	}
	async toggle() {
		await this.getSummary().click();
	}
}, v = class extends u {
	getTextBox() {
		return this.component.locator("input[readonly]");
	}
	getHiddenInput() {
		return this.component.locator("input[type=\"file\"]");
	}
	getBrowseButton() {
		return this.component.locator("[class*=\"_button_\"]");
	}
	getContainer() {
		return this.component;
	}
	async isEnabled() {
		return !await this.getBrowseButton().isDisabled();
	}
	async getSelectedFiles() {
		return await this.getTextBox().inputValue() || "";
	}
	async openFileDialog() {
		await this.getBrowseButton().click();
	}
	async getPlaceholder() {
		return await this.getTextBox().getAttribute("placeholder") || "";
	}
	async focusButton() {
		await this.getBrowseButton().focus();
	}
	async hasReadOnlyAttribute() {
		return await this.getTextBox().getAttribute("readonly") !== null;
	}
	async getAcceptedFileTypes() {
		return await this.getHiddenInput().getAttribute("accept") || "";
	}
	async isMultiple() {
		return await this.getHiddenInput().getAttribute("multiple") !== null;
	}
	async isDirectory() {
		return await this.getHiddenInput().getAttribute("webkitdirectory") !== null;
	}
}, y = class extends u {
	getWrapper() {
		return this.component.locator("[class*=\"_wrapper_\"]");
	}
	getHiddenInput() {
		return this.component.locator("input[type=\"file\"]");
	}
	getDropPlaceholder() {
		return this.component.locator("[class*=\"_dropPlaceholder_\"]");
	}
	getDropIcon() {
		return this.getDropPlaceholder().locator("svg");
	}
	async isDropPlaceholderVisible() {
		return await this.getDropPlaceholder().isVisible();
	}
	async isEnabled() {
		return !await this.getHiddenInput().isDisabled();
	}
	async getDropText() {
		return await this.getDropPlaceholder().textContent() || "";
	}
	async triggerDragEnter() {
		await this.component.dispatchEvent("dragenter");
	}
	async triggerDragLeave() {
		await this.component.dispatchEvent("dragleave");
	}
	async triggerDrop(e = ["test.txt"]) {
		let t = this.getHiddenInput(), n = e.map((e) => ({
			name: e,
			mimeType: "text/plain",
			buffer: Buffer.from("test content")
		}));
		await t.setInputFiles(n), await this.component.evaluate((e, t) => {
			let n = new DragEvent("drop", {
				bubbles: !0,
				cancelable: !0,
				dataTransfer: new DataTransfer()
			});
			t.forEach((e) => {
				let t = new File(["test content"], e, { type: "text/plain" });
				n.dataTransfer?.items.add(t);
			}), e.dispatchEvent(n);
		}, e);
	}
	async triggerPaste() {
		await this.component.dispatchEvent("paste", { clipboardData: {
			files: [{
				name: "pasted.txt",
				type: "text/plain",
				size: 50
			}],
			items: [{
				kind: "file",
				getAsFile: () => ({ name: "pasted.txt" })
			}]
		} });
	}
	async hasChildren() {
		return await this.component.locator("> *:not(input):not([class*=\"_dropPlaceholder_\"])").count() > 0;
	}
}, b = class extends u {
	async mockExternalApi(e, t) {
		let { status: n = 200, headers: r = {}, body: i = {} } = t;
		await this.page.route(e, (e) => e.fulfill({
			status: n,
			headers: r,
			body: JSON.stringify(i)
		}));
	}
	get submitButton() {
		return this.getByPartName("submitButton");
	}
	get cancelButton() {
		return this.getByPartName("cancelButton");
	}
	async hasSubmitButton() {
		return await this.submitButton.count() > 0;
	}
	async submitForm(e = "click") {
		if (e === "keypress") {
			await this.hasSubmitButton() && await this.submitButton.isEnabled() && await this.submitButton.focus(), await this.locator.locator("input").waitFor();
			let e = this.locator.locator("input");
			await e.count() > 0 && await e.first().focus(), await this.page.keyboard.press("Enter");
		} else e === "click" && await this.submitButton.click();
	}
	async getSubmitRequest(e = "/entities", t = "POST", n = "click", r = 5e3) {
		let i = this.page.waitForRequest((n) => n.url().includes(e) && n.method().toLowerCase() === t.toLowerCase(), { timeout: r });
		return await this.submitForm(n), i;
	}
	waitForSubmitResponse(e = "/entities", t = 200, n = 5e3) {
		return this.page.waitForResponse((n) => n.url().includes(e) && n.status() === t, { timeout: n });
	}
	getValidationSummary() {
		return this.component.locator("[data-validation-summary='true']");
	}
	getValidationDisplays() {
		return this.component.locator("[data-validation-summary='true']").locator("[data-validation-display-severity]");
	}
	getValidationDisplaysBySeverity(e) {
		return this.component.locator("[data-validation-summary='true']").locator(`[data-validation-display-severity="${e}"]`);
	}
}, x = class extends u {
	getValidationDisplays() {
		return this.component.locator("[data-validation-summary='true']").locator("[data-validation-display-severity]");
	}
}, S = class extends u {
	getSeverity() {
		return this.component.getAttribute("data-validation-display-severity");
	}
	getText() {
		return this.component.locator("li").textContent();
	}
}, C = class extends u {
	async hasHtmlElement(e) {
		let t = await this.component.innerHTML();
		return e = typeof e == "string" ? [e] : e, e.map((e) => `<${e}`).reduce((e, n) => e && t.includes(n), !0);
	}
}, w = class extends u {}, T = class extends u {}, E = class extends u {
	async toggleDropdownVisibility() {
		await this.component.click();
	}
	async pickADay(e) {
		await this.component.getByRole("gridcell", { name: e }).or(this.page.getByRole("gridcell", { name: e })).first().click({ force: !0 });
	}
}, ee = class extends u {
	async toggleOptionsVisibility() {
		await this.component.click();
	}
	async selectLabel(e) {
		await this.component.getByRole("option", { name: e }).or(this.page.getByRole("option", { name: e })).first().click({ force: !0 });
	}
	async searchFor(e) {
		await this.page.getByRole("combobox").fill(e);
	}
	async chooseIndex(e) {
		await this.locator.getByRole("option").nth(e).or(this.page.getByRole("option").nth(e)).first().click();
	}
}, D = class extends u {
	get clearButton() {
		return this.getByPartName("clearButton");
	}
	async toggleOptionsVisibility() {
		await this.component.click();
	}
	async selectLabel(e) {
		await this.component.getByRole("option", { name: e }).or(this.page.getByRole("option", { name: e })).first().click({ force: !0 });
	}
	async selectFirstLabelPostSearh(e) {
		await this.searchFor(e), await this.chooseIndex(0);
	}
	async searchFor(e) {
		await this.page.getByRole("searchbox").fill(e);
	}
	async chooseIndex(e) {
		await this.locator.getByRole("option").nth(e).or(this.page.getByRole("option").nth(e)).first().click();
	}
	async selectMultipleLabels(e) {
		for (let t of e) await this.component.getByRole("option", { name: t }).or(this.page.getByRole("option", { name: t })).first().click();
	}
}, O = class extends u {}, k = class extends d {}, A = class extends u {
	get bar() {
		return this.component.locator("> div");
	}
	async getProgressRatio() {
		let e = await this.bar.getAttribute("style");
		if (!e) return 0;
		let t = e.match(/width:\s*(\d+(?:\.\d+)?)%/);
		return t ? parseFloat(t[1]) / 100 : 0;
	}
}, j = class extends u {
	get items() {
		return this.component.locator("[data-list-item]").or(this.component.locator("div").filter({ hasText: /^(?!.*Loading).*/ }));
	}
	get loadingSpinner() {
		return this.component.locator("[class*=\"loadingWrapper\"]");
	}
	async isLoading() {
		return await this.loadingSpinner.isVisible().catch(() => !1);
	}
	get groupHeaders() {
		return this.component.locator("[data-group-header]").or(this.component.locator("div").filter({ hasText: /^Category:|^Header:/ }));
	}
	get groupFooters() {
		return this.component.locator("[data-group-footer]").or(this.component.locator("div").filter({ hasText: /^End of/ }));
	}
	get emptyState() {
		return this.component.locator("[data-empty-state]").or(this.component.getByText("No items found!"));
	}
	async scrollTo(e) {
		e === "top" ? await this.component.evaluate((e) => e.scrollTo({ top: 0 })) : e === "bottom" ? await this.component.evaluate((e) => e.scrollTo({ top: e.scrollHeight })) : await this.component.evaluate((e, t) => e.scrollTo({ top: t }), e);
	}
	async getVisibleItemCount() {
		return await this.items.count();
	}
	getItemAt(e) {
		return this.items.nth(e);
	}
	getItemByText(e) {
		return this.component.getByText(e);
	}
	async isEmpty() {
		let e = await this.component.textContent(), t = e?.includes("No data available") || e?.includes("No items found"), n = await this.items.count() > 0 && !t;
		return t || !n;
	}
	async getVisibleItemTexts() {
		let e = await this.items.all();
		return (await Promise.all(e.map((e) => e.textContent()))).filter((e) => e !== null);
	}
}, M = class extends u {}, N = class extends u {}, P = class extends u {
	get svgIcon() {
		return this.component.locator("svg");
	}
}, F = class extends u {}, I = class extends F {}, L = class extends F {}, R = class extends u {}, z = class extends u {}, B = class extends u {
	getIcons() {
		return this.locator.locator("> svg").or(this.locator.locator("> img"));
	}
}, V = class extends u {}, H = class extends u {
	get avatar() {
		return this.component.getByRole("img", { name: "avatar" });
	}
}, U = class extends u {}, W = class extends u {}, G = class extends u {}, K = class extends u {}, q = class extends u {}, J = class extends u {}, Y = class extends u {
	get input() {
		return this.component.locator(">input").or(this.component).first();
	}
	get textBox() {
		return this.input.getByRole("textbox").or(this.input.getByRole("spinbutton"));
	}
	get checkbox() {
		return this.input.getByRole("checkbox");
	}
	get label() {
		return this.component.locator("label");
	}
	get validationStatusTag() {
		return "data-validation-status";
	}
	get validationStatusIndicator() {
		return this.component.locator(`[${this.validationStatusTag}]`);
	}
}, X = class extends u {}, te = class extends u {
	getHeader() {
		return this.component.locator("[class*=\"codeBlockHeader\"]");
	}
	getContent() {
		return this.component.locator("[class*=\"codeBlockContent\"]");
	}
	getCopyButton() {
		return this.component.locator("[class*=\"codeBlockCopyButton\"] button");
	}
	getFilename() {
		return this.getHeader().locator("span");
	}
	async isCopyButtonVisible() {
		return await this.getCopyButton().isVisible();
	}
	async hasHeader() {
		return await this.getHeader().isVisible();
	}
	async getCodeText() {
		return await this.getContent().textContent();
	}
	async clickCopyButton() {
		await this.getCopyButton().click();
	}
	async hoverContent() {
		await this.getContent().hover();
	}
}, Z = class extends d {
	async getIndicatorColor() {
		let { boxShadow: e } = await l(this.component.getByRole("checkbox").or(this.component).last(), "box-shadow", "::before"), t = e.match(/(rgba?\([^)]+\)|hsla?\([^)]+\)|#[a-fA-F0-9]{3,8})/);
		return t ? t[1] : null;
	}
}, Q = class extends u {}, ne = class extends u {
	get spinnerElement() {
		return this.page.locator("[data-testid=\"test-id-component\"]").filter({ has: this.page.locator("div") }).first();
	}
	getSpinnerByIndex(e) {
		return this.page.locator("[data-testid=\"test-id-component\"]").filter({ has: this.page.locator("div") }).nth(e);
	}
	get fullScreenWrapper() {
		return this.page.locator("div[class*=\"_fullScreenSpinnerWrapper_\"]");
	}
	async isFullScreen() {
		try {
			return await this.fullScreenWrapper.isVisible();
		} catch {
			return !1;
		}
	}
	async getSpinnerStyle() {
		return await this.spinnerElement.evaluate((e) => {
			let t = window.getComputedStyle(e);
			return {
				display: t.display,
				position: t.position,
				width: t.width,
				height: t.height,
				animationDuration: t.animationDuration,
				className: e.className
			};
		});
	}
	async getAnimationDuration() {
		return await this.spinnerElement.evaluate((e) => {
			let t = e.querySelector("div");
			return t ? window.getComputedStyle(t).animationDuration : "0s";
		});
	}
	async waitForSpinner(e = 5e3) {
		await this.spinnerElement.waitFor({
			state: "visible",
			timeout: e
		});
	}
	async waitForSpinnerToDisappear(e = 5e3) {
		await this.spinnerElement.waitFor({
			state: "hidden",
			timeout: e
		});
	}
	async isVisible() {
		return await this.spinnerElement.isVisible();
	}
	async getClassName() {
		return await this.spinnerElement.getAttribute("class") || "";
	}
	async getChildCount() {
		return await this.spinnerElement.evaluate((e) => e.querySelectorAll("div").length);
	}
	async getSpinnerCount() {
		return await this.page.locator("[data-testid=\"test-id-component\"]").count();
	}
	getSpinnerByTestId(e) {
		return this.page.locator(`[data-testid="${e}"]`);
	}
	async getFullScreenWrapperInfo() {
		let e = this.fullScreenWrapper;
		return await e.isVisible() ? await e.evaluate((e) => {
			let t = e.parentElement, n = window.getComputedStyle(e);
			return {
				position: n.position,
				inset: n.inset,
				parentClassName: t?.className || "",
				hasSpinnerChild: !!e.querySelector("[class*=\"_lds-ring_\"]")
			};
		}) : null;
	}
}, re = class extends u {
	getTrigger() {
		return this.page.getByRole("button").first();
	}
	async open() {
		await this.getTrigger().click();
	}
	async close() {
		try {
			await this.page.keyboard.press("Escape");
		} catch {
			await this.page.click("html");
		}
	}
	getMenuItems() {
		return this.page.getByRole("menuitem");
	}
	getMenuItem(e) {
		return this.page.getByRole("menuitem", { name: e });
	}
	async clickMenuItem(e) {
		await this.getMenuItem(e).click();
	}
	getSubMenuItems(e) {
		return this.page.getByText(e);
	}
	async openSubMenu(e) {
		await this.page.getByText(e).hover();
	}
	getMenuSeparators() {
		return this.page.locator("[class*=\"DropdownMenuSeparator\"]");
	}
	getMenuContent() {
		return this.page.locator("[class*=\"DropdownMenuContent\"]");
	}
	async isOpen() {
		try {
			return await this.getMenuContent().isVisible();
		} catch {
			return !1;
		}
	}
	async waitForOpen() {
		await this.getMenuContent().waitFor({ state: "visible" });
	}
	async waitForClose() {
		await this.getMenuContent().waitFor({ state: "hidden" });
	}
}, ie = class extends u {
	getMenuItems() {
		return this.page.getByRole("menuitem");
	}
	getMenuItem(e) {
		return this.page.getByRole("menuitem", { name: e });
	}
	async clickMenuItem(e) {
		await this.getMenuItem(e).click();
	}
	async openSubMenu(e) {
		await this.page.getByText(e).hover();
	}
	getMenuSeparators() {
		return this.page.locator("[class*=\"DropdownMenuSeparator\"]");
	}
	getMenuContent() {
		return this.page.locator("[class*=\"ContextMenuContent\"]");
	}
	async isOpen() {
		try {
			return await this.getMenuContent().isVisible();
		} catch {
			return !1;
		}
	}
	async waitForOpen() {
		await this.getMenuContent().waitFor({ state: "visible" });
	}
	async waitForClose() {
		await this.getMenuContent().waitFor({ state: "hidden" });
	}
	async close() {
		await this.page.keyboard.press("Escape");
	}
}, ae = class extends u {
	async getActiveThumb(e = 0) {
		let t = this.page.getByRole("slider"), n = await t.count();
		if (n === 0) throw Error("No slider thumb found to drag");
		return e < 0 ? e = 0 : e >= n && (e = n - 1), t.nth(e);
	}
	async dragThumbByMouse(e, t = 0) {
		let n = this.page.locator("[data-track]");
		await n.waitFor({ state: "visible" });
		let r = await this.getActiveThumb(t);
		if (await r.waitFor({ state: "visible" }), !await r.boundingBox()) throw Error("Could not get thumb bounding box");
		let i = await n.boundingBox();
		if (!i) throw Error("Could not get track bounding box");
		let a;
		a = e === "start" ? i.x : e === "end" ? i.x + i.width : i.x + i.width / 2;
		let o = i.y + i.height / 2;
		await r.hover(), await this.page.mouse.down({ button: "left" }), await this.page.mouse.move(a, o), await this.page.mouse.up();
	}
	async stepThumbByKeyboard(e, t = 0, n = 1) {
		await (await this.getActiveThumb(t)).focus();
		for (let t = 0; t < n; t++) await this.page.keyboard.press(e);
	}
}, oe = class extends u {
	getMenuItems() {
		return this.page.getByRole("menuitem");
	}
}, se = class extends d {
	get hourInput() {
		return this.getByPartName("hour");
	}
	get minuteInput() {
		return this.getByPartName("minute");
	}
	get secondInput() {
		return this.getByPartName("second");
	}
	get amPmInput() {
		return this.getByPartName("ampm");
	}
	get clearButton() {
		return this.getByPartName("clearButton");
	}
}, ce = class extends u {
	async isEnabled() {
		return await this.component.getAttribute("data-timer-enabled") === "true";
	}
	async isRunning() {
		return await this.component.getAttribute("data-timer-running") === "true";
	}
	async isPaused() {
		return await this.component.getAttribute("data-timer-paused") === "true";
	}
	async isInInitialDelay() {
		return await this.component.getAttribute("data-timer-in-initial-delay") === "true";
	}
	async getInterval() {
		let e = await this.component.getAttribute("data-timer-interval");
		return parseInt(e || "0", 10);
	}
	async getInitialDelay() {
		let e = await this.component.getAttribute("data-timer-initial-delay");
		return parseInt(e || "0", 10);
	}
	async isOnce() {
		return await this.component.getAttribute("data-timer-once") === "true";
	}
	async hasExecuted() {
		return await this.component.getAttribute("data-timer-has-executed") === "true";
	}
}, le = class extends d {
	get dayInput() {
		return this.getByPartName("day");
	}
	get monthInput() {
		return this.getByPartName("month");
	}
	get yearInput() {
		return this.getByPartName("year");
	}
	get clearButton() {
		return this.getByPartName("clearButton");
	}
}, ue = class extends u {
	get titlePart() {
		return this.getByPartName("title");
	}
}, de = class extends d {
	get input() {
		return this.getByPartName("input");
	}
	get startAdornment() {
		return this.getByPartName(n);
	}
	get endAdornment() {
		return this.getByPartName(i);
	}
	get button() {
		return this.getByPartName(i);
	}
}, fe = "spinnerUp", pe = "spinnerDown", $ = class extends d {
	get input() {
		return this.getByPartName(r);
	}
	get startAdornment() {
		return this.getByPartName(n);
	}
	get endAdornment() {
		return this.getByPartName(i);
	}
	get spinnerUp() {
		return this.getByPartName(fe);
	}
	get spinnerDown() {
		return this.getByPartName(pe);
	}
	async increment() {
		await this.spinnerUp.click({ force: !0 });
	}
	async decrement() {
		await this.spinnerDown.click({ force: !0 });
	}
}, me = class extends u {
	getNodeById(e) {
		return this.component.locator(`[data-tree-node-id="${e}"]`).first();
	}
	getNodeWrapperByTestId(e) {
		return this.getByTestId(e).locator("../..");
	}
}, he = o.extend({
	async toHaveExplicitLabel(e, t) {
		let n = "toHaveExplicitLabel", r = !1, i = await e.evaluate((e) => [...e.childNodes].filter((e) => e.nodeType === Node.TEXT_NODE && e.textContent.trim()).map((e) => e.textContent.trim())?.[0]);
		return i === t && (r = !0), {
			message: r ? () => this.utils.matcherHint(n, e, t, { isNot: this.isNot }) + `

Expected: ${this.isNot ? "not" : ""}${this.utils.printExpected(t)}\nReceived: ${this.utils.printReceived(i)}` : () => this.utils.matcherHint(n, e, t, { isNot: this.isNot }) + `

Expected: ${this.utils.printExpected(t)}\nReceived: ${this.utils.printReceived(i)}`,
			pass: r,
			name: n,
			expected: t,
			actual: void 0
		};
	},
	toEqualWithTolerance(e, t, n = 1) {
		let r = "toEqualWithTolerance", i = !1;
		return e >= t - (n || 0) && e <= t + (n || 0) && (i = !0), {
			message: i ? () => this.utils.matcherHint(r, e, t, { isNot: this.isNot }) + `

Expected: ${this.isNot ? "not" : ""}${this.utils.printExpected(t)}\nReceived: ${this.utils.printReceived(e)}` : () => this.utils.matcherHint(r, e, t, { isNot: this.isNot }) + `

Expected: ${this.utils.printExpected(t)}\nReceived: ${this.utils.printReceived(e)}`,
			pass: i,
			name: r,
			expected: t,
			actual: void 0
		};
	}
}), ge = process?.env?.CI === "true";
async function _e(e, t) {
	let n = e.getByTestId(t);
	return await n.count() > 1 ? n.first() : n;
}
var ve = class {
	constructor(e) {
		this.content = "", this.page = e;
	}
	init() {
		return () => {
			window.navigator.clipboard.readText = () => Promise.resolve(this.content), window.navigator.clipboard.read = () => {
				throw Error("Clipboard read not implemented in mocked environment");
			}, window.navigator.clipboard.writeText = (e) => (this.content = e, Promise.resolve(void 0)), window.navigator.clipboard.write = (e) => {
				throw Error("Clipboard write not implemented in mocked environment");
			};
		};
	}
	async read() {
		return (await (await this.page.evaluateHandle(() => navigator.clipboard.readText())).jsonValue()).replace(/\r\n/g, "\n");
	}
	async write(e) {
		await this.page.evaluate((e) => navigator.clipboard.writeText(e), e);
	}
	async clear() {
		await this.page.evaluate(() => navigator.clipboard.writeText(""));
	}
	async copy(e) {
		await e.focus(), await e.selectText(), await this.page.keyboard.press("ControlOrMeta+C");
	}
	async paste(e) {
		await e.focus(), await this.page.keyboard.press("ControlOrMeta+V");
	}
};
function ye(e) {
	let { themes: t, defaultTheme: n, testThemeVars: r, ...i } = e ?? {};
	return t ? {
		themes: t,
		defaultTheme: n ?? "xmlui",
		...i
	} : {
		themes: [{
			id: "test",
			name: "Test",
			extends: "xmlui",
			themeVars: r
		}],
		defaultTheme: "test",
		...i
	};
}
var be = "http://localhost:3211", xe = s.extend({
	_sharedContext: [async ({ browser: e }, t) => {
		let n = await e.newContext({
			...a["Desktop Chrome"],
			baseURL: be,
			serviceWorkers: "allow",
			permissions: ["clipboard-read", "clipboard-write"]
		});
		await t(n), await n.close();
	}, { scope: "worker" }],
	_sharedPage: [async ({ _sharedContext: e }, t) => {
		await t(await e.newPage());
	}, { scope: "worker" }],
	page: async ({ _sharedPage: e, viewport: t }, n) => {
		t && await e.setViewportSize(t);
		let r = [], i = e.addInitScript.bind(e);
		e.addInitScript = async (e, t) => (typeof e == "function" && r.push({
			fn: e,
			arg: t
		}), i(e, t)), e.__initScriptQueue__ = r, await n(e), e.addInitScript = i, e.__initScriptQueue__ = void 0;
		try {
			await e.evaluate(() => {
				localStorage.clear(), sessionStorage.clear(), window.scrollTo(0, 0), window.__originalMatchMedia && (window.matchMedia = window.__originalMatchMedia, delete window.__originalMatchMedia);
			}), await e.mouse.move(0, 0);
		} catch {}
	},
	baseComponentTestId: "test-id-component",
	testStateViewTestId: "test-state-view-testid",
	initTestBed: async ({ page: n, baseComponentTestId: r, testStateViewTestId: i }, a) => {
		let o = 0;
		await a(async (a, s) => {
			let l = `${i}-${++o}`, u = {
				"icon.box": "/resources/box.svg",
				"icon.doc": "/resources/doc.svg",
				"icon.sun": "/resources/sun.svg",
				"icon.eye": "/resources/eye.svg",
				"icon.txt": "/resources/txt.svg",
				"icon.bell": "/resources/bell.svg"
			}, { errors: d, warnings: p, component: m } = t(s?.noFragmentWrapper ? a : `
          <Fragment var.testState="{null}">
            ${a}
            <Stack width="0" height="0">
              <Text
                testId="${l}"
                value="{ typeof testState === 'undefined' ? 'undefined' : JSON.stringify(testState) }"/>
            </Stack>
          </Fragment>
        `);
			if (p.length > 0 && (console.group("[xmlui] Warnings in markup:"), p.forEach((e) => console.warn(e)), console.groupEnd()), d.length > 0) {
				let e = d.map((e) => `code: "${e.code}" msg: "${e.message}"`).join("\n");
				throw Error(`(${d.length}) Errors while parsing Main.xmlui:\n${e}`);
			}
			let h = m, g = s?.components?.map((e) => {
				let { component: t, errors: n, erroneousCompoundComponentName: r } = c(e);
				if (r) {
					let e = n.map((e) => `[${e.code}] ${e.message}`).join("\n");
					throw Error(`Error parsing component "${r}":\n${e}`);
				}
				return t;
			}), _, v = s?.globalsXs ?? s?.mainXs;
			if (v) {
				let t = e("Globals", v), n = t?.moduleErrors ?? {};
				if (Object.keys(n).length > 0) {
					let e = Object.entries(n).flatMap(([, e]) => e.map((e) => `code: "${e.code}" msg: "${e.text}"`)).join("\n");
					throw Error(`Errors while parsing globalsXs:\n${e}`);
				}
				(t?.vars || t?.functions) && (_ = { "/src/Globals.xs": {
					vars: t.vars || {},
					functions: t.functions || {},
					src: v
				} });
			}
			if (s?.noFragmentWrapper && h && (_ ||= {}, _["/src/Main.xmlui"] = { default: {
				component: h,
				src: a
			} }), a !== "" && h.children) {
				let e = s?.noFragmentWrapper ? h : h.children[0], t = g && g?.length > 0 && g?.map((e) => e.name).includes(e.type);
				!t && !e.testId ? e.testId = r : t && e.children?.length === 1 && !e.children?.[0].testId && (e.children[0].testId = r);
			}
			let y = ye(s), b = {
				...u,
				...y.resources
			}, x = {
				name: "test bed app",
				...y,
				resources: b,
				components: g,
				entryPoint: h,
				runtime: _
			}, S = new ve(n), C = s?.extensionIds ? Array.isArray(s.extensionIds) ? s.extensionIds : [s.extensionIds] : [];
			if (await n.evaluate(() => !!window.__XMLUI_READY__).catch(() => !1)) try {
				let e = n.__initScriptQueue__ ?? [];
				for (let { fn: t, arg: r } of e) try {
					await (r === void 0 ? n.evaluate(t) : n.evaluate(t, r));
				} catch {}
				e.length = 0, await n.evaluate(({ app: e, extensionIds: t }) => {
					history.replaceState(null, "", "/"), window.scrollTo(0, 0), window.TEST_ENV = e, window.TEST_RUNTIME = e.runtime, window.TEST_EXTENSION_IDS = t, window.__XMLUI_REINIT__();
				}, {
					app: x,
					extensionIds: C
				});
			} catch {
				await n.addInitScript(({ app: e, extensionIds: t }) => {
					window.TEST_ENV = e, window.TEST_RUNTIME = e.runtime, window.TEST_EXTENSION_IDS = t;
				}, {
					app: x,
					extensionIds: C
				}), await n.goto("/");
			}
			else ge && await n.addInitScript(S.init), await n.addInitScript(({ app: e, extensionIds: t }) => {
				window.TEST_ENV = e, window.TEST_RUNTIME = e.runtime, window.TEST_EXTENSION_IDS = t;
			}, {
				app: x,
				extensionIds: C
			}), await n.goto("/");
			let { width: w, height: T } = n.viewportSize();
			s?.noFragmentWrapper || await n.getByTestId(l).waitFor({ state: "attached" }), await n.evaluate(() => document.fonts.ready.then(() => new Promise((e) => {
				requestAnimationFrame(() => setTimeout(e, 0));
			}))), await n.keyboard.press("Shift");
			let E = {
				boxIcon: n.getByTestId("box-svg"),
				docIcon: n.getByTestId("doc-svg"),
				sunIcon: n.getByTestId("sun-svg"),
				eyeIcon: n.getByTestId("eye-svg"),
				txtIcon: n.getByTestId("txt-svg"),
				bellIcon: n.getByTestId("bell-svg")
			};
			return {
				testStateDriver: new f(n.getByTestId(l)),
				clipboard: S,
				width: w ?? 0,
				height: T ?? 0,
				testIcons: E
			};
		});
	},
	createDriver: async ({ page: e, baseComponentTestId: t }, n) => {
		await n(async (n, r) => {
			let i;
			return r === void 0 || typeof r == "string" ? i = await _e(e, r ?? t) : typeof r == "object" && (i = r), new n({
				locator: i,
				page: e
			});
		});
	},
	createButtonDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(p, t));
	},
	createContentSeparatorDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(m, t));
	},
	createAvatarDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(h, t));
	},
	createFormDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(b, t));
	},
	createFormItemDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(Y, t));
	},
	createValidationSummaryDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(x, t));
	},
	createValidationDisplayDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(S, t));
	},
	createSplitterDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(g, t));
	},
	createMarkdownDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(C, t));
	},
	createItemsDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(w, t));
	},
	createRangeDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(T, t));
	},
	createDatePickerDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(E, t));
	},
	createExpandableItemDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(_, t));
	},
	createFileInputDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(v, t));
	},
	createFileUploadDropZoneDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(y, t));
	},
	createAutoCompleteDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ee, t));
	},
	createSelectDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(D, t));
	},
	createRadioGroupDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(O, t));
	},
	createNumberBoxDriver: async ({ createDriver: e }, t) => {
		await t((t) => e($, t));
	},
	createTextBoxDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(de, t));
	},
	createSliderDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ae, t));
	},
	createTextAreaDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(k, t));
	},
	createProgressBarDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(A, t));
	},
	createListDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(j, t));
	},
	createTextDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(M, t));
	},
	createHeadingDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(N, t));
	},
	createIconDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(P, t));
	},
	createStackDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(F, t));
	},
	createHStackDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(I, t));
	},
	createVStackDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(L, t));
	},
	createLinkDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(R, t));
	},
	createNavLinkDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(z, t));
	},
	createNavGroupDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(B, t));
	},
	createNavPanelDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(V, t));
	},
	createCardDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(H, t));
	},
	createAccordionDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(U, t));
	},
	createAppHeaderDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(W, t));
	},
	createAppFooterDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(G, t));
	},
	createBadgeDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(K, t));
	},
	createNoResultDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(q, t));
	},
	createOptionDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(J, t));
	},
	createHtmlTagDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(X, t));
	},
	createCodeBlockDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(te, t));
	},
	createCheckboxDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(Z, t));
	},
	createLabelDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(Q, t));
	},
	createSpinnerDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ne, t));
	},
	createDropdownMenuDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(re, t));
	},
	createContextMenuDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ie, t));
	},
	createTimeInputDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(se, t));
	},
	createTimerDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ce, t));
	},
	createDateInputDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(le, t));
	},
	createModalDialogDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(ue, t));
	},
	createTreeDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(me, t));
	},
	createResponsiveBarDriver: async ({ createDriver: e }, t) => {
		await t((t) => e(oe, t));
	}
});
//#endregion
export { he as expect, xe as test };

//# sourceMappingURL=testing.js.map