@vitest/browser 5.0.0-beta.2 → 5.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/context.d.ts +8 -0
  2. package/dist/client/.vite/manifest.json +8 -8
  3. package/dist/client/__vitest__/assets/index-BlLo6Q_D.css +1 -0
  4. package/dist/client/__vitest__/assets/index-O8gheoYf.js +89 -0
  5. package/dist/client/__vitest__/index.html +2 -2
  6. package/dist/client/__vitest_browser__/defineProperty-C3k2g8Sk.js +267 -0
  7. package/dist/client/__vitest_browser__/orchestrator-B44yH1M4.js +343 -0
  8. package/dist/client/__vitest_browser__/rrweb-snapshot-iZCFA2to.js +4388 -0
  9. package/dist/client/__vitest_browser__/tester-Byk-s_d6.js +5088 -0
  10. package/dist/client/orchestrator.html +2 -2
  11. package/dist/client/tester/tester.html +2 -2
  12. package/dist/client/tester/trace.d.ts +9 -6
  13. package/dist/client.js +10 -1
  14. package/dist/context.js +53 -23
  15. package/dist/expect-element.js +30 -30
  16. package/dist/index.js +92 -23
  17. package/dist/locators-DUkyvRhY.js +5 -0
  18. package/dist/locators.js +1 -1
  19. package/dist/shared/screenshotMatcher/types.d.ts +2 -1
  20. package/dist/state.js +64 -14
  21. package/dist/types.d.ts +2 -0
  22. package/jest-dom.d.ts +1 -0
  23. package/matchers.d.ts +2 -1
  24. package/package.json +6 -6
  25. package/dist/client/__vitest__/assets/index-Cd6On2Pm.js +0 -136
  26. package/dist/client/__vitest__/assets/index-Dw9P28Qt.css +0 -1
  27. package/dist/client/__vitest_browser__/orchestrator-BfoS0x4w.js +0 -411
  28. package/dist/client/__vitest_browser__/rrweb-snapshot-xhvrgOHx.js +0 -5476
  29. package/dist/client/__vitest_browser__/tester-BJtW9QqZ.js +0 -5588
  30. package/dist/client/__vitest_browser__/utils-Nd8hqrhP.js +0 -189
  31. package/dist/locators-CesZ2RSY.js +0 -5
@@ -26,8 +26,8 @@
26
26
  {__VITEST_INJECTOR__}
27
27
  {__VITEST_ERROR_CATCHER__}
28
28
  {__VITEST_SCRIPTS__}
29
- <script type="module" crossorigin src="/__vitest_browser__/orchestrator-BfoS0x4w.js"></script>
30
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-Nd8hqrhP.js">
29
+ <script type="module" crossorigin src="/__vitest_browser__/orchestrator-B44yH1M4.js"></script>
30
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/defineProperty-C3k2g8Sk.js">
31
31
  </head>
32
32
  <body>
33
33
  <div id="vitest-tester"></div>
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vitest Browser Tester</title>
8
- <script type="module" crossorigin src="/__vitest_browser__/tester-BJtW9QqZ.js"></script>
9
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-Nd8hqrhP.js">
8
+ <script type="module" crossorigin src="/__vitest_browser__/tester-Byk-s_d6.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/defineProperty-C3k2g8Sk.js">
10
10
  </head>
11
11
  <body>
12
12
  </body>
@@ -1,4 +1,5 @@
1
1
  import type { Task } from "@vitest/runner";
2
+ import type { BrowserTraceEntryKind } from "vitest/browser";
2
3
  import type { SerializedLocator } from "./locators.js";
