@ctrl/dom 0.3.1 → 0.3.2
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.
- package/dist/aria/_chunks/roles-list-CtWrIYOt.cjs +4 -0
- package/dist/aria/_chunks/roles-list-D5_w80vQ.js +4 -0
- package/dist/aria/index.cjs +1 -1
- package/dist/aria/index.js +1 -1
- package/dist/aria/internal.cjs +1 -1
- package/dist/aria/internal.js +1 -1
- package/dist/bridge/internal.js +1 -1
- package/dist/dom/_chunks/{src-BTj3c0xg.js → src-CImID776.js} +14 -14
- package/dist/dom/index.js +1 -1
- package/dist/dom/internal.js +1 -1
- package/dist/dom/types/css/cascade.d.ts +10 -0
- package/dist/dom/types/css/properties.d.ts +2 -0
- package/dist/dom/types/css/values.d.ts +8 -2
- package/dist/dom/types/events/Event.d.ts +2 -0
- package/dist/dom/types/nodes/Document.d.ts +1 -1
- package/dist/dom/types/nodes/constants.d.ts +10 -0
- package/dist/dom/types/traversal/live.d.ts +7 -0
- package/dist/jest-dom/_chunks/{matchers-CwGF61j-.js → matchers-DGsBvtWC.js} +13 -13
- package/dist/jest-dom/_chunks/{matchers-CZ6Smfw9.cjs → matchers-DJmRgUYG.cjs} +7 -7
- package/dist/jest-dom/index.cjs +1 -1
- package/dist/jest-dom/index.js +1 -1
- package/dist/jest-dom/jest-globals.cjs +1 -1
- package/dist/jest-dom/jest-globals.js +1 -1
- package/dist/jest-dom/matchers.cjs +1 -1
- package/dist/jest-dom/matchers.js +1 -1
- package/dist/jest-dom/vitest.cjs +1 -1
- package/dist/jest-dom/vitest.js +1 -1
- package/dist/testing-library/_chunks/{aria-snapshot-diff-BXYf4D_D.cjs → aria-snapshot-diff-B95LLutl.cjs} +8 -6
- package/dist/testing-library/_chunks/aria-snapshot-diff-BSXxnyqJ.js +16 -0
- package/dist/testing-library/agent.cjs +1 -1
- package/dist/testing-library/agent.js +1 -1
- package/dist/testing-library/index.cjs +8 -8
- package/dist/testing-library/index.js +9 -9
- package/dist/user-event/index.cjs +10 -10
- package/dist/user-event/index.js +10 -10
- package/package.json +1 -1
- package/dist/aria/_chunks/roles-list-C57tqF4n.cjs +0 -4
- package/dist/aria/_chunks/roles-list-DEwbBc_c.js +0 -4
- package/dist/testing-library/_chunks/aria-snapshot-diff-DejA3Rdn.js +0 -14
|
@@ -15,17 +15,17 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0}),
|
|
|
15
15
|
`)}}function toAppearBefore(e,t){return checkToAppear(this,`toAppearBefore`,4,e,t)}function toAppearAfter(e,t){return checkToAppear(this,`toAppearAfter`,2,e,t)}function toHaveTextContent(e,t,n={normalizeWhitespace:!0}){checkNode(e,toHaveTextContent,this);let r=n.normalizeWhitespace?normalize(e.textContent):e.textContent.replace(/ /g,` `),i=r!==``&&t===``;return{pass:!i&&matches(r,t),message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveTextContent`,`element`,``),i?`Checking with empty string will always match, use .toBeEmptyDOMElement() instead`:`Expected element ${e} have text content`,t,`Received`,r)}}}function printAttribute(e,t,n){return n===void 0?t:`${t}=${e(n)}`}function getAttributeComment(e,t,n){return n===void 0?`element.hasAttribute(${e(t)})`:`element.getAttribute(${e(t)}) === ${e(n)}`}function toHaveAttribute(e,t,n){checkHtmlElement(e,toHaveAttribute,this);let r=n!==void 0,i=e.hasAttribute(t),a=e.getAttribute(t);return{pass:r?i&&this.equals(a,n):i,message:()=>{let e=this.isNot?`not to`:`to`,o=i?printAttribute(this.utils.stringify,t,a):null,s=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAttribute`,`element`,this.utils.printExpected(t),{secondArgument:r?this.utils.printExpected(n):void 0,comment:getAttributeComment(this.utils.stringify,t,n)});return getMessage(this,s,`Expected the element ${e} have attribute`,printAttribute(this.utils.stringify,t,n),`Received`,o)}}}function getExpectedClassNamesAndOptions(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 splitClassNames(e){return e?e.split(/\s+/).filter(e=>e.length>0):[]}function isSubset$1(e,t){return e.every(e=>typeof e==`string`?t.includes(e):t.some(t=>e.test(t)))}__name(isSubset$1,`isSubset`);function toHaveClass(e,...t){checkHtmlElement(e,toHaveClass,this);let{expectedClassNames:n,options:r}=getExpectedClassNamesAndOptions(t),i=splitClassNames(e.getAttribute(`class`)),a=n.reduce((e,t)=>e.concat(typeof t==`string`||!t?splitClassNames(t):t),[]),o=a.some(e=>e instanceof RegExp);if(r.exact&&o)throw Error(`Exact option does not support RegExp expected class names`);return r.exact?{pass:isSubset$1(a,i)&&a.length===i.length,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(a.join(` `))),`Expected the element ${e} have EXACTLY defined classes`,a.join(` `),`Received`,i.join(` `))}}:a.length>0?{pass:isSubset$1(a,i),message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(a.join(` `))),`Expected the element ${e} have class`,a.join(` `),`Received`,i.join(` `))}}:{pass:this.isNot?i.length>0:!1,message:()=>this.isNot?getMessage(this,this.utils.matcherHint(`.not.toHaveClass`,`element`,``),`Expected the element to have classes`,`(none)`,`Received`,i.join(` `)):[this.utils.matcherHint(`.toHaveClass`,`element`),`At least one expected class must be provided.`].join(`
|
|
16
16
|
`)}}function toHaveValue(e,t){if(checkHtmlElement(e,toHaveValue,this),e.tagName.toLowerCase()===`input`&&[`checkbox`,`radio`].includes(e.type))throw Error(`input with type=checkbox or type=radio cannot be used with .toHaveValue(). Use .toBeChecked() for type=checkbox or .toHaveFormValues() instead`);let n=getSingleElementValue(e),r=t!==void 0,i=t,a=n;return t==n&&t!==n&&(i=`${t} (${typeof t})`,a=`${n} (${typeof n})`),{pass:r?compareAsSet(n,t):!!n,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveValue`,`element`,t);return getMessage(this,n,`Expected the element ${e} have value`,r?i:`(any)`,`Received`,a)}}}function getValues(e,t){if(e!==`select`)return[t.value];let n=[],r=t.options;for(let e=0;e<r.length;e++){let t=r[e];t.selected&&n.push(t.textContent)}return n}function toHaveDisplayValue(e,t){checkHtmlElement(e,toHaveDisplayValue,this);let n=e.tagName.toLowerCase();if(![`select`,`input`,`textarea`].includes(n))throw Error(`.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.`);if(n===`input`&&[`radio`,`checkbox`].includes(e.type))throw Error(`.toHaveDisplayValue() currently does not support input[type="${e.type}"], try with another matcher instead.`);let r=getValues(n,e),i=t instanceof Array?t:[t],a=i.filter(e=>r.some(t=>e instanceof RegExp?e.test(t):this.equals(t,String(e)))).length,o=a===r.length,s=a===i.length;return{pass:o&&s,message:()=>getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDisplayValue`,`element`,``),`Expected element ${this.isNot?`not `:``}to have display value`,t,`Received`,r)}}function getMultiElementValue(e){let t=[...new Set(e.map(e=>e.type))];if(t.length!==1)throw Error(`Multiple form elements with the same name must be of the same type`);switch(t[0]){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 getFormValue(e){if(e!==void 0)switch(e.length){case 1:return getSingleElementValue(e[0]);default:return getMultiElementValue(e)}}function getPureName(e){return e.endsWith(`[]`)?e.slice(0,-2):e}function getAllFormValues(e){let t=/* @__PURE__ */ new Map;for(let n of e.querySelectorAll(`[name]`)){let e=n.getAttribute(`name`),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}let n={};for(let r of Array.from(e.elements)){let e=r.name;n[getPureName(e)]=getFormValue(t.get(e))}return n}function toHaveFormValues(e,t){if(checkHtmlElement(e,toHaveFormValues,this),!e.elements)throw Error(`toHaveFormValues must be called on a form or a fieldset`);let n=getAllFormValues(e);return{pass:Object.entries(t).every(([e,t])=>compareAsSet(n[e],t)),message:()=>{let e=this.isNot?`not to`:`to`,r=`${this.isNot?`.not`:``}.toHaveFormValues`,i={};for(let e of Object.keys(n))Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=n[e]);return[this.utils.matcherHint(r,`element`,``),`Expected the element ${e} have form values`,this.utils.diff(t,i)].join(`
|
|
17
17
|
|
|
18
|
-
`)}}}function getSelection(e){let t=e.ownerDocument.getSelection();if([`input`,`textarea`].includes(e.tagName.toLowerCase()))return[`radio`,`checkbox`].includes(e.type)?``:e.value.toString().substring(e.selectionStart,e.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}function toHaveSelection(e,t){checkHtmlElement(e,toHaveSelection,this);let n=t!==void 0;if(n&&typeof t!=`string`)throw Error(`expected selection must be a string or undefined`);let r=getSelection(e);return{pass:n?compareAsSet(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`,i=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveSelection`,`element`,t);return getMessage(this,i,`Expected the element ${e} have selection`,n?t:`(any)`,`Received`,r)}}}let g=null;function foreign(){return g??=(0,n.createRequire)(require("url").pathToFileURL(__filename).href)(`dom-accessibility-api`)}function computeAccessibleName(e){return e[i.$impl]===void 0?foreign().computeAccessibleName(e):r.daa06.computeAccessibleName(e)}function computeAccessibleDescription(e){return e[i.$impl]===void 0?foreign().computeAccessibleDescription(e):r.daa06.computeAccessibleDescription(e)}const _=[[`input`,[[`list`,`+`],[`type`,`=email`]],!1,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=search`]],!1,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=tel`]],!1,[`combobox`]],[`input`,[[`list`,`+`]],!0,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=url`]],!1,[`combobox`]],[`select`,[[`multiple`,`-`],[`size`,`-`]],!1,[`combobox`]],[`input`,[[`list`,`-`],[`type`,`=search`]],!1,[`searchbox`]],[`input`,[[`type`,`-`],[`list`,`-`]],!1,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=email`]],!1,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=tel`]],!1,[`textbox`]],[`input`,[[`list`,`-`]],!0,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=url`]],!1,[`textbox`]],[`input`,[[`type`,`=button`]],!1,[`button`]],[`input`,[[`type`,`=image`]],!1,[`button`]],[`input`,[[`type`,`=reset`]],!1,[`button`]],[`input`,[[`type`,`=submit`]],!1,[`button`]],[`input`,[[`type`,`=checkbox`]],!1,[`checkbox`]],[`th`,[[`scope`,`=col`]],!1,[`columnheader`]],[`th`,[[`scope`,`=colgroup`]],!1,[`columnheader`]],[`aside`,[[`aria-label`,`+`]],!1,[`complementary`]],[`aside`,[[`aria-labelledby`,`+`]],!1,[`complementary`]],[`form`,[[`aria-label`,`+`]],!1,[`form`]],[`form`,[[`aria-labelledby`,`+`]],!1,[`form`]],[`form`,[[`name`,`+`]],!1,[`form`]],[`img`,[[`alt`,`+`]],!1,[`img`]],[`img`,[[`alt`,`-`]],!1,[`img`]],[`a`,[[`href`,`+`]],!1,[`link`]],[`area`,[[`href`,`+`]],!1,[`link`]],[`select`,[[`size`,`+`]],!1,[`listbox`]],[`select`,[[`multiple`,`+`]],!1,[`listbox`]],[`img`,[[`alt`,`+`]],!1,[`presentation`]],[`input`,[[`type`,`=radio`]],!1,[`radio`]],[`section`,[[`aria-label`,`+`]],!1,[`region`]],[`section`,[[`aria-labelledby`,`+`]],!1,[`region`]],[`th`,[[`scope`,`=row`]],!1,[`rowheader`]],[`th`,[[`scope`,`=rowgroup`]],!1,[`rowheader`]],[`input`,[[`type`,`=range`]],!1,[`slider`]],[`input`,[[`type`,`=number`]],!1,[`spinbutton`]],[`article`,[],!1,[`article`]],[`header`,[],!1,[`banner`]],[`blockquote`,[],!1,[`blockquote`]],[`button`,[],!1,[`button`]],[`caption`,[],!1,[`caption`]],[`td`,[],!1,[`cell`]],[`code`,[],!1,[`code`]],[`th`,[],!1,[`columnheader`]],[`aside`,[],!1,[`complementary`]],[`footer`,[],!1,[`contentinfo`]],[`dd`,[],!1,[`definition`]],[`del`,[],!1,[`deletion`]],[`dialog`,[],!1,[`dialog`]],[`html`,[],!1,[`document`]],[`em`,[],!1,[`emphasis`]],[`figure`,[],!1,[`figure`]],[`a`,[],!1,[`generic`]],[`area`,[],!1,[`generic`]],[`aside`,[],!1,[`generic`]],[`b`,[],!1,[`generic`]],[`bdo`,[],!1,[`generic`]],[`body`,[],!1,[`generic`]],[`data`,[],!1,[`generic`]],[`div`,[],!1,[`generic`]],[`footer`,[],!1,[`generic`]],[`header`,[],!1,[`generic`]],[`hgroup`,[],!1,[`generic`]],[`i`,[],!1,[`generic`]],[`pre`,[],!1,[`generic`]],[`q`,[],!1,[`generic`]],[`samp`,[],!1,[`generic`]],[`section`,[],!1,[`generic`]],[`small`,[],!1,[`generic`]],[`span`,[],!1,[`generic`]],[`u`,[],!1,[`generic`]],[`td`,[],!1,[`gridcell`]],[`details`,[],!1,[`group`]],[`fieldset`,[],!1,[`group`]],[`optgroup`,[],!1,[`group`]],[`address`,[],!1,[`group`]],[`h1`,[],!1,[`heading`]],[`h2`,[],!1,[`heading`]],[`h3`,[],!1,[`heading`]],[`h4`,[],!1,[`heading`]],[`h5`,[],!1,[`heading`]],[`h6`,[],!1,[`heading`]],[`ins`,[],!1,[`insertion`]],[`menu`,[],!1,[`list`]],[`ol`,[],!1,[`list`]],[`ul`,[],!1,[`list`]],[`datalist`,[],!1,[`listbox`]],[`li`,[],!1,[`listitem`]],[`main`,[],!1,[`main`]],[`mark`,[],!1,[`mark`]],[`math`,[],!1,[`math`]],[`meter`,[],!1,[`meter`]],[`nav`,[],!1,[`navigation`]],[`option`,[],!1,[`option`]],[`p`,[],!1,[`paragraph`]],[`progress`,[],!1,[`progressbar`]],[`tr`,[],!1,[`row`]],[`tbody`,[],!1,[`rowgroup`]],[`tfoot`,[],!1,[`rowgroup`]],[`thead`,[],!1,[`rowgroup`]],[`hr`,[],!1,[`separator`]],[`output`,[],!1,[`status`]],[`strong`,[],!1,[`strong`]],[`sub`,[],!1,[`subscript`]],[`sup`,[],!1,[`superscript`]],[`table`,[],!1,[`table`]],[`dfn`,[],!1,[`term`]],[`dt`,[],!1,[`term`]],[`textarea`,[],!1,[`textbox`]],[`time`,[],!1,[`time`]]];function valueEquals(e,t,n,r){return n===r||(t===`type`||t===`scope`)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`&&n.toLowerCase()===r}function getImplicitAriaRoles(e){let t=e.localName;for(let n=0;n<_.length;n++){let[r,i,a,o]=_[n];if(r!==t||a&&e.type!==`text`)continue;let s=!0;for(let t=0;t<i.length&&s;t++){let[n,r]=i[t],a=e.getAttribute(n);s=r===`-`?a===null:r===`+`?a!==null:a!==null&&valueEquals(e,n,a,r.slice(1))}if(s)return[...o]}return[]}function getExplicitOrImplicitRoles(e){let t=e.getAttribute(`role`);return t===null?e[i.$impl]===void 0?getImplicitAriaRoles(e):(0,r.getImplicitAriaRolesJestDom)(e):t.split(` `).filter(Boolean)}function toHaveRole(e,t){checkHtmlElement(e,toHaveRole,this);let n=getExplicitOrImplicitRoles(e);return{pass:n.some(e=>e===t),message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveRole.name}`,`element`,``),`Expected element ${e} have role`,t,`Received`,n.join(`, `))}}}function toHaveAccessibleName(e,t){checkHtmlElement(e,toHaveAccessibleName,this);let n=computeAccessibleName(e),r=arguments.length===1,i=!1;return i=r?n!==``:t instanceof RegExp?t.test(n):this.equals(n,t),{pass:i,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveAccessibleName.name}`,`element`,``),`Expected element ${e} have accessible name`,t,`Received`,n)}}}function toHaveAccessibleDescription(e,t){checkHtmlElement(e,toHaveAccessibleDescription,this);let n=computeAccessibleDescription(e),r=arguments.length===1,i=!1;return i=r?n!==``:t instanceof RegExp?t.test(n):this.equals(n,t),{pass:i,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveAccessibleDescription.name}`,`element`,``),`Expected element ${e} have accessible description`,t,`Received`,n)}}}const v=`aria-invalid`,y=[`false`];function toHaveAccessibleErrorMessage(e,t){checkHtmlElement(e,toHaveAccessibleErrorMessage,this);let n=this.isNot?`not to`:`to`,r=this.isNot?`.not.toHaveAccessibleErrorMessage`:`.toHaveAccessibleErrorMessage`,i=e.getAttribute(`aria-errormessage`);if(i&&/\s+/.test(i))return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(r,`element`),"Expected element's `aria-errormessage` attribute to be empty or a single, valid ID",``,`Received`,`aria-errormessage="${i}"`)};let a=e.getAttribute(v);if(!e.hasAttribute(v)||y.includes(a))return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(r,`element`),`Expected element to be marked as invalid with attribute`,`${v}="true"`,`Received`,e.hasAttribute(`aria-invalid`)?`${v}="${e.getAttribute(v)}`:null)};let o=normalize(e.ownerDocument.getElementById(i)?.textContent??``);return{pass:t===void 0?!!o:t instanceof RegExp?t.test(o):this.equals(o,t),message:()=>getMessage(this,this.utils.matcherHint(r,`element`),`Expected element ${n} have accessible error message`,t??``,`Received`,o)}}function textOfIdRefs(e,t){let n=(e.getAttribute(t)||``).split(/\s+/).filter(Boolean);if(n.length===0)return``;let r=e.ownerDocument;return normalize(n.map(e=>r.getElementById(e)).filter(Boolean).map(e=>e.textContent).join(` `))}function toHaveDescription(e,t){deprecate(`toHaveDescription`,`Please use toHaveAccessibleDescription.`),checkHtmlElement(e,toHaveDescription,this);let n=t!==void 0,r=textOfIdRefs(e,`aria-describedby`);return{pass:n?t instanceof RegExp?t.test(r):this.equals(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDescription`,`element`,``),`Expected the element ${e} have description`,this.utils.printExpected(t),`Received`,this.utils.printReceived(r))}}}function toHaveErrorMessage(e,t){if(deprecate(`toHaveErrorMessage`,`Please use toHaveAccessibleErrorMessage.`),checkHtmlElement(e,toHaveErrorMessage,this),!e.hasAttribute(`aria-invalid`)||e.getAttribute(`aria-invalid`)===`false`){let t=this.isNot?`.not`:``;return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(`${t}.toHaveErrorMessage`,`element`,``),`Expected the element to have invalid state indicated by`,`aria-invalid="true"`,`Received`,e.hasAttribute(`aria-invalid`)?`aria-invalid="${e.getAttribute(`aria-invalid`)}"`:this.utils.printReceived(``))}}let n=t!==void 0,r=textOfIdRefs(e,`aria-errormessage`);return{pass:n?t instanceof RegExp?t.test(r):this.equals(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveErrorMessage`,`element`,``),`Expected the element ${e} have error message`,this.utils.printExpected(t),`Received`,this.utils.printReceived(r))}}}const b={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},x=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/i;function channel(e,t){if(e.toLowerCase()===`none`)return 0;let n=x.exec(e);if(n===null)return null;let r=Number(n[1]);return n[2]===void 0?r:n[2]===`%`?r/100*t:null}function hue(e){let t=x.exec(e);if(t===null)return e.toLowerCase()===`none`?0:null;let n=Number(t[1]);switch(t[2]?.toLowerCase()){case void 0:case`deg`:return n;case`grad`:return n*360/400;case`rad`:return n*180/Math.PI;case`turn`:return n*360;default:return null}}function args(e){let t=e.trim();if(t.includes(`,`)){let e=t.split(`,`).map(e=>e.trim());return e.some(e=>e===``||/\s/.test(e))?null:e}let n=t.indexOf(`/`),r=(n===-1?t:t.slice(0,n)).trim().split(/\s+/);return n!==-1&&r.push(t.slice(n+1).trim()),r}const clamp=(e,t,n)=>Math.min(n,Math.max(t,e));function hslToRgb(e,t,n){e=(e%360+360)%360,t=clamp(t,0,1),n=clamp(n,0,1);let f=r=>{let i=(r+e/30)%12,a=t*Math.min(n,1-n);return(n-a*Math.max(-1,Math.min(i-3,9-i,1)))*255};return[f(0),f(8),f(4)]}function key(e,t,n,r){return`${Math.round(clamp(e,0,255))},${Math.round(clamp(t,0,255))},${Math.round(clamp(n,0,255))},${Math.round(clamp(r,0,1)*1e3)}`}function canonicalColor(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(t===``)return null;if(t===`transparent`)return key(0,0,0,0);if(t.charCodeAt(0)===35){let e=t.slice(1);if(!/^[0-9a-f]+$/.test(e))return null;let n=e.length,d=(t,n)=>parseInt(e.slice(t,t+n),16)*(n===1?17:1);return n===3||n===4?key(d(0,1),d(1,1),d(2,1),n===4?d(3,1)/255:1):n===6||n===8?key(d(0,2),d(2,2),d(4,2),n===8?d(6,2)/255:1):null}let n=t.indexOf(`(`);if(n===-1){let e=b[t];return e===void 0?null:key(e>>16,e>>8&255,e&255,1)}if(!t.endsWith(`)`))return null;let r=t.slice(0,n),i=args(t.slice(n+1,-1));if(i===null||i.length!==3&&i.length!==4)return null;let a=i.length===4?channel(i[3],1):1;if(a===null)return null;if(r===`rgb`||r===`rgba`){let e=channel(i[0],255),t=channel(i[1],255),n=channel(i[2],255);return e===null||t===null||n===null?null:key(e,t,n,a)}if(r===`hsl`||r===`hsla`){let e=hue(i[0]),t=channel(i[1],1),n=channel(i[2],1);if(e===null||t===null||n===null)return null;let[r,o,s]=hslToRgb(e,i[1].endsWith(`%`)?t:t/100,i[2].endsWith(`%`)?n:n/100);return key(r,o,s,a)}return null}function sameColor(e,t){let n=canonicalColor(e);return n!==null&&n===canonicalColor(t)}function isStyleVisible(e){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r,opacity:i}=t(e);return n!==`none`&&r!==`hidden`&&r!==`collapse`&&i!==`0`&&i!==0}function isAttributeVisible(e,t){let n;return n=t?e.nodeName===`DETAILS`&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0:e.nodeName!==`DETAILS`||e.hasAttribute(`open`),!e.hasAttribute(`hidden`)&&n}function isElementVisible(e,t){return isStyleVisible(e)&&isAttributeVisible(e,t)&&(!e.parentElement||isElementVisible(e.parentElement,e))}function toBeVisible(e){checkHtmlElement(e,toBeVisible,this);let t=e.ownerDocument===e.getRootNode({composed:!0}),n=t&&isElementVisible(e);return{pass:n,message:()=>{let r=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeVisible`,`element`,``),``,`Received element ${r} visible${t?``:` (element is not in the document)`}:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
19
|
-
`)}}}function getStyleDeclaration(e,t){let n={}
|
|
18
|
+
`)}}}function getSelection(e){let t=e.ownerDocument.getSelection();if([`input`,`textarea`].includes(e.tagName.toLowerCase()))return[`radio`,`checkbox`].includes(e.type)?``:e.value.toString().substring(e.selectionStart,e.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}function toHaveSelection(e,t){checkHtmlElement(e,toHaveSelection,this);let n=t!==void 0;if(n&&typeof t!=`string`)throw Error(`expected selection must be a string or undefined`);let r=getSelection(e);return{pass:n?compareAsSet(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`,i=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveSelection`,`element`,t);return getMessage(this,i,`Expected the element ${e} have selection`,n?t:`(any)`,`Received`,r)}}}let g=null;function foreign(){return g??=(0,n.createRequire)(require("url").pathToFileURL(__filename).href)(`dom-accessibility-api`)}function computeAccessibleName(e){return e[i.$impl]===void 0?foreign().computeAccessibleName(e):r.daa06.computeAccessibleName(e)}function computeAccessibleDescription(e){return e[i.$impl]===void 0?foreign().computeAccessibleDescription(e):r.daa06.computeAccessibleDescription(e)}const _=[[`input`,[[`list`,`+`],[`type`,`=email`]],!1,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=search`]],!1,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=tel`]],!1,[`combobox`]],[`input`,[[`list`,`+`]],!0,[`combobox`]],[`input`,[[`list`,`+`],[`type`,`=url`]],!1,[`combobox`]],[`select`,[[`multiple`,`-`],[`size`,`-`]],!1,[`combobox`]],[`input`,[[`list`,`-`],[`type`,`=search`]],!1,[`searchbox`]],[`input`,[[`type`,`-`],[`list`,`-`]],!1,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=email`]],!1,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=tel`]],!1,[`textbox`]],[`input`,[[`list`,`-`]],!0,[`textbox`]],[`input`,[[`list`,`-`],[`type`,`=url`]],!1,[`textbox`]],[`input`,[[`type`,`=button`]],!1,[`button`]],[`input`,[[`type`,`=image`]],!1,[`button`]],[`input`,[[`type`,`=reset`]],!1,[`button`]],[`input`,[[`type`,`=submit`]],!1,[`button`]],[`input`,[[`type`,`=checkbox`]],!1,[`checkbox`]],[`th`,[[`scope`,`=col`]],!1,[`columnheader`]],[`th`,[[`scope`,`=colgroup`]],!1,[`columnheader`]],[`aside`,[[`aria-label`,`+`]],!1,[`complementary`]],[`aside`,[[`aria-labelledby`,`+`]],!1,[`complementary`]],[`form`,[[`aria-label`,`+`]],!1,[`form`]],[`form`,[[`aria-labelledby`,`+`]],!1,[`form`]],[`form`,[[`name`,`+`]],!1,[`form`]],[`img`,[[`alt`,`+`]],!1,[`img`]],[`img`,[[`alt`,`-`]],!1,[`img`]],[`a`,[[`href`,`+`]],!1,[`link`]],[`area`,[[`href`,`+`]],!1,[`link`]],[`select`,[[`size`,`+`]],!1,[`listbox`]],[`select`,[[`multiple`,`+`]],!1,[`listbox`]],[`img`,[[`alt`,`+`]],!1,[`presentation`]],[`input`,[[`type`,`=radio`]],!1,[`radio`]],[`section`,[[`aria-label`,`+`]],!1,[`region`]],[`section`,[[`aria-labelledby`,`+`]],!1,[`region`]],[`th`,[[`scope`,`=row`]],!1,[`rowheader`]],[`th`,[[`scope`,`=rowgroup`]],!1,[`rowheader`]],[`input`,[[`type`,`=range`]],!1,[`slider`]],[`input`,[[`type`,`=number`]],!1,[`spinbutton`]],[`article`,[],!1,[`article`]],[`header`,[],!1,[`banner`]],[`blockquote`,[],!1,[`blockquote`]],[`button`,[],!1,[`button`]],[`caption`,[],!1,[`caption`]],[`td`,[],!1,[`cell`]],[`code`,[],!1,[`code`]],[`th`,[],!1,[`columnheader`]],[`aside`,[],!1,[`complementary`]],[`footer`,[],!1,[`contentinfo`]],[`dd`,[],!1,[`definition`]],[`del`,[],!1,[`deletion`]],[`dialog`,[],!1,[`dialog`]],[`html`,[],!1,[`document`]],[`em`,[],!1,[`emphasis`]],[`figure`,[],!1,[`figure`]],[`a`,[],!1,[`generic`]],[`area`,[],!1,[`generic`]],[`aside`,[],!1,[`generic`]],[`b`,[],!1,[`generic`]],[`bdo`,[],!1,[`generic`]],[`body`,[],!1,[`generic`]],[`data`,[],!1,[`generic`]],[`div`,[],!1,[`generic`]],[`footer`,[],!1,[`generic`]],[`header`,[],!1,[`generic`]],[`hgroup`,[],!1,[`generic`]],[`i`,[],!1,[`generic`]],[`pre`,[],!1,[`generic`]],[`q`,[],!1,[`generic`]],[`samp`,[],!1,[`generic`]],[`section`,[],!1,[`generic`]],[`small`,[],!1,[`generic`]],[`span`,[],!1,[`generic`]],[`u`,[],!1,[`generic`]],[`td`,[],!1,[`gridcell`]],[`details`,[],!1,[`group`]],[`fieldset`,[],!1,[`group`]],[`optgroup`,[],!1,[`group`]],[`address`,[],!1,[`group`]],[`h1`,[],!1,[`heading`]],[`h2`,[],!1,[`heading`]],[`h3`,[],!1,[`heading`]],[`h4`,[],!1,[`heading`]],[`h5`,[],!1,[`heading`]],[`h6`,[],!1,[`heading`]],[`ins`,[],!1,[`insertion`]],[`menu`,[],!1,[`list`]],[`ol`,[],!1,[`list`]],[`ul`,[],!1,[`list`]],[`datalist`,[],!1,[`listbox`]],[`li`,[],!1,[`listitem`]],[`main`,[],!1,[`main`]],[`mark`,[],!1,[`mark`]],[`math`,[],!1,[`math`]],[`meter`,[],!1,[`meter`]],[`nav`,[],!1,[`navigation`]],[`option`,[],!1,[`option`]],[`p`,[],!1,[`paragraph`]],[`progress`,[],!1,[`progressbar`]],[`tr`,[],!1,[`row`]],[`tbody`,[],!1,[`rowgroup`]],[`tfoot`,[],!1,[`rowgroup`]],[`thead`,[],!1,[`rowgroup`]],[`hr`,[],!1,[`separator`]],[`output`,[],!1,[`status`]],[`strong`,[],!1,[`strong`]],[`sub`,[],!1,[`subscript`]],[`sup`,[],!1,[`superscript`]],[`table`,[],!1,[`table`]],[`dfn`,[],!1,[`term`]],[`dt`,[],!1,[`term`]],[`textarea`,[],!1,[`textbox`]],[`time`,[],!1,[`time`]]];function valueEquals(e,t,n,r){return n===r||(t===`type`||t===`scope`)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`&&n.toLowerCase()===r}function getImplicitAriaRoles(e){let t=e.localName;for(let n=0;n<_.length;n++){let[r,i,a,o]=_[n];if(r!==t||a&&e.type!==`text`)continue;let s=!0;for(let t=0;t<i.length&&s;t++){let[n,r]=i[t],a=e.getAttribute(n);s=r===`-`?a===null:r===`+`?a!==null:a!==null&&valueEquals(e,n,a,r.slice(1))}if(s)return[...o]}return[]}function getExplicitOrImplicitRoles(e){let t=e.getAttribute(`role`);return t===null?e[i.$impl]===void 0?getImplicitAriaRoles(e):(0,r.getImplicitAriaRolesJestDom)(e):t.split(` `).filter(Boolean)}function toHaveRole(e,t){checkHtmlElement(e,toHaveRole,this);let n=getExplicitOrImplicitRoles(e);return{pass:n.some(e=>e===t),message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveRole.name}`,`element`,``),`Expected element ${e} have role`,t,`Received`,n.join(`, `))}}}function toHaveAccessibleName(e,t){checkHtmlElement(e,toHaveAccessibleName,this);let n=computeAccessibleName(e),r=arguments.length===1,i=!1;return i=r?n!==``:t instanceof RegExp?t.test(n):this.equals(n,t),{pass:i,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveAccessibleName.name}`,`element`,``),`Expected element ${e} have accessible name`,t,`Received`,n)}}}function toHaveAccessibleDescription(e,t){checkHtmlElement(e,toHaveAccessibleDescription,this);let n=computeAccessibleDescription(e),r=arguments.length===1,i=!1;return i=r?n!==``:t instanceof RegExp?t.test(n):this.equals(n,t),{pass:i,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${toHaveAccessibleDescription.name}`,`element`,``),`Expected element ${e} have accessible description`,t,`Received`,n)}}}const v=`aria-invalid`,y=[`false`];function toHaveAccessibleErrorMessage(e,t){checkHtmlElement(e,toHaveAccessibleErrorMessage,this);let n=this.isNot?`not to`:`to`,r=this.isNot?`.not.toHaveAccessibleErrorMessage`:`.toHaveAccessibleErrorMessage`,i=e.getAttribute(`aria-errormessage`);if(i&&/\s+/.test(i))return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(r,`element`),"Expected element's `aria-errormessage` attribute to be empty or a single, valid ID",``,`Received`,`aria-errormessage="${i}"`)};let a=e.getAttribute(v);if(!e.hasAttribute(v)||y.includes(a))return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(r,`element`),`Expected element to be marked as invalid with attribute`,`${v}="true"`,`Received`,e.hasAttribute(`aria-invalid`)?`${v}="${e.getAttribute(v)}`:null)};let o=normalize(e.ownerDocument.getElementById(i)?.textContent??``);return{pass:t===void 0?!!o:t instanceof RegExp?t.test(o):this.equals(o,t),message:()=>getMessage(this,this.utils.matcherHint(r,`element`),`Expected element ${n} have accessible error message`,t??``,`Received`,o)}}function textOfIdRefs(e,t){let n=(e.getAttribute(t)||``).split(/\s+/).filter(Boolean);if(n.length===0)return``;let r=e.ownerDocument;return normalize(n.map(e=>r.getElementById(e)).filter(Boolean).map(e=>e.textContent).join(` `))}function toHaveDescription(e,t){deprecate(`toHaveDescription`,`Please use toHaveAccessibleDescription.`),checkHtmlElement(e,toHaveDescription,this);let n=t!==void 0,r=textOfIdRefs(e,`aria-describedby`);return{pass:n?t instanceof RegExp?t.test(r):this.equals(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDescription`,`element`,``),`Expected the element ${e} have description`,this.utils.printExpected(t),`Received`,this.utils.printReceived(r))}}}function toHaveErrorMessage(e,t){if(deprecate(`toHaveErrorMessage`,`Please use toHaveAccessibleErrorMessage.`),checkHtmlElement(e,toHaveErrorMessage,this),!e.hasAttribute(`aria-invalid`)||e.getAttribute(`aria-invalid`)===`false`){let t=this.isNot?`.not`:``;return{pass:!1,message:()=>getMessage(this,this.utils.matcherHint(`${t}.toHaveErrorMessage`,`element`,``),`Expected the element to have invalid state indicated by`,`aria-invalid="true"`,`Received`,e.hasAttribute(`aria-invalid`)?`aria-invalid="${e.getAttribute(`aria-invalid`)}"`:this.utils.printReceived(``))}}let n=t!==void 0,r=textOfIdRefs(e,`aria-errormessage`);return{pass:n?t instanceof RegExp?t.test(r):this.equals(r,t):!!r,message:()=>{let e=this.isNot?`not to`:`to`;return getMessage(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveErrorMessage`,`element`,``),`Expected the element ${e} have error message`,this.utils.printExpected(t),`Received`,this.utils.printReceived(r))}}}const b={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},x=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/i;function channel(e,t){if(e.toLowerCase()===`none`)return 0;let n=x.exec(e);if(n===null)return null;let r=Number(n[1]);return n[2]===void 0?r:n[2]===`%`?r/100*t:null}function hue(e){let t=x.exec(e);if(t===null)return e.toLowerCase()===`none`?0:null;let n=Number(t[1]);switch(t[2]?.toLowerCase()){case void 0:case`deg`:return n;case`grad`:return n*360/400;case`rad`:return n*180/Math.PI;case`turn`:return n*360;default:return null}}function args(e){let t=e.trim();if(t.includes(`,`)){let e=t.split(`,`).map(e=>e.trim());return e.some(e=>e===``||/\s/.test(e))?null:e}let n=t.indexOf(`/`),r=(n===-1?t:t.slice(0,n)).trim().split(/\s+/);return n!==-1&&r.push(t.slice(n+1).trim()),r}const clamp=(e,t,n)=>Math.min(n,Math.max(t,e));function hslToRgb(e,t,n){e=(e%360+360)%360,t=clamp(t,0,1),n=clamp(n,0,1);let f=r=>{let i=(r+e/30)%12,a=t*Math.min(n,1-n);return(n-a*Math.max(-1,Math.min(i-3,9-i,1)))*255};return[f(0),f(8),f(4)]}function key(e,t,n,r){return`${Math.round(clamp(e,0,255))},${Math.round(clamp(t,0,255))},${Math.round(clamp(n,0,255))},${Math.round(clamp(r,0,1)*1e3)}`}function canonicalColor(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(t===``)return null;if(t===`transparent`)return key(0,0,0,0);if(t.charCodeAt(0)===35){let e=t.slice(1);if(!/^[0-9a-f]+$/.test(e))return null;let n=e.length,d=(t,n)=>parseInt(e.slice(t,t+n),16)*(n===1?17:1);return n===3||n===4?key(d(0,1),d(1,1),d(2,1),n===4?d(3,1)/255:1):n===6||n===8?key(d(0,2),d(2,2),d(4,2),n===8?d(6,2)/255:1):null}let n=t.indexOf(`(`);if(n===-1){let e=b[t];return e===void 0?null:key(e>>16,e>>8&255,e&255,1)}if(!t.endsWith(`)`))return null;let r=t.slice(0,n),i=args(t.slice(n+1,-1));if(i===null||i.length!==3&&i.length!==4)return null;let a=i.length===4?channel(i[3],1):1;if(a===null)return null;if(r===`rgb`||r===`rgba`){let e=channel(i[0],255),t=channel(i[1],255),n=channel(i[2],255);return e===null||t===null||n===null?null:key(e,t,n,a)}if(r===`hsl`||r===`hsla`){let e=hue(i[0]),t=channel(i[1],1),n=channel(i[2],1);if(e===null||t===null||n===null)return null;let[r,o,s]=hslToRgb(e,i[1].endsWith(`%`)?t:t/100,i[2].endsWith(`%`)?n:n/100);return key(r,o,s,a)}return null}function sameColor(e,t){let n=canonicalColor(e);return n!==null&&n===canonicalColor(t)}function nodeNameIs(e,t,n){return e.prefix===null?(e.flags&i.F_HTML)===0?e.name===n:(0,i.asciiLowercase)(e.name)===t:!1}function isElementVisibleImpl(e){let t=null;for(let n=e;n!==null&&n.type===i.ELEMENT_NODE;t=n,n=n.parent){if((0,i.computedValue)(n,`display`)===`none`)return!1;let e=(0,i.computedValue)(n,`visibility`);if(e===`hidden`||e===`collapse`||(0,i.computedValue)(n,`opacity`)===`0`||(0,i.getAttribute)(n,`hidden`)!==null||nodeNameIs(n,`details`,`DETAILS`)&&(t===null||!nodeNameIs(t,`summary`,`SUMMARY`))&&(0,i.getAttribute)(n,`open`)===null)return!1}return!0}function isStyleVisible(e){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r,opacity:i}=t(e);return n!==`none`&&r!==`hidden`&&r!==`collapse`&&i!==`0`&&i!==0}function isAttributeVisible(e,t){let n;return n=t?e.nodeName===`DETAILS`&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0:e.nodeName!==`DETAILS`||e.hasAttribute(`open`),!e.hasAttribute(`hidden`)&&n}function isElementVisible(e,t){return isStyleVisible(e)&&isAttributeVisible(e,t)&&(!e.parentElement||isElementVisible(e.parentElement,e))}function toBeVisible(e){checkHtmlElement(e,toBeVisible,this);let t=e.ownerDocument===e.getRootNode({composed:!0}),n=e[i.$impl],r=t&&(n!==void 0&&(0,i.getComputedStyleOverride)(n)===null?isElementVisibleImpl(n):isElementVisible(e));return{pass:r,message:()=>{let n=r?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeVisible`,`element`,``),``,`Received element ${n} visible${t?``:` (element is not in the document)`}:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
19
|
+
`)}}}function getStyleDeclaration(e,t){let n=normalizedKey(t);if(n!==null){let e=S.get(n);if(e!==void 0)return{...e}}let r={},i=e.createElement(`div`);for(let e of Object.keys(t))i.style[e]=t[e],r[e]=i.style[e];return n!==null&&(S.size>=512&&S.clear(),S.set(n,{...r})),r}const S=/* @__PURE__ */ new Map;function normalizedKey(e){let t=``;for(let n of Object.keys(e)){let r=e[n],i=typeof r;if(i!==`string`&&i!==`number`)return null;t+=`${n}\u0000${i===`number`?`n`:`s`}${r}\u0001`}return t}function valueMatches(e,t){return e===t||sameColor(t,e)}function isSubset(e,t){let n=Object.entries(e);if(n.length===0)return!1;for(let[e,r]of n){let n=e.startsWith(`--`);if(!(valueMatches(t[e],r)||valueMatches(t.getPropertyValue(e),r))){if(!n){let n=e.toLowerCase();if(valueMatches(t[n],r)||valueMatches(t.getPropertyValue(n),r))continue}return!1}}return!0}function printoutStyles(e){return Object.keys(e).sort().map(t=>`${t}: ${e[t]};`).join(`
|
|
20
20
|
`)}function expectedDiff(e,t,n){let r={};for(let e of Array.from(n))t[e]!==void 0&&(r[e]=n.getPropertyValue(e));return e(printoutStyles(t),printoutStyles(r)).replace(`${picoRed(`+ Received`)}\n`,``)}function toHaveStyle(e,t){checkHtmlElement(e,toHaveStyle,this);let n=typeof t==`object`?t:parseCSS(t,toHaveStyle,this),{getComputedStyle:r}=e.ownerDocument.defaultView,i=getStyleDeclaration(e.ownerDocument,n),a=r(e);return{pass:isSubset(i,a),message:()=>{let e=`${this.isNot?`.not`:``}.toHaveStyle`;return[this.utils.matcherHint(e,`element`,``),expectedDiff(this.utils.diff,i,a)].join(`
|
|
21
21
|
|
|
22
|
-
`)}}}const
|
|
22
|
+
`)}}}const C=r.roles;let w=null;function checkedRoles(){return w??=C.keys().filter(e=>C.get(e)?.props[`aria-checked`]!==void 0)}function roleSupportsChecked(e){return e!==null&&checkedRoles().includes(e)}function supportedRolesSentence(){return toSentence(checkedRoles().map(e=>`role="${e}"`),{lastWordConnector:` or `})}function toBeChecked(e){checkHtmlElement(e,toBeChecked,this);let isValidInput=()=>e.tagName.toLowerCase()===`input`&&[`checkbox`,`radio`].includes(e.type),isValidAriaElement=()=>roleSupportsChecked(e.getAttribute(`role`))&&[`true`,`false`].includes(e.getAttribute(`aria-checked`));if(!isValidInput()&&!isValidAriaElement())return{pass:!1,message:()=>`only inputs with type="checkbox" or type="radio" or elements with ${supportedRolesSentence()} and a valid aria-checked attribute can be used with .toBeChecked(). Use .toHaveValue() instead`};let isChecked=()=>isValidInput()?e.checked:e.getAttribute(`aria-checked`)===`true`;return{pass:isChecked(),message:()=>{let t=isChecked()?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeChecked`,`element`,``),``,`Received element ${t} checked:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
23
23
|
`)}}}function toBePartiallyChecked(e){checkHtmlElement(e,toBePartiallyChecked,this);let isValidInput=()=>e.tagName.toLowerCase()===`input`&&e.type===`checkbox`,isValidAriaElement=()=>e.getAttribute(`role`)===`checkbox`;if(!isValidInput()&&!isValidAriaElement())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 isPartiallyChecked=()=>{let t=e.getAttribute(`aria-checked`)===`mixed`;return isValidInput()&&e.indeterminate||t};return{pass:isPartiallyChecked(),message:()=>{let t=isPartiallyChecked()?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyChecked`,`element`,``),``,`Received element ${t} partially checked:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
24
|
-
`)}}}function isButtonLike(e){let t=(e.getAttribute(`role`)||``).split(` `).map(e=>e.trim());return e.tagName.toLowerCase()===`button`||e.tagName.toLowerCase()===`input`&&e.type===`button`||t.includes(`button`)}function toBePressed(e){checkHtmlElement(e,toBePressed,this);let t=isButtonLike(e),n=e.getAttribute(`aria-pressed`);return!t||n!==`true`&&n!==`false`?{pass:!1,message:()=>`Only button or input with type="button" or element with role="button" and a valid aria-pressed attribute can be used with .toBePressed()`}:{pass:t&&n===`true`,message:()=>{let e=this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePressed`,`element`,``);return getMessage(this,e,`Expected element to have`,`aria-pressed="${this.isNot?`false`:`true`}"`,`Received`,`aria-pressed="${n}"`)}}}function toBePartiallyPressed(e){checkHtmlElement(e,toBePartiallyPressed,this);let t=isButtonLike(e),n=e.getAttribute(`aria-pressed`);return!t||n!==`true`&&n!==`false`&&n!==`mixed`?{pass:!1,message:()=>`Only button or input with type="button" or element with role="button" and a valid aria-pressed attribute can be used with .toBePartiallyPressed()`}:{pass:t&&n===`mixed`,message:()=>{let e=this.isNot?`not to`:`to`,t=this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyPressed`,`element`,``);return getMessage(this,t,`Expected element ${e} have`,`aria-pressed="mixed"`,`Received`,`aria-pressed="${n}"`)}}}const
|
|
24
|
+
`)}}}function isButtonLike(e){let t=(e.getAttribute(`role`)||``).split(` `).map(e=>e.trim());return e.tagName.toLowerCase()===`button`||e.tagName.toLowerCase()===`input`&&e.type===`button`||t.includes(`button`)}function toBePressed(e){checkHtmlElement(e,toBePressed,this);let t=isButtonLike(e),n=e.getAttribute(`aria-pressed`);return!t||n!==`true`&&n!==`false`?{pass:!1,message:()=>`Only button or input with type="button" or element with role="button" and a valid aria-pressed attribute can be used with .toBePressed()`}:{pass:t&&n===`true`,message:()=>{let e=this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePressed`,`element`,``);return getMessage(this,e,`Expected element to have`,`aria-pressed="${this.isNot?`false`:`true`}"`,`Received`,`aria-pressed="${n}"`)}}}function toBePartiallyPressed(e){checkHtmlElement(e,toBePartiallyPressed,this);let t=isButtonLike(e),n=e.getAttribute(`aria-pressed`);return!t||n!==`true`&&n!==`false`&&n!==`mixed`?{pass:!1,message:()=>`Only button or input with type="button" or element with role="button" and a valid aria-pressed attribute can be used with .toBePartiallyPressed()`}:{pass:t&&n===`mixed`,message:()=>{let e=this.isNot?`not to`:`to`,t=this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyPressed`,`element`,``);return getMessage(this,t,`Expected element ${e} have`,`aria-pressed="mixed"`,`Received`,`aria-pressed="${n}"`)}}}const T=[`fieldset`,`input`,`select`,`optgroup`,`option`,`button`,`textarea`];function isFirstLegendChildOfFieldset(e,t){if(getTag(e)!==`legend`||getTag(t)!==`fieldset`)return!1;for(let n=t.firstElementChild;n!==null;n=n.nextElementSibling)if(getTag(n)===`legend`)return e.isSameNode(n);return!1}function isElementDisabledByParent(e,t){return isElementDisabled(t)&&!isFirstLegendChildOfFieldset(e,t)}function isCustomElement(e){return e.includes(`-`)}function canElementBeDisabled(e){let t=getTag(e);return T.includes(t)||isCustomElement(t)}function isElementDisabled(e){return canElementBeDisabled(e)&&e.hasAttribute(`disabled`)}function isAncestorDisabled(e){let t=e.parentElement;return!!t&&(isElementDisabledByParent(e,t)||isAncestorDisabled(t))}function isElementOrAncestorDisabled(e){let t=e[i.$impl];return t===void 0?canElementBeDisabled(e)&&(isElementDisabled(e)||isAncestorDisabled(e)):isElementOrAncestorDisabledImpl(t)}function tagOf(e){return e.prefix===null&&e.tag!==0&&(e.flags&i.F_HTML)!==0?e.name:(e.prefix===null?e.name:`${e.prefix}:${e.name}`).toLowerCase()}function isElementDisabledImpl(e,t){return(T.includes(t)||isCustomElement(t))&&(0,i.getAttribute)(e,`disabled`)!==null}function isElementOrAncestorDisabledImpl(e){let t=tagOf(e);if(!T.includes(t)&&!isCustomElement(t))return!1;if((0,i.getAttribute)(e,`disabled`)!==null)return!0;let n=e,r=t;for(let t=e.parent;t!==null&&t.type===i.ELEMENT_NODE;t=t.parent){let e=tagOf(t);if(isElementDisabledImpl(t,e)&&!isFirstLegendChildImpl(n,r,t,e))return!0;n=t,r=e}return!1}function isFirstLegendChildImpl(e,t,n,r){if(t!==`legend`||r!==`fieldset`)return!1;for(let t=n.first;t!==null;t=t.next)if(t.type===i.ELEMENT_NODE&&tagOf(t)===`legend`)return t===e;return!1}function toBeDisabled(e){checkHtmlElement(e,toBeDisabled,this);let t=isElementOrAncestorDisabled(e);return{pass:t,message:()=>{let n=t?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeDisabled`,`element`,``),``,`Received element ${n} disabled:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
25
25
|
`)}}}function toBeEnabled(e){checkHtmlElement(e,toBeEnabled,this);let t=!isElementOrAncestorDisabled(e);return{pass:t,message:()=>{let n=t?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEnabled`,`element`,``),``,`Received element ${n} enabled:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
26
|
-
`)}}}const
|
|
27
|
-
`)}}}const
|
|
26
|
+
`)}}}const E=[`select`,`textarea`],D=[`input`,`select`,`textarea`],O=[`color`,`hidden`,`range`,`submit`,`image`,`reset`],k=[`checkbox`,`combobox`,`gridcell`,`listbox`,`radiogroup`,`spinbutton`,`textbox`,`tree`];function isRequiredOnFormTagsExceptInput(e){return E.includes(getTag(e))&&e.hasAttribute(`required`)}function isRequiredOnSupportedInput(e){return getTag(e)===`input`&&e.hasAttribute(`required`)&&(e.hasAttribute(`type`)&&!O.includes(e.getAttribute(`type`))||!e.hasAttribute(`type`))}function isElementRequiredByARIA(e){return e.hasAttribute(`aria-required`)&&e.getAttribute(`aria-required`)===`true`&&(D.includes(getTag(e))||e.hasAttribute(`role`)&&k.includes(e.getAttribute(`role`)))}function toBeRequired(e){checkHtmlElement(e,toBeRequired,this);let t=isRequiredOnFormTagsExceptInput(e)||isRequiredOnSupportedInput(e)||isElementRequiredByARIA(e);return{pass:t,message:()=>{let n=t?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeRequired`,`element`,``),``,`Received element ${n} required:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
27
|
+
`)}}}const A=[`form`,`input`,`select`,`textarea`];function isElementHavingAriaInvalid(e){return e.hasAttribute(`aria-invalid`)&&e.getAttribute(`aria-invalid`)!==`false`}function isElementInvalid(e){let t=isElementHavingAriaInvalid(e);return A.includes(getTag(e))?t||!e.checkValidity():t}function toBeInvalid(e){checkHtmlElement(e,toBeInvalid,this);let t=isElementInvalid(e);return{pass:t,message:()=>{let n=t?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInvalid`,`element`,``),``,`Received element ${n} currently invalid:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
28
28
|
`)}}}function toBeValid(e){checkHtmlElement(e,toBeValid,this);let t=!isElementInvalid(e);return{pass:t,message:()=>{let n=t?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeValid`,`element`,``),``,`Received element ${n} currently valid:`,` ${this.utils.printReceived(e.cloneNode(!1))}`].join(`
|
|
29
29
|
`)}}}function toMatchAriaSnapshot(e,t){if(typeof e!=`object`||!e||e[i.$impl]===void 0)throw new NodeTypeError(e,toMatchAriaSnapshot,this);if(typeof t!=`string`)throw TypeError(`toMatchAriaSnapshot expects an aria snapshot template string, got ${t===null?`null`:typeof t}`);let n;try{n=(0,a.matchAriaSnapshot)(e,t)}catch(e){throw e instanceof a.AriaTemplateError&&Error.captureStackTrace&&Error.captureStackTrace(e,toMatchAriaSnapshot),e}let r=this.utils.matcherHint(`${this.isNot?`.not`:``}.toMatchAriaSnapshot`,`element`,`template`);return{pass:n.pass,message:()=>{if(this.isNot)return[r,``,`Expected the accessibility tree not to match the template:`,this.utils.EXPECTED_COLOR(n.expected()),``,`Received:`,this.utils.RECEIVED_COLOR(n.received())].join(`
|
|
30
30
|
`);let e=n.diff(),t=0,i=0,a=[];for(let n=0;n<e.length;n++){let r=e[n];r.kind===`-`?(t++,a.push(this.utils.EXPECTED_COLOR(`- ${r.text}`))):r.kind===`+`?(i++,a.push(this.utils.RECEIVED_COLOR(`+ ${r.text}`))):a.push(` ${r.text}`)}return[r,``,`${this.utils.EXPECTED_COLOR(`- Expected - ${t}`)} (template)`,`${this.utils.RECEIVED_COLOR(`+ Received + ${i}`)} (closest part of the accessibility tree)`,``,...a,``,`Received accessibility tree:`,this.utils.RECEIVED_COLOR(n.received())].join(`
|
|
31
|
-
`)}}}var
|
|
31
|
+
`)}}}var j=/* @__PURE__ */ __exportAll({toAppearAfter:()=>toAppearAfter,toAppearBefore:()=>toAppearBefore,toBeChecked:()=>toBeChecked,toBeDisabled:()=>toBeDisabled,toBeEmpty:()=>toBeEmpty,toBeEmptyDOMElement:()=>toBeEmptyDOMElement,toBeEnabled:()=>toBeEnabled,toBeInTheDOM:()=>toBeInTheDOM,toBeInTheDocument:()=>toBeInTheDocument,toBeInvalid:()=>toBeInvalid,toBePartiallyChecked:()=>toBePartiallyChecked,toBePartiallyPressed:()=>toBePartiallyPressed,toBePressed:()=>toBePressed,toBeRequired:()=>toBeRequired,toBeValid:()=>toBeValid,toBeVisible:()=>toBeVisible,toContainAnyByAltText:()=>M,toContainAnyByDisplayValue:()=>P,toContainAnyByLabelText:()=>I,toContainAnyByPlaceholderText:()=>R,toContainAnyByRole:()=>B,toContainAnyByTestId:()=>H,toContainAnyByText:()=>W,toContainAnyByTitle:()=>K,toContainElement:()=>toContainElement,toContainHTML:()=>toContainHTML,toContainOneByAltText:()=>N,toContainOneByDisplayValue:()=>F,toContainOneByLabelText:()=>L,toContainOneByPlaceholderText:()=>z,toContainOneByRole:()=>V,toContainOneByTestId:()=>U,toContainOneByText:()=>G,toContainOneByTitle:()=>q,toHaveAccessibleDescription:()=>toHaveAccessibleDescription,toHaveAccessibleErrorMessage:()=>toHaveAccessibleErrorMessage,toHaveAccessibleName:()=>toHaveAccessibleName,toHaveAttribute:()=>toHaveAttribute,toHaveClass:()=>toHaveClass,toHaveDescription:()=>toHaveDescription,toHaveDisplayValue:()=>toHaveDisplayValue,toHaveErrorMessage:()=>toHaveErrorMessage,toHaveFocus:()=>toHaveFocus,toHaveFormValues:()=>toHaveFormValues,toHaveRole:()=>toHaveRole,toHaveSelection:()=>toHaveSelection,toHaveStyle:()=>toHaveStyle,toHaveTextContent:()=>toHaveTextContent,toHaveValue:()=>toHaveValue,toMatchAriaSnapshot:()=>toMatchAriaSnapshot});const{toContainAnyByAltText:M,toContainOneByAltText:N,toContainAnyByDisplayValue:P,toContainOneByDisplayValue:F,toContainAnyByLabelText:I,toContainOneByLabelText:L,toContainAnyByPlaceholderText:R,toContainOneByPlaceholderText:z,toContainAnyByRole:B,toContainOneByRole:V,toContainAnyByTestId:H,toContainOneByTestId:U,toContainAnyByText:W,toContainOneByText:G,toContainAnyByTitle:K,toContainOneByTitle:q}=m;Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return toHaveAccessibleDescription}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return toHaveSelection}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return toBePartiallyChecked}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return toBeValid}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return toBeRequired}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return toHaveRole}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return toBeEmpty}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return toHaveValue}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return toHaveAttribute}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return toBeInTheDocument}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return toBeEmptyDOMElement}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return toHaveClass}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return toHaveAccessibleName}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return toHaveDescription}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return toBeVisible}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return toHaveErrorMessage}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return toHaveDisplayValue}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return toBeInvalid}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return toBePressed}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return toAppearAfter}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return toHaveTextContent}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return toAppearBefore}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return toContainHTML}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return toContainElement}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return toHaveFocus}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return toBeDisabled}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return toHaveAccessibleErrorMessage}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return toHaveStyle}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return toBeInTheDOM}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return toMatchAriaSnapshot}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return toBePartiallyPressed}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return toBeEnabled}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return toBeChecked}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return toHaveFormValues}});
|
package/dist/jest-dom/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-DJmRgUYG.cjs");expect.extend(e.t);
|
package/dist/jest-dom/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./_chunks/matchers-
|
|
1
|
+
import{t as e}from"./_chunks/matchers-DGsBvtWC.js";expect.extend(e);export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-DJmRgUYG.cjs");require("@jest/globals").expect.extend(e.t);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./_chunks/matchers-
|
|
1
|
+
import{t as e}from"./_chunks/matchers-DGsBvtWC.js";import{expect as t}from"@jest/globals";t.extend(e);export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-DJmRgUYG.cjs");exports.toAppearAfter=e.U,exports.toAppearBefore=e.W,exports.toBeChecked=e.y,exports.toBeDisabled=e.b,exports.toBeEmpty=e.G,exports.toBeEmptyDOMElement=e.K,exports.toBeEnabled=e.x,exports.toBeInTheDOM=e.q,exports.toBeInTheDocument=e.J,exports.toBeInvalid=e.S,exports.toBePartiallyChecked=e.C,exports.toBePartiallyPressed=e.w,exports.toBePressed=e.T,exports.toBeRequired=e.E,exports.toBeValid=e.D,exports.toBeVisible=e.O,exports.toContainAnyByAltText=e.n,exports.toContainAnyByDisplayValue=e.r,exports.toContainAnyByLabelText=e.i,exports.toContainAnyByPlaceholderText=e.a,exports.toContainAnyByRole=e.o,exports.toContainAnyByTestId=e.s,exports.toContainAnyByText=e.c,exports.toContainAnyByTitle=e.l,exports.toContainElement=e.Y,exports.toContainHTML=e.X,exports.toContainOneByAltText=e.u,exports.toContainOneByDisplayValue=e.d,exports.toContainOneByLabelText=e.f,exports.toContainOneByPlaceholderText=e.p,exports.toContainOneByRole=e.m,exports.toContainOneByTestId=e.h,exports.toContainOneByText=e.g,exports.toContainOneByTitle=e._,exports.toHaveAccessibleDescription=e.A,exports.toHaveAccessibleErrorMessage=e.j,exports.toHaveAccessibleName=e.M,exports.toHaveAttribute=e.I,exports.toHaveClass=e.L,exports.toHaveDescription=e.N,exports.toHaveDisplayValue=e.R,exports.toHaveErrorMessage=e.P,exports.toHaveFocus=e.Z,exports.toHaveFormValues=e.z,exports.toHaveRole=e.F,exports.toHaveSelection=e.B,exports.toHaveStyle=e.k,exports.toHaveTextContent=e.V,exports.toHaveValue=e.H,exports.toMatchAriaSnapshot=e.v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{U as toAppearAfter,W as toAppearBefore,y as toBeChecked,b as toBeDisabled,G as toBeEmpty,K as toBeEmptyDOMElement,x as toBeEnabled,q as toBeInTheDOM,J as toBeInTheDocument,S as toBeInvalid,C as toBePartiallyChecked,w as toBePartiallyPressed,T as toBePressed,E as toBeRequired,D as toBeValid,O as toBeVisible,n as toContainAnyByAltText,r as toContainAnyByDisplayValue,i as toContainAnyByLabelText,a as toContainAnyByPlaceholderText,o as toContainAnyByRole,s as toContainAnyByTestId,c as toContainAnyByText,l as toContainAnyByTitle,Y as toContainElement,X as toContainHTML,u as toContainOneByAltText,d as toContainOneByDisplayValue,f as toContainOneByLabelText,p as toContainOneByPlaceholderText,m as toContainOneByRole,h as toContainOneByTestId,g as toContainOneByText,_ as toContainOneByTitle,A as toHaveAccessibleDescription,j as toHaveAccessibleErrorMessage,M as toHaveAccessibleName,I as toHaveAttribute,L as toHaveClass,N as toHaveDescription,R as toHaveDisplayValue,P as toHaveErrorMessage,Z as toHaveFocus,z as toHaveFormValues,F as toHaveRole,B as toHaveSelection,k as toHaveStyle,V as toHaveTextContent,H as toHaveValue,v as toMatchAriaSnapshot}from"./_chunks/matchers-
|
|
1
|
+
export{U as toAppearAfter,W as toAppearBefore,y as toBeChecked,b as toBeDisabled,G as toBeEmpty,K as toBeEmptyDOMElement,x as toBeEnabled,q as toBeInTheDOM,J as toBeInTheDocument,S as toBeInvalid,C as toBePartiallyChecked,w as toBePartiallyPressed,T as toBePressed,E as toBeRequired,D as toBeValid,O as toBeVisible,n as toContainAnyByAltText,r as toContainAnyByDisplayValue,i as toContainAnyByLabelText,a as toContainAnyByPlaceholderText,o as toContainAnyByRole,s as toContainAnyByTestId,c as toContainAnyByText,l as toContainAnyByTitle,Y as toContainElement,X as toContainHTML,u as toContainOneByAltText,d as toContainOneByDisplayValue,f as toContainOneByLabelText,p as toContainOneByPlaceholderText,m as toContainOneByRole,h as toContainOneByTestId,g as toContainOneByText,_ as toContainOneByTitle,A as toHaveAccessibleDescription,j as toHaveAccessibleErrorMessage,M as toHaveAccessibleName,I as toHaveAttribute,L as toHaveClass,N as toHaveDescription,R as toHaveDisplayValue,P as toHaveErrorMessage,Z as toHaveFocus,z as toHaveFormValues,F as toHaveRole,B as toHaveSelection,k as toHaveStyle,V as toHaveTextContent,H as toHaveValue,v as toMatchAriaSnapshot}from"./_chunks/matchers-DGsBvtWC.js";
|
package/dist/jest-dom/vitest.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/matchers-DJmRgUYG.cjs");require("vitest").expect.extend(e.t);
|
package/dist/jest-dom/vitest.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./_chunks/matchers-
|
|
1
|
+
import{t as e}from"./_chunks/matchers-DGsBvtWC.js";import{expect as t}from"vitest";t.extend(e);export{};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0})
|
|
1
|
+
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria/internal"),r=require("node:module"),i=require("node:fs"),a=require("@ctrl/dom/aria");const o=new URL(`./`,require("url").pathToFileURL(__filename).href).pathname;let s=null;const c=process.env,l=process.argv,u=!(c.NO_COLOR||l.includes(`--no-color`))&&(!!c.FORCE_COLOR||l.includes(`--color`)||process.platform===`win32`||process.stdout?.isTTY&&c.TERM!==`dumb`||!!c.CI);function dim(e){return u?`\x1b[2m${e}\x1b[22m`:e}function getCodeFrame(e){s??=(0,r.createRequire)(require("url").pathToFileURL(__filename).href)(`@babel/code-frame`).codeFrameColumns;let t=e.indexOf(`(`)+1,n=e.indexOf(`)`),a=e.slice(t,n),o=a.split(`:`),[c,l,u]=[o[0],parseInt(o[1],10),parseInt(o[2],10)],d=``;try{d=(0,i.readFileSync)(c,`utf-8`)}catch{return``}let f=s(d,{start:{line:l,column:u-1}},{highlightCode:!0,linesBelow:0});return`${dim(a)}\n${f}\n`}function getUserCodeFrame(){return getCodeFrame((/* @__PURE__ */ Error()).stack.split(`
|
|
2
2
|
`).slice(1).find(e=>!e.includes(`node_modules/`)&&!e.includes(o)))}function jestFakeTimersAreEnabled(){if(typeof jest<`u`&&jest!==null)return setTimeout._isMockFunction===!0||Object.hasOwn(setTimeout,`clock`);let e=setTimeout.clock;return e!=null&&typeof e.tick==`function`}function advanceFakeTimersByTime(e){if(typeof jest<`u`&&jest!==null){jest.advanceTimersByTime(e);return}let t=globalThis.vi;t!=null&&typeof t.advanceTimersByTime==`function`&&typeof t.isFakeTimers==`function`&&t.isFakeTimers()?t.advanceTimersByTime(e):setTimeout.clock.tick(e)}function getDocument(){if(typeof window>`u`)throw Error(`Could not find default container`);return window.document}function getWindowFromNode(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&e.ownerDocument.defaultView===null?Error(`It looks like the window object is not available for the provided node.`):e.then instanceof Function?Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):typeof e.debug==`function`&&typeof e.logTestingPlaygroundURL==`function`?Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):Error(`The given node is not an Element, the node type is: ${typeof e}.`)}function checkContainerType(e){if(!e||typeof e.querySelector!=`function`||typeof e.querySelectorAll!=`function`)throw TypeError(`Expected container to be an Element, a Document or a DocumentFragment but got ${getTypeName(e)}.`)}function getTypeName(e){return typeof e==`object`?e===null?`null`:e.constructor.name:typeof e}function implOf(e){let n=e[t.$impl];if(n===void 0)throw TypeError(`@ctrl/dom/testing-library requires nodes created by @ctrl/dom.`);return n}function matchesSelector(e,n){return e.type===t.ELEMENT_NODE&&(0,t.matches)(e,n)}function envDebugFormat(){let e=typeof process<`u`?process.env?.CTRL_DOM_DEBUG:void 0;if(e===void 0||e===``)return null;let t=String(e).trim().toLowerCase();return t===`aria`?`aria`:t===`compact`||t===`html`?`compact`:null}function containerLabel(e){let n=e?.[t.$impl];return n===void 0?`the container`:n.type===9?`the document`:describeElement(n)}function agentErrorContext(e,t,n){return t===`aria`?`Accessibility snapshot of ${containerLabel(e)} (CTRL_DOM_DEBUG=aria):\n${ariaSnapshot(e,{maxLines:envMaxLines()??100})}`:`DOM of ${containerLabel(e)} without class/style/SVG internals (CTRL_DOM_DEBUG=compact):\n${n(e,void 0,{format:`compact`})}`}function agentElementSummary(e){return ariaSnapshot(e,{maxLines:12})}function envMaxLines(){let e=typeof process<`u`?process.env?.CTRL_DOM_DEBUG_LINES:void 0,t=e?Number(e):NaN;return t>0?t:void 0}function ariaSnapshot(e,t={}){let{header:n,lines:r,empty:i}=ariaSnapshotLines(e,t);return i===null?n+budgetLines(r,t.maxLines??envMaxLines()??200).join(`
|
|
3
|
-
`):n+i}(0,t.setFailureSnapshot)(e=>ariaSnapshot(e,{maxLines:2e3}));function buildTree(e,
|
|
4
|
-
`)),{header:a,lines:o,empty:s}}function budgetLines(e,t){if(e.length<=t)return e;let n=e.length-t,r=e.slice(0,t);return r.push(`# … ${n} more line${n===1?``:`s`} (raise maxLines or CTRL_DOM_DEBUG_LINES)`),r}const d=Symbol.for(`ctrl-dom.agent.lastBodySnapshot`);function recordBodySnapshot(e,t){e!=null&&Object.defineProperty(e,d,{value:t,configurable:!0,writable:!0,enumerable:!1})}function lastBodySnapshot(e){return e?.[d]}function resetBodySnapshot(e){e!=null&&Object.hasOwn(e,d)&&delete e[d]}function rootImpl(e){let n=e??getDocument().body,r=n?.[t.$impl];if(r===void 0)throw TypeError(`Expected an element, document or fragment but got ${n===null?`null`:typeof n}`);if(r.type===t.DOCUMENT_NODE||r.tag===t.T.html&&r.ns===t.HTML_NS){let e=r.doc?.body;return e?e[t.$impl]:r}return r}function bodyOf(e){let n=e.doc?.body;return n?n[t.$impl]:null}function normalizeSpace(e){return e.replace(/[\t\n\f\r ]+/g,` `)}function truncate(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+`…`:e}function quote(e){return JSON.stringify(e)}const f=/^$|^[\s\-?:,[\]{}#&*!|>'"%@`]|[\s]$|:$|: | #|^(true|false|null|yes|no|on|off|~)$|^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;function yamlValue(e){return f.test(e)?quote(e):e}function nodeKey(e,t){let n=e.role;e.name!==``&&(n+=` `+quote(truncate(e.name,t)));for(let t=0;t<e.props.length;t++)n+=` `+e.props[t];return n}function describeElement(e){let n=e.name;if(e.id!==``)return`<${n} id="${e.id}">`;let r=(0,t.attr)(e,`data-testid`);return r===null?`<${n}>`:`<${n} data-testid="${r}">`}function hiddenReason(e){let t=hiddenChainReason(e);return t===``?(0,a.isVisibilityHidden)(e)?`visibility: hidden on ${describeElement(e)}`:``:t}function hiddenChainReason(e){for(let n=e;n!==null&&n.type===t.ELEMENT_NODE;n=n.parent){if(n.ns===t.HTML_NS&&(0,t.attr)(n,`hidden`)!==null)return`hidden attribute on ${describeElement(n)}`;if((0,t.ariaAttr)(n,`aria-hidden`)===`true`)return`aria-hidden="true" on ${describeElement(n)}`;if((0,a.isDisplayNone)(n))return`display: none on ${describeElement(n)}`}return``}const p=/* @__PURE__ */ new Set([``,`generic`,`none`,`presentation`]);function isSkippedTag(e){if(e.ns!==t.HTML_NS)return!1;switch(e.tag){case t.T.script:case t.T.style:case t.T.template:case t.T.noscript:case t.T.head:return!0}return!1}function nodeProps(e,t,n,r){let o=[];if((0,i.roleSupportsProp)(t,`aria-checked`)){let t=(0,a.ariaCheckedState)(e);t===!0?o.push(`[checked]`):t===`mixed`&&o.push(`[checked=mixed]`)}(0,a.isDisabledImpl)(e)&&o.push(`[disabled]`);let s=(0,a.computeAriaExpanded)(e);s===!0?o.push(`[expanded]`):s===!1&&o.push(`[expanded=false]`),n&&o.push(`[active]`);let c=t===`heading`?(0,a.computeHeadingLevel)(e):levelAttr(e);c!==void 0&&o.push(`[level=${c}]`);let l=(0,a.ariaPressedState)(e);l===!0?o.push(`[pressed]`):l===`mixed`?o.push(`[pressed=mixed]`):l===!1&&o.push(`[pressed=false]`),(0,a.computeAriaSelected)(e)===!0&&o.push(`[selected]`);let u=(0,a.computeAriaCurrent)(e);return u===!0?o.push(`[current]`):typeof u==`string`&&u!==``&&o.push(`[current=${u}]`),(0,a.computeAriaBusy)(e)&&o.push(`[busy]`),r&&o.push(`[hidden]`),o}function levelAttr(e){let n=(0,t.ariaAttr)(e,`aria-level`),r=n===null?NaN:Number(n);return r>0?r:void 0}const m=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`spinbutton`,`slider`,`progressbar`,`meter`,`scrollbar`,`separator`]);function nodeValue(e,n){if(!m.has(n))return null;let r=(0,t.ariaAttr)(e,`aria-valuetext`);if(r!==null)return r;let i=(0,t.ariaAttr)(e,`aria-valuenow`);if(i!==null)return i;if(e.ns!==t.HTML_NS)return null;if(e.tag===t.T.input||e.tag===t.T.textarea){let t=String(e.node.value??``);return t===``?null:t}return null}var SnapshotContext=class{includeHidden;forceHidden=!1;sawHidden=!1;maxText;collapseAfter;urls;active;constructor(e,n){this.includeHidden=n.hidden===!0,this.maxText=n.maxTextLength??100,this.collapseAfter=n.collapseAfter??5,this.urls=n.urls===!0;let r=e.doc?.activeElement,i=r?r[t.$impl]??null:null;this.active=i!==null&&i===bodyOf(e)?null:i}visitChildren(e,n,r,i){for(let a=e.first;a!==null;a=a.next)a.type===t.TEXT_NODE?i||appendText(n,a.data):a.type===t.ELEMENT_NODE?this.visitElement(a,n,r):a.type===t.DOCUMENT_FRAGMENT_NODE&&this.visitChildren(a,n,r,i)}visitElement(e,n,r){if(isSkippedTag(e))return;let i=r;if(!i&&(0,a.isSubtreeInaccessibleImpl)(e)){if(this.sawHidden=!0,!this.includeHidden)return;i=!0}let o=i;if(!i&&(0,a.isVisibilityHidden)(e)){if(this.sawHidden=!0,!this.includeHidden){this.visitChildren(e,n,!1,!0);return}o=!0}let s=(0,a.tlRole)(e);if(p.has(s)){let t=!(0,a.isDisplayInline)(e);t&&appendBreak(n),this.visitChildren(e,n,i,!1),t&&appendBreak(n);return}let c={role:s,name:normalizeSpace((0,a.computeAccessibleNameImpl)(e,void 0,5)).trim(),props:nodeProps(e,s,e===this.active,o&&this.includeHidden),value:nodeValue(e,s),url:null,children:[],element:e};this.urls&&s===`link`&&(c.url=(0,t.attr)(e,`href`)),(e.ns!==t.HTML_NS||e.tag!==t.T.textarea)&&this.visitChildren(e,c.children,i,!1),finishChildren(c.children,c.name),n.push(c)}renderList(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(typeof i==`string`){n.push(`${t}- text: ${yamlValue(truncate(i,this.maxText))}`);continue}let a=1;for(;r+a<e.length&&typeof e[r+a]!=`string`&&e[r+a].role===i.role;)a++;if(a>this.collapseAfter+1){for(let i=0;i<this.collapseAfter;i++)this.renderNode(e[r+i],t,n);n.push(`${t}- ${i.role} … (+${a-this.collapseAfter} more)`),r+=a-1}else this.renderNode(i,t,n)}}renderNode(e,t,n){let r=nodeKey(e,this.maxText),i=e.children;if(e.url===null&&(i.length===0||i.length===1&&typeof i[0]==`string`&&e.value===null)){let a=e.value??(i.length===1?i[0]:null);n.push(a===null?`${t}- ${r}`:`${t}- ${r}: ${yamlValue(truncate(a,this.maxText))}`);return}n.push(e.value===null?`${t}- ${r}:`:`${t}- ${r}: ${yamlValue(truncate(e.value,this.maxText))}`);let a=t+` `;e.url!==null&&n.push(`${a}- /url: ${yamlValue(e.url)}`),this.renderList(i,a,n)}};function appendText(e,t){if(t===``)return;let n=e.length-1;n>=0&&typeof e[n]==`string`&&e[n]!==`\0`?e[n]=e[n]+t:e.push(t)}function appendBreak(e){let t=e.length-1;t>=0&&typeof e[t]==`string`&&e[t]!==`\0`&&e.push(`\0`)}function finishChildren(e,t){let n=0;for(let t=0;t<e.length;t++){let r=e[t];typeof r==`string`&&(r===`\0`||(r=normalizeSpace(r).trim(),r===``))||(e[n++]=r)}e.length=n,e.length>0&&typeof e[0]==`string`&&e[0]===t&&e.splice(0,1),n=0;for(let t=0;t<e.length;t++){let r=e[t];(typeof r!=`string`||!labels(e[t-1],r)&&!labels(e[t+1],r))&&(e[n++]=r)}e.length=n}const h=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`slider`,`spinbutton`,`meter`,`progressbar`]);function labels(e,t){return e!==void 0&&typeof e!=`string`&&e.name===t&&h.has(e.role)}let g=null;function loadPrettyFormat(e){if(g!==null)return g;try{return g=(0,n.createRequire)(require("url").pathToFileURL(__filename).href)(`pretty-format`)}catch(t){throw Error(`${e} needs pretty-format, which @ctrl/dom does not install: add pretty-format@27 to the project's devDependencies.`,{cause:t})}}const _=`The prettyFormat export`,v=Object.defineProperties({},{format:{enumerable:!0,get:()=>loadPrettyFormat(_).format},default:{enumerable:!0,get:()=>loadPrettyFormat(_).default},plugins:{enumerable:!0,get:()=>loadPrettyFormat(_).plugins},DEFAULT_OPTIONS:{enumerable:!0,get:()=>loadPrettyFormat(_).DEFAULT_OPTIONS}}),shouldHighlight=()=>{if(typeof process>`u`)return!1;let e;try{let t=process.env?.COLORS;t&&(e=JSON.parse(t))}catch{}return typeof e==`boolean`?e:process.versions!==void 0&&process.versions.node!==void 0};function filterCommentsAndDefaultIgnoreTagsTags(e){return e.nodeType!==t.COMMENT_NODE&&(e.nodeType!==t.ELEMENT_NODE||!e.matches(getConfig().defaultIgnore))}const y={open:``,close:``},b={comment:y,content:y,prop:y,tag:y,value:y},x={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],gray:[90,39],grey:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49],bgGray:[100,49],bgGrey:[100,49]},S={comment:`gray`,content:`reset`,prop:`yellow`,tag:`cyan`,value:`green`};function highlightColors(e){let t={};for(let n of Object.keys(S)){let r=e!==void 0&&e[n]!==void 0?e[n]:S[n],i=typeof r==`string`&&Object.hasOwn(x,r)?x[r]:void 0;if(i===void 0)throw Error(`pretty-format: Option "theme" has a key "${n}" whose value "${r}" is undefined in ansi-styles.`);t[n]={open:`\u001b[${i[0]}m`,close:`\u001b[${i[1]}m`}}return t}const C=highlightColors(void 0),w=/* @__PURE__ */ new Set([`callToJSON`,`compareKeys`,`escapeRegex`,`escapeString`,`highlight`,`indent`,`maxDepth`,`min`,`plugins`,`printBasicPrototype`,`printFunctionName`,`theme`]),T=Symbol(`delegate`),E=/^((HTML|SVG)\w*)?Element$/,D=/* @__PURE__ */ new WeakMap;function isCustomElement(e){let{tagName:t}=e;return!!(typeof t==`string`&&t.includes(`-`)||typeof e.hasAttribute==`function`&&e.hasAttribute(`is`))}function pluginHandles(e){let n=e.node,r=n.constructor,i=r?.name;switch(e.type){case t.ELEMENT_NODE:{if(!i&&!isCustomElement(n))return!1;if(typeof r!=`function`)return E.test(i)||isCustomElement(n);let e=D.get(r);return e===void 0&&D.set(r,e=E.test(i)),e||isCustomElement(n)}case t.TEXT_NODE:return i===`Text`;case t.COMMENT_NODE:return i===`Comment`;case t.DOCUMENT_FRAGMENT_NODE:return i===`DocumentFragment`}return!1}function escapeHTML(e){return e.indexOf(`<`)===-1&&e.indexOf(`>`)===-1?e:e.replace(/</g,`<`).replace(/>/g,`>`)}function printString(e,t){return t.escapeString?`"`+e.replace(/"|\\/g,`\\$&`)+`"`:`"`+e+`"`}function keepChild(e,n){return n.filterNode===null?e.type===t.COMMENT_NODE?!1:e.type===t.ELEMENT_NODE?n.scriptStyleIgnore?e.name!==`script`&&e.name!==`style`:!matchesSelector(e,n.defaultIgnore):!0:!!n.filterNode(e.node)}function tagNameLower(e){return e.node.tagName.toLowerCase()}function printProps(e,t,n){let r=e.attrs;if(r===null||r.length===0)return``;let i=[],a=/* @__PURE__ */ new Map;for(let n=0;n<r.length;n++)t.compact&&isNoiseAttribute(e,r[n].name)||(i.push(r[n].name),a.set(r[n].name,r[n].value));i.sort();let o=t.colors,s=``;for(let e=0;e<i.length;e++){let r=i[e];s+=t.spacingInner+n+o.prop.open+r+o.prop.close+`=`+o.value.open+printString(a.get(r),t)+o.value.close}return s}function isNoiseAttribute(e,n){return n===`class`||n===`style`||e.ns===t.SVG_NS&&n!==`role`&&n!==`id`&&!n.startsWith(`aria-`)&&!n.startsWith(`data-`)}function printChildren(e,n,r,i){if(n.compact&&e.ns===t.SVG_NS&&e.name===`svg`)return``;let a=``;for(let o=e.first;o!==null;o=o.next)keepChild(o,n)&&(n.compact&&o.type===t.TEXT_NODE&&o.data.trim()===``||(a+=n.spacingOuter+r+printNode(o,n,r,i)));return a}function printElement(e,t,n,r,i){let a=r.colors.tag;return a.open+`<`+e+(t&&a.close+t+r.spacingOuter+i+a.open)+(n?`>`+a.close+n+r.spacingOuter+i+a.open+`</`+e:(t&&!r.min?``:` `)+`/`)+`>`+a.close}function printNode(e,n,r,i){if(!pluginHandles(e))throw T;if(e.type===t.TEXT_NODE){let t=n.compact&&e.data.length>200?e.data.slice(0,199)+`…`:e.data;return n.colors.content.open+escapeHTML(t)+n.colors.content.close}if(e.type===t.COMMENT_NODE){let t=n.colors.comment;return t.open+`<!--`+escapeHTML(e.data)+`-->`+t.close}let a=e.type===t.DOCUMENT_FRAGMENT_NODE?`DocumentFragment`:tagNameLower(e),o=n.colors.tag;if(++i>n.maxDepth)return o.open+`<`+a+o.close+` …`+o.open+` />`+o.close;let s=r+n.indent;return printElement(a,e.type===t.DOCUMENT_FRAGMENT_NODE?``:printProps(e,n,s),printChildren(e,n,s,i),n,r)}function printForeignNode(e,n,r,i,a){if(!foreignHandles(e))throw T;if(e.nodeType===t.TEXT_NODE)return n.colors.content.open+escapeHTML(e.data)+n.colors.content.close;if(e.nodeType===t.COMMENT_NODE)return n.colors.comment.open+`<!--`+escapeHTML(e.data)+`-->`+n.colors.comment.close;let o=e.nodeType===t.DOCUMENT_FRAGMENT_NODE,s=o?`DocumentFragment`:e.tagName.toLowerCase(),c=n.colors.tag;if(++a>n.maxDepth)return c.open+`<`+s+c.close+` …`+c.open+` />`+c.close;let l=i+n.indent,u=``;if(!o){let t=Array.from(e.attributes);t.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));for(let{name:e,value:r}of t)u+=n.spacingInner+l+n.colors.prop.open+e+n.colors.prop.close+`=`+n.colors.value.open+printString(r,n)+n.colors.value.close}let d=``,f=e.childNodes||e.children;for(let e=0;e<f.length;e++)r(f[e])&&(d+=n.spacingOuter+l+printForeignNode(f[e],n,r,l,a));return printElement(s,u,d,n,i)}function foreignHandles(e){let n=e?.constructor?.name;if(!n&&!isCustomElement(e))return!1;switch(e.nodeType){case t.ELEMENT_NODE:return E.test(n)||isCustomElement(e);case t.TEXT_NODE:return n===`Text`;case t.COMMENT_NODE:return n===`Comment`;case t.DOCUMENT_FRAGMENT_NODE:return n===`DocumentFragment`}return!1}function makePrintConfig(e,t){for(let t of Object.keys(e))if(!w.has(t))throw Error(`pretty-format: Unknown option "${t}".`);if(e.min&&e.indent!==void 0&&e.indent!==0)throw Error(`pretty-format: Options "min" and "indent" cannot be used together.`);if(e.theme!==void 0){if(e.theme===null)throw Error(`pretty-format: Option "theme" must not be null.`);if(typeof e.theme!=`object`)throw Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof e.theme}".`)}if(e.plugins!==void 0)return null;let n=!!e.min,r=e.indent===void 0?2:e.indent,i=getConfig().defaultIgnore;return{colors:e.highlight?e.theme===void 0?C:highlightColors(e.theme):b,escapeString:e.escapeString===void 0||e.escapeString,indent:n?``:Array(r+1).join(` `),maxDepth:e.maxDepth===void 0?1/0:e.maxDepth,min:n,spacingInner:n?` `:`
|
|
3
|
+
`):n+i}(0,t.setFailureSnapshot)(e=>ariaSnapshot(e,{maxLines:2e3}));function buildTree(e,r){let i=rootImpl(e),a=new SnapshotContext(i,r),o=[],s=``;return!a.includeHidden&&i.type===t.ELEMENT_NODE&&(0,n.isInaccessibleImpl)(i)&&(s=`# hidden from the accessibility tree: ${hiddenReason(i)}\n`,a.includeHidden=!0,a.forceHidden=!0),i.type===t.ELEMENT_NODE&&i!==bodyOf(i)?a.visitElement(i,o,a.forceHidden):a.visitChildren(i,o,!1,!1),finishChildren(o,null),{root:i,ctx:a,children:o,header:s}}function ariaSnapshotTree(e,t={}){return buildTree(e,t).children}function ariaSnapshotLines(e,t={}){let{root:n,ctx:r,children:i,header:a}=buildTree(e,t),o=[];r.renderList(i,``,o);let s=o.length>0?null:r.sawHidden?`# no accessible content (hidden elements exist: pass { hidden: true })`:`# no accessible content`;return n===bodyOf(n)&&envDebugFormat()!==null&&recordBodySnapshot(n.doc,s??o.join(`
|
|
4
|
+
`)),{header:a,lines:o,empty:s}}function budgetLines(e,t){if(e.length<=t)return e;let n=e.length-t,r=e.slice(0,t);return r.push(`# … ${n} more line${n===1?``:`s`} (raise maxLines or CTRL_DOM_DEBUG_LINES)`),r}const d=Symbol.for(`ctrl-dom.agent.lastBodySnapshot`);function recordBodySnapshot(e,t){e!=null&&Object.defineProperty(e,d,{value:t,configurable:!0,writable:!0,enumerable:!1})}function lastBodySnapshot(e){return e?.[d]}function resetBodySnapshot(e){e!=null&&Object.hasOwn(e,d)&&delete e[d]}function rootImpl(e){let n=e??getDocument().body,r=n?.[t.$impl];if(r===void 0)throw TypeError(`Expected an element, document or fragment but got ${n===null?`null`:typeof n}`);if(r.type===t.DOCUMENT_NODE||r.tag===t.T.html&&r.ns===t.HTML_NS){let e=r.doc?.body;return e?e[t.$impl]:r}return r}function bodyOf(e){let n=e.doc?.body;return n?n[t.$impl]:null}function normalizeSpace(e){return e.replace(/[\t\n\f\r ]+/g,` `)}function truncate(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+`…`:e}function quote(e){return JSON.stringify(e)}const f=/^$|^[\s\-?:,[\]{}#&*!|>'"%@`]|[\s]$|:$|: | #|^(true|false|null|yes|no|on|off|~)$|^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;function yamlValue(e){return f.test(e)?quote(e):e}function nodeKey(e,t){let n=e.role;e.name!==``&&(n+=` `+quote(truncate(e.name,t)));for(let t=0;t<e.props.length;t++)n+=` `+e.props[t];return n}function describeElement(e){let n=e.name;if(e.id!==``)return`<${n} id="${e.id}">`;let r=(0,t.attr)(e,`data-testid`);return r===null?`<${n}>`:`<${n} data-testid="${r}">`}function hiddenReason(e){let t=hiddenChainReason(e);return t===``?(0,n.isVisibilityHidden)(e)?`visibility: hidden on ${describeElement(e)}`:``:t}function hiddenChainReason(e){for(let r=e;r!==null&&r.type===t.ELEMENT_NODE;r=r.parent){if(r.ns===t.HTML_NS&&(0,t.attr)(r,`hidden`)!==null)return`hidden attribute on ${describeElement(r)}`;if((0,t.ariaAttr)(r,`aria-hidden`)===`true`)return`aria-hidden="true" on ${describeElement(r)}`;if((0,n.isDisplayNone)(r))return`display: none on ${describeElement(r)}`}return``}const p=/* @__PURE__ */ new Set([``,`generic`,`none`,`presentation`]);function isSkippedTag(e){if(e.ns!==t.HTML_NS)return!1;switch(e.tag){case t.T.script:case t.T.style:case t.T.template:case t.T.noscript:case t.T.head:return!0}return!1}function nodeProps(e,t,r,i){let o=[];if((0,a.roleSupportsProp)(t,`aria-checked`)){let t=(0,n.ariaCheckedState)(e);t===!0?o.push(`[checked]`):t===`mixed`&&o.push(`[checked=mixed]`)}(0,n.isDisabledImpl)(e)&&o.push(`[disabled]`);let s=(0,n.computeAriaExpanded)(e);s===!0?o.push(`[expanded]`):s===!1&&o.push(`[expanded=false]`),r&&o.push(`[active]`);let c=t===`heading`?(0,n.computeHeadingLevel)(e):levelAttr(e);c!==void 0&&o.push(`[level=${c}]`);let l=(0,n.ariaPressedState)(e);l===!0?o.push(`[pressed]`):l===`mixed`?o.push(`[pressed=mixed]`):l===!1&&o.push(`[pressed=false]`),(0,n.computeAriaSelected)(e)===!0&&o.push(`[selected]`);let u=(0,n.computeAriaCurrent)(e);return u===!0?o.push(`[current]`):typeof u==`string`&&u!==``&&o.push(`[current=${u}]`),(0,n.computeAriaBusy)(e)&&o.push(`[busy]`),i&&o.push(`[hidden]`),o}function levelAttr(e){let n=(0,t.ariaAttr)(e,`aria-level`),r=n===null?NaN:Number(n);return r>0?r:void 0}const m=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`spinbutton`,`slider`,`progressbar`,`meter`,`scrollbar`,`separator`]);function nodeValue(e,n){if(!m.has(n))return null;let r=(0,t.ariaAttr)(e,`aria-valuetext`);if(r!==null)return r;let i=(0,t.ariaAttr)(e,`aria-valuenow`);if(i!==null)return i;if(e.ns!==t.HTML_NS)return null;if(e.tag===t.T.input||e.tag===t.T.textarea){let t=String(e.node.value??``);return t===``?null:t}return null}var SnapshotContext=class{includeHidden;forceHidden=!1;sawHidden=!1;maxText;collapseAfter;urls;active;constructor(e,n){this.includeHidden=n.hidden===!0,this.maxText=n.maxTextLength??100,this.collapseAfter=n.collapseAfter??5,this.urls=n.urls===!0;let r=e.doc?.activeElement,i=r?r[t.$impl]??null:null;this.active=i!==null&&i===bodyOf(e)?null:i}visitChildren(e,n,r,i){for(let a=e.first;a!==null;a=a.next)a.type===t.TEXT_NODE?i||appendText(n,a.data):a.type===t.ELEMENT_NODE?this.visitElement(a,n,r):a.type===t.DOCUMENT_FRAGMENT_NODE&&this.visitChildren(a,n,r,i)}visitElement(e,r,i){if(isSkippedTag(e))return;let a=i;if(!a&&(0,n.isSubtreeInaccessibleImpl)(e)){if(this.sawHidden=!0,!this.includeHidden)return;a=!0}let o=a;if(!a&&(0,n.isVisibilityHidden)(e)){if(this.sawHidden=!0,!this.includeHidden){this.visitChildren(e,r,!1,!0);return}o=!0}let s=(0,n.tlRole)(e);if(p.has(s)){let t=!(0,n.isDisplayInline)(e);t&&appendBreak(r),this.visitChildren(e,r,a,!1),t&&appendBreak(r);return}let c={role:s,name:normalizeSpace((0,n.computeAccessibleNameImpl)(e,void 0,5)).trim(),props:nodeProps(e,s,e===this.active,o&&this.includeHidden),value:nodeValue(e,s),url:null,children:[],element:e};this.urls&&s===`link`&&(c.url=(0,t.attr)(e,`href`)),(e.ns!==t.HTML_NS||e.tag!==t.T.textarea)&&this.visitChildren(e,c.children,a,!1),finishChildren(c.children,c.name),r.push(c)}renderList(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(typeof i==`string`){n.push(`${t}- text: ${yamlValue(truncate(i,this.maxText))}`);continue}let a=1;for(;r+a<e.length&&typeof e[r+a]!=`string`&&e[r+a].role===i.role;)a++;if(a>this.collapseAfter+1){for(let i=0;i<this.collapseAfter;i++)this.renderNode(e[r+i],t,n);n.push(`${t}- ${i.role} … (+${a-this.collapseAfter} more)`),r+=a-1}else this.renderNode(i,t,n)}}renderNode(e,t,n){let r=nodeKey(e,this.maxText),i=e.children;if(e.url===null&&(i.length===0||i.length===1&&typeof i[0]==`string`&&e.value===null)){let a=e.value??(i.length===1?i[0]:null);n.push(a===null?`${t}- ${r}`:`${t}- ${r}: ${yamlValue(truncate(a,this.maxText))}`);return}n.push(e.value===null?`${t}- ${r}:`:`${t}- ${r}: ${yamlValue(truncate(e.value,this.maxText))}`);let a=t+` `;e.url!==null&&n.push(`${a}- /url: ${yamlValue(e.url)}`),this.renderList(i,a,n)}};function appendText(e,t){if(t===``)return;let n=e.length-1;n>=0&&typeof e[n]==`string`&&e[n]!==`\0`?e[n]=e[n]+t:e.push(t)}function appendBreak(e){let t=e.length-1;t>=0&&typeof e[t]==`string`&&e[t]!==`\0`&&e.push(`\0`)}function finishChildren(e,t){let n=0;for(let t=0;t<e.length;t++){let r=e[t];typeof r==`string`&&(r===`\0`||(r=normalizeSpace(r).trim(),r===``))||(e[n++]=r)}e.length=n,e.length>0&&typeof e[0]==`string`&&e[0]===t&&e.splice(0,1),n=0;for(let t=0;t<e.length;t++){let r=e[t];(typeof r!=`string`||!labels(e[t-1],r)&&!labels(e[t+1],r))&&(e[n++]=r)}e.length=n}const h=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`slider`,`spinbutton`,`meter`,`progressbar`]);function labels(e,t){return e!==void 0&&typeof e!=`string`&&e.name===t&&h.has(e.role)}let g=null;function loadPrettyFormat(e){if(g!==null)return g;try{return g=(0,r.createRequire)(require("url").pathToFileURL(__filename).href)(`pretty-format`)}catch(t){throw Error(`${e} needs pretty-format, which @ctrl/dom does not install: add pretty-format@27 to the project's devDependencies.`,{cause:t})}}const _=`The prettyFormat export`,v=Object.defineProperties({},{format:{enumerable:!0,get:()=>loadPrettyFormat(_).format},default:{enumerable:!0,get:()=>loadPrettyFormat(_).default},plugins:{enumerable:!0,get:()=>loadPrettyFormat(_).plugins},DEFAULT_OPTIONS:{enumerable:!0,get:()=>loadPrettyFormat(_).DEFAULT_OPTIONS}}),shouldHighlight=()=>{if(typeof process>`u`)return!1;let e;try{let t=process.env?.COLORS;t&&(e=JSON.parse(t))}catch{}return typeof e==`boolean`?e:process.versions!==void 0&&process.versions.node!==void 0};function filterCommentsAndDefaultIgnoreTagsTags(e){return e.nodeType!==t.COMMENT_NODE&&(e.nodeType!==t.ELEMENT_NODE||!e.matches(getConfig().defaultIgnore))}const y={open:``,close:``},b={comment:y,content:y,prop:y,tag:y,value:y},x={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],gray:[90,39],grey:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49],bgGray:[100,49],bgGrey:[100,49]},S={comment:`gray`,content:`reset`,prop:`yellow`,tag:`cyan`,value:`green`};function highlightColors(e){let t={};for(let n of Object.keys(S)){let r=e!==void 0&&e[n]!==void 0?e[n]:S[n],i=typeof r==`string`&&Object.hasOwn(x,r)?x[r]:void 0;if(i===void 0)throw Error(`pretty-format: Option "theme" has a key "${n}" whose value "${r}" is undefined in ansi-styles.`);t[n]={open:`\u001b[${i[0]}m`,close:`\u001b[${i[1]}m`}}return t}const C=highlightColors(void 0),w=/* @__PURE__ */ new Set([`callToJSON`,`compareKeys`,`escapeRegex`,`escapeString`,`highlight`,`indent`,`maxDepth`,`min`,`plugins`,`printBasicPrototype`,`printFunctionName`,`theme`]),T=Symbol(`delegate`),E=/^((HTML|SVG)\w*)?Element$/,D=/* @__PURE__ */ new WeakMap;function isCustomElement(e){let{tagName:t}=e;return!!(typeof t==`string`&&t.includes(`-`)||typeof e.hasAttribute==`function`&&e.hasAttribute(`is`))}function pluginHandles(e){let n=e.node,r=n.constructor,i=r?.name;switch(e.type){case t.ELEMENT_NODE:{if(!i&&!isCustomElement(n))return!1;if(typeof r!=`function`)return E.test(i)||isCustomElement(n);let e=D.get(r);return e===void 0&&D.set(r,e=E.test(i)),e||isCustomElement(n)}case t.TEXT_NODE:return i===`Text`;case t.COMMENT_NODE:return i===`Comment`;case t.DOCUMENT_FRAGMENT_NODE:return i===`DocumentFragment`}return!1}function escapeHTML(e){return e.indexOf(`<`)===-1&&e.indexOf(`>`)===-1?e:e.replace(/</g,`<`).replace(/>/g,`>`)}function printString(e,t){return t.escapeString?`"`+e.replace(/"|\\/g,`\\$&`)+`"`:`"`+e+`"`}function keepChild(e,n){return n.filterNode===null?e.type===t.COMMENT_NODE?!1:e.type===t.ELEMENT_NODE?n.scriptStyleIgnore?e.name!==`script`&&e.name!==`style`:!matchesSelector(e,n.defaultIgnore):!0:!!n.filterNode(e.node)}function tagNameLower(e){return e.node.tagName.toLowerCase()}function printProps(e,t,n){let r=e.attrs;if(r===null||r.length===0)return``;let i=[],a=/* @__PURE__ */ new Map;for(let n=0;n<r.length;n++)t.compact&&isNoiseAttribute(e,r[n].name)||(i.push(r[n].name),a.set(r[n].name,r[n].value));i.sort();let o=t.colors,s=``;for(let e=0;e<i.length;e++){let r=i[e];s+=t.spacingInner+n+o.prop.open+r+o.prop.close+`=`+o.value.open+printString(a.get(r),t)+o.value.close}return s}function isNoiseAttribute(e,n){return n===`class`||n===`style`||e.ns===t.SVG_NS&&n!==`role`&&n!==`id`&&!n.startsWith(`aria-`)&&!n.startsWith(`data-`)}function printChildren(e,n,r,i){if(n.compact&&e.ns===t.SVG_NS&&e.name===`svg`)return``;let a=``;for(let o=e.first;o!==null;o=o.next)keepChild(o,n)&&(n.compact&&o.type===t.TEXT_NODE&&o.data.trim()===``||(a+=n.spacingOuter+r+printNode(o,n,r,i)));return a}function printElement(e,t,n,r,i){let a=r.colors.tag;return a.open+`<`+e+(t&&a.close+t+r.spacingOuter+i+a.open)+(n?`>`+a.close+n+r.spacingOuter+i+a.open+`</`+e:(t&&!r.min?``:` `)+`/`)+`>`+a.close}function printNode(e,n,r,i){if(!pluginHandles(e))throw T;if(e.type===t.TEXT_NODE){let t=n.compact&&e.data.length>200?e.data.slice(0,199)+`…`:e.data;return n.colors.content.open+escapeHTML(t)+n.colors.content.close}if(e.type===t.COMMENT_NODE){let t=n.colors.comment;return t.open+`<!--`+escapeHTML(e.data)+`-->`+t.close}let a=e.type===t.DOCUMENT_FRAGMENT_NODE?`DocumentFragment`:tagNameLower(e),o=n.colors.tag;if(++i>n.maxDepth)return o.open+`<`+a+o.close+` …`+o.open+` />`+o.close;let s=r+n.indent;return printElement(a,e.type===t.DOCUMENT_FRAGMENT_NODE?``:printProps(e,n,s),printChildren(e,n,s,i),n,r)}function printForeignNode(e,n,r,i,a){if(!foreignHandles(e))throw T;if(e.nodeType===t.TEXT_NODE)return n.colors.content.open+escapeHTML(e.data)+n.colors.content.close;if(e.nodeType===t.COMMENT_NODE)return n.colors.comment.open+`<!--`+escapeHTML(e.data)+`-->`+n.colors.comment.close;let o=e.nodeType===t.DOCUMENT_FRAGMENT_NODE,s=o?`DocumentFragment`:e.tagName.toLowerCase(),c=n.colors.tag;if(++a>n.maxDepth)return c.open+`<`+s+c.close+` …`+c.open+` />`+c.close;let l=i+n.indent,u=``;if(!o){let t=Array.from(e.attributes);t.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));for(let{name:e,value:r}of t)u+=n.spacingInner+l+n.colors.prop.open+e+n.colors.prop.close+`=`+n.colors.value.open+printString(r,n)+n.colors.value.close}let d=``,f=e.childNodes||e.children;for(let e=0;e<f.length;e++)r(f[e])&&(d+=n.spacingOuter+l+printForeignNode(f[e],n,r,l,a));return printElement(s,u,d,n,i)}function foreignHandles(e){let n=e?.constructor?.name;if(!n&&!isCustomElement(e))return!1;switch(e.nodeType){case t.ELEMENT_NODE:return E.test(n)||isCustomElement(e);case t.TEXT_NODE:return n===`Text`;case t.COMMENT_NODE:return n===`Comment`;case t.DOCUMENT_FRAGMENT_NODE:return n===`DocumentFragment`}return!1}function makePrintConfig(e,t){for(let t of Object.keys(e))if(!w.has(t))throw Error(`pretty-format: Unknown option "${t}".`);if(e.min&&e.indent!==void 0&&e.indent!==0)throw Error(`pretty-format: Options "min" and "indent" cannot be used together.`);if(e.theme!==void 0){if(e.theme===null)throw Error(`pretty-format: Option "theme" must not be null.`);if(typeof e.theme!=`object`)throw Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof e.theme}".`)}if(e.plugins!==void 0)return null;let n=!!e.min,r=e.indent===void 0?2:e.indent,i=getConfig().defaultIgnore;return{colors:e.highlight?e.theme===void 0?C:highlightColors(e.theme):b,escapeString:e.escapeString===void 0||e.escapeString,indent:n?``:Array(r+1).join(` `),maxDepth:e.maxDepth===void 0?1/0:e.maxDepth,min:n,spacingInner:n?` `:`
|
|
5
5
|
`,spacingOuter:n?``:`
|
|
6
6
|
`,filterNode:t,scriptStyleIgnore:i===`script, style`,defaultIgnore:i,compact:!1}}function formatDOM(e,n,r,i=!1){let a={printFunctionName:!1,highlight:shouldHighlight(),...r},o=n??filterCommentsAndDefaultIgnoreTagsTags,s=makePrintConfig(a,n===void 0?null:n);if(s===null)return formatWithPrettyFormat(e,o,a,`The "plugins" option of prettyDOM`);s.compact=i;let c=e[t.$impl];try{return c===void 0?printForeignNode(e,s,o,``,0):printNode(c,s,``,0)}catch(e){if(e!==T)throw e}return formatWithPrettyFormat(e,o,a,`Printing a node other than an element, text, comment or fragment`)}function formatWithPrettyFormat(e,t,n,r=`pretty-format's own printing`){let i=loadPrettyFormat(r);return i.format(e,{plugins:[createDOMElementFilter(t),i.plugins.DOMCollection],...n})}function prettyDOM(e,t,n={}){e||=getDocument().body;let r=typeof t==`number`?t:void 0;if(typeof t!=`number`&&(t=typeof process<`u`&&process.env!==void 0&&process.env.DEBUG_PRINT_LIMIT||7e3),t===0)return``;e.documentElement&&(e=e.documentElement);let i=typeof e;if(i===`object`?i=e.constructor.name:e={},!(`outerHTML`in e))throw TypeError(`Expected an element or document but got ${i}`);let a=n.format??envDebugFormat();if(a!==null||`format`in n){let{format:i,hidden:o,maxLines:s,maxTextLength:c,collapseAfter:l,urls:u,...d}=n;if(a===`aria`){let t=ariaSnapshot(e,{hidden:o,maxLines:s,maxTextLength:c,collapseAfter:l,urls:u});return r!==void 0&&t.length>r?`${t.slice(0,r)}...`:t}if(n=d,a===`compact`){let{filterNode:r,...i}={highlight:!1,...n},a=formatDOM(e,r,i,!0);return a.length>t?`${a.slice(0,t)}...`:a}}let{filterNode:o,...s}=n,c=formatDOM(e,o,s);return t!==void 0&&outerHTMLLength(e)>t?`${c.slice(0,t)}...`:c}function outerHTMLLength(e){let n=e[t.$impl];return n!==void 0&&n.type===t.ELEMENT_NODE?(0,t.serializeNode)(n).length:e.outerHTML.length}const logDOM=(...e)=>{let t=getUserCodeFrame();console.log(t?`${prettyDOM(...e)}\n\n${t}`:prettyDOM(...e))};function createDOMElementFilter(e){let printPropsPF=(e,t,n,r,i,a,o)=>{let s=r+n.indent,c=n.colors;return e.map(e=>{let l=t[e],u=o(l,n,s,i,a);return typeof l!=`string`&&(u.indexOf(`
|
|
7
7
|
`)!==-1&&(u=n.spacingOuter+s+u+n.spacingOuter+r),u=`{`+u+`}`),n.spacingInner+r+c.prop.open+e+c.prop.close+`=`+c.value.open+u+c.value.close}).join(``)},printText=(e,t)=>t.colors.content.open+escapeHTML(e)+t.colors.content.close,printChildrenPF=(e,n,r,i,a,o)=>e.map(e=>{let s=typeof e==`string`?printText(e,n):o(e,n,r,i,a);return s===``&&typeof e==`object`&&e&&e.nodeType!==t.TEXT_NODE?``:n.spacingOuter+r+s}).join(``),testNode=e=>{let n=e.constructor.name,{nodeType:r}=e;return r===t.ELEMENT_NODE&&(E.test(n)||isCustomElement(e))||r===t.TEXT_NODE&&n===`Text`||r===t.COMMENT_NODE&&n===`Comment`||r===t.DOCUMENT_FRAGMENT_NODE&&n===`DocumentFragment`};return{test:e=>(e?.constructor?.name||isCustomElement(e))&&testNode(e),serialize:(n,r,i,a,o,s)=>{if(n.nodeType===t.TEXT_NODE)return printText(n.data,r);if(n.nodeType===t.COMMENT_NODE){let e=r.colors.comment;return e.open+`<!--`+escapeHTML(n.data)+`-->`+e.close}let c=n.nodeType===t.DOCUMENT_FRAGMENT_NODE,l=c?`DocumentFragment`:n.tagName.toLowerCase();if(++a>r.maxDepth){let e=r.colors.tag;return e.open+`<`+l+e.close+` …`+e.open+` />`+e.close}return printElement(l,printPropsPF(c?[]:Array.from(n.attributes).map(e=>e.name).sort(),c?{}:Array.from(n.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),r,i+r.indent,a,o,s),printChildrenPF(Array.prototype.slice.call(n.childNodes||n.children).filter(e),r,i+r.indent,a,o,s),r,i)}}}let O={testIdAttribute:`data-testid`,asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:`script, style`,showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){let n=envDebugFormat();if(n!==null){let r=Error([e,agentErrorContext(t,n,prettyDOM)].filter(Boolean).join(`
|
|
8
8
|
|
|
9
|
-
`));return r.name=`TestingLibraryElementError`,r}let r=prettyDOM(t),i=Error([e,`Ignored nodes: comments, ${O.defaultIgnore}\n${r}`].filter(Boolean).join(`
|
|
9
|
+
`));return r.name=`TestingLibraryElementError`,r}if(k)return lazyElementError(e,t,O.defaultIgnore);let r=prettyDOM(t),i=Error([e,`Ignored nodes: comments, ${O.defaultIgnore}\n${r}`].filter(Boolean).join(`
|
|
10
10
|
|
|
11
|
-
`));return i.name=`TestingLibraryElementError`,i},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1};function
|
|
11
|
+
`));return i.name=`TestingLibraryElementError`,i},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1},k=!1;function lazyElementError(e,t,n){let r=/* @__PURE__ */ Error();r.name=`TestingLibraryElementError`;let settle=e=>(Object.defineProperty(r,"message",{value:e,writable:!0,enumerable:!1,configurable:!0}),e);return Object.defineProperty(r,"message",{get:()=>settle([e,`Ignored nodes: comments, ${n}\n${prettyDOM(t)}`].filter(Boolean).join(`
|
|
12
|
+
|
|
13
|
+
`)),set:settle,enumerable:!1,configurable:!0}),r}function runWithExpensiveErrorDiagnosticsDisabled(e,t=!1){let n=k;try{return O._disableExpensiveErrorDiagnostics=!0,k=t,e()}finally{O._disableExpensiveErrorDiagnostics=!1,k=n}}function configure(e){typeof e==`function`&&(e=e(O)),O={...O,...e}}function getConfig(){return O}function diffAriaSnapshots(e,t){let n=diffLines(e.split(`
|
|
12
14
|
`),t.split(`
|
|
13
15
|
`)),r=new Uint8Array(n.length),i=!1;for(let e=0;e<n.length;e++){if(n[e].kind===`=`)continue;i=!0,r[e]=1;let t=indentOf(n[e].text);for(let i=e-1;i>=0&&t>0;i--){if(n[i].kind!==`=`)continue;let e=indentOf(n[i].text);e<t&&(r[i]=1,t=e)}}if(!i)return`(no changes)`;let a=[],o=-1;for(let e=0;e<n.length;e++)r[e]!==0&&(o!==-1&&e!==o+1&&a.push(` …`),a.push(`${n[e].kind===`=`?` `:n[e].kind} ${n[e].text}`),o=e);return a.join(`
|
|
14
|
-
`)}function indentOf(e){let t=0;for(;t<e.length&&e.charCodeAt(t)===32;)t++;return t}function diffLines(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let r=e.length,i=t.length;for(;r>n&&i>n&&e[r-1]===t[i-1];)r--,i--;let a=[];for(let t=0;t<n;t++)a.push({kind:`=`,text:e[t]});let o=r-n,s=i-n;if(o*s>4e6){for(let t=n;t<r;t++)a.push({kind:`-`,text:e[t]});for(let e=n;e<i;e++)a.push({kind:`+`,text:t[e]})}else{let r=s+1,i=new Uint32Array((o+1)*r);for(let a=o-1;a>=0;a--)for(let o=s-1;o>=0;o--)i[a*r+o]=e[n+a]===t[n+o]?i[(a+1)*r+o+1]+1:Math.max(i[(a+1)*r+o],i[a*r+o+1]);let c=0,l=0;for(;c<o||l<s;)c<o&&l<s&&e[n+c]===t[n+l]?(a.push({kind:`=`,text:e[n+c]}),c++,l++):c<o&&(l===s||i[(c+1)*r+l]>=i[c*r+l+1])?(a.push({kind:`-`,text:e[n+c]}),c++):(a.push({kind:`+`,text:t[n+l]}),l++)}for(let t=r;t<e.length;t++)a.push({kind:`=`,text:e[t]});return a}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return implOf}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return agentElementSummary}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return checkContainerType}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return advanceFakeTimersByTime}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return
|
|
16
|
+
`)}function indentOf(e){let t=0;for(;t<e.length&&e.charCodeAt(t)===32;)t++;return t}function diffLines(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let r=e.length,i=t.length;for(;r>n&&i>n&&e[r-1]===t[i-1];)r--,i--;let a=[];for(let t=0;t<n;t++)a.push({kind:`=`,text:e[t]});let o=r-n,s=i-n;if(o*s>4e6){for(let t=n;t<r;t++)a.push({kind:`-`,text:e[t]});for(let e=n;e<i;e++)a.push({kind:`+`,text:t[e]})}else{let r=s+1,i=new Uint32Array((o+1)*r);for(let a=o-1;a>=0;a--)for(let o=s-1;o>=0;o--)i[a*r+o]=e[n+a]===t[n+o]?i[(a+1)*r+o+1]+1:Math.max(i[(a+1)*r+o],i[a*r+o+1]);let c=0,l=0;for(;c<o||l<s;)c<o&&l<s&&e[n+c]===t[n+l]?(a.push({kind:`=`,text:e[n+c]}),c++,l++):c<o&&(l===s||i[(c+1)*r+l]>=i[c*r+l+1])?(a.push({kind:`-`,text:e[n+c]}),c++):(a.push({kind:`+`,text:t[n+l]}),l++)}for(let t=r;t<e.length;t++)a.push({kind:`=`,text:e[t]});return a}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return implOf}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return agentElementSummary}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return checkContainerType}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return advanceFakeTimersByTime}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return __name}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return getDocument}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return yamlValue}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return matchesSelector}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return nodeKey}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return runWithExpensiveErrorDiagnosticsDisabled}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return resetBodySnapshot}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return ariaSnapshotTree}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return budgetLines}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return lastBodySnapshot}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return hiddenReason}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return getConfig}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return jestFakeTimersAreEnabled}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return getWindowFromNode}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return ariaSnapshot}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return envMaxLines}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return diffLines}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return logDOM}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return describeElement}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return configure}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return prettyDOM}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return diffAriaSnapshots}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ariaSnapshotLines}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return nodeProps}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return envDebugFormat}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return truncate}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return quote}});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{$impl as t,COMMENT_NODE as n,DOCUMENT_FRAGMENT_NODE as r,DOCUMENT_NODE as i,ELEMENT_NODE as a,HTML_NS as o,SVG_NS as s,T as c,TEXT_NODE as l,ariaAttr as u,attr as d,matches as f,serializeNode as p,setFailureSnapshot as m}from"@ctrl/dom/internal";import{ariaCheckedState as h,ariaPressedState as g,computeAccessibleNameImpl as _,computeAriaBusy as v,computeAriaCurrent as y,computeAriaExpanded as b,computeAriaSelected as x,computeHeadingLevel as ee,isDisabledImpl as te,isDisplayInline as ne,isDisplayNone as S,isInaccessibleImpl as C,isSubtreeInaccessibleImpl as w,isVisibilityHidden as T,tlRole as E}from"@ctrl/dom/aria/internal";import{readFileSync as D}from"node:fs";import{roleSupportsProp as O}from"@ctrl/dom/aria";var k=Object.defineProperty,__name=(e,t)=>k(e,`name`,{value:t,configurable:!0});const A=new URL(`./`,import.meta.url).pathname;let j=null;const M=process.env,N=process.argv,P=!(M.NO_COLOR||N.includes(`--no-color`))&&(!!M.FORCE_COLOR||N.includes(`--color`)||process.platform===`win32`||process.stdout?.isTTY&&M.TERM!==`dumb`||!!M.CI);function dim(e){return P?`\x1b[2m${e}\x1b[22m`:e}function getCodeFrame(t){j??=e(import.meta.url)(`@babel/code-frame`).codeFrameColumns;let n=t.indexOf(`(`)+1,r=t.indexOf(`)`),i=t.slice(n,r),a=i.split(`:`),[o,s,c]=[a[0],parseInt(a[1],10),parseInt(a[2],10)],l=``;try{l=D(o,`utf-8`)}catch{return``}let u=j(l,{start:{line:s,column:c-1}},{highlightCode:!0,linesBelow:0});return`${dim(i)}\n${u}\n`}function getUserCodeFrame(){return getCodeFrame((/* @__PURE__ */ Error()).stack.split(`
|
|
2
|
+
`).slice(1).find(e=>!e.includes(`node_modules/`)&&!e.includes(A)))}function jestFakeTimersAreEnabled(){if(typeof jest<`u`&&jest!==null)return setTimeout._isMockFunction===!0||Object.hasOwn(setTimeout,`clock`);let e=setTimeout.clock;return e!=null&&typeof e.tick==`function`}function advanceFakeTimersByTime(e){if(typeof jest<`u`&&jest!==null){jest.advanceTimersByTime(e);return}let t=globalThis.vi;t!=null&&typeof t.advanceTimersByTime==`function`&&typeof t.isFakeTimers==`function`&&t.isFakeTimers()?t.advanceTimersByTime(e):setTimeout.clock.tick(e)}function getDocument(){if(typeof window>`u`)throw Error(`Could not find default container`);return window.document}function getWindowFromNode(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&e.ownerDocument.defaultView===null?Error(`It looks like the window object is not available for the provided node.`):e.then instanceof Function?Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):typeof e.debug==`function`&&typeof e.logTestingPlaygroundURL==`function`?Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):Error(`The given node is not an Element, the node type is: ${typeof e}.`)}function checkContainerType(e){if(!e||typeof e.querySelector!=`function`||typeof e.querySelectorAll!=`function`)throw TypeError(`Expected container to be an Element, a Document or a DocumentFragment but got ${getTypeName(e)}.`)}function getTypeName(e){return typeof e==`object`?e===null?`null`:e.constructor.name:typeof e}function implOf(e){let n=e[t];if(n===void 0)throw TypeError(`@ctrl/dom/testing-library requires nodes created by @ctrl/dom.`);return n}function matchesSelector(e,t){return e.type===a&&f(e,t)}function envDebugFormat(){let e=typeof process<`u`?process.env?.CTRL_DOM_DEBUG:void 0;if(e===void 0||e===``)return null;let t=String(e).trim().toLowerCase();return t===`aria`?`aria`:t===`compact`||t===`html`?`compact`:null}function containerLabel(e){let n=e?.[t];return n===void 0?`the container`:n.type===9?`the document`:describeElement(n)}function agentErrorContext(e,t,n){return t===`aria`?`Accessibility snapshot of ${containerLabel(e)} (CTRL_DOM_DEBUG=aria):\n${ariaSnapshot(e,{maxLines:envMaxLines()??100})}`:`DOM of ${containerLabel(e)} without class/style/SVG internals (CTRL_DOM_DEBUG=compact):\n${n(e,void 0,{format:`compact`})}`}function agentElementSummary(e){return ariaSnapshot(e,{maxLines:12})}function envMaxLines(){let e=typeof process<`u`?process.env?.CTRL_DOM_DEBUG_LINES:void 0,t=e?Number(e):NaN;return t>0?t:void 0}function ariaSnapshot(e,t={}){let{header:n,lines:r,empty:i}=ariaSnapshotLines(e,t);return i===null?n+budgetLines(r,t.maxLines??envMaxLines()??200).join(`
|
|
3
|
+
`):n+i}m(e=>ariaSnapshot(e,{maxLines:2e3}));function buildTree(e,t){let n=rootImpl(e),r=new SnapshotContext(n,t),i=[],o=``;return!r.includeHidden&&n.type===a&&C(n)&&(o=`# hidden from the accessibility tree: ${hiddenReason(n)}\n`,r.includeHidden=!0,r.forceHidden=!0),n.type===a&&n!==bodyOf(n)?r.visitElement(n,i,r.forceHidden):r.visitChildren(n,i,!1,!1),finishChildren(i,null),{root:n,ctx:r,children:i,header:o}}function ariaSnapshotTree(e,t={}){return buildTree(e,t).children}function ariaSnapshotLines(e,t={}){let{root:n,ctx:r,children:i,header:a}=buildTree(e,t),o=[];r.renderList(i,``,o);let s=o.length>0?null:r.sawHidden?`# no accessible content (hidden elements exist: pass { hidden: true })`:`# no accessible content`;return n===bodyOf(n)&&envDebugFormat()!==null&&recordBodySnapshot(n.doc,s??o.join(`
|
|
4
|
+
`)),{header:a,lines:o,empty:s}}function budgetLines(e,t){if(e.length<=t)return e;let n=e.length-t,r=e.slice(0,t);return r.push(`# … ${n} more line${n===1?``:`s`} (raise maxLines or CTRL_DOM_DEBUG_LINES)`),r}const F=Symbol.for(`ctrl-dom.agent.lastBodySnapshot`);function recordBodySnapshot(e,t){e!=null&&Object.defineProperty(e,F,{value:t,configurable:!0,writable:!0,enumerable:!1})}function lastBodySnapshot(e){return e?.[F]}function resetBodySnapshot(e){e!=null&&Object.hasOwn(e,F)&&delete e[F]}function rootImpl(e){let n=e??getDocument().body,r=n?.[t];if(r===void 0)throw TypeError(`Expected an element, document or fragment but got ${n===null?`null`:typeof n}`);if(r.type===i||r.tag===c.html&&r.ns===o){let e=r.doc?.body;return e?e[t]:r}return r}function bodyOf(e){let n=e.doc?.body;return n?n[t]:null}function normalizeSpace(e){return e.replace(/[\t\n\f\r ]+/g,` `)}function truncate(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+`…`:e}function quote(e){return JSON.stringify(e)}const I=/^$|^[\s\-?:,[\]{}#&*!|>'"%@`]|[\s]$|:$|: | #|^(true|false|null|yes|no|on|off|~)$|^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;function yamlValue(e){return I.test(e)?quote(e):e}function nodeKey(e,t){let n=e.role;e.name!==``&&(n+=` `+quote(truncate(e.name,t)));for(let t=0;t<e.props.length;t++)n+=` `+e.props[t];return n}function describeElement(e){let t=e.name;if(e.id!==``)return`<${t} id="${e.id}">`;let n=d(e,`data-testid`);return n===null?`<${t}>`:`<${t} data-testid="${n}">`}function hiddenReason(e){let t=hiddenChainReason(e);return t===``?T(e)?`visibility: hidden on ${describeElement(e)}`:``:t}function hiddenChainReason(e){for(let t=e;t!==null&&t.type===a;t=t.parent){if(t.ns===o&&d(t,`hidden`)!==null)return`hidden attribute on ${describeElement(t)}`;if(u(t,`aria-hidden`)===`true`)return`aria-hidden="true" on ${describeElement(t)}`;if(S(t))return`display: none on ${describeElement(t)}`}return``}const L=/* @__PURE__ */ new Set([``,`generic`,`none`,`presentation`]);function isSkippedTag(e){if(e.ns!==o)return!1;switch(e.tag){case c.script:case c.style:case c.template:case c.noscript:case c.head:return!0}return!1}function nodeProps(e,t,n,r){let i=[];if(O(t,`aria-checked`)){let t=h(e);t===!0?i.push(`[checked]`):t===`mixed`&&i.push(`[checked=mixed]`)}te(e)&&i.push(`[disabled]`);let a=b(e);a===!0?i.push(`[expanded]`):a===!1&&i.push(`[expanded=false]`),n&&i.push(`[active]`);let o=t===`heading`?ee(e):levelAttr(e);o!==void 0&&i.push(`[level=${o}]`);let s=g(e);s===!0?i.push(`[pressed]`):s===`mixed`?i.push(`[pressed=mixed]`):s===!1&&i.push(`[pressed=false]`),x(e)===!0&&i.push(`[selected]`);let c=y(e);return c===!0?i.push(`[current]`):typeof c==`string`&&c!==``&&i.push(`[current=${c}]`),v(e)&&i.push(`[busy]`),r&&i.push(`[hidden]`),i}function levelAttr(e){let t=u(e,`aria-level`),n=t===null?NaN:Number(t);return n>0?n:void 0}const R=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`spinbutton`,`slider`,`progressbar`,`meter`,`scrollbar`,`separator`]);function nodeValue(e,t){if(!R.has(t))return null;let n=u(e,`aria-valuetext`);if(n!==null)return n;let r=u(e,`aria-valuenow`);if(r!==null)return r;if(e.ns!==o)return null;if(e.tag===c.input||e.tag===c.textarea){let t=String(e.node.value??``);return t===``?null:t}return null}var SnapshotContext=class{includeHidden;forceHidden=!1;sawHidden=!1;maxText;collapseAfter;urls;active;constructor(e,n){this.includeHidden=n.hidden===!0,this.maxText=n.maxTextLength??100,this.collapseAfter=n.collapseAfter??5,this.urls=n.urls===!0;let r=e.doc?.activeElement,i=r?r[t]??null:null;this.active=i!==null&&i===bodyOf(e)?null:i}visitChildren(e,t,n,i){for(let o=e.first;o!==null;o=o.next)o.type===l?i||appendText(t,o.data):o.type===a?this.visitElement(o,t,n):o.type===r&&this.visitChildren(o,t,n,i)}visitElement(e,t,n){if(isSkippedTag(e))return;let r=n;if(!r&&w(e)){if(this.sawHidden=!0,!this.includeHidden)return;r=!0}let i=r;if(!r&&T(e)){if(this.sawHidden=!0,!this.includeHidden){this.visitChildren(e,t,!1,!0);return}i=!0}let a=E(e);if(L.has(a)){let n=!ne(e);n&&appendBreak(t),this.visitChildren(e,t,r,!1),n&&appendBreak(t);return}let s={role:a,name:normalizeSpace(_(e,void 0,5)).trim(),props:nodeProps(e,a,e===this.active,i&&this.includeHidden),value:nodeValue(e,a),url:null,children:[],element:e};this.urls&&a===`link`&&(s.url=d(e,`href`)),(e.ns!==o||e.tag!==c.textarea)&&this.visitChildren(e,s.children,r,!1),finishChildren(s.children,s.name),t.push(s)}renderList(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];if(typeof i==`string`){n.push(`${t}- text: ${yamlValue(truncate(i,this.maxText))}`);continue}let a=1;for(;r+a<e.length&&typeof e[r+a]!=`string`&&e[r+a].role===i.role;)a++;if(a>this.collapseAfter+1){for(let i=0;i<this.collapseAfter;i++)this.renderNode(e[r+i],t,n);n.push(`${t}- ${i.role} … (+${a-this.collapseAfter} more)`),r+=a-1}else this.renderNode(i,t,n)}}renderNode(e,t,n){let r=nodeKey(e,this.maxText),i=e.children;if(e.url===null&&(i.length===0||i.length===1&&typeof i[0]==`string`&&e.value===null)){let a=e.value??(i.length===1?i[0]:null);n.push(a===null?`${t}- ${r}`:`${t}- ${r}: ${yamlValue(truncate(a,this.maxText))}`);return}n.push(e.value===null?`${t}- ${r}:`:`${t}- ${r}: ${yamlValue(truncate(e.value,this.maxText))}`);let a=t+` `;e.url!==null&&n.push(`${a}- /url: ${yamlValue(e.url)}`),this.renderList(i,a,n)}};function appendText(e,t){if(t===``)return;let n=e.length-1;n>=0&&typeof e[n]==`string`&&e[n]!==`\0`?e[n]=e[n]+t:e.push(t)}function appendBreak(e){let t=e.length-1;t>=0&&typeof e[t]==`string`&&e[t]!==`\0`&&e.push(`\0`)}function finishChildren(e,t){let n=0;for(let t=0;t<e.length;t++){let r=e[t];typeof r==`string`&&(r===`\0`||(r=normalizeSpace(r).trim(),r===``))||(e[n++]=r)}e.length=n,e.length>0&&typeof e[0]==`string`&&e[0]===t&&e.splice(0,1),n=0;for(let t=0;t<e.length;t++){let r=e[t];(typeof r!=`string`||!labels(e[t-1],r)&&!labels(e[t+1],r))&&(e[n++]=r)}e.length=n}const z=/* @__PURE__ */ new Set([`textbox`,`searchbox`,`combobox`,`listbox`,`checkbox`,`radio`,`switch`,`slider`,`spinbutton`,`meter`,`progressbar`]);function labels(e,t){return e!==void 0&&typeof e!=`string`&&e.name===t&&z.has(e.role)}let B=null;function loadPrettyFormat(t){if(B!==null)return B;try{return B=e(import.meta.url)(`pretty-format`)}catch(e){throw Error(`${t} needs pretty-format, which @ctrl/dom does not install: add pretty-format@27 to the project's devDependencies.`,{cause:e})}}const V=`The prettyFormat export`,H=Object.defineProperties({},{format:{enumerable:!0,get:()=>loadPrettyFormat(V).format},default:{enumerable:!0,get:()=>loadPrettyFormat(V).default},plugins:{enumerable:!0,get:()=>loadPrettyFormat(V).plugins},DEFAULT_OPTIONS:{enumerable:!0,get:()=>loadPrettyFormat(V).DEFAULT_OPTIONS}}),shouldHighlight=()=>{if(typeof process>`u`)return!1;let e;try{let t=process.env?.COLORS;t&&(e=JSON.parse(t))}catch{}return typeof e==`boolean`?e:process.versions!==void 0&&process.versions.node!==void 0};function filterCommentsAndDefaultIgnoreTagsTags(e){return e.nodeType!==n&&(e.nodeType!==a||!e.matches(getConfig().defaultIgnore))}const U={open:``,close:``},W={comment:U,content:U,prop:U,tag:U,value:U},G={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],gray:[90,39],grey:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49],bgGray:[100,49],bgGrey:[100,49]},K={comment:`gray`,content:`reset`,prop:`yellow`,tag:`cyan`,value:`green`};function highlightColors(e){let t={};for(let n of Object.keys(K)){let r=e!==void 0&&e[n]!==void 0?e[n]:K[n],i=typeof r==`string`&&Object.hasOwn(G,r)?G[r]:void 0;if(i===void 0)throw Error(`pretty-format: Option "theme" has a key "${n}" whose value "${r}" is undefined in ansi-styles.`);t[n]={open:`\u001b[${i[0]}m`,close:`\u001b[${i[1]}m`}}return t}const q=highlightColors(void 0),J=/* @__PURE__ */ new Set([`callToJSON`,`compareKeys`,`escapeRegex`,`escapeString`,`highlight`,`indent`,`maxDepth`,`min`,`plugins`,`printBasicPrototype`,`printFunctionName`,`theme`]),Y=Symbol(`delegate`),X=/^((HTML|SVG)\w*)?Element$/,Z=/* @__PURE__ */ new WeakMap;function isCustomElement(e){let{tagName:t}=e;return!!(typeof t==`string`&&t.includes(`-`)||typeof e.hasAttribute==`function`&&e.hasAttribute(`is`))}function pluginHandles(e){let t=e.node,i=t.constructor,o=i?.name;switch(e.type){case a:{if(!o&&!isCustomElement(t))return!1;if(typeof i!=`function`)return X.test(o)||isCustomElement(t);let e=Z.get(i);return e===void 0&&Z.set(i,e=X.test(o)),e||isCustomElement(t)}case l:return o===`Text`;case n:return o===`Comment`;case r:return o===`DocumentFragment`}return!1}function escapeHTML(e){return e.indexOf(`<`)===-1&&e.indexOf(`>`)===-1?e:e.replace(/</g,`<`).replace(/>/g,`>`)}function printString(e,t){return t.escapeString?`"`+e.replace(/"|\\/g,`\\$&`)+`"`:`"`+e+`"`}function keepChild(e,t){return t.filterNode===null?e.type===n?!1:e.type===a?t.scriptStyleIgnore?e.name!==`script`&&e.name!==`style`:!matchesSelector(e,t.defaultIgnore):!0:!!t.filterNode(e.node)}function tagNameLower(e){return e.node.tagName.toLowerCase()}function printProps(e,t,n){let r=e.attrs;if(r===null||r.length===0)return``;let i=[],a=/* @__PURE__ */ new Map;for(let n=0;n<r.length;n++)t.compact&&isNoiseAttribute(e,r[n].name)||(i.push(r[n].name),a.set(r[n].name,r[n].value));i.sort();let o=t.colors,s=``;for(let e=0;e<i.length;e++){let r=i[e];s+=t.spacingInner+n+o.prop.open+r+o.prop.close+`=`+o.value.open+printString(a.get(r),t)+o.value.close}return s}function isNoiseAttribute(e,t){return t===`class`||t===`style`||e.ns===s&&t!==`role`&&t!==`id`&&!t.startsWith(`aria-`)&&!t.startsWith(`data-`)}function printChildren(e,t,n,r){if(t.compact&&e.ns===s&&e.name===`svg`)return``;let i=``;for(let a=e.first;a!==null;a=a.next)keepChild(a,t)&&(t.compact&&a.type===l&&a.data.trim()===``||(i+=t.spacingOuter+n+printNode(a,t,n,r)));return i}function printElement(e,t,n,r,i){let a=r.colors.tag;return a.open+`<`+e+(t&&a.close+t+r.spacingOuter+i+a.open)+(n?`>`+a.close+n+r.spacingOuter+i+a.open+`</`+e:(t&&!r.min?``:` `)+`/`)+`>`+a.close}function printNode(e,t,i,a){if(!pluginHandles(e))throw Y;if(e.type===l){let n=t.compact&&e.data.length>200?e.data.slice(0,199)+`…`:e.data;return t.colors.content.open+escapeHTML(n)+t.colors.content.close}if(e.type===n){let n=t.colors.comment;return n.open+`<!--`+escapeHTML(e.data)+`-->`+n.close}let o=e.type===r?`DocumentFragment`:tagNameLower(e),s=t.colors.tag;if(++a>t.maxDepth)return s.open+`<`+o+s.close+` …`+s.open+` />`+s.close;let c=i+t.indent;return printElement(o,e.type===r?``:printProps(e,t,c),printChildren(e,t,c,a),t,i)}function printForeignNode(e,t,i,a,o){if(!foreignHandles(e))throw Y;if(e.nodeType===l)return t.colors.content.open+escapeHTML(e.data)+t.colors.content.close;if(e.nodeType===n)return t.colors.comment.open+`<!--`+escapeHTML(e.data)+`-->`+t.colors.comment.close;let s=e.nodeType===r,c=s?`DocumentFragment`:e.tagName.toLowerCase(),u=t.colors.tag;if(++o>t.maxDepth)return u.open+`<`+c+u.close+` …`+u.open+` />`+u.close;let d=a+t.indent,f=``;if(!s){let n=Array.from(e.attributes);n.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));for(let{name:e,value:r}of n)f+=t.spacingInner+d+t.colors.prop.open+e+t.colors.prop.close+`=`+t.colors.value.open+printString(r,t)+t.colors.value.close}let p=``,m=e.childNodes||e.children;for(let e=0;e<m.length;e++)i(m[e])&&(p+=t.spacingOuter+d+printForeignNode(m[e],t,i,d,o));return printElement(c,f,p,t,a)}function foreignHandles(e){let t=e?.constructor?.name;if(!t&&!isCustomElement(e))return!1;switch(e.nodeType){case a:return X.test(t)||isCustomElement(e);case l:return t===`Text`;case n:return t===`Comment`;case r:return t===`DocumentFragment`}return!1}function makePrintConfig(e,t){for(let t of Object.keys(e))if(!J.has(t))throw Error(`pretty-format: Unknown option "${t}".`);if(e.min&&e.indent!==void 0&&e.indent!==0)throw Error(`pretty-format: Options "min" and "indent" cannot be used together.`);if(e.theme!==void 0){if(e.theme===null)throw Error(`pretty-format: Option "theme" must not be null.`);if(typeof e.theme!=`object`)throw Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof e.theme}".`)}if(e.plugins!==void 0)return null;let n=!!e.min,r=e.indent===void 0?2:e.indent,i=getConfig().defaultIgnore;return{colors:e.highlight?e.theme===void 0?q:highlightColors(e.theme):W,escapeString:e.escapeString===void 0||e.escapeString,indent:n?``:Array(r+1).join(` `),maxDepth:e.maxDepth===void 0?1/0:e.maxDepth,min:n,spacingInner:n?` `:`
|
|
5
|
+
`,spacingOuter:n?``:`
|
|
6
|
+
`,filterNode:t,scriptStyleIgnore:i===`script, style`,defaultIgnore:i,compact:!1}}function formatDOM(e,n,r,i=!1){let a={printFunctionName:!1,highlight:shouldHighlight(),...r},o=n??filterCommentsAndDefaultIgnoreTagsTags,s=makePrintConfig(a,n===void 0?null:n);if(s===null)return formatWithPrettyFormat(e,o,a,`The "plugins" option of prettyDOM`);s.compact=i;let c=e[t];try{return c===void 0?printForeignNode(e,s,o,``,0):printNode(c,s,``,0)}catch(e){if(e!==Y)throw e}return formatWithPrettyFormat(e,o,a,`Printing a node other than an element, text, comment or fragment`)}function formatWithPrettyFormat(e,t,n,r=`pretty-format's own printing`){let i=loadPrettyFormat(r);return i.format(e,{plugins:[createDOMElementFilter(t),i.plugins.DOMCollection],...n})}function prettyDOM(e,t,n={}){e||=getDocument().body;let r=typeof t==`number`?t:void 0;if(typeof t!=`number`&&(t=typeof process<`u`&&process.env!==void 0&&process.env.DEBUG_PRINT_LIMIT||7e3),t===0)return``;e.documentElement&&(e=e.documentElement);let i=typeof e;if(i===`object`?i=e.constructor.name:e={},!(`outerHTML`in e))throw TypeError(`Expected an element or document but got ${i}`);let a=n.format??envDebugFormat();if(a!==null||`format`in n){let{format:i,hidden:o,maxLines:s,maxTextLength:c,collapseAfter:l,urls:u,...d}=n;if(a===`aria`){let t=ariaSnapshot(e,{hidden:o,maxLines:s,maxTextLength:c,collapseAfter:l,urls:u});return r!==void 0&&t.length>r?`${t.slice(0,r)}...`:t}if(n=d,a===`compact`){let{filterNode:r,...i}={highlight:!1,...n},a=formatDOM(e,r,i,!0);return a.length>t?`${a.slice(0,t)}...`:a}}let{filterNode:o,...s}=n,c=formatDOM(e,o,s);return t!==void 0&&outerHTMLLength(e)>t?`${c.slice(0,t)}...`:c}function outerHTMLLength(e){let n=e[t];return n!==void 0&&n.type===a?p(n).length:e.outerHTML.length}const logDOM=(...e)=>{let t=getUserCodeFrame();console.log(t?`${prettyDOM(...e)}\n\n${t}`:prettyDOM(...e))};function createDOMElementFilter(e){let printPropsPF=(e,t,n,r,i,a,o)=>{let s=r+n.indent,c=n.colors;return e.map(e=>{let l=t[e],u=o(l,n,s,i,a);return typeof l!=`string`&&(u.indexOf(`
|
|
7
|
+
`)!==-1&&(u=n.spacingOuter+s+u+n.spacingOuter+r),u=`{`+u+`}`),n.spacingInner+r+c.prop.open+e+c.prop.close+`=`+c.value.open+u+c.value.close}).join(``)},printText=(e,t)=>t.colors.content.open+escapeHTML(e)+t.colors.content.close,printChildrenPF=(e,t,n,r,i,a)=>e.map(e=>{let o=typeof e==`string`?printText(e,t):a(e,t,n,r,i);return o===``&&typeof e==`object`&&e&&e.nodeType!==l?``:t.spacingOuter+n+o}).join(``),testNode=e=>{let t=e.constructor.name,{nodeType:i}=e;return i===a&&(X.test(t)||isCustomElement(e))||i===l&&t===`Text`||i===n&&t===`Comment`||i===r&&t===`DocumentFragment`};return{test:e=>(e?.constructor?.name||isCustomElement(e))&&testNode(e),serialize:(t,i,a,o,s,c)=>{if(t.nodeType===l)return printText(t.data,i);if(t.nodeType===n){let e=i.colors.comment;return e.open+`<!--`+escapeHTML(t.data)+`-->`+e.close}let u=t.nodeType===r,d=u?`DocumentFragment`:t.tagName.toLowerCase();if(++o>i.maxDepth){let e=i.colors.tag;return e.open+`<`+d+e.close+` …`+e.open+` />`+e.close}return printElement(d,printPropsPF(u?[]:Array.from(t.attributes).map(e=>e.name).sort(),u?{}:Array.from(t.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),i,a+i.indent,o,s,c),printChildrenPF(Array.prototype.slice.call(t.childNodes||t.children).filter(e),i,a+i.indent,o,s,c),i,a)}}}let Q={testIdAttribute:`data-testid`,asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:`script, style`,showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){let n=envDebugFormat();if(n!==null){let r=Error([e,agentErrorContext(t,n,prettyDOM)].filter(Boolean).join(`
|
|
8
|
+
|
|
9
|
+
`));return r.name=`TestingLibraryElementError`,r}if($)return lazyElementError(e,t,Q.defaultIgnore);let r=prettyDOM(t),i=Error([e,`Ignored nodes: comments, ${Q.defaultIgnore}\n${r}`].filter(Boolean).join(`
|
|
10
|
+
|
|
11
|
+
`));return i.name=`TestingLibraryElementError`,i},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1},$=!1;function lazyElementError(e,t,n){let r=/* @__PURE__ */ Error();r.name=`TestingLibraryElementError`;let settle=e=>(Object.defineProperty(r,"message",{value:e,writable:!0,enumerable:!1,configurable:!0}),e);return Object.defineProperty(r,"message",{get:()=>settle([e,`Ignored nodes: comments, ${n}\n${prettyDOM(t)}`].filter(Boolean).join(`
|
|
12
|
+
|
|
13
|
+
`)),set:settle,enumerable:!1,configurable:!0}),r}function runWithExpensiveErrorDiagnosticsDisabled(e,t=!1){let n=$;try{return Q._disableExpensiveErrorDiagnostics=!0,$=t,e()}finally{Q._disableExpensiveErrorDiagnostics=!1,$=n}}function configure(e){typeof e==`function`&&(e=e(Q)),Q={...Q,...e}}function getConfig(){return Q}function diffAriaSnapshots(e,t){let n=diffLines(e.split(`
|
|
14
|
+
`),t.split(`
|
|
15
|
+
`)),r=new Uint8Array(n.length),i=!1;for(let e=0;e<n.length;e++){if(n[e].kind===`=`)continue;i=!0,r[e]=1;let t=indentOf(n[e].text);for(let i=e-1;i>=0&&t>0;i--){if(n[i].kind!==`=`)continue;let e=indentOf(n[i].text);e<t&&(r[i]=1,t=e)}}if(!i)return`(no changes)`;let a=[],o=-1;for(let e=0;e<n.length;e++)r[e]!==0&&(o!==-1&&e!==o+1&&a.push(` …`),a.push(`${n[e].kind===`=`?` `:n[e].kind} ${n[e].text}`),o=e);return a.join(`
|
|
16
|
+
`)}function indentOf(e){let t=0;for(;t<e.length&&e.charCodeAt(t)===32;)t++;return t}function diffLines(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;let r=e.length,i=t.length;for(;r>n&&i>n&&e[r-1]===t[i-1];)r--,i--;let a=[];for(let t=0;t<n;t++)a.push({kind:`=`,text:e[t]});let o=r-n,s=i-n;if(o*s>4e6){for(let t=n;t<r;t++)a.push({kind:`-`,text:e[t]});for(let e=n;e<i;e++)a.push({kind:`+`,text:t[e]})}else{let r=s+1,i=new Uint32Array((o+1)*r);for(let a=o-1;a>=0;a--)for(let o=s-1;o>=0;o--)i[a*r+o]=e[n+a]===t[n+o]?i[(a+1)*r+o+1]+1:Math.max(i[(a+1)*r+o],i[a*r+o+1]);let c=0,l=0;for(;c<o||l<s;)c<o&&l<s&&e[n+c]===t[n+l]?(a.push({kind:`=`,text:e[n+c]}),c++,l++):c<o&&(l===s||i[(c+1)*r+l]>=i[c*r+l+1])?(a.push({kind:`-`,text:e[n+c]}),c++):(a.push({kind:`+`,text:t[n+l]}),l++)}for(let t=r;t<e.length;t++)a.push({kind:`=`,text:e[t]});return a}export{implOf as A,agentElementSummary as C,checkContainerType as D,advanceFakeTimersByTime as E,__name as M,getDocument as O,yamlValue as S,matchesSelector as T,nodeKey as _,runWithExpensiveErrorDiagnosticsDisabled as a,resetBodySnapshot as b,H as c,ariaSnapshotTree as d,budgetLines as f,lastBodySnapshot as g,hiddenReason as h,getConfig as i,jestFakeTimersAreEnabled as j,getWindowFromNode as k,ariaSnapshot as l,envMaxLines as m,diffLines as n,logDOM as o,describeElement as p,configure as r,prettyDOM as s,diffAriaSnapshots as t,ariaSnapshotLines as u,nodeProps as v,envDebugFormat as w,truncate as x,quote as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/aria-snapshot-diff-B95LLutl.cjs");let t=require("@ctrl/dom/internal"),n=require("@ctrl/dom/aria");var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const r=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
|
|
2
2
|
`:t===`t`?i+=` `:t===`u`?(i+=String.fromCharCode(parseInt(e.slice(n+1,n+5),16)),n+=4):i+=t??``}else i+=t}}return n(`Unterminated string`,e.length)}var KeyError=class extends Error{pos;constructor(e,t){super(e),this.pos=t}},KeyParser=class{pos=0;input;constructor(e){this.input=e}peek(){return this.input[this.pos]??``}eof(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}atColon(){return this.peek()===`:`&&(this.pos+1>=this.input.length||/\s/.test(this.input[this.pos+1]))}readIdentifier(e){if(this.eof())throw new KeyError(`Unexpected end of input when expecting ${e}`,this.pos);let t=this.pos;for(;!this.eof()&&/[a-zA-Z]/.test(this.peek());)this.pos++;if(this.pos===t)throw new KeyError(`Expected ${e}`,this.pos);return this.input.slice(t,this.pos)}readString(){let e=``;for(;!this.eof();){let t=this.input[this.pos++];if(t===`\\`){let t=this.input[this.pos++]??``;t===`n`?e+=`
|
|
3
3
|
`:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(r.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let r=e.states.get(t);if(r!==void 0)return r;switch(t){case`checked`:return(0,n.roleSupportsProp)(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e.S(t.normalized):t.raw}function templateKey(t){let n=t.role;typeof t.name==`string`?n+=` `+e.y(t.name):t.name!==null&&(n+=` /${t.name.source}/`);for(let e=0;e<t.attrs.length;e++)n+=t.attrs[e][1]===`true`?` [${t.attrs[e][0]}]`:` [${t.attrs[e][0]}=${t.attrs[e][1]}]`;return n}function receivedKey(t){let n=t.role;t.name!==``&&(n+=` `+e.y(e.x(t.name,100)));for(let e=0;e<t.props.length;e++)n+=` `+t.props[e];return n}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(t,n,r,i){if(t.kind===`text`){let a=n;i.push(`${r}- text: ${matchesText(a,t.text)?textRepr(t.text):e.S(e.x(a,100))}`);return}let a=n,o=headerMatches(a,t)?templateKey(t):receivedKey(a),s=this.align(t.children,a.children);if(isInline(t)){let n=s[0],a=t.children[0].text;i.push(n===null?`${r}- ${o}`:`${r}- ${o}: ${matchesText(n,a)?textRepr(a):e.S(e.x(n,100))}`);return}if(t.children.length===0&&t.url===null&&t.mode===null){i.push(`${r}- ${o}`);return}i.push(`${r}- ${o}:`);let c=r+` `;t.url!==null&&i.push(`${c}- /url: ${matchesText(a.url,t.url)?textRepr(t.url):e.S(a.url??``)}`),t.mode!==null&&i.push(`${c}- /children: ${t.mode}`);for(let e=0;e<t.children.length;e++)s[e]!==null&&this.project(t.children[e],s[e],c,i)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(t,n){let r=parseAriaTemplate(n),i=e.d(t,{urls:!0}),a=[];for(let e=0;e<i.length;e++){let t=i[e];a.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let o={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:a,props:[]},s=matchesDeep(o,r),expectedLines=()=>{let e=[];if(r.kind===`role`&&r.role===`fragment`){r.mode!==null&&e.push(`- /children: ${r.mode}`);for(let t=0;t<r.children.length;t++)renderTemplate(r.children[t],``,e)}else renderTemplate(r,``,e);return e};return{pass:s,expected:()=>expectedLines().join(`
|
|
4
4
|
`),diff:()=>pairChanges(e.n(expectedLines(),closestLines(o,r))),received:()=>e.l(t,{collapseAfter:1/0,maxLines:e.m()??100})}}function resetFailureSnapshot(t){e.b(t)}function captureFailureSnapshot(n){let r=e.w(),i=n?.body;if(r===null||i==null||i[t.$impl]===void 0)return null;if(r===`compact`){let t=e.s(i,void 0,{format:`compact`});return{format:r,text:String(t),full:``,previous:void 0}}let a=e.g(n),{lines:o,empty:s}=e.u(i),c=s??o.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,b as t,d as n,f as r,g as i,l as a,m as o,n as s,s as c,t as l,u,w as d,x as f,y as p}from"./_chunks/aria-snapshot-diff-
|
|
1
|
+
import{S as e,b as t,d as n,f as r,g as i,l as a,m as o,n as s,s as c,t as l,u,w as d,x as f,y as p}from"./_chunks/aria-snapshot-diff-BSXxnyqJ.js";import{$impl as m}from"@ctrl/dom/internal";import{roleSupportsProp as h}from"@ctrl/dom/aria";var AriaTemplateError=class extends Error{constructor(e,t,n,r=-1){super(`${e} (template line ${t+1}):\n\n${n}${r>=0?`\n${` `.repeat(r)}^`:``}`),this.name=`AriaTemplateError`}};function normalizeWhitespace(e){return e.replace(/[]/g,``).replace(/[\r\n\s\t]+/g,` `).trim()}function textValue(e){let t=null;if(e.length>1&&e.startsWith(`/`)&&e.endsWith(`/`))try{t=new RegExp(e.slice(1,-1))}catch{t=null}return{raw:e,normalized:normalizeWhitespace(e),regex:t}}const g=/* @__PURE__ */ new Set([`disabled`,`expanded`,`active`,`selected`,`busy`,`hidden`]);function parseAriaTemplate(e){let t=e.split(/\r?\n/),n=1/0;for(let e=0;e<t.length;e++){let r=t[e],i=r.trim();if(i===``||i.startsWith(`#`))continue;let a=r.length-r.trimStart().length;if(r.slice(0,a).includes(` `))throw new AriaTemplateError(`Tabs cannot be used for indentation`,e,r);a<n&&(n=a)}let r={kind:`role`,role:`fragment`,name:null,attrs:[],url:null,mode:null,children:[]};if(n===1/0)throw new AriaTemplateError(`The aria snapshot template is empty`,0,e);let i=[{indent:-1,node:r,line:-1}];for(let e=0;e<t.length;e++){let r=t[e],a=r.trim();if(a===``||a.startsWith(`#`))continue;let o=r.length-r.trimStart().length-n;if(a!==`-`&&!a.startsWith(`- `))throw new AriaTemplateError(`Aria snapshot must be a YAML sequence, elements starting with "-"`,e,r,o+n);for(;i[i.length-1].indent>=o;)i.pop();let s=i[i.length-1];if(s.node===null)throw new AriaTemplateError(`"- text:" on line ${s.line+1} cannot have children`,e,r,o+n);let c=a.slice(2).trimStart(),l=r.length-c.length,u=parseItem(c,s.node,e,r,l);u!==void 0&&i.push({indent:o,node:u,line:e})}return r.children.length===1&&(r.mode===null||r.mode===`contain`)&&r.url===null?r.children[0]:r}function parseItem(e,t,n,r,i){let fail=(e,t)=>{throw new AriaTemplateError(e,n,r,i+t)};if(e===``&&fail(`Empty sequence item`,0),e.startsWith(`/`)){let n=e.indexOf(`:`);n<0&&fail("Property should be written `/name: value`",e.length);let r=e.slice(1,n).trim(),i=parseScalar(e.slice(n+1),fail,n+1);r===`children`?(i!==`contain`&&i!==`equal`&&i!==`deep-equal`&&fail(`Value of "/children" should be "contain", "equal" or "deep-equal"`,n+1),t.mode=i):r===`url`&&(t.url=textValue(i));return}let a,o=null;try{if(e[0]===`"`||e[0]===`'`){let[n,r]=readQuoted(e,0,fail),i=e.slice(r).trimStart();if(i!==``&&i[0]!==`:`&&fail(`Unexpected input after the quoted key`,r),i!==``&&(o=i.slice(1)),n===`text`&&o!==null)return textItem(t,o,fail,e.length-o.length);a=new KeyParser(n).parse(!1)}else{if(/^text:(\s|$)/.test(e))return textItem(t,e.slice(5),fail,5);let n=new KeyParser(e);a=n.parse(!0),n.pos<e.length&&(o=e.slice(n.pos+1))}}catch(t){throw t instanceof KeyError&&fail(t.message,e[0]===`"`||e[0]===`'`?0:t.pos),t}return o!==null&&o.trim()!==``&&a.children.push({kind:`text`,text:textValue(parseScalar(o,fail,e.length-o.length))}),t.children.push(a),a}function textItem(e,t,n,r){return e.children.push({kind:`text`,text:textValue(parseScalar(t,n,r))}),null}function parseScalar(e,t,n){let r=e.length-e.trimStart().length,i=e.trim();if(i[0]===`"`||i[0]===`'`){let[e,a]=readQuoted(i,0,(e,i)=>t(e,n+r+i)),o=i.slice(a).trim();return o!==``&&!o.startsWith(`#`)&&t(`Unexpected input after the quoted value`,n+r+a),e}(i===`|`||i===`>`||i.startsWith(`|`)||i.startsWith(`>`))&&t(`Block scalars are not supported in aria snapshot templates`,n+r);let a=i.search(/\s#/);return a>=0?i.slice(0,a).trim():i}function readQuoted(e,t,n){let r=e[t],i=``;for(let n=t+1;n<e.length;n++){let t=e[n];if(r===`'`){if(t===`'`){if(e[n+1]===`'`){i+=`'`,n++;continue}return[i,n+1]}i+=t}else{if(t===`"`)return[i,n+1];if(t===`\\`){let t=e[++n];t===`n`?i+=`
|
|
2
2
|
`:t===`t`?i+=` `:t===`u`?(i+=String.fromCharCode(parseInt(e.slice(n+1,n+5),16)),n+=4):i+=t??``}else i+=t}}return n(`Unterminated string`,e.length)}var KeyError=class extends Error{pos;constructor(e,t){super(e),this.pos=t}},KeyParser=class{pos=0;input;constructor(e){this.input=e}peek(){return this.input[this.pos]??``}eof(){return this.pos>=this.input.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}atColon(){return this.peek()===`:`&&(this.pos+1>=this.input.length||/\s/.test(this.input[this.pos+1]))}readIdentifier(e){if(this.eof())throw new KeyError(`Unexpected end of input when expecting ${e}`,this.pos);let t=this.pos;for(;!this.eof()&&/[a-zA-Z]/.test(this.peek());)this.pos++;if(this.pos===t)throw new KeyError(`Expected ${e}`,this.pos);return this.input.slice(t,this.pos)}readString(){let e=``;for(;!this.eof();){let t=this.input[this.pos++];if(t===`\\`){let t=this.input[this.pos++]??``;t===`n`?e+=`
|
|
3
3
|
`:t===`t`?e+=` `:t===`u`?(e+=String.fromCharCode(parseInt(this.input.slice(this.pos,this.pos+4),16)),this.pos+=4):e+=t}else if(t===`"`)return e;else e+=t}throw new KeyError(`Unterminated string`,this.pos)}readRegex(){let e=this.pos,t=``,n=!1,r=!1;for(;!this.eof();){let i=this.input[this.pos++];if(n)t+=i,n=!1;else if(i===`\\`)n=!0,t+=i;else if(i===`/`&&!r)try{return new RegExp(t)}catch(t){throw new KeyError(`Invalid regular expression: ${t.message}`,e)}else i===`[`?(r=!0,t+=i):i===`]`&&r?(t+=i,r=!1):t+=i}throw new KeyError(`Unterminated regex`,this.pos)}parse(e){this.skipWhitespace();let t=this.readIdentifier(`role`);this.skipWhitespace();let n=null;this.peek()===`"`?(this.pos++,n=normalizeWhitespace(this.readString())):this.peek()===`/`&&(this.pos++,n=this.readRegex());let r={kind:`role`,role:t,name:n===``?null:n,attrs:[],url:null,mode:null,children:[]};for(;this.skipWhitespace(),this.peek()===`[`;){this.pos++,this.skipWhitespace();let e=this.pos,t=this.readIdentifier(`attribute`);this.skipWhitespace();let n=``;if(this.peek()===`=`)for(this.pos++,this.skipWhitespace();this.peek()!==`]`&&!/\s/.test(this.peek())&&!this.eof();)n+=this.input[this.pos++];if(this.skipWhitespace(),this.peek()!==`]`)throw new KeyError(`Expected ]`,this.pos);this.pos++,r.attrs.push([t,checkAttribute(t,n||`true`,e)])}if(this.skipWhitespace(),e&&this.atColon())return r;if(!this.eof())throw new KeyError(e?`Unexpected input (a key ends with ":" and a space)`:`Unexpected input`,this.pos);return r}};function checkAttribute(e,t,n){if(e===`checked`||e===`pressed`){if(t!==`true`&&t!==`false`&&t!==`mixed`)throw new KeyError(`Value of "${e}" attribute must be a boolean or "mixed"`,n);return t}if(g.has(e)){if(t!==`true`&&t!==`false`)throw new KeyError(`Value of "${e}" attribute must be a boolean`,n);return t}if(e===`level`){if(Number.isNaN(Number(t)))throw new KeyError(`Value of "level" attribute must be a number`,n);return String(Number(t))}if(e===`current`)return t;throw new KeyError(`Unsupported attribute [${e}]`,n)}function toMatchNode(e){let t=[];e.value!==null&&e.value!==``&&t.push(normalizeWhitespace(e.value));for(let n=0;n<e.children.length;n++){let r=e.children[n];t.push(typeof r==`string`?normalizeWhitespace(r):toMatchNode(r))}let n=/* @__PURE__ */ new Map;for(let t=0;t<e.props.length;t++){let r=e.props[t].slice(1,-1),i=r.indexOf(`=`);i<0?n.set(r,`true`):n.set(r.slice(0,i),r.slice(i+1))}return{role:e.role,name:normalizeWhitespace(e.name),states:n,url:e.url,children:t,props:e.props}}function stateOf(e,t){let n=e.states.get(t);if(n!==void 0)return n;switch(t){case`checked`:return h(e.role,`aria-checked`)?`false`:void 0;case`disabled`:case`selected`:case`active`:case`busy`:case`hidden`:case`current`:return`false`}}function attrsMatch(e,t){for(let n=0;n<t.attrs.length;n++){let[r,i]=t.attrs[n],a=stateOf(e,r);if(r===`current`&&i===`true`){if(a===void 0||a===`false`)return!1}else if(a!==i)return!1}return!0}function matchesName(e,t){return t===null?!0:e===``?!1:typeof t==`string`?e===t:t.test(e)}function matchesText(e,t){return t===null||t.normalized===``?!0:e?e===t.normalized||e===t.raw||t.regex!==null&&t.regex.test(e):!1}function headerMatches(e,t){return(t.role===`fragment`||t.role===e.role)&&attrsMatch(e,t)&&matchesName(e.name,t.name)&&matchesText(e.url,t.url)}function matchesNode(e,t,n){return typeof e==`string`?t.kind===`text`&&matchesText(e,t.text):t.kind!==`role`||!headerMatches(e,t)?!1:t.mode===`contain`?containsList(e.children,t.children):t.mode===`equal`?listEqual(e.children,t.children,!1):t.mode===`deep-equal`||n?listEqual(e.children,t.children,!0):containsList(e.children,t.children)}function listEqual(e,t,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!matchesNode(e[r],t[r],n))return!1;return!0}function containsList(e,t){if(t.length>e.length)return!1;let n=0;for(let r=0;r<t.length;r++){for(;n<e.length&&!matchesNode(e[n],t[r],!1);)n++;if(n===e.length)return!1;n++}return!0}function matchesDeep(e,t){if(matchesNode(e,t,!1))return!0;if(typeof e==`string`)return!1;for(let n=0;n<e.children.length;n++)if(matchesDeep(e.children[n],t))return!0;return!1}function textRepr(t){return t.regex===null?e(t.normalized):t.raw}function templateKey(e){let t=e.role;typeof e.name==`string`?t+=` `+p(e.name):e.name!==null&&(t+=` /${e.name.source}/`);for(let n=0;n<e.attrs.length;n++)t+=e.attrs[n][1]===`true`?` [${e.attrs[n][0]}]`:` [${e.attrs[n][0]}=${e.attrs[n][1]}]`;return t}function receivedKey(e){let t=e.role;e.name!==``&&(t+=` `+p(f(e.name,100)));for(let n=0;n<e.props.length;n++)t+=` `+e.props[n];return t}function isInline(e){return e.url===null&&e.mode===null&&e.children.length===1&&e.children[0].kind===`text`}function renderTemplate(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${textRepr(e.text)}`);return}let r=templateKey(e);if(isInline(e)){n.push(`${t}- ${r}: ${textRepr(e.children[0].text)}`);return}if(e.children.length===0&&e.url===null&&e.mode===null){n.push(`${t}- ${r}`);return}n.push(`${t}- ${r}:`);let i=t+` `;e.url!==null&&n.push(`${i}- /url: ${textRepr(e.url)}`),e.mode!==null&&n.push(`${i}- /children: ${e.mode}`);for(let t=0;t<e.children.length;t++)renderTemplate(e.children[t],i,n)}var Scorer=class{memo=/* @__PURE__ */ new Map;score(e,t){if(e.kind===`text`)return typeof t==`string`?matchesText(t,e.text)?3:1:0;if(typeof t==`string`||e.role!==`fragment`&&e.role!==t.role)return 0;let n=this.memo.get(e);n===void 0&&this.memo.set(e,n=/* @__PURE__ */ new Map);let r=n.get(t);if(r!==void 0)return r;let i=2;return i+=e.name===null?1:matchesName(t.name,e.name)?2:0,attrsMatch(t,e)&&(i+=1),e.url!==null&&matchesText(t.url,e.url)&&(i+=1),i+=this.scoreList(e.children,t.children),n.set(t,i),i}scoreList(e,t){let n=this.align(e,t),r=0;for(let t=0;t<e.length;t++)n[t]!==null&&(r+=this.score(e[t],n[t]));return r}align(e,t){let n=[],r=0;for(let i=0;i<e.length;i++){let a=-1,o=0;for(let n=r;n<t.length;n++){let r=this.score(e[i],t[n]);r>o&&(a=n,o=r)}a<0?n.push(null):(n.push(t[a]),r=a+1)}return n}project(t,n,r,i){if(t.kind===`text`){let a=n;i.push(`${r}- text: ${matchesText(a,t.text)?textRepr(t.text):e(f(a,100))}`);return}let a=n,o=headerMatches(a,t)?templateKey(t):receivedKey(a),s=this.align(t.children,a.children);if(isInline(t)){let n=s[0],a=t.children[0].text;i.push(n===null?`${r}- ${o}`:`${r}- ${o}: ${matchesText(n,a)?textRepr(a):e(f(n,100))}`);return}if(t.children.length===0&&t.url===null&&t.mode===null){i.push(`${r}- ${o}`);return}i.push(`${r}- ${o}:`);let c=r+` `;t.url!==null&&i.push(`${c}- /url: ${matchesText(a.url,t.url)?textRepr(t.url):e(a.url??``)}`),t.mode!==null&&i.push(`${c}- /children: ${t.mode}`);for(let e=0;e<t.children.length;e++)s[e]!==null&&this.project(t.children[e],s[e],c,i)}};function forEachNode(e,t){t(e);for(let n=0;n<e.children.length;n++){let r=e.children[n];typeof r==`string`?t(r):forEachNode(r,t)}}function closestLines(e,t){let n=new Scorer,r=[];if(t.kind===`role`&&t.role===`fragment`){let i=null,a=0;if(forEachNode(e,e=>{if(typeof e==`string`)return;let r=n.scoreList(t.children,e.children);r>a&&(i=e,a=r)}),i!==null){let e=n.align(t.children,i.children);for(let i=0;i<t.children.length;i++)e[i]!==null&&n.project(t.children[i],e[i],``,r)}return r}let i=null,a=0;return forEachNode(e,e=>{let r=n.score(t,e);r>a&&(i=e,a=r)}),i!==null&&n.project(t,i,``,r),r}function pairChanges(e){let t=[];for(let n=0;n<e.length;){if(e[n].kind===`=`){t.push(e[n++]);continue}let r=n;for(;r<e.length&&e[r].kind===`-`;)r++;let i=r;for(;i<e.length&&e[i].kind===`+`;)i++;if(r-n===i-r)for(let i=0;i<r-n;i++)t.push(e[n+i],e[r+i]);else for(let r=n;r<i;r++)t.push(e[r]);n=i}return t}function matchAriaSnapshot(e,t){let r=parseAriaTemplate(t),i=n(e,{urls:!0}),c=[];for(let e=0;e<i.length;e++){let t=i[e];c.push(typeof t==`string`?normalizeWhitespace(t):toMatchNode(t))}let l={role:`fragment`,name:``,states:/* @__PURE__ */ new Map,url:null,children:c,props:[]},u=matchesDeep(l,r),expectedLines=()=>{let e=[];if(r.kind===`role`&&r.role===`fragment`){r.mode!==null&&e.push(`- /children: ${r.mode}`);for(let t=0;t<r.children.length;t++)renderTemplate(r.children[t],``,e)}else renderTemplate(r,``,e);return e};return{pass:u,expected:()=>expectedLines().join(`
|
|
4
4
|
`),diff:()=>pairChanges(s(expectedLines(),closestLines(l,r))),received:()=>a(e,{collapseAfter:1/0,maxLines:o()??100})}}function resetFailureSnapshot(e){t(e)}function captureFailureSnapshot(e){let t=d(),n=e?.body;if(t===null||n==null||n[m]===void 0)return null;if(t===`compact`){let e=c(n,void 0,{format:`compact`});return{format:t,text:String(e),full:``,previous:void 0}}let a=i(e),{lines:s,empty:l}=u(n),f=l??s.join(`
|