@ctrl/dom 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +12 -105
  2. package/dist/aria/_chunks/{aria-query.generated-BivoZ-ec.js → aria-query.generated-BG-n1PE9.js} +2 -2
  3. package/dist/aria/_chunks/{aria-query.generated-CeGmXXFh.cjs → aria-query.generated-BqD80bJk.cjs} +1 -1
  4. package/dist/aria/index.cjs +1 -1
  5. package/dist/aria/index.js +1 -1
  6. package/dist/aria/internal.cjs +1 -1
  7. package/dist/aria/internal.js +1 -1
  8. package/dist/aria/types/forms.d.ts +0 -2
  9. package/dist/bridge/internal.js +1 -1
  10. package/dist/dom/_chunks/src-B3vkUXY6.js +50 -0
  11. package/dist/dom/index.js +1 -1
  12. package/dist/dom/internal.js +1 -1
  13. package/dist/dom/types/css/cascade.d.ts +0 -2
  14. package/dist/dom/types/css/media.d.ts +0 -2
  15. package/dist/dom/types/css/parser.d.ts +0 -2
  16. package/dist/dom/types/css/properties.d.ts +0 -2
  17. package/dist/dom/types/css/shorthands.d.ts +0 -2
  18. package/dist/dom/types/css/values.d.ts +0 -1
  19. package/dist/dom/types/html/focus.d.ts +0 -2
  20. package/dist/dom/types/html/forms/HTMLOptionElement.d.ts +8 -0
  21. package/dist/dom/types/html/forms/HTMLSelectElement.d.ts +19 -2
  22. package/dist/dom/types/html/forms/collections.d.ts +12 -1
  23. package/dist/dom/types/html/forms/control-state.d.ts +5 -0
  24. package/dist/dom/types/html/forms/form-associated.d.ts +4 -2
  25. package/dist/dom/types/html/forms/index.d.ts +1 -2
  26. package/dist/dom/types/html/forms/microsyntaxes.d.ts +0 -3
  27. package/dist/dom/types/html/forms/state.d.ts +0 -1
  28. package/dist/dom/types/html/reflect.d.ts +0 -4
  29. package/dist/dom/types/html/resources.d.ts +0 -2
  30. package/dist/dom/types/html/shared.d.ts +0 -2
  31. package/dist/dom/types/html/template.d.ts +0 -3
  32. package/dist/dom/types/keys.d.ts +16 -0
  33. package/dist/dom/types/nodes/Document.d.ts +10 -3
  34. package/dist/dom/types/nodes/attributes.d.ts +3 -0
  35. package/dist/dom/types/parser/index.d.ts +1 -1
  36. package/dist/dom/types/parser/tokenizer.d.ts +0 -2
  37. package/dist/dom/types/selectors/compile.d.ts +0 -2
  38. package/dist/dom/types/selectors/index.d.ts +0 -4
  39. package/dist/dom/types/selectors/internal.d.ts +3 -6
  40. package/dist/dom/types/selectors/parser.d.ts +0 -5
  41. package/dist/dom/types/selectors/state.d.ts +0 -5
  42. package/dist/dom/types/serializer/index.d.ts +0 -2
  43. package/dist/dom/types/traversal/live.d.ts +6 -2
  44. package/dist/dom/types/{events/convert.d.ts → webidl-convert.d.ts} +0 -2
  45. package/dist/dom/types/window/devtools-console.d.ts +2 -0
  46. package/dist/dom/types/window/shared-accessors.d.ts +9 -0
  47. package/dist/jest-dom/_chunks/matchers-DGsBvtWC.js +1 -1
  48. package/dist/react/_chunks/pure-0apusBJy.cjs +1 -0
  49. package/dist/react/_chunks/pure-CRYsLxrp.js +1 -0
  50. package/dist/react/index.cjs +1 -1
  51. package/dist/react/index.js +1 -1
  52. package/dist/react/pure.cjs +1 -1
  53. package/dist/react/pure.js +1 -1
  54. package/dist/react/types/config.d.ts +3 -1
  55. package/dist/react/types/fire-event.d.ts +1 -1
  56. package/dist/react/types/pure.d.ts +2 -2
  57. package/dist/testing-library/_chunks/aria-snapshot-diff-BSXxnyqJ.js +1 -1
  58. package/dist/testing-library/agent.js +1 -1
  59. package/dist/testing-library/index.js +1 -1
  60. package/dist/user-event/index.cjs +4 -4
  61. package/dist/user-event/index.js +4 -4
  62. package/dist/user-event/types/ctrl-dom.d.ts +0 -13
  63. package/dist/user-event/types/event/selection/selectBoundaries.d.ts +2 -0
  64. package/dist/user-event/types/setup/dtl.d.ts +0 -2
  65. package/dist/user-event/types/utility/upload.d.ts +1 -4
  66. package/dist/vitest-environment/failure-snapshot.js +1 -1
  67. package/dist/vitest-environment/plugin.js +1 -1
  68. package/dist/vitest-environment/types/warm-forks.d.ts +0 -7
  69. package/package.json +2 -3
  70. package/dist/dom/_chunks/src-BXKOjfbH.js +0 -50
  71. package/dist/react/_chunks/pure-BzGfHsO2.js +0 -1
  72. package/dist/react/_chunks/pure-DvYA3m08.cjs +0 -1
  73. package/dist/react/types/dtl.d.ts +0 -1
@@ -29,6 +29,12 @@ export declare function markBoundary(n: NodeImpl): void;
29
29
  /** Sets F_RANGE_BELOW on `n` and its ancestors (stops at the first one that has it). */
30
30
  export declare function markRangeAncestors(n: NodeImpl): void;
31
31
  export declare function registerLiveRange(r: LiveBoundaries): void;
32
+ /**
33
+ * `r` is unreachable: its only holder (a Selection that made it and never handed it out) has
34
+ * replaced it. The next walk of its document's list drops the entry instead of waiting for a
35
+ * major GC to clear the WeakRef, so selections moved in a loop do not lengthen every mutation.
36
+ */
37
+ export declare function retireLiveRange(r: LiveBoundaries): void;
32
38
  /** Re-file `r` after its boundary points moved to another document. */
33
39
  export declare function refileRange(r: LiveBoundaries): void;
34
40
  export declare function registerNodeIterator(it: IteratorState): void;
