aria-ease 7.5.0 → 7.8.1
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 +66 -81
- package/dist/ToggleComponentStrategy-TMRNXFSL.js +1 -0
- package/dist/cli.cjs +63 -63
- package/dist/cli.js +1 -1
- package/dist/contractTestRunnerPlaywright-CHCVW7VO.js +46 -0
- package/dist/contractTestRunnerPlaywright-FECB4HSX.js +46 -0
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +18 -19
- package/dist/index.d.ts +18 -19
- 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/ToggleComponentStrategy-UOGYK2U4.js +1 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-7ERFIHCM.js +46 -0
- package/dist/src/utils/test/dsl/index.cjs +1 -1
- package/dist/src/utils/test/dsl/index.d.cts +0 -5
- package/dist/src/utils/test/dsl/index.d.ts +0 -5
- 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 +4 -3
- package/dist/src/utils/test/index.d.ts +4 -3
- package/dist/src/utils/test/index.js +1 -1
- package/dist/{test-FURQN5KO.js → test-CMD6E5YF.js} +1 -1
- package/package.json +1 -1
- package/dist/contractTestRunnerPlaywright-75NI6SN7.js +0 -46
- package/dist/contractTestRunnerPlaywright-VLOD5IB3.js +0 -46
- package/dist/src/utils/test/contractTestRunnerPlaywright-FSZDW7IR.js +0 -46
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;
|
|
@@ -273,11 +277,6 @@ type DynamicAssertion = {
|
|
|
273
277
|
level?: Level;
|
|
274
278
|
};
|
|
275
279
|
type DynamicAction = {
|
|
276
|
-
type: "focus";
|
|
277
|
-
target: string;
|
|
278
|
-
relativeTarget?: "first" | "last" | "next" | "previous" | number;
|
|
279
|
-
virtualId?: string;
|
|
280
|
-
} | {
|
|
281
280
|
type: "click" | "keypress" | "type" | "hover" | "focus";
|
|
282
281
|
target: string;
|
|
283
282
|
key?: string;
|
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;
|
|
@@ -273,11 +277,6 @@ type DynamicAssertion = {
|
|
|
273
277
|
level?: Level;
|
|
274
278
|
};
|
|
275
279
|
type DynamicAction = {
|
|
276
|
-
type: "focus";
|
|
277
|
-
target: string;
|
|
278
|
-
relativeTarget?: "first" | "last" | "next" | "previous" | number;
|
|
279
|
-
virtualId?: string;
|
|
280
|
-
} | {
|
|
281
280
|
type: "click" | "keypress" | "type" | "hover" | "focus";
|
|
282
281
|
target: string;
|
|
283
282
|
key?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{b as z,d as N}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Be({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 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 r=Array.from(n.querySelectorAll(`.${t}`));if(r.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(n.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(r.length!==a.length)return console.error(`[aria-ease] Accordion trigger/panel mismatch: found ${r.length} triggers but ${a.length} panels.`),{cleanup:()=>{}};let o=new WeakMap,i=new WeakMap;function p(){r.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||r.length<=6)&&H.setAttribute("role","region"),H.setAttribute("aria-labelledby",d.id),H.style.display="none"})}function m(d){if(d<0||d>=r.length){console.error(`[aria-ease] Invalid accordion index: ${d}`);return}let w=r[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>=r.length){console.error(`[aria-ease] Invalid accordion index: ${d}`);return}let w=r[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){r[d].getAttribute("aria-expanded")==="true"?y(d):(s||r.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)%r.length;r[b].focus()}break;case"ArrowUp":w.preventDefault();{let b=(d-1+r.length)%r.length;r[b].focus()}break;case"Home":w.preventDefault(),r[0].focus();break;case"End":w.preventDefault(),r[r.length-1].focus();break}}}function q(){r.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(){r.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(),r.forEach((d,w)=>{y(w)})}function k(){c();let d=Array.from(n.querySelectorAll(`.${t}`)),w=Array.from(n.querySelectorAll(`.${h}`));r.length=0,r.push(...d),a.length=0,a.push(...w),p(),q()}return p(),q(),{expandItem:m,collapseItem:y,toggleItem:L,cleanup:u,refresh:k}}function O(e){if(e.tagName!=="INPUT")return!1;let t=e.type;return["text","email","password","tel","number"].includes(t)}function _(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 V(e,t,h){let s=e.length,l=(t+h+s)%s;e.item(l).focus()}function ae(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function J(e,t,h){let s=t.item(h);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!O(s)&&!_(s)||(O(s)||_(s))&&s.selectionStart===0)&&(e.preventDefault(),V(t,h,-1));break}case"ArrowDown":case"ArrowRight":{if(!O(s)&&!_(s))e.preventDefault(),V(t,h,1);else if(O(s)||_(s)){let l=s.value;s.selectionStart===l.length&&(e.preventDefault(),V(t,h,1))}break}case"Escape":{e.preventDefault();break}case"Enter":case" ":{(!W(s)&&!ie(s)&&ae(s)||W(s))&&(e.preventDefault(),s.click());break}case"Tab":break;default:break}}function Ue({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 n=l();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 r=new Map;n.forEach(i=>{if(!r.has(i)){let p=m=>{let y=h.querySelectorAll(`.${t}`),L=Array.prototype.indexOf.call(y,i);J(m,y,L)};i.addEventListener("keydown",p),r.set(i,p)}});function a(){n.forEach(i=>{let p=r.get(i);p&&(i.removeEventListener("keydown",p),r.delete(i))})}function o(){s=null}return{cleanup:a,refresh:o}}function We({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 n=new WeakMap,r=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,k){if(h?.onCheck)try{h.onCheck(u,k)}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 k=l[u],d=k.getAttribute("aria-checked")==="true";k.setAttribute("aria-checked",d?"false":"true"),o(u,d)}function p(u,k){if(u<0||u>=l.length){console.error(`[aria-ease] Invalid checkbox index: ${u}`);return}l[u].setAttribute("aria-checked",k?"true":"false"),o(u,k)}function m(u){return()=>{i(u)}}function y(u){return k=>{let{key:d}=k;switch(d){case" ":k.preventDefault(),i(u);break}}}function L(){l.forEach((u,k)=>{let d=m(k),w=y(k);u.addEventListener("click",d),u.addEventListener("keydown",w),n.set(u,w),r.set(u,d)})}function C(){l.forEach(u=>{let k=n.get(u),d=r.get(u);k&&(u.removeEventListener("keydown",k),n.delete(u)),d&&(u.removeEventListener("click",d),r.delete(u))})}function S(){C()}function q(){return l.map(u=>u.getAttribute("aria-checked")==="true")}function c(){return l.map((u,k)=>u.getAttribute("aria-checked")==="true"?k:-1).filter(u=>u!==-1)}return a(),L(),{toggleCheckbox:i,setCheckboxState:p,getCheckedStates:q,getCheckedIndices:c,cleanup:S}}function se({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 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"),l.setAttribute("role","menu"),l.setAttribute("aria-labelledby",h);let r=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 M=g.item(v),$=k(M),P=M.getAttribute("aria-disabled")==="true";$||(M.hasAttribute("tabindex")||M.setAttribute("tabindex","-1"),P||i.push(M))}}return i}function y(g){return{length:g.length,item:M=>g[M],forEach:M=>{g.forEach(M)},[Symbol.iterator]:function*(){for(let M of g)yield M}}}function L(){p().forEach(v=>{v.setAttribute("role","menuitem");let M=v.getAttribute("data-submenu-id")??v.getAttribute("aria-controls"),$=v.hasAttribute("aria-haspopup")&&M;M&&(v.hasAttribute("data-submenu-id")||$)&&(v.setAttribute("aria-haspopup","menu"),v.setAttribute("aria-controls",M),v.hasAttribute("aria-expanded")||v.setAttribute("aria-expanded","false"))})}function C(g,v,M){let $=g.length,P=(v+M+$)%$;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 M=v.closest('[role="menu"]');if(!M)break;M.style.display="none",v.setAttribute("aria-expanded","false");let $=M.getAttribute("aria-labelledby");if(!$)break;let P=document.getElementById($);if(!P)break;v=P}}L();function u(g,v,M){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&n.getAttribute("role")==="menuitem"){g.preventDefault(),f();return}break}case"ArrowUp":{g.preventDefault(),C(y(m()),M,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&q(v)){g.preventDefault();let $=v.getAttribute("aria-controls");if($){w($);return}}break}case"ArrowDown":{g.preventDefault(),C(y(m()),M,1);break}case"Home":{g.preventDefault(),S(m(),0);break}case"End":{g.preventDefault();let $=m();S($,$.length-1);break}case"Escape":{g.preventDefault(),f(),n.focus(),H&&H(!1);break}case"Enter":case" ":{if(g.preventDefault(),q(v)){let $=v.getAttribute("aria-controls");if($){w($);return}}v.click(),f(),H&&H(!1);break}case"Tab":{f(),c(n),H&&H(!1);break}default:break}}function k(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){n.setAttribute("aria-expanded",g?"true":"false")}function w(g){let v=a.get(g);if(!v){let M=l.querySelector(`[aria-controls="${g}"]`);if(!M){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!M.id){let P=`trigger-${g}`;M.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=se({menuId:g,menuItemsClass:t,triggerId:M.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,M)=>{if(!r.has(v)){let $=P=>u(P,v,M);v.addEventListener("keydown",$),r.set(v,$)}})}function E(){m().forEach(v=>{let M=r.get(v);M&&(v.removeEventListener("keydown",M),r.delete(v))})}function x(){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(),n.focus(),s?.onOpenChange)try{s.onOpenChange(!1)}catch(g){console.error("[aria-ease] Error in menu onOpenChange callback:",g)}}function A(){n.getAttribute("aria-expanded")==="true"?f():x()}function T(g){if(!(n.getAttribute("aria-expanded")==="true"))return;let M=n.contains(g.target),$=l.contains(g.target);!M&&!$&&f()}n.addEventListener("click",A),document.addEventListener("click",T);function D(){E(),n.removeEventListener("click",A),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:x,closeMenu:f,cleanup:D,refresh:I}}function Xe({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 n=Array.from(l.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 r=new WeakMap,a=new WeakMap,o;h&&(o=h);function i(){l.getAttribute("role")||l.setAttribute("role","radiogroup"),n.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>=n.length){console.error(`[aria-ease] Invalid radio index: ${c}`);return}if(o>=0&&o<n.length&&n[o].setAttribute("aria-checked","false"),n[c].setAttribute("aria-checked","true"),n[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:k}=u,d=c;switch(k){case"ArrowDown":case"ArrowRight":u.preventDefault(),d=(c+1)%n.length,p(d);break;case"ArrowUp":case"ArrowLeft":u.preventDefault(),d=(c-1+n.length)%n.length,p(d);break;case" ":case"Enter":u.preventDefault(),p(c);break}}}function L(){n.forEach((c,u)=>{let k=m(u),d=y(u);c.addEventListener("click",k),c.addEventListener("keydown",d),r.set(c,d),a.set(c,k)})}function C(){n.forEach(c=>{let u=r.get(c),k=a.get(c);u&&(c.removeEventListener("keydown",u),r.delete(c)),k&&(c.removeEventListener("click",k),a.delete(c))})}function S(){C()}function q(){return o}return i(),L(),{selectRadio:p,getSelectedIndex:q,cleanup:S}}function Qe({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 n=new WeakMap,r=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],k=u.getAttribute("aria-pressed")==="true";u.setAttribute("aria-pressed",k?"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:k}=u;switch(k){case"Enter":case" ":u.preventDefault(),o(c);break}}}function y(){l.forEach((c,u)=>{let k=p(u),d=m(u);c.addEventListener("click",k),c.addEventListener("keydown",d),n.set(c,d),r.set(c,k)})}function L(){l.forEach(c=>{let u=n.get(c),k=r.get(c);u&&(c.removeEventListener("keydown",u),n.delete(c)),k&&(c.removeEventListener("click",k),r.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 Ze({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 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 r=document.getElementById(`${h}`);if(!r)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;n.setAttribute("role","combobox"),n.setAttribute("aria-autocomplete","list"),n.setAttribute("aria-controls",h),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-haspopup","listbox"),r.setAttribute("role","listbox");let p=null;function m(){return p||(p=r.querySelectorAll(`.${s}`)),Array.from(p).filter(f=>!f.hidden&&f.style.display!=="none")}function y(){return n.getAttribute("aria-expanded")==="true"}function L(f){let A=m();if(f>=0&&f<A.length){let T=A[f],D=T.id||`${h}-option-${f}`;if(T.id||(T.id=D),n.setAttribute("aria-activedescendant",D),typeof T.scrollIntoView=="function"&&T.scrollIntoView({block:"nearest",behavior:"smooth"}),l?.onActiveDescendantChange)try{l.onActiveDescendantChange(D,T)}catch(I){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",I)}}else n.setAttribute("aria-activedescendant","");i=f}function C(){if(n.setAttribute("aria-expanded","true"),r.style.display="block",l?.onOpenChange)try{l.onOpenChange(!0)}catch(f){console.error("[aria-ease] Error in combobox onOpenChange callback:",f)}}function S(){if(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-activedescendant",""),r.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 A=f.textContent?.trim()||"";if(n.value=A,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 A=m(),T=y();switch(f.key){case"ArrowDown":if(f.preventDefault(),!T){C();return}if(A.length===0)return;{let D=i>=A.length-1?0:i+1;L(D)}break;case"ArrowUp":if(f.preventDefault(),!T)return;if(A.length>0){let D=i<=0?A.length-1:i-1;L(D)}break;case"Enter":T&&i>=0&&i<A.length&&(f.preventDefault(),q(A[i]));break;case"Escape":if(T)f.preventDefault(),S();else if(n.value&&(f.preventDefault(),n.value="",n.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&&A.length>0&&(f.preventDefault(),L(0));break;case"End":T&&A.length>0&&(f.preventDefault(),L(A.length-1));break;case"Tab":T&&i>=0&&i<A.length&&q(A[i]),T&&S();break}}function u(f){let A=f.target;if(A.classList.contains(s)){let D=m().indexOf(A);D>=0&&L(D)}}function k(f){let A=f.target;A.classList.contains(s)&&(f.preventDefault(),q(A))}function d(f){let A=f.target;!n.contains(A)&&!r.contains(A)&&(!o||!o.contains(A))&&S()}function w(){y()?S():(C(),n.focus())}function H(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),w())}n.addEventListener("keydown",c),r.addEventListener("mousemove",u),r.addEventListener("mousedown",k),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=r.querySelectorAll(`.${s}`);if(f.length===0)return;let A=null;for(let T of f)if(T.getAttribute("aria-selected")==="true"){A=T.textContent?.trim()||null;break}!A&&n.value&&(A=n.value.trim()),f.forEach((T,D)=>{T.setAttribute("role","option");let I=T.textContent?.trim()||"";A&&I===A?T.setAttribute("aria-selected","true"):T.setAttribute("aria-selected","false");let g=T.getAttribute("id");if(!g||g===""){let v=`${h}-option-${D}`;T.id=v,T.setAttribute("id",v)}})}b();function E(){n.removeEventListener("keydown",c),r.removeEventListener("mousemove",u),r.removeEventListener("mousedown",k),document.removeEventListener("mousedown",d),o&&(o.removeEventListener("click",w),o.removeEventListener("keydown",H))}function x(){p=null,b(),i=-1,L(-1)}return{cleanup:E,refresh:x,openListbox:C,closeListbox:S}}function tt({tabListId:e,tabsClass:t,tabPanelsClass:h,orientation:s="horizontal",activateOnFocus:l=!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 r=document.querySelector(`#${e}`);if(!r)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(r.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(){r.setAttribute("role","tablist"),r.setAttribute("aria-orientation",s),a.forEach((b,E)=>{let x=o[E];b.id||(b.id=`${e}-tab-${E}`),x.id||(x.id=`${e}-panel-${E}`),b.setAttribute("role","tab"),b.setAttribute("aria-controls",x.id),b.setAttribute("aria-selected","false"),b.setAttribute("tabindex","-1"),x.setAttribute("role","tabpanel"),x.setAttribute("aria-labelledby",b.id),x.hidden=!0,x.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||x.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 x=y;a.forEach((T,D)=>{let I=o[D];T.setAttribute("aria-selected","false"),T.setAttribute("tabindex","-1"),I.hidden=!0});let f=a[b],A=o[b];if(f.setAttribute("aria-selected","true"),f.setAttribute("tabindex","0"),A.hidden=!1,E&&f.focus(),y=b,n?.onTabChange&&x!==b)try{n.onTabChange(b,x)}catch(T){console.error("[aria-ease] Error in tabs onTabChange callback:",T)}}function S(b){let E=a.findIndex(A=>A===document.activeElement),x=E!==-1?E:y,f=x;switch(b){case"first":f=0;break;case"last":f=a.length-1;break;case"next":f=(x+1)%a.length;break;case"prev":f=(x-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 A=y;a.forEach((T,D)=>{D===f?T.setAttribute("tabindex","0"):D!==A&&T.setAttribute("tabindex","-1")})}}function q(b){return()=>{C(b)}}function c(b){return E=>{let{key:x}=E,f=!1;if(s==="horizontal")switch(x){case"ArrowLeft":E.preventDefault(),S("prev"),f=!0;break;case"ArrowRight":E.preventDefault(),S("next"),f=!0;break}else switch(x){case"ArrowUp":E.preventDefault(),S("prev"),f=!0;break;case"ArrowDown":E.preventDefault(),S("next"),f=!0;break}if(!f)switch(x){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&&n?.onContextMenu){E.preventDefault();try{n.onContextMenu(b,a[b])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function u(b){return E=>{if(n?.onContextMenu){E.preventDefault();try{n.onContextMenu(b,a[b])}catch(x){console.error("[aria-ease] Error in tabs onContextMenu callback:",x)}}}}function k(){a.forEach((b,E)=>{let x=q(E),f=c(E),A=u(E);b.addEventListener("click",x),b.addEventListener("keydown",f),n?.onContextMenu&&(b.addEventListener("contextmenu",A),m.set(b,A)),i.set(b,f),p.set(b,x)})}function d(){a.forEach(b=>{let E=i.get(b),x=p.get(b),f=m.get(b);E&&(b.removeEventListener("keydown",E),i.delete(b)),x&&(b.removeEventListener("click",x),p.delete(b)),f&&(b.removeEventListener("contextmenu",f),m.delete(b))})}function w(){d(),a.forEach((b,E)=>{let x=o[E];b.removeAttribute("role"),b.removeAttribute("aria-selected"),b.removeAttribute("aria-controls"),b.removeAttribute("tabindex"),x.removeAttribute("role"),x.removeAttribute("aria-labelledby"),x.removeAttribute("tabindex"),x.hidden=!1}),r.removeAttribute("role"),r.removeAttribute("aria-orientation")}function H(){d();let b=Array.from(r.querySelectorAll(`.${t}`)),E=Array.from(document.querySelectorAll(`.${h}`));a.length=0,a.push(...b),o.length=0,o.push(...E),L(),k()}return L(),k(),{activateTab:C,cleanup:w,refresh:H}}function R(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 X={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:oe},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...ce(),...j()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:de},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:fe},"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:ge},"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={})=>le(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ue},"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={})=>pe(e.relativeTarget)}};function oe(){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 ce(){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 le(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 ue(){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 pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${R("option",e)} to have aria-selected='true'.`}]}function de(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function fe(){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 ge(){return[{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var G={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:me},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:he},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:ve},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:ye},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ke(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:Ae},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:Ee},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:Te},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:we},"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={})=>xe(e.relativeTarget)}};function me(){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 he(){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 ve(){return[{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function ye(){return[{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function ke(e){return[{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function Ae(){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 Ee(){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 Te(){return[{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function we(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function xe(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={})=>He(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Me(e.relativeTarget)}};function Me(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${R("tab",e)} to have focus.`}]}function Le(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${R("tab",e)} to have tabindex='0'.`}]}function He(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${R("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${R("tab",e)} to be visible.`},Le(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={})=>Ce(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Se(e.relativeTarget)}};function Ce(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 Se(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={})=>$e(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>De(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>qe(e.relativeTarget)}};function $e(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function De(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 ${R("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={})=>Ie(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Re(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Pe(e.relativeTarget)}};function Ie(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Re(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function Pe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${R("checkbox",e)} to have focus.`}]}function Oe(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(Oe(t,h.when))return h.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var _e={combobox:X,menu:G,tabs:Q,accordion:Y,radio:Z,checkbox:ee},K=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},F=class{constructor(t){this.componentName=t;this.statePack=_e[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=(r,a=new Set)=>{if(a.has(r))return[];a.add(r);let o=h[r];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:(r,a,o)=>({requires:i=>{let p=l(i,new Set);return{required:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"required",setup:p}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"optional",setup:p}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"recommended",setup:p})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:r,attribute:a,to:o,level:"recommended"})}),contains:(r,a)=>({requires:o=>{let i=l(o,new Set);return{required:()=>this.relationshipInvariants.push({type:"contains",parent:r,child:a,level:"required",setup:i}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:r,child:a,level:"optional",setup:i}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:r,child:a,level:"recommended",setup:i})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:r,child:a,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:r,child:a,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:r,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)},n=a=>a==="role"?"toHaveRole":"toHaveAttribute",r=(a,o,i)=>{let p=n(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)=>({...r(a,o),requires:p=>{let m=l(p);return r(a,o,m)}})}}}),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,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},n=[];for(let i of this._given)if(typeof i=="string")n.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"?n.push(...y.steps({relativeTarget:i.ref})):Array.isArray(y.steps)&&n.push(...y.steps)}}let r=new Set;n=n.filter(i=>{let p=JSON.stringify(i);return r.has(p)?!1:(r.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,...n.length?{setup:n}:{}})}};function Tt(e,t){let h=new F(e);return t(h),new K(h.build())}import Ve from"path";async function te(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 n=N(h.strictness),r={},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(r=m.config,m.configPath&&(a=Ve.dirname(m.configPath)),h.strictness===void 0){let y=r.test?.components?.find(L=>L?.name===e)?.strictness;n=N(y??r.test?.strictness)}}catch{h.strictness===void 0&&(n="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-75NI6SN7.js");o=await m(e,p,n,r,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 B}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";function Xe({accordionId:e,triggersClass:t,panelsClass:m,allowMultipleOpen:l=!1,callback:d}){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(m==="")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(`.${m}`));if(o.length===0)return console.error(`[aria-ease] No elements with class="${m}" 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,T)=>{let C=o[T];i.id||(i.id=`${e}-trigger-${T}`),C.id||(C.id=`${e}-panel-${T}`),i.setAttribute("aria-controls",C.id),i.setAttribute("aria-expanded","false"),(!l||a.length<=6)&&C.setAttribute("role","region"),C.setAttribute("aria-labelledby",i.id),C.style.display="none"})}function v(i){if(i<0||i>=a.length){console.error(`[aria-ease] Invalid accordion index: ${i}`);return}let T=a[i],C=o[i];if(T.setAttribute("aria-expanded","true"),C.style.display="block",d?.onExpandedChange)try{d.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 T=a[i],C=o[i];if(T.setAttribute("aria-expanded","false"),C.style.display="none",d?.onExpandedChange)try{d.onExpandedChange(i,!1)}catch(f){console.error("[aria-ease] Error in accordion onExpandedChange callback:",f)}}function E(i){a[i].getAttribute("aria-expanded")==="true"?y(i):(l||a.forEach((f,x)=>{x!==i&&y(x)}),v(i))}function S(i){return()=>{E(i)}}function H(i){return T=>{let{key:C}=T;switch(C){case"Enter":case" ":T.preventDefault(),E(i);break;case"ArrowDown":T.preventDefault();{let f=(i+1)%a.length;a[f].focus()}break;case"ArrowUp":T.preventDefault();{let f=(i-1+a.length)%a.length;a[f].focus()}break;case"Home":T.preventDefault(),a[0].focus();break;case"End":T.preventDefault(),a[a.length-1].focus();break}}}function q(){a.forEach((i,T)=>{let C=S(T),f=H(T);i.addEventListener("click",C),i.addEventListener("keydown",f),c.set(i,f),s.set(i,C)})}function k(){a.forEach(i=>{let T=c.get(i),C=s.get(i);T&&(i.removeEventListener("keydown",T),c.delete(i)),C&&(i.removeEventListener("click",C),s.delete(i))})}function r(){k(),a.forEach((i,T)=>{y(T)})}function b(){k();let i=Array.from(n.querySelectorAll(`.${t}`)),T=Array.from(n.querySelectorAll(`.${m}`));a.length=0,a.push(...i),o.length=0,o.push(...T),u(),q()}return u(),q(),{expandItem:v,collapseItem:y,toggleItem:E,cleanup:r,refresh:b}}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,m){let l=e.length,d=(t+m+l)%l;e.item(d).focus()}function se(e){return e.getAttribute("data-custom-click")!==null&&e.getAttribute("data-custom-click")!==void 0}function j(e,t,m){let l=t.item(m);switch(e.key){case"ArrowUp":case"ArrowLeft":{(!_(l)&&!V(l)||(_(l)||V(l))&&l.selectionStart===0)&&(e.preventDefault(),O(t,m,-1));break}case"ArrowDown":case"ArrowRight":{if(!_(l)&&!V(l))e.preventDefault(),O(t,m,1);else if(_(l)||V(l)){let d=l.value;l.selectionStart===d.length&&(e.preventDefault(),O(t,m,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 et({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 m=document.querySelector(`#${e}`);if(!m)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 d(){return l||(l=m.querySelectorAll(`.${t}`)),l}let n=d();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=v=>{let y=m.querySelectorAll(`.${t}`),E=Array.prototype.indexOf.call(y,s);j(v,y,E)};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 rt({checkboxGroupId:e,checkboxesClass:t,callback:m}){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 d=Array.from(l.querySelectorAll(`.${t}`));if(d.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"),d.forEach(r=>{r.setAttribute("role","checkbox");let b=r.checked;r.setAttribute("aria-checked",b?"true":"false"),r.hasAttribute("tabindex")||r.setAttribute("tabindex","0")})}function c(r,b){if(m?.onCheckedChange)try{m.onCheckedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onCheckedChange callback:",i)}}function s(r){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let b=d[r],i=!b.checked;b.checked=i,b.setAttribute("aria-checked",i?"true":"false"),c(r,i)}function u(r,b){if(r<0||r>=d.length){console.error(`[aria-ease] Invalid checkbox index: ${r}`);return}let i=d[r];i.checked=b,i.setAttribute("aria-checked",b?"true":"false"),c(r,b)}function v(r){return()=>{let b=d[r];if("checked"in b&&typeof b.checked=="boolean")setTimeout(()=>{let i=b.checked;b.setAttribute("aria-checked",i?"true":"false"),c(r,i)},0);else{let i=b.getAttribute("aria-checked")==="true";b.setAttribute("aria-checked",i?"false":"true"),c(r,!i)}}}function y(r){return b=>{let{key:i}=b;switch(i){case" ":case"Spacebar":b.preventDefault(),s(r);break}}}function E(){d.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),n.set(r,T),a.set(r,i)})}function S(){d.forEach(r=>{let b=n.get(r),i=a.get(r);b&&(r.removeEventListener("keydown",b),n.delete(r)),i&&(r.removeEventListener("click",i),a.delete(r))})}function H(){S()}function q(){return d.map(r=>r.getAttribute("aria-checked")==="true")}function k(){return d.map((r,b)=>r.getAttribute("aria-checked")==="true"?b:-1).filter(r=>r!==-1)}return o(),E(),{toggleCheckbox:s,setCheckboxState:u,getCheckedStates:q,getCheckedIndices:k,cleanup:H}}function oe({menuId:e,menuItemsClass:t,triggerId:m,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 d=document.querySelector(`#${e}`);if(!d)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the menu element exists before calling makeMenuAccessible.`),{openMenu:()=>{},closeMenu:()=>{},cleanup:()=>{}};if(m==="")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(`#${m}`);if(!n)return console.error(`[aria-ease] Element with id="${m}" 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"),d.setAttribute("role","menu"),d.setAttribute("aria-labelledby",m);let a=new WeakMap,o=new Map,c=null,s=null;function u(){return c||(c=d.querySelectorAll(`.${t}`)),c}function v(){if(!s){let g=u();s=[];for(let h=0;h<g.length;h++){let L=g.item(h),$=b(L),R=L.getAttribute("aria-disabled")==="true";$||(L.hasAttribute("tabindex")||L.setAttribute("tabindex","-1"),R||s.push(L))}}return s}function y(g){return{length:g.length,item:L=>g[L],forEach:L=>{g.forEach(L)},[Symbol.iterator]:function*(){for(let L of g)yield L}}}function E(){u().forEach(h=>{h.setAttribute("role","menuitem");let L=h.getAttribute("data-submenu-id")??h.getAttribute("aria-controls"),$=h.hasAttribute("aria-haspopup")&&L;L&&(h.hasAttribute("data-submenu-id")||$)&&(h.setAttribute("aria-haspopup","menu"),h.setAttribute("aria-controls",L),h.hasAttribute("aria-expanded")||h.setAttribute("aria-expanded","false"))})}function S(g,h,L){let $=g.length,R=(h+L+$)%$;g.item(R).focus()}function H(g,h){g.length!==0&&g[h]?.focus()}function q(g){return g.hasAttribute("aria-controls")&&g.hasAttribute("aria-haspopup")&&g.getAttribute("role")==="menuitem"}function k(g){let h=g;for(;h&&h.getAttribute("role")==="menuitem";){let L=h.closest('[role="menu"]');if(!L)break;L.style.display="none",h.setAttribute("aria-expanded","false");let $=L.getAttribute("aria-labelledby");if(!$)break;let R=document.getElementById($);if(!R)break;h=R}}E();function r(g,h,L){switch(g.key){case"ArrowLeft":{if(g.key==="ArrowLeft"&&n.getAttribute("role")==="menuitem"){g.preventDefault(),p();return}break}case"ArrowUp":{g.preventDefault(),S(y(v()),L,-1);break}case"ArrowRight":{if(g.key==="ArrowRight"&&q(h)){g.preventDefault();let $=h.getAttribute("aria-controls");if($){T($);return}}break}case"ArrowDown":{g.preventDefault(),S(y(v()),L,1);break}case"Home":{g.preventDefault(),H(v(),0);break}case"End":{g.preventDefault();let $=v();H($,$.length-1);break}case"Escape":{g.preventDefault(),p(),n.focus(),C&&C(!1);break}case"Enter":case" ":{if(g.preventDefault(),q(h)){let $=h.getAttribute("aria-controls");if($){T($);return}}h.click(),p(),C&&C(!1);break}case"Tab":{p(),k(n),C&&C(!1);break}default:break}}function b(g){let h=g.parentElement;for(;h&&h!==d;){if(h.getAttribute("role")==="menu"||h.id&&d.querySelector(`[aria-controls="${h.id}"]`))return!0;h=h.parentElement}return!1}function i(g){n.setAttribute("aria-expanded",g?"true":"false")}function T(g){let h=o.get(g);if(!h){let L=d.querySelector(`[aria-controls="${g}"]`);if(!L){console.error(`[aria-ease] Submenu trigger with aria-controls="${g}" not found in menu "${e}".`);return}if(!L.id){let R=`trigger-${g}`;L.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}h=oe({menuId:g,menuItemsClass:t,triggerId:L.id,callback:l}),o.set(g,h)}h.openMenu()}function C(g){if(l?.onExpandedChange)try{l.onExpandedChange(g)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function f(){v().forEach((h,L)=>{if(!a.has(h)){let $=R=>r(R,h,L);h.addEventListener("keydown",$),a.set(h,$)}})}function x(){v().forEach(h=>{let L=a.get(h);L&&(h.removeEventListener("keydown",L),a.delete(h))})}function w(){i(!0),d.style.display="block";let g=v();if(f(),g&&g.length>0&&g[0].focus(),l?.onExpandedChange)try{l.onExpandedChange(!0)}catch(h){console.error("[aria-ease] Error in menu onExpandedChange callback:",h)}}function p(){if(o.forEach(g=>g.closeMenu()),i(!1),d.style.display="none",x(),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"?p():w()}function M(g){if(!(n.getAttribute("aria-expanded")==="true"))return;let L=n.contains(g.target),$=d.contains(g.target);!L&&!$&&p()}n.addEventListener("click",A),document.addEventListener("click",M);function I(){x(),n.removeEventListener("click",A),document.removeEventListener("click",M),d.style.display="none",i(!1),o.forEach(g=>g.cleanup()),o.clear()}function P(){c=null,s=null}return{openMenu:w,closeMenu:p,cleanup:I,refresh:P}}function it({radioGroupId:e,radiosClass:t,defaultSelectedIndex:m,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 d=document.querySelector(`#${e}`);if(!d)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(d.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;m&&(c=m);function s(){d.getAttribute("role")||d.setAttribute("role","radiogroup"),n.forEach((k,r)=>{k.setAttribute("role","radio"),k.setAttribute("tabindex","0");let b=r===c;k.setAttribute("aria-checked",b?"true":"false"),k.checked!==void 0&&(k.checked=b)})}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 v(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:b}=r,i=k;switch(b){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 E(){n.forEach((k,r)=>{let b=v(r),i=y(r);k.addEventListener("click",b),k.addEventListener("keydown",i),a.set(k,i),o.set(k,b)})}function S(){n.forEach(k=>{let r=a.get(k),b=o.get(k);r&&(k.removeEventListener("keydown",r),a.delete(k)),b&&(k.removeEventListener("click",b),o.delete(k))})}function H(){S()}function q(){return c}return s(),E(),{selectRadio:u,getSelectedIndex:q,cleanup:H}}function ot({toggleId:e,togglesClass:t,isSingleToggle:m=!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 d=document.querySelector(`#${e}`);if(!d)return console.error(`[aria-ease] Element with id="${e}" not found. Make sure the toggle element exists before calling makeToggleAccessible.`),{cleanup:()=>{}};let n;if(m)n=[d];else{if(!t)return console.error("[aria-ease] togglesClass is required when isSingleToggle is false."),{cleanup:()=>{}};if(n=Array.from(d.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,b){if(r<0||r>=n.length){console.error(`[aria-ease] Invalid toggle index: ${r}`);return}if(n[r].setAttribute("aria-pressed",b?"true":"false"),l?.onPressedChange)try{l.onPressedChange(r,b)}catch(i){console.error("[aria-ease] Error in checkbox onPressedChange callback:",i)}}function v(r){return()=>{s(r)}}function y(r){return b=>{let{key:i}=b;switch(i){case"Enter":case" ":b.preventDefault(),s(r);break}}}function E(){n.forEach((r,b)=>{let i=v(b),T=y(b);r.addEventListener("click",i),r.addEventListener("keydown",T),a.set(r,T),o.set(r,i)})}function S(){n.forEach(r=>{let b=a.get(r),i=o.get(r);b&&(r.removeEventListener("keydown",b),a.delete(r)),i&&(r.removeEventListener("click",i),o.delete(r))})}function H(){S()}function q(){return n.map(r=>r.getAttribute("aria-pressed")==="true")}function k(){return n.map((r,b)=>r.getAttribute("aria-pressed")==="true"?b:-1).filter(r=>r!==-1)}return c(),E(),{toggleButton:s,setPressed:u,getPressedStates:q,getPressedIndices:k,cleanup:H}}function lt({comboboxInputId:e,comboboxButtonId:t,listBoxId:m,listBoxItemsClass:l,callback:d}){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(m==="")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(`${m}`);if(!a)return console.error(`[aria-ease] Element with id="${m}" 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",m),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-haspopup","listbox"),a.setAttribute("role","listbox");let u=null;function v(){return u||(u=a.querySelectorAll(`.${l}`)),Array.from(u).filter(p=>!p.hidden&&p.style.display!=="none")}function y(){return n.getAttribute("aria-expanded")==="true"}function E(p){let A=v();if(p>=0&&p<A.length){let M=A[p],I=M.id||`${m}-option-${p}`;if(M.id||(M.id=I),n.setAttribute("aria-activedescendant",I),typeof M.scrollIntoView=="function"&&M.scrollIntoView({block:"nearest",behavior:"smooth"}),d?.onActiveDescendantChange)try{d.onActiveDescendantChange(I,M)}catch(P){console.error("[aria-ease] Error in combobox onActiveDescendantChange callback:",P)}}else n.setAttribute("aria-activedescendant","");s=p}function S(){if(n.setAttribute("aria-expanded","true"),a.style.display="block",d?.onExpandedChange)try{d.onExpandedChange(!0)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function H(){if(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-activedescendant",""),a.style.display="none",s=-1,d?.onExpandedChange)try{d.onExpandedChange(!1)}catch(p){console.error("[aria-ease] Error in combobox onExpandedChange callback:",p)}}function q(p){let A=p.textContent?.trim()||"";if(n.value=A,p.setAttribute("aria-selected","true"),H(),d?.onSelect)try{d.onSelect(p)}catch(M){console.error("[aria-ease] Error in combobox onSelect callback:",M)}}function k(p){let A=v(),M=y();switch(p.key){case"ArrowDown":if(p.preventDefault(),!M){S();return}if(A.length===0)return;{let I=s>=A.length-1?0:s+1;E(I)}break;case"ArrowUp":if(p.preventDefault(),!M)return;if(A.length>0){let I=s<=0?A.length-1:s-1;E(I)}break;case"Enter":M&&s>=0&&s<A.length&&(p.preventDefault(),q(A[s]));break;case"Escape":if(M)p.preventDefault(),H();else if(n.value&&(p.preventDefault(),n.value="",n.setAttribute("aria-activedescendant",""),v().forEach(P=>{P.getAttribute("aria-selected")==="true"&&P.setAttribute("aria-selected","false")}),d?.onClear))try{d.onClear()}catch(P){console.error("[aria-ease] Error in combobox onClear callback:",P)}break;case"Home":M&&A.length>0&&(p.preventDefault(),E(0));break;case"End":M&&A.length>0&&(p.preventDefault(),E(A.length-1));break;case"Tab":M&&s>=0&&s<A.length&&q(A[s]),M&&H();break}}function r(p){let A=p.target;if(A.classList.contains(l)){let I=v().indexOf(A);I>=0&&E(I)}}function b(p){let A=p.target;A.classList.contains(l)&&(p.preventDefault(),q(A))}function i(p){let A=p.target;!n.contains(A)&&!a.contains(A)&&(!c||!c.contains(A))&&H()}function T(){y()?H():(S(),n.focus())}function C(p){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),T())}n.addEventListener("keydown",k),a.addEventListener("mousemove",r),a.addEventListener("mousedown",b),document.addEventListener("mousedown",i),c&&(c.setAttribute("tabindex","-1"),c.setAttribute("aria-label","Toggle options"),c.addEventListener("click",T),c.addEventListener("keydown",C));function f(){let p=a.querySelectorAll(`.${l}`);if(p.length===0)return;let A=null;for(let M of p)if(M.getAttribute("aria-selected")==="true"){A=M.textContent?.trim()||null;break}!A&&n.value&&(A=n.value.trim()),p.forEach((M,I)=>{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 h=`${m}-option-${I}`;M.id=h,M.setAttribute("id",h)}})}f();function x(){n.removeEventListener("keydown",k),a.removeEventListener("mousemove",r),a.removeEventListener("mousedown",b),document.removeEventListener("mousedown",i),c&&(c.removeEventListener("click",T),c.removeEventListener("keydown",C))}function w(){u=null,f(),s=-1,E(-1)}return{cleanup:x,refresh:w,openListbox:S,closeListbox:H}}function dt({tabListId:e,tabsClass:t,tabPanelsClass:m,orientation:l="horizontal",activateOnFocus:d=!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(m==="")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(`.${m}`));if(c.length===0)return console.error(`[aria-ease] No elements with class="${m}" 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,v=new WeakMap,y=0;function E(){a.setAttribute("role","tablist"),a.setAttribute("aria-orientation",l),o.forEach((f,x)=>{let w=c[x];f.id||(f.id=`${e}-tab-${x}`),w.id||(w.id=`${e}-panel-${x}`),f.setAttribute("role","tab"),f.setAttribute("aria-controls",w.id),f.setAttribute("aria-selected","false"),f.setAttribute("tabindex","-1"),w.setAttribute("role","tabpanel"),w.setAttribute("aria-labelledby",f.id),w.hidden=!0,w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')||w.setAttribute("tabindex","0")}),S(0,!1)}function S(f,x=!0){if(f<0||f>=o.length){console.error(`[aria-ease] Invalid tab index: ${f}`);return}o.forEach((A,M)=>{let I=c[M];A.setAttribute("aria-selected","false"),A.setAttribute("tabindex","-1"),I.hidden=!0});let w=o[f],p=c[f];if(w.setAttribute("aria-selected","true"),w.setAttribute("tabindex","0"),p.hidden=!1,x&&w.focus(),y=f,n?.onSelectedChange)try{n.onSelectedChange(f,!0)}catch(A){console.error("[aria-ease] Error in tabs onSelectedChange callback:",A)}}function H(f){let x=o.findIndex(A=>A===document.activeElement),w=x!==-1?x:y,p=w;switch(f){case"first":p=0;break;case"last":p=o.length-1;break;case"next":p=(w+1)%o.length;break;case"prev":p=(w-1+o.length)%o.length;break}if(o[p].focus(),o[p].setAttribute("tabindex","0"),o[y].setAttribute("tabindex","-1"),d)S(p,!1);else{let A=y;o.forEach((M,I)=>{I===p?M.setAttribute("tabindex","0"):I!==A&&M.setAttribute("tabindex","-1")})}}function q(f){return()=>{S(f)}}function k(f){return x=>{let{key:w}=x,p=!1;if(l==="horizontal")switch(w){case"ArrowLeft":x.preventDefault(),H("prev"),p=!0;break;case"ArrowRight":x.preventDefault(),H("next"),p=!0;break}else switch(w){case"ArrowUp":x.preventDefault(),H("prev"),p=!0;break;case"ArrowDown":x.preventDefault(),H("next"),p=!0;break}if(!p)switch(w){case"Home":x.preventDefault(),H("first");break;case"End":x.preventDefault(),H("last");break;case" ":case"Enter":d||(x.preventDefault(),S(f));break;case"F10":if(x.shiftKey&&n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(A){console.error("[aria-ease] Error in tabs onContextMenu callback:",A)}}break}}}function r(f){return x=>{if(n?.onContextMenu){x.preventDefault();try{n.onContextMenu(f,o[f])}catch(w){console.error("[aria-ease] Error in tabs onContextMenu callback:",w)}}}}function b(){o.forEach((f,x)=>{let w=q(x),p=k(x),A=r(x);f.addEventListener("click",w),f.addEventListener("keydown",p),n?.onContextMenu&&(f.addEventListener("contextmenu",A),v.set(f,A)),s.set(f,p),u.set(f,w)})}function i(){o.forEach(f=>{let x=s.get(f),w=u.get(f),p=v.get(f);x&&(f.removeEventListener("keydown",x),s.delete(f)),w&&(f.removeEventListener("click",w),u.delete(f)),p&&(f.removeEventListener("contextmenu",p),v.delete(f))})}function T(){i(),o.forEach((f,x)=>{let w=c[x];f.removeAttribute("role"),f.removeAttribute("aria-selected"),f.removeAttribute("aria-controls"),f.removeAttribute("tabindex"),w.removeAttribute("role"),w.removeAttribute("aria-labelledby"),w.removeAttribute("tabindex"),w.hidden=!1}),a.removeAttribute("role"),a.removeAttribute("aria-orientation")}function C(){i();let f=Array.from(a.querySelectorAll(`.${t}`)),x=Array.from(document.querySelectorAll(`.${m}`));o.length=0,o.push(...f),c.length=0,c.push(...x),E(),b()}return E(),b(),{activateTab:S,cleanup:T,refresh:C}}function D(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:de},"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={})=>pe(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 de(){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 pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${D("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:we},"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={})=>Me(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 we(){return[{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function Me(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={})=>Se(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Le(e.relativeTarget)},"tab.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>He(e.relativeTarget)}};function Le(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have focus.`}]}function He(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} not to have focus.`}]}function Ce(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have tabindex='0'.`}]}function Se(e){return[{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${D("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${D("tab",e)} to be visible.`},Ce(e)]}var Y={"panel.expanded":{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={})=>$e(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>De(e.relativeTarget)},"trigger.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Ie(e.relativeTarget)},"trigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>qe(e.relativeTarget)}};function $e(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 De(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 Ie(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} to have focus.`}]}function qe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("trigger",e)} not to have focus.`}]}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={})=>Re(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Pe(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>_e(e.relativeTarget)},"radio.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ve(e.relativeTarget)}};function Re(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function Pe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function _e(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} to have focus.`}]}function Ve(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("radio",e)} not 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={})=>Oe(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Be(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>Fe(e.relativeTarget)},"checkbox.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ne(e.relativeTarget)}};function Oe(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function Be(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function Fe(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} to have focus.`}]}function Ne(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("checkbox",e)} not 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={})=>Ke(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Ue(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ze(e.relativeTarget)},"toggle.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>We(e.relativeTarget)}};function Ke(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function Ue(e){return[{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function ze(e){return[{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} to have focus.`}]}function We(e){return[{target:"relative",assertion:"notToHaveFocus",relativeTarget:e,failureMessage:`Expected ${D("toggle",e)} not to have focus.`}]}function je(e,t){return t.some(m=>e.capabilities.includes(m))}function F(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let m of e)if(je(t,m.when))return m.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var Je={combobox:G,menu:X,tabs:Q,accordion:Y,radio:Z,checkbox:ee,toggle:te},N=class{constructor(t){this.jsonContract=t}toJSON(){return this.jsonContract}},K=class{constructor(t){this.componentName=t;this.statePack=Je[t]||{}}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let m=this.statePack,l={capabilities:["keyboard"]},d=(a,o=new Set)=>{if(o.has(a))return[];o.add(a);let c=m[a];if(!c)return[];let s=[];if(Array.isArray(c.requires))for(let u of c.requires)s=s.concat(d(u,o));return c.setup&&(s=s.concat(F(c.setup,l))),s};return t({ariaReference:(a,o,c)=>({requires:s=>{let u=d(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=d(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 d=o=>{let c=this.statePack,s={capabilities:["keyboard"]},u=(v,y=new Set)=>{if(y.has(v))return[];y.add(v);let E=c[v];if(!E)return[];let S=[];if(Array.isArray(E.requires))for(let H of E.requires)S=S.concat(u(H,y));return E.setup&&(S=S.concat(F(E.setup,s))),S};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 v=d(u);return a(o,c,v)}})}}}),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,m,l){this.parent=t;this.statePack=m;this.event=l}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,m){return this._onTarget=t,this._onRelativeTarget=m,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"]},d=(s,u=new Set,v)=>{if(u.has(s))return[];u.add(s);let y=this.statePack[s];if(!y)return[];let E=[];if(Array.isArray(y.requires))for(let S of y.requires)E=E.concat(d(S,u,v));if(y.setup){let S=y.setup.filter(H=>H.when.some(q=>l.capabilities.includes(q)));for(let H of S)typeof H.steps=="function"?E=E.concat(H.steps({relativeTarget:v})):E=E.concat(H.steps)}return E},n=[];for(let s of this._given)typeof s=="string"?n=n.concat(d(s,new Set)):typeof s=="object"&&s.type&&(n=n.concat(d(s.type,new Set,s.ref)));let a=new Set;n=n.filter(s=>{let u=[s.type,s.target,s.relativeTarget].join(":");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 v=u.assertion;if(typeof v=="function")try{v=v()}catch(y){throw new Error(`Error calling assertion function for state '${s}': ${y.message}`)}Array.isArray(v)?o.push(...v):o.push(v)}}else if(typeof s=="object"&&s!==null&&"type"in s&&"ref"in s){let u=this._findStateKeyByTypeAndRef(s.type);if(u){let v=this.statePack[u];if(v&&v.assertion!==void 0){let y=v.assertion;if(typeof y=="function")try{y=y({relativeTarget:s.ref})}catch(E){throw new Error(`Error calling assertion function for state '${u}': ${E.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 _t(e,t){let m=new K(e);return t(m),new N(m.build())}import Ge from"path";async function re(e,t,m={}){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 d(u){try{let v=await fetch(u,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(v.ok||v.status===304)return u}catch{return null}return null}let n=B(m.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"),v=await u(process.cwd());if(a=v.config,v.configPath&&(o=Ge.dirname(v.configPath)),m.strictness===void 0){let y=a.test?.components?.find(E=>E?.name===e)?.strictness;n=B(y??a.test?.strictness)}}catch{m.strictness===void 0&&(n="balanced")}let c;try{if(t){let u=await d(t);if(u){console.log(`\u{1F3AD} Running Playwright tests on ${u}`);let{runContractTestsPlaywright:v}=await import("./contractTestRunnerPlaywright-CHCVW7VO.js");c=await v(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,v=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
|
+
${v}
|
|
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((
|
|
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((m,l)=>{e("npx vitest --run --reporter verbose",async(d,n,a)=>{if(console.log(n),a&&console.error(a),!d||d.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)}m({passes:[],failures:[],skipped:[]}),process.exit(0)}else{let c=d?.code||1;l(new Error(`Tests failed with code ${c}`)),process.exit(c)}})})});async function ae(){await z()}export{ae as cleanupTests,_t as createContract,Xe as makeAccordionAccessible,et as makeBlockAccessible,rt as makeCheckboxAccessible,lt as makeComboboxAccessible,oe as makeMenuAccessible,it as makeRadioAccessible,dt as makeTabsAccessible,ot 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 };
|