3
4
  export interface BrowserTraceData {
4
5
  retry: number;
@@ -6,12 +7,17 @@ export interface BrowserTraceData {
6
7
  recordCanvas: boolean;
7
8
  entries: BrowserTraceEntry[];
8
9
  }
9
- export type BrowserTraceEntryKind = "action" | "expect" | "mark" | "lifecycle";
10
10
  export type BrowserTraceEntryStatus = "pass" | "fail";
11
+ export type BrowserTraceEntryRangePhase = "start" | "end";
11
12
  export type BrowserTraceSelectorResolution = "matched" | "missing" | "error";
13
+ export interface BrowserTraceEntryRange {
14
+ id: string;
15
+ phase: BrowserTraceEntryRangePhase;
16
+ }
12
17
  export interface BrowserTraceEntry {
13
18
  name: string;
14
19
  kind: BrowserTraceEntryKind;
20
+ range?: BrowserTraceEntryRange;
15
21
  status?: BrowserTraceEntryStatus;
16
22
  startTime: number;
17
23
  duration?: number;
@@ -41,14 +47,11 @@ interface TraceSnapshot {
41
47
  }
42
48
  declare const PSEUDO_CLASS_NAMES: readonly [":hover", ":active", ":focus", ":focus-visible", ":focus-within"];
43
49
  type PseudoClassName = (typeof PSEUDO_CLASS_NAMES)[number];
44
- export type BrowserTraceState = Record<string, BrowserTraceData>;
45
50
  export interface BrowserTraceAttempt {
46
51
  retry: number;
47
52
  repeats: number;
48
53
  startTime: number;
49
54
  }
50
- export declare function recordBrowserTraceEntry(task: Task, options: Omit<BrowserTraceEntry, "snapshot" | "startTime"> & {
51
- startTime?: number;
52
- }): void;
53
- export declare function getBrowserTrace(testId: string, repeats: number, retry: number): BrowserTraceData | undefined;
55
+ export declare function createBrowserTraceRangeId(): string;
56
+ export declare function recordBrowserTraceEntry(task: Task, options: Omit<BrowserTraceEntry, "snapshot" | "startTime">): Promise<void>;
54
57
  export {};
package/dist/client.js CHANGED
@@ -337,6 +337,10 @@ const onCancelCallbacks = [];
337
337
  function onCancel(callback) {
338
338
  onCancelCallbacks.push(callback);
339
339
  }
340
+ let pageMarkHandler = null;
341
+ function registerPageMarkHandler(handler) {
342
+ pageMarkHandler = handler;
343
+ }
340
344
  // ws connection can be established before the orchestrator is fully loaded
341
345
  // in very rare cases in the preview provider
342
346
  function waitForOrchestrator() {
@@ -385,6 +389,11 @@ function createClient() {
385
389
  }
386
390
  cdp.emit(event, payload);
387
391
  },
392
+ async pageMark(name, options) {
393
+ if (pageMarkHandler) {
394
+ await pageMarkHandler(name, options);
395
+ }
396
+ },
388
397
  async resolveManualMock(url) {
389
398
  // @ts-expect-error not typed global API
390
399
  const mocker = globalThis.__vitest_mocker__;
@@ -461,4 +470,4 @@ function createClient() {
461
470
  }
462
471
  const client = createClient();
463
472
 
464
- export { ENTRY_URL, HOST, PORT, RPC_ID, channel, client, globalChannel, onCancel };
473
+ export { ENTRY_URL, HOST, PORT, RPC_ID, channel, client, globalChannel, onCancel, registerPageMarkHandler };
package/dist/context.js CHANGED
@@ -66,16 +66,12 @@ const PSEUDO_CLASS_NAMES = [
66
66
  ":focus-visible",
67
67
  ":focus-within"
68
68
  ];
69
- function getBrowserTraceState() {
70
- return getBrowserState().browserTraceState ??= {};
69
+ function createBrowserTraceRangeId() {
70
+ return Math.random().toString(36).slice(2);
71
71
  }
72
- function getTraceStateKey(testId, repeats, retry) {
73
- return `${testId}:${repeats}:${retry}`;
74
- }
75
- // TODO: should we avoid accumulating? send and immediately clear each entry to save memory?
76
- function recordBrowserTraceEntry(task, options) {
72
+ async function recordBrowserTraceEntry(task, options) {
77
73
  const attemptInfo = getBrowserState().browserTraceAttempts.get(task.id);
78
- const relativeStartTime = (options.startTime ?? now()) - attemptInfo.startTime;
74
+ const relativeStartTime = now() - attemptInfo.startTime;
79
75
  const snapshot = takeSnapshot(options.element);
80
76
  const entry = {
81
77
  ...options,
@@ -84,15 +80,21 @@ function recordBrowserTraceEntry(task, options) {
84
80
  };
85
81
  const { retry, repeats } = attemptInfo;
86
82
  const { recordCanvas } = getBrowserState().config.browser.traceView;
87
- const state = getBrowserTraceState();
88
- const traceKey = getTraceStateKey(task.id, repeats, retry);
89
- state[traceKey] ??= {
83
+ // An async lane could defer artifact recording and flush it at test-attempt end,
84
+ // but the synchronous snapshot work is already a comparable cost, and this path
85
+ // is mostly data passing after that.
86
+ // Keep it simple unless measurements show artifact recording is a bottleneck.
87
+ const data = {
90
88
  retry,
91
89
  repeats,
92
90
  recordCanvas,
93
- entries: []
91
+ entries: [entry]
94
92
  };
95
- state[traceKey].entries.push(entry);
93
+ const rpc = getWorkerState().rpc;
94
+ await rpc.triggerCommand(getBrowserState().sessionId, "__vitest_recordBrowserTrace", undefined, [{
95
+ testId: task.id,
96
+ data
97
+ }]);
96
98
  }
97
99
  // Resolve ivya selector to a DOM element and take a snapshot with rrweb Mirror
98
100
  // so we can store the nodeId for provider-agnostic element highlighting in the viewer.
@@ -585,13 +587,24 @@ const page = {
585
587
  if (typeof bodyOrOptions === "function") {
586
588
  return ensureAwaited(async (error) => {
587
589
  let status = "pass";
588
- const startTime = now();
590
+ const traceRangeId = hasActiveTraceView ? createBrowserTraceRangeId() : undefined;
589
591
  if (hasActiveTrace) {
590
592
  await triggerCommand("__vitest_groupTraceStart", [{
591
593
  name,
592
594
  stack: options?.stack ?? error?.stack
593
595
  }], error);
594
596
  }
597
+ if (hasActiveTraceView) {
598
+ await recordBrowserTraceEntry(currentTest, {
599
+ name,
600
+ kind: "mark",
601
+ range: {
602
+ id: traceRangeId,
603
+ phase: "start"
604
+ },
605
+ stack: options?.stack ?? error?.stack
606
+ });
607
+ }
595
608
  try {
596
609
  return await bodyOrOptions();
597
610
  } catch (err) {
@@ -599,13 +612,14 @@ const page = {
599
612
  throw err;
600
613
  } finally {
601
614
  if (hasActiveTraceView) {
602
- // TODO: support nested trace
603
- recordBrowserTraceEntry(currentTest, {
615
+ await recordBrowserTraceEntry(currentTest, {
604
616
  name,
605
- kind: "mark",
617
+ kind: options?.kind ?? "mark",
618
+ range: {
619
+ id: traceRangeId,
620
+ phase: "end"
621
+ },
606
622
  status,
607
- startTime,
608
- duration: now() - startTime,
609
623
  stack: options?.stack ?? error?.stack
610
624
  });
611
625
  }
@@ -618,11 +632,11 @@ const page = {
618
632
  if (!hasActiveTrace && !hasActiveTraceView) {
619
633
  return Promise.resolve();
620
634
  }
621
- return ensureAwaited((error) => {
635
+ return ensureAwaited(async (error) => {
622
636
  if (hasActiveTraceView) {
623
- recordBrowserTraceEntry(currentTest, {
637
+ await recordBrowserTraceEntry(currentTest, {
624
638
  name,
625
- kind: "mark",
639
+ kind: bodyOrOptions?.kind ?? "mark",
626
640
  stack: bodyOrOptions?.stack ?? error?.stack
627
641
  });
628
642
  }
@@ -753,10 +767,26 @@ function prettyDOM(dom, maxLength = Number(defaultOptions?.maxLength ?? import.m
753
767
  return dom.outerHTML.length > maxLength ? `${pretty.slice(0, maxLength)}...` : pretty;
754
768
  }
755
769
  function getElementError(selector, container) {
756
- const error = new Error(`Cannot find element with locator: ${typeof selector === "string" ? __INTERNAL._asLocator("javascript", selector) : selector.asLocator()}\n\n${prettyDOM(container)}`);
770
+ const locator = typeof selector === "string" ? __INTERNAL._asLocator("javascript", selector) : selector.asLocator();
771
+ const formatted = formatDOM(container);
772
+ const error = new Error(`Cannot find element with locator: ${locator}\n\n${formatted}`);
757
773
  error.name = "VitestBrowserElementError";
758
774
  return error;
759
775
  }
776
+ function formatDOM(container) {
777
+ const format = getBrowserState().config.browser.locators.errorFormat;
778
+ if (format === "aria") {
779
+ return `ARIA tree:\n${formatAriaTree(container)}`;
780
+ }
781
+ if (format === "all") {
782
+ return `ARIA tree:\n${formatAriaTree(container)}\n\nHTML:\n${prettyDOM(container)}`;
783
+ }
784
+ return prettyDOM(container);
785
+ }
786
+ function formatAriaTree(container) {
787
+ const { generateAriaTree, renderAriaTree } = getBrowserState().aria;
788
+ return renderAriaTree(generateAriaTree(container));
789
+ }
760
790
  function configurePrettyDOM(options) {
761
791
  defaultOptions = options;
762
792
  }
@@ -1,34 +1,34 @@
1
- import{Snapshots as e,recordArtifact as t,expect as n,chai as r}from"vitest";import{getType as i}from"vitest/internal/browser";import{b as a,e as o,i as s,g as c,n as l,a as u,k as d,c as f,d as ee,f as p,h as te,j as ne,l as re,m as ie,o as ae,p as oe,q as se,r as ce,s as le,t as m,_ as h,u as g,L as _,v as ue,w as de,x as fe,y as pe,z as me,A as he,B as ge,C as _e,D as ve}from"./locators-CesZ2RSY.js";import{server as ye}from"vitest/browser";var be=Object.defineProperty,xe=(e,t)=>{let n={};for(var r in e)be(n,r,{get:e[r],enumerable:!0});return be(n,Symbol.toStringTag,{value:`Module`}),n};function Se(e,t,n={}){let r=Ce(e,t,n);if(r.errors.length)throw Error(r.errors[0].message);return r.fragment}function Ce(e,t,n={}){let r=new e.LineCounter,i={keepSourceTokens:!0,lineCounter:r,...n},a=e.parseDocument(t,i),o=[],s=e=>[r.linePos(e[0]),r.linePos(e[1])],c=e=>{o.push({message:e.message,range:[r.linePos(e.pos[0]),r.linePos(e.pos[1])]})},l=(t,n)=>{for(let r of n.items){if(r instanceof e.Scalar&&typeof r.value==`string`){let e=Ee.parse(r,i,o);e&&(t.children=t.children||[],t.children.push(e));continue}if(r instanceof e.YAMLMap){u(t,r);continue}o.push({message:`Sequence items should be strings or maps`,range:s(r.range||n.range)})}},u=(t,n)=>{for(let r of n.items){if(t.children=t.children||[],!(r.key instanceof e.Scalar&&typeof r.key.value==`string`)){o.push({message:`Only string keys are supported`,range:s(r.key.range||n.range)});continue}let a=r.key,c=r.value;if(a.value===`text`){if(!(c instanceof e.Scalar&&typeof c.value==`string`)){o.push({message:`Text value should be a string`,range:s(r.value.range||n.range)});continue}t.children.push({kind:`text`,text:v(c.value)});continue}if(a.value===`/children`){if(!(c instanceof e.Scalar&&typeof c.value==`string`)||c.value!==`contain`&&c.value!==`equal`&&c.value!==`deep-equal`){o.push({message:`Strict value should be "contain", "equal" or "deep-equal"`,range:s(r.value.range||n.range)});continue}t.containerMode=c.value;continue}if(a.value.startsWith(`/`)){if(!(c instanceof e.Scalar&&typeof c.value==`string`)){o.push({message:`Property value should be a string`,range:s(r.value.range||n.range)});continue}t.props=t.props??{},t.props[a.value.slice(1)]=v(c.value);continue}let u=Ee.parse(a,i,o);if(u){if(c instanceof e.Scalar){let e=typeof c.value;if(e!==`string`&&e!==`number`&&e!==`boolean`){o.push({message:`Node value should be a string or a sequence`,range:s(r.value.range||n.range)});continue}t.children.push({...u,children:[{kind:`text`,text:v(String(c.value))}]});continue}if(c instanceof e.YAMLSeq){t.children.push(u),l(u,c);continue}o.push({message:`Map values should be strings or sequences`,range:s(r.value.range||n.range)})}}},d={kind:`role`,role:`fragment`};return a.errors.forEach(c),o.length?{errors:o,fragment:d}:a.contents?(a.contents instanceof e.YAMLSeq||o.push({message:`Aria snapshot must be a YAML sequence, elements starting with " -"`,range:s(a.contents.range)}),o.length?{errors:o,fragment:d}:(l(d,a.contents),o.length?{errors:o,fragment:we}:d.children?.length===1&&(!d.containerMode||d.containerMode===`contain`)?{fragment:d.children[0],errors:[]}:{fragment:d,errors:[]})):{fragment:d,errors:[]}}const we={kind:`role`,role:`fragment`};function Te(e){return e.replace(/[\u200b\u00ad]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function v(e){return{raw:e,normalized:Te(e)}}var Ee=class e{static parse(t,n,r){try{return new e(t.value)._parse()}catch(e){if(e instanceof y){let i=n.prettyErrors===!1?e.message:`${e.message}:\n\n${t.value}\n${` `.repeat(e.pos)}^\n`;return r.push({message:i,range:[n.lineCounter.linePos(t.range[0]),n.lineCounter.linePos(t.range[0]+e.pos)]}),null}throw e}}constructor(e){h(this,`_input`,void 0),h(this,`_pos`,void 0),h(this,`_length`,void 0),this._input=e,this._pos=0,this._length=e.length}_peek(){return this._input[this._pos]||``}_next(){return this._pos<this._length?this._input[this._pos++]:null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\s/.test(this._peek())}_skipWhitespace(){for(;this._isWhitespace();)this._pos++}_readIdentifier(e){this._eof()&&this._throwError(`Unexpected end of input when expecting ${e}`);let t=this._pos;for(;!this._eof()&&/[a-zA-Z]/.test(this._peek());)this._pos++;return this._input.slice(t,this._pos)}_readString(){let e=``,t=!1;for(;!this._eof();){let n=this._next();if(t)e+=n,t=!1;else if(n===`\\`)t=!0;else if(n===`"`)return e;else e+=n}this._throwError(`Unterminated string`)}_throwError(e,t=0){throw new y(e,t||this._pos)}_readRegex(){let e=``,t=!1,n=!1;for(;!this._eof();){let r=this._next();if(t)e+=r,t=!1;else if(r===`\\`)t=!0,e+=r;else if(r===`/`&&!n)return{pattern:e};else r===`[`?(n=!0,e+=r):r===`]`&&n?(e+=r,n=!1):e+=r}this._throwError(`Unterminated regex`)}_readStringOrRegex(){let e=this._peek();return e===`"`?(this._next(),Te(this._readString())):e===`/`?(this._next(),this._readRegex()):null}_readAttributes(e){let t=this._pos;for(;this._skipWhitespace(),this._peek()===`[`;){this._next(),this._skipWhitespace(),t=this._pos;let n=this._readIdentifier(`attribute`);this._skipWhitespace();let r=``;if(this._peek()===`=`)for(this._next(),this._skipWhitespace(),t=this._pos;this._peek()!==`]`&&!this._isWhitespace()&&!this._eof();)r+=this._next();this._skipWhitespace(),this._peek()!==`]`&&this._throwError(`Expected ]`),this._next(),this._applyAttribute(e,n,r||`true`,t)}}_parse(){this._skipWhitespace();let e=this._readIdentifier(`role`);e===`fragment`&&this._throwError(`Invalid role "fragment"`),this._skipWhitespace();let t={kind:`role`,role:e,name:this._readStringOrRegex()||void 0};return this._readAttributes(t),this._skipWhitespace(),this._eof()||this._throwError(`Unexpected input`),t}_applyAttribute(e,t,n,r){if(t===`checked`){this._assert(n===`true`||n===`false`||n===`mixed`,`Value of "checked" attribute must be a boolean or "mixed"`,r),e.checked=n===`true`?!0:n===`false`?!1:`mixed`;return}if(t===`disabled`){this._assert(n===`true`||n===`false`,`Value of "disabled" attribute must be a boolean`,r),e.disabled=n===`true`;return}if(t===`expanded`){this._assert(n===`true`||n===`false`,`Value of "expanded" attribute must be a boolean`,r),e.expanded=n===`true`;return}if(t===`active`){this._assert(n===`true`||n===`false`,`Value of "active" attribute must be a boolean`,r),e.active=n===`true`;return}if(t===`level`){this._assert(!Number.isNaN(Number(n)),`Value of "level" attribute must be a number`,r),e.level=Number(n);return}if(t===`pressed`){this._assert(n===`true`||n===`false`||n===`mixed`,`Value of "pressed" attribute must be a boolean or "mixed"`,r),e.pressed=n===`true`?!0:n===`false`?!1:`mixed`;return}if(t===`selected`){this._assert(n===`true`||n===`false`,`Value of "selected" attribute must be a boolean`,r),e.selected=n===`true`;return}this._assert(!1,`Unsupported attribute [${t}]`,r)}_assert(e,t,n){e||this._throwError(t||`Assertion error`,n)}},y=class extends Error{constructor(e,t){super(e),h(this,`pos`,void 0),this.pos=t}};function b(e,t){return t?e?typeof t==`string`?e===t:!!e.match(new RegExp(t.pattern)):!1:!0}function x(e,t){if(!t?.normalized)return!0;if(!e)return!1;if(e===t.normalized||e===t.raw)return!0;let n=C(t);return n?!!e.match(n):!1}const S=Symbol(`cachedRegex`);function C(e){if(e[S]!==void 0)return e[S];let{raw:t}=e,n=t.startsWith(`/`)&&t.endsWith(`/`)&&t.length>1,r;try{r=n?new RegExp(t.slice(1,-1)):null}catch{r=null}return e[S]=r,r}function w(e,t,n){if(typeof e==`string`&&t.kind===`text`)return x(e,t.text);if(typeof e!=`object`||!e||t.kind!==`role`||t.role!==`fragment`&&t.role!==e.role||t.checked!==void 0&&t.checked!==e.checked||t.disabled!==void 0&&t.disabled!==e.disabled||t.expanded!==void 0&&t.expanded!==e.expanded||t.level!==void 0&&t.level!==e.level||t.pressed!==void 0&&t.pressed!==e.pressed||t.selected!==void 0&&t.selected!==e.selected||!b(e.name,t.name))return!1;if(t.props){for(let[n,r]of Object.entries(t.props))if(!x(e.props[n]||``,r))return!1}return t.containerMode===`contain`?E(e.children||[],t.children||[]):t.containerMode===`equal`?T(e.children||[],t.children||[],!1):t.containerMode===`deep-equal`||n?T(e.children||[],t.children||[],!0):E(e.children||[],t.children||[])}function T(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!w(e[r],t[r],n))return!1;return!0}function E(e,t){if(t.length>e.length)return!1;let n=e.slice(),r=t.slice();for(let e of r){let t=n.shift();for(;t&&!w(t,e,!1);)t=n.shift();if(!t)return!1}return!0}var De=xe({LineCounter:()=>Oe,Scalar:()=>D,YAMLError:()=>A,YAMLMap:()=>O,YAMLSeq:()=>k,parseDocument:()=>ke}),D=class{constructor(e,t=[0,0,0]){h(this,`value`,void 0),h(this,`range`,void 0),this.value=e,this.range=t}},O=class{constructor(e=[0,0,0]){h(this,`items`,void 0),h(this,`range`,void 0),this.items=[],this.range=e}},k=class{constructor(e=[0,0,0]){h(this,`items`,void 0),h(this,`range`,void 0),this.items=[],this.range=e}},Oe=class{constructor(){h(this,`lineStarts`,[0])}addNewLine(e){e>this.lineStarts[this.lineStarts.length-1]&&this.lineStarts.push(e)}linePos(e){let t=0,n=this.lineStarts.length-1;for(;t<n;){let r=t+n+1>>1;this.lineStarts[r]<=e?t=r:n=r-1}return{line:t+1,col:e-this.lineStarts[t]+1}}},A=class extends Error{constructor(e,t){super(e),h(this,`pos`,void 0),this.pos=t}};function ke(e,t={}){let n=t.lineCounter,r=[];if(n)for(let t=0;t<e.length;t++)e[t]===`
2
- `&&n.addNewLine(t+1);try{return{contents:new Ae(e,r).parseRoot(),errors:r}}catch(e){if(e instanceof A)return r.push(e),{contents:null,errors:r};throw e}}var Ae=class{constructor(e,t){h(this,`lines`,void 0),h(this,`pos`,void 0),h(this,`text`,void 0),h(this,`errors`,void 0),this.text=e,this.errors=t,this.lines=[],this.pos=0;let n=0,r=e.split(`
3
- `);for(let e of r){let t=e.replace(/\r$/,``),r=t.replace(/^\s+/,``),i=t.length-r.length;this.lines.push({indent:i,content:r,offset:n+i,lineOffset:n,raw:t}),n+=e.length+1}for(;this.lines.length>0&&this.lines[this.lines.length-1].content===``;)this.lines.pop()}parseRoot(){if(this.lines.length===0)return null;let e=this.parseNode(0);if(this.skipEmpty(),this.pos<this.lines.length){let e=this.currentLine();this.addError(`Unexpected scalar at node end`,e.offset)}return e}currentLine(){return this.lines[this.pos]}parseNode(e){this.skipEmpty();let t=this.currentLine();return!t||t.indent<e?null:t.content.startsWith(`- `)||t.content===`-`?this.parseSequence(t.indent):this.isMapEntry(t.content)?this.parseMap(t.indent):(this.pos++,this.parseScalarValue(t.content,t.offset,t))}parseSequence(e){let t=this.currentLine(),n=new k([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a sequence entry`,t.offset);break}if(!t.content.startsWith(`- `)&&t.content!==`-`)break;let i=t.content===`-`?1:2,a=t.content.slice(i),o=t.offset+i;if(this.pos++,a===``||a.trim()===``){let t=this.parseNode(e+1);t&&(n.items.push(t),r=this.peekLastOffset())}else if(this.isMapEntry(a)){let s=this.parseInlineMap(a,o,e+i,t);n.items.push(s),r=s.range[2]}else{let e=this.parseScalarValue(a,o,t);n.items.push(e),r=e.range[2]}}return n.range[1]=r,n.range[2]=r,n}parseMap(e){let t=this.currentLine(),n=new O([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a mapping entry`,t.offset);break}if(!this.isMapEntry(t.content))break;let{key:i,valueStr:a,colonOffset:o,valueOffset:s}=this.splitMapEntry(t.content,t.offset),c=new D(i,[t.offset,t.offset+i.length,o]);this.pos++;let l;l=a===``?this.parseMapValue(e,o):this.parseScalarValue(a.trim(),s,t),n.items.push({key:c,value:l}),r=l?this.getNodeEnd(l):o+1}return n.range[1]=r,n.range[2]=r,n}parseInlineMap(e,t,n,r){let i=new O([t,0,0]),a=t,{key:o,valueStr:s,colonOffset:c,valueOffset:l}=this.splitMapEntry(e,t),u=new D(o,[t,t+o.length,c]),d;for(d=s===``?this.parseMapValue(n,c):this.parseScalarValue(s.trim(),l,r),i.items.push({key:u,value:d}),a=d?this.getNodeEnd(d):c+1;this.pos<this.lines.length;){this.skipEmpty();let e=this.currentLine();if(!e||e.indent<n||e.indent>n||!this.isMapEntry(e.content)||e.content.startsWith(`- `))break;let t=this.splitMapEntry(e.content,e.offset),r=new D(t.key,[e.offset,e.offset+t.key.length,t.colonOffset]);this.pos++;let o;o=t.valueStr===``?this.parseMapValue(n,t.colonOffset):this.parseScalarValue(t.valueStr.trim(),t.valueOffset,e),i.items.push({key:r,value:o}),a=o?this.getNodeEnd(o):t.colonOffset+1}return i.range[1]=a,i.range[2]=a,i}parseMapValue(e,t){this.skipEmpty();let n=this.currentLine();return!n||n.indent<e?new D(null,[t+1,t+1,t+1]):n.indent===e&&(n.content.startsWith(`- `)||n.content===`-`)?this.parseNode(e):n.indent>e?this.parseNode(e+1):new D(null,[t+1,t+1,t+1])}getNodeEnd(e){return e.range[2]}peekLastOffset(){if(this.pos>0&&this.pos<=this.lines.length){let e=this.lines[this.pos-1];return e.lineOffset+e.raw.length}return this.text.length}parseScalarValue(e,t,n){let r=e.trim(),i=t+e.indexOf(r),a=i+r.length,o=n.lineOffset+n.raw.length;return r.startsWith(`"`)?this.parseQuotedScalar(r,i,o):r===`true`||r===`false`?new D(r===`true`,[i,a,o]):r===`null`||r===`~`?new D(null,[i,a,o]):r!==``&&je(r)?new D(Number(r),[i,a,o]):new D(r,[i,a,o])}parseQuotedScalar(e,t,n){let r=``,i=1;for(;i<e.length;){let a=e[i];if(a===`\\`){if(i++,i>=e.length){this.addError(`Unterminated double-quoted string`,t+i);break}let n=e[i];switch(n){case`n`:r+=`
4
- `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`"`:r+=`"`;break;case`\\`:r+=`\\`;break;case`/`:r+=`/`;break;default:r+=n}}else if(a===`"`){let e=t+i+1;return new D(r,[t,e,n])}else r+=a;i++}return this.addError(`Unterminated double-quoted string`,t),new D(r,[t,t+e.length,n])}skipEmpty(){for(;this.pos<this.lines.length&&this.lines[this.pos].content===``;)this.pos++}isMapEntry(e){return this.findMapColon(e)>=0}findMapColon(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){n=!1;continue}if(i===`\\`&&t){n=!0;continue}if(i===`"`){t=!t;continue}if(!t&&i===`:`&&(r+1>=e.length||e[r+1]===` `))return r}return-1}splitMapEntry(e,t){let n=this.findMapColon(e),r=e.slice(0,n).trim(),i=t+n,a=e.slice(n+1),o=a.trimStart(),s=i+1+(a.length-a.trimStart().length);return r.startsWith(`"`)&&r.endsWith(`"`)?{key:r.slice(1,-1),valueStr:o,colonOffset:i,valueOffset:s}:{key:r,valueStr:o,colonOffset:i,valueOffset:s}}addError(e,t){this.errors.push(new A(e,[t,t+1]))}};function je(e){return e===``||e===`-`||e===`+`?!1:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(e)}function j(e){return Me(e)?`"`+e.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,e=>{switch(e){case`\\`:return`\\\\`;case`"`:return`\\"`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`
5
- `:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;default:return`\\x`+e.charCodeAt(0).toString(16).padStart(2,`0`)}})+`"`:e}function Me(e){return!!(e.length===0||/^\s|\s$/.test(e)||/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(e)||/^-/.test(e)||/[\n:](\s|$)/.test(e)||/\s#/.test(e)||/[\n\r]/.test(e)||/^[&*\],?!>|@"'#%]/.test(e)||/[{}`]/.test(e)||/^\[/.test(e)||!isNaN(Number(e))||[`y`,`n`,`yes`,`no`,`true`,`false`,`on`,`off`,`null`].includes(e.toLowerCase()))}const M={visible:!0,inline:!1};function Ne(e){let t=new Set,n={role:`fragment`,name:``,children:[],props:{},box:M,receivesPointerEvents:!0},r=(n,r,a)=>{if(t.has(r))return;if(t.add(r),r.nodeType===Node.TEXT_NODE&&r.nodeValue){if(!a)return;let e=r.nodeValue;n.role!==`textbox`&&e&&n.children.push(r.nodeValue||``);return}if(r.nodeType!==Node.ELEMENT_NODE)return;let o=r,c=!s(o);if(!c)return;let l=[];if(o.hasAttribute(`aria-owns`)){let t=o.getAttribute(`aria-owns`).split(/\s+/);for(let n of t){let t=e.ownerDocument.getElementById(n);t&&l.push(t)}}let u=Pe(o);u&&n.children.push(u),i(u||n,o,l,c)};function i(e,t,n,i){let a=(le(t)?.display||`inline`)!==`inline`||t.nodeName===`BR`?` `:``;a&&e.children.push(a),e.children.push(m(t,`::before`));let o=t.nodeName===`SLOT`?t.assignedNodes():[];if(o.length)for(let t of o)r(e,t,i);else{for(let n=t.firstChild;n;n=n.nextSibling)n.assignedSlot||r(e,n,i);if(t.shadowRoot)for(let n=t.shadowRoot.firstChild;n;n=n.nextSibling)r(e,n,i)}for(let t of n)r(e,t,i);if(e.children.push(m(t,`::after`)),a&&e.children.push(a),e.children.length===1&&e.name===e.children[0]&&(e.children=[]),e.role===`link`&&t.hasAttribute(`href`)){let n=t.getAttribute(`href`);e.props.url=n}if(e.role===`textbox`&&t.hasAttribute(`placeholder`)&&t.getAttribute(`placeholder`)!==e.name){let n=t.getAttribute(`placeholder`);e.props.placeholder=n}}a();try{r(n,e,!0)}finally{o()}return Fe(n),n}function Pe(e){let t=c(e)??null;if(!t||t===`presentation`||t===`none`)return null;let n={role:t,name:l(u(e,!1)||``),children:[],props:{},box:M,receivesPointerEvents:!0};if(d.includes(t)&&(n.checked=f(e)),ee.includes(t)&&(n.disabled=p(e)||void 0),te.includes(t)){let t=ne(e);n.expanded=t===`none`?void 0:t}return re.includes(t)&&(n.level=ie(e)),ae.includes(t)&&(n.pressed=oe(e)),se.includes(t)&&(n.selected=ce(e)),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`file`&&(n.children=[e.value]),n}function Fe(e){let t=(e,t)=>{if(!e.length)return;let n=l(e.join(``));n&&t.push(n),e.length=0},n=e=>{let r=[],i=[];for(let a of e.children||[])typeof a==`string`?i.push(a):(t(i,r),n(a),r.push(a));t(i,r),e.children=r.length?r:[],e.children.length===1&&e.children[0]===e.name&&(e.children=[])};n(e)}function N(e,t){let n=``;return e.level&&(n+=` [level=${e.level}]`),e.checked===!0&&(n+=` [checked]`),e.checked===`mixed`&&(n+=` [checked=mixed]`),e.disabled&&(n+=` [disabled]`),e.expanded===!0&&(n+=` [expanded]`),e.expanded,e.pressed===!0&&(n+=` [pressed]`),e.pressed===`mixed`&&(n+=` [pressed=mixed]`),e.selected&&(n+=` [selected]`),n}function Ie(e){let t=e.role;return e.name&&e.name.length<=900&&(t+=` ${JSON.stringify(e.name)}`),t+=N(e),t}function P(e,t,n){let r=Ie(e),i=Object.keys(e.props).length>0,a=e.children.length===1&&typeof e.children[0]==`string`&&!i?e.children[0]:void 0;if(!e.children.length&&!i)n.push(`${t}- ${r}`);else if(a!==void 0)n.push(`${t}- ${r}: ${j(a)}`);else{n.push(`${t}- ${r}:`);for(let[r,i]of Object.entries(e.props))n.push(`${t} - /${r}: ${j(i)}`);for(let r of e.children)typeof r==`string`?r&&n.push(`${t} - text: ${j(r)}`):P(r,`${t} `,n)}}function Le(e){let t=[],n=e.role===`fragment`?e.children:[e];for(let e of n)typeof e==`string`?e&&t.push(`- text: ${j(e)}`):P(e,``,t);return t.join(`
6
- `)}function F(e){return C(e)?`/${e.raw.slice(1,-1)}/`:j(e.normalized)}function I(e){return typeof e==`string`?JSON.stringify(e):`/${e.pattern}/`}function Re(e){let t=[];if(e.kind===`text`)t.push(`- text: ${F(e.text)}`);else if(e.role===`fragment`){e.containerMode&&e.containerMode!==`contain`&&t.push(`- /children: ${e.containerMode}`);for(let n of e.children||[])L(n,``,t)}else L(e,``,t);return t.join(`
7
- `)}function ze(e){let t=e.role;return e.name!==void 0&&(t+=` ${I(e.name)}`),t+=N(e),t}function L(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${F(e.text)}`);return}let r=ze(e),i=e.children||[],a=[];if(e.containerMode&&e.containerMode!==`contain`&&a.push(`${t} - /children: ${e.containerMode}`),e.props)for(let[n,r]of Object.entries(e.props))a.push(`${t} - /${n}: ${F(r)}`);if(i.length===0&&a.length===0){n.push(`${t}- ${r}`);return}if(i.length===1&&i[0].kind===`text`&&a.length===0){n.push(`${t}- ${r}: ${F(i[0].text)}`);return}n.push(`${t}- ${r}:`),n.push(...a);for(let e of i)L(e,`${t} `,n)}function Be(e,t){let n=e.role===`fragment`?e.children:[e],r=R(t)?t.children??[]:[t],i=R(t)?t.containerMode:void 0,a=Ge(n,r,``,i);return a.pass&&i&&i!==`contain`&&a.resolved.unshift(`- /children: ${i}`),{pass:a.pass,resolved:a.resolved.join(`
8
- `)}}function R(e){return e.kind===`role`&&e.role===`fragment`}function Ve(e){return typeof e==`object`&&!!e&&`pattern`in e}function He(e,t){let n=e.role;return t.name===void 0||(Ve(t.name)&&b(e.name,t.name)?n+=` ${I(t.name)}`:e.name&&(n+=` ${JSON.stringify(e.name)}`)),t.level!==void 0&&(n+=` [level=${e.level}]`),t.checked!==void 0&&(e.checked===!0?n+=` [checked]`:e.checked===`mixed`&&(n+=` [checked=mixed]`)),t.disabled!==void 0&&e.disabled&&(n+=` [disabled]`),t.expanded!==void 0&&(e.expanded===!0?n+=` [expanded]`:e.expanded===!1&&(n+=` [expanded=false]`)),t.pressed!==void 0&&(e.pressed===!0?n+=` [pressed]`:e.pressed===`mixed`&&(n+=` [pressed=mixed]`)),t.selected!==void 0&&e.selected&&(n+=` [selected]`),n}function Ue(e,t){let n=new Map,r=0;for(let i=0;i<e.length&&r<t.length;i++)w(e[i],t[r],!1)&&(n.set(i,r),r++);return n}function We(e,t){let n=new Map,r=new Set;for(let i=0;i<t.length;i++)for(let a=0;a<e.length;a++)if(!r.has(a)&&w(e[a],t[i],!1)){n.set(a,i),r.add(a);break}return n}function z(e,t){let n=[];return typeof e==`string`?n.push(`${t}- text: ${e}`):P(e,t,n),n}function Ge(e,t,n,r){if(e.some(e=>typeof e!=`string`&&e.role===`fragment`)||t.some(e=>R(e)))throw Error(`Internal error: fragment wrappers must be unwrapped at matchAriaTree root`);if(r===`equal`||r===`deep-equal`)return Ke(e,t,n,r===`deep-equal`);let i=[],a=Ue(e,t);if(t.length!==a.size){let r=We(e,t);for(let a=0;a<e.length;a++){let o=r.get(a);o===void 0?i.push(...z(e[a],n)):i.push(...B(e[a],t[o],n))}return{resolved:i,pass:!1}}for(let r=0;r<e.length;r++){let o=a.get(r);o!==void 0&&i.push(...B(e[r],t[o],n))}return{resolved:i,pass:!0}}function Ke(e,t,n,r){let i=[],a=e.length===t.length&&e.every((e,n)=>w(e,t[n],r));for(let a=0;a<e.length;a++)a<t.length?i.push(...B(e[a],t[a],n,r)):i.push(...z(e[a],n));return{resolved:i,pass:a}}function B(e,t,n,r=!1){if(typeof e==`string`&&t.kind===`text`)return[`${n}- text: ${x(e,t.text)&&C(t.text)?F(t.text):e}`];if(typeof e==`string`||t.kind===`text`)return z(e,n);let i=He(e,t),a=Ge(e.children,t.children||[],`${n} `,t.containerMode??(r?`equal`:`contain`)),o=[];t.containerMode&&t.containerMode!==`contain`&&o.push(`${n} - /children: ${t.containerMode}`);let s=new Set([...Object.keys(e.props),...Object.keys(t.props||{})]);for(let r of s){let i=e.props[r],a=t.props?.[r];if(i!==void 0){let e=(a===void 0||x(i,a))&&a&&C(a)?F(a):i;o.push(`${n} - /${r}: ${e}`)}}let c=[];if(!a.resolved.length&&!o.length)c.push(`${n}- ${i}`);else if(a.resolved.length===1&&a.resolved[0].trimStart().startsWith(`- text: `)&&!o.length){let e=a.resolved[0].trimStart().slice(8);c.push(`${n}- ${i}: ${e}`)}else c.push(`${n}- ${i}:`),c.push(...o),c.push(...a.resolved);return c}function qe(e){return Se(De,e)}var Je=Object.freeze({__proto__:null,generateAriaTree:Ne,matchAriaTree:Be,parseAriaTemplate:qe,renderAriaTemplate:Re,renderAriaTree:Le});g().aria=Je;const{generateAriaTree:Ye,matchAriaTree:Xe,parseAriaTemplate:Ze,renderAriaTemplate:Qe,renderAriaTree:$e}=Je,et={name:`aria`,capture(e){if(e instanceof Element)return Ye(e);throw TypeError(`aria adapter expects an Element`)},render(e){return V($e(e))},parseExpected(e){let t=Error.stackTraceLimit;Error.stackTraceLimit=t+20;try{return Ze(e.trim())}finally{Error.stackTraceLimit=t}},match(e,t){let n=Xe(e,t);return n.pass?{pass:!0}:{pass:!1,message:`Accessibility tree does not match expected template`,resolved:V(n.resolved),expected:V(Qe(t))}}};function V(e){return`\n${e}\n`}const tt={toMatchAriaSnapshot(t){return e.toMatchDomainSnapshot.call(this,et,t)},toMatchAriaInlineSnapshot(t,n){return e.toMatchDomainInlineSnapshot.call(this,et,t,n)}};for(let e of Object.values(tt))Object.assign(e,{__vitest_poll_takeover__:!0});function nt(){return[...d]}function rt(e,t,n){return e instanceof _&&(e=e.query()),e==null?null:H(e,t,n)}function H(e,t,n){e instanceof _&&(e=e.element());let r=e?.ownerDocument?.defaultView||window;if(e instanceof r.HTMLElement||e instanceof r.SVGElement)return e;throw new dt(e,t,n)}function it(e,t,n){e instanceof _&&(e=e.element());let r=e.ownerDocument?.defaultView||window;if(e instanceof r.Node)return e;throw new ft(e,t,n)}function U(e,t,n,r,i,a){return[`${t}\n`,`${n}:\n${e.utils.EXPECTED_COLOR(W(ct(e,r),2))}`,`${i}:\n${e.utils.RECEIVED_COLOR(W(ct(e,a),2))}`].join(`
9
- `)}function W(e,t){return at(st(e),t)}function at(e,t){return e.replace(/^(?!\s*$)/gm,` `.repeat(t))}function ot(e){let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((e,t)=>Math.min(e,t.length),1/0):0}function st(e){let t=ot(e);if(t===0)return e;let n=RegExp(`^[ \\t]{${t}}`,`gm`);return e.replace(n,``)}function ct(e,t){return typeof t==`string`?t:e.utils.stringify(t)}function lt(e,{wordConnector:t=`, `,lastWordConnector:n=` and `}={}){return[e.slice(0,-1).join(t),e.at(-1)].join(e.length>1?n:``)}class ut extends Error{constructor(e,t,n,r){super(),Error.captureStackTrace&&Error.captureStackTrace(this,n);let i=``;try{i=r.utils.printWithType(`Received`,t,r.utils.printReceived)}catch{}this.message=[r.utils.matcherHint(`${r.isNot?`.not`:``}.${n.name}`,`received`,``),``,`${r.utils.RECEIVED_COLOR(`received`)} value must ${e} or a Locator that returns ${e}.`,i].join(`
10
- `)}}class dt extends ut{constructor(e,t,n){super(`an HTMLElement or an SVGElement`,e,t,n)}}class ft extends ut{constructor(e,t,n){super(`a Node`,e,t,n)}}function G(e){return e instanceof HTMLFormElement?`FORM`:e.tagName.toUpperCase()}function K(e){return G(e)===`INPUT`}function pt(e){if(e)switch(G(e)){case`INPUT`:return ht(e);case`SELECT`:return mt(e);default:return e.value??_t(e)}}function mt({multiple:e,options:t}){let n=[...t].filter(e=>e.selected);if(e)return[...n].map(e=>e.value);if(n.length!==0)return n[0].value}function ht(e){switch(e.type){case`number`:return e.value===``?null:Number(e.value);case`checkbox`:return e.checked;default:return e.value}}const gt=[`meter`,`progressbar`,`slider`,`spinbutton`];function _t(e){if(gt.includes(e.getAttribute(`role`)||``))return Number(e.getAttribute(`aria-valuenow`))}function vt(e){return e.replace(/\s+/g,` `).trim()}function yt(e,t){return t instanceof RegExp?t.test(e):e.includes(String(t))}function q(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=new Set(t);for(let t of new Set(e))if(!n.has(t))return!1;return!0}}const bt=nt();function xt(e){let t=H(e,xt,this);if(!(K(t)&&[`checkbox`,`radio`].includes(t.type))&&!(bt.includes(c(t)||``)&&[`true`,`false`].includes(t.getAttribute(`aria-checked`)||``)))return{pass:!1,message:()=>`only inputs with type="checkbox" or type="radio" or elements with ${St()} and a valid aria-checked attribute can be used with .toBeChecked(). Use .toHaveValue() instead`};let n=f(t)===!0;return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeChecked`,`element`,``),``,`Received element ${e} checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
11
- `)}}}function St(){return lt(bt.map(e=>`role="${e}"`),{lastWordConnector:` or `})}function Ct(e){let t=H(e,Ct,this);return{pass:wt(t),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEmptyDOMElement`,`element`,``),``,`Received:`,` ${this.utils.printReceived(t.innerHTML)}`].join(`
12
- `)}}function wt(e){return[...e.childNodes].filter(e=>e.nodeType!==Node.COMMENT_NODE).length===0}function Tt(e){let t=H(e,Tt,this),n=Dt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeDisabled`,`element`,``),``,`Received element ${e} disabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
13
- `)}}}function Et(e){let t=H(e,Et,this),n=Dt(t);return{pass:!n,message:()=>{let e=n?`is not`:`is`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEnabled`,`element`,``),``,`Received element ${e} enabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
14
- `)}}}function Dt(e){return G(e).includes(`-`)?e.hasAttribute(`disabled`):p(e)}function Ot(e){let t=null;(e!==null||!this.isNot)&&(t=rt(e,Ot,this));let n=t===null?!1:t.ownerDocument===t.getRootNode({composed:!0}),r=()=>`expected document not to contain element, found ${this.utils.stringify(t?.cloneNode(!0))} instead`,i=()=>`element could not be found in the document`;return{pass:n,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInTheDocument`,`element`,``),``,this.utils.RECEIVED_COLOR(this.isNot?r():i())].join(`
15
- `)}}const kt=[`FORM`,`INPUT`,`SELECT`,`TEXTAREA`];function At(e){return e.hasAttribute(`aria-invalid`)&&e.getAttribute(`aria-invalid`)!==`false`}function jt(e){return kt.includes(G(e))}function Mt(e){let t=At(e);return jt(e)?t||!e.checkValidity():t}function J(e){let t=H(e,J,this),n=Mt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInvalid`,`element`,``),``,`Received element ${e} currently invalid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
16
- `)}}}function Nt(e){let t=H(e,J,this),n=!Mt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeValid`,`element`,``),``,`Received element ${e} currently valid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
17
- `)}}}function Pt(e,t){let n=H(e,Pt,this),r=t?.ratio??0;return Ft(n,r).then(({pass:e,ratio:t})=>({pass:e,message:()=>{let i=e?`is`:`is not`,a=r>0?` with ratio ${r}`:``,o=t===void 0?``:` (actual ratio: ${t.toFixed(3)})`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInViewport`,`element`,``),``,`Received element ${i} in viewport${a}${o}:`,` ${this.utils.printReceived(n.cloneNode(!1))}`].join(`
18
- `)}}))}async function Ft(e,t){let n=await new Promise(t=>{let n=new IntersectionObserver(e=>{e.length>0?t(e[0].intersectionRatio):t(0),n.disconnect()});n.observe(e),requestAnimationFrame(()=>{})});return{pass:n>0&&n>t-1e-9,ratio:n}}function It(e){let t=H(e,It,this);if(!(K(t)&&t.type===`checkbox`)&&t.getAttribute(`role`)!==`checkbox`)return{pass:!1,message:()=>`only inputs with type="checkbox" or elements with role="checkbox" and a valid aria-checked attribute can be used with .toBePartiallyChecked(). Use .toHaveValue() instead`};let n=Lt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyChecked`,`element`,``),``,`Received element ${e} partially checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
19
- `)}}}function Lt(e){let t=f(e)===`mixed`;return!t&&K(e)&&[`checkbox`,`radio`].includes(e.type)&&e.getAttribute(`aria-checked`)===`mixed`?!0:t}const Rt=[`SELECT`,`TEXTAREA`],zt=[`INPUT`,`SELECT`,`TEXTAREA`],Bt=[`color`,`hidden`,`range`,`submit`,`image`,`reset`],Vt=[`checkbox`,`combobox`,`gridcell`,`listbox`,`radiogroup`,`spinbutton`,`textbox`,`tree`];function Ht(e){return Rt.includes(G(e))&&e.hasAttribute(`required`)}function Ut(e){return G(e)===`INPUT`&&e.hasAttribute(`required`)&&(e.hasAttribute(`type`)&&!Bt.includes(e.getAttribute(`type`)||``)||!e.hasAttribute(`type`))}function Wt(e){return e.hasAttribute(`aria-required`)&&e.getAttribute(`aria-required`)===`true`&&(zt.includes(G(e))||e.hasAttribute(`role`)&&Vt.includes(e.getAttribute(`role`)||``))}function Gt(e){let t=H(e,Gt,this),n=Ht(t)||Ut(t)||Wt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeRequired`,`element`,``),``,`Received element ${e} required:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
20
- `)}}}function Kt(e){let t=H(e,Kt,this),n=t.ownerDocument===t.getRootNode({composed:!0});a();let r=n&&qt(t);return o(),{pass:r,message:()=>{let e=r?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeVisible`,`element`,``),``,`Received element ${e} visible${n?``:` (element is not in the document)`}:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
21
- `)}}}function qt(e){let t=ue(e);if(ye.browser!==`webkit`)return t;let n=e.closest(`details`);return!n||e===n?t:Jt(e)}function Jt(e){let t=e;for(;t;){if(t.tagName===`DETAILS`){let n=t.querySelector(`summary`)===e;if(!t.open&&!n)return!1}t=t.parentElement}return e.offsetParent!==null}function Y(e,t){let n=H(e,Y,this),r=t===null?null:H(t,Y,this);return{pass:n.contains(r),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainElement`,`element`,`element`),``,this.utils.RECEIVED_COLOR(`${this.utils.stringify(n.cloneNode(!1))} ${this.isNot?`contains:`:`does not contain:`} ${this.utils.stringify(r?r.cloneNode(!1):null)}
1
+ import{Snapshots as e,recordArtifact as t,expect as n,chai as r}from"vitest";import{getType as i}from"vitest/internal/browser";import{b as a,e as o,i as s,g as c,n as l,a as u,k as d,c as f,d as ee,f as te,h as ne,j as re,l as ie,m as ae,o as oe,p as se,q as ce,r as le,s as ue,t as p,_ as m,u as h,L as g,v as de,w as fe,x as pe,y as me,z as he,A as ge,B as _e,C as ve,D as ye,E as be}from"./locators-DUkyvRhY.js";import{server as xe}from"vitest/browser";var Se=Object.defineProperty,Ce=(e,t)=>{let n={};for(var r in e)Se(n,r,{get:e[r],enumerable:!0});return Se(n,Symbol.toStringTag,{value:`Module`}),n};function we(e,t,n={}){let r=Te(e,t,n);if(r.errors.length)throw Error(r.errors[0].message);return r.fragment}function Te(e,t,n={}){let r=new e.LineCounter,i={keepSourceTokens:!0,lineCounter:r,...n},a=e.parseDocument(t,i),o=[],s=e=>[r.linePos(e[0]),r.linePos(e[1])],c=e=>{o.push({message:e.message,range:[r.linePos(e.pos[0]),r.linePos(e.pos[1])]})},l=(t,n)=>{for(let r of n.items){if(r instanceof e.Scalar&&typeof r.value==`string`){let e=v.parse(r,i,o);e&&(t.children=t.children||[],t.children.push(e));continue}if(r instanceof e.YAMLMap){u(t,r);continue}o.push({message:`Sequence items should be strings or maps`,range:s(r.range||n.range)})}},u=(t,n)=>{for(let r of n.items){if(t.children=t.children||[],!(r.key instanceof e.Scalar&&typeof r.key.value==`string`)){o.push({message:`Only string keys are supported`,range:s(r.key.range||n.range)});continue}let a=r.key,c=r.value;if(a.value===`text`){if(!(c instanceof e.Scalar&&typeof c.value==`string`)){o.push({message:`Text value should be a string`,range:s(r.value.range||n.range)});continue}t.children.push({kind:`text`,text:_(c.value)});continue}if(a.value===`/children`){if(!(c instanceof e.Scalar&&typeof c.value==`string`)||c.value!==`contain`&&c.value!==`equal`&&c.value!==`deep-equal`){o.push({message:`Strict value should be "contain", "equal" or "deep-equal"`,range:s(r.value.range||n.range)});continue}t.containerMode=c.value;continue}if(a.value.startsWith(`/`)){if(!(c instanceof e.Scalar&&typeof c.value==`string`)){o.push({message:`Property value should be a string`,range:s(r.value.range||n.range)});continue}t.props=t.props??{},t.props[a.value.slice(1)]=_(c.value);continue}let u=v.parse(a,i,o);if(u){if(c instanceof e.Scalar){let e=typeof c.value;if(e!==`string`&&e!==`number`&&e!==`boolean`){o.push({message:`Node value should be a string or a sequence`,range:s(r.value.range||n.range)});continue}t.children.push({...u,children:[{kind:`text`,text:_(String(c.value))}]});continue}if(c instanceof e.YAMLSeq){t.children.push(u),l(u,c);continue}o.push({message:`Map values should be strings or sequences`,range:s(r.value.range||n.range)})}}},d={kind:`role`,role:`fragment`};return a.errors.forEach(c),o.length?{errors:o,fragment:d}:a.contents?(a.contents instanceof e.YAMLSeq||o.push({message:`Aria snapshot must be a YAML sequence, elements starting with " -"`,range:s(a.contents.range)}),o.length?{errors:o,fragment:d}:(l(d,a.contents),o.length?{errors:o,fragment:Ee}:d.children?.length===1&&(!d.containerMode||d.containerMode===`contain`)?{fragment:d.children[0],errors:[]}:{fragment:d,errors:[]})):{fragment:d,errors:[]}}const Ee={kind:`role`,role:`fragment`};function De(e){return e.replace(/[\u200b\u00ad]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function _(e){return{raw:e,normalized:De(e)}}var v=class e{static parse(t,n,r){try{return new e(t.value)._parse()}catch(e){if(e instanceof y){let i=n.prettyErrors===!1?e.message:`${e.message}:\n\n${t.value}\n${` `.repeat(e.pos)}^\n`;return r.push({message:i,range:[n.lineCounter.linePos(t.range[0]),n.lineCounter.linePos(t.range[0]+e.pos)]}),null}throw e}}constructor(e){m(this,`_input`,void 0),m(this,`_pos`,void 0),m(this,`_length`,void 0),this._input=e,this._pos=0,this._length=e.length}_peek(){return this._input[this._pos]||``}_next(){return this._pos<this._length?this._input[this._pos++]:null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\s/.test(this._peek())}_skipWhitespace(){for(;this._isWhitespace();)this._pos++}_readIdentifier(e){this._eof()&&this._throwError(`Unexpected end of input when expecting ${e}`);let t=this._pos;for(;!this._eof()&&/[a-zA-Z]/.test(this._peek());)this._pos++;return this._input.slice(t,this._pos)}_readString(){let e=``,t=!1;for(;!this._eof();){let n=this._next();if(t)e+=n,t=!1;else if(n===`\\`)t=!0;else if(n===`"`)return e;else e+=n}this._throwError(`Unterminated string`)}_throwError(e,t=0){throw new y(e,t||this._pos)}_readRegex(){let e=``,t=!1,n=!1;for(;!this._eof();){let r=this._next();if(t)e+=r,t=!1;else if(r===`\\`)t=!0,e+=r;else if(r===`/`&&!n)return{pattern:e};else r===`[`?(n=!0,e+=r):r===`]`&&n?(e+=r,n=!1):e+=r}this._throwError(`Unterminated regex`)}_readStringOrRegex(){let e=this._peek();return e===`"`?(this._next(),De(this._readString())):e===`/`?(this._next(),this._readRegex()):null}_readAttributes(e){let t=this._pos;for(;this._skipWhitespace(),this._peek()===`[`;){this._next(),this._skipWhitespace(),t=this._pos;let n=this._readIdentifier(`attribute`);this._skipWhitespace();let r=``;if(this._peek()===`=`)for(this._next(),this._skipWhitespace(),t=this._pos;this._peek()!==`]`&&!this._isWhitespace()&&!this._eof();)r+=this._next();this._skipWhitespace(),this._peek()!==`]`&&this._throwError(`Expected ]`),this._next(),this._applyAttribute(e,n,r||`true`,t)}}_parse(){this._skipWhitespace();let e=this._readIdentifier(`role`);e===`fragment`&&this._throwError(`Invalid role "fragment"`),this._skipWhitespace();let t={kind:`role`,role:e,name:this._readStringOrRegex()||void 0};return this._readAttributes(t),this._skipWhitespace(),this._eof()||this._throwError(`Unexpected input`),t}_applyAttribute(e,t,n,r){if(t===`checked`){this._assert(n===`true`||n===`false`||n===`mixed`,`Value of "checked" attribute must be a boolean or "mixed"`,r),e.checked=n===`true`?!0:n===`false`?!1:`mixed`;return}if(t===`disabled`){this._assert(n===`true`||n===`false`,`Value of "disabled" attribute must be a boolean`,r),e.disabled=n===`true`;return}if(t===`expanded`){this._assert(n===`true`||n===`false`,`Value of "expanded" attribute must be a boolean`,r),e.expanded=n===`true`;return}if(t===`active`){this._assert(n===`true`||n===`false`,`Value of "active" attribute must be a boolean`,r),e.active=n===`true`;return}if(t===`level`){this._assert(!Number.isNaN(Number(n)),`Value of "level" attribute must be a number`,r),e.level=Number(n);return}if(t===`pressed`){this._assert(n===`true`||n===`false`||n===`mixed`,`Value of "pressed" attribute must be a boolean or "mixed"`,r),e.pressed=n===`true`?!0:n===`false`?!1:`mixed`;return}if(t===`selected`){this._assert(n===`true`||n===`false`,`Value of "selected" attribute must be a boolean`,r),e.selected=n===`true`;return}this._assert(!1,`Unsupported attribute [${t}]`,r)}_assert(e,t,n){e||this._throwError(t||`Assertion error`,n)}},y=class extends Error{constructor(e,t){super(e),m(this,`pos`,void 0),this.pos=t}};function b(e,t){return t?e?typeof t==`string`?e===t:!!e.match(new RegExp(t.pattern)):!1:!0}function x(e,t){if(!t?.normalized)return!0;if(!e)return!1;if(e===t.normalized||e===t.raw)return!0;let n=C(t);return n?!!e.match(n):!1}const S=Symbol(`cachedRegex`);function C(e){if(e[S]!==void 0)return e[S];let{raw:t}=e,n=t.startsWith(`/`)&&t.endsWith(`/`)&&t.length>1,r;try{r=n?new RegExp(t.slice(1,-1)):null}catch{r=null}return e[S]=r,r}function w(e,t,n){if(typeof e==`string`&&t.kind===`text`)return x(e,t.text);if(typeof e!=`object`||!e||t.kind!==`role`||t.role!==`fragment`&&t.role!==e.role||t.checked!==void 0&&t.checked!==e.checked||t.disabled!==void 0&&t.disabled!==e.disabled||t.expanded!==void 0&&t.expanded!==e.expanded||t.level!==void 0&&t.level!==e.level||t.pressed!==void 0&&t.pressed!==e.pressed||t.selected!==void 0&&t.selected!==e.selected||!b(e.name,t.name))return!1;if(t.props){for(let[n,r]of Object.entries(t.props))if(!x(e.props[n]||``,r))return!1}return t.containerMode===`contain`?E(e.children||[],t.children||[]):t.containerMode===`equal`?T(e.children||[],t.children||[],!1):t.containerMode===`deep-equal`||n?T(e.children||[],t.children||[],!0):E(e.children||[],t.children||[])}function T(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!w(e[r],t[r],n))return!1;return!0}function E(e,t){if(t.length>e.length)return!1;let n=e.slice(),r=t.slice();for(let e of r){let t=n.shift();for(;t&&!w(t,e,!1);)t=n.shift();if(!t)return!1}return!0}var Oe=Ce({LineCounter:()=>ke,Scalar:()=>D,YAMLError:()=>A,YAMLMap:()=>O,YAMLSeq:()=>k,parseDocument:()=>Ae}),D=class{constructor(e,t=[0,0,0]){m(this,`value`,void 0),m(this,`range`,void 0),this.value=e,this.range=t}},O=class{constructor(e=[0,0,0]){m(this,`items`,void 0),m(this,`range`,void 0),this.items=[],this.range=e}},k=class{constructor(e=[0,0,0]){m(this,`items`,void 0),m(this,`range`,void 0),this.items=[],this.range=e}},ke=class{constructor(){m(this,`lineStarts`,[0])}addNewLine(e){e>this.lineStarts[this.lineStarts.length-1]&&this.lineStarts.push(e)}linePos(e){let t=0,n=this.lineStarts.length-1;for(;t<n;){let r=t+n+1>>1;this.lineStarts[r]<=e?t=r:n=r-1}return{line:t+1,col:e-this.lineStarts[t]+1}}},A=class extends Error{constructor(e,t){super(e),m(this,`pos`,void 0),this.pos=t}};function Ae(e,t={}){let n=t.lineCounter,r=[];if(n)for(let t=0;t<e.length;t++)e[t]===`
2
+ `&&n.addNewLine(t+1);try{return{contents:new je(e,r).parseRoot(),errors:r}}catch(e){if(e instanceof A)return r.push(e),{contents:null,errors:r};throw e}}var je=class{constructor(e,t){m(this,`lines`,void 0),m(this,`pos`,void 0),m(this,`text`,void 0),m(this,`errors`,void 0),this.text=e,this.errors=t,this.lines=[],this.pos=0;let n=0,r=e.split(`
3
+ `);for(let e of r){let t=e.replace(/\r$/,``),r=t.replace(/^\s+/,``),i=t.length-r.length;this.lines.push({indent:i,content:r,offset:n+i,lineOffset:n,raw:t}),n+=e.length+1}for(;this.lines.length>0&&this.lines[this.lines.length-1].content===``;)this.lines.pop()}parseRoot(){if(this.lines.length===0)return null;let e=this.parseNode(0);if(this.skipEmpty(),this.pos<this.lines.length){let e=this.currentLine();this.addError(`Unexpected scalar at node end`,e.offset)}return e}currentLine(){return this.lines[this.pos]}parseNode(e){this.skipEmpty();let t=this.currentLine();return!t||t.indent<e?null:t.content.startsWith(`- `)||t.content===`-`?this.parseSequence(t.indent):this.isMapEntry(t.content)?this.parseMap(t.indent):(this.pos++,this.parseScalarValue(t.content,t.offset,t))}parseSequence(e){let t=this.currentLine(),n=new k([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a sequence entry`,t.offset);break}if(!t.content.startsWith(`- `)&&t.content!==`-`)break;let i=t.content===`-`?1:2,a=t.content.slice(i),o=t.offset+i;if(this.pos++,a===``||a.trim()===``){let t=this.parseNode(e+1);t&&(n.items.push(t),r=this.peekLastOffset())}else if(this.isMapEntry(a)){let s=this.parseInlineMap(a,o,e+i,t);n.items.push(s),r=s.range[2]}else{let e=this.parseScalarValue(a,o,t);n.items.push(e),r=e.range[2]}}return n.range[1]=r,n.range[2]=r,n}parseMap(e){let t=this.currentLine(),n=new O([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a mapping entry`,t.offset);break}if(!this.isMapEntry(t.content))break;let{key:i,valueStr:a,colonOffset:o,valueOffset:s}=this.splitMapEntry(t.content,t.offset),c=new D(i,[t.offset,t.offset+i.length,o]);this.pos++;let l;l=a===``?this.parseMapValue(e,o):this.parseScalarValue(a.trim(),s,t),n.items.push({key:c,value:l}),r=l?this.getNodeEnd(l):o+1}return n.range[1]=r,n.range[2]=r,n}parseInlineMap(e,t,n,r){let i=new O([t,0,0]),a=t,{key:o,valueStr:s,colonOffset:c,valueOffset:l}=this.splitMapEntry(e,t),u=new D(o,[t,t+o.length,c]),d;for(d=s===``?this.parseMapValue(n,c):this.parseScalarValue(s.trim(),l,r),i.items.push({key:u,value:d}),a=d?this.getNodeEnd(d):c+1;this.pos<this.lines.length;){this.skipEmpty();let e=this.currentLine();if(!e||e.indent<n||e.indent>n||!this.isMapEntry(e.content)||e.content.startsWith(`- `))break;let t=this.splitMapEntry(e.content,e.offset),r=new D(t.key,[e.offset,e.offset+t.key.length,t.colonOffset]);this.pos++;let o;o=t.valueStr===``?this.parseMapValue(n,t.colonOffset):this.parseScalarValue(t.valueStr.trim(),t.valueOffset,e),i.items.push({key:r,value:o}),a=o?this.getNodeEnd(o):t.colonOffset+1}return i.range[1]=a,i.range[2]=a,i}parseMapValue(e,t){this.skipEmpty();let n=this.currentLine();return!n||n.indent<e?new D(null,[t+1,t+1,t+1]):n.indent===e&&(n.content.startsWith(`- `)||n.content===`-`)?this.parseNode(e):n.indent>e?this.parseNode(e+1):new D(null,[t+1,t+1,t+1])}getNodeEnd(e){return e.range[2]}peekLastOffset(){if(this.pos>0&&this.pos<=this.lines.length){let e=this.lines[this.pos-1];return e.lineOffset+e.raw.length}return this.text.length}parseScalarValue(e,t,n){let r=e.trim(),i=t+e.indexOf(r),a=i+r.length,o=n.lineOffset+n.raw.length;return r.startsWith(`"`)?this.parseQuotedScalar(r,i,o):r===`true`||r===`false`?new D(r===`true`,[i,a,o]):r===`null`||r===`~`?new D(null,[i,a,o]):r!==``&&Me(r)?new D(Number(r),[i,a,o]):new D(r,[i,a,o])}parseQuotedScalar(e,t,n){let r=``,i=1;for(;i<e.length;){let a=e[i];if(a===`\\`){if(i++,i>=e.length){this.addError(`Unterminated double-quoted string`,t+i);break}let n=e[i];switch(n){case`n`:r+=`
4
+ `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`"`:r+=`"`;break;case`\\`:r+=`\\`;break;case`/`:r+=`/`;break;default:r+=n}}else if(a===`"`){let e=t+i+1;return new D(r,[t,e,n])}else r+=a;i++}return this.addError(`Unterminated double-quoted string`,t),new D(r,[t,t+e.length,n])}skipEmpty(){for(;this.pos<this.lines.length&&this.lines[this.pos].content===``;)this.pos++}isMapEntry(e){return this.findMapColon(e)>=0}findMapColon(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){n=!1;continue}if(i===`\\`&&t){n=!0;continue}if(i===`"`){t=!t;continue}if(!t&&i===`:`&&(r+1>=e.length||e[r+1]===` `))return r}return-1}splitMapEntry(e,t){let n=this.findMapColon(e),r=e.slice(0,n).trim(),i=t+n,a=e.slice(n+1),o=a.trimStart(),s=i+1+(a.length-a.trimStart().length);return r.startsWith(`"`)&&r.endsWith(`"`)?{key:r.slice(1,-1),valueStr:o,colonOffset:i,valueOffset:s}:{key:r,valueStr:o,colonOffset:i,valueOffset:s}}addError(e,t){this.errors.push(new A(e,[t,t+1]))}};function Me(e){return e===``||e===`-`||e===`+`?!1:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(e)}function j(e){return Ne(e)?`"`+e.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,e=>{switch(e){case`\\`:return`\\\\`;case`"`:return`\\"`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`
5
+ `:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;default:return`\\x`+e.charCodeAt(0).toString(16).padStart(2,`0`)}})+`"`:e}function Ne(e){return!!(e.length===0||/^\s|\s$/.test(e)||/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(e)||/^-/.test(e)||/[\n:](\s|$)/.test(e)||/\s#/.test(e)||/[\n\r]/.test(e)||/^[&*\],?!>|@"'#%]/.test(e)||/[{}`]/.test(e)||/^\[/.test(e)||!isNaN(Number(e))||[`y`,`n`,`yes`,`no`,`true`,`false`,`on`,`off`,`null`].includes(e.toLowerCase()))}const M={visible:!0,inline:!1};function Pe(e){let t=new Set,n={role:`fragment`,name:``,children:[],props:{},box:M,receivesPointerEvents:!0},r=(n,r,a)=>{if(t.has(r))return;if(t.add(r),r.nodeType===Node.TEXT_NODE&&r.nodeValue){if(!a)return;let e=r.nodeValue;n.role!==`textbox`&&e&&n.children.push(r.nodeValue||``);return}if(r.nodeType!==Node.ELEMENT_NODE)return;let o=r,c=!s(o);if(!c)return;let l=[];if(o.hasAttribute(`aria-owns`)){let t=o.getAttribute(`aria-owns`).split(/\s+/);for(let n of t){let t=e.ownerDocument.getElementById(n);t&&l.push(t)}}let u=Fe(o);u&&n.children.push(u),i(u||n,o,l,c)};function i(e,t,n,i){let a=(ue(t)?.display||`inline`)!==`inline`||t.nodeName===`BR`?` `:``;a&&e.children.push(a),e.children.push(p(t,`::before`));let o=t.nodeName===`SLOT`?t.assignedNodes():[];if(o.length)for(let t of o)r(e,t,i);else{for(let n=t.firstChild;n;n=n.nextSibling)n.assignedSlot||r(e,n,i);if(t.shadowRoot)for(let n=t.shadowRoot.firstChild;n;n=n.nextSibling)r(e,n,i)}for(let t of n)r(e,t,i);if(e.children.push(p(t,`::after`)),a&&e.children.push(a),e.children.length===1&&e.name===e.children[0]&&(e.children=[]),e.role===`link`&&t.hasAttribute(`href`)){let n=t.getAttribute(`href`);e.props.url=n}if(e.role===`textbox`&&t.hasAttribute(`placeholder`)&&t.getAttribute(`placeholder`)!==e.name){let n=t.getAttribute(`placeholder`);e.props.placeholder=n}}a();try{r(n,e,!0)}finally{o()}return Ie(n),n}function Fe(e){let t=c(e)??null;if(!t||t===`presentation`||t===`none`)return null;let n={role:t,name:l(u(e,!1)||``),children:[],props:{},box:M,receivesPointerEvents:!0};if(d.includes(t)&&(n.checked=f(e)),ee.includes(t)&&(n.disabled=te(e)||void 0),ne.includes(t)){let t=re(e);n.expanded=t===`none`?void 0:t}return ie.includes(t)&&(n.level=ae(e)),oe.includes(t)&&(n.pressed=se(e)),ce.includes(t)&&(n.selected=le(e)),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`file`&&(n.children=[e.value]),n}function Ie(e){let t=(e,t)=>{if(!e.length)return;let n=l(e.join(``));n&&t.push(n),e.length=0},n=e=>{let r=[],i=[];for(let a of e.children||[])typeof a==`string`?i.push(a):(t(i,r),n(a),r.push(a));t(i,r),e.children=r.length?r:[],e.children.length===1&&e.children[0]===e.name&&(e.children=[])};n(e)}function N(e,t){let n=``;return e.level&&(n+=` [level=${e.level}]`),e.checked===!0&&(n+=` [checked]`),e.checked===`mixed`&&(n+=` [checked=mixed]`),e.disabled&&(n+=` [disabled]`),e.expanded===!0&&(n+=` [expanded]`),e.expanded,e.pressed===!0&&(n+=` [pressed]`),e.pressed===`mixed`&&(n+=` [pressed=mixed]`),e.selected&&(n+=` [selected]`),n}function Le(e){let t=e.role;return e.name&&e.name.length<=900&&(t+=` ${JSON.stringify(e.name)}`),t+=N(e),t}function P(e,t,n){let r=Le(e),i=Object.keys(e.props).length>0,a=e.children.length===1&&typeof e.children[0]==`string`&&!i?e.children[0]:void 0;if(!e.children.length&&!i)n.push(`${t}- ${r}`);else if(a!==void 0)n.push(`${t}- ${r}: ${j(a)}`);else{n.push(`${t}- ${r}:`);for(let[r,i]of Object.entries(e.props))n.push(`${t} - /${r}: ${j(i)}`);for(let r of e.children)typeof r==`string`?r&&n.push(`${t} - text: ${j(r)}`):P(r,`${t} `,n)}}function Re(e){let t=[],n=e.role===`fragment`?e.children:[e];for(let e of n)typeof e==`string`?e&&t.push(`- text: ${j(e)}`):P(e,``,t);return t.join(`
6
+ `)}function F(e){return C(e)?`/${e.raw.slice(1,-1)}/`:j(e.normalized)}function ze(e){return typeof e==`string`?JSON.stringify(e):`/${e.pattern}/`}function Be(e){let t=[];if(e.kind===`text`)t.push(`- text: ${F(e.text)}`);else if(e.role===`fragment`){e.containerMode&&e.containerMode!==`contain`&&t.push(`- /children: ${e.containerMode}`);for(let n of e.children||[])I(n,``,t)}else I(e,``,t);return t.join(`
7
+ `)}function Ve(e){let t=e.role;return e.name!==void 0&&(t+=` ${ze(e.name)}`),t+=N(e),t}function I(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${F(e.text)}`);return}let r=Ve(e),i=e.children||[],a=[];if(e.containerMode&&e.containerMode!==`contain`&&a.push(`${t} - /children: ${e.containerMode}`),e.props)for(let[n,r]of Object.entries(e.props))a.push(`${t} - /${n}: ${F(r)}`);if(i.length===0&&a.length===0){n.push(`${t}- ${r}`);return}if(i.length===1&&i[0].kind===`text`&&a.length===0){n.push(`${t}- ${r}: ${F(i[0].text)}`);return}n.push(`${t}- ${r}:`),n.push(...a);for(let e of i)I(e,`${t} `,n)}function He(e,t){let n=e.role===`fragment`?e.children:[e],r=L(t)?t.children??[]:[t],i=L(t)?t.containerMode:void 0,a=qe(n,r,``,i);return a.pass&&i&&i!==`contain`&&a.resolved.unshift(`- /children: ${i}`),{pass:a.pass,resolved:a.resolved.join(`
8
+ `)}}function L(e){return e.kind===`role`&&e.role===`fragment`}function Ue(e){return typeof e==`object`&&!!e&&`pattern`in e}function We(e,t){let n=e.role;return t.name===void 0||(Ue(t.name)&&b(e.name,t.name)?n+=` ${ze(t.name)}`:e.name&&(n+=` ${JSON.stringify(e.name)}`)),t.level!==void 0&&(n+=` [level=${e.level}]`),t.checked!==void 0&&(e.checked===!0?n+=` [checked]`:e.checked===`mixed`&&(n+=` [checked=mixed]`)),t.disabled!==void 0&&e.disabled&&(n+=` [disabled]`),t.expanded!==void 0&&(e.expanded===!0?n+=` [expanded]`:e.expanded===!1&&(n+=` [expanded=false]`)),t.pressed!==void 0&&(e.pressed===!0?n+=` [pressed]`:e.pressed===`mixed`&&(n+=` [pressed=mixed]`)),t.selected!==void 0&&e.selected&&(n+=` [selected]`),n}function Ge(e,t){let n=new Map,r=0;for(let i=0;i<e.length&&r<t.length;i++)w(e[i],t[r],!1)&&(n.set(i,r),r++);return n}function Ke(e,t){let n=new Map,r=new Set;for(let i=0;i<t.length;i++)for(let a=0;a<e.length;a++)if(!r.has(a)&&w(e[a],t[i],!1)){n.set(a,i),r.add(a);break}return n}function R(e,t){let n=[];return typeof e==`string`?n.push(`${t}- text: ${e}`):P(e,t,n),n}function qe(e,t,n,r){if(e.some(e=>typeof e!=`string`&&e.role===`fragment`)||t.some(e=>L(e)))throw Error(`Internal error: fragment wrappers must be unwrapped at matchAriaTree root`);if(r===`equal`||r===`deep-equal`)return Je(e,t,n,r===`deep-equal`);let i=[],a=Ge(e,t);if(t.length!==a.size){let r=Ke(e,t);for(let a=0;a<e.length;a++){let o=r.get(a);o===void 0?i.push(...R(e[a],n)):i.push(...z(e[a],t[o],n))}return{resolved:i,pass:!1}}for(let r=0;r<e.length;r++){let o=a.get(r);o!==void 0&&i.push(...z(e[r],t[o],n))}return{resolved:i,pass:!0}}function Je(e,t,n,r){let i=[],a=e.length===t.length&&e.every((e,n)=>w(e,t[n],r));for(let a=0;a<e.length;a++)a<t.length?i.push(...z(e[a],t[a],n,r)):i.push(...R(e[a],n));return{resolved:i,pass:a}}function z(e,t,n,r=!1){if(typeof e==`string`&&t.kind===`text`)return[`${n}- text: ${x(e,t.text)&&C(t.text)?F(t.text):e}`];if(typeof e==`string`||t.kind===`text`)return R(e,n);let i=We(e,t),a=qe(e.children,t.children||[],`${n} `,t.containerMode??(r?`equal`:`contain`)),o=[];t.containerMode&&t.containerMode!==`contain`&&o.push(`${n} - /children: ${t.containerMode}`);let s=new Set([...Object.keys(e.props),...Object.keys(t.props||{})]);for(let r of s){let i=e.props[r],a=t.props?.[r];if(i!==void 0){let e=(a===void 0||x(i,a))&&a&&C(a)?F(a):i;o.push(`${n} - /${r}: ${e}`)}}let c=[];if(!a.resolved.length&&!o.length)c.push(`${n}- ${i}`);else if(a.resolved.length===1&&a.resolved[0].trimStart().startsWith(`- text: `)&&!o.length){let e=a.resolved[0].trimStart().slice(8);c.push(`${n}- ${i}: ${e}`)}else c.push(`${n}- ${i}:`),c.push(...o),c.push(...a.resolved);return c}function Ye(e){return we(Oe,e)}var Xe=Object.freeze({__proto__:null,generateAriaTree:Pe,matchAriaTree:He,parseAriaTemplate:Ye,renderAriaTemplate:Be,renderAriaTree:Re});h().aria=Xe;const{generateAriaTree:Ze,matchAriaTree:Qe,parseAriaTemplate:$e,renderAriaTemplate:et,renderAriaTree:tt}=Xe,B={name:`aria`,capture(e){if(e instanceof Element)return Ze(e);throw TypeError(`aria adapter expects an Element`)},render(e){return V(tt(e))},parseExpected(e){let t=Error.stackTraceLimit;Error.stackTraceLimit=t+20;try{return $e(e.trim())}finally{Error.stackTraceLimit=t}},match(e,t){let n=Qe(e,t);return n.pass?{pass:!0}:{pass:!1,message:`Accessibility tree does not match expected template`,resolved:V(n.resolved),expected:V(et(t))}}};function V(e){return`\n${e}\n`}const nt={toMatchAriaSnapshot(t){return e.toMatchDomainSnapshot.call(this,B,t)},toMatchAriaInlineSnapshot(t,n){return e.toMatchDomainInlineSnapshot.call(this,B,t,n)}};for(let e of Object.values(nt))Object.assign(e,{__vitest_poll_takeover__:!0});function rt(){return[...d]}function it(e,t,n){return e instanceof g&&(e=e.query()),e==null?null:H(e,t,n)}function H(e,t,n){e instanceof g&&(e=e.element());let r=e?.ownerDocument?.defaultView||window;if(e instanceof r.HTMLElement||e instanceof r.SVGElement)return e;throw new ft(e,t,n)}function at(e,t,n){e instanceof g&&(e=e.element());let r=e.ownerDocument?.defaultView||window;if(e instanceof r.Node)return e;throw new pt(e,t,n)}function U(e,t,n,r,i,a){return[`${t}\n`,`${n}:\n${e.utils.EXPECTED_COLOR(W(lt(e,r),2))}`,`${i}:\n${e.utils.RECEIVED_COLOR(W(lt(e,a),2))}`].join(`
9
+ `)}function W(e,t){return ot(ct(e),t)}function ot(e,t){return e.replace(/^(?!\s*$)/gm,` `.repeat(t))}function st(e){let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((e,t)=>Math.min(e,t.length),1/0):0}function ct(e){let t=st(e);if(t===0)return e;let n=RegExp(`^[ \\t]{${t}}`,`gm`);return e.replace(n,``)}function lt(e,t){return typeof t==`string`?t:e.utils.stringify(t)}function ut(e,{wordConnector:t=`, `,lastWordConnector:n=` and `}={}){return[e.slice(0,-1).join(t),e.at(-1)].join(e.length>1?n:``)}class dt extends Error{constructor(e,t,n,r){super(),Error.captureStackTrace&&Error.captureStackTrace(this,n);let i=``;try{i=r.utils.printWithType(`Received`,t,r.utils.printReceived)}catch{}this.message=[r.utils.matcherHint(`${r.isNot?`.not`:``}.${n.name}`,`received`,``),``,`${r.utils.RECEIVED_COLOR(`received`)} value must ${e} or a Locator that returns ${e}.`,i].join(`
10
+ `)}}class ft extends dt{constructor(e,t,n){super(`an HTMLElement or an SVGElement`,e,t,n)}}class pt extends dt{constructor(e,t,n){super(`a Node`,e,t,n)}}function G(e){return e instanceof HTMLFormElement?`FORM`:e.tagName.toUpperCase()}function K(e){return G(e)===`INPUT`}function mt(e){if(e)switch(G(e)){case`INPUT`:return gt(e);case`SELECT`:return ht(e);default:return e.value??vt(e)}}function ht({multiple:e,options:t}){let n=[...t].filter(e=>e.selected);if(e)return[...n].map(e=>e.value);if(n.length!==0)return n[0].value}function gt(e){switch(e.type){case`number`:return e.value===``?null:Number(e.value);case`checkbox`:return e.checked;default:return e.value}}const _t=[`meter`,`progressbar`,`slider`,`spinbutton`];function vt(e){if(_t.includes(e.getAttribute(`role`)||``))return Number(e.getAttribute(`aria-valuenow`))}function yt(e){return e.replace(/\s+/g,` `).trim()}function bt(e,t){return t instanceof RegExp?t.test(e):e.includes(String(t))}function q(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=new Set(t);for(let t of new Set(e))if(!n.has(t))return!1;return!0}}const xt=rt();function St(e){let t=H(e,St,this);if(!(K(t)&&[`checkbox`,`radio`].includes(t.type))&&!(xt.includes(c(t)||``)&&[`true`,`false`].includes(t.getAttribute(`aria-checked`)||``)))return{pass:!1,message:()=>`only inputs with type="checkbox" or type="radio" or elements with ${Ct()} and a valid aria-checked attribute can be used with .toBeChecked(). Use .toHaveValue() instead`};let n=f(t)===!0;return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeChecked`,`element`,``),``,`Received element ${e} checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
11
+ `)}}}function Ct(){return ut(xt.map(e=>`role="${e}"`),{lastWordConnector:` or `})}function wt(e){let t=H(e,wt,this);return{pass:Tt(t),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEmptyDOMElement`,`element`,``),``,`Received:`,` ${this.utils.printReceived(t.innerHTML)}`].join(`
12
+ `)}}function Tt(e){return[...e.childNodes].filter(e=>e.nodeType!==Node.COMMENT_NODE).length===0}function Et(e){let t=H(e,Et,this),n=Ot(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeDisabled`,`element`,``),``,`Received element ${e} disabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
13
+ `)}}}function Dt(e){let t=H(e,Dt,this),n=Ot(t);return{pass:!n,message:()=>{let e=n?`is not`:`is`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEnabled`,`element`,``),``,`Received element ${e} enabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
14
+ `)}}}function Ot(e){return G(e).includes(`-`)?e.hasAttribute(`disabled`):te(e)}function kt(e){let t=null;(e!==null||!this.isNot)&&(t=it(e,kt,this));let n=t===null?!1:t.ownerDocument===t.getRootNode({composed:!0}),r=()=>`expected document not to contain element, found ${this.utils.stringify(t?.cloneNode(!0))} instead`,i=()=>`element could not be found in the document`;return{pass:n,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInTheDocument`,`element`,``),``,this.utils.RECEIVED_COLOR(this.isNot?r():i())].join(`
15
+ `)}}const At=[`FORM`,`INPUT`,`SELECT`,`TEXTAREA`];function jt(e){return e.hasAttribute(`aria-invalid`)&&e.getAttribute(`aria-invalid`)!==`false`}function Mt(e){return At.includes(G(e))}function Nt(e){let t=jt(e);return Mt(e)?t||!e.checkValidity():t}function J(e){let t=H(e,J,this),n=Nt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInvalid`,`element`,``),``,`Received element ${e} currently invalid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
16
+ `)}}}function Pt(e){let t=H(e,J,this),n=!Nt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeValid`,`element`,``),``,`Received element ${e} currently valid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
17
+ `)}}}function Ft(e,t){let n=H(e,Ft,this),r=t?.ratio??0;return It(n,r).then(({pass:e,ratio:t})=>({pass:e,message:()=>{let i=e?`is`:`is not`,a=r>0?` with ratio ${r}`:``,o=t===void 0?``:` (actual ratio: ${t.toFixed(3)})`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInViewport`,`element`,``),``,`Received element ${i} in viewport${a}${o}:`,` ${this.utils.printReceived(n.cloneNode(!1))}`].join(`
18
+ `)}}))}async function It(e,t){let n=await new Promise(t=>{let n=new IntersectionObserver(e=>{e.length>0?t(e[0].intersectionRatio):t(0),n.disconnect()});n.observe(e),requestAnimationFrame(()=>{})});return{pass:n>0&&n>t-1e-9,ratio:n}}function Lt(e){let t=H(e,Lt,this);if(!(K(t)&&t.type===`checkbox`)&&t.getAttribute(`role`)!==`checkbox`)return{pass:!1,message:()=>`only inputs with type="checkbox" or elements with role="checkbox" and a valid aria-checked attribute can be used with .toBePartiallyChecked(). Use .toHaveValue() instead`};let n=Rt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyChecked`,`element`,``),``,`Received element ${e} partially checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
19
+ `)}}}function Rt(e){let t=f(e)===`mixed`;return!t&&K(e)&&[`checkbox`,`radio`].includes(e.type)&&e.getAttribute(`aria-checked`)===`mixed`?!0:t}const zt=[`SELECT`,`TEXTAREA`],Bt=[`INPUT`,`SELECT`,`TEXTAREA`],Vt=[`color`,`hidden`,`range`,`submit`,`image`,`reset`],Ht=[`checkbox`,`combobox`,`gridcell`,`listbox`,`radiogroup`,`spinbutton`,`textbox`,`tree`];function Ut(e){return zt.includes(G(e))&&e.hasAttribute(`required`)}function Wt(e){return G(e)===`INPUT`&&e.hasAttribute(`required`)&&(e.hasAttribute(`type`)&&!Vt.includes(e.getAttribute(`type`)||``)||!e.hasAttribute(`type`))}function Gt(e){return e.hasAttribute(`aria-required`)&&e.getAttribute(`aria-required`)===`true`&&(Bt.includes(G(e))||e.hasAttribute(`role`)&&Ht.includes(e.getAttribute(`role`)||``))}function Kt(e){let t=H(e,Kt,this),n=Ut(t)||Wt(t)||Gt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeRequired`,`element`,``),``,`Received element ${e} required:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
20
+ `)}}}function qt(e){let t=H(e,qt,this),n=t.ownerDocument===t.getRootNode({composed:!0});a();let r=n&&Jt(t);return o(),{pass:r,message:()=>{let e=r?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeVisible`,`element`,``),``,`Received element ${e} visible${n?``:` (element is not in the document)`}:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
21
+ `)}}}function Jt(e){let t=de(e);if(xe.browser!==`webkit`)return t;let n=e.closest(`details`);return!n||e===n?t:Yt(e)}function Yt(e){let t=e;for(;t;){if(t.tagName===`DETAILS`){let n=t.querySelector(`summary`)===e;if(!t.open&&!n)return!1}t=t.parentElement}return e.offsetParent!==null}function Y(e,t){let n=H(e,Y,this),r=t===null?null:H(t,Y,this);return{pass:n.contains(r),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainElement`,`element`,`element`),``,this.utils.RECEIVED_COLOR(`${this.utils.stringify(n.cloneNode(!1))} ${this.isNot?`contains:`:`does not contain:`} ${this.utils.stringify(r?r.cloneNode(!1):null)}
22
22
  `)].join(`
23
- `)}}function Yt(e,t){let n=e.ownerDocument.createElement(`div`);return n.innerHTML=t,n.innerHTML}function Xt(e,t){let n=H(e,Xt,this);if(typeof t!=`string`)throw TypeError(`.toContainHTML() expects a string value, got ${t}`);return{pass:n.outerHTML.includes(Yt(n,t)),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainHTML`,`element`,``),`Expected:`,` ${this.utils.EXPECTED_COLOR(t)}`,`Received:`,` ${this.utils.printReceived(n.cloneNode(!0))}`].join(`
24
- `)}}function Zt(e,t){let n=H(e,Zt,this),r=de(n,!1),i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleDescription`,`element`,``),`Expected element ${e} have accessible description`,t,`Received`,r)}}}function Qt(e,t){let n=H(e,Qt,this),r=fe(n)??``,i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return t==null?[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message, but got${this.isNot?``:` nothing`}`,this.isNot?this.utils.RECEIVED_COLOR(W(r,2)):``].filter(Boolean).join(`
23
+ `)}}function Xt(e,t){let n=e.ownerDocument.createElement(`div`);return n.innerHTML=t,n.innerHTML}function Zt(e,t){let n=H(e,Zt,this);if(typeof t!=`string`)throw TypeError(`.toContainHTML() expects a string value, got ${t}`);return{pass:n.outerHTML.includes(Xt(n,t)),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainHTML`,`element`,``),`Expected:`,` ${this.utils.EXPECTED_COLOR(t)}`,`Received:`,` ${this.utils.printReceived(n.cloneNode(!0))}`].join(`
24
+ `)}}function Qt(e,t){let n=H(e,Qt,this),r=fe(n,!1),i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleDescription`,`element`,``),`Expected element ${e} have accessible description`,t,`Received`,r)}}}function $t(e,t){let n=H(e,$t,this),r=pe(n)??``,i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return t==null?[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message, but got${this.isNot?``:` nothing`}`,this.isNot?this.utils.RECEIVED_COLOR(W(r,2)):``].filter(Boolean).join(`
25
25
 
26
- `):U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message`,t,`Received`,r)}}}function X(e,t){let n=H(e,X,this),r=u(n,!1),i=arguments.length===1,a=n.ownerDocument.defaultView||window,o=!1;return o=i?r!==``:t instanceof a.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${X.name}`,`element`,``),`Expected element ${e} have accessible name`,t,`Received`,r)}}}function $t(e,t,n){let r=H(e,$t,this),i=n!==void 0,a=r.hasAttribute(t),o=r.getAttribute(t);return{pass:i?a&&this.equals(o,n,this.customTesters):a,message:()=>{let e=this.isNot?`not to`:`to`,r=a?en(this.utils.stringify,t,o):null,s=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAttribute`,`element`,this.utils.printExpected(t),{secondArgument:i?this.utils.printExpected(n):void 0,comment:tn(this.utils.stringify,t,n)});return U(this,s,`Expected the element ${e} have attribute`,en(this.utils.stringify,t,n),`Received`,r)}}}function en(e,t,n){return n===void 0?t:`${t}=${e(n)}`}function tn(e,t,n){return n===void 0?`element.hasAttribute(${e(t)})`:`element.getAttribute(${e(t)}) === ${e(n)}`}function nn(e,...t){let n=H(e,nn,this),{expectedClassNames:r,options:i}=rn(t),a=an(n.getAttribute(`class`)),o=r.reduce((e,t)=>e.concat(typeof t==`string`||!t?an(t):t),[]),s=o.some(e=>e instanceof RegExp);if(i.exact&&s)throw Error(`Exact option does not support RegExp expected class names`);return i.exact?{pass:on(o,a)&&o.length===a.length,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have EXACTLY defined classes`,o.join(` `),`Received`,a.join(` `))}}:o.length>0?{pass:on(o,a),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have class`,o.join(` `),`Received`,a.join(` `))}}:{pass:this.isNot?a.length>0:!1,message:()=>this.isNot?U(this,this.utils.matcherHint(`.not.toHaveClass`,`element`,``),`Expected the element to have classes`,`(none)`,`Received`,a.join(` `)):[this.utils.matcherHint(`.toHaveClass`,`element`),`At least one expected class must be provided.`].join(`
27
- `)}}function rn(e){let t=e.pop(),n,r;return typeof t==`object`&&!(t instanceof RegExp)?(n=e,r=t):(n=e.concat(t),r={exact:!1}),{expectedClassNames:n,options:r}}function an(e){return e?e.split(/\s+/).filter(e=>e.length>0):[]}function on(e,t){return e.every(e=>typeof e==`string`?t.includes(e):t.some(t=>e.test(t)))}function sn(e,t){let n=H(e,sn,this),r=G(n);if(![`SELECT`,`INPUT`,`TEXTAREA`].includes(r))throw Error(`.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.`);if(K(n)&&[`radio`,`checkbox`].includes(n.type))throw Error(`.toHaveDisplayValue() currently does not support input[type="${n.type}"], try with another matcher instead.`);let i=cn(r,n),a=ln(t),o=a.filter(e=>i.some(t=>e instanceof RegExp?e.test(t):this.equals(t,String(e),this.customTesters))).length,s=o===i.length,c=o===a.length;return{pass:s&&c,message:()=>U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDisplayValue`,`element`,``),`Expected element ${this.isNot?`not `:``}to have display value`,t,`Received`,i)}}function cn(e,t){return e===`SELECT`?Array.from(t).filter(e=>e.selected).map(e=>e.textContent||``):[t.value]}function ln(e){return Array.isArray(e)?e:[e]}function un(e){let t=H(e,un,this);return{pass:t.ownerDocument.activeElement===t,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveFocus`,`element`,``),``,...this.isNot?[`Received element is focused:`,` ${this.utils.printReceived(t)}`]:[`Expected element with focus:`,` ${this.utils.printExpected(t)}`,`Received element with focus:`,` ${this.utils.printReceived(t.ownerDocument.activeElement)}`]].join(`
28
- `)}}function Z(e,t){let n=H(e,Z,this),r=n.ownerDocument.defaultView||window;if(!(n instanceof r.HTMLFieldSetElement)&&!(n instanceof r.HTMLFormElement))throw TypeError(`toHaveFormValues must be called on a form or a fieldset, instead got ${G(n)}`);if(!t||typeof t!=`object`)throw TypeError(`toHaveFormValues must be called with an object of expected form values. Got ${t}`);let i=mn(n);return{pass:Object.entries(t).every(([e,t])=>this.equals(i[e],t,[q,...this.customTesters])),message:()=>{let e=this.isNot?`not to`:`to`,n=`${this.isNot?`.not`:``}.toHaveFormValues`,r={};for(let e in i)Object.hasOwn(t,e)&&(r[e]=i[e]);return[this.utils.matcherHint(n,`element`,``),`Expected the element ${e} have form values`,this.utils.diff(t,r)].join(`
26
+ `):U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message`,t,`Received`,r)}}}function X(e,t){let n=H(e,X,this),r=u(n,!1),i=arguments.length===1,a=n.ownerDocument.defaultView||window,o=!1;return o=i?r!==``:t instanceof a.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${X.name}`,`element`,``),`Expected element ${e} have accessible name`,t,`Received`,r)}}}function en(e,t,n){let r=H(e,en,this),i=n!==void 0,a=r.hasAttribute(t),o=r.getAttribute(t);return{pass:i?a&&this.equals(o,n,this.customTesters):a,message:()=>{let e=this.isNot?`not to`:`to`,r=a?tn(this.utils.stringify,t,o):null,s=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAttribute`,`element`,this.utils.printExpected(t),{secondArgument:i?this.utils.printExpected(n):void 0,comment:nn(this.utils.stringify,t,n)});return U(this,s,`Expected the element ${e} have attribute`,tn(this.utils.stringify,t,n),`Received`,r)}}}function tn(e,t,n){return n===void 0?t:`${t}=${e(n)}`}function nn(e,t,n){return n===void 0?`element.hasAttribute(${e(t)})`:`element.getAttribute(${e(t)}) === ${e(n)}`}function rn(e,...t){let n=H(e,rn,this),{expectedClassNames:r,options:i}=an(t),a=on(n.getAttribute(`class`)),o=r.reduce((e,t)=>e.concat(typeof t==`string`||!t?on(t):t),[]),s=o.some(e=>e instanceof RegExp);if(i.exact&&s)throw Error(`Exact option does not support RegExp expected class names`);return i.exact?{pass:sn(o,a)&&o.length===a.length,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have EXACTLY defined classes`,o.join(` `),`Received`,a.join(` `))}}:o.length>0?{pass:sn(o,a),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have class`,o.join(` `),`Received`,a.join(` `))}}:{pass:this.isNot?a.length>0:!1,message:()=>this.isNot?U(this,this.utils.matcherHint(`.not.toHaveClass`,`element`,``),`Expected the element to have classes`,`(none)`,`Received`,a.join(` `)):[this.utils.matcherHint(`.toHaveClass`,`element`),`At least one expected class must be provided.`].join(`
27
+ `)}}function an(e){let t=e.pop(),n,r;return typeof t==`object`&&!(t instanceof RegExp)?(n=e,r=t):(n=e.concat(t),r={exact:!1}),{expectedClassNames:n,options:r}}function on(e){return e?e.split(/\s+/).filter(e=>e.length>0):[]}function sn(e,t){return e.every(e=>typeof e==`string`?t.includes(e):t.some(t=>e.test(t)))}function cn(e,t){let n=H(e,cn,this),r=G(n);if(![`SELECT`,`INPUT`,`TEXTAREA`].includes(r))throw Error(`.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.`);if(K(n)&&[`radio`,`checkbox`].includes(n.type))throw Error(`.toHaveDisplayValue() currently does not support input[type="${n.type}"], try with another matcher instead.`);let i=ln(r,n),a=un(t),o=a.filter(e=>i.some(t=>e instanceof RegExp?e.test(t):this.equals(t,String(e),this.customTesters))).length,s=o===i.length,c=o===a.length;return{pass:s&&c,message:()=>U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDisplayValue`,`element`,``),`Expected element ${this.isNot?`not `:``}to have display value`,t,`Received`,i)}}function ln(e,t){return e===`SELECT`?Array.from(t).filter(e=>e.selected).map(e=>e.textContent||``):[t.value]}function un(e){return Array.isArray(e)?e:[e]}function dn(e){let t=H(e,dn,this);return{pass:t.ownerDocument.activeElement===t,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveFocus`,`element`,``),``,...this.isNot?[`Received element is focused:`,` ${this.utils.printReceived(t)}`]:[`Expected element with focus:`,` ${this.utils.printExpected(t)}`,`Received element with focus:`,` ${this.utils.printReceived(t.ownerDocument.activeElement)}`]].join(`
28
+ `)}}function fn(e,t){let n=H(e,fn,this),r=n.ownerDocument.defaultView||window;if(!(n instanceof r.HTMLFieldSetElement)&&!(n instanceof r.HTMLFormElement))throw TypeError(`toHaveFormValues must be called on a form or a fieldset, instead got ${G(n)}`);if(!t||typeof t!=`object`)throw TypeError(`toHaveFormValues must be called with an object of expected form values. Got ${t}`);let i=gn(n);return{pass:Object.entries(t).every(([e,t])=>this.equals(i[e],t,[q,...this.customTesters])),message:()=>{let e=this.isNot?`not to`:`to`,n=`${this.isNot?`.not`:``}.toHaveFormValues`,r={};for(let e in i)Object.hasOwn(t,e)&&(r[e]=i[e]);return[this.utils.matcherHint(n,`element`,``),`Expected the element ${e} have form values`,this.utils.diff(t,r)].join(`
29
29
 
30
- `)}}}function dn(e){let t=``;for(let n of e){if(t&&t!==n.type)throw Error(`Multiple form elements with the same name must be of the same type`);t=n.type}switch(t){case`radio`:{let t=e.find(e=>e.checked);return t?t.value:void 0}case`checkbox`:return e.filter(e=>e.checked).map(e=>e.value);default:return e.map(e=>e.value)}}function fn(e,t){let n=[...e.querySelectorAll(`[name="${pe(t)}"]`)];if(n.length!==0)switch(n.length){case 1:return pt(n[0]);default:return dn(n)}}function pn(e){return/\[\]$/.test(e)?e.slice(0,-2):e}function mn(e){let t={};for(let n of e.elements){if(!(`name`in n))continue;let r=n.name;t[pn(r)]=fn(e,r)}return t}function hn(e,t){let n=H(e,hn,this);a();let r=c(n);return o(),{pass:r===t,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveRole`,`element`,``),`Expected element ${e} have role`,t,`Received`,r)}}}function gn(e,t){let n=H(e,gn,this),r=t!==void 0;if(r&&typeof t!=`string`)throw Error(`expected selection must be a string or undefined`);let i=_n(n);return{pass:r?this.equals(i,t,[q,...this.customTesters]):!!i,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveSelection`,`element`,t);return U(this,n,`Expected the element ${e} have selection`,r?t:`(any)`,`Received`,i)}}}function _n(e){let t=e.ownerDocument.getSelection();if(!t)return``;if([`INPUT`,`TEXTAREA`].includes(G(e))){let t=e;return[`radio`,`checkbox`].includes(t.type)||t.selectionStart==null||t.selectionEnd==null?``:t.value.toString().substring(t.selectionStart,t.selectionEnd)}if(t.anchorNode===null||t.focusNode===null)return``;let n=t.getRangeAt(0),r=e.ownerDocument.createRange();if(t.containsNode(e,!1))r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r);else if(!(e.contains(t.anchorNode)&&e.contains(t.focusNode))){let i=e===n.startContainer||e.contains(n.startContainer),a=e===n.endContainer||e.contains(n.endContainer);t.removeAllRanges(),(i||a)&&(r.selectNodeContents(e),i&&r.setStart(n.startContainer,n.startOffset),a&&r.setEnd(n.endContainer,n.endOffset),t.addRange(r))}let i=t.toString();return t.removeAllRanges(),t.addRange(n),i}const Q=ye.config.browser.name,$=new Set(`backgroundPosition.background-position.bottom.left.right.top.height.width.margin-bottom.marginBottom.margin-left.marginLeft.margin-right.marginRight.margin-top.marginTop.min-height.minHeight.min-width.minWidth.padding-bottom.padding-left.padding-right.padding-top.text-indent.paddingBottom.paddingLeft.paddingRight.paddingTop.textIndent`.split(`.`));function vn(e,t){let n=H(e,vn,this),{getComputedStyle:r}=n.ownerDocument.defaultView,i=typeof t==`object`?yn(t):bn(t),a=r(n),o=new Set(Array.from(n.style));return{pass:Sn(i,n,a,o),message:()=>{let e=`${this.isNot?`.not`:``}.toHaveStyle`,t=new Set(Object.keys(i)),r=xn(Array.from(a).filter(e=>t.has(e)).reduce((e,t)=>(e[t]=(o.has(t)&&$.has(t)?n.style:a)[t],e),{})),s=r===``?`Expected styles could not be parsed by the browser. Did you make a typo?`:this.utils.diff(xn(i),r);return[this.utils.matcherHint(e,`element`,``),s].join(`
30
+ `)}}}function pn(e){let t=``;for(let n of e){if(t&&t!==n.type)throw Error(`Multiple form elements with the same name must be of the same type`);t=n.type}switch(t){case`radio`:{let t=e.find(e=>e.checked);return t?t.value:void 0}case`checkbox`:return e.filter(e=>e.checked).map(e=>e.value);default:return e.map(e=>e.value)}}function mn(e,t){let n=[...e.querySelectorAll(`[name="${me(t)}"]`)];if(n.length!==0)switch(n.length){case 1:return mt(n[0]);default:return pn(n)}}function hn(e){return/\[\]$/.test(e)?e.slice(0,-2):e}function gn(e){let t={};for(let n of e.elements){if(!(`name`in n))continue;let r=n.name;t[hn(r)]=mn(e,r)}return t}function _n(e,t){let n=H(e,_n,this);a();let r=c(n);return o(),{pass:r===t,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveRole`,`element`,``),`Expected element ${e} have role`,t,`Received`,r)}}}function vn(e,t){let n=H(e,vn,this),r=t!==void 0;if(r&&typeof t!=`string`)throw Error(`expected selection must be a string or undefined`);let i=yn(n);return{pass:r?this.equals(i,t,[q,...this.customTesters]):!!i,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveSelection`,`element`,t);return U(this,n,`Expected the element ${e} have selection`,r?t:`(any)`,`Received`,i)}}}function yn(e){let t=e.ownerDocument.getSelection();if(!t)return``;if([`INPUT`,`TEXTAREA`].includes(G(e))){let t=e;return[`radio`,`checkbox`].includes(t.type)||t.selectionStart==null||t.selectionEnd==null?``:t.value.toString().substring(t.selectionStart,t.selectionEnd)}if(t.anchorNode===null||t.focusNode===null)return``;let n=t.getRangeAt(0),r=e.ownerDocument.createRange();if(t.containsNode(e,!1))r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r);else if(!(e.contains(t.anchorNode)&&e.contains(t.focusNode))){let i=e===n.startContainer||e.contains(n.startContainer),a=e===n.endContainer||e.contains(n.endContainer);t.removeAllRanges(),(i||a)&&(r.selectNodeContents(e),i&&r.setStart(n.startContainer,n.startOffset),a&&r.setEnd(n.endContainer,n.endOffset),t.addRange(r))}let i=t.toString();return t.removeAllRanges(),t.addRange(n),i}const Z=xe.config.browser.name,Q=new Set(`backgroundPosition.background-position.bottom.left.right.top.height.width.margin-bottom.marginBottom.margin-left.marginLeft.margin-right.marginRight.margin-top.marginTop.min-height.minHeight.min-width.minWidth.padding-bottom.padding-left.padding-right.padding-top.text-indent.paddingBottom.paddingLeft.paddingRight.paddingTop.textIndent`.split(`.`));function bn(e,t){let n=H(e,bn,this),{getComputedStyle:r}=n.ownerDocument.defaultView,i=typeof t==`object`?xn(t):Sn(t),a=r(n),o=new Set(Array.from(n.style));return{pass:wn(i,n,a,o),message:()=>{let e=`${this.isNot?`.not`:``}.toHaveStyle`,t=new Set(Object.keys(i)),r=Cn(Array.from(a).filter(e=>t.has(e)).reduce((e,t)=>(e[t]=(o.has(t)&&Q.has(t)?n.style:a)[t],e),{})),s=r===``?`Expected styles could not be parsed by the browser. Did you make a typo?`:this.utils.diff(Cn(i),r);return[this.utils.matcherHint(e,`element`,``),s].join(`
31
31
 
32
- `)}}}function yn(e){let t=Q===`chrome`||Q===`chromium`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);t.body.appendChild(n);let r=Object.keys(e);r.forEach(t=>{n.style[t]=e[t]});let i={},a=window.getComputedStyle(n);return r.forEach(e=>{let t=($.has(e)?n.style:a)[e];t!=null&&(i[e]=t)}),n.remove(),i}function bn(e){let t=Q===`chrome`||Q===`chromium`||Q===`webkit`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);n.setAttribute(`style`,e.replace(/\n/g,``)),t.body.appendChild(n);let r=window.getComputedStyle(n),i=Array.from(n.style).reduce((e,t)=>(e[t]=$.has(t)?n.style.getPropertyValue(t):r.getPropertyValue(t),e),{});return n.remove(),i}function xn(e){return Object.keys(e).sort().map(t=>`${t}: ${e[t]};`).join(`
33
- `)}function Sn(e,t,n,r){let i=Object.keys(e);return i.length?i.every(i=>{let a=e[i],o=i.startsWith(`--`),s=[i];return o||s.push(i.toLowerCase()),s.some(e=>{let o=r.has(i)&&$.has(i)?t.style:n;return o[e]===a||o.getPropertyValue(e)===a})}):!1}function Cn(e,t,n={normalizeWhitespace:!0}){let r=it(e,Cn,this),i=n.normalizeWhitespace?vt(r.textContent||``):(r.textContent||``).replace(/\u00A0/g,` `),a=i!==``&&t===``;return{pass:!a&&yt(i,t),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveTextContent`,`element`,``),a?`Checking with empty string will always match, use .toBeEmptyDOMElement() instead`:`Expected element ${e} have text content`,t,`Received`,i)}}}function wn(e,t){let n=H(e,wn,this);if(K(n)&&[`checkbox`,`radio`].includes(n.type))throw Error(`input with type=checkbox or type=radio cannot be used with .toHaveValue(). Use .toBeChecked() for type=checkbox or .toHaveFormValues() instead`);let r=pt(n),i=t!==void 0,a=t,o=r;return t==r&&t!==r&&(a=`${t} (${typeof t})`,o=`${r} (${typeof r})`),{pass:i?this.equals(r,t,[q,...this.customTesters]):!!r,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveValue`,`element`,t);return U(this,n,`Expected the element ${e} have value`,i?a:`(any)`,`Received`,o)}}}const Tn=new Map([]);async function En(e,n,r=typeof n==`object`?n:{}){if(this.isNot)throw Error(`'toMatchScreenshot' cannot be used with "not"`);if(this.task===void 0||this.currentTestName===void 0)throw Error(`'toMatchScreenshot' cannot be used without test context`);let i=`${this.task.result?.repeatCount??0}${this.testPath}${this.currentTestName}`,a=Tn.get(i);a===void 0&&(a={current:0},Tn.set(i,a)),a.current+=1;let o=typeof n==`string`?n:`${this.currentTestName} ${a.current}`,[s,...c]=await Promise.all([me(e,r),...r.screenshotOptions&&`mask`in r.screenshotOptions?r.screenshotOptions.mask.map(e=>me(e,r)):[]]),l=r.screenshotOptions&&`mask`in r.screenshotOptions?{...r,screenshotOptions:{...r.screenshotOptions,mask:c}}:r,u=await g().commands.triggerCommand(`__vitest_screenshotMatcher`,[o,this.currentTestName,{element:s,...l}]);if(u.pass===!1){let e=[];u.reference&&e.push({name:`reference`,...u.reference}),u.actual&&e.push({name:`actual`,...u.actual}),u.diff&&e.push({name:`diff`,...u.diff}),e.length>0&&await t(this.task,{type:`internal:toMatchScreenshot`,kind:`visual-regression`,message:u.message,attachments:e})}return{pass:u.pass,message:()=>u.pass?``:[this.utils.matcherHint(`toMatchScreenshot`,`element`,``),``,u.message,u.reference?`\nReference screenshot:\n ${this.utils.EXPECTED_COLOR(u.reference.path)}`:null,u.actual?`\nActual screenshot:\n ${this.utils.RECEIVED_COLOR(u.actual.path)}`:null,u.diff?this.utils.DIM_COLOR(`\nDiff image:\n ${u.diff.path}`):null,``].filter(e=>e!==null).join(`
34
- `),meta:{outcome:u.outcome}}}const Dn={toBeDisabled:Tt,toBeEnabled:Et,toBeEmptyDOMElement:Ct,toBeInTheDocument:Ot,toBeInViewport:Pt,toBeInvalid:J,toBeRequired:Gt,toBeValid:Nt,toBeVisible:Kt,toContainElement:Y,toContainHTML:Xt,toHaveAccessibleDescription:Zt,toHaveAccessibleErrorMessage:Qt,toHaveAccessibleName:X,toHaveAttribute:$t,toHaveClass:nn,toHaveFocus:un,toHaveFormValues:Z,toHaveStyle:vn,toHaveTextContent:Cn,toHaveValue:wn,toHaveDisplayValue:sn,toBeChecked:xt,toBePartiallyChecked:It,toHaveRole:hn,toHaveSelection:gn,toMatchScreenshot:En},On=Symbol.for(`$$vitest:locator`);function kn(e,t){if(e!=null&&!(e instanceof HTMLElement)&&!(e instanceof SVGElement)&&!(On in e))throw Error(`Invalid element or locator: ${e}. Expected an instance of HTMLElement, SVGElement or Locator, received ${i(e)}`);let a=n.poll(function(){if(e instanceof Element||e==null)return e;let t=r.util.flag(this,`negate`),n=r.util.flag(this,`_name`);if(t&&n===`toBeInTheDocument`)return e.query();if(n===`toHaveLength`)return e.elements();if(n===`toMatchScreenshot`&&!r.util.flag(this,`_poll.assert_once`)&&r.util.flag(this,`_poll.assert_once`,!0),r.util.flag(this,`_isLastPollAttempt`))return e.element();let i=e.query();if(!i)throw Error(`Cannot find element with locator: ${JSON.stringify(e)}`);return i},he(t));r.util.flag(a,`_poll.element`,!0);let o=ge().current,s=!!o&&g().activeTraceTaskIds.has(o.id),c=!!o&&g().browserTraceAttempts.has(o.id);if(o&&(s||c)){let t=Error(`__vitest_mark_trace__`),n=_e();r.util.flag(a,`_poll.onSettled`,async i=>{let a=r.util.flag(i.assertion,`negate`),l=r.util.flag(i.assertion,`_name`)||`<unknown>`,u=`${a?`not.`:``}${l}`,d=i.status===`fail`?`${u} [ERROR]`:u,f=!e||e instanceof Element?void 0:e.serialize();c&&ve(o,{name:d,kind:`expect`,status:i.status,startTime:n,duration:_e()-n,element:f,stack:t.stack}),s&&await g().commands.triggerCommand(`__vitest_markTrace`,[{name:d,element:f,stack:t.stack}],t)})}return a}n.extend(Dn),n.extend(tt),n.element=kn;
32
+ `)}}}function xn(e){let t=Z===`chrome`||Z===`chromium`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);t.body.appendChild(n);let r=Object.keys(e);r.forEach(t=>{n.style[t]=e[t]});let i={},a=window.getComputedStyle(n);return r.forEach(e=>{let t=(Q.has(e)?n.style:a)[e];t!=null&&(i[e]=t)}),n.remove(),i}function Sn(e){let t=Z===`chrome`||Z===`chromium`||Z===`webkit`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);n.setAttribute(`style`,e.replace(/\n/g,``)),t.body.appendChild(n);let r=window.getComputedStyle(n),i=Array.from(n.style).reduce((e,t)=>(e[t]=Q.has(t)?n.style.getPropertyValue(t):r.getPropertyValue(t),e),{});return n.remove(),i}function Cn(e){return Object.keys(e).sort().map(t=>`${t}: ${e[t]};`).join(`
33
+ `)}function wn(e,t,n,r){let i=Object.keys(e);return i.length?i.every(i=>{let a=e[i],o=i.startsWith(`--`),s=[i];return o||s.push(i.toLowerCase()),s.some(e=>{let o=r.has(i)&&Q.has(i)?t.style:n;return o[e]===a||o.getPropertyValue(e)===a})}):!1}function Tn(e,t,n={normalizeWhitespace:!0}){let r=at(e,Tn,this),i=n.normalizeWhitespace?yt(r.textContent||``):(r.textContent||``).replace(/\u00A0/g,` `),a=i!==``&&t===``;return{pass:!a&&bt(i,t),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveTextContent`,`element`,``),a?`Checking with empty string will always match, use .toBeEmptyDOMElement() instead`:`Expected element ${e} have text content`,t,`Received`,i)}}}function En(e,t){let n=H(e,En,this);if(K(n)&&[`checkbox`,`radio`].includes(n.type))throw Error(`input with type=checkbox or type=radio cannot be used with .toHaveValue(). Use .toBeChecked() for type=checkbox or .toHaveFormValues() instead`);let r=mt(n),i=t!==void 0,a=t,o=r;return t==r&&t!==r&&(a=`${t} (${typeof t})`,o=`${r} (${typeof r})`),{pass:i?this.equals(r,t,[q,...this.customTesters]):!!r,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveValue`,`element`,t);return U(this,n,`Expected the element ${e} have value`,i?a:`(any)`,`Received`,o)}}}const $=new Map([]);async function Dn(e,n,r=typeof n==`object`?n:{}){if(this.isNot)throw Error(`'toMatchScreenshot' cannot be used with "not"`);if(this.task===void 0||this.currentTestName===void 0)throw Error(`'toMatchScreenshot' cannot be used without test context`);let i=`${this.task.result?.repeatCount??0}${this.testPath}${this.currentTestName}`,a=$.get(i);a===void 0&&(a={current:0},$.set(i,a)),a.current+=1;let o=typeof n==`string`?n:`${this.currentTestName} ${a.current}`,s=On(e),[c,...l]=await Promise.all([s?void 0:he(e,r),...r.screenshotOptions&&`mask`in r.screenshotOptions?r.screenshotOptions.mask.map(e=>he(e,r)):[]]),u=r.screenshotOptions&&`mask`in r.screenshotOptions?{...r,screenshotOptions:{...r.screenshotOptions,mask:l}}:r,d=await h().commands.triggerCommand(`__vitest_screenshotMatcher`,[o,this.currentTestName,{element:c,target:s?`page`:`element`,...u}]);if(d.pass===!1){let e=[];d.reference&&e.push({name:`reference`,...d.reference}),d.actual&&e.push({name:`actual`,...d.actual}),d.diff&&e.push({name:`diff`,...d.diff}),e.length>0&&await t(this.task,{type:`internal:toMatchScreenshot`,kind:`visual-regression`,message:d.message,attachments:e})}return{pass:d.pass,message:()=>d.pass?``:[this.utils.matcherHint(`toMatchScreenshot`,s?`page`:`element`,``),``,d.message,d.reference?`\nReference screenshot:\n ${this.utils.EXPECTED_COLOR(d.reference.path)}`:null,d.actual?`\nActual screenshot:\n ${this.utils.RECEIVED_COLOR(d.actual.path)}`:null,d.diff?this.utils.DIM_COLOR(`\nDiff image:\n ${d.diff.path}`):null,``].filter(e=>e!==null).join(`
34
+ `),meta:{outcome:d.outcome}}}function On(e){return!!e&&typeof e==`object`&&`viewport`in e&&typeof e.viewport==`function`}const kn={toBeDisabled:Et,toBeEnabled:Dt,toBeEmptyDOMElement:wt,toBeInTheDocument:kt,toBeInViewport:Ft,toBeInvalid:J,toBeRequired:Kt,toBeValid:Pt,toBeVisible:qt,toContainElement:Y,toContainHTML:Zt,toHaveAccessibleDescription:Qt,toHaveAccessibleErrorMessage:$t,toHaveAccessibleName:X,toHaveAttribute:en,toHaveClass:rn,toHaveFocus:dn,toHaveFormValues:fn,toHaveStyle:bn,toHaveTextContent:Tn,toHaveValue:En,toHaveDisplayValue:cn,toBeChecked:St,toBePartiallyChecked:Lt,toHaveRole:_n,toHaveSelection:vn,toMatchScreenshot:Dn},An=Symbol.for(`$$vitest:locator`);function jn(e,t){if(e!=null&&!(e instanceof HTMLElement)&&!(e instanceof SVGElement)&&!(An in e))throw Error(`Invalid element or locator: ${e}. Expected an instance of HTMLElement, SVGElement or Locator, received ${i(e)}`);let a=ge(t),o=a?.timeout?_e()+a.timeout:void 0,s=n.poll(async function(){if(e instanceof Element||e==null)return e;let t=r.util.flag(this,`negate`),n=r.util.flag(this,`_name`);return t&&n===`toBeInTheDocument`?e.query():n===`toHaveLength`?e.elements():e.findElement({...a,timeout:o?Math.max(o-_e(),0):void 0})},a);r.util.flag(s,`_poll.element`,!0);let c=ve().current,l=!!c&&h().activeTraceTaskIds.has(c.id),u=!!c&&h().browserTraceAttempts.has(c.id);if(c&&(l||u)){let t=Error(`__vitest_mark_trace__`),n=u?ye():void 0,i=()=>!e||e instanceof Element?void 0:e.serialize(),a=(e,t)=>{let n=r.util.flag(e,`negate`),i=r.util.flag(e,`_name`)||`<unknown>`,a=`${n?`not.`:``}${i}`;return t===`fail`?`${a} [ERROR]`:a};r.util.flag(s,`_poll.onStart`,async e=>{u&&await be(c,{name:a(e.assertion),kind:`expect`,range:{id:n,phase:`start`},element:i(),stack:t.stack})}),r.util.flag(s,`_poll.onSettled`,async e=>{let r=a(e.assertion,e.status);u&&await be(c,{name:r,kind:`expect`,range:{id:n,phase:`end`},status:e.status,element:i(),stack:t.stack}),l&&await h().commands.triggerCommand(`__vitest_markTrace`,[{name:r,element:i(),stack:t.stack}],t)})}return s}n.extend(kn),n.extend(nt),n.element=jn;