@@ -49,5 +55,3 @@ export declare function rangesSplitText(node: NodeImpl, newNode: NodeImpl, offse
49
55
  export declare function rangesNormalizeMerge(node: NodeImpl, current: NodeImpl, length: number): void;
50
56
  /** https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps (for every iterator in node's document). */
51
57
  export declare function iteratorsBeforeRemove(toBeRemoved: NodeImpl): void;
52
- /** @internal For tests: drop every registration. */
53
- export declare function _resetLiveRegistries(): void;
@@ -12,5 +12,3 @@ export declare function toUnsignedLong(v: unknown): number;
12
12
  export declare function toShort(v: unknown): number;
13
13
  /** https://webidl.spec.whatwg.org/#es-unsigned-short */
14
14
  export declare function toUnsignedShort(v: unknown): number;
15
- /** A dictionary argument: undefined/null → null (use defaults), objects pass, others throw. */
16
- export declare function toDictionary(v: unknown, iface: string): Record<string, unknown> | null;
@@ -0,0 +1,2 @@
1
+ /** Hide the inspector-only members of `console` (see above). Returns the undo, or null when there is nothing to hide. */
2
+ export declare function hideDevtoolsConsole(console: object | undefined): (() => void) | null;
@@ -0,0 +1,9 @@
1
+ /** The descriptor to define for `key` on `o`: `desc`, or a shared pair standing for it. */
2
+ export declare function sharedAccessor(o: unknown, key: PropertyKey, desc: PropertyDescriptor): PropertyDescriptor;
3
+ /**
4
+ * Wrap `Object.defineProperty` of the realm whose `Object` is `O` (see the top of this file).
5
+ * Returns the undo; nested calls for one realm share the wrapper.
6
+ */
7
+ export declare function shareAccessors(O: ObjectConstructor): () => void;
8
+ /** `O.defineProperty` without this file's wrapper, for a wrapper that calls `sharedAccessor` itself. */
9
+ export declare function unsharedDefineProperty(O: ObjectConstructor): ObjectConstructor["defineProperty"];
@@ -1,4 +1,4 @@
1
- import{createRequire as e}from"node:module";import{prettyDOM as t,queries as n}from"@ctrl/dom/testing-library";import{daa06 as r,getImplicitAriaRolesJestDom as i,roles as a}from"@ctrl/dom/aria";import{$impl as o,ELEMENT_NODE as s,F_HTML as c,asciiLowercase as l,computedValue as u,getAttribute as p,getComputedStyleOverride as ee}from"@ctrl/dom/internal";import{AriaTemplateError as m,matchAriaSnapshot as h}from"@ctrl/dom/testing-library/agent";var g=Object.defineProperty,__name=(e,t)=>g(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let n={};for(var r in e)g(n,r,{get:e[r],enumerable:!0});return t||g(n,Symbol.toStringTag,{value:`Module`}),n},GenericTypeError=class extends Error{constructor(e,t,n,r){super(),Error.captureStackTrace&&Error.captureStackTrace(this,n);let i=``;try{i=r.utils.printWithType(`Received`,t,r.utils.printReceived)}catch{}this.message=[r.utils.matcherHint(`${r.isNot?`.not`:``}.${n.name}`,`received`,``),``,`${r.utils.RECEIVED_COLOR(`received`)} value must ${e}.`,i].join(`
1
+ import{createRequire as e}from"node:module";import{prettyDOM as t,queries as n}from"../../testing-library/index.js";import{daa06 as r,getImplicitAriaRolesJestDom as i,roles as a}from"../../aria/index.js";import{$impl as o,ELEMENT_NODE as s,F_HTML as c,asciiLowercase as l,computedValue as u,getAttribute as p,getComputedStyleOverride as ee}from"../../bridge/internal.js";import{AriaTemplateError as m,matchAriaSnapshot as h}from"../../testing-library/agent.js";var g=Object.defineProperty,__name=(e,t)=>g(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let n={};for(var r in e)g(n,r,{get:e[r],enumerable:!0});return t||g(n,Symbol.toStringTag,{value:`Module`}),n},GenericTypeError=class extends Error{constructor(e,t,n,r){super(),Error.captureStackTrace&&Error.captureStackTrace(this,n);let i=``;try{i=r.utils.printWithType(`Received`,t,r.utils.printReceived)}catch{}this.message=[r.utils.matcherHint(`${r.isNot?`.not`:``}.${n.name}`,`received`,``),``,`${r.utils.RECEIVED_COLOR(`received`)} value must ${e}.`,i].join(`
2
2
  `)}},HtmlElementTypeError=class extends GenericTypeError{constructor(e,t,n){super(`be an HTMLElement or an SVGElement`,e,t,n)}},NodeTypeError=class extends GenericTypeError{constructor(e,t,n){super(`be a Node`,e,t,n)}};function checkHasWindow(e,t,n,r){if(!e||!e.ownerDocument||!e.ownerDocument.defaultView)throw new t(e,n,r)}function checkNode(e,t,n){if(checkHasWindow(e,NodeTypeError,t,n),!(e instanceof e.ownerDocument.defaultView.Node))throw new NodeTypeError(e,t,n)}function checkHtmlElement(e,t,n){checkHasWindow(e,HtmlElementTypeError,t,n);let r=e.ownerDocument.defaultView;if(!(e instanceof r.HTMLElement)&&!(e instanceof r.SVGElement))throw new HtmlElementTypeError(e,t,n)}var InvalidCSSError=class extends Error{constructor(e,t,n){super(),Error.captureStackTrace&&Error.captureStackTrace(this,t),this.message=[e.message,``,n.utils.RECEIVED_COLOR(`Failing css:`),n.utils.RECEIVED_COLOR(`${e.css}`)].join(`
3
3
  `)}};let _=null;function parseCSS(t,n,r){_??=e(import.meta.url)(`@adobe/css-tools`).parse;let i=_(`selector { ${t} }`,{silent:!0}).stylesheet;if(i.parsingErrors&&i.parsingErrors.length>0){let{reason:e,line:a}=i.parsingErrors[0];throw new InvalidCSSError({css:t,message:`Syntax error parsing expected css: ${e} on line: ${a}`},n,r)}let a={},o=i.rules[0].declarations;for(let e=0;e<o.length;e++){let t=o[e];t.type===`declaration`&&(a[t.property]=t.value)}return a}function display(e,t){return typeof t==`string`?t:e.utils.stringify(t)}function getMessage(e,t,n,r,i,a){return[`${t}\n`,`${n}:\n${e.utils.EXPECTED_COLOR(redent(display(e,r),2))}`,`${i}:\n${e.utils.RECEIVED_COLOR(redent(display(e,a),2))}`].join(`
4
4
  `)}function matches(e,t){return t instanceof RegExp?t.test(e):e.includes(String(t))}function deprecate(e,t){console.warn(`Warning: ${e} has been deprecated and will be removed in future updates.`,t)}function normalize(e){return e.replace(/\s+/g,` `).trim()}function getTag(e){return e.tagName&&e.tagName.toLowerCase()}function getSelectValue({multiple:e,options:t}){let n=[];for(let e=0;e<t.length;e++)t[e].selected&&n.push(t[e]);if(e)return n.map(e=>e.value);if(n.length!==0)return n[0].value}function getInputValue(e){switch(e.type){case`number`:return e.value===``?null:Number(e.value);case`checkbox`:return e.checked;default:return e.value}}const v=[`meter`,`progressbar`,`slider`,`spinbutton`];function getAccessibleValue(e){if(v.includes(e.getAttribute(`role`)))return Number(e.getAttribute(`aria-valuenow`))}function getSingleElementValue(e){if(e)switch(e.tagName.toLowerCase()){case`input`:return getInputValue(e);case`select`:return getSelectValue(e);default:return e.value??getAccessibleValue(e)}}function toSentence(e,{wordConnector:t=`, `,lastWordConnector:n=` and `}={}){return[e.slice(0,-1).join(t),e[e.length-1]].join(e.length>1?n:``)}function compareAsSet(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=new Set(t);return[...new Set(e)].every(e=>n.has(e))}return e===t}function redent(e,t){let n=e.match(/^[ \t]*(?=\S)/gm),r=0;n&&(r=n.reduce((e,t)=>Math.min(e,t.length),1/0));let i=r>0?e.replace(RegExp(`^[ \\t]{${r}}`,`gm`),``):e;return t===0?i:i.replace(/^(?!\s*$)/gm,` `.repeat(t))}const y=process.env,b=process.argv,x=!(y.NO_COLOR||b.includes(`--no-color`))&&(!!y.FORCE_COLOR||b.includes(`--color`)||process.platform===`win32`||process.stdout?.isTTY&&y.TERM!==`dumb`||!!y.CI);function picoRed(e){if(!x)return String(e);let t=`\x1B[31m`,n=`\x1B[39m`,r=``+e,i=r.indexOf(n,5);if(i===-1)return t+r+n;let a=``,o=0;do a+=r.substring(o,i)+t,o=i+5,i=r.indexOf(n,o);while(i!==-1);return t+a+r.substring(o)+n}const S=[`alt text`,`display value`,`label text`,`placeholder text`,`role`,`test ID`,`text`,`title`];function toPascalCase(e){return e.split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}function createQueryMatcher(e,r){let i=toPascalCase(r),a=`toContain${e}By${i}`,o=n[`queryAllBy${i}`];function queryMatcher(n,...i){checkHtmlElement(n,queryMatcher,this);let s=o(n,...i);return{message:()=>{let n=this.isNot?`not to`:`to`,o=this.utils.matcherHint(`${this.isNot?`.not`:``}.${a}`,`element`,r,{secondArgument:i[1]===void 0?void 0:this.utils.printExpected(i[1])}),c=[getMessage(this,o,`Expected element ${n} contain ${e.toLowerCase()} descendant by ${r}`,i[0],`Received`,s.length)],l=s.map(e=>t(e)).filter(e=>typeof e==`string`);return l.length&&c.push(`Here are the matching elements:`,...l),c.join(`
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},__copyProps=(r,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!i.call(r,d)&&d!==o&&e(r,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return r},__reExport=(e,t,n)=>(__copyProps(e,t,`default`),n&&__copyProps(n,t,`default`)),__toESM=(t,n,a)=>(a=t==null?{}:{__proto__:r(t)},__copyProps(n||!t||!t.__esModule||!i.call(t,`default`)?e(a,`default`,{value:t,enumerable:!0}):a,t));let a=require("react");a=__toESM(a,1);let o=require("@ctrl/dom/testing-library"),s=require("@ctrl/dom/internal"),c=require("react-dom/client");c=__toESM(c,1);let l={reactStrictMode:!1,releaseSuspendedWork:!0};function releaseSuspendedWorkEnabled(){return l.releaseSuspendedWork}function reactStrictModeEnabled(){return l.reactStrictMode}function getConfig(){return{...(0,o.getConfig)(),...l}}function configure(e){typeof e==`function`&&(e=e(getConfig()));let{reactStrictMode:t,releaseSuspendedWork:n,...r}=e;(0,o.configure)(r),l={...l,reactStrictMode:t,releaseSuspendedWork:n??l.releaseSuspendedWork}}const u=a.act;function setReactActEnvironment(e){globalThis.IS_REACT_ACT_ENVIRONMENT=e}function getIsReactActEnvironment(){return globalThis.IS_REACT_ACT_ENVIRONMENT}const d=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,f=/* @__PURE__ */ new Set;function flushReleasingSuspendedWork(e){let t=!1,n=0;try{for(;n<e.length;n++){let r=e[n];for(;r!==null;)if(d.didUsePromise=!1,r=r(!1),r!==null&&d.didUsePromise){t=!0;break}}e.length=0}catch(t){e.splice(0,n+1),d.thrownErrors.unshift(t)}if(t)for(let e of f){let t=e._internalRoot,n=t?.callbackNode;n!=null&&n.callback===void 0&&(t.callbackNode=null,t.callbackPriority=0)}if(d.thrownErrors.length>0)return d.thrownErrors.splice(0)}function isThenable(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function withGlobalActEnvironment(e){return t=>{let n=getIsReactActEnvironment();setReactActEnvironment(!0);try{let r=!1,i=e(()=>{let e=t();return isThenable(e)&&(r=!0),e});if(r){let e=i;return{then:(t,r)=>{e.then(e=>{setReactActEnvironment(n),t(e)},e=>{setReactActEnvironment(n),r(e)})}}}return setReactActEnvironment(n),i}catch(e){throw setReactActEnvironment(n),e}}}const p=withGlobalActEnvironment(u);function actReleasingSuspendedWork(e){let t=getIsReactActEnvironment();setReactActEnvironment(!0);let n;try{if(d.actQueue!==null||!releaseSuspendedWorkEnabled()){u(e);return}u(()=>{let t=d.actQueue;e(),n=flushReleasingSuspendedWork(t)})}catch(e){if(n===void 0)throw e;n.push(e)}finally{setReactActEnvironment(t)}if(n!==void 0){if(n.length===1)throw n[0];if(n.length>1)throw AggregateError(n)}}const fireEvent=((...e)=>(0,o.fireEvent)(...e)),m=fireEvent,h=o.fireEvent;for(let e of Object.keys(o.fireEvent))m[e]=(...t)=>h[e](...t);const g=m.mouseEnter,_=m.mouseLeave;m.mouseEnter=(...e)=>(g(...e),m.mouseOver(...e)),m.mouseLeave=(...e)=>(_(...e),m.mouseOut(...e));const v=m.pointerEnter,y=m.pointerLeave;m.pointerEnter=(...e)=>(v(...e),m.pointerOver(...e)),m.pointerLeave=(...e)=>(y(...e),m.pointerOut(...e));const b=m.select;m.select=(e,t)=>{b(e,t),e.focus(),m.keyUp(e,t)};const x=m.blur,S=m.focus;m.blur=(...e)=>(m.focusOut(...e),x(...e)),m.focus=(...e)=>(m.focusIn(...e),S(...e));function advanceFakeTimersIfEnabled(){if(typeof jest<`u`&&jest!==null){(setTimeout._isMockFunction===!0||Object.prototype.hasOwnProperty.call(setTimeout,`clock`))&&jest.advanceTimersByTime(0);return}let e=setTimeout.clock;typeof e?.tick==`function`&&e.tick(0)}function drainWithTimer(e){setTimeout(()=>{e()},0),advanceFakeTimersIfEnabled()}async function finishAsyncWrapper(e,t){try{let t=await e;return await new Promise(e=>{(0,s.canSkipZeroDelayWait)(globalThis)?(0,s.loopTurn)(()=>(0,s.skipZeroDelayWait)(globalThis)?e():drainWithTimer(e)):drainWithTimer(e)}),t}finally{setReactActEnvironment(t)}}let C=!1;(0,o.configure)({unstable_advanceTimersWrapper:e=>p(e),asyncWrapper:e=>{let t=getIsReactActEnvironment();setReactActEnvironment(!1);try{return finishAsyncWrapper(e(),t)}catch(e){return setReactActEnvironment(t),Promise.reject(e)}},eventWrapper:e=>{if(C)return e();C=!0;try{let t;return actReleasingSuspendedWork(()=>{t=e()}),t}finally{C=!1}}});const w=/* @__PURE__ */ new WeakMap,T=[],E=/* @__PURE__ */ new WeakMap,D=/* @__PURE__ */ new WeakMap;function strictModeIfNeeded(e,t){return t??reactStrictModeEnabled()?a.createElement(a.StrictMode,null,e):e}function wrapUiIfNeeded(e,t){return t?a.createElement(t,null,e):e}function createConcurrentRoot(e,{hydrate:t,onCaughtError:n,onRecoverableError:r,ui:i,wrapper:a,reactStrictMode:o}){let s;if(t)try{actReleasingSuspendedWork(()=>{s=c.hydrateRoot(e,strictModeIfNeeded(wrapUiIfNeeded(i,a),o),{onCaughtError:n,onRecoverableError:r}),f.add(s)})}catch(e){throw f.delete(s),e}else s=c.createRoot(e,{onCaughtError:n,onRecoverableError:r}),f.add(s);return wrapRoot(s,t)}function wrapRoot(e,t){return{hydrate(){if(!t)throw Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(t){e.render(t)},unmount(){try{e.unmount()}finally{f.delete(e)}}}}const O=/* @__PURE__ */ new WeakMap;function resultTemplateFor(e){let t=O.get(e);return t===void 0&&(t={container:void 0,baseElement:void 0,debug:void 0,unmount:void 0,rerender:void 0,asFragment:void 0,...(0,o.getQueriesForElement)(e)},O.set(e,t)),t}function actRender(e,t,n,r,i){actReleasingSuspendedWork(()=>{n?t.hydrate():t.render(strictModeIfNeeded(wrapUiIfNeeded(e,r),i))})}function renderRoot(e,{baseElement:t,container:n,hydrate:r,queries:i,root:a,wrapper:c,reactStrictMode:l}){actRender(e,a,r,c,l);let debug=(e=t,n,r)=>Array.isArray(e)?e.forEach(e=>console.log((0,o.prettyDOM)(e,n,r))):console.log((0,o.prettyDOM)(e,n,r)),unmount=()=>{p(()=>{a.unmount()})},rerender=e=>{let rerender=()=>actRender(e,a,!1,c,l);(0,s.tracing)()?(0,s.traceSync)(`react.rerender`,`rerender(${describeElement(e)})`,rerender):rerender()},asFragment=()=>{if(typeof document.createRange==`function`)return document.createRange().createContextualFragment(n.innerHTML);let e=document.createElement(`template`);return e.innerHTML=n.innerHTML,e.content};if(i!==void 0)return{container:n,baseElement:t,debug,unmount,rerender,asFragment,...(0,o.getQueriesForElement)(t,i)};let u={...resultTemplateFor(t)};return u.container=n,u.baseElement=t,u.debug=debug,u.unmount=unmount,u.rerender=rerender,u.asFragment=asFragment,u}function legacyRootError(e){let t=/* @__PURE__ */ Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");return Error.captureStackTrace(t,e),t}function render(e,t){return(0,s.tracing)()?(0,s.traceSync)(`react.render`,`render(${describeElement(e)})`,()=>renderUntraced(e,t)):renderUntraced(e,t)}function describeElement(e){if(!a.isValidElement(e))return typeof e==`string`?JSON.stringify(e):String(e);let t=e;for(let e=0;e<10;e++){let e=isWrapper(t)?wrappedElement(t):null;if(e===null)break;t=e}return describeTree(t,0)}function describeTree(e,t){let n=componentName(e.type)||`Component`;if(typeof e.type!=`string`)return`<${n} />`;let r=e.props.children;if(r==null||r===!1)return`<${n} />`;let i=onlyElement(r);return i!==null&&t<2?`<${n}>${describeTree(i,t+1)}</${n}>`:`<${n}>…</${n}>`}function componentName(e){if(typeof e==`string`)return e;if(typeof e==`symbol`)return e.description?.replace(/^react\./,``)??``;let t=e;return(t?.displayName??t?.name??t?.render?.name??t?.type?.name??``).replace(/\$\d+$/,``)}const k=/(?:Providers?|Context|Router|Wrapper|Fragment|StrictMode|Suspense|Profiler)$/;function isWrapper(e){if(typeof e.type==`symbol`)return!0;let t=componentName(e.type);return k.test(t)||t===``&&onlyElement(e.props.children)!==null}function wrappedElement(e){let t=e.props;return onlyElement(t.children)??firstRouteElement(t.router?.routes)}function firstRouteElement(e){for(let t of e??[]){let e=onlyElement(t.element);if(e!==null&&componentName(e.type)!==`Outlet`)return e;let n=firstRouteElement(t.children);if(n!==null)return n}return null}function onlyElement(e){if(a.isValidElement(e))return e;if(!Array.isArray(e))return null;let t=e.filter(e=>a.isValidElement(e));return t.length===1?t[0]:null}function renderUntraced(e,{container:t,baseElement:n=t,legacyRoot:r=!1,onCaughtError:i,onUncaughtError:a,onRecoverableError:o,queries:c,hydrate:l=!1,wrapper:u,reactStrictMode:d}={}){if(a!==void 0)throw Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(r)throw legacyRootError(render);n||=document.body;let f=!1;if(!t){let e=E.get(document);for(;e?.length&&!t;)t=e.pop().deref();f=!t,t=n.appendChild(t??document.createElement(`div`))}let p=w.get(t);return p===void 0&&(p=createConcurrentRoot(t,{hydrate:l,onCaughtError:i,onRecoverableError:o,ui:e,wrapper:u,reactStrictMode:d}),f&&D.set(t,{listeners:(0,s.listenerCount)(t),keys:Object.keys(t).length}),w.set(t,p),T.push(new WeakRef(t))),renderRoot(e,{container:t,baseElement:n,queries:c,hydrate:l,wrapper:u,root:p,reactStrictMode:d})}function cleanup(){let e;for(let t of T){let n=t.deref();if(n===void 0)continue;let r=w.get(n);if(r!==void 0){try{p(()=>r.unmount())}catch(t){(e??=[]).push(t),D.delete(n)}try{removeContainer(n,t)}catch(t){(e??=[]).push(t)}w.delete(n)}}if(T.length=0,e!==void 0)throw e.length===1?e[0]:AggregateError(e,`React cleanup failed`)}function removeContainer(e,t){if(e.parentNode!==document.body)return;document.body.removeChild(e);let n=D.get(e);if(n!==void 0&&(e.onclick=null,(0,s.reusableElement)(e,n.listeners)&&Object.keys(e).length===n.keys)){let e=E.get(document);e===void 0&&E.set(document,e=[]),e.length<8&&e.push(t)}}(0,s.registerTestHooks)(`react`,{fileEnd(){try{cleanup()}finally{dropHoistedResources()}}});function dropHoistedResources(){for(let e of Object.keys(document)){if(!e.startsWith(`__reactResources$`))continue;let t=document[e];for(let e of[t?.hoistableStyles,t?.hoistableScripts])if(e instanceof Map)for(let t of e.values()){let e=t?.instance??t;typeof e?.remove==`function`&&e.remove()}delete document[e]}}function renderHook(e,t={}){let{initialProps:n,...r}=t;if(r.legacyRoot)throw legacyRootError(renderHook);let i=a.createRef();function TestComponent({renderCallbackProps:t}){let n=e(t);return a.useEffect(()=>{i.current=n}),null}let{rerender:o,unmount:s}=render(a.createElement(TestComponent,{renderCallbackProps:n}),r);function rerender(e){return o(a.createElement(TestComponent,{renderCallbackProps:e}))}return{result:i,rerender,unmount:s}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return configure}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return __reExport}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return fireEvent}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return getConfig}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return render}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return getIsReactActEnvironment}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return renderHook}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return setReactActEnvironment}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return cleanup}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return __exportAll}});
@@ -0,0 +1 @@
1
+ import*as e from"react";import{configure as t,fireEvent as n,getConfig as r,getQueriesForElement as i,prettyDOM as a}from"../../testing-library/index.js";import{canSkipZeroDelayWait as o,listenerCount as s,loopTurn as c,registerTestHooks as l,reusableElement as u,skipZeroDelayWait as d,traceSync as f,tracing as p}from"../../bridge/internal.js";import*as m from"react-dom/client";var h=Object.defineProperty,__name=(e,t)=>h(e,`name`,{value:t,configurable:!0}),g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.prototype.hasOwnProperty,__exportAll=(e,t)=>{let n={};for(var r in e)h(n,r,{get:e[r],enumerable:!0});return t||h(n,Symbol.toStringTag,{value:`Module`}),n},__copyProps=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_(t),a=0,o=i.length,s;a<o;a++)s=i[a],!v.call(e,s)&&s!==n&&h(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=g(t,s))||r.enumerable});return e},__reExport=(e,t,n)=>(__copyProps(e,t,`default`),n&&__copyProps(n,t,`default`));let y={reactStrictMode:!1,releaseSuspendedWork:!0};function releaseSuspendedWorkEnabled(){return y.releaseSuspendedWork}function reactStrictModeEnabled(){return y.reactStrictMode}function getConfig$1(){return{...r(),...y}}__name(getConfig$1,`getConfig`);function configure$1(e){typeof e==`function`&&(e=e(getConfig$1()));let{reactStrictMode:n,releaseSuspendedWork:r,...i}=e;t(i),y={...y,reactStrictMode:n,releaseSuspendedWork:r??y.releaseSuspendedWork}}__name(configure$1,`configure`);const b=e.act;function setReactActEnvironment(e){globalThis.IS_REACT_ACT_ENVIRONMENT=e}function getIsReactActEnvironment(){return globalThis.IS_REACT_ACT_ENVIRONMENT}const x=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=/* @__PURE__ */ new Set;function flushReleasingSuspendedWork(e){let t=!1,n=0;try{for(;n<e.length;n++){let r=e[n];for(;r!==null;)if(x.didUsePromise=!1,r=r(!1),r!==null&&x.didUsePromise){t=!0;break}}e.length=0}catch(t){e.splice(0,n+1),x.thrownErrors.unshift(t)}if(t)for(let e of S){let t=e._internalRoot,n=t?.callbackNode;n!=null&&n.callback===void 0&&(t.callbackNode=null,t.callbackPriority=0)}if(x.thrownErrors.length>0)return x.thrownErrors.splice(0)}function isThenable(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function withGlobalActEnvironment(e){return t=>{let n=getIsReactActEnvironment();setReactActEnvironment(!0);try{let r=!1,i=e(()=>{let e=t();return isThenable(e)&&(r=!0),e});if(r){let e=i;return{then:(t,r)=>{e.then(e=>{setReactActEnvironment(n),t(e)},e=>{setReactActEnvironment(n),r(e)})}}}return setReactActEnvironment(n),i}catch(e){throw setReactActEnvironment(n),e}}}const C=withGlobalActEnvironment(b);function actReleasingSuspendedWork(e){let t=getIsReactActEnvironment();setReactActEnvironment(!0);let n;try{if(x.actQueue!==null||!releaseSuspendedWorkEnabled()){b(e);return}b(()=>{let t=x.actQueue;e(),n=flushReleasingSuspendedWork(t)})}catch(e){if(n===void 0)throw e;n.push(e)}finally{setReactActEnvironment(t)}if(n!==void 0){if(n.length===1)throw n[0];if(n.length>1)throw AggregateError(n)}}const w=/* @__PURE__ */ __name(((...e)=>n(...e)),`fireEvent`),T=w,E=n;for(let e of Object.keys(n))T[e]=(...t)=>E[e](...t);const D=T.mouseEnter,O=T.mouseLeave;T.mouseEnter=(...e)=>(D(...e),T.mouseOver(...e)),T.mouseLeave=(...e)=>(O(...e),T.mouseOut(...e));const k=T.pointerEnter,A=T.pointerLeave;T.pointerEnter=(...e)=>(k(...e),T.pointerOver(...e)),T.pointerLeave=(...e)=>(A(...e),T.pointerOut(...e));const j=T.select;T.select=(e,t)=>{j(e,t),e.focus(),T.keyUp(e,t)};const M=T.blur,N=T.focus;T.blur=(...e)=>(T.focusOut(...e),M(...e)),T.focus=(...e)=>(T.focusIn(...e),N(...e));function advanceFakeTimersIfEnabled(){if(typeof jest<`u`&&jest!==null){(setTimeout._isMockFunction===!0||Object.prototype.hasOwnProperty.call(setTimeout,`clock`))&&jest.advanceTimersByTime(0);return}let e=setTimeout.clock;typeof e?.tick==`function`&&e.tick(0)}function drainWithTimer(e){setTimeout(()=>{e()},0),advanceFakeTimersIfEnabled()}async function finishAsyncWrapper(e,t){try{let t=await e;return await new Promise(e=>{o(globalThis)?c(()=>d(globalThis)?e():drainWithTimer(e)):drainWithTimer(e)}),t}finally{setReactActEnvironment(t)}}let P=!1;t({unstable_advanceTimersWrapper:e=>C(e),asyncWrapper:e=>{let t=getIsReactActEnvironment();setReactActEnvironment(!1);try{return finishAsyncWrapper(e(),t)}catch(e){return setReactActEnvironment(t),Promise.reject(e)}},eventWrapper:e=>{if(P)return e();P=!0;try{let t;return actReleasingSuspendedWork(()=>{t=e()}),t}finally{P=!1}}});const F=/* @__PURE__ */ new WeakMap,I=[],L=/* @__PURE__ */ new WeakMap,R=/* @__PURE__ */ new WeakMap;function strictModeIfNeeded(t,n){return n??reactStrictModeEnabled()?e.createElement(e.StrictMode,null,t):t}function wrapUiIfNeeded(t,n){return n?e.createElement(n,null,t):t}function createConcurrentRoot(e,{hydrate:t,onCaughtError:n,onRecoverableError:r,ui:i,wrapper:a,reactStrictMode:o}){let s;if(t)try{actReleasingSuspendedWork(()=>{s=m.hydrateRoot(e,strictModeIfNeeded(wrapUiIfNeeded(i,a),o),{onCaughtError:n,onRecoverableError:r}),S.add(s)})}catch(e){throw S.delete(s),e}else s=m.createRoot(e,{onCaughtError:n,onRecoverableError:r}),S.add(s);return wrapRoot(s,t)}function wrapRoot(e,t){return{hydrate(){if(!t)throw Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(t){e.render(t)},unmount(){try{e.unmount()}finally{S.delete(e)}}}}const z=/* @__PURE__ */ new WeakMap;function resultTemplateFor(e){let t=z.get(e);return t===void 0&&(t={container:void 0,baseElement:void 0,debug:void 0,unmount:void 0,rerender:void 0,asFragment:void 0,...i(e)},z.set(e,t)),t}function actRender(e,t,n,r,i){actReleasingSuspendedWork(()=>{n?t.hydrate():t.render(strictModeIfNeeded(wrapUiIfNeeded(e,r),i))})}function renderRoot(e,{baseElement:t,container:n,hydrate:r,queries:o,root:s,wrapper:c,reactStrictMode:l}){actRender(e,s,r,c,l);let debug=(e=t,n,r)=>Array.isArray(e)?e.forEach(e=>console.log(a(e,n,r))):console.log(a(e,n,r)),unmount=()=>{C(()=>{s.unmount()})},rerender=e=>{let rerender=()=>actRender(e,s,!1,c,l);p()?f(`react.rerender`,`rerender(${describeElement(e)})`,rerender):rerender()},asFragment=()=>{if(typeof document.createRange==`function`)return document.createRange().createContextualFragment(n.innerHTML);let e=document.createElement(`template`);return e.innerHTML=n.innerHTML,e.content};if(o!==void 0)return{container:n,baseElement:t,debug,unmount,rerender,asFragment,...i(t,o)};let u={...resultTemplateFor(t)};return u.container=n,u.baseElement=t,u.debug=debug,u.unmount=unmount,u.rerender=rerender,u.asFragment=asFragment,u}function legacyRootError(e){let t=/* @__PURE__ */ Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");return Error.captureStackTrace(t,e),t}function render(e,t){return p()?f(`react.render`,`render(${describeElement(e)})`,()=>renderUntraced(e,t)):renderUntraced(e,t)}function describeElement(t){if(!e.isValidElement(t))return typeof t==`string`?JSON.stringify(t):String(t);let n=t;for(let e=0;e<10;e++){let e=isWrapper(n)?wrappedElement(n):null;if(e===null)break;n=e}return describeTree(n,0)}function describeTree(e,t){let n=componentName(e.type)||`Component`;if(typeof e.type!=`string`)return`<${n} />`;let r=e.props.children;if(r==null||r===!1)return`<${n} />`;let i=onlyElement(r);return i!==null&&t<2?`<${n}>${describeTree(i,t+1)}</${n}>`:`<${n}>…</${n}>`}function componentName(e){if(typeof e==`string`)return e;if(typeof e==`symbol`)return e.description?.replace(/^react\./,``)??``;let t=e;return(t?.displayName??t?.name??t?.render?.name??t?.type?.name??``).replace(/\$\d+$/,``)}const B=/(?:Providers?|Context|Router|Wrapper|Fragment|StrictMode|Suspense|Profiler)$/;function isWrapper(e){if(typeof e.type==`symbol`)return!0;let t=componentName(e.type);return B.test(t)||t===``&&onlyElement(e.props.children)!==null}function wrappedElement(e){let t=e.props;return onlyElement(t.children)??firstRouteElement(t.router?.routes)}function firstRouteElement(e){for(let t of e??[]){let e=onlyElement(t.element);if(e!==null&&componentName(e.type)!==`Outlet`)return e;let n=firstRouteElement(t.children);if(n!==null)return n}return null}function onlyElement(t){if(e.isValidElement(t))return t;if(!Array.isArray(t))return null;let n=t.filter(t=>e.isValidElement(t));return n.length===1?n[0]:null}function renderUntraced(e,{container:t,baseElement:n=t,legacyRoot:r=!1,onCaughtError:i,onUncaughtError:a,onRecoverableError:o,queries:c,hydrate:l=!1,wrapper:u,reactStrictMode:d}={}){if(a!==void 0)throw Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(r)throw legacyRootError(render);n||=document.body;let f=!1;if(!t){let e=L.get(document);for(;e?.length&&!t;)t=e.pop().deref();f=!t,t=n.appendChild(t??document.createElement(`div`))}let p=F.get(t);return p===void 0&&(p=createConcurrentRoot(t,{hydrate:l,onCaughtError:i,onRecoverableError:o,ui:e,wrapper:u,reactStrictMode:d}),f&&R.set(t,{listeners:s(t),keys:Object.keys(t).length}),F.set(t,p),I.push(new WeakRef(t))),renderRoot(e,{container:t,baseElement:n,queries:c,hydrate:l,wrapper:u,root:p,reactStrictMode:d})}function cleanup(){let e;for(let t of I){let n=t.deref();if(n===void 0)continue;let r=F.get(n);if(r!==void 0){try{C(()=>r.unmount())}catch(t){(e??=[]).push(t),R.delete(n)}try{removeContainer(n,t)}catch(t){(e??=[]).push(t)}F.delete(n)}}if(I.length=0,e!==void 0)throw e.length===1?e[0]:AggregateError(e,`React cleanup failed`)}function removeContainer(e,t){if(e.parentNode!==document.body)return;document.body.removeChild(e);let n=R.get(e);if(n!==void 0&&(e.onclick=null,u(e,n.listeners)&&Object.keys(e).length===n.keys)){let e=L.get(document);e===void 0&&L.set(document,e=[]),e.length<8&&e.push(t)}}l(`react`,{fileEnd(){try{cleanup()}finally{dropHoistedResources()}}});function dropHoistedResources(){for(let e of Object.keys(document)){if(!e.startsWith(`__reactResources$`))continue;let t=document[e];for(let e of[t?.hoistableStyles,t?.hoistableScripts])if(e instanceof Map)for(let t of e.values()){let e=t?.instance??t;typeof e?.remove==`function`&&e.remove()}delete document[e]}}function renderHook(t,n={}){let{initialProps:r,...i}=n;if(i.legacyRoot)throw legacyRootError(renderHook);let a=e.createRef();function TestComponent({renderCallbackProps:n}){let r=t(n);return e.useEffect(()=>{a.current=r}),null}let{rerender:o,unmount:s}=render(e.createElement(TestComponent,{renderCallbackProps:r}),i);function rerender(t){return o(e.createElement(TestComponent,{renderCallbackProps:t}))}return{result:a,rerender,unmount:s}}export{C as a,configure$1 as c,__reExport as d,w as i,getConfig$1 as l,render as n,getIsReactActEnvironment as o,renderHook as r,setReactActEnvironment as s,cleanup as t,__exportAll as u};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/pure-DvYA3m08.cjs");let t=require("@ctrl/dom/internal");var n=/* @__PURE__ */ e.d({act:()=>e.o,cleanup:()=>e.t,configure:()=>e.l,fireEvent:()=>e.a,getConfig:()=>e.u,render:()=>e.r,renderHook:()=>e.i});if(e.f(n,e.n),(typeof process>`u`||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&(typeof afterEach==`function`?(afterEach(()=>{e.t()}),(0,t.registerTestHooks)(`react`,{afterEach:e.t})):typeof teardown==`function`&&teardown(()=>{e.t()}),typeof beforeAll==`function`&&typeof afterAll==`function`)){let n=e.s(),enterActEnvironment=()=>{n=e.s(),e.c(!0)},leaveActEnvironment=()=>{e.c(n)};beforeAll(enterActEnvironment),afterAll(leaveActEnvironment),(0,t.registerTestHooks)(`react`,{beforeAll:enterActEnvironment,afterAll:leaveActEnvironment})}exports.act=e.o,exports.cleanup=e.t,exports.configure=e.l,exports.fireEvent=e.a,exports.getConfig=e.u,exports.render=e.r,exports.renderHook=e.i;var r=require("@ctrl/dom/testing-library");Object.keys(r).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/pure-0apusBJy.cjs");let t=require("@ctrl/dom/internal");if((typeof process>`u`||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&(typeof afterEach==`function`?(afterEach(()=>{e.t()}),(0,t.registerTestHooks)(`react`,{afterEach:e.t})):typeof teardown==`function`&&teardown(()=>{e.t()}),typeof beforeAll==`function`&&typeof afterAll==`function`)){let n=e.o(),enterActEnvironment=()=>{n=e.o(),e.s(!0)},leaveActEnvironment=()=>{e.s(n)};beforeAll(enterActEnvironment),afterAll(leaveActEnvironment),(0,t.registerTestHooks)(`react`,{beforeAll:enterActEnvironment,afterAll:leaveActEnvironment})}exports.act=e.a,exports.cleanup=e.t,exports.configure=e.c,exports.fireEvent=e.i,exports.getConfig=e.l,exports.render=e.n,exports.renderHook=e.r;var n=require("@ctrl/dom/testing-library");Object.keys(n).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});
@@ -1 +1 @@
1
- import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./_chunks/pure-BzGfHsO2.js";import{registerTestHooks as f}from"@ctrl/dom/internal";export*from"@ctrl/dom/testing-library";if(r(/* @__PURE__ */ n({act:()=>s,cleanup:()=>u,configure:()=>a,fireEvent:()=>e,getConfig:()=>d,render:()=>c,renderHook:()=>i}),o),(typeof process>`u`||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&(typeof afterEach==`function`?(afterEach(()=>{u()}),f(`react`,{afterEach:u})):typeof teardown==`function`&&teardown(()=>{u()}),typeof beforeAll==`function`&&typeof afterAll==`function`)){let e=l(),enterActEnvironment=()=>{e=l(),t(!0)},leaveActEnvironment=()=>{t(e)};beforeAll(enterActEnvironment),afterAll(leaveActEnvironment),f(`react`,{beforeAll:enterActEnvironment,afterAll:leaveActEnvironment})}export{s as act,u as cleanup,a as configure,e as fireEvent,d as getConfig,c as render,i as renderHook};
1
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./_chunks/pure-CRYsLxrp.js";import{registerTestHooks as l}from"../bridge/internal.js";export*from"../testing-library/index.js";if((typeof process>`u`||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&(typeof afterEach==`function`?(afterEach(()=>{c()}),l(`react`,{afterEach:c})):typeof teardown==`function`&&teardown(()=>{c()}),typeof beforeAll==`function`&&typeof afterAll==`function`)){let e=a(),enterActEnvironment=()=>{e=a(),s(!0)},leaveActEnvironment=()=>{s(e)};beforeAll(enterActEnvironment),afterAll(leaveActEnvironment),l(`react`,{beforeAll:enterActEnvironment,afterAll:leaveActEnvironment})}export{e as act,c as cleanup,t as configure,n as fireEvent,r as getConfig,i as render,o as renderHook};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/pure-DvYA3m08.cjs");exports.act=e.o,exports.cleanup=e.t,exports.configure=e.l,exports.fireEvent=e.a,exports.getConfig=e.u,exports.render=e.r,exports.renderHook=e.i;var t=require("@ctrl/dom/testing-library");Object.keys(t).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./_chunks/pure-0apusBJy.cjs");exports.act=e.a,exports.cleanup=e.t,exports.configure=e.c,exports.fireEvent=e.i,exports.getConfig=e.l,exports.render=e.n,exports.renderHook=e.r;var t=require("@ctrl/dom/testing-library");Object.keys(t).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
@@ -1 +1 @@
1
- export{o as act,t as cleanup,l as configure,a as fireEvent,u as getConfig,r as render,i as renderHook}from"./_chunks/pure-BzGfHsO2.js";export*from"@ctrl/dom/testing-library";
1
+ export{a as act,t as cleanup,c as configure,i as fireEvent,l as getConfig,n as render,r as renderHook}from"./_chunks/pure-CRYsLxrp.js";export*from"../testing-library/index.js";
@@ -1,4 +1,4 @@
1
- import { type Config as ConfigDTL } from "./dtl.js";
1
+ import { type Config as ConfigDTL } from "@ctrl/dom/testing-library";
2
2
  export interface Config extends ConfigDTL {
3
3
  reactStrictMode: boolean;
4
4
  /**
@@ -14,5 +14,7 @@ export interface ConfigFn {
14
14
  }
15
15
  /** `releaseSuspendedWork` without building the merged config (read on every RTL act). */
16
16
  export declare function releaseSuspendedWorkEnabled(): boolean;
17
+ /** `reactStrictMode`, likewise (read on every render and rerender). */
18
+ export declare function reactStrictModeEnabled(): boolean | undefined;
17
19
  export declare function getConfig(): Config;
18
20
  export declare function configure(newConfig: ConfigFn | Partial<Config>): void;
@@ -1,3 +1,3 @@
1
- import { type FireFunction, type FireObject } from "./dtl.js";
1
+ import { type FireFunction, type FireObject } from "@ctrl/dom/testing-library";
2
2
  declare const fireEvent: FireFunction & FireObject;
3
3
  export { fireEvent };
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import * as ReactDOMClient from "react-dom/client";
3
- import { type BoundFunction, type PrettyDOMOptions, type Queries, type prettyFormat, type queries } from "./dtl.js";
3
+ import { type BoundFunction, type PrettyDOMOptions, type Queries, type prettyFormat, type queries } from "@ctrl/dom/testing-library";
4
4
  import act from "./act-compat.js";
5
5
  import { fireEvent } from "./fire-event.js";
6
6
  import { getConfig, configure, type Config, type ConfigFn } from "./config.js";
@@ -132,5 +132,5 @@ export declare function cleanup(): void;
132
132
  * component yourself.
133
133
  */
134
134
  export declare function renderHook<Result, Props, Q extends Queries = typeof queries, Container extends RendererableContainer | HydrateableContainer = DOMElement, BaseElement extends RendererableContainer | HydrateableContainer = Container>(renderCallback: (initialProps: Props) => Result, options?: RenderHookOptions<Props, Q, Container, BaseElement> | undefined): RenderHookResult<Result, Props>;
135
- export * from "./dtl.js";
135
+ export * from "@ctrl/dom/testing-library";
136
136
  export { act, fireEvent, getConfig, configure, type Config, type ConfigFn };
@@ -1,4 +1,4 @@
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(`
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"../../bridge/internal.js";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"../../aria/internal.js";import{readFileSync as D}from"node:fs";import{roleSupportsProp as O}from"../../aria/index.js";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
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
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
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,`&lt;`).replace(/>/g,`&gt;`)}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?` `:`
@@ -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-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+=`
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"../bridge/internal.js";import{roleSupportsProp as h}from"../aria/index.js";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(`
@@ -1,4 +1,4 @@
1
- import{A as e,C as t,D as n,E as r,M as i,O as a,T as o,_ as s,a as c,c as l,h as u,i as d,j as f,k as p,l as m,o as h,p as g,r as _,s as v,t as y,v as b,w as x,x as S,y as C}from"./_chunks/aria-snapshot-diff-BSXxnyqJ.js";import{$impl as w,ELEMENT_NODE as T,F_HTML as ee,HTML_NS as E,T as D,TEXT_NODE as O,ariaAttr as k,asciiLowercase as A,attr as j,describeCall as M,describeNode as te,getComputedStyleOverride as ne,indexedDescendantById as re,nextInTree as N,prefixFlag as ie,tracePromise as ae,traceSync as oe,tracing as P}from"@ctrl/dom/internal";import{computeAccessibleDescriptionImpl as se,computeAccessibleNameImpl as F,implicitRole as ce,isInaccessibleImpl as I,isInaccessibleWithStyle as le,isLabelable as ue,isSubtreeInaccessibleImpl as de,isVisibilityHidden as fe,labelMapForTree as pe,labelsOf as me,tlRole as L,tlRoleMatcher as he,tlRoleMatches as ge}from"@ctrl/dom/aria/internal";import{roleSupportsProp as _e}from"@ctrl/dom/aria";import{AsyncLocalStorage as ve}from"node:async_hooks";const R=/* @__PURE__ */ new Set([`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`]);function isLabelledNodeName(e){return e.prefix===null&&R.has(e.tag===0?A(e.name):e.name)}function buildIdMap(e){let t=/* @__PURE__ */ new Map;for(let n=e.first;n!==null;n=N(n,e))n.type===T&&n.id!==``&&!t.has(n.id)&&t.set(n.id,n);return t}var LabelContext=class{container;containerIds;sameTree;labelMap;constructor(e,t=!1){this.container=e,this.containerIds=null,this.sameTree=t,this.labelMap=null}labelsOf(e){return this.sameTree?(this.labelMap??=pe(this.container)).get(e)??z:me(e)??z}byIdInContainer(e){if(e===``)return null;if(this.containerIds===null){let t=re(this.container,e);if(t!==void 0)return t;this.containerIds=buildIdMap(this.container)}return this.containerIds.get(e)??null}};const z=[];function getTextContent(e){let t=``;for(let n=e.first;n!==null;n=n.next)n.type===O?t+=n.data:n.first===null||n.type===T&&isLabelledNodeName(n)||(t+=getTextContent(n));return t}function getLabelContentImpl(e){if(e.tag===D.label&&e.ns===E)return getTextContent(e);let t=e.node;return t.value||t.textContent}function labelledFormControl(e,t){for(let n=e.first;n!==null;n=N(n,e))if(n.type===T&&R.has(n.name)&&(t===`*`||o(n,t)))return n}function getLabelsImpl(e,t,n=`*`){let r=k(t,`aria-labelledby`);return r?r.split(` `).map(t=>{let n=e.byIdInContainer(t);return n?{content:getLabelContentImpl(n),formControl:null}:{content:``,formControl:null}}):e.labelsOf(t).map(e=>({content:getLabelContentImpl(e),formControl:labelledFormControl(e,n)}))}function assertNotNullOrUndefined(e){if(e==null)throw Error(`It looks like ${e} was passed instead of a matcher. Did you do something like getByText(${e})?`)}function fuzzyMatches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return typeof n==`string`||typeof n==`number`?i.toLowerCase().includes(n.toString().toLowerCase()):typeof n==`function`?n(i,t):matchRegExp(n,i)}function matches$1(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return n instanceof Function?n(i,t):n instanceof RegExp?matchRegExp(n,i):i===String(n)}i(matches$1,`matches`);function isRegExpWhitespace(e){return e<=32?e===32||e>=9&&e<=13:e<160?!1:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function changedByNormalizing(e,t,n){let r=e.length-1,i=!1;for(let a=0;a<=r;a++){let o=e.charCodeAt(a),s=isRegExpWhitespace(o);if(s&&(t&&(a===0||a===r)||n&&(i||o!==32)))return!0;i=s}return!1}const ye=/\s+/g;function getDefaultNormalizer({trim:e=!0,collapseWhitespace:t=!0}={}){return n=>{if(!changedByNormalizing(n,e,t))return n;let r=n;return r=e?r.trim():r,r=t?r.replace(ye,` `):r,r}}const B=getDefaultNormalizer();function textMatcher(e,t,n){if(!e)return(e,r)=>fuzzyMatches(e,r,t,n);if(n===B&&isPlainRegExp(t)){let e;return n=>typeof n==`string`?n.length===0?e??=t.test(``):t.test(B(n)):!1}if(n!==B||typeof t!=`string`&&typeof t!=`number`)return(e,r)=>matches$1(e,r,t,n);let r=String(t);if(changedByNormalizing(r,!0,!0))return()=>!1;let i=r.length,a=r.charCodeAt(0),o=r.charCodeAt(i-1);return e=>{if(typeof e!=`string`||e.length<i)return!1;if(i!==0){let t=e.charCodeAt(0);if(t!==a&&!isRegExpWhitespace(t))return!1;let n=e.charCodeAt(e.length-1);if(n!==o&&!isRegExpWhitespace(n))return!1}return B(e)===r}}function makeNormalizer({trim:e,collapseWhitespace:t,normalizer:n}){if(!n)return e===void 0&&t===void 0?B:getDefaultNormalizer({trim:e,collapseWhitespace:t});if(e!==void 0||t!==void 0)throw Error(`trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer`);return n}const be=RegExp.prototype.exec;function isPlainRegExp(e){return e instanceof RegExp&&!e.global&&!e.sticky&&Object.getPrototypeOf(e)===RegExp.prototype&&!Object.hasOwn(e,`exec`)&&!Object.hasOwn(e,`test`)&&RegExp.prototype.exec===be&&RegExp.prototype.test===xe}const xe=RegExp.prototype.test;function matchRegExp(e,t){let n=e.test(t);return e.global&&e.lastIndex!==0&&(console.warn(`To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.`),e.lastIndex=0),n}function isButtonLikeInput(e){if(e.tag!==D.input||e.ns!==E)return!1;let t=j(e,`type`);if(t===null)return!1;let n=A(t);return n===`submit`||n===`button`||n===`reset`}function getNodeTextImpl(e){if(isButtonLikeInput(e))return e.node.value;let t=``;for(let n=e.first;n!==null;n=n.next)n.type===O&&(t+=n.data);return t}function getNodeText(t){let n=e(t);return n.type===T?getNodeTextImpl(n):t.matches(`input[type=submit], input[type=button], input[type=reset]`)}const Se={computedStyleSupportsPseudoElements:!0};function styleOverride(e){return ne(e)}function nameOptions(e,t){return t===null?e?Se:void 0:{computedStyleSupportsPseudoElements:e,getComputedStyle:t}}const V={implicitRole(e){let t=ce(e);return t===``?null:t},roleMatcher:he,roleSupportsProp(e,t){return typeof e==`string`&&_e(e,t)},computeAccessibleName(e,t,n){return F(e,nameOptions(t,n),5)},computeAccessibleDescription(e,t,n){return se(e,nameOptions(t,n),5)},isInaccessible:I,isInaccessibleWithStyle:le,isSubtreeInaccessible:de};function parentElement(e){let t=e.parent;return t!==null&&t.type===T?t:null}function isInaccessibleImpl$1(e){return V.isInaccessible(e)}i(isInaccessibleImpl$1,`isInaccessibleImpl`);function isInaccessibleChecked(e){let t=styleOverride(e);return t===null?V.isInaccessible(e):V.isInaccessibleWithStyle(e,t,null)}function isInaccessible(t,n={}){let r=e(t),i=n.isSubtreeInaccessible,a=styleOverride(r);if(i===void 0)return a===null?isInaccessibleImpl$1(r):V.isInaccessibleWithStyle(r,a,null);if(a===null?fe(r):a(t).visibility===`hidden`)return!0;for(let e=r;e!==null;e=parentElement(e))if(i(e.node))return!0;return!1}function getImplicitAriaRolesImpl(e){let t=V.implicitRole(e);return t===null?[]:[t]}function getRoles(t,{hidden:n=!1}={}){let r=e(t),i={},a=n===!1?styleOverride(r):null,o=a===null?null:/* @__PURE__ */ new Map,visit=e=>{if(n!==!1||(a===null?isInaccessibleImpl$1(e):V.isInaccessibleWithStyle(e,a,o))===!1){let t=j(e,`role`),n=t===null?getImplicitAriaRolesImpl(e):t.split(` `).slice(0,1);for(let t of n){let n=i[t];Array.isArray(n)?n.push(e.node):i[t]=[e.node]}}for(let t=e.first;t!==null;t=t.next)t.type===T&&visit(t)};return visit(r),i}const Ce={format:`pretty`};function prettyRoles(t,{hidden:n,includeDescription:r}){let i=getRoles(t,{hidden:n}),a=d().computedStyleSupportsPseudoElements,o=styleOverride(e(t));return Object.entries(i).filter(([e])=>e!==`generic`).map(([t,n])=>{let i=`-`.repeat(50);return`${t}:\n\n${n.map(t=>{let n=e(t),i=`Name "${V.computeAccessibleName(n,a,o)}":\n`,s=v(t.cloneNode(!1),void 0,Ce);return r?`${i}${`Description "${V.computeAccessibleDescription(n,a,o)}":\n`}${s}`:`${i}${s}`}).join(`
1
+ import{A as e,C as t,D as n,E as r,M as i,O as a,T as o,_ as s,a as c,c as l,h as u,i as d,j as f,k as p,l as m,o as h,p as g,r as _,s as v,t as y,v as b,w as x,x as S,y as C}from"./_chunks/aria-snapshot-diff-BSXxnyqJ.js";import{$impl as w,ELEMENT_NODE as T,F_HTML as ee,HTML_NS as E,T as D,TEXT_NODE as O,ariaAttr as k,asciiLowercase as A,attr as j,describeCall as M,describeNode as te,getComputedStyleOverride as ne,indexedDescendantById as re,nextInTree as N,prefixFlag as ie,tracePromise as ae,traceSync as oe,tracing as P}from"../bridge/internal.js";import{computeAccessibleDescriptionImpl as se,computeAccessibleNameImpl as F,implicitRole as ce,isInaccessibleImpl as I,isInaccessibleWithStyle as le,isLabelable as ue,isSubtreeInaccessibleImpl as de,isVisibilityHidden as fe,labelMapForTree as pe,labelsOf as me,tlRole as L,tlRoleMatcher as he,tlRoleMatches as ge}from"../aria/internal.js";import{roleSupportsProp as _e}from"../aria/index.js";import{AsyncLocalStorage as ve}from"node:async_hooks";const R=/* @__PURE__ */ new Set([`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`]);function isLabelledNodeName(e){return e.prefix===null&&R.has(e.tag===0?A(e.name):e.name)}function buildIdMap(e){let t=/* @__PURE__ */ new Map;for(let n=e.first;n!==null;n=N(n,e))n.type===T&&n.id!==``&&!t.has(n.id)&&t.set(n.id,n);return t}var LabelContext=class{container;containerIds;sameTree;labelMap;constructor(e,t=!1){this.container=e,this.containerIds=null,this.sameTree=t,this.labelMap=null}labelsOf(e){return this.sameTree?(this.labelMap??=pe(this.container)).get(e)??z:me(e)??z}byIdInContainer(e){if(e===``)return null;if(this.containerIds===null){let t=re(this.container,e);if(t!==void 0)return t;this.containerIds=buildIdMap(this.container)}return this.containerIds.get(e)??null}};const z=[];function getTextContent(e){let t=``;for(let n=e.first;n!==null;n=n.next)n.type===O?t+=n.data:n.first===null||n.type===T&&isLabelledNodeName(n)||(t+=getTextContent(n));return t}function getLabelContentImpl(e){if(e.tag===D.label&&e.ns===E)return getTextContent(e);let t=e.node;return t.value||t.textContent}function labelledFormControl(e,t){for(let n=e.first;n!==null;n=N(n,e))if(n.type===T&&R.has(n.name)&&(t===`*`||o(n,t)))return n}function getLabelsImpl(e,t,n=`*`){let r=k(t,`aria-labelledby`);return r?r.split(` `).map(t=>{let n=e.byIdInContainer(t);return n?{content:getLabelContentImpl(n),formControl:null}:{content:``,formControl:null}}):e.labelsOf(t).map(e=>({content:getLabelContentImpl(e),formControl:labelledFormControl(e,n)}))}function assertNotNullOrUndefined(e){if(e==null)throw Error(`It looks like ${e} was passed instead of a matcher. Did you do something like getByText(${e})?`)}function fuzzyMatches(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return typeof n==`string`||typeof n==`number`?i.toLowerCase().includes(n.toString().toLowerCase()):typeof n==`function`?n(i,t):matchRegExp(n,i)}function matches$1(e,t,n,r){if(typeof e!=`string`)return!1;assertNotNullOrUndefined(n);let i=r(e);return n instanceof Function?n(i,t):n instanceof RegExp?matchRegExp(n,i):i===String(n)}i(matches$1,`matches`);function isRegExpWhitespace(e){return e<=32?e===32||e>=9&&e<=13:e<160?!1:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function changedByNormalizing(e,t,n){let r=e.length-1,i=!1;for(let a=0;a<=r;a++){let o=e.charCodeAt(a),s=isRegExpWhitespace(o);if(s&&(t&&(a===0||a===r)||n&&(i||o!==32)))return!0;i=s}return!1}const ye=/\s+/g;function getDefaultNormalizer({trim:e=!0,collapseWhitespace:t=!0}={}){return n=>{if(!changedByNormalizing(n,e,t))return n;let r=n;return r=e?r.trim():r,r=t?r.replace(ye,` `):r,r}}const B=getDefaultNormalizer();function textMatcher(e,t,n){if(!e)return(e,r)=>fuzzyMatches(e,r,t,n);if(n===B&&isPlainRegExp(t)){let e;return n=>typeof n==`string`?n.length===0?e??=t.test(``):t.test(B(n)):!1}if(n!==B||typeof t!=`string`&&typeof t!=`number`)return(e,r)=>matches$1(e,r,t,n);let r=String(t);if(changedByNormalizing(r,!0,!0))return()=>!1;let i=r.length,a=r.charCodeAt(0),o=r.charCodeAt(i-1);return e=>{if(typeof e!=`string`||e.length<i)return!1;if(i!==0){let t=e.charCodeAt(0);if(t!==a&&!isRegExpWhitespace(t))return!1;let n=e.charCodeAt(e.length-1);if(n!==o&&!isRegExpWhitespace(n))return!1}return B(e)===r}}function makeNormalizer({trim:e,collapseWhitespace:t,normalizer:n}){if(!n)return e===void 0&&t===void 0?B:getDefaultNormalizer({trim:e,collapseWhitespace:t});if(e!==void 0||t!==void 0)throw Error(`trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer`);return n}const be=RegExp.prototype.exec;function isPlainRegExp(e){return e instanceof RegExp&&!e.global&&!e.sticky&&Object.getPrototypeOf(e)===RegExp.prototype&&!Object.hasOwn(e,`exec`)&&!Object.hasOwn(e,`test`)&&RegExp.prototype.exec===be&&RegExp.prototype.test===xe}const xe=RegExp.prototype.test;function matchRegExp(e,t){let n=e.test(t);return e.global&&e.lastIndex!==0&&(console.warn(`To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp.`),e.lastIndex=0),n}function isButtonLikeInput(e){if(e.tag!==D.input||e.ns!==E)return!1;let t=j(e,`type`);if(t===null)return!1;let n=A(t);return n===`submit`||n===`button`||n===`reset`}function getNodeTextImpl(e){if(isButtonLikeInput(e))return e.node.value;let t=``;for(let n=e.first;n!==null;n=n.next)n.type===O&&(t+=n.data);return t}function getNodeText(t){let n=e(t);return n.type===T?getNodeTextImpl(n):t.matches(`input[type=submit], input[type=button], input[type=reset]`)}const Se={computedStyleSupportsPseudoElements:!0};function styleOverride(e){return ne(e)}function nameOptions(e,t){return t===null?e?Se:void 0:{computedStyleSupportsPseudoElements:e,getComputedStyle:t}}const V={implicitRole(e){let t=ce(e);return t===``?null:t},roleMatcher:he,roleSupportsProp(e,t){return typeof e==`string`&&_e(e,t)},computeAccessibleName(e,t,n){return F(e,nameOptions(t,n),5)},computeAccessibleDescription(e,t,n){return se(e,nameOptions(t,n),5)},isInaccessible:I,isInaccessibleWithStyle:le,isSubtreeInaccessible:de};function parentElement(e){let t=e.parent;return t!==null&&t.type===T?t:null}function isInaccessibleImpl$1(e){return V.isInaccessible(e)}i(isInaccessibleImpl$1,`isInaccessibleImpl`);function isInaccessibleChecked(e){let t=styleOverride(e);return t===null?V.isInaccessible(e):V.isInaccessibleWithStyle(e,t,null)}function isInaccessible(t,n={}){let r=e(t),i=n.isSubtreeInaccessible,a=styleOverride(r);if(i===void 0)return a===null?isInaccessibleImpl$1(r):V.isInaccessibleWithStyle(r,a,null);if(a===null?fe(r):a(t).visibility===`hidden`)return!0;for(let e=r;e!==null;e=parentElement(e))if(i(e.node))return!0;return!1}function getImplicitAriaRolesImpl(e){let t=V.implicitRole(e);return t===null?[]:[t]}function getRoles(t,{hidden:n=!1}={}){let r=e(t),i={},a=n===!1?styleOverride(r):null,o=a===null?null:/* @__PURE__ */ new Map,visit=e=>{if(n!==!1||(a===null?isInaccessibleImpl$1(e):V.isInaccessibleWithStyle(e,a,o))===!1){let t=j(e,`role`),n=t===null?getImplicitAriaRolesImpl(e):t.split(` `).slice(0,1);for(let t of n){let n=i[t];Array.isArray(n)?n.push(e.node):i[t]=[e.node]}}for(let t=e.first;t!==null;t=t.next)t.type===T&&visit(t)};return visit(r),i}const Ce={format:`pretty`};function prettyRoles(t,{hidden:n,includeDescription:r}){let i=getRoles(t,{hidden:n}),a=d().computedStyleSupportsPseudoElements,o=styleOverride(e(t));return Object.entries(i).filter(([e])=>e!==`generic`).map(([t,n])=>{let i=`-`.repeat(50);return`${t}:\n\n${n.map(t=>{let n=e(t),i=`Name "${V.computeAccessibleName(n,a,o)}":\n`,s=v(t.cloneNode(!1),void 0,Ce);return r?`${i}${`Description "${V.computeAccessibleDescription(n,a,o)}":\n`}${s}`:`${i}${s}`}).join(`
2
2
 
3
3
  `)}\n\n${i}`}).join(`
4
4
  `)}const logRoles=(e,{hidden:t=!1}={})=>console.log(prettyRoles(e,{hidden:t}));function checkBooleanAttribute(e,t){let n=j(e,t);if(n===`true`)return!0;if(n===`false`)return!1}function computeAriaSelected$1(e){return e.tag===D.option&&e.ns===E?e.node.selected:checkBooleanAttribute(e,`aria-selected`)}i(computeAriaSelected$1,`computeAriaSelected`);function computeAriaBusy$1(e){return k(e,`aria-busy`)===`true`}i(computeAriaBusy$1,`computeAriaBusy`);function computeAriaChecked(e){let t=e.node;if(!(`indeterminate`in t&&t.indeterminate))return`checked`in t?t.checked:checkBooleanAttribute(e,`aria-checked`)}function computeAriaPressed(e){return checkBooleanAttribute(e,`aria-pressed`)}function computeAriaCurrent$1(e){return checkBooleanAttribute(e,`aria-current`)??k(e,`aria-current`)??!1}i(computeAriaCurrent$1,`computeAriaCurrent`);function computeAriaExpanded$1(e){return checkBooleanAttribute(e,`aria-expanded`)}i(computeAriaExpanded$1,`computeAriaExpanded`);function computeHeadingLevelImpl(e){let t=k(e,`aria-level`),n=t&&Number(t);if(n)return n;if(e.ns===E)switch(e.tag){case D.h1:return 1;case D.h2:return 2;case D.h3:return 3;case D.h4:return 4;case D.h5:return 5;case D.h6:return 6}}function computeAriaValueNow(e){let t=k(e,`aria-valuenow`);return t===null?void 0:+t}function computeAriaValueMax(e){let t=k(e,`aria-valuemax`);return t===null?void 0:+t}function computeAriaValueMin(e){let t=k(e,`aria-valuemin`);return t===null?void 0:+t}function computeAriaValueText(e){let t=k(e,`aria-valuetext`);return t===null?void 0:t}const H=getDefaultNormalizer();function escapeRegExp(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,`\\$&`)}function getRegExpMatcher(e){return new RegExp(escapeRegExp(e.toLowerCase()),`i`)}function makeSuggestion(t,n,r,{variant:i,name:a}){let o=``,s={},c=[[`Role`,`TestId`].includes(t)?r:getRegExpMatcher(r)];a&&(s.name=getRegExpMatcher(a)),t===`Role`&&isInaccessibleChecked(e(n))&&(s.hidden=!0,o=`Element is inaccessible. This means that the element and all its children are invisible to screen readers.
@@ -1,4 +1,4 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0}),t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},__copyProps=(r,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!i.call(r,d)&&d!==o&&e(r,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return r},__toESM=(t,n,a)=>(a=t==null?{}:{__proto__:r(t)},__copyProps(n||!t||!t.__esModule||!i.call(t,`default`)?e(a,`default`,{value:t,enumerable:!0}):a,t));let a=require("@ctrl/dom/internal");a=__toESM(a,1);let o=require("@ctrl/dom/testing-library");o=__toESM(o,1);const s={auxclick:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},beforeinput:{EventType:`InputEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},blur:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},click:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},contextmenu:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},copy:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},change:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!1}},cut:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblclick:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},focus:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusin:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusout:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},keydown:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keypress:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyup:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},input:{EventType:`InputEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},mousedown:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseenter:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseleave:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mousemove:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseout:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseover:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseup:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerover:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerenter:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},pointerdown:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointermove:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerup:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointercancel:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerout:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerleave:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},submit:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!0}}};function getEventClass(e){return s[e].EventType}const c=[`MouseEvent`,`PointerEvent`];function isMouseEvent(e){return c.includes(getEventClass(e))}function isKeyboardEvent(e){return getEventClass(e)===`KeyboardEvent`}const l=a.$impl,u=a;function pick(e){if(u===null)return null;let t={};for(let n of e){let e=u[n];if(typeof e!=`function`)return null;t[n]=e}return t}const d=pick([`getUIValue`,`setUIValue`,`clearUIValue`,`getUISelection`,`setUISelection`]);pick([`computedValue`,`isDisplayNone`,`isVisibilityHidden`]);const f=u?.skipIdleTime;function skipIdleTime(e){return f===void 0||f(e)}const p=u?.isClockTimer;function isClockTimer(e){return p!==void 0&&p(e)}const ee=u?.foreignImmediatesPending;function immediatesPending(){return ee===void 0?process.getActiveResourcesInfo().includes(`Immediate`):ee()}const m=u?.loopTurn;function loopTurn(e){m===void 0?globalThis.setImmediate(e):m(e)}const h=u?.NodeImpl??null;function implOf(e){if(h===null||e==null)return null;let t=e[l];return t instanceof h?t:null}const g=u?.attr,_=u?.T;function hasCtrlDomUI(e){return d!==null&&implOf(e)!==null}const te=/[A-Z]/;function lowerTagName(e){let t=e.localName;return e.prefix==null&&typeof t==`string`&&!te.test(t)?t:e.tagName.toLowerCase()}function isElementType(e,t,n){let r=implOf(e),i;if(r!==null&&r.tag!==0&&r.prefix===null)i=r.name;else{if(e.namespaceURI&&e.namespaceURI!==`http://www.w3.org/1999/xhtml`)return!1;i=lowerTagName(e)}if(typeof t==`string`?i!==t:!t.includes(i))return!1;if(n){for(let t in n)if(Object.hasOwn(n,t)&&e[t]!==n[t])return!1}return!0}const ne={button:`button`,color:`color`,file:`file`,image:`image`,reset:`reset`,submit:`submit`,checkbox:`checkbox`,radio:`radio`};function isClickableInput(e){return isElementType(e,`button`)||isElementType(e,`input`)&&e.type in ne}function readBlobText(e,t){return new Promise((n,r)=>{let i=new t;i.onerror=r,i.onabort=r,i.onload=()=>{n(String(i.result))},i.readAsText(e)})}function createFileList(e,t){if(implOf(e.document))return(0,a.createFileList)(t);let n={...t,length:t.length,item:e=>n[e],[Symbol.iterator]:function*nextFile(){for(let e=0;e<n.length;e++)yield n[e]}};return n.constructor=e.FileList,e.FileList&&Object.setPrototypeOf(n,e.FileList.prototype),Object.freeze(n),n}var DataTransferItemStub=class{kind;type;file=null;data=void 0;constructor(e,t){typeof e==`string`?(this.kind=`string`,this.type=String(t),this.data=e):(this.kind=`file`,this.type=e.type,this.file=e)}getAsFile(){return this.file}getAsString(e){typeof this.data==`string`&&e(this.data)}
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0}),t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},__copyProps=(r,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!i.call(r,d)&&d!==o&&e(r,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return r},__toESM=(t,n,a)=>(a=t==null?{}:{__proto__:r(t)},__copyProps(n||!t||!t.__esModule||!i.call(t,`default`)?e(a,`default`,{value:t,enumerable:!0}):a,t));let a=require("@ctrl/dom/internal");a=__toESM(a,1);let o=require("@ctrl/dom/testing-library");o=__toESM(o,1);const s={auxclick:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},beforeinput:{EventType:`InputEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},blur:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},click:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},contextmenu:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},copy:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},change:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!1}},cut:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblclick:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},focus:{EventType:`FocusEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusin:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusout:{EventType:`FocusEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},keydown:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keypress:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyup:{EventType:`KeyboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:`ClipboardEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},input:{EventType:`InputEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},mousedown:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseenter:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseleave:{EventType:`MouseEvent`,defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mousemove:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseout:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseover:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseup:{EventType:`MouseEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerover:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerenter:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},pointerdown:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointermove:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerup:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointercancel:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerout:{EventType:`PointerEvent`,defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerleave:{EventType:`PointerEvent`,defaultInit:{bubbles:!1,cancelable:!1}},submit:{EventType:`Event`,defaultInit:{bubbles:!0,cancelable:!0}}};function getEventClass(e){return s[e].EventType}const c=[`MouseEvent`,`PointerEvent`];function isMouseEvent(e){return c.includes(getEventClass(e))}function isKeyboardEvent(e){return getEventClass(e)===`KeyboardEvent`}const l=a.$impl,u=a;function pick(e){if(u===null)return null;let t={};for(let n of e){let e=u[n];if(typeof e!=`function`)return null;t[n]=e}return t}const d=pick([`getUIValue`,`setUIValue`,`clearUIValue`,`getUISelection`,`setUISelection`]),f=u?.skipIdleTime;function skipIdleTime(e){return f===void 0||f(e)}const p=u?.isClockTimer;function isClockTimer(e){return p!==void 0&&p(e)}const ee=u?.foreignImmediatesPending;function immediatesPending(){return ee===void 0?process.getActiveResourcesInfo().includes(`Immediate`):ee()}const m=u?.loopTurn;function loopTurn(e){m===void 0?globalThis.setImmediate(e):m(e)}const h=u?.NodeImpl??null;function implOf(e){if(h===null||e==null)return null;let t=e[l];return t instanceof h?t:null}const g=u?.attr,_=u?.T;function hasCtrlDomUI(e){return d!==null&&implOf(e)!==null}const te=/[A-Z]/;function lowerTagName(e){let t=e.localName;return e.prefix==null&&typeof t==`string`&&!te.test(t)?t:e.tagName.toLowerCase()}function isElementType(e,t,n){let r=implOf(e),i;if(r!==null&&r.tag!==0&&r.prefix===null)i=r.name;else{if(e.namespaceURI&&e.namespaceURI!==`http://www.w3.org/1999/xhtml`)return!1;i=lowerTagName(e)}if(typeof t==`string`?i!==t:!t.includes(i))return!1;if(n){for(let t in n)if(Object.hasOwn(n,t)&&e[t]!==n[t])return!1}return!0}const ne={button:`button`,color:`color`,file:`file`,image:`image`,reset:`reset`,submit:`submit`,checkbox:`checkbox`,radio:`radio`};function isClickableInput(e){return isElementType(e,`button`)||isElementType(e,`input`)&&e.type in ne}function readBlobText(e,t){return new Promise((n,r)=>{let i=new t;i.onerror=r,i.onabort=r,i.onload=()=>{n(String(i.result))},i.readAsText(e)})}function createFileList(e,t){if(implOf(e.document))return(0,a.createFileList)(t);let n={...t,length:t.length,item:e=>n[e],[Symbol.iterator]:function*nextFile(){for(let e=0;e<n.length;e++)yield n[e]}};return n.constructor=e.FileList,e.FileList&&Object.setPrototypeOf(n,e.FileList.prototype),Object.freeze(n),n}var DataTransferItemStub=class{kind;type;file=null;data=void 0;constructor(e,t){typeof e==`string`?(this.kind=`string`,this.type=String(t),this.data=e):(this.kind=`file`,this.type=e.type,this.file=e)}getAsFile(){return this.file}getAsString(e){typeof this.data==`string`&&e(this.data)}
2
2
  /* istanbul ignore next */
3
3
  webkitGetAsEntry(){throw Error(`not implemented`)}};function toAsciiLowercase(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}var DataTransferItemListStub=class extends Array{add(...e){let t=typeof e[0]==`string`?new DataTransferItemStub(e[0],toAsciiLowercase(e[1])):new DataTransferItemStub(e[0]);return this.push(t),t}clear(){this.splice(0,this.length)}remove(e){this.splice(e,1)}};function normalizeFormat(e){let t=toAsciiLowercase(e);return t===`text`?`text/plain`:t===`url`?`text/uri-list`:t}function getTypeMatcher(e,t){let[n,r]=e.split(`/`),i=!r||r===`*`;return r=>t?r.type===(i?n:e):i?r.type.startsWith(`${n}/`):r.type===n}function createDataTransferStub(e){return new class DataTransferStub{getData(e){let t=normalizeFormat(e),n=this.items.find(getTypeMatcher(t,!0))??this.items.find(getTypeMatcher(t,!1)),r=``;return n?.getAsString(e=>{r=e}),r}setData(e,t){let n=normalizeFormat(e),r=this.items.findIndex(getTypeMatcher(n,!0)),i=new DataTransferItemStub(t,n);r>=0?this.items.splice(r,1,i):this.items.push(i)}clearData(e){if(e){let t=normalizeFormat(e),n=this.items.findIndex(getTypeMatcher(t,!0));n>=0&&this.items.remove(n)}else this.items.clear()}dropEffect=`none`;effectAllowed=`uninitialized`;items=new DataTransferItemListStub;files=createFileList(e,[]);get types(){let e=[];return this.files.length&&e.push(`Files`),this.items.forEach(t=>e.push(t.type)),Object.freeze(e),e}
4
4
  /* istanbul ignore next */
@@ -9,13 +9,13 @@ t?Object.defineProperty(e.navigator,"clipboard",t):Object.defineProperty(e.navig
9
9
  ()=>!1)))throw Error(`The Clipboard API is unavailable.`)}const b=globalThis;
10
10
  /* istanbul ignore else */
11
11
  typeof b.afterEach==`function`&&b.afterEach(()=>{b.window!==void 0&&resetClipboardStubOnView(b.window)}),typeof b.afterAll==`function`&&b.afterAll(()=>{b.window!==void 0&&detachClipboardStubFromView(b.window)});const x=globalThis.parseInt;function buildTimeValue(e){let t=e.replace(/\D/g,``);if(t.length<2)return e;let n=x(t[0],10),r=x(t[1],10);if(n>=3||n===2&&r>=4){let e;return e=n>=3?1:2,build(t,e)}return e.length===2?e:build(t,2)}function build(e,t){let n=e.slice(0,t),r=Math.min(x(n,10),23),i=e.slice(t),a=x(i,10),o=Math.min(a,59);return`${r.toString().padStart(2,`0`)}:${o.toString().padStart(2,`0`)}`}function isValidDateOrTimeValue(e,t){let n=e.cloneNode();return n.value=t,n.value===t}function isContentEditable(e){let t=e.getAttribute(`contenteditable`);return t===`true`||t===``}function getContentEditable(e){let t=getElement$1(e),n=implOf(t);if(n){let e=null;for(;n!==null;n=n.parent){if((n.flags&a.F_CONTENTEDITABLE_ATTR)===0)continue;let t=(0,a.attr)(n,`contenteditable`);if(t===``)return n.node;t===`true`&&e===null&&(e=n.node)}return e}return t&&(t.closest(`[contenteditable=""]`)||t.closest(`[contenteditable="true"]`))}function getElement$1(e){return e.nodeType===1?e:e.parentElement}__name(getElement$1,`getElement`);function isEditable(e){return isEditableInputOrTextArea(e)&&!e.readOnly||isContentEditable(e)}const re={text:`text`,date:`date`,"datetime-local":`datetime-local`,email:`email`,month:`month`,number:`number`,password:`password`,search:`search`,tel:`tel`,time:`time`,url:`url`,week:`week`};function isEditableInputOrTextArea(e){return isElementType(e,`textarea`)||isElementType(e,`input`)&&e.type in re}const ie={email:`email`,password:`password`,search:`search`,telephone:`telephone`,text:`text`,url:`url`};function getMaxLength(e){let t=e.getAttribute(`maxlength`)??``;return/^\d+$/.test(t)&&Number(t)>=0?Number(t):void 0}function supportsMaxLength(e){return isElementType(e,`textarea`)||isElementType(e,`input`)&&e.type in ie}const S=Symbol(`files and value properties are mocked`);function restoreProperty(e,t,n){n?Object.defineProperty(e,t,n):delete e[t]}function setFiles(e,t){if(implOf(e)){e.files=t;return}e[S]?.restore();let n=Object.getOwnPropertyDescriptor(e,`type`),r=Object.getOwnPropertyDescriptor(e,`value`),i=Object.getOwnPropertyDescriptor(e,`files`);function restore(){delete e[S],restoreProperty(e,`type`,n),restoreProperty(e,`value`,r),restoreProperty(e,`files`,i)}e[S]={restore},Object.defineProperties(e,{files:{configurable:!0,get:()=>t},value:{configurable:!0,get:()=>t.length?`C:\\fakepath\\${t[0].name}`:``,set(t){t===``?restore():r?.set?.call(e,t)}},type:{configurable:!0,get:()=>`file`,set(t){t!==`file`&&(restore(),e.type=t)}}})}function getNextCursorPosition(e,t,n,r){if(isTextNode(e)&&t+n>=0&&t+n<=e.nodeValue.length)return{node:e,offset:t+n};let i=getNextCharacterContentNode(e,t,n);if(i){if(isTextNode(i))return{node:i,offset:n>0?Math.min(1,i.nodeValue.length):Math.max(i.nodeValue.length-1,0)};if(isElementType(i,`br`)){let e=getNextCharacterContentNode(i,void 0,n);return e?isTextNode(e)?{node:e,offset:n>0?0:e.nodeValue.length}:n<0&&isElementType(e,`br`)?{node:i.parentNode,offset:getOffset(i)}:{node:e.parentNode,offset:getOffset(e)+(n>0?0:1)}:n<0&&r===`deleteContentBackward`?{node:i.parentNode,offset:getOffset(i)}:void 0}return{node:i.parentNode,offset:getOffset(i)+ +(n>0)}}}function getNextCharacterContentNode(e,t,n){let r=Number(t)+(n<0?-1:0);return t!==void 0&&isElement$1(e)&&r>=0&&r<e.children.length&&(e=e.children[r]),walkNodes(e,n===1?`next`:`previous`,isTreatedAsCharacterContent)}function isTreatedAsCharacterContent(e){if(isTextNode(e))return!0;if(isElement$1(e)){if(isElementType(e,[`input`,`textarea`]))return e.type!==`hidden`;if(isElementType(e,`br`))return!0}return!1}function getOffset(e){let t=0;for(;e.previousSibling;)t++,e=e.previousSibling;return t}function isElement$1(e){return e.nodeType===1}__name(isElement$1,`isElement`);function isTextNode(e){return e.nodeType===3}function walkNodes(e,t,n){for(;;){let r=e[`${t}Sibling`];if(r){if(e=getDescendant(r,t===`next`?`first`:`last`),n(e))return e}else if(e.parentNode&&(!isElement$1(e.parentNode)||!isContentEditable(e.parentNode)&&e.parentNode!==e.ownerDocument?.body))e=e.parentNode;else break}}function getDescendant(e,t){for(;e.hasChildNodes();)e=e[`${t}Child`];return e}const ae=[`button`,`input`,`select`,`textarea`,`optgroup`,`option`];function isDisabled(e){let t=implOf(e);if(t!==null&&g!==void 0&&_!==void 0)return isDisabledImpl(t,e,g,_);for(let t=e;t;t=t.parentElement)if(disables(t,e))return!0;return!1}function disables(e,t){if(isElementType(e,ae)){if(e.hasAttribute(`disabled`))return!0}else if(isElementType(e,`fieldset`)){if(e.hasAttribute(`disabled`)&&!e.querySelector(`:scope > legend`)?.contains(t))return!0}else if(e.tagName.includes(`-`)&&e.constructor.formAssociated&&e.hasAttribute(`disabled`))return!0;return!1}function isDisabledImpl(e,t,n,r){let i=null;for(let a=e;a!==null&&a.type===1;i=a,a=a.parent){let e=a.tag;if(e===0||a.prefix!==null){if(disables(a.node,t))return!0}else if(e===r.button||e===r.input||e===r.select||e===r.textarea||e===r.optgroup||e===r.option){if(n(a,`disabled`)!==null)return!0}else if(e===r.fieldset&&n(a,`disabled`)!==null&&firstLegendChild(a)!==i)return!0}return!1}function firstLegendChild(e){for(let t=e.first;t!==null;t=t.next)if(t.type===1&&t.name===`legend`)return t}function getActiveElement(e){let t=e.activeElement;if(t?.shadowRoot){let e=getActiveElement(t.shadowRoot);if(e)return e}else if(t&&isElementType(t,`iframe`)){let e=t.contentDocument;if(e)return getActiveElement(e)}return isDisabled(t)?e.ownerDocument?
12
- /* istanbul ignore next */e.ownerDocument.body:e.body:t}function getActiveElementOrBody(e){return getActiveElement(e)??/* istanbul ignore next */e.body}function isVisible(e){let t=getWindow(e),n=implOf(e);if(n&&typeof t.getComputedStyle==`function`&&(0,a.getComputedStyleOverride)(n)===null){for(let e=n;e?.type===1;e=e.parent)if((0,a.isDisplayNone)(e)||(0,a.computedVisibility)(e)===`hidden`)return!1;return!0}for(let n=e;n?.ownerDocument;n=n.parentElement){let{display:e,visibility:r}=t.getComputedStyle(n);if(e===`none`||r===`hidden`)return!1}return!0}const C=`input:not([type=hidden]):not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable=""], [contenteditable="true"], a[href], [tabindex]:not([disabled]), details > summary`;function tabIndexAttr(e){let t=g===void 0?null:implOf(e);return t===null?Number(e.getAttribute(`tabindex`)):(t.flags&a.F_TABINDEX_ATTR)===0?0:Number(g(t,`tabindex`))}function compareTabIndex(e,t){return e===t?0:e===0?1:t===0?-1:e-t}function getTabDestination(e,t){let n=e.ownerDocument,r=n.querySelectorAll(C),i=[],a;for(let t=0,n=r.length;t<n;t++){let n=r[t],o=tabIndexAttr(n);n!==e&&o<0||(o!==0&&(a??=[],a[i.length]=o),i.push(n))}if(a&&tabIndexAttr(e)>=0){let t=a,n=[];for(let t=0;t<i.length;t++){let r=i[t];r!==e&&isDisabled(r)||n.push(t)}n.sort((e,n)=>compareTabIndex(t[e]??0,t[n]??0)),i=n.map(e=>i[e])}i.unshift(n.body);let o=pruneRadioGroups(i,e);for(let r=o.indexOf(e);;){r+=t?-1:1,r===o.length?r=0:r===-1&&(r=o.length-1);let i=o[r];if(i!==null&&(i===e||i===n.body||!isDisabled(i)&&isVisible(i)))return i}}function pruneRadioGroups(e,t){let n=isElementType(t,`input`)&&t.type===`radio`?t.name:void 0,r={},i;for(let a=1;a<e.length;a++){let o=e[a];if(!isElementType(o,`input`)||o.type!==`radio`||o===t)continue;let s=o.name;if(!s)continue;if(s===n||isDisabled(o)){e[a]=null;continue}i??=/* @__PURE__ */ new Map;let c=i.get(s);if(o.checked){if(r[s]=o,c){for(let t of c)e[t]=null;c.length=0}}else if(r[s]!==void 0){e[a]=null;continue}c?c.push(a):i.set(s,[a])}return e}function isFocusable(e){return e.matches(C)}function hasOwnSelection(e){return isElement(e)&&isEditableInputOrTextArea(e)}function hasNoSelection(e){return isElement(e)&&isClickableInput(e)}function isElement(e){return e.nodeType===1}const oe={"{":`}`,"[":`]`};function readNextDescriptor(e,t,n=0){let r=e[n];return r===`{`||r===`[`?e[n+1]===r?printableChar(r,2):readTag(e,n,r,t):(assertDescriptor(r,e,n,t),printableChar(r,1))}function printableChar(e,t){return{type:``,consumedLength:t,descriptor:e,releasePrevious:!1,releaseSelf:!0,repeat:1}}function readTag(e,t,n,r){let i=t+1,a=e[i]===`/`;a&&i++;let o=n===`{`&&e[i]===`\\`;o&&i++;let s=i;if(!o)for(;isWordChar(e.charCodeAt(i));)i++;if(i===s){let a=e[i];if(!a||!o&&(n===`[`||a===`}`||a===`>`||a===`/`))throw Error(getErrorMessage(`key descriptor`,a,e.slice(t),r));i++}let c=e.slice(s,i),l;if(e[i]===`>`&&isDigit(e.charCodeAt(i+1))){let t=i+1;for(i=t+1;isDigit(e.charCodeAt(i));)i++;l=Math.max(Number(e.slice(t,i)),1)}let u=e[i]===`/`||l===void 0&&e[i]===`>`?e[i]:``;i+=u.length;let d=oe[n];if(e[i]!==d)throw Error(getErrorMessage([l===void 0&&`repeat modifier`,!u&&`release modifier`,`"${d}"`].filter(Boolean).join(` or `),e[i],e.slice(t),r));let f;return(u||l!==void 0)&&(f=u===`/`),{type:n,consumedLength:i+1-t,descriptor:c,releasePrevious:a,repeat:l??1,releaseSelf:f}}function assertDescriptor(e,t,n,r){if(!e)throw Error(getErrorMessage(`key descriptor`,t[n],t,r))}function isDigit(e){return e>=48&&e<=57}function isWordChar(e){return isDigit(e)||e>=65&&e<=90||e>=97&&e<=122||e===95}function getErrorMessage(e,t,n,r){return`Expected ${e} but found "${t??``}" in "${n}"
12
+ /* istanbul ignore next */e.ownerDocument.body:e.body:t}function getActiveElementOrBody(e){return getActiveElement(e)??/* istanbul ignore next */e.body}function isVisible(e){let t=getWindow(e),n=implOf(e);if(n&&typeof t.getComputedStyle==`function`&&(0,a.getComputedStyleOverride)(n)===null){for(let e=n;e?.type===1;e=e.parent)if((0,a.isDisplayNone)(e)||(0,a.computedVisibility)(e)===`hidden`)return!1;return!0}for(let n=e;n?.ownerDocument;n=n.parentElement){let{display:e,visibility:r}=t.getComputedStyle(n);if(e===`none`||r===`hidden`)return!1}return!0}const C=`input:not([type=hidden]):not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable=""], [contenteditable="true"], a[href], [tabindex]:not([disabled]), details > summary`;function tabIndexAttr(e){let t=g===void 0?null:implOf(e);return t===null?Number(e.getAttribute(`tabindex`)):(t.flags&a.F_TABINDEX_ATTR)===0?0:Number(g(t,`tabindex`))}function compareTabIndex(e,t){return e===t?0:e===0?1:t===0?-1:e-t}function getTabDestination(e,t){let n=e.ownerDocument,r=n.querySelectorAll(C),i=[],a;for(let t=0,n=r.length;t<n;t++){let n=r[t],o=tabIndexAttr(n);n!==e&&o<0||(o!==0&&(a??=[],a[i.length]=o),i.push(n))}if(a&&tabIndexAttr(e)>=0){let t=a,n=[];for(let t=0;t<i.length;t++){let r=i[t];r!==e&&isDisabled(r)||n.push(t)}n.sort((e,n)=>compareTabIndex(t[e]??0,t[n]??0)),i=n.map(e=>i[e])}i.unshift(n.body);let o=pruneRadioGroups(i,e);for(let r=o.indexOf(e);;){r+=t?-1:1,r===o.length?r=0:r===-1&&(r=o.length-1);let i=o[r];if(i!==null&&(i===e||i===n.body||!isDisabled(i)&&isVisible(i)))return i}}function pruneRadioGroups(e,t){let n=isElementType(t,`input`)&&t.type===`radio`?t.name:void 0,r={},i;for(let a=1;a<e.length;a++){let o=e[a];if(!isElementType(o,`input`)||o.type!==`radio`||o===t)continue;let s=o.name;if(!s)continue;let c=o.checked;if(s===n||c&&isDisabled(o)){e[a]=null;continue}i??=/* @__PURE__ */ new Map;let l=i.get(s);if(c){if(r[s]=o,l){for(let t of l)e[t]=null;l.length=0}}else if(r[s]!==void 0){e[a]=null;continue}l?l.push(a):i.set(s,[a])}return e}function isFocusable(e){return e.matches(C)}function hasOwnSelection(e){return isElement(e)&&isEditableInputOrTextArea(e)}function hasNoSelection(e){return isElement(e)&&isClickableInput(e)}function isElement(e){return e.nodeType===1}const oe={"{":`}`,"[":`]`};function readNextDescriptor(e,t,n=0){let r=e[n];return r===`{`||r===`[`?e[n+1]===r?printableChar(r,2):readTag(e,n,r,t):(assertDescriptor(r,e,n,t),printableChar(r,1))}function printableChar(e,t){return{type:``,consumedLength:t,descriptor:e,releasePrevious:!1,releaseSelf:!0,repeat:1}}function readTag(e,t,n,r){let i=t+1,a=e[i]===`/`;a&&i++;let o=n===`{`&&e[i]===`\\`;o&&i++;let s=i;if(!o)for(;isWordChar(e.charCodeAt(i));)i++;if(i===s){let a=e[i];if(!a||!o&&(n===`[`||a===`}`||a===`>`||a===`/`))throw Error(getErrorMessage(`key descriptor`,a,e.slice(t),r));i++}let c=e.slice(s,i),l;if(e[i]===`>`&&isDigit(e.charCodeAt(i+1))){let t=i+1;for(i=t+1;isDigit(e.charCodeAt(i));)i++;l=Math.max(Number(e.slice(t,i)),1)}let u=e[i]===`/`||l===void 0&&e[i]===`>`?e[i]:``;i+=u.length;let d=oe[n];if(e[i]!==d)throw Error(getErrorMessage([l===void 0&&`repeat modifier`,!u&&`release modifier`,`"${d}"`].filter(Boolean).join(` or `),e[i],e.slice(t),r));let f;return(u||l!==void 0)&&(f=u===`/`),{type:n,consumedLength:i+1-t,descriptor:c,releasePrevious:a,repeat:l??1,releaseSelf:f}}function assertDescriptor(e,t,n,r){if(!e)throw Error(getErrorMessage(`key descriptor`,t[n],t,r))}function isDigit(e){return e>=48&&e<=57}function isWordChar(e){return isDigit(e)||e>=65&&e<=90||e>=97&&e<=122||e===95}function getErrorMessage(e,t,n,r){return`Expected ${e} but found "${t??``}" in "${n}"
13
13
  See ${r===`pointer`?`https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen`:`https://testing-library.com/docs/user-event/keyboard`}
14
14
  for more information about how userEvent parses your input.`}function cloneEvent(e){return new e.constructor(e.type,e)}function findClosest(e,t){let n=e;do{if(t(n))return n;n=n.parentElement}while(n&&n!==e.ownerDocument.body)}function getDocumentFromNode(e){return isDocument(e)?e:e.ownerDocument}function isDocument(e){return e.nodeType===9}function getTreeDiff(e,t){let n=[],r=[];for(;e!==t;)e&&=(n.push(e),e.parentElement),t&&=(r.push(t),t.parentElement);let i=e;for(;n.length&&r.length&&n[n.length-1]===r[r.length-1];)i=n.pop(),r.pop();return[n,r,i]}const w={Trigger:`trigger`,Call:`call`};let se=0;function setLevelRef(e,t){e.levelRefs[t]=++se}function isFaked(e){return e!==void 0&&(e._isMockFunction===!0||Object.hasOwn(e,`clock`))}function defaultAdvanceTimers(){return Promise.resolve()}function wait(e){let t=e.delay;if(typeof t==`number`)return Promise.all([new Promise(e=>globalThis.setTimeout(()=>e(),t)),e.advanceTimers(t)])}function resolveOnImmediate(e){globalThis.setImmediate(e)}function countTimeouts(){let e=process.getActiveResourcesInfo(),t=0;for(let n=0;n<e.length;n++)e[n]===`Timeout`&&t++;return t}const T=/* @__PURE__ */ new Set;function isObjectHandle(e){return typeof e==`object`&&!!e||typeof e==`function`}const E=/* @__PURE__ */ new WeakMap,D=/* @__PURE__ */ new Map,O=new FinalizationRegistry(forgetTimer);function forgetTimer(e){if(T.delete(e)){if(O.unregister(e),e.objectHandle===null)D.get(e.primitiveHandle)===e&&D.delete(e.primitiveHandle);else{let t=e.objectHandle.deref();t!==void 0&&E.get(t)===e&&E.delete(t)}}}const k=/* @__PURE__ */ new WeakMap;function copyProps(e,t){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}function wrapSchedule(e){let t=globalThis,n=t[e];if(k.get(n)===e||typeof n!=`function`||isFaked(n))return;let r=n,i=e===`setInterval`;if(isClockTimer(r)){k.set(n,e);return}let wrapper=function(e,t,...n){if(typeof e!=`function`)return r.call(this,e,t,...n);let a=Math.max(1,Number(t)||0),o={due:performance.now()+a,interval:i?a:0,objectHandle:null,primitiveHandle:void 0},s=!1,run=function(...t){return i?o.due=performance.now()+o.interval:(s=!0,forgetTimer(o)),Reflect.apply(e,this,t)},c=r.call(this,run,t,...n);return s||(isObjectHandle(c)?(o.objectHandle=new WeakRef(c),E.set(c,o)):(o.primitiveHandle=c,D.set(c,o)),T.add(o),O.register(run,o,o)),c};copyProps(wrapper,r),k.set(wrapper,e),t[e]=wrapper}function wrapClear(e){let t=globalThis,n=t[e];if(k.get(n)===e||typeof n!=`function`||isFaked(n))return;let r=n,wrapper=function(e){let t=isObjectHandle(e)?E.get(e):D.get(e);return t!==void 0&&forgetTimer(t),r.call(this,e)};copyProps(wrapper,r),k.set(wrapper,e),t[e]=wrapper}function observeTimerGlobals(){wrapSchedule(`setTimeout`),wrapSchedule(`setInterval`),wrapClear(`clearTimeout`),wrapClear(`clearInterval`)}function timerGlobalsObserved(){let e=globalThis;return k.get(e.setTimeout)===`setTimeout`&&k.get(e.setInterval)===`setInterval`&&k.get(e.clearTimeout)===`clearTimeout`&&k.get(e.clearInterval)===`clearInterval`}function trackedTimerDueSoon(){if(T.size===0)return!1;let e=performance.now();for(let t of T)if(t.due<=e+4){let n=t.objectHandle?.deref()?._destroyed;if(n===!0||n===void 0&&t.interval===0&&t.due<e-50){forgetTimer(t);continue}return!0}return!1}let A=-1;function untrackedTimeouts(){let e=countTimeouts(),t=0;for(let e of T){let n=e.objectHandle?.deref();n?._destroyed===!0?forgetTimer(e):n?.hasRef?.()!==!1&&t++}return e-t}typeof globalThis.setImmediate==`function`&&observeTimerGlobals();function markTimers(e){e.delay===0&&e.advanceTimers===defaultAdvanceTimers&&observeTimerGlobals()}function realTimersAtZeroDelay(e){if(e.delay!==0||e.advanceTimers!==defaultAdvanceTimers)return!1;let t=globalThis.setImmediate;return typeof t==`function`&&!isFaked(t)&&timerGlobalsObserved()}function canYieldWithImmediate(e){if(!realTimersAtZeroDelay(e))return!1;if(isClockTimer(globalThis.setTimeout))return skipIdleTime(1);if(trackedTimerDueSoon())return!1;let t=untrackedTimeouts();return A===-1||t>A||!skipIdleTime(1)?!1:(A=t,!0)}function yieldBetweenActions(e){return!realTimersAtZeroDelay(e)&&!timerGlobalsObserved()?wait(e):yieldAndSettle(e)}async function yieldAndSettle(e){if(canYieldWithImmediate(e)?await new Promise(isClockTimer(globalThis.setTimeout)?loopTurn:resolveOnImmediate):(await wait(e),timerGlobalsObserved()&&!isClockTimer(globalThis.setTimeout)&&(A=untrackedTimeouts())),realTimersAtZeroDelay(e))for(let e=0;e<20&&immediatesPending();e++)await new Promise(resolveOnImmediate)}var j=class PointerLocation{targetRef;coords;caret;static from(e){return e instanceof PointerLocation?e:new PointerLocation(e)}constructor({target:e,coords:t,caret:n},r){e&&(this.targetRef=r?.target===e?r.targetRef:new WeakRef(e)),this.coords=t,n?.node?this.caret=new CaretLocation(n.node,n.offset):n?.offset!==void 0&&(this.caret={offset:n.offset})}get target(){return this.targetRef?.deref()}},CaretLocation=class{#e;offset;constructor(e,t){this.#e=new WeakRef(e),this.offset=t}get node(){return this.#e.deref()}};function isDifferentPointerPosition(e,t){return e.target!==t.target||e.coords?.x!==t.coords?.x||e.coords?.y!==t.coords?.y||e.coords?.clientX!==t.coords?.clientX||e.coords?.clientY!==t.coords?.clientY||e.coords?.offsetX!==t.coords?.offsetX||e.coords?.offsetY!==t.coords?.offsetY||e.coords?.pageX!==t.coords?.pageX||e.coords?.pageY!==t.coords?.pageY||e.coords?.screenX!==t.coords?.screenX||e.coords?.screenY!==t.coords?.screenY||e.caret?.node!==t.caret?.node||e.caret?.offset!==t.caret?.offset}var Buttons=class{pressed={};mask=0;getButtons(){return this.mask}down(e){let t=getMouseButtonId(e.button),n=this.pressed[t];if(n!==void 0)Array.isArray(n)?n.push(e):this.pressed[t]=[n,e];else return this.pressed[t]=e,this.mask|=2**t,t}up(e){let t=getMouseButtonId(e.button),n=this.pressed[t];if(Array.isArray(n)){let r=n.filter(t=>t.name!==e.name);if(r.length){this.pressed[t]=r.length===1?r[0]:r;return}}else if(n===void 0||n.name!==e.name)return;return delete this.pressed[t],this.mask&=~(2**t),t}};const M={primary:0,secondary:1,auxiliary:2,back:3,X1:3,forward:4,X2:4};function getMouseButtonId(e=0){return e in M?M[e]:Number(e)}const ce={1:2,2:1};function getMouseEventButton(e){return e=getMouseButtonId(e),e in ce?ce[e]:e}var Device=class{first;additional;get countPressed(){return Number(this.first!==void 0)+(this.additional?.size??0)}isPressed({name:e}){return this.first===e||(this.additional?.has(e)??!1)}addPressed({name:e}){this.first===void 0?this.additional?.has(e)||(this.first=e):this.first!==e&&(this.additional??=/* @__PURE__ */ new Set).add(e)}removePressed({name:e}){return this.first===e?(this.first=void 0,!0):this.additional?.delete(e)??!1}},ClickCount=class{button;downDetail=0;count;incOnClick(e){let t=this.getOnUp(e);return t===void 0?this.count=void 0:this.count!==void 0&&this.count++,t}getOnDown(e){let t=String(e);return(t!==this.button||this.count===void 0)&&(this.count=0),this.button=t,this.downDetail=this.count+1,this.downDetail}getOnUp(e){return String(e)===this.button?this.downDetail:void 0}reset(){this.count=void 0}},Mouse=class{position=new j({});buttons=new Buttons;selecting;selections;buttonDownTarget={};clickCount=new ClickCount;move(e,t,n){let r=this.position,i=this.getTarget(e);if(this.position=t,!isDifferentPointerPosition(r,t))return;let a=this.getTarget(e),o=this.getEventInit(`mousemove`),[s,c]=getTreeDiff(i,a);return{leave:()=>{i!==a&&(e.dispatchUIEvent(i,`mouseout`,o),s.forEach(t=>e.dispatchUIEvent(t,`mouseleave`,o)))},enter:()=>{i!==a&&(e.dispatchUIEvent(a,`mouseover`,o),c.forEach(t=>e.dispatchUIEvent(t,`mouseenter`,o)))},move:()=>{n||(e.dispatchUIEvent(a,`mousemove`,o),this.modifySelecting(e))}}}down(e,t,n){let r=this.buttons.down(t);if(r===void 0)return;let i=this.position.target,a=i??e.config.document.body,o=i?this.position.targetRef:new WeakRef(a);this.buttonDownTarget[r]=o;let s=this.getEventInit(`mousedown`,t.button),c=isDisabled(a);!n&&(c||e.dispatchUIEvent(a,`mousedown`,s))&&(this.startSelecting(e,s.detail,a,o),focusElement(a)),!c&&getMouseEventButton(t.button)===2&&e.dispatchUIEvent(a,`contextmenu`,this.getEventInit(`contextmenu`,t.button))}up(e,t,n){let r=this.buttons.up(t);if(r===void 0)return;let i=this.buttonDownTarget[r].deref()??null;delete this.buttonDownTarget[r];let a=this.getTarget(e),o=isDisabled(a);if(!o&&!n){let n=this.getEventInit(`mouseup`,t.button);e.dispatchUIEvent(a,`mouseup`,n)}if(this.endSelecting(),!o){let n=i===a?a:i&&getTreeDiff(i,a)[2];if(n){let r=this.getEventInit(`click`,t.button);r.detail&&(e.dispatchUIEvent(n,r.button===0?`click`:`auxclick`,r),r.button===0&&r.detail===2&&e.dispatchUIEvent(n,`dblclick`,{...this.getEventInit(`dblclick`,t.button),detail:r.detail}))}}}resetClickCount(){this.clickCount.reset()}getEventInit(e,t){let n={...this.position.coords};return n.button=getMouseEventButton(t),n.buttons=this.buttons.getButtons(),e===`mousedown`?n.detail=this.clickCount.getOnDown(n.button):e===`mouseup`?n.detail=this.clickCount.getOnUp(n.button):(e===`click`||e===`auxclick`)&&(n.detail=this.clickCount.incOnClick(n.button)),n}getTarget(e){return this.position.target??e.config.document.body}startSelecting(e,t,n,r){let i=setSelectionPerMouseDown({document:e.config.document,target:n,node:this.position.caret?.node,offset:this.position.caret?.offset,clickCount:t});this.endSelecting(),i&&(this.selections??=/* @__PURE__ */ new WeakMap,this.selections.set(n,i),this.selecting=r)}modifySelecting(e){let t=this.selecting?.deref(),n=t&&this.selections?.get(t);n&&modifySelectionPerMouseMove(n,{document:e.config.document,target:this.getTarget(e),node:this.position.caret?.node,offset:this.position.caret?.offset})}endSelecting(){let e=this.selecting?.deref();e&&this.selections?.delete(e),this.selecting=void 0}},Pointer=class{constructor({pointerId:e,pointerType:t,isPrimary:n},r){this.pointerId=e,this.pointerType=t,this.isPrimary=n,this.isMultitouch=!n,this.buttons=r}pointerId;pointerType;isPrimary;buttons;isMultitouch=!1;isCancelled=!1;isDown=!1;isPrevented=!1;position=new j({});init(e){let t=this.getTarget(e),[,n]=getTreeDiff(null,t),r=this.getEventInit();return assertPointerEvents(e,t),e.dispatchUIEvent(t,`pointerover`,r),n.forEach(t=>e.dispatchUIEvent(t,`pointerenter`,r)),this}move(e,t){let n=this.position,r=this.getTarget(e);if(this.position=t,!isDifferentPointerPosition(n,t))return;let i=this.getTarget(e),a=this.getEventInit(-1),[o,s]=getTreeDiff(r,i);return{leave:()=>{hasPointerEvents(e,r)&&r!==i&&(e.dispatchUIEvent(r,`pointerout`,a),o.forEach(t=>e.dispatchUIEvent(t,`pointerleave`,a)))},enter:()=>{assertPointerEvents(e,i),r!==i&&(e.dispatchUIEvent(i,`pointerover`,a),s.forEach(t=>e.dispatchUIEvent(t,`pointerenter`,a)))},move:()=>{e.dispatchUIEvent(i,`pointermove`,a)}}}down(e,t=0){if(this.isDown)return;let n=this.getTarget(e);assertPointerEvents(e,n),this.isDown=!0,this.isPrevented=!e.dispatchUIEvent(n,`pointerdown`,this.getEventInit(t))}up(e,t=0){if(!this.isDown)return;let n=this.getTarget(e);assertPointerEvents(e,n),this.isPrevented=!1,this.isDown=!1,e.dispatchUIEvent(n,`pointerup`,this.getEventInit(t))}release(e){let t=this.getTarget(e),[n]=getTreeDiff(t,null),r=this.getEventInit();hasPointerEvents(e,t)&&(e.dispatchUIEvent(t,`pointerout`,r),n.forEach(t=>e.dispatchUIEvent(t,`pointerleave`,r))),this.isCancelled=!0}getTarget(e){return this.position.target??e.config.document.body}getEventInit(e){return{...this.position.coords,pointerId:this.pointerId,pointerType:this.pointerType,isPrimary:this.isPrimary,button:getMouseEventButton(e),buttons:this.buttons.getButtons()}}},DeviceRegistry=class{registry={};get(e){return this.registry[e]??=new Device}},PointerRegistry=class{registry={};nextId=1;new(e,t,n){let r=t!==`touch`||!Object.values(this.registry).some(e=>e.pointerType===`touch`&&!e.isCancelled);return r||Object.values(this.registry).forEach(e=>{e.pointerType===t&&!e.isCancelled&&(e.isMultitouch=!0)}),this.registry[e]=new Pointer({pointerId:this.nextId++,pointerType:t,isPrimary:r},n),this.registry[e]}get(e){if(!this.has(e))throw Error(`Trying to access pointer "${e}" which does not exist.`);return this.registry[e]}has(e){return e in this.registry}},PointerHost=class{system;constructor(e){this.system=e,this.buttons=new Buttons,this.mouse=new Mouse,this.pointers.new(`mouse`,`mouse`,this.buttons)}mouse;buttons;devices=new DeviceRegistry;pointers=new PointerRegistry;isKeyPressed(e){return this.devices.get(e.pointerType).isPressed(e)}async press(e,t,n){this.devices.get(t.pointerType).addPressed(t),this.buttons.down(t);let r=this.getPointerName(t),i=t.pointerType===`touch`?this.pointers.new(r,t.pointerType,this.buttons):this.pointers.get(r),a=j.from(n);i.position=a,i.pointerType!==`touch`&&(this.mouse.position=a),i.pointerType===`touch`&&i.init(e),i.down(e,t.button),i.pointerType!==`touch`&&this.mouse.down(e,t,i.isPrevented)}async move(e,t,n){let r=this.pointers.get(t),i=j.from(n),a=r.move(e,i),o=r.pointerType===`touch`?void 0:this.mouse.move(e,i,r.isPrevented);a?.leave(),o?.leave(),a?.enter(),o?.enter(),a?.move(),o?.move()}async release(e,t,n){let r=this.devices.get(t.pointerType);r.removePressed(t),this.buttons.up(t);let i=this.pointers.get(this.getPointerName(t)),a=i.isPrevented,o=j.from(n);if(i.position=o,i.pointerType!==`touch`&&(this.mouse.position=o),r.countPressed===0&&i.up(e,t.button),i.pointerType===`touch`&&i.release(e),i.pointerType===`touch`&&!i.isMultitouch){let n=this.mouse.move(e,o,a);n?.leave(),n?.enter(),n?.move(),this.mouse.down(e,t,a)}if(!i.isMultitouch){let n=this.mouse.move(e,o,a);n?.leave(),n?.enter(),n?.move(),this.mouse.up(e,t,a)}}getPointerName(e){return e.pointerType===`touch`?e.name:e.pointerType}getPreviousPosition(e){return this.pointers.has(e)?this.pointers.get(e).position:void 0}resetClickCount(){this.mouse.resetClickCount()}getMouseTarget(e){return this.mouse.position.target??e.config.document.body}setMousePosition(e){this.mouse.position=this.pointers.get(`mouse`).position=j.from(e)}},System=class{keyboard=new KeyboardHost(this);#e;get pointer(){return this.#e??=new PointerHost(this)}assignUIEventModifiers(e){let t=this.keyboard.modifiers;e.altKey=t.Alt,e.ctrlKey=t.Control,e.metaKey=t.Meta,e.shiftKey=t.Shift,e.modifierAltGraph=t.AltGraph,e.modifierCapsLock=t.CapsLock,e.modifierFn=t.Fn,e.modifierFnLock=t.FnLock,e.modifierNumLock=t.NumLock,e.modifierScrollLock=t.ScrollLock,e.modifierSymbol=t.Symbol,e.modifierSymbolLock=t.SymbolLock}getUIEventModifiers(){return{altKey:this.keyboard.modifiers.Alt,ctrlKey:this.keyboard.modifiers.Control,metaKey:this.keyboard.modifiers.Meta,shiftKey:this.keyboard.modifiers.Shift,modifierAltGraph:this.keyboard.modifiers.AltGraph,modifierCapsLock:this.keyboard.modifiers.CapsLock,modifierFn:this.keyboard.modifiers.Fn,modifierFnLock:this.keyboard.modifiers.FnLock,modifierNumLock:this.keyboard.modifiers.NumLock,modifierScrollLock:this.keyboard.modifiers.ScrollLock,modifierSymbol:this.keyboard.modifiers.Symbol,modifierSymbolLock:this.keyboard.modifiers.SymbolLock}}};const N=Object.freeze({STANDARD:0,LEFT:1,RIGHT:2,NUMPAD:3,0:`STANDARD`,1:`LEFT`,2:`RIGHT`,3:`NUMPAD`}),le=[`Alt`,`AltGraph`,`Control`,`Fn`,`Meta`,`Shift`,`Symbol`];function isModifierKey(e){return e.length>1&&le.includes(e)}const ue=[`CapsLock`,`FnLock`,`NumLock`,`ScrollLock`,`SymbolLock`];function isModifierLock(e){return e.length>1&&ue.includes(e)}var PressedKeys=class{registry=Object.create(null);add(e,t){this.registry[e]??={keyDef:t,unpreventedDefault:!1}}has(e){return!!this.registry[e]}setUnprevented(e){let t=this.registry[e];t&&(t.unpreventedDefault=!0)}isUnprevented(e){return!!this.registry[e]?.unpreventedDefault}delete(e){delete this.registry[e]}hasKey(e){for(let t in this.registry)if(this.registry[t].keyDef.key===e)return!0;return!1}keyDefs(){let e=[];for(let t in this.registry)e.push(this.registry[t].keyDef);return e}},KeyboardHost=class{system;constructor(e){this.system=e}modifiers={Alt:!1,AltGraph:!1,CapsLock:!1,Control:!1,Fn:!1,FnLock:!1,Meta:!1,NumLock:!1,ScrollLock:!1,Shift:!1,Symbol:!1,SymbolLock:!1};pressed;carryChar=``;lastKeydownTarget;modifierLockStart={};isKeyPressed(e){return this.pressed?.has(String(e.code))??!1}getPressedKeys(){return this.pressed?.keyDefs()??[]}async keydown(e,t,n=!1){let r=String(t.key),i=String(t.code),a=getActiveElementOrBody(e.config.document);this.setKeydownTarget(a);let o=this.pressed??=new PressedKeys;o.add(i,t),isModifierKey(r)&&(this.modifiers[r]=!0);let s=e.dispatchUIEvent(a,`keydown`,{key:r,code:i,repeat:n});isModifierLock(r)&&!this.modifiers[r]&&(this.modifiers[r]=!0,this.modifierLockStart[r]=!0),s&&o.setUnprevented(i),s&&this.hasKeyPress(r)&&e.dispatchUIEvent(getActiveElementOrBody(e.config.document),`keypress`,{key:r,code:i,charCode:t.key===`Enter`?13:String(t.key).charCodeAt(0)})}async keyup(e,t){let n=String(t.key),r=String(t.code),i=this.pressed?.isUnprevented(r);this.pressed?.delete(r),isModifierKey(n)&&!this.pressed?.hasKey(n)&&(this.modifiers[n]=!1),e.dispatchUIEvent(getActiveElementOrBody(e.config.document),`keyup`,{key:n,code:r},!i),isModifierLock(n)&&this.modifiers[n]&&(this.modifierLockStart[n]?this.modifierLockStart[n]=!1:this.modifiers[n]=!1)}setKeydownTarget(e){e!==this.lastKeydownTarget?.deref()&&(this.carryChar=``,this.lastKeydownTarget=new WeakRef(e))}hasKeyPress(e){return(e.length===1||e===`Enter`)&&!this.modifiers.Control&&!this.modifiers.Alt}};const P=Object.freeze({EachTrigger:4,EachApiCall:2,EachTarget:1,Never:0,4:`EachTrigger`,2:`EachApiCall`,1:`EachTarget`,0:`Never`});function hasPointerEvents(e,t){return checkPointerEvents(e,t)===void 0}function blockedPointerEventsTree(e){let t=getWindow(e),n=implOf(e);if(n&&typeof t.getComputedStyle==`function`&&(0,a.getComputedStyleOverride)(n)===null){let e=(0,a.pointerEvents)(n);if(e===`none`)return!0;if(e&&e!==`inherit`&&e!==`unset`)return}for(let n=e,r;n?.ownerDocument;n=n.parentElement){n!==e&&(r??=[]).push(n);let i=t.getComputedStyle(n).pointerEvents;if(i===`none`)return r?.map(e=>new WeakRef(e))??!0;if(i&&i!==`inherit`&&i!==`unset`)break}}const F=Symbol(`Last check for pointer-events`);function checkPointerEvents(e,t){let n=t[F],{call:r,trigger:i}=e.levelRefs,a=e.config.pointerEventsCheck;if(!(a!==P.Never&&(!n||hasBitFlag(a,P.EachApiCall)&&n.call!==r||hasBitFlag(a,P.EachTrigger)&&n.trigger!==i)))return n?.result;let o=blockedPointerEventsTree(t);return n?(n.call=r,n.trigger=i,n.result=o):t[F]={call:r,trigger:i,result:o},o}function assertPointerEvents(e,t){let n=checkPointerEvents(e,t);if(n){let e=n===!0?[t]:[...n.map(e=>e.deref()).reverse(),t];throw Error([`Unable to perform pointer interaction as the element ${e.length>1?`inherits`:`has`} \`pointer-events: none\`:`,``,printTree(e)].join(`
15
15
  `))}}function printTree(e){return e.map((t,n)=>[``.padEnd(n),t?.tagName??`(removed element)`,t?.id&&`#${t.id}`,t?.hasAttribute(`data-testid`)&&`(testId=${t.getAttribute(`data-testid`)})`,t&&getLabelDescr(t),e.length>1&&n===0&&" <-- This element declared `pointer-events: none`",e.length>1&&n===e.length-1&&` <-- Asserted pointer events here`].filter(Boolean).join(``)).join(`
16
- `)}function getLabelDescr(e){let t;return e.hasAttribute(`aria-label`)?t=e.getAttribute(`aria-label`):e.hasAttribute(`aria-labelledby`)?t=e.ownerDocument.getElementById(e.getAttribute(`aria-labelledby`))?.textContent?.trim():isElementType(e,[`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`])&&e.labels?.length?t=Array.from(e.labels).map(e=>e.textContent?.trim()).join(`|`):isElementType(e,`button`)&&(t=e.textContent?.trim()),t=t?.replace(/\n/g,` `),Number(t?.length)>30&&(t=`${t?.substring(0,29)}…`),t?`(label=${t})`:``}function hasBitFlag(e,t){return(e&t)>0}const I=Symbol(`Displayed value in UI`),L=Symbol(`Displayed selection in UI`),R=Symbol(`Initial value to compare on blur`);function isUIValue(e){return typeof e==`object`&&I in e}function isUISelectionStart(e){return!!e&&typeof e==`object`&&L in e}function setUIValue(e,t){let n=e;n[R]===void 0&&(n[R]=n.value),hasCtrlDomUI(n)?d.setUIValue(n,t):(n[I]=t,n.value=Object.assign(new String(t),{[I]:!0}))}function getUIValue(e){let t=e;return hasCtrlDomUI(t)?d.getUIValue(t):t[I]===void 0?t.value:String(t[I])}function setUIValueClean(e){hasCtrlDomUI(e)?d.clearUIValue(e):e[I]=void 0}function clearInitialValue(e){e[R]=void 0}function getInitialValue(e){return e[R]}function setUISelectionRaw(e,t){e[L]=t}function setUISelection(e,{focusOffset:t,anchorOffset:n=t},r=`replace`){let i=e;if(hasCtrlDomUI(i)){let e=r===`replace`?Math.max(0,n):getUISelection(i).anchorOffset,a=Math.max(0,t);if(e>a){let t=d.getUIValue(i).length;i[L]={anchorOffset:Math.min(e,t),focusOffset:Math.min(a,t)}}else i[L]!==void 0&&(i[L]=void 0);d.setUISelection(i,Math.min(e,a),Math.max(e,a),`none`);return}let a=getUIValue(i).length,sanitizeOffset=e=>Math.max(0,Math.min(a,e)),o=r===`replace`||i[L]===void 0?sanitizeOffset(n):i[L].anchorOffset,s=sanitizeOffset(t),c=Math.min(o,s),l=Math.max(o,s);if(i[L]={anchorOffset:o,focusOffset:s},i.selectionStart===c&&i.selectionEnd===l)return;let u=Object.assign(new Number(c),{[L]:!0});try{i.setSelectionRange(u,l)}catch{}}function getUISelection(e){let t=e;if(hasCtrlDomUI(t)){let{start:e,end:n}=d.getUISelection(t),r=t[L],i=r?.anchorOffset===n&&r.focusOffset===e;return{anchorOffset:i?n:e,focusOffset:i?e:n,startOffset:e,endOffset:n}}let n=t[L]??{anchorOffset:t.selectionStart??0,focusOffset:t.selectionEnd??0};return{anchorOffset:n.anchorOffset,focusOffset:n.focusOffset,startOffset:Math.min(n.anchorOffset,n.focusOffset),endOffset:Math.max(n.anchorOffset,n.focusOffset)}}function hasUISelection(e){return hasCtrlDomUI(e)||!!e[L]}function setUISelectionClean(e){e[L]=void 0}function getValueOrTextContent(e){return e?isContentEditable(e)?e.textContent:getUIValue(e):null}function copySelection(e){let t=hasOwnSelection(e)?{"text/plain":readSelectedValueFromInput(e)}:{"text/plain":String(e.ownerDocument.getSelection())},n=createDataTransfer(getWindow(e));for(let e in t)t[e]&&n.setData(e,t[e]);return n}function readSelectedValueFromInput(e){let t=getUISelection(e);return getUIValue(e).substring(t.startOffset,t.endOffset)}const z=Symbol(`Track programmatic changes for React workaround`);function isReact17Element(e){return Object.getOwnPropertyNames(e).some(e=>e.startsWith(`__react`))&&getWindow(e).REACT_VERSION===17}function startTrackValue(e){isReact17Element(e)&&(e[z]={previousValue:String(e.value),tracked:[]})}function trackOrSetValue(e,t){e[z]?.tracked?.push(t),e[z]||(setUIValueClean(e),setUISelection(e,{focusOffset:t.length}))}function commitValueAfterInput(e,t){let n=e[z];if(e[z]=void 0,!n?.tracked?.length)return;let r=n.tracked.length===2&&n.tracked[0]===n.previousValue&&n.tracked[1]===e.value;r||setUIValueClean(e),hasUISelection(e)&&setUISelection(e,{focusOffset:r?t:e.value.length})}function getTargetTypeAndSelection(e){let t=getElement(e);if(t&&hasOwnSelection(t))return{type:`input`,selection:getUISelection(t)};let n=t?.ownerDocument.getSelection();return{type:getContentEditable(e)&&n?.anchorNode&&getContentEditable(n.anchorNode)?`contenteditable`:`default`,selection:n}}function getElement(e){return e.nodeType===1?e:e.parentElement}function getInputRange(e){let t=getTargetTypeAndSelection(e);if(t.type===`input`)return t.selection;if(t.type===`contenteditable`)return t.selection?.getRangeAt(0)}function setSelection({focusNode:e,focusOffset:t,anchorNode:n=e,anchorOffset:r=t}){let i=getElement(e);if(i&&hasOwnSelection(i))return setUISelection(e,{anchorOffset:r,focusOffset:t});n.ownerDocument?.getSelection()?.setBaseAndExtent(n,r,e,t)}function moveSelection(e,t){if(hasOwnSelection(e)){let n=getUISelection(e);setSelection({focusNode:e,focusOffset:n.startOffset===n.endOffset?n.focusOffset+t:t<0?n.startOffset:n.endOffset})}else{let n=e.ownerDocument.getSelection();if(!n?.focusNode)return;if(n.isCollapsed){let e=getNextCursorPosition(n.focusNode,n.focusOffset,t);e&&setSelection({focusNode:e.node,focusOffset:e.offset})}else n[t<0?`collapseToStart`:`collapseToEnd`]()}}function resolveCaretPosition({target:e,node:t,offset:n}){if(hasOwnSelection(e))return{node:e,offset:n??getUIValue(e).length};if(t)return{node:t,offset:n??(t.nodeType===3?t.nodeValue.length:t.childNodes.length)};if(n===void 0){let t=e;for(;t.nodeType===1;){let n=t.lastChild;if(!n){if(t===e)return{node:e,offset:0};break}t=n}if(t.nodeType===3&&t.nodeValue)return{node:t,offset:t.nodeValue.length}}return findNodeAtTextOffset(e,n)}function findNodeAtTextOffset(e,t,n=!0){let r=t===void 0?e.childNodes.length-1:0,i=t===void 0?-1:1;for(;t===void 0?r>=(n?Math.max(e.childNodes.length-1,0):0):r<=e.childNodes.length;){if(t&&r===e.childNodes.length)throw Error(`The given offset is out of bounds.`);let n=e.childNodes.item(r),a=String(n.textContent);if(a.length){if(t!==void 0&&a.length<t)t-=a.length;else if(n.nodeType===1)return findNodeAtTextOffset(n,t,!1);else if(n.nodeType===3)return{node:n,offset:t??n.nodeValue.length}}r+=i}return{node:e,offset:e.childNodes.length}}function setSelectionPerMouseDown({document:e,target:t,clickCount:n,node:r,offset:i}){if(hasNoSelection(t))return;let a=hasOwnSelection(t),o=!r&&n%3!=1,s=a?String(getUIValue(t)):o?String(t.textContent):``,[c,l]=o?getTextRange(s,i,n):[i,i];if(a)return setUISelection(t,{anchorOffset:c??s.length,focusOffset:l??s.length}),{node:t,start:c??0,end:l??s.length};{let n=resolveCaretPosition({target:t,node:r,offset:c}),i=c===l?n:resolveCaretPosition({target:t,node:r,offset:l}),a=t.ownerDocument.createRange();try{a.setStart(n.node,n.offset),a.setEnd(i.node,i.offset)}catch{throw Error(`The given offset is out of bounds.`)}let o=e.getSelection();return o?.removeAllRanges(),o?.addRange(a.cloneRange()),a}}function getTextRange(e,t,n){if(e.length===0)return[t,t];let r=t??e.length;return n%3==2?[r-e.substr(0,t).match(/(\w+|\s+|\W)?$/)[0].length,t===void 0?t:t+e.substr(t).match(/^(\w+|\s+|\W)?/)[0].length]:[r-e.substr(0,t).match(/[^\r\n]*$/)[0].length,t===void 0?t:t+e.substr(t).match(/^[^\r\n]*/)[0].length]}function modifySelectionPerMouseMove(e,{document:t,target:n,node:r,offset:i}){let a=resolveCaretPosition({target:n,node:r,offset:i});if(`node`in e){
16
+ `)}function getLabelDescr(e){let t;return e.hasAttribute(`aria-label`)?t=e.getAttribute(`aria-label`):e.hasAttribute(`aria-labelledby`)?t=e.ownerDocument.getElementById(e.getAttribute(`aria-labelledby`))?.textContent?.trim():isElementType(e,[`button`,`input`,`meter`,`output`,`progress`,`select`,`textarea`])&&e.labels?.length?t=Array.from(e.labels).map(e=>e.textContent?.trim()).join(`|`):isElementType(e,`button`)&&(t=e.textContent?.trim()),t=t?.replace(/\n/g,` `),Number(t?.length)>30&&(t=`${t?.substring(0,29)}…`),t?`(label=${t})`:``}function hasBitFlag(e,t){return(e&t)>0}const I=Symbol(`Displayed value in UI`),L=Symbol(`Displayed selection in UI`),R=Symbol(`Initial value to compare on blur`);function isUIValue(e){return typeof e==`object`&&I in e}function isUISelectionStart(e){return!!e&&typeof e==`object`&&L in e}function setUIValue(e,t){let n=e;n[R]===void 0&&(n[R]=n.value),hasCtrlDomUI(n)?d.setUIValue(n,t):(n[I]=t,n.value=Object.assign(new String(t),{[I]:!0}))}function getUIValue(e){let t=e;return hasCtrlDomUI(t)?d.getUIValue(t):t[I]===void 0?t.value:String(t[I])}function setUIValueClean(e){hasCtrlDomUI(e)?d.clearUIValue(e):e[I]=void 0}function clearInitialValue(e){e[R]=void 0}function getInitialValue(e){return e[R]}function setUISelectionRaw(e,t){e[L]=t}function setUISelection(e,{focusOffset:t,anchorOffset:n=t},r=`replace`){let i=e;if(hasCtrlDomUI(i)){let e=r===`replace`?Math.max(0,n):getUISelection(i).anchorOffset,a=Math.max(0,t);if(e>a){let t=d.getUIValue(i).length;i[L]={anchorOffset:Math.min(e,t),focusOffset:Math.min(a,t)}}else i[L]!==void 0&&(i[L]=void 0);d.setUISelection(i,Math.min(e,a),Math.max(e,a),`none`);return}let a=getUIValue(i).length,sanitizeOffset=e=>Math.max(0,Math.min(a,e)),o=r===`replace`||i[L]===void 0?sanitizeOffset(n):i[L].anchorOffset,s=sanitizeOffset(t),c=Math.min(o,s),l=Math.max(o,s);if(i[L]={anchorOffset:o,focusOffset:s},i.selectionStart===c&&i.selectionEnd===l)return;let u=Object.assign(new Number(c),{[L]:!0});try{i.setSelectionRange(u,l)}catch{}}function getUISelection(e){let t=e;if(hasCtrlDomUI(t)){let{start:e,end:n}=d.getUISelection(t),r=t[L],i=r?.anchorOffset===n&&r.focusOffset===e;return{anchorOffset:i?n:e,focusOffset:i?e:n,startOffset:e,endOffset:n}}let n=t[L]??{anchorOffset:t.selectionStart??0,focusOffset:t.selectionEnd??0};return{anchorOffset:n.anchorOffset,focusOffset:n.focusOffset,startOffset:Math.min(n.anchorOffset,n.focusOffset),endOffset:Math.max(n.anchorOffset,n.focusOffset)}}function hasUISelection(e){return hasCtrlDomUI(e)||!!e[L]}function setUISelectionClean(e){e[L]=void 0}function getValueOrTextContent(e){return e?isContentEditable(e)?e.textContent:getUIValue(e):null}function copySelection(e){let t=hasOwnSelection(e)?{"text/plain":readSelectedValueFromInput(e)}:{"text/plain":String(e.ownerDocument.getSelection())},n=createDataTransfer(getWindow(e));for(let e in t)t[e]&&n.setData(e,t[e]);return n}function readSelectedValueFromInput(e){let t=getUISelection(e);return getUIValue(e).substring(t.startOffset,t.endOffset)}const z=Symbol(`Track programmatic changes for React workaround`);function isReact17Element(e){return Object.getOwnPropertyNames(e).some(e=>e.startsWith(`__react`))&&getWindow(e).REACT_VERSION===17}function startTrackValue(e){isReact17Element(e)&&(e[z]={previousValue:String(e.value),tracked:[]})}function trackOrSetValue(e,t){e[z]?.tracked?.push(t),e[z]||(setUIValueClean(e),setUISelection(e,{focusOffset:t.length}))}function commitValueAfterInput(e,t){let n=e[z];if(e[z]=void 0,!n?.tracked?.length)return;let r=n.tracked.length===2&&n.tracked[0]===n.previousValue&&n.tracked[1]===e.value;r||setUIValueClean(e),hasUISelection(e)&&setUISelection(e,{focusOffset:r?t:e.value.length})}function getTargetTypeAndSelection(e){let t=getElement(e);if(t&&hasOwnSelection(t))return{type:`input`,selection:getUISelection(t)};let n=t?.ownerDocument.getSelection();return{type:getContentEditable(e)&&n?.anchorNode&&getContentEditable(n.anchorNode)?`contenteditable`:`default`,selection:n}}function getElement(e){return e.nodeType===1?e:e.parentElement}function getInputRange(e){let t=getTargetTypeAndSelection(e);if(t.type===`input`)return t.selection;if(t.type===`contenteditable`)return t.selection?.getRangeAt(0)}function setSelection({focusNode:e,focusOffset:t,anchorNode:n=e,anchorOffset:r=t}){let i=getElement(e);if(i&&hasOwnSelection(i))return setUISelection(e,{anchorOffset:r,focusOffset:t});n.ownerDocument?.getSelection()?.setBaseAndExtent(n,r,e,t)}function moveSelection(e,t){if(hasOwnSelection(e)){let n=getUISelection(e);setSelection({focusNode:e,focusOffset:n.startOffset===n.endOffset?n.focusOffset+t:t<0?n.startOffset:n.endOffset})}else{let n=e.ownerDocument.getSelection();if(!n?.focusNode)return;if(n.isCollapsed){let e=getNextCursorPosition(n.focusNode,n.focusOffset,t);e&&setSelection({focusNode:e.node,focusOffset:e.offset})}else n[t<0?`collapseToStart`:`collapseToEnd`]()}}function resolveCaretPosition({target:e,node:t,offset:n}){if(hasOwnSelection(e))return{node:e,offset:n??getUIValue(e).length};if(t)return{node:t,offset:n??(t.nodeType===3?t.nodeValue.length:t.childNodes.length)};if(n===void 0){let t=e;for(;t.nodeType===1;){let n=t.lastChild;if(!n){if(t===e)return{node:e,offset:0};break}t=n}if(t.nodeType===3&&t.nodeValue)return{node:t,offset:t.nodeValue.length}}return findNodeAtTextOffset(e,n)}function findNodeAtTextOffset(e,t,n=!0){let r=t===void 0?e.childNodes.length-1:0,i=t===void 0?-1:1;for(;t===void 0?r>=(n?Math.max(e.childNodes.length-1,0):0):r<=e.childNodes.length;){if(t&&r===e.childNodes.length)throw Error(`The given offset is out of bounds.`);let n=e.childNodes.item(r),a=String(n.textContent);if(a.length){if(t!==void 0&&a.length<t)t-=a.length;else if(n.nodeType===1)return findNodeAtTextOffset(n,t,!1);else if(n.nodeType===3)return{node:n,offset:t??n.nodeValue.length}}r+=i}return{node:e,offset:e.childNodes.length}}function selectBoundaries(e,t,n,r,i){let a=e.getSelection();if(a){if(a.removeAllRanges(),t.getRootNode()===e)a.setBaseAndExtent(t,n,r,i);else{let o=e.createRange();o.setStart(t,n),o.setEnd(r,i),a.addRange(o)}}}function setSelectionPerMouseDown({document:e,target:t,clickCount:n,node:r,offset:i}){if(hasNoSelection(t))return;let a=hasOwnSelection(t),o=!r&&n%3!=1,s=a?String(getUIValue(t)):o?String(t.textContent):``,[c,l]=o?getTextRange(s,i,n):[i,i];if(a)return setUISelection(t,{anchorOffset:c??s.length,focusOffset:l??s.length}),{node:t,start:c??0,end:l??s.length};{let n=resolveCaretPosition({target:t,node:r,offset:c}),i=c===l?n:resolveCaretPosition({target:t,node:r,offset:l}),a=t.ownerDocument.createRange();try{a.setStart(n.node,n.offset),a.setEnd(i.node,i.offset)}catch{throw Error(`The given offset is out of bounds.`)}return selectBoundaries(e,a.startContainer,a.startOffset,a.endContainer,a.endOffset),a}}function getTextRange(e,t,n){if(e.length===0)return[t,t];let r=t??e.length;return n%3==2?[r-e.substr(0,t).match(/(\w+|\s+|\W)?$/)[0].length,t===void 0?t:t+e.substr(t).match(/^(\w+|\s+|\W)?/)[0].length]:[r-e.substr(0,t).match(/[^\r\n]*$/)[0].length,t===void 0?t:t+e.substr(t).match(/^[^\r\n]*/)[0].length]}function modifySelectionPerMouseMove(e,{document:t,target:n,node:r,offset:i}){let a=resolveCaretPosition({target:n,node:r,offset:i});if(`node`in e){
17
17
  /* istanbul ignore else */
18
- if(a.node===e.node){let t=a.offset<e.start?e.end:e.start,n=a.offset>e.end||a.offset<e.start?a.offset:e.end;setUISelection(e.node,{anchorOffset:t,focusOffset:n})}}else{let n=e.cloneRange(),r=n.comparePoint(a.node,a.offset);r<0?n.setStart(a.node,a.offset):r>0&&n.setEnd(a.node,a.offset);let i=t.getSelection();i?.removeAllRanges(),i?.addRange(n)}}function selectAll(e){if(hasOwnSelection(e))return setSelection({focusNode:e,anchorOffset:0,focusOffset:getUIValue(e).length});let t=getContentEditable(e)??e.ownerDocument.body;setSelection({focusNode:t,anchorOffset:0,focusOffset:t.childNodes.length})}function isAllSelected(e){if(hasOwnSelection(e))return getUISelection(e).startOffset===0&&getUISelection(e).endOffset===getUIValue(e).length;let t=getContentEditable(e)??e.ownerDocument.body,n=e.ownerDocument.getSelection();return n?.anchorNode===t&&n.focusNode===t&&n.anchorOffset===0&&n.focusOffset===t.childNodes.length}function setSelectionRange(e,t,n){if(hasOwnSelection(e))return setSelection({focusNode:e,anchorOffset:t,focusOffset:n});
18
+ if(a.node===e.node){let t=a.offset<e.start?e.end:e.start,n=a.offset>e.end||a.offset<e.start?a.offset:e.end;setUISelection(e.node,{anchorOffset:t,focusOffset:n})}}else{let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=e.comparePoint(a.node,a.offset);s<0?(n=a.node,r=a.offset):s>0&&(i=a.node,o=a.offset),selectBoundaries(t,n,r,i,o)}}function selectAll(e){if(hasOwnSelection(e))return setSelection({focusNode:e,anchorOffset:0,focusOffset:getUIValue(e).length});let t=getContentEditable(e)??e.ownerDocument.body;setSelection({focusNode:t,anchorOffset:0,focusOffset:t.childNodes.length})}function isAllSelected(e){if(hasOwnSelection(e))return getUISelection(e).startOffset===0&&getUISelection(e).endOffset===getUIValue(e).length;let t=getContentEditable(e)??e.ownerDocument.body,n=e.ownerDocument.getSelection();return n?.anchorNode===t&&n.focusNode===t&&n.anchorOffset===0&&n.focusOffset===t.childNodes.length}function setSelectionRange(e,t,n){if(hasOwnSelection(e))return setSelection({focusNode:e,anchorOffset:t,focusOffset:n});
19
19
  /* istanbul ignore else */
20
20
  if(isContentEditable(e)&&e.firstChild?.nodeType===3)return setSelection({focusNode:e.firstChild,anchorOffset:t,focusOffset:n});
21
21
  /* istanbul ignore next */