aria-ease 7.4.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -75
- package/dist/CheckboxComponentStrategy-AZF2Y4MN.js +1 -0
- package/dist/RadioComponentStrategy-GKA5KOM5.js +1 -0
- package/dist/ToggleComponentStrategy-TMRNXFSL.js +1 -0
- package/dist/cli.cjs +36 -36
- package/dist/cli.js +1 -1
- package/dist/{contractTestRunnerPlaywright-SJIHHZ3Y.js → contractTestRunnerPlaywright-CJFYO766.js} +5 -5
- package/dist/{contractTestRunnerPlaywright-IFI5BPGV.js → contractTestRunnerPlaywright-OB2GWGOA.js} +5 -5
- package/dist/index.cjs +42 -42
- package/dist/index.d.cts +18 -14
- package/dist/index.d.ts +18 -14
- package/dist/index.js +10 -10
- package/dist/src/{Types.d-D96FYkCN.d.cts → Types.d-BjBTlIzl.d.cts} +18 -8
- package/dist/src/{Types.d-D96FYkCN.d.ts → Types.d-BjBTlIzl.d.ts} +18 -8
- package/dist/src/accordion/index.cjs +1 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/accordion/index.js +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.cjs +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/checkbox/index.js +1 -1
- package/dist/src/combobox/index.cjs +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/combobox/index.js +1 -1
- package/dist/src/menu/index.cjs +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/menu/index.js +1 -1
- package/dist/src/radio/index.cjs +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/radio/index.js +1 -1
- package/dist/src/tabs/index.cjs +1 -1
- package/dist/src/tabs/index.d.cts +1 -2
- package/dist/src/tabs/index.d.ts +1 -2
- package/dist/src/tabs/index.js +1 -1
- package/dist/src/toggle/index.cjs +1 -1
- package/dist/src/toggle/index.d.cts +2 -7
- package/dist/src/toggle/index.d.ts +2 -7
- package/dist/src/toggle/index.js +1 -1
- package/dist/src/utils/test/CheckboxComponentStrategy-ST2DWNYT.js +1 -0
- package/dist/src/utils/test/RadioComponentStrategy-TWMIMSYX.js +1 -0
- package/dist/src/utils/test/ToggleComponentStrategy-UOGYK2U4.js +1 -0
- package/dist/src/utils/test/{contractTestRunnerPlaywright-Y7N2W6AK.js → contractTestRunnerPlaywright-ZKVK7KUM.js} +5 -5
- package/dist/src/utils/test/dsl/index.cjs +1 -1
- package/dist/src/utils/test/dsl/index.js +1 -1
- package/dist/src/utils/test/index.cjs +29 -29
- package/dist/src/utils/test/index.d.cts +1 -0
- package/dist/src/utils/test/index.d.ts +1 -0
- package/dist/src/utils/test/index.js +1 -1
- package/dist/{test-2XAMHIKD.js → test-TZFBWFCP.js} +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -50,8 +50,7 @@ interface AccordionConfig {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
interface AccordionCallback {
|
|
53
|
-
|
|
54
|
-
onCollapse?: (index: number) => void;
|
|
53
|
+
onExpandedChange?: (index: number, expanded: boolean) => void;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
interface TabsConfig {
|
|
@@ -64,7 +63,7 @@ interface TabsConfig {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
interface TabsCallback {
|
|
67
|
-
|
|
66
|
+
onSelectedChange?: (index: number, selected: boolean) => void;
|
|
68
67
|
onContextMenu?: (tabIndex: number, tabElement: HTMLElement) => void;
|
|
69
68
|
}
|
|
70
69
|
|
|
@@ -78,7 +77,7 @@ interface ComboboxConfig {
|
|
|
78
77
|
|
|
79
78
|
interface ComboboxCallback {
|
|
80
79
|
onSelect?: (item: HTMLElement) => void;
|
|
81
|
-
|
|
80
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
82
81
|
onActiveDescendantChange?: (optionId: string, item: HTMLElement) => void;
|
|
83
82
|
onClear?: () => void;
|
|
84
83
|
}
|
|
@@ -91,7 +90,7 @@ interface RadioConfig {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
interface RadioCallback {
|
|
94
|
-
|
|
93
|
+
onValueChange?: (index: number, value: string) => void;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
interface CheckboxConfig {
|
|
@@ -101,7 +100,7 @@ interface CheckboxConfig {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
interface CheckboxCallback {
|
|
104
|
-
|
|
103
|
+
onCheckedChange?: (index: number, checked: boolean) => void;
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
interface MenuConfig {
|
|
@@ -112,7 +111,18 @@ interface MenuConfig {
|
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
interface MenuCallback {
|
|
115
|
-
|
|
114
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface ToggleConfig {
|
|
118
|
+
toggleId: string;
|
|
119
|
+
togglesClass?: string;
|
|
120
|
+
isSingleToggle?: boolean;
|
|
121
|
+
callback: ToggleCallback;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface ToggleCallback {
|
|
125
|
+
onPressedChange: (index: number, pressed: boolean) => void;
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
/**
|
|
@@ -176,12 +186,7 @@ declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelecte
|
|
|
176
186
|
* @param {boolean} isSingleToggle - Whether this is a single toggle button (default: true).
|
|
177
187
|
*/
|
|
178
188
|
|
|
179
|
-
|
|
180
|
-
toggleId: string;
|
|
181
|
-
togglesClass?: string;
|
|
182
|
-
isSingleToggle?: boolean;
|
|
183
|
-
}
|
|
184
|
-
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle }: ToggleConfig): AccessibilityInstance;
|
|
189
|
+
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle, callback }: ToggleConfig): AccessibilityInstance;
|
|
185
190
|
|
|
186
191
|
/**
|
|
187
192
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -202,7 +207,6 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
202
207
|
* @param {string} tabPanelsClass - The shared class of all tab panels.
|
|
203
208
|
* @param {('horizontal' | 'vertical')} orientation - Tab list orientation (default: 'horizontal').
|
|
204
209
|
* @param {boolean} activateOnFocus - Whether tabs activate automatically on focus (default: true).
|
|
205
|
-
* @param {TabsCallback} callback - Configuration options for callbacks.
|
|
206
210
|
*/
|
|
207
211
|
|
|
208
212
|
declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
|
package/dist/index.d.ts
CHANGED
|
@@ -50,8 +50,7 @@ interface AccordionConfig {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
interface AccordionCallback {
|
|
53
|
-
|
|
54
|
-
onCollapse?: (index: number) => void;
|
|
53
|
+
onExpandedChange?: (index: number, expanded: boolean) => void;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
interface TabsConfig {
|
|
@@ -64,7 +63,7 @@ interface TabsConfig {
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
interface TabsCallback {
|
|
67
|
-
|
|
66
|
+
onSelectedChange?: (index: number, selected: boolean) => void;
|
|
68
67
|
onContextMenu?: (tabIndex: number, tabElement: HTMLElement) => void;
|
|
69
68
|
}
|
|
70
69
|
|
|
@@ -78,7 +77,7 @@ interface ComboboxConfig {
|
|
|
78
77
|
|
|
79
78
|
interface ComboboxCallback {
|
|
80
79
|
onSelect?: (item: HTMLElement) => void;
|
|
81
|
-
|
|
80
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
82
81
|
onActiveDescendantChange?: (optionId: string, item: HTMLElement) => void;
|
|
83
82
|
onClear?: () => void;
|
|
84
83
|
}
|
|
@@ -91,7 +90,7 @@ interface RadioConfig {
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
interface RadioCallback {
|
|
94
|
-
|
|
93
|
+
onValueChange?: (index: number, value: string) => void;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
interface CheckboxConfig {
|
|
@@ -101,7 +100,7 @@ interface CheckboxConfig {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
interface CheckboxCallback {
|
|
104
|
-
|
|
103
|
+
onCheckedChange?: (index: number, checked: boolean) => void;
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
interface MenuConfig {
|
|
@@ -112,7 +111,18 @@ interface MenuConfig {
|
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
interface MenuCallback {
|
|
115
|
-
|
|
114
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface ToggleConfig {
|
|
118
|
+
toggleId: string;
|
|
119
|
+
togglesClass?: string;
|
|
120
|
+
isSingleToggle?: boolean;
|
|
121
|
+
callback: ToggleCallback;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface ToggleCallback {
|
|
125
|
+
onPressedChange: (index: number, pressed: boolean) => void;
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
/**
|
|
@@ -176,12 +186,7 @@ declare function makeRadioAccessible({ radioGroupId, radiosClass, defaultSelecte
|
|
|
176
186
|
* @param {boolean} isSingleToggle - Whether this is a single toggle button (default: true).
|
|
177
187
|
*/
|
|
178
188
|
|
|
179
|
-
|
|
180
|
-
toggleId: string;
|
|
181
|
-
togglesClass?: string;
|
|
182
|
-
isSingleToggle?: boolean;
|
|
183
|
-
}
|
|
184
|
-
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle }: ToggleConfig): AccessibilityInstance;
|
|
189
|
+
declare function makeToggleAccessible({ toggleId, togglesClass, isSingleToggle, callback }: ToggleConfig): AccessibilityInstance;
|
|
185
190
|
|
|
186
191
|
/**
|
|
187
192
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -202,7 +207,6 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
|
|
|
202
207
|
* @param {string} tabPanelsClass - The shared class of all tab panels.
|
|
203
208
|
* @param {('horizontal' | 'vertical')} orientation - Tab list orientation (default: 'horizontal').
|
|
204
209
|
* @param {boolean} activateOnFocus - Whether tabs activate automatically on focus (default: true).
|
|
205
|
-
* @param {TabsCallback} callback - Configuration options for callbacks.
|
|
206
210
|
*/
|
|
207
211
|
|
|
208
212
|
declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{b as U,d as V}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function De({accordionId:e,triggersClass:t,panelsClass:h,allowMultipleOpen:s=!1,callback:l}){if(e==="")return console.error("[aria-ease] 'accordionId' should not be an empty string. Provide an id to the accordion container element that exists before calling makeAccordionAccessible."),{cleanup:()=>{}};let r=document.querySelector(`#${e}`);if(!r)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'triggersClass' should not be an empty string. Provide a class name that exists on the accordion trigger elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let n=Array.from(r.querySelectorAll(`.${t}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'panelsClass' should not be an empty string. Provide a class name that exists on the accordion panel elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let a=Array.from(r.querySelectorAll(`.${h}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${h}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(n.length!==a.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${n.length} triggers but ${a.length} panels.`),{cleanup:()=>{}};let o=new WeakMap,i=new WeakMap;function p(){n.forEach((d,w)=>{let H=a[w];d.id||(d.id=`${e}-trigger-${w}`),H.id||(H.id=`${e}-panel-${w}`),d.setAttribute("aria-controls",H.id),d.setAttribute("aria-expanded","false"),(!s||n.length<=6)&&H.setAttribute("role","region"),H.setAttribute("aria-labelledby",d.id),H.style.display="none"})}function m(d){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid accordion index: ${d}`);return}let w=n[d],H=a[d];if(w.setAttribute("aria-expanded","true"),H.style.display="block",l?.onExpand)try{l.onExpand(d)}catch(b){console.error("[aria-ease] Error in accordion onExpand callback:",b)}}function y(d){if(d<0||d>=n.length){console.error(`[aria-ease] Invalid accordion index: ${d}`);return}let w=n[d],H=a[d];if(w.setAttribute("aria-expanded","false"),H.style.display="none",l?.onCollapse)try{l.onCollapse(d)}catch(b){console.error("[aria-ease] Error in accordion onCollapse callback:",b)}}function L(d){n[d].getAttribute("aria-expanded")==="true"?y(d):(s||n.forEach((b,E)=>{E!==d&&y(E)}),m(d))}function C(d){return()=>{L(d)}}function S(d){return w=>{let{key:H}=w;switch(H){case"Enter":case" ":w.preventDefault(),L(d);break;case"ArrowDown":w.preventDefault();{let b=(d+1)%n.length;n[b].focus()}break;case"ArrowUp":w.preventDefault();{let b=(d-1+n.length)%n.length;n[b].focus()}break;case"Home":w.preventDefault(),n[0].focus();break;case"End":w.preventDefault(),n[n.length-1].focus();break}}}function q(){n.forEach((d,w)=>{let H=C(w),b=S(w);d.addEventListener("click",H),d.addEventListener("keydown",b),o.set(d,b),i.set(d,H)})}function c(){n.forEach(d=>{let w=o.get(d),H=i.get(d);w&&(d.removeEventListener("keydown",w),o.delete(d)),H&&(d.removeEventListener("click",H),i.delete(d))})}function u(){c(),n.forEach((d,w)=>{y(w)})}function A(){c();let d=Array.from(r.querySelectorAll(`.${t}`)),w=Array.from(r.querySelectorAll(`.${h}`));n.length=0,n.push(...d),a.length=0,a.push(...w),p(),q()}return p(),q(),{expandItem:m,collapseItem:y,toggleItem:L,cleanup:u,refresh:A}}function O(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function R(e){return e.tagName==="TEXTAREA"}function z(e){return e.tagName==="BUTTON"||e.tagName==="INPUT"&&["button","submit","reset"].includes(e.type)}function te(e){return e.tagName==="A"}function _(e,t,h){let s=e.length,l=(t+h+s)%s;e.item(l).focus()}function ne(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function W(e,t,h){let s=t.item(h);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!O(s)&&!R(s)||(O(s)||R(s))&&s.selectionStart===0)&&(e.preventDefault(),_(t,h,-1));break}case"ArrowDown":case"ArrowRight":{if(!O(s)&&!R(s))e.preventDefault(),_(t,h,1);else if(O(s)||R(s)){let l=s.value;s.selectionStart===l.length&&(e.preventDefault(),_(t,h,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!z(s)&&!te(s)&&ne(s)||z(s))&&(e.preventDefault(),s.click());break}case"Tab":break;default:break}}function Pe({blockId:e,blockItemsClass:t}){if(e==="")return console.error("[aria-ease] 'blockId' should not be an empty string. Provide an id to the block container element that exists before calling makeBlockAccessible."),{cleanup:()=>{}};let h=document.querySelector(`#${e}`);if(!h)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'blockItemsClass' should not be an empty string. Provide a class name that exists on the block item elements before calling makeBlockAccessible."),{cleanup:()=>{}};let s=null;function l(){return s||(s=h.querySelectorAll(`.${t}`)),s}let r=l();if(!r||r.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let n=new Map;r.forEach(i=>{if(!n.has(i)){let p=m=>{let y=h.querySelectorAll(`.${t}`),L=Array.prototype.indexOf.call(y,i);W(m,y,L)};i.addEventListener("keydown",p),n.set(i,p)}});function a(){r.forEach(i=>{let p=n.get(i);p&&(i.removeEventListener("keydown",p),n.delete(i))})}function o(){s=null}return{cleanup:a,refresh:o}}function Re({checkboxGroupId:e,checkboxesClass:t,callback:h}){if(e==="")return console.error("[aria-ease] 'checkboxGroupId' should not be an empty string. Provide an id to the checkbox group container element that exists before calling makeCheckboxAccessible."),{cleanup:()=>{}};let s=document.querySelector(`#${e}`);if(!s)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'checkboxesClass' should not be an empty string. Provide a class name that exists on the checkbox elements before calling makeCheckboxAccessible."),{cleanup:()=>{}};let l=Array.from(s.querySelectorAll(`.${t}`));if(l.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let r=new WeakMap,n=new WeakMap;function a(){s.getAttribute("role")||s.setAttribute("role","group"),l.forEach(u=>{u.setAttribute("role","checkbox"),u.hasAttribute("aria-checked")||u.setAttribute("aria-checked","false"),u.hasAttribute("tabindex")||u.setAttribute("tabindex","0")})}function o(u,A){if(h?.onCheck)try{h.onCheck(u,A)}catch(d){console.error("[aria-ease] Error in checkbox onCheck callback:",d)}}function i(u){if(u<0||u>=l.length){console.error(`[aria-ease] Invalid checkbox index: ${u}`);return}let A=l[u],d=A.getAttribute("aria-checked")==="true";A.setAttribute("aria-checked",d?"false":"true"),o(u,d)}function p(u,A){if(u<0||u>=l.length){console.error(`[aria-ease] Invalid checkbox index: ${u}`);return}l[u].setAttribute("aria-checked",A?"true":"false"),o(u,A)}function m(u){return()=>{i(u)}}function y(u){return A=>{let{key:d}=A;switch(d){case" ":A.preventDefault(),i(u);break}}}function L(){l.forEach((u,A)=>{let d=m(A),w=y(A);u.addEventListener("click",d),u.addEventListener("keydown",w),r.set(u,w),n.set(u,d)})}function C(){l.forEach(u=>{let A=r.get(u),d=n.get(u);A&&(u.removeEventListener("keydown",A),r.delete(u)),d&&(u.removeEventListener("click",d),n.delete(u))})}function S(){C()}function q(){return l.map(u=>u.getAttribute("aria-checked")==="true")}function c(){return l.map((u,A)=>u.getAttribute("aria-checked")==="true"?A:-1).filter(u=>u!==-1)}return a(),L(),{toggleCheckbox:i,setCheckboxState:p,getCheckedStates:q,getCheckedIndices:c,cleanup:S}}function re({menuId:e,menuItemsClass:t,triggerId:h,callback:s}){if(e==="")return console.error("[aria-ease] 'menuId' should not be an empty string. Provide an id of the menu element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let l=document.querySelector(`#${e}`);if(!l)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'triggerId' should not be an empty string. Provide an id of the trigger button element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let r=document.querySelector(`#${h}`);if(!r)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'menuItemsClass' should not be an empty string. Provide a class name to at least a menu item that exists before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(!/^[\w-]+$/.test(e))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};r.setAttribute("aria-haspopup","true"),r.setAttribute("aria-controls",e),r.setAttribute("aria-expanded","false"),l.setAttribute("role","menu"),l.setAttribute("aria-labelledby",h);let n=new WeakMap,a=new Map,o=null,i=null;function p(){return o||(o=l.querySelectorAll(`.${t}`)),o}function m(){if(!i){let g=p();i=[];for(let v=0;v<g.length;v++){let x=g.item(v),D=A(x),P=x.getAttribute("aria-disabled")==="true";D||(x.hasAttribute("tabindex")||x.setAttribute("tabindex","-1"),P||i.push(x))}}return i}function y(g){return{length:g.length,item:x=>g[x],forEach:x=>{g.forEach(x)},[Symbol.iterator]:function*(){for(let x of g)yield x}}}function L(){p().forEach(v=>{v.setAttribute("role","menuitem");let x=v.getAttribute("data-submenu-id")??v.getAttribute("aria-controls"),D=v.hasAttribute("aria-haspopup")&&x;x&&(v.hasAttribute("data-submenu-id")||D)&&(v.setAttribute("aria-haspopup","menu"),v.setAttribute("aria-controls",x),v.hasAttribute("aria-expanded")||v.setAttribute("aria-expanded","false"))})}function C(g,v,x){let D=g.length,P=(v+x+D)%D;g.item(P).focus()}function S(g,v){g.length!==0&&g[v]?.focus()}function q(g){return g.hasAttribute("aria-controls")&&g.hasAttribute("aria-haspopup")&&g.getAttribute("role")==="menuitem"}function c(g){let v=g;for(;v&&v.getAttribute("role")==="menuitem";){let x=v.closest('[role="menu"]');if(!x)break;x.style.display="none",v.setAttribute("aria-expanded","false");let D=x.getAttribute("aria-labelledby");if(!D)break;let P=document.getElementById(D);if(!P)break;v=P}}L();function u(g,v,x){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&r.getAttribute("role")==="menuitem"){g.preventDefault(),f();return}break}case"ArrowUp":{g.preventDefault(),C(y(m()),x,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&q(v)){g.preventDefault();let D=v.getAttribute("aria-controls");if(D){w(D);return}}break}case"ArrowDown":{g.preventDefault(),C(y(m()),x,1);break}case"Home":{g.preventDefault(),S(m(),0);break}case"End":{g.preventDefault();let D=m();S(D,D.length-1);break}case"Escape":{g.preventDefault(),f(),r.focus(),H&&H(!1);break}case"Enter":case" ":{if(g.preventDefault(),q(v)){let D=v.getAttribute("aria-controls");if(D){w(D);return}}v.click(),f(),H&&H(!1);break}case"Tab":{f(),c(r),H&&H(!1);break}default:break}}function A(g){let v=g.parentElement;for(;v&&v!==l;){if(v.getAttribute("role")==="menu"||v.id&&l.querySelector(`[aria-controls="${v.id}"]`))return!0;v=v.parentElement}return!1}function d(g){r.setAttribute("aria-expanded",g?"true":"false")}function w(g){let v=a.get(g);if(!v){let x=l.querySelector(`[aria-controls="${g}"]`);if(!x){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!x.id){let P=`trigger-${g}`;x.id=P,console.warn(`[aria-ease] Submenu trigger for "${g}" had no ID. Auto-generated ID: "${P}".`)}if(!document.querySelector(`#${g}`)){console.error(`[aria-ease] Submenu element with id="${g}" not found. Cannot create submenu instance.`);return}v=re({menuId:g,menuItemsClass:t,triggerId:x.id,callback:s}),a.set(g,v)}v.openMenu()}function H(g){if(s?.onOpenChange)try{s.onOpenChange(g)}catch(v){console.error("[aria-ease] Error in menu onOpenChange callback:",v)}}function b(){m().forEach((v,x)=>{if(!n.has(v)){let D=P=>u(P,v,x);v.addEventListener("keydown",D),n.set(v,D)}})}function E(){m().forEach(v=>{let x=n.get(v);x&&(v.removeEventListener("keydown",x),n.delete(v))})}function M(){d(!0),l.style.display="block";let g=m();if(b(),g&&g.length>0&&g[0].focus(),s?.onOpenChange)try{s.onOpenChange(!0)}catch(v){console.error("[aria-ease] Error in menu onOpenChange callback:",v)}}function f(){if(a.forEach(g=>g.closeMenu()),d(!1),l.style.display="none",E(),r.focus(),s?.onOpenChange)try{s.onOpenChange(!1)}catch(g){console.error("[aria-ease] Error in menu onOpenChange callback:",g)}}function k(){r.getAttribute("aria-expanded")==="true"?f():M()}function T(g){if(!(r.getAttribute("aria-expanded")==="true"))return;let x=r.contains(g.target),D=l.contains(g.target);!x&&!D&&f()}r.addEventListener("click",k),document.addEventListener("click",T);function $(){E(),r.removeEventListener("click",k),document.removeEventListener("click",T),l.style.display="none",d(!1),a.forEach(g=>g.cleanup()),a.clear()}function I(){o=null,i=null}return{openMenu:M,closeMenu:f,cleanup:$,refresh:I}}function Ve({radioGroupId:e,radiosClass:t,defaultSelectedIndex:h,callback:s}){if(e==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let l=document.querySelector(`#${e}`);if(!l)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let r=Array.from(l.querySelectorAll(`.${t}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let n=new WeakMap,a=new WeakMap,o;h&&(o=h);function i(){l.getAttribute("role")||l.setAttribute("role","radiogroup"),r.forEach((c,u)=>{c.setAttribute("role","radio"),c.setAttribute("tabindex","0"),u===o?c.setAttribute("aria-checked","true"):c.setAttribute("aria-checked","false")})}function p(c){if(c<0||c>=r.length){console.error(`[aria-ease] Invalid radio index: ${c}`);return}if(o>=0&&o<r.length&&r[o].setAttribute("aria-checked","false"),r[c].setAttribute("aria-checked","true"),r[c].focus(),s?.onCheck)try{s.onCheck(c)}catch(u){console.error("[aria-ease] Error in radio onCheck callback:",u)}o=c}function m(c){return()=>{p(c)}}function y(c){return u=>{let{key:A}=u,d=c;switch(A){case"ArrowDown":case"ArrowRight":u.preventDefault(),d=(c+1)%r.length,p(d);break;case"ArrowUp":case"ArrowLeft":u.preventDefault(),d=(c-1+r.length)%r.length,p(d);break;case" ":case"Enter":u.preventDefault(),p(c);break}}}function L(){r.forEach((c,u)=>{let A=m(u),d=y(u);c.addEventListener("click",A),c.addEventListener("keydown",d),n.set(c,d),a.set(c,A)})}function C(){r.forEach(c=>{let u=n.get(c),A=a.get(c);u&&(c.removeEventListener("keydown",u),n.delete(c)),A&&(c.removeEventListener("click",A),a.delete(c))})}function S(){C()}function q(){return o}return i(),L(),{selectRadio:p,getSelectedIndex:q,cleanup:S}}function Ke({toggleId:e,togglesClass:t,isSingleToggle:h=!0}){if(e==="")return console.error("[aria-ease] 'toggleId' should not be an empty string. Provide an id to the toggle element or toggle container before calling makeToggleAccessible."),{cleanup:()=>{}};let s=document.querySelector(`#${e}`);if(!s)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let l;if(h)l=[s];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(l=Array.from(s.querySelectorAll(`.${t}`)),l.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let r=new WeakMap,n=new WeakMap;function a(){l.forEach(c=>{c.tagName.toLowerCase()!=="button"&&!c.getAttribute("role")&&c.setAttribute("role","button"),c.hasAttribute("aria-pressed")||c.setAttribute("aria-pressed","false"),c.hasAttribute("tabindex")||c.setAttribute("tabindex","0")})}function o(c){if(c<0||c>=l.length){console.error(`[aria-ease] Invalid toggle index: ${c}`);return}let u=l[c],A=u.getAttribute("aria-pressed")==="true";u.setAttribute("aria-pressed",A?"false":"true")}function i(c,u){if(c<0||c>=l.length){console.error(`[aria-ease] Invalid toggle index: ${c}`);return}l[c].setAttribute("aria-pressed",u?"true":"false")}function p(c){return()=>{o(c)}}function m(c){return u=>{let{key:A}=u;switch(A){case"Enter":case" ":u.preventDefault(),o(c);break}}}function y(){l.forEach((c,u)=>{let A=p(u),d=m(u);c.addEventListener("click",A),c.addEventListener("keydown",d),r.set(c,d),n.set(c,A)})}function L(){l.forEach(c=>{let u=r.get(c),A=n.get(c);u&&(c.removeEventListener("keydown",u),r.delete(c)),A&&(c.removeEventListener("click",A),n.delete(c))})}function C(){L()}function S(){return l.map(c=>c.getAttribute("aria-pressed")==="true")}function q(){return l.map((c,u)=>c.getAttribute("aria-pressed")==="true"?u:-1).filter(c=>c!==-1)}return a(),y(),{toggleButton:o,setPressed:i,getPressedStates:S,getPressedIndices:q,cleanup:C}}function Ue({comboboxInputId:e,comboboxButtonId:t,listBoxId:h,listBoxItemsClass:s,callback:l}){if(e==="")return console.error("[aria-ease] 'comboboxInputId' should not be an empty string. Provide an id to the combobox input element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let r=document.getElementById(`${e}`);if(!r)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let n=document.getElementById(`${h}`);if(!n)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(s==="")return console.error("[aria-ease] 'listboxItemsClass' class should not be an empty string. Provide a class name to at least a listbox option that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};if(!document.querySelectorAll(s))return console.error(`[aria-ease] Listbox option(s) with class="${s}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let o=t?document.getElementById(`${t}`):null,i=-1;r.setAttribute("role","combobox"),r.setAttribute("aria-autocomplete","list"),r.setAttribute("aria-controls",h),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-haspopup","listbox"),n.setAttribute("role","listbox");let p=null;function m(){return p||(p=n.querySelectorAll(`.${s}`)),Array.from(p).filter(f=>!f.hidden&&f.style.display!=="none")}function y(){return r.getAttribute("aria-expanded")==="true"}function L(f){let k=m();if(f>=0&&f<k.length){let T=k[f],$=T.id||`${h}-option-${f}`;if(T.id||(T.id=$),r.setAttribute("aria-activedescendant",$),typeof T.scrollIntoView=="function"&&T.scrollIntoView({block:"nearest",behavior:"smooth"}),l?.onActiveDescendantChange)try{l.onActiveDescendantChange($,T)}catch(I){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",I)}}else r.setAttribute("aria-activedescendant","");i=f}function C(){if(r.setAttribute("aria-expanded","true"),n.style.display="block",l?.onOpenChange)try{l.onOpenChange(!0)}catch(f){console.error("[aria-ease] Error in combobox onOpenChange callback:",f)}}function S(){if(r.setAttribute("aria-expanded","false"),r.setAttribute("aria-activedescendant",""),n.style.display="none",i=-1,l?.onOpenChange)try{l.onOpenChange(!1)}catch(f){console.error("[aria-ease] Error in combobox onOpenChange callback:",f)}}function q(f){let k=f.textContent?.trim()||"";if(r.value=k,f.setAttribute("aria-selected","true"),S(),l?.onSelect)try{l.onSelect(f)}catch(T){console.error("[aria-ease] Error in combobox onSelect callback:",T)}}function c(f){let k=m(),T=y();switch(f.key){case"ArrowDown":if(f.preventDefault(),!T){C();return}if(k.length===0)return;{let $=i>=k.length-1?0:i+1;L($)}break;case"ArrowUp":if(f.preventDefault(),!T)return;if(k.length>0){let $=i<=0?k.length-1:i-1;L($)}break;case"Enter":T&&i>=0&&i<k.length&&(f.preventDefault(),q(k[i]));break;case"Escape":if(T)f.preventDefault(),S();else if(r.value&&(f.preventDefault(),r.value="",r.setAttribute("aria-activedescendant",""),m().forEach(I=>{I.getAttribute("aria-selected")==="true"&&I.setAttribute("aria-selected","false")}),l?.onClear))try{l.onClear()}catch(I){console.error("[aria-ease] Error in combobox onClear callback:",I)}break;case"Home":T&&k.length>0&&(f.preventDefault(),L(0));break;case"End":T&&k.length>0&&(f.preventDefault(),L(k.length-1));break;case"Tab":T&&i>=0&&i<k.length&&q(k[i]),T&&S();break}}function u(f){let k=f.target;if(k.classList.contains(s)){let $=m().indexOf(k);$>=0&&L($)}}function A(f){let k=f.target;k.classList.contains(s)&&(f.preventDefault(),q(k))}function d(f){let k=f.target;!r.contains(k)&&!n.contains(k)&&(!o||!o.contains(k))&&S()}function w(){y()?S():(C(),r.focus())}function H(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),w())}r.addEventListener("keydown",c),n.addEventListener("mousemove",u),n.addEventListener("mousedown",A),document.addEventListener("mousedown",d),o&&(o.setAttribute("tabindex","-1"),o.setAttribute("aria-label","Toggle options"),o.addEventListener("click",w),o.addEventListener("keydown",H));function b(){let f=n.querySelectorAll(`.${s}`);if(f.length===0)return;let k=null;for(let T of f)if(T.getAttribute("aria-selected")==="true"){k=T.textContent?.trim()||null;break}!k&&r.value&&(k=r.value.trim()),f.forEach((T,$)=>{T.setAttribute("role","option");let I=T.textContent?.trim()||"";k&&I===k?T.setAttribute("aria-selected","true"):T.setAttribute("aria-selected","false");let g=T.getAttribute("id");if(!g||g===""){let v=`${h}-option-${$}`;T.id=v,T.setAttribute("id",v)}})}b();function E(){r.removeEventListener("keydown",c),n.removeEventListener("mousemove",u),n.removeEventListener("mousedown",A),document.removeEventListener("mousedown",d),o&&(o.removeEventListener("click",w),o.removeEventListener("keydown",H))}function M(){p=null,b(),i=-1,L(-1)}return{cleanup:E,refresh:M,openListbox:C,closeListbox:S}}function We({tabListId:e,tabsClass:t,tabPanelsClass:h,orientation:s="horizontal",activateOnFocus:l=!0,callback:r}){if(e==="")return console.error("[aria-ease] 'tabListId' should not be an empty string. Provide an id to the tab list container element that exists before calling makeTabsAccessible."),{cleanup:()=>{}};let n=document.querySelector(`#${e}`);if(!n)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'tabsClass' should not be an empty string. Provide a class name that exists on the tab button elements before calling makeTabsAccessible."),{cleanup:()=>{}};let a=Array.from(n.querySelectorAll(`.${t}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'tabPanelsClass' should not be an empty string. Provide a class name that exists on the tab panel elements before calling makeTabsAccessible."),{cleanup:()=>{}};let o=Array.from(document.querySelectorAll(`.${h}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${h}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${a.length} tabs but ${o.length} panels.`),{cleanup:()=>{}};let i=new WeakMap,p=new WeakMap,m=new WeakMap,y=0;function L(){n.setAttribute("role","tablist"),n.setAttribute("aria-orientation",s),a.forEach((b,E)=>{let M=o[E];b.id||(b.id=`${e}-tab-${E}`),M.id||(M.id=`${e}-panel-${E}`),b.setAttribute("role","tab"),b.setAttribute("aria-controls",M.id),b.setAttribute("aria-selected","false"),b.setAttribute("tabindex","-1"),M.setAttribute("role","tabpanel"),M.setAttribute("aria-labelledby",b.id),M.hidden=!0,M.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||M.setAttribute("tabindex","0")}),C(0,!1)}function C(b,E=!0){if(b<0||b>=a.length){console.error(`[aria-ease] Invalid tab index: ${b}`);return}let M=y;a.forEach((T,$)=>{let I=o[$];T.setAttribute("aria-selected","false"),T.setAttribute("tabindex","-1"),I.hidden=!0});let f=a[b],k=o[b];if(f.setAttribute("aria-selected","true"),f.setAttribute("tabindex","0"),k.hidden=!1,E&&f.focus(),y=b,r?.onTabChange&&M!==b)try{r.onTabChange(b,M)}catch(T){console.error("[aria-ease] Error in tabs onTabChange callback:",T)}}function S(b){let E=a.findIndex(k=>k===document.activeElement),M=E!==-1?E:y,f=M;switch(b){case"first":f=0;break;case"last":f=a.length-1;break;case"next":f=(M+1)%a.length;break;case"prev":f=(M-1+a.length)%a.length;break}if(a[f].focus(),a[f].setAttribute("tabindex","0"),a[y].setAttribute("tabindex","-1"),l)C(f,!1);else{let k=y;a.forEach((T,$)=>{$===f?T.setAttribute("tabindex","0"):$!==k&&T.setAttribute("tabindex","-1")})}}function q(b){return()=>{C(b)}}function c(b){return E=>{let{key:M}=E,f=!1;if(s==="horizontal")switch(M){case"ArrowLeft":E.preventDefault(),S("prev"),f=!0;break;case"ArrowRight":E.preventDefault(),S("next"),f=!0;break}else switch(M){case"ArrowUp":E.preventDefault(),S("prev"),f=!0;break;case"ArrowDown":E.preventDefault(),S("next"),f=!0;break}if(!f)switch(M){case"Home":E.preventDefault(),S("first");break;case"End":E.preventDefault(),S("last");break;case" ":case"Enter":l||(E.preventDefault(),C(b));break;case"F10":if(E.shiftKey&&r?.onContextMenu){E.preventDefault();try{r.onContextMenu(b,a[b])}catch(k){console.error("[aria-ease] Error in tabs onContextMenu callback:",k)}}break}}}function u(b){return E=>{if(r?.onContextMenu){E.preventDefault();try{r.onContextMenu(b,a[b])}catch(M){console.error("[aria-ease] Error in tabs onContextMenu callback:",M)}}}}function A(){a.forEach((b,E)=>{let M=q(E),f=c(E),k=u(E);b.addEventListener("click",M),b.addEventListener("keydown",f),r?.onContextMenu&&(b.addEventListener("contextmenu",k),m.set(b,k)),i.set(b,f),p.set(b,M)})}function d(){a.forEach(b=>{let E=i.get(b),M=p.get(b),f=m.get(b);E&&(b.removeEventListener("keydown",E),i.delete(b)),M&&(b.removeEventListener("click",M),p.delete(b)),f&&(b.removeEventListener("contextmenu",f),m.delete(b))})}function w(){d(),a.forEach((b,E)=>{let M=o[E];b.removeAttribute("role"),b.removeAttribute("aria-selected"),b.removeAttribute("aria-controls"),b.removeAttribute("tabindex"),M.removeAttribute("role"),M.removeAttribute("aria-labelledby"),M.removeAttribute("tabindex"),M.hidden=!1}),n.removeAttribute("role"),n.removeAttribute("aria-orientation")}function H(){d();let b=Array.from(n.querySelectorAll(`.${t}`)),E=Array.from(document.querySelectorAll(`.${h}`));a.length=0,a.push(...b),o.length=0,o.push(...E),L(),A()}return L(),A(),{activateTab:C,cleanup:w,refresh:H}}var j={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:ie},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...ae(),...J()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:le},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ue},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:pe},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:de},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>typeof e.relativeTarget=="number"?Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):e.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:e.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(e={})=>se(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:oe},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:J},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ce(e.relativeTarget)}};function ie(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function ae(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function se(e){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:e,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function oe(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function J(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function ce(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${e} item to have aria-selected='true'.`}]}function le(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function ue(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function pe(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function de(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var X={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:fe},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:be},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ge},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:me},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>he(e.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:ve},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ye},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:Ae},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ke},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>{let t=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof e.relativeTarget=="number"&&(t=t.concat(Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),e.relativeTarget==="first"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),e.relativeTarget==="last"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),t}},{when:["pointer"],steps:(e={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ee(e.relativeTarget)}};function fe(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function be(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function ge(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function me(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function he(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function ve(){return[{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function ye(){return[{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function Ae(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function ke(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Ee(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var G={"tab.active":{setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Me(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Te(e.relativeTarget)}};function Te(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:"Expected first tab to have focus."}]}function we(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have tabindex='0'.`}]}function Me(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${e} tab to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} tab to be visible.`},we(e)]}var Q={"panel.expanded":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>xe(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Le(e.relativeTarget)}};function xe(e){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function Le(e){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger not to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}function He(e,t){return t.some(h=>e.capabilities.includes(h))}function B(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let h of e)if(He(t,h.when))return h.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var Ce={combobox:j,menu:X,tabs:G,accordion:Q},N=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=Ce[t]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let h=this.statePack,s={capabilities:["keyboard"]},l=(n,a=new Set)=>{if(a.has(n))return[];a.add(n);let o=h[n];if(!o)return[];let i=[];if(Array.isArray(o.requires))for(let p of o.requires)i=i.concat(l(p,a));return o.setup&&(i=i.concat(B(o.setup,s))),i};return t({ariaReference:(n,a,o)=>({requires:i=>{let p=l(i,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"required",setup:p}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"optional",setup:p}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"recommended",setup:p})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:a,to:o,level:"recommended"})}),contains:(n,a)=>({requires:o=>{let i=l(o,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"required",setup:i}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"optional",setup:i}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"recommended",setup:i})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:a,level:"recommended"})})}),this}static(t){return t({target:s=>{let l=a=>{let o=this.statePack,i={capabilities:["keyboard"]},p=(m,y=new Set)=>{if(y.has(m))return[];y.add(m);let L=o[m];if(!L)return[];let C=[];if(Array.isArray(L.requires))for(let S of L.requires)C=C.concat(p(S,y));return L.setup&&(C=C.concat(B(L.setup,i))),C};return p(a,new Set)},r=a=>a==="role"?"toHaveRole":"toHaveAttribute",n=(a,o,i)=>{let p=r(a);return{required:()=>this.staticAssertions.push({target:s,assertion:p,attribute:a,expectedValue:o,failureMessage:"",level:"required",setup:i}),optional:()=>this.staticAssertions.push({target:s,assertion:p,attribute:a,expectedValue:o,failureMessage:"",level:"optional",setup:i}),recommended:()=>this.staticAssertions.push({target:s,assertion:p,attribute:a,expectedValue:o,failureMessage:"",level:"recommended",setup:i})}};return{has:(a,o)=>({...n(a,o),requires:p=>{let m=l(p);return n(a,o,m)}})}}}),this}when(t){return new F(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?this.staticAssertions:[],dynamic:this.dynamicTests}}},F=class{constructor(t,h,s){this.parent=t;this.statePack=h;this.event=s}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,h){return this._onTarget=t,this._onRelativeTarget=h,this}given(t){return this._given=this._normalizeStates(t),this}then(t){return this._then=this._normalizeStates(t),this}orientation(t){return this._orientation=t,this}_normalizeStates(t){return(Array.isArray(t)?t:[t]).flatMap(s=>typeof s=="string"?[s]:typeof s=="object"&&s!==null&&"type"in s&&"ref"in s?this._findStateKeyByTypeAndRef(s.type)?[{type:s.type,ref:s.ref}]:[]:[s])}_findStateKeyByTypeAndRef(t){if(Object.keys(this.statePack).includes(t))return t}describe(t){return this._desc=t,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let s={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},l=(i,p=new Set)=>{if(p.has(i))return[];p.add(i);let m=this.statePack[i];if(!m)return[];let y=[];if(Array.isArray(m.requires))for(let L of m.requires)y=y.concat(l(L,p));return m.setup&&(y=y.concat(B(m.setup,s))),y},r=[];for(let i of this._given)if(typeof i=="string")r.push(...l(i));else if(typeof i=="object"&&i!==null&&"type"in i&&"ref"in i){let p=this._findStateKeyByTypeAndRef(i.type);if(p){let m=this.statePack[p];if(m&&m.setup)for(let y of m.setup)typeof y.steps=="function"?r.push(...y.steps({relativeTarget:i.ref})):Array.isArray(y.steps)&&r.push(...y.steps)}}let n=new Set;r=r.filter(i=>{let p=JSON.stringify(i);return n.has(p)?!1:(n.add(p),!0)});let a=[];for(let i of this._then)if(typeof i=="string"){let p=this.statePack[i];if(p&&p.assertion!==void 0){let m=p.assertion;if(typeof m=="function")try{m=m()}catch(y){throw new Error(`Error calling assertion function for state '${i}': ${y.message}`)}Array.isArray(m)?a.push(...m):a.push(m)}}else if(typeof i=="object"&&i!==null&&"type"in i&&"ref"in i){let p=this._findStateKeyByTypeAndRef(i.type);if(p){let m=this.statePack[p];if(m&&m.assertion!==void 0){let y=m.assertion;if(typeof y=="function")try{y=y({relativeTarget:i.ref})}catch(L){throw new Error(`Error calling assertion function for state '${p}': ${L.message}`)}Array.isArray(y)?a.push(...y):a.push(y)}}}let o=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:o,assertions:a,...r.length?{setup:r}:{}})}};function at(e,t){let h=new K(e);return t(h),new N(h.build())}import Se from"path";async function Y(e,t,h={}){if(!e||typeof e!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!t)throw new Error("\u274C testUiComponent requires a URL");if(t&&typeof t!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let s={violations:[]};async function l(p){try{let m=await fetch(p,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(m.ok||m.status===304)return p}catch{return null}return null}let r=V(h.strictness),n={},a=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:p}=await import("./configLoader-ZEJVXLX7.js"),m=await p(process.cwd());if(n=m.config,m.configPath&&(a=Se.dirname(m.configPath)),h.strictness===void 0){let y=n.test?.components?.find(L=>L?.name===e)?.strictness;r=V(y??n.test?.strictness)}}catch{h.strictness===void 0&&(r="balanced")}let o;try{if(t){let p=await l(t);if(p){console.log(`\u{1F3AD} Running Playwright tests on ${p}`);let{runContractTestsPlaywright:m}=await import("./contractTestRunnerPlaywright-IFI5BPGV.js");o=await m(e,p,r,n,a)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
2
|
-
Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(
|
|
3
|
-
\u274C ${
|
|
4
|
-
\u2705 ${
|
|
1
|
+
import{b as z,d as N}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Ue({accordionId:e,triggersClass:t,panelsClass:h,allowMultipleOpen:l=!1,callback:p}){if(e==="")return console.error("[aria-ease] 'accordionId' should not be an empty string. Provide an id to the accordion container element that exists before calling makeAccordionAccessible."),{cleanup:()=>{}};let n=document.querySelector(`#${e}`);if(!n)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'triggersClass' should not be an empty string. Provide a class name that exists on the accordion trigger elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let a=Array.from(n.querySelectorAll(`.${t}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'panelsClass' should not be an empty string. Provide a class name that exists on the accordion panel elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let o=Array.from(n.querySelectorAll(`.${h}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${h}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(a.length!==o.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${a.length} triggers but ${o.length} panels.`),{cleanup:()=>{}};let c=new WeakMap,s=new WeakMap;function u(){a.forEach((i,E)=>{let H=o[E];i.id||(i.id=`${e}-trigger-${E}`),H.id||(H.id=`${e}-panel-${E}`),i.setAttribute("aria-controls",H.id),i.setAttribute("aria-expanded","false"),(!l||a.length<=6)&&H.setAttribute("role","region"),H.setAttribute("aria-labelledby",i.id),H.style.display="none"})}function b(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let E=a[i],H=o[i];if(E.setAttribute("aria-expanded","true"),H.style.display="block",p?.onExpandedChange)try{p.onExpandedChange(i,!0)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function y(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let E=a[i],H=o[i];if(E.setAttribute("aria-expanded","false"),H.style.display="none",p?.onExpandedChange)try{p.onExpandedChange(i,!1)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function L(i){a[i].getAttribute("aria-expanded")==="true"?y(i):(l||a.forEach((f,T)=>{T!==i&&y(T)}),b(i))}function C(i){return()=>{L(i)}}function S(i){return E=>{let{key:H}=E;switch(H){case"Enter":case" ":E.preventDefault(),L(i);break;case"ArrowDown":E.preventDefault();{let f=(i+1)%a.length;a[f].focus()}break;case"ArrowUp":E.preventDefault();{let f=(i-1+a.length)%a.length;a[f].focus()}break;case"Home":E.preventDefault(),a[0].focus();break;case"End":E.preventDefault(),a[a.length-1].focus();break}}}function I(){a.forEach((i,E)=>{let H=C(E),f=S(E);i.addEventListener("click",H),i.addEventListener("keydown",f),c.set(i,f),s.set(i,H)})}function k(){a.forEach(i=>{let E=c.get(i),H=s.get(i);E&&(i.removeEventListener("keydown",E),c.delete(i)),H&&(i.removeEventListener("click",H),s.delete(i))})}function r(){k(),a.forEach((i,E)=>{y(E)})}function m(){k();let i=Array.from(n.querySelectorAll(`.${t}`)),E=Array.from(n.querySelectorAll(`.${h}`));a.length=0,a.push(...i),o.length=0,o.push(...E),u(),I()}return u(),I(),{expandItem:b,collapseItem:y,toggleItem:L,cleanup:r,refresh:m}}function _(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function V(e){return e.tagName==="TEXTAREA"}function W(e){return e.tagName==="BUTTON"||e.tagName==="INPUT"&&["button","submit","reset"].includes(e.type)}function ie(e){return e.tagName==="A"}function O(e,t,h){let l=e.length,p=(t+h+l)%l;e.item(p).focus()}function se(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function J(e,t,h){let l=t.item(h);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!_(l)&&!V(l)||(_(l)||V(l))&&l.selectionStart===0)&&(e.preventDefault(),O(t,h,-1));break}case"ArrowDown":case"ArrowRight":{if(!_(l)&&!V(l))e.preventDefault(),O(t,h,1);else if(_(l)||V(l)){let p=l.value;l.selectionStart===p.length&&(e.preventDefault(),O(t,h,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!W(l)&&!ie(l)&&se(l)||W(l))&&(e.preventDefault(),l.click());break}case"Tab":break;default:break}}function je({blockId:e,blockItemsClass:t}){if(e==="")return console.error("[aria-ease] 'blockId' should not be an empty string. Provide an id to the block container element that exists before calling makeBlockAccessible."),{cleanup:()=>{}};let h=document.querySelector(`#${e}`);if(!h)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the block element exists before calling makeBlockAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'blockItemsClass' should not be an empty string. Provide a class name that exists on the block item elements before calling makeBlockAccessible."),{cleanup:()=>{}};let l=null;function p(){return l||(l=h.querySelectorAll(`.${t}`)),l}let n=p();if(!n||n.length===0)return console.error(`[aria-ease] Element with class="${t}" not found. Make sure the block items exist before calling makeBlockAccessible.`),{cleanup:()=>{}};let a=new Map;n.forEach(s=>{if(!a.has(s)){let u=b=>{let y=h.querySelectorAll(`.${t}`),L=Array.prototype.indexOf.call(y,s);J(b,y,L)};s.addEventListener("keydown",u),a.set(s,u)}});function o(){n.forEach(s=>{let u=a.get(s);u&&(s.removeEventListener("keydown",u),a.delete(s))})}function c(){l=null}return{cleanup:o,refresh:c}}function Xe({checkboxGroupId:e,checkboxesClass:t,callback:h}){if(e==="")return console.error("[aria-ease] 'checkboxGroupId' should not be an empty string. Provide an id to the checkbox group container element that exists before calling makeCheckboxAccessible."),{cleanup:()=>{}};let l=document.querySelector(`#${e}`);if(!l)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the checkbox group container exists before calling makeCheckboxAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'checkboxesClass' should not be an empty string. Provide a class name that exists on the checkbox elements before calling makeCheckboxAccessible."),{cleanup:()=>{}};let p=Array.from(l.querySelectorAll(`.${t}`));if(p.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure checkboxes exist before calling makeCheckboxAccessible.`),{cleanup:()=>{}};let n=new WeakMap,a=new WeakMap;function o(){l.getAttribute("role")||l.setAttribute("role","group"),p.forEach(r=>{r.setAttribute("role","checkbox");let m=r.checked;r.setAttribute("aria-checked",m?"true":"false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function c(r,m){if(h?.onCheckedChange)try{h.onCheckedChange(r,m)}catch(i){console.error("[aria-ease] Error in checkbox onCheckedChange callback:",i)}}function s(r){if(r<0||r>=p.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let m=p[r],i=!m.checked;m.checked=i,m.setAttribute("aria-checked",i?"true":"false"),c(r,i)}function u(r,m){if(r<0||r>=p.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let i=p[r];i.checked=m,i.setAttribute("aria-checked",m?"true":"false"),c(r,m)}function b(r){return()=>{let m=p[r];if("checked"in m&&typeof m.checked=="boolean")setTimeout(()=>{let i=m.checked;m.setAttribute("aria-checked",i?"true":"false"),c(r,i)},0);else{let i=m.getAttribute("aria-checked")==="true";m.setAttribute("aria-checked",i?"false":"true"),c(r,!i)}}}function y(r){return m=>{let{key:i}=m;switch(i){case" ":case"Spacebar":m.preventDefault(),s(r);break}}}function L(){p.forEach((r,m)=>{let i=b(m),E=y(m);r.addEventListener("click",i),r.addEventListener("keydown",E),n.set(r,E),a.set(r,i)})}function C(){p.forEach(r=>{let m=n.get(r),i=a.get(r);m&&(r.removeEventListener("keydown",m),n.delete(r)),i&&(r.removeEventListener("click",i),a.delete(r))})}function S(){C()}function I(){return p.map(r=>r.getAttribute("aria-checked")==="true")}function k(){return p.map((r,m)=>r.getAttribute("aria-checked")==="true"?m:-1).filter(r=>r!==-1)}return o(),L(),{toggleCheckbox:s,setCheckboxState:u,getCheckedStates:I,getCheckedIndices:k,cleanup:S}}function oe({menuId:e,menuItemsClass:t,triggerId:h,callback:l}){if(e==="")return console.error("[aria-ease] 'menuId' should not be an empty string. Provide an id of the menu element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let p=document.querySelector(`#${e}`);if(!p)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'triggerId' should not be an empty string. Provide an id of the trigger button element before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};let n=document.querySelector(`#${h}`);if(!n)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the trigger button element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'menuItemsClass' should not be an empty string. Provide a class name to at least a menu item that exists before calling makeMenuAccessible."),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(!/^[\w-]+$/.test(e))return console.error("[aria-ease] Invalid menuId: must be alphanumeric"),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",e),n.setAttribute("aria-expanded","false"),p.setAttribute("role","menu"),p.setAttribute("aria-labelledby",h);let a=new WeakMap,o=new Map,c=null,s=null;function u(){return c||(c=p.querySelectorAll(`.${t}`)),c}function b(){if(!s){let g=u();s=[];for(let v=0;v<g.length;v++){let w=g.item(v),$=m(w),R=w.getAttribute("aria-disabled")==="true";$||(w.hasAttribute("tabindex")||w.setAttribute("tabindex","-1"),R||s.push(w))}}return s}function y(g){return{length:g.length,item:w=>g[w],forEach:w=>{g.forEach(w)},[Symbol.iterator]:function*(){for(let w of g)yield w}}}function L(){u().forEach(v=>{v.setAttribute("role","menuitem");let w=v.getAttribute("data-submenu-id")??v.getAttribute("aria-controls"),$=v.hasAttribute("aria-haspopup")&&w;w&&(v.hasAttribute("data-submenu-id")||$)&&(v.setAttribute("aria-haspopup","menu"),v.setAttribute("aria-controls",w),v.hasAttribute("aria-expanded")||v.setAttribute("aria-expanded","false"))})}function C(g,v,w){let $=g.length,R=(v+w+$)%$;g.item(R).focus()}function S(g,v){g.length!==0&&g[v]?.focus()}function I(g){return g.hasAttribute("aria-controls")&&g.hasAttribute("aria-haspopup")&&g.getAttribute("role")==="menuitem"}function k(g){let v=g;for(;v&&v.getAttribute("role")==="menuitem";){let w=v.closest('[role="menu"]');if(!w)break;w.style.display="none",v.setAttribute("aria-expanded","false");let $=w.getAttribute("aria-labelledby");if(!$)break;let R=document.getElementById($);if(!R)break;v=R}}L();function r(g,v,w){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&n.getAttribute("role")==="menuitem"){g.preventDefault(),d();return}break}case"ArrowUp":{g.preventDefault(),C(y(b()),w,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&I(v)){g.preventDefault();let $=v.getAttribute("aria-controls");if($){E($);return}}break}case"ArrowDown":{g.preventDefault(),C(y(b()),w,1);break}case"Home":{g.preventDefault(),S(b(),0);break}case"End":{g.preventDefault();let $=b();S($,$.length-1);break}case"Escape":{g.preventDefault(),d(),n.focus(),H&&H(!1);break}case"Enter":case" ":{if(g.preventDefault(),I(v)){let $=v.getAttribute("aria-controls");if($){E($);return}}v.click(),d(),H&&H(!1);break}case"Tab":{d(),k(n),H&&H(!1);break}default:break}}function m(g){let v=g.parentElement;for(;v&&v!==p;){if(v.getAttribute("role")==="menu"||v.id&&p.querySelector(`[aria-controls="${v.id}"]`))return!0;v=v.parentElement}return!1}function i(g){n.setAttribute("aria-expanded",g?"true":"false")}function E(g){let v=o.get(g);if(!v){let w=p.querySelector(`[aria-controls="${g}"]`);if(!w){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!w.id){let R=`trigger-${g}`;w.id=R,console.warn(`[aria-ease] Submenu trigger for "${g}" had no ID. Auto-generated ID: "${R}".`)}if(!document.querySelector(`#${g}`)){console.error(`[aria-ease] Submenu element with id="${g}" not found. Cannot create submenu instance.`);return}v=oe({menuId:g,menuItemsClass:t,triggerId:w.id,callback:l}),o.set(g,v)}v.openMenu()}function H(g){if(l?.onExpandedChange)try{l.onExpandedChange(g)}catch(v){console.error("[aria-ease] Error in menu onExpandedChange callback:",v)}}function f(){b().forEach((v,w)=>{if(!a.has(v)){let $=R=>r(R,v,w);v.addEventListener("keydown",$),a.set(v,$)}})}function T(){b().forEach(v=>{let w=a.get(v);w&&(v.removeEventListener("keydown",w),a.delete(v))})}function x(){i(!0),p.style.display="block";let g=b();if(f(),g&&g.length>0&&g[0].focus(),l?.onExpandedChange)try{l.onExpandedChange(!0)}catch(v){console.error("[aria-ease] Error in menu onExpandedChange callback:",v)}}function d(){if(o.forEach(g=>g.closeMenu()),i(!1),p.style.display="none",T(),n.focus(),l?.onExpandedChange)try{l.onExpandedChange(!1)}catch(g){console.error("[aria-ease] Error in menu onExpandedChange callback:",g)}}function A(){n.getAttribute("aria-expanded")==="true"?d():x()}function M(g){if(!(n.getAttribute("aria-expanded")==="true"))return;let w=n.contains(g.target),$=p.contains(g.target);!w&&!$&&d()}n.addEventListener("click",A),document.addEventListener("click",M);function D(){T(),n.removeEventListener("click",A),document.removeEventListener("click",M),p.style.display="none",i(!1),o.forEach(g=>g.cleanup()),o.clear()}function P(){c=null,s=null}return{openMenu:x,closeMenu:d,cleanup:D,refresh:P}}function Ze({radioGroupId:e,radiosClass:t,defaultSelectedIndex:h,callback:l}){if(e==="")return console.error("[aria-ease] 'radioGroupId' should not be an empty string. Provide an id to the radio group container element that exists before calling makeRadioAccessible."),{cleanup:()=>{}};let p=document.querySelector(`#${e}`);if(!p)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the radio group container exists before calling makeRadioAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'radiosClass' should not be an empty string. Provide a class name that exists on the radio button elements before calling makeRadioAccessible."),{cleanup:()=>{}};let n=Array.from(p.querySelectorAll(`.${t}`));if(n.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure radio buttons exist before calling makeRadioAccessible.`),{cleanup:()=>{}};let a=new WeakMap,o=new WeakMap,c;h&&(c=h);function s(){p.getAttribute("role")||p.setAttribute("role","radiogroup"),n.forEach((k,r)=>{k.setAttribute("role","radio"),k.setAttribute("tabindex","0");let m=r===c;k.setAttribute("aria-checked",m?"true":"false"),k.checked!==void 0&&(k.checked=m)})}function u(k){if(k<0||k>=n.length){console.error(`[aria-ease] Invalid radio index: ${k}`);return}if(c>=0&&c<n.length&&(n[c].setAttribute("aria-checked","false"),n[c].checked!==void 0&&(n[c].checked=!1)),n[k].setAttribute("aria-checked","true"),n[k].checked!==void 0&&(n[k].checked=!0),n[k].focus(),l?.onValueChange)try{l.onValueChange(k,n[k].getAttribute("value"))}catch(r){console.error("[aria-ease] Error in radio onValueChange callback:",r)}c=k}function b(k){return()=>{let r=n[k];"checked"in r&&typeof r.checked=="boolean"?setTimeout(()=>{u(k)},0):u(k)}}function y(k){return r=>{let{key:m}=r,i=k;switch(m){case"ArrowDown":case"ArrowRight":r.preventDefault(),i=(k+1)%n.length,u(i);break;case"ArrowUp":case"ArrowLeft":r.preventDefault(),i=(k-1+n.length)%n.length,u(i);break;case" ":case"Enter":r.preventDefault(),u(k);break}}}function L(){n.forEach((k,r)=>{let m=b(r),i=y(r);k.addEventListener("click",m),k.addEventListener("keydown",i),a.set(k,i),o.set(k,m)})}function C(){n.forEach(k=>{let r=a.get(k),m=o.get(k);r&&(k.removeEventListener("keydown",r),a.delete(k)),m&&(k.removeEventListener("click",m),o.delete(k))})}function S(){C()}function I(){return c}return s(),L(),{selectRadio:u,getSelectedIndex:I,cleanup:S}}function tt({toggleId:e,togglesClass:t,isSingleToggle:h=!0,callback:l}){if(e==="")return console.error("[aria-ease] 'toggleId' should not be an empty string. Provide an id to the toggle element or toggle container before calling makeToggleAccessible."),{cleanup:()=>{}};let p=document.querySelector(`#${e}`);if(!p)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(h)n=[p];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(p.querySelectorAll(`.${t}`)),n.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure toggle buttons exist before calling makeToggleAccessible.`),{cleanup:()=>{}}}let a=new WeakMap,o=new WeakMap;function c(){n.forEach(r=>{r.tagName.toLowerCase()!=="button"&&!r.getAttribute("role")&&r.setAttribute("role","button"),r.hasAttribute("aria-pressed")||r.setAttribute("aria-pressed","false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function s(r){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}let i=n[r].getAttribute("aria-pressed")==="true";u(r,!i)}function u(r,m){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}if(n[r].setAttribute("aria-pressed",m?"true":"false"),l?.onPressedChange)try{l.onPressedChange(r,m)}catch(i){console.error("[aria-ease] Error in checkbox onPressedChange callback:",i)}}function b(r){return()=>{s(r)}}function y(r){return m=>{let{key:i}=m;switch(i){case"Enter":case" ":m.preventDefault(),s(r);break}}}function L(){n.forEach((r,m)=>{let i=b(m),E=y(m);r.addEventListener("click",i),r.addEventListener("keydown",E),a.set(r,E),o.set(r,i)})}function C(){n.forEach(r=>{let m=a.get(r),i=o.get(r);m&&(r.removeEventListener("keydown",m),a.delete(r)),i&&(r.removeEventListener("click",i),o.delete(r))})}function S(){C()}function I(){return n.map(r=>r.getAttribute("aria-pressed")==="true")}function k(){return n.map((r,m)=>r.getAttribute("aria-pressed")==="true"?m:-1).filter(r=>r!==-1)}return c(),L(),{toggleButton:s,setPressed:u,getPressedStates:I,getPressedIndices:k,cleanup:S}}function nt({comboboxInputId:e,comboboxButtonId:t,listBoxId:h,listBoxItemsClass:l,callback:p}){if(e==="")return console.error("[aria-ease] 'comboboxInputId' should not be an empty string. Provide an id to the combobox input element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let n=document.getElementById(`${e}`);if(!n)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the combobox input element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'listBoxId' should not be an empty string. Provide an id to the combobox listbox element that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};let a=document.getElementById(`${h}`);if(!a)return console.error(`[aria-ease] Element with id="${h}" not found. Make sure the combobox listbox element exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};if(l==="")return console.error("[aria-ease] 'listboxItemsClass' class should not be an empty string. Provide a class name to at least a listbox option that exists before calling makeComboboxAccessible."),{cleanup:()=>{}};if(!document.querySelectorAll(l))return console.error(`[aria-ease] Listbox option(s) with class="${l}" not found. Make sure at least a combobox listbox option exists before calling makeComboboxAccessible.`),{cleanup:()=>{}};let c=t?document.getElementById(`${t}`):null,s=-1;n.setAttribute("role","combobox"),n.setAttribute("aria-autocomplete","list"),n.setAttribute("aria-controls",h),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let u=null;function b(){return u||(u=a.querySelectorAll(`.${l}`)),Array.from(u).filter(d=>!d.hidden&&d.style.display!=="none")}function y(){return n.getAttribute("aria-expanded")==="true"}function L(d){let A=b();if(d>=0&&d<A.length){let M=A[d],D=M.id||`${h}-option-${d}`;if(M.id||(M.id=D),n.setAttribute("aria-activedescendant",D),typeof M.scrollIntoView=="function"&&M.scrollIntoView({block:"nearest",behavior:"smooth"}),p?.onActiveDescendantChange)try{p.onActiveDescendantChange(D,M)}catch(P){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",P)}}else n.setAttribute("aria-activedescendant","");s=d}function C(){if(n.setAttribute("aria-expanded","true"),a.style.display="block",p?.onExpandedChange)try{p.onExpandedChange(!0)}catch(d){console.error("[aria-ease] Error in combobox onExpandedChange callback:",d)}}function S(){if(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-activedescendant",""),a.style.display="none",s=-1,p?.onExpandedChange)try{p.onExpandedChange(!1)}catch(d){console.error("[aria-ease] Error in combobox onExpandedChange callback:",d)}}function I(d){let A=d.textContent?.trim()||"";if(n.value=A,d.setAttribute("aria-selected","true"),S(),p?.onSelect)try{p.onSelect(d)}catch(M){console.error("[aria-ease] Error in combobox onSelect callback:",M)}}function k(d){let A=b(),M=y();switch(d.key){case"ArrowDown":if(d.preventDefault(),!M){C();return}if(A.length===0)return;{let D=s>=A.length-1?0:s+1;L(D)}break;case"ArrowUp":if(d.preventDefault(),!M)return;if(A.length>0){let D=s<=0?A.length-1:s-1;L(D)}break;case"Enter":M&&s>=0&&s<A.length&&(d.preventDefault(),I(A[s]));break;case"Escape":if(M)d.preventDefault(),S();else if(n.value&&(d.preventDefault(),n.value="",n.setAttribute("aria-activedescendant",""),b().forEach(P=>{P.getAttribute("aria-selected")==="true"&&P.setAttribute("aria-selected","false")}),p?.onClear))try{p.onClear()}catch(P){console.error("[aria-ease] Error in combobox onClear callback:",P)}break;case"Home":M&&A.length>0&&(d.preventDefault(),L(0));break;case"End":M&&A.length>0&&(d.preventDefault(),L(A.length-1));break;case"Tab":M&&s>=0&&s<A.length&&I(A[s]),M&&S();break}}function r(d){let A=d.target;if(A.classList.contains(l)){let D=b().indexOf(A);D>=0&&L(D)}}function m(d){let A=d.target;A.classList.contains(l)&&(d.preventDefault(),I(A))}function i(d){let A=d.target;!n.contains(A)&&!a.contains(A)&&(!c||!c.contains(A))&&S()}function E(){y()?S():(C(),n.focus())}function H(d){(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),E())}n.addEventListener("keydown",k),a.addEventListener("mousemove",r),a.addEventListener("mousedown",m),document.addEventListener("mousedown",i),c&&(c.setAttribute("tabindex","-1"),c.setAttribute("aria-label","Toggle options"),c.addEventListener("click",E),c.addEventListener("keydown",H));function f(){let d=a.querySelectorAll(`.${l}`);if(d.length===0)return;let A=null;for(let M of d)if(M.getAttribute("aria-selected")==="true"){A=M.textContent?.trim()||null;break}!A&&n.value&&(A=n.value.trim()),d.forEach((M,D)=>{M.setAttribute("role","option");let P=M.textContent?.trim()||"";A&&P===A?M.setAttribute("aria-selected","true"):M.setAttribute("aria-selected","false");let g=M.getAttribute("id");if(!g||g===""){let v=`${h}-option-${D}`;M.id=v,M.setAttribute("id",v)}})}f();function T(){n.removeEventListener("keydown",k),a.removeEventListener("mousemove",r),a.removeEventListener("mousedown",m),document.removeEventListener("mousedown",i),c&&(c.removeEventListener("click",E),c.removeEventListener("keydown",H))}function x(){u=null,f(),s=-1,L(-1)}return{cleanup:T,refresh:x,openListbox:C,closeListbox:S}}function it({tabListId:e,tabsClass:t,tabPanelsClass:h,orientation:l="horizontal",activateOnFocus:p=!0,callback:n}){if(e==="")return console.error("[aria-ease] 'tabListId' should not be an empty string. Provide an id to the tab list container element that exists before calling makeTabsAccessible."),{cleanup:()=>{}};let a=document.querySelector(`#${e}`);if(!a)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the tab list container exists before calling makeTabsAccessible.`),{cleanup:()=>{}};if(t==="")return console.error("[aria-ease] 'tabsClass' should not be an empty string. Provide a class name that exists on the tab button elements before calling makeTabsAccessible."),{cleanup:()=>{}};let o=Array.from(a.querySelectorAll(`.${t}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${t}" found. Make sure tab buttons exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(h==="")return console.error("[aria-ease] 'tabPanelsClass' should not be an empty string. Provide a class name that exists on the tab panel elements before calling makeTabsAccessible."),{cleanup:()=>{}};let c=Array.from(document.querySelectorAll(`.${h}`));if(c.length===0)return console.error(`[aria-ease] No elements with class="${h}" found. Make sure tab panels exist before calling makeTabsAccessible.`),{cleanup:()=>{}};if(o.length!==c.length)return console.error(`[aria-ease] Tab/panel mismatch: found ${o.length} tabs but ${c.length} panels.`),{cleanup:()=>{}};let s=new WeakMap,u=new WeakMap,b=new WeakMap,y=0;function L(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",l),o.forEach((f,T)=>{let x=c[T];f.id||(f.id=`${e}-tab-${T}`),x.id||(x.id=`${e}-panel-${T}`),f.setAttribute("role","tab"),f.setAttribute("aria-controls",x.id),f.setAttribute("aria-selected","false"),f.setAttribute("tabindex","-1"),x.setAttribute("role","tabpanel"),x.setAttribute("aria-labelledby",f.id),x.hidden=!0,x.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||x.setAttribute("tabindex","0")}),C(0,!1)}function C(f,T=!0){if(f<0||f>=o.length){console.error(`[aria-ease] Invalid tab index: ${f}`);return}o.forEach((A,M)=>{let D=c[M];A.setAttribute("aria-selected","false"),A.setAttribute("tabindex","-1"),D.hidden=!0});let x=o[f],d=c[f];if(x.setAttribute("aria-selected","true"),x.setAttribute("tabindex","0"),d.hidden=!1,T&&x.focus(),y=f,n?.onSelectedChange)try{n.onSelectedChange(f,!0)}catch(A){console.error("[aria-ease] Error in tabs onSelectedChange callback:",A)}}function S(f){let T=o.findIndex(A=>A===document.activeElement),x=T!==-1?T:y,d=x;switch(f){case"first":d=0;break;case"last":d=o.length-1;break;case"next":d=(x+1)%o.length;break;case"prev":d=(x-1+o.length)%o.length;break}if(o[d].focus(),o[d].setAttribute("tabindex","0"),o[y].setAttribute("tabindex","-1"),p)C(d,!1);else{let A=y;o.forEach((M,D)=>{D===d?M.setAttribute("tabindex","0"):D!==A&&M.setAttribute("tabindex","-1")})}}function I(f){return()=>{C(f)}}function k(f){return T=>{let{key:x}=T,d=!1;if(l==="horizontal")switch(x){case"ArrowLeft":T.preventDefault(),S("prev"),d=!0;break;case"ArrowRight":T.preventDefault(),S("next"),d=!0;break}else switch(x){case"ArrowUp":T.preventDefault(),S("prev"),d=!0;break;case"ArrowDown":T.preventDefault(),S("next"),d=!0;break}if(!d)switch(x){case"Home":T.preventDefault(),S("first");break;case"End":T.preventDefault(),S("last");break;case" ":case"Enter":p||(T.preventDefault(),C(f));break;case"F10":if(T.shiftKey&&n?.onContextMenu){T.preventDefault();try{n.onContextMenu(f,o[f])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function r(f){return T=>{if(n?.onContextMenu){T.preventDefault();try{n.onContextMenu(f,o[f])}catch(x){console.error("[aria-ease] Error in tabs onContextMenu callback:",x)}}}}function m(){o.forEach((f,T)=>{let x=I(T),d=k(T),A=r(T);f.addEventListener("click",x),f.addEventListener("keydown",d),n?.onContextMenu&&(f.addEventListener("contextmenu",A),b.set(f,A)),s.set(f,d),u.set(f,x)})}function i(){o.forEach(f=>{let T=s.get(f),x=u.get(f),d=b.get(f);T&&(f.removeEventListener("keydown",T),s.delete(f)),x&&(f.removeEventListener("click",x),u.delete(f)),d&&(f.removeEventListener("contextmenu",d),b.delete(f))})}function E(){i(),o.forEach((f,T)=>{let x=c[T];f.removeAttribute("role"),f.removeAttribute("aria-selected"),f.removeAttribute("aria-controls"),f.removeAttribute("tabindex"),x.removeAttribute("role"),x.removeAttribute("aria-labelledby"),x.removeAttribute("tabindex"),x.hidden=!1}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function H(){i();let f=Array.from(a.querySelectorAll(`.${t}`)),T=Array.from(document.querySelectorAll(`.${h}`));o.length=0,o.push(...f),c.length=0,c.push(...T),L(),m()}return L(),m(),{activateTab:C,cleanup:E,refresh:H}}function q(e,t){return t==="first"?`first ${e}`:t==="last"?`last ${e}`:t==="next"?`next ${e}`:t==="previous"?`previous ${e}`:typeof t=="number"?`${e} at index ${t}`:`${t} ${e}`}var G={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:ce},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...le(),...j()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:fe},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ge},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:be},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:me},"option.active":{requires:["comboboxpopup.open"],setup:[{when:["keyboard","pointer"],steps:(e={})=>typeof e.relativeTarget=="number"?Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"main",key:"ArrowDown"})):e.relativeTarget==="first"?[{type:"keypress",target:"main",key:"ArrowDown"}]:e.relativeTarget==="last"?[{type:"keypress",target:"main",key:"ArrowDown"},{type:"keypress",target:"main",key:"ArrowUp"}]:[]}],assertion:(e={})=>ue(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:pe},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:j},"option.selected":{requires:["comboboxpopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",key:"Enter",relativeTarget:e.relativeTarget}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>de(e.relativeTarget)}};function ce(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected combobox main to have aria-expanded='true'."}]}function le(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected combobox main to have aria-expanded='false'."}]}function ue(e){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:{ref:"relative",relativeTarget:e,property:"id"},failureMessage:"Expected aria-activedescendant on main to match the id of the first relative item."}]}function pe(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function j(){return[{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function de(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${q("option",e)} to have aria-selected='true'.`}]}function fe(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function ge(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function be(){return[{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function me(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var X={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:he},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ve},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ye},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ke},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ae(e.relativeTarget)},"submenupopup.open":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}]},{when:["pointer"],steps:()=>[{type:"click",target:"submenuTrigger"}]}],assertion:Ee},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Te},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:xe},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Me},"submenuitem.focused":{requires:["submenupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>{let t=[{type:"focus",target:"submenuTrigger"},{type:"keypress",target:"submenuTrigger",key:"ArrowRight"}];return typeof e.relativeTarget=="number"&&(t=t.concat(Array.from({length:e.relativeTarget},()=>({type:"keypress",target:"submenuItems",key:"ArrowDown"})))),e.relativeTarget==="first"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowDown"})),e.relativeTarget==="last"&&(t=t.concat({type:"keypress",target:"submenuItems",key:"ArrowUp"})),t}},{when:["pointer"],steps:(e={})=>[{type:"click",target:"submenuTrigger"},{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>we(e.relativeTarget)}};function he(){return[{target:"popup",assertion:"toBeVisible",failureMessage:"Expected popup to be visible"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected menu main to have aria-expanded='true'."}]}function ve(){return[{target:"popup",assertion:"notToBeVisible",failureMessage:"Expected popup to be closed"},{target:"main",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected menu main to have aria-expanded='false'."}]}function ye(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function ke(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function Ae(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function Ee(){return[{target:"submenu",assertion:"toBeVisible",failureMessage:"Expected submenu to be visible"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected submenu trigger to have aria-expanded='true'."}]}function Te(){return[{target:"submenu",assertion:"notToBeVisible",failureMessage:"Expected submenu to be closed"},{target:"submenuTrigger",assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected submenu trigger to have aria-expanded='false'."}]}function xe(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function Me(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function we(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var Q={"tab.active":{setup:[{when:["keyboard"],steps:(e={})=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"ArrowLeft"}]},{when:["pointer"],steps:(e={})=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ce(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Le(e.relativeTarget)}};function Le(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${q("tab",e)} to have focus.`}]}function He(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${q("tab",e)} to have tabindex='0'.`}]}function Ce(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${q("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${q("tab",e)} to be visible.`},He(e)]}var Y={"panel.expanded":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Se(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>$e(e.relativeTarget)}};function Se(e){return[{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"true",failureMessage:"Expected trigger to have aria-expanded='true' when panel expands."}]}function $e(e){return[{target:"panel",assertion:"notToBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${e} trigger not to be visible.`},{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-expanded",expectedValue:"false",failureMessage:"Expected trigger to have aria-expanded='false' when panel collapses."}]}var Z={"radio.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>De(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ie(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>qe(e.relativeTarget)}};function De(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function Ie(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function qe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${q("radio",e)} to have focus.`}]}var ee={"checkbox.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Re(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Pe(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>_e(e.relativeTarget)}};function Re(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function _e(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${q("checkbox",e)} to have focus.`}]}var te={"toggle.pressed":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Enter"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ve(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Oe(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Be(e.relativeTarget)}};function Ve(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function Oe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function Be(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${q("toggle",e)} to have focus.`}]}function Ne(e,t){return t.some(h=>e.capabilities.includes(h))}function B(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let h of e)if(Ne(t,h.when))return h.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var Fe={combobox:G,menu:X,tabs:Q,accordion:Y,radio:Z,checkbox:ee,toggle:te},F=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=Fe[t]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let h=this.statePack,l={capabilities:["keyboard"]},p=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let c=h[a];if(!c)return[];let s=[];if(Array.isArray(c.requires))for(let u of c.requires)s=s.concat(p(u,o));return c.setup&&(s=s.concat(B(c.setup,l))),s};return t({ariaReference:(a,o,c)=>({requires:s=>{let u=p(s,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required",setup:u}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional",setup:u}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended",setup:u})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:a,attribute:o,to:c,level:"recommended"})}),contains:(a,o)=>({requires:c=>{let s=p(c,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required",setup:s}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional",setup:s}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended",setup:s})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:a,child:o,level:"recommended"})})}),this}static(t){return t({target:l=>{let p=o=>{let c=this.statePack,s={capabilities:["keyboard"]},u=(b,y=new Set)=>{if(y.has(b))return[];y.add(b);let L=c[b];if(!L)return[];let C=[];if(Array.isArray(L.requires))for(let S of L.requires)C=C.concat(u(S,y));return L.setup&&(C=C.concat(B(L.setup,s))),C};return u(o,new Set)},n=o=>o==="role"?"toHaveRole":"toHaveAttribute",a=(o,c,s)=>{let u=n(o);return{required:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"required",setup:s}),optional:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"optional",setup:s}),recommended:()=>this.staticAssertions.push({target:l,assertion:u,attribute:o,expectedValue:c,failureMessage:"",level:"recommended",setup:s})}};return{has:(o,c)=>({...a(o,c),requires:u=>{let b=p(u);return a(o,c,b)}})}}}),this}when(t){return new U(this,this.statePack,t)}addDynamicTest(t){this.dynamicTests.push(t)}build(){return{meta:this.metaValue,selectors:this.selectorsValue,relationships:this.relationshipInvariants.length?this.relationshipInvariants:void 0,static:this.staticAssertions.length?this.staticAssertions:[],dynamic:this.dynamicTests}}},U=class{constructor(t,h,l){this.parent=t;this.statePack=h;this.event=l}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,h){return this._onTarget=t,this._onRelativeTarget=h,this}given(t){return this._given=this._normalizeStates(t),this}then(t){return this._then=this._normalizeStates(t),this}orientation(t){return this._orientation=t,this}_normalizeStates(t){return(Array.isArray(t)?t:[t]).flatMap(l=>typeof l=="string"?[l]:typeof l=="object"&&l!==null&&"type"in l&&"ref"in l?this._findStateKeyByTypeAndRef(l.type)?[{type:l.type,ref:l.ref}]:[]:[l])}_findStateKeyByTypeAndRef(t){if(Object.keys(this.statePack).includes(t))return t}describe(t){return this._desc=t,this}required(){return this._level="required",this._finalize(),this.parent}optional(){return this._level="optional",this._finalize(),this.parent}recommended(){return this._level="recommended",this._finalize(),this.parent}_finalize(){let l={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},p=(s,u=new Set)=>{if(u.has(s))return[];u.add(s);let b=this.statePack[s];if(!b)return[];let y=[];if(Array.isArray(b.requires))for(let L of b.requires)y=y.concat(p(L,u));return b.setup&&(y=y.concat(B(b.setup,l))),y},n=[];for(let s of this._given)if(typeof s=="string")n.push(...p(s));else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let u=this._findStateKeyByTypeAndRef(s.type);if(u){let b=this.statePack[u];if(b&&b.setup)for(let y of b.setup)typeof y.steps=="function"?n.push(...y.steps({relativeTarget:s.ref})):Array.isArray(y.steps)&&n.push(...y.steps)}}let a=new Set;n=n.filter(s=>{let u=JSON.stringify(s);return a.has(u)?!1:(a.add(u),!0)});let o=[];for(let s of this._then)if(typeof s=="string"){let u=this.statePack[s];if(u&&u.assertion!==void 0){let b=u.assertion;if(typeof b=="function")try{b=b()}catch(y){throw new Error(`Error calling assertion function for state '${s}': ${y.message}`)}Array.isArray(b)?o.push(...b):o.push(b)}}else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let u=this._findStateKeyByTypeAndRef(s.type);if(u){let b=this.statePack[u];if(b&&b.assertion!==void 0){let y=b.assertion;if(typeof y=="function")try{y=y({relativeTarget:s.ref})}catch(L){throw new Error(`Error calling assertion function for state '${u}': ${L.message}`)}Array.isArray(y)?o.push(...y):o.push(y)}}}let c=[{type:this._as,target:this._onTarget,key:this._as==="keypress"?this.event:void 0,relativeTarget:this._onRelativeTarget}];this.parent.addDynamicTest({description:this._desc||"",level:this._level,orientation:this._orientation||"horizontal",action:c,assertions:o,...n.length?{setup:n}:{}})}};function St(e,t){let h=new K(e);return t(h),new F(h.build())}import Ke from"path";async function re(e,t,h={}){if(!e||typeof e!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!t)throw new Error("\u274C testUiComponent requires a URL");if(t&&typeof t!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let l={violations:[]};async function p(u){try{let b=await fetch(u,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(b.ok||b.status===304)return u}catch{return null}return null}let n=N(h.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:u}=await import("./configLoader-ZEJVXLX7.js"),b=await u(process.cwd());if(a=b.config,b.configPath&&(o=Ke.dirname(b.configPath)),h.strictness===void 0){let y=a.test?.components?.find(L=>L?.name===e)?.strictness;n=N(y??a.test?.strictness)}}catch{h.strictness===void 0&&(n="balanced")}let c;try{if(t){let u=await p(t);if(u){console.log(`\u{1F3AD} Running Playwright tests on ${u}`);let{runContractTestsPlaywright:b}=await import("./contractTestRunnerPlaywright-OB2GWGOA.js");c=await b(e,u,n,a,o)}else throw new Error(`\u274C Dev server not running at ${t}
|
|
2
|
+
Please start your dev server and try again.`)}else throw new Error("\u274C URL is required for component testing. Please provide a URL to run full accessibility tests with testUiComponent.")}catch(u){throw u instanceof Error?u:new Error(`\u274C Contract test execution failed: ${String(u)}`)}let s={violations:l.violations,raw:l,contract:c};if(c.failures.length>0&&t==="Playwright")throw new Error(`
|
|
3
|
+
\u274C ${c.failures.length} accessibility contract test${c.failures.length>1?"s":""} failed (Playwright mode)
|
|
4
|
+
\u2705 ${c.passes.length} test${c.passes.length>1?"s":""} passed
|
|
5
5
|
|
|
6
6
|
\u{1F4CB} Review the detailed test report above for specific failures.
|
|
7
|
-
\u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(
|
|
7
|
+
\u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(l.violations.length>0){let u=l.violations.length,b=l.violations.map(y=>`
|
|
8
8
|
- ${y.id}: ${y.description}
|
|
9
9
|
Impact: ${y.impact}
|
|
10
10
|
Affected elements: ${y.nodes.length}
|
|
11
11
|
Help: ${y.helpUrl}`).join(`
|
|
12
12
|
`);throw new Error(`
|
|
13
|
-
\u274C ${
|
|
14
|
-
${
|
|
13
|
+
\u274C ${u} axe accessibility violation${u>1?"s":""} detected
|
|
14
|
+
${b}
|
|
15
15
|
|
|
16
|
-
\u{1F4CB} Full details available in result.violations`)}return
|
|
17
|
-
`);let{exec:e}=await import("child_process"),t=(await import("chalk")).default;return new Promise((h,
|
|
16
|
+
\u{1F4CB} Full details available in result.violations`)}return s}var ne=async()=>({passes:[],failures:[],skipped:[]});typeof window>"u"&&(ne=async()=>{console.log(`\u{1F680} Running component accessibility tests...
|
|
17
|
+
`);let{exec:e}=await import("child_process"),t=(await import("chalk")).default;return new Promise((h,l)=>{e("npx vitest --run --reporter verbose",async(p,n,a)=>{if(console.log(n),a&&console.error(a),!p||p.code===0){try{let{displayBadgeInfo:c,promptAddBadge:s}=await import("./badgeHelper-IB5RTMAG.js");c("component"),await s("component",process.cwd()),console.log(t.dim(`
|
|
18
18
|
`+"\u2500".repeat(60))),console.log(t.cyan("\u{1F499} Found aria-ease helpful?")),console.log(t.white(" \u2022 Star us on GitHub: ")+t.blue.underline("https://github.com/aria-ease/aria-ease")),console.log(t.white(" \u2022 Share feedback: ")+t.blue.underline("https://github.com/aria-ease/aria-ease/discussions")),console.log(t.dim("\u2500".repeat(60)+`
|
|
19
|
-
`))}catch(
|
|
19
|
+
`))}catch(c){console.error("Warning: Could not display badge prompt:",c)}h({passes:[],failures:[],skipped:[]}),process.exit(0)}else{let c=p?.code||1;l(new Error(`Tests failed with code ${c}`)),process.exit(c)}})})});async function ae(){await z()}export{ae as cleanupTests,St as createContract,Ue as makeAccordionAccessible,je as makeBlockAccessible,Xe as makeCheckboxAccessible,nt as makeComboboxAccessible,oe as makeMenuAccessible,Ze as makeRadioAccessible,it as makeTabsAccessible,tt as makeToggleAccessible,re as testUiComponent};
|
|
@@ -44,8 +44,7 @@ interface AccordionConfig {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
interface AccordionCallback {
|
|
47
|
-
|
|
48
|
-
onCollapse?: (index: number) => void;
|
|
47
|
+
onExpandedChange?: (index: number, expanded: boolean) => void;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
interface TabsConfig {
|
|
@@ -58,7 +57,7 @@ interface TabsConfig {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
interface TabsCallback {
|
|
61
|
-
|
|
60
|
+
onSelectedChange?: (index: number, selected: boolean) => void;
|
|
62
61
|
onContextMenu?: (tabIndex: number, tabElement: HTMLElement) => void;
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -72,7 +71,7 @@ interface ComboboxConfig {
|
|
|
72
71
|
|
|
73
72
|
interface ComboboxCallback {
|
|
74
73
|
onSelect?: (item: HTMLElement) => void;
|
|
75
|
-
|
|
74
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
76
75
|
onActiveDescendantChange?: (optionId: string, item: HTMLElement) => void;
|
|
77
76
|
onClear?: () => void;
|
|
78
77
|
}
|
|
@@ -85,7 +84,7 @@ interface RadioConfig {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
interface RadioCallback {
|
|
88
|
-
|
|
87
|
+
onValueChange?: (index: number, value: string) => void;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
interface CheckboxConfig {
|
|
@@ -95,7 +94,7 @@ interface CheckboxConfig {
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
interface CheckboxCallback {
|
|
98
|
-
|
|
97
|
+
onCheckedChange?: (index: number, checked: boolean) => void;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
interface MenuConfig {
|
|
@@ -106,7 +105,18 @@ interface MenuConfig {
|
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
interface MenuCallback {
|
|
109
|
-
|
|
108
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
interface ToggleConfig {
|
|
112
|
+
toggleId: string;
|
|
113
|
+
togglesClass?: string;
|
|
114
|
+
isSingleToggle?: boolean;
|
|
115
|
+
callback: ToggleCallback;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface ToggleCallback {
|
|
119
|
+
onPressedChange: (index: number, pressed: boolean) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type { AccordionConfig as A, CheckboxConfig as C, MenuConfig as M, RadioConfig as R, TabsConfig as T, AccessibilityInstance as a, ComboboxConfig as b, ToggleConfig as c };
|
|
@@ -44,8 +44,7 @@ interface AccordionConfig {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
interface AccordionCallback {
|
|
47
|
-
|
|
48
|
-
onCollapse?: (index: number) => void;
|
|
47
|
+
onExpandedChange?: (index: number, expanded: boolean) => void;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
interface TabsConfig {
|
|
@@ -58,7 +57,7 @@ interface TabsConfig {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
interface TabsCallback {
|
|
61
|
-
|
|
60
|
+
onSelectedChange?: (index: number, selected: boolean) => void;
|
|
62
61
|
onContextMenu?: (tabIndex: number, tabElement: HTMLElement) => void;
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -72,7 +71,7 @@ interface ComboboxConfig {
|
|
|
72
71
|
|
|
73
72
|
interface ComboboxCallback {
|
|
74
73
|
onSelect?: (item: HTMLElement) => void;
|
|
75
|
-
|
|
74
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
76
75
|
onActiveDescendantChange?: (optionId: string, item: HTMLElement) => void;
|
|
77
76
|
onClear?: () => void;
|
|
78
77
|
}
|
|
@@ -85,7 +84,7 @@ interface RadioConfig {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
interface RadioCallback {
|
|
88
|
-
|
|
87
|
+
onValueChange?: (index: number, value: string) => void;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
interface CheckboxConfig {
|
|
@@ -95,7 +94,7 @@ interface CheckboxConfig {
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
interface CheckboxCallback {
|
|
98
|
-
|
|
97
|
+
onCheckedChange?: (index: number, checked: boolean) => void;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
interface MenuConfig {
|
|
@@ -106,7 +105,18 @@ interface MenuConfig {
|
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
interface MenuCallback {
|
|
109
|
-
|
|
108
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
interface ToggleConfig {
|
|
112
|
+
toggleId: string;
|
|
113
|
+
togglesClass?: string;
|
|
114
|
+
isSingleToggle?: boolean;
|
|
115
|
+
callback: ToggleCallback;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface ToggleCallback {
|
|
119
|
+
onPressedChange: (index: number, pressed: boolean) => void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type { AccordionConfig as A, CheckboxConfig as C, MenuConfig as M, RadioConfig as R, TabsConfig as T, AccessibilityInstance as a, ComboboxConfig as b, ToggleConfig as c };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function H({accordionId:c,triggersClass:l,panelsClass:i,allowMultipleOpen:
|
|
1
|
+
'use strict';function H({accordionId:c,triggersClass:l,panelsClass:i,allowMultipleOpen:p=false,callback:d}){if(c==="")return console.error("[aria-ease] 'accordionId' should not be an empty string. Provide an id to the accordion container element that exists before calling makeAccordionAccessible."),{cleanup:()=>{}};let s=document.querySelector(`#${c}`);if(!s)return console.error(`[aria-ease] Element with id="${c}" not found. Make sure the accordion container exists before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(l==="")return console.error("[aria-ease] 'triggersClass' should not be an empty string. Provide a class name that exists on the accordion trigger elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let r=Array.from(s.querySelectorAll(`.${l}`));if(r.length===0)return console.error(`[aria-ease] No elements with class="${l}" found. Make sure accordion triggers exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(i==="")return console.error("[aria-ease] 'panelsClass' should not be an empty string. Provide a class name that exists on the accordion panel elements before calling makeAccordionAccessible."),{cleanup:()=>{}};let a=Array.from(s.querySelectorAll(`.${i}`));if(a.length===0)return console.error(`[aria-ease] No elements with class="${i}" found. Make sure accordion panels exist before calling makeAccordionAccessible.`),{cleanup:()=>{}};if(r.length!==a.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${r.length} triggers but ${a.length} panels.`),{cleanup:()=>{}};let f=new WeakMap,m=new WeakMap;function b(){r.forEach((e,n)=>{let o=a[n];e.id||(e.id=`${c}-trigger-${n}`),o.id||(o.id=`${c}-panel-${n}`),e.setAttribute("aria-controls",o.id),e.setAttribute("aria-expanded","false"),(!p||r.length<=6)&&o.setAttribute("role","region"),o.setAttribute("aria-labelledby",e.id),o.style.display="none";});}function g(e){if(e<0||e>=r.length){console.error(`[aria-ease] Invalid accordion index: ${e}`);return}let n=r[e],o=a[e];if(n.setAttribute("aria-expanded","true"),o.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(e,!0);}catch(t){console.error("[aria-ease] Error in accordion onExpandedChange callback:",t);}}function u(e){if(e<0||e>=r.length){console.error(`[aria-ease] Invalid accordion index: ${e}`);return}let n=r[e],o=a[e];if(n.setAttribute("aria-expanded","false"),o.style.display="none",d?.onExpandedChange)try{d.onExpandedChange(e,!1);}catch(t){console.error("[aria-ease] Error in accordion onExpandedChange callback:",t);}}function h(e){r[e].getAttribute("aria-expanded")==="true"?u(e):(p||r.forEach((t,y)=>{y!==e&&u(y);}),g(e));}function k(e){return ()=>{h(e);}}function v(e){return n=>{let{key:o}=n;switch(o){case "Enter":case " ":n.preventDefault(),h(e);break;case "ArrowDown":n.preventDefault();{let t=(e+1)%r.length;r[t].focus();}break;case "ArrowUp":n.preventDefault();{let t=(e-1+r.length)%r.length;r[t].focus();}break;case "Home":n.preventDefault(),r[0].focus();break;case "End":n.preventDefault(),r[r.length-1].focus();break}}}function A(){r.forEach((e,n)=>{let o=k(n),t=v(n);e.addEventListener("click",o),e.addEventListener("keydown",t),f.set(e,t),m.set(e,o);});}function E(){r.forEach(e=>{let n=f.get(e),o=m.get(e);n&&(e.removeEventListener("keydown",n),f.delete(e)),o&&(e.removeEventListener("click",o),m.delete(e));});}function $(){E(),r.forEach((e,n)=>{u(n);});}function w(){E();let e=Array.from(s.querySelectorAll(`.${l}`)),n=Array.from(s.querySelectorAll(`.${i}`));r.length=0,r.push(...e),a.length=0,a.push(...n),b(),A();}return b(),A(),{expandItem:g,collapseItem:u,toggleItem:h,cleanup:$,refresh:w}}exports.makeAccordionAccessible=H;
|