aria-ease 7.8.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.
@@ -64,11 +64,6 @@ type DynamicAssertion = {
64
64
  level?: Level;
65
65
  };
66
66
  type DynamicAction = {
67
- type: "focus";
68
- target: string;
69
- relativeTarget?: "first" | "last" | "next" | "previous" | number;
70
- virtualId?: string;
71
- } | {
72
67
  type: "click" | "keypress" | "type" | "hover" | "focus";
73
68
  target: string;
74
69
  key?: string;
@@ -64,11 +64,6 @@ type DynamicAssertion = {
64
64
  level?: Level;
65
65
  };
66
66
  type DynamicAction = {
67
- type: "focus";
68
- target: string;
69
- relativeTarget?: "first" | "last" | "next" | "previous" | number;
70
- virtualId?: string;
71
- } | {
72
67
  type: "click" | "keypress" | "type" | "hover" | "focus";
73
68
  target: string;
74
69
  key?: string;
@@ -1 +1 @@
1
- function l(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 k={"comboboxpopup.open":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"keypress",target:"input",key:"ArrowDown"}]},{when:["pointer"],steps:()=>[{type:"click",target:"button"}]}],assertion:C},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...D(),...T()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:q},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:I},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:B},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:F},"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={})=>H(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:V},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:T},"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={})=>R(e.relativeTarget)}};function C(){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 D(){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 H(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 V(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function T(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function R(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${l("option",e)} to have aria-selected='true'.`}]}function q(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function I(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function B(){return [{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function F(){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:P},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:$},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:O},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:z},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>L(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:K},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:U},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:j},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:J},"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={})=>G(e.relativeTarget)}};function P(){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 $(){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 O(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function z(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function L(e){return [{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function K(){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 U(){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 j(){return [{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function J(){return [{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function G(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var A={"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={})=>W(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>X(e.relativeTarget)}};function X(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${l("tab",e)} to have focus.`}]}function N(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${l("tab",e)} to have tabindex='0'.`}]}function W(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${l("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${l("tab",e)} to be visible.`},N(e)]}var w={"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={})=>Q(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>Y(e.relativeTarget)}};function Q(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 Y(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 S={"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={})=>Z(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ee(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>te(e.relativeTarget)}};function Z(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function ee(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function te(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${l("radio",e)} to have focus.`}]}var E={"checkbox.checked":{setup:[{when:["keyboard"],steps:e=>[{type:"keypress",target:"relative",relativeTarget:e.relativeTarget,key:"Space"}]},{when:["pointer"],steps:e=>[{type:"click",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>re(e.relativeTarget)},"checkbox.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ie(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>ae(e.relativeTarget)}};function re(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected checkbox to have aria-checked='true' when checked."}]}function ie(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected checkbox to have aria-checked='false' when unchecked."}]}function ae(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${l("checkbox",e)} to have focus.`}]}var M={"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={})=>se(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ne(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>oe(e.relativeTarget)}};function se(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function ne(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function oe(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${l("toggle",e)} to have focus.`}]}function ue(e,t){return t.some(c=>e.capabilities.includes(c))}function m(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let c of e)if(ue(t,c.when))return c.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var pe={combobox:k,menu:x,tabs:A,accordion:w,radio:S,checkbox:E,toggle:M},y=class{constructor(t){this.jsonContract=t;}toJSON(){return this.jsonContract}},f=class{constructor(t){this.componentName=t;this.statePack=pe[t]||{};}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let c=this.statePack,p={capabilities:["keyboard"]},d=(o,i=new Set)=>{if(i.has(o))return [];i.add(o);let n=c[o];if(!n)return [];let r=[];if(Array.isArray(n.requires))for(let a of n.requires)r=r.concat(d(a,i));return n.setup&&(r=r.concat(m(n.setup,p))),r};return t({ariaReference:(o,i,n)=>({requires:r=>{let a=d(r,new Set);return {required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"required",setup:a}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"optional",setup:a}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"recommended",setup:a})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:o,attribute:i,to:n,level:"recommended"})}),contains:(o,i)=>({requires:n=>{let r=d(n,new Set);return {required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required",setup:r}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional",setup:r}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended",setup:r})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:o,child:i,level:"recommended"})})}),this}static(t){return t({target:p=>{let d=i=>{let n=this.statePack,r={capabilities:["keyboard"]},a=(s,u=new Set)=>{if(u.has(s))return [];u.add(s);let v=n[s];if(!v)return [];let b=[];if(Array.isArray(v.requires))for(let _ of v.requires)b=b.concat(a(_,u));return v.setup&&(b=b.concat(m(v.setup,r))),b};return a(i,new Set)},g=i=>i==="role"?"toHaveRole":"toHaveAttribute",o=(i,n,r)=>{let a=g(i);return {required:()=>this.staticAssertions.push({target:p,assertion:a,attribute:i,expectedValue:n,failureMessage:"",level:"required",setup:r}),optional:()=>this.staticAssertions.push({target:p,assertion:a,attribute:i,expectedValue:n,failureMessage:"",level:"optional",setup:r}),recommended:()=>this.staticAssertions.push({target:p,assertion:a,attribute:i,expectedValue:n,failureMessage:"",level:"recommended",setup:r})}};return {has:(i,n)=>({...o(i,n),requires:a=>{let s=d(a);return o(i,n,s)}})}}}),this}when(t){return new h(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}}},h=class{constructor(t,c,p){this.parent=t;this.statePack=c;this.event=p;}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,c){return this._onTarget=t,this._onRelativeTarget=c,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(p=>typeof p=="string"?[p]:typeof p=="object"&&p!==null&&"type"in p&&"ref"in p?this._findStateKeyByTypeAndRef(p.type)?[{type:p.type,ref:p.ref}]:[]:[p])}_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 p={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},d=(r,a=new Set)=>{if(a.has(r))return [];a.add(r);let s=this.statePack[r];if(!s)return [];let u=[];if(Array.isArray(s.requires))for(let v of s.requires)u=u.concat(d(v,a));return s.setup&&(u=u.concat(m(s.setup,p))),u},g=[];for(let r of this._given)if(typeof r=="string")g.push(...d(r));else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let a=this._findStateKeyByTypeAndRef(r.type);if(a){let s=this.statePack[a];if(s&&s.setup)for(let u of s.setup)typeof u.steps=="function"?g.push(...u.steps({relativeTarget:r.ref})):Array.isArray(u.steps)&&g.push(...u.steps);}}let o=new Set;g=g.filter(r=>{let a=JSON.stringify(r);return o.has(a)?false:(o.add(a),true)});let i=[];for(let r of this._then)if(typeof r=="string"){let a=this.statePack[r];if(a&&a.assertion!==void 0){let s=a.assertion;if(typeof s=="function")try{s=s();}catch(u){throw new Error(`Error calling assertion function for state '${r}': ${u.message}`)}Array.isArray(s)?i.push(...s):i.push(s);}}else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let a=this._findStateKeyByTypeAndRef(r.type);if(a){let s=this.statePack[a];if(s&&s.assertion!==void 0){let u=s.assertion;if(typeof u=="function")try{u=u({relativeTarget:r.ref});}catch(v){throw new Error(`Error calling assertion function for state '${a}': ${v.message}`)}Array.isArray(u)?i.push(...u):i.push(u);}}}let n=[{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:n,assertions:i,...g.length?{setup:g}:{}});}};function Re(e,t){let c=new f(e);return t(c),new y(c.build())}export{Re as createContract};
1
+ function o(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:C},"comboboxpopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:[...D(),...k()]},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:B},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:I},"input.filled":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:"test"}]}],assertion:F},"input.empty":{setup:[{when:["keyboard","textInput","pointer"],steps:()=>[{type:"type",target:"input",value:""}]}],assertion:$},"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={})=>R(e.relativeTarget)},"activedescendant.set":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:V},"activedescendant.unset":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:k},"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={})=>q(e.relativeTarget)}};function C(){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 D(){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 R(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 V(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"!empty",failureMessage:"Expected aria-activedescendant on main to not be empty."}]}function k(){return [{target:"main",assertion:"toHaveAttribute",attribute:"aria-activedescendant",expectedValue:"",failureMessage:"Expected aria-activedescendant on main to be empty."}]}function q(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",failureMessage:`Expected ${o("option",e)} to have aria-selected='true'.`}]}function B(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected main to be focused."}]}function I(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected main to not have focused."}]}function F(){return [{target:"input",assertion:"toHaveValue",expectedValue:"test",failureMessage:"Expected input to have the value 'test'."}]}function $(){return [{target:"input",assertion:"toHaveValue",expectedValue:"",failureMessage:"Expected input to have the value ''."}]}var A={"menupopup.open":{setup:[{when:["keyboard"],steps:()=>[{type:"keypress",target:"main",key:"Enter"}]},{when:["pointer"],steps:()=>[{type:"click",target:"main"}]}],assertion:P},"menupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:O},"main.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"main"}]}],assertion:z},"main.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:L},"menuitem.focused":{requires:["menupopup.open"],setup:[{when:["keyboard"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>j(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:U},"submenupopup.closed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:K},"submenutrigger.focused":{setup:[{when:["keyboard","pointer"],steps:()=>[{type:"focus",target:"submenuTrigger"}]}],assertion:J},"submenutrigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:G},"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={})=>X(e.relativeTarget)}};function P(){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 O(){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 z(){return [{target:"main",assertion:"toHaveFocus",failureMessage:"Expected menu main to be focused."}]}function L(){return [{target:"main",assertion:"notToHaveFocus",failureMessage:"Expected menu main to not have focused."}]}function j(e){return [{target:"relative",assertion:"toHaveFocus",expectedValue:e,failureMessage:`${e} menu item should have focus.`}]}function U(){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 K(){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 J(){return [{target:"submenuTrigger",assertion:"toHaveFocus",failureMessage:"Expected submenu trigger to be focused."}]}function G(){return [{target:"submenuTrigger",assertion:"notToHaveFocus",failureMessage:"Expected submenu trigger to not have focused."}]}function X(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveFocus",failureMessage:`Expected submenu item ${e} to have focus.`}]}var w={"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={})=>Y(e.relativeTarget)},"tab.focused":{setup:[{when:["keyboard","pointer"],steps:(e={})=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>N(e.relativeTarget)},"tab.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>W(e.relativeTarget)}};function N(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("tab",e)} to have focus.`}]}function W(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("tab",e)} not to have focus.`}]}function Q(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${o("tab",e)} to have tabindex='0'.`}]}function Y(e){return [{target:"relative",assertion:"toHaveAttribute",attribute:"aria-selected",expectedValue:"true",relativeTarget:e,failureMessage:`Expected ${o("tab",e)} to have aria-selected='true'.`},{target:"panel",assertion:"toBeVisible",controlledBy:{target:"relative",relativeTarget:e},failureMessage:`Expected panel controlled by the ${o("tab",e)} to be visible.`},Q(e)]}var S={"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={})=>Z(e.relativeTarget)},"panel.collapsed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ee(e.relativeTarget)},"trigger.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>te(e.relativeTarget)},"trigger.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>re(e.relativeTarget)}};function Z(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 ee(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 te(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("trigger",e)} to have focus.`}]}function re(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("trigger",e)} not to have focus.`}]}var E={"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={})=>ie(e.relativeTarget)},"radio.unchecked":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ae(e.relativeTarget)},"radio.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>se(e.relativeTarget)},"radio.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ne(e.relativeTarget)}};function ie(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"true",failureMessage:"Expected radio to have aria-checked='true' when checked."}]}function ae(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-checked",expectedValue:"false",failureMessage:"Expected radio to have aria-checked='false' when unchecked."}]}function se(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("radio",e)} to have focus.`}]}function ne(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("radio",e)} not to have focus.`}]}var M={"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={})=>ue(e.relativeTarget)},"checkbox.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>pe(e.relativeTarget)},"checkbox.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ce(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 ue(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 ${o("checkbox",e)} to have focus.`}]}function ce(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("checkbox",e)} not to have focus.`}]}var H={"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={})=>le(e.relativeTarget)},"toggle.unpressed":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ge(e.relativeTarget)},"toggle.focused":{setup:[{when:["keyboard","pointer"],steps:e=>[{type:"focus",target:"relative",relativeTarget:e.relativeTarget}]}],assertion:(e={})=>de(e.relativeTarget)},"toggle.blurred":{setup:[{when:["keyboard","pointer"],steps:()=>[]}],assertion:(e={})=>ve(e.relativeTarget)}};function le(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"true",failureMessage:"Expected toggle to have aria-pressed='true' when pressed."}]}function ge(e){return [{target:"relative",relativeTarget:e,assertion:"toHaveAttribute",attribute:"aria-pressed",expectedValue:"false",failureMessage:"Expected toggle to have aria-pressed='false' when unpressed."}]}function de(e){return [{target:"relative",assertion:"toHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("toggle",e)} to have focus.`}]}function ve(e){return [{target:"relative",assertion:"notToHaveFocus",relativeTarget:e,failureMessage:`Expected ${o("toggle",e)} not to have focus.`}]}function be(e,t){return t.some(l=>e.capabilities.includes(l))}function f(e,t){Array.isArray(e)&&e.length&&!e[0].when&&(e=[{when:["keyboard"],steps:()=>e}]);for(let l of e)if(be(t,l.when))return l.steps(t);throw new Error(`No setup strategy matches capabilities: ${t.capabilities.join(", ")}`)}var me={combobox:x,menu:A,tabs:w,accordion:S,radio:E,checkbox:M,toggle:H},h=class{constructor(t){this.jsonContract=t;}toJSON(){return this.jsonContract}},y=class{constructor(t){this.componentName=t;this.statePack=me[t]||{};}metaValue={};selectorsValue={};relationshipInvariants=[];staticAssertions=[];dynamicTests=[];statePack;meta(t){return this.metaValue=t,this}selectors(t){return this.selectorsValue=t,this}relationships(t){let l=this.statePack,u={capabilities:["keyboard"]},v=(n,i=new Set)=>{if(i.has(n))return [];i.add(n);let s=l[n];if(!s)return [];let r=[];if(Array.isArray(s.requires))for(let a of s.requires)r=r.concat(v(a,i));return s.setup&&(r=r.concat(f(s.setup,u))),r};return t({ariaReference:(n,i,s)=>({requires:r=>{let a=v(r,new Set);return {required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"required",setup:a}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"optional",setup:a}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"recommended",setup:a})}},required:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"aria-reference",from:n,attribute:i,to:s,level:"recommended"})}),contains:(n,i)=>({requires:s=>{let r=v(s,new Set);return {required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"required",setup:r}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"optional",setup:r}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"recommended",setup:r})}},required:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"required"}),optional:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"optional"}),recommended:()=>this.relationshipInvariants.push({type:"contains",parent:n,child:i,level:"recommended"})})}),this}static(t){return t({target:u=>{let v=i=>{let s=this.statePack,r={capabilities:["keyboard"]},a=(p,c=new Set)=>{if(c.has(p))return [];c.add(p);let g=s[p];if(!g)return [];let b=[];if(Array.isArray(g.requires))for(let m of g.requires)b=b.concat(a(m,c));return g.setup&&(b=b.concat(f(g.setup,r))),b};return a(i,new Set)},d=i=>i==="role"?"toHaveRole":"toHaveAttribute",n=(i,s,r)=>{let a=d(i);return {required:()=>this.staticAssertions.push({target:u,assertion:a,attribute:i,expectedValue:s,failureMessage:"",level:"required",setup:r}),optional:()=>this.staticAssertions.push({target:u,assertion:a,attribute:i,expectedValue:s,failureMessage:"",level:"optional",setup:r}),recommended:()=>this.staticAssertions.push({target:u,assertion:a,attribute:i,expectedValue:s,failureMessage:"",level:"recommended",setup:r})}};return {has:(i,s)=>({...n(i,s),requires:a=>{let p=v(a);return n(i,s,p)}})}}}),this}when(t){return new T(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}}},T=class{constructor(t,l,u){this.parent=t;this.statePack=l;this.event=u;}_as;_onTarget;_onRelativeTarget;_given=[];_then=[];_desc="";_level="required";_orientation;as(t){return this._as=t,this}on(t,l){return this._onTarget=t,this._onRelativeTarget=l,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(u=>typeof u=="string"?[u]:typeof u=="object"&&u!==null&&"type"in u&&"ref"in u?this._findStateKeyByTypeAndRef(u.type)?[{type:u.type,ref:u.ref}]:[]:[u])}_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 u={capabilities:[{keypress:"keyboard",click:"pointer",type:"textInput",focus:"keyboard",hover:"pointer"}[this._as||"keyboard"]||this._as||"keyboard"]},v=(r,a=new Set,p)=>{if(a.has(r))return [];a.add(r);let c=this.statePack[r];if(!c)return [];let g=[];if(Array.isArray(c.requires))for(let b of c.requires)g=g.concat(v(b,a,p));if(c.setup){let b=c.setup.filter(m=>m.when.some(_=>u.capabilities.includes(_)));for(let m of b)typeof m.steps=="function"?g=g.concat(m.steps({relativeTarget:p})):g=g.concat(m.steps);}return g},d=[];for(let r of this._given)typeof r=="string"?d=d.concat(v(r,new Set)):typeof r=="object"&&r.type&&(d=d.concat(v(r.type,new Set,r.ref)));let n=new Set;d=d.filter(r=>{let a=[r.type,r.target,r.relativeTarget].join(":");return n.has(a)?false:(n.add(a),true)});let i=[];for(let r of this._then)if(typeof r=="string"){let a=this.statePack[r];if(a&&a.assertion!==void 0){let p=a.assertion;if(typeof p=="function")try{p=p();}catch(c){throw new Error(`Error calling assertion function for state '${r}': ${c.message}`)}Array.isArray(p)?i.push(...p):i.push(p);}}else if(typeof r=="object"&&r!==null&&"type"in r&&"ref"in r){let a=this._findStateKeyByTypeAndRef(r.type);if(a){let p=this.statePack[a];if(p&&p.assertion!==void 0){let c=p.assertion;if(typeof c=="function")try{c=c({relativeTarget:r.ref});}catch(g){throw new Error(`Error calling assertion function for state '${a}': ${g.message}`)}Array.isArray(c)?i.push(...c):i.push(c);}}}let s=[{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:s,assertions:i,...d.length?{setup:d}:{}});}};function ze(e,t){let l=new y(e);return t(l),new h(l.build())}export{ze as createContract};
@@ -1,12 +1,12 @@
1
- 'use strict';var playwright=require('playwright'),Be=require('path'),Fe=require('fs-extra'),test=require('@playwright/test'),url=require('url'),fs=require('fs'),L=require('chalk'),Ot=require('readline');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Be__default=/*#__PURE__*/_interopDefault(Be);var Fe__default=/*#__PURE__*/_interopDefault(Fe);var L__default=/*#__PURE__*/_interopDefault(L);var Ot__default=/*#__PURE__*/_interopDefault(Ot);var Rt=Object.defineProperty;var x=(c,e)=>()=>(c&&(e=c(c=0)),e);var _=(c,e)=>{for(var t in e)Rt(c,t,{get:e[t],enumerable:true});};async function xt(){return re||(re=await playwright.chromium.launch({headless:true,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),re}async function Et(){return ie||(ie=await(await xt()).newContext({permissions:[],ignoreHTTPSErrors:true})),ie}async function qe(){return await(await Et()).newPage()}async function _e(){ie&&(await ie.close(),ie=null),re&&(await re.close(),re=null);}var re,ie,be=x(()=>{re=null,ie=null;});function Z(c){return c==="required"||c==="recommended"||c==="optional"?c:Pt}function ce(c){return c==="minimal"||c==="balanced"||c==="strict"||c==="paranoid"?c:"balanced"}function Je(c,e){return {minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][c]}var Pt,Te=x(()=>{Pt="required";});var Ge={};_(Ge,{loadConfig:()=>Lt});function Bt(c){let e=[];if(!c||typeof c!="object")return e.push("Config must be an object"),{valid:false,errors:e};let t=c;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(r=>typeof r!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else {let r=t.audit.output;r.format!==void 0&&(["json","csv","html","all"].includes(r.format)||e.push("audit.output.format must be one of: json, csv, html, all")),r.out!==void 0&&typeof r.out!="string"&&e.push("audit.output.out must be a string");}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else {t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let r=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let i of r){let n=t.test[i];n!==void 0&&(typeof n!="number"||!Number.isFinite(n)||n<0)&&e.push(`test.${i} must be a non-negative number when provided`);}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((i,n)=>{if(typeof i!="object"||i===null)e.push(`test.components[${n}] must be an object`);else {typeof i.name!="string"&&e.push(`test.components[${n}].name must be a string`),i.contractPath!==void 0&&typeof i.contractPath!="string"&&e.push(`test.components[${n}].contractPath must be a string when provided`),i.strategyPath!==void 0&&typeof i.strategyPath!="string"&&e.push(`test.components[${n}].strategyPath must be a string when provided`),i.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(i.strictness)&&e.push(`test.components[${n}].strictness must be one of: minimal, balanced, strict, paranoid`),i.disableTimeouts!==void 0&&typeof i.disableTimeouts!="boolean"&&e.push(`test.components[${n}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let f=i[o];f!==void 0&&(typeof f!="number"||!Number.isFinite(f)||f<0)&&e.push(`test.components[${n}].${o} must be a non-negative number when provided`);}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"));}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((r,i)=>{typeof r!="object"||r===null?e.push(`contracts[${i}] must be an object`):(typeof r.src!="string"&&e.push(`contracts[${i}].src is required and must be a string`),r.out!==void 0&&typeof r.out!="string"&&e.push(`contracts[${i}].out must be a string`));}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function It(c){try{let e=Be__default.default.extname(c);if(e===".json"){let t=await Fe__default.default.readFile(c,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(c);return t.default||t}return null}catch{return null}}async function Lt(c=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,r=null,i=[];for(let n of e){let a=Be__default.default.resolve(c,n);if(await Fe__default.default.pathExists(a)){if(r=a,t=await It(a),t===null){i.push(`Found config at ${n} but failed to load it. Check for syntax errors.`);continue}let o=Bt(t);if(!o.valid){i.push(`Config validation failed in ${n}:`),i.push(...o.errors.map(f=>` - ${f}`)),t=null;continue}break}}return {config:t||{},configPath:t?r:null,errors:i}}var Ne=x(()=>{});var Ye={};_(Ye,{MenuComponentStrategy:()=>$e});var $e,Qe=x(()=>{$e=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
1
+ 'use strict';var playwright=require('playwright'),Be=require('path'),Fe=require('fs-extra'),test=require('@playwright/test'),url=require('url'),fs=require('fs'),L=require('chalk'),Jt=require('readline');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Be__default=/*#__PURE__*/_interopDefault(Be);var Fe__default=/*#__PURE__*/_interopDefault(Fe);var L__default=/*#__PURE__*/_interopDefault(L);var Jt__default=/*#__PURE__*/_interopDefault(Jt);var Et=Object.defineProperty;var x=(c,e)=>()=>(c&&(e=c(c=0)),e);var q=(c,e)=>{for(var t in e)Et(c,t,{get:e[t],enumerable:true});};async function Bt(){return se||(se=await playwright.chromium.launch({headless:true,args:["--disable-extensions","--disable-blink-features=AutomationControlled"]})),se}async function It(){return re||(re=await(await Bt()).newContext({permissions:[],ignoreHTTPSErrors:true})),re}async function _e(){return await(await It()).newPage()}async function Je(){re&&(await re.close(),re=null),se&&(await se.close(),se=null);}var se,re,be=x(()=>{se=null,re=null;});function ie(c){return c==="required"||c==="recommended"||c==="optional"?c:Lt}function ae(c){return c==="minimal"||c==="balanced"||c==="strict"||c==="paranoid"?c:"balanced"}function Ke(c,e){return {minimal:{required:"error",recommended:"ignore",optional:"ignore"},balanced:{required:"error",recommended:"warning",optional:"ignore"},strict:{required:"error",recommended:"error",optional:"warning"},paranoid:{required:"error",recommended:"error",optional:"error"}}[e][c]}var Lt,Te=x(()=>{Lt="required";});var Ne={};q(Ne,{loadConfig:()=>Ut});function Ft(c){let e=[];if(!c||typeof c!="object")return e.push("Config must be an object"),{valid:false,errors:e};let t=c;if(t.audit!==void 0){if(typeof t.audit!="object"||t.audit===null)e.push("audit must be an object");else if(t.audit.urls!==void 0&&(Array.isArray(t.audit.urls)?t.audit.urls.some(r=>typeof r!="string")&&e.push("audit.urls must contain only strings"):e.push("audit.urls must be an array")),t.audit.output!==void 0)if(typeof t.audit.output!="object")e.push("audit.output must be an object");else {let r=t.audit.output;r.format!==void 0&&(["json","csv","html","all"].includes(r.format)||e.push("audit.output.format must be one of: json, csv, html, all")),r.out!==void 0&&typeof r.out!="string"&&e.push("audit.output.out must be a string");}}if(t.test!==void 0)if(typeof t.test!="object"||t.test===null)e.push("test must be an object");else {t.test.disableTimeouts!==void 0&&typeof t.test.disableTimeouts!="boolean"&&e.push("test.disableTimeouts must be a boolean when provided");let r=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let i of r){let n=t.test[i];n!==void 0&&(typeof n!="number"||!Number.isFinite(n)||n<0)&&e.push(`test.${i} must be a non-negative number when provided`);}t.test.components!==void 0&&(Array.isArray(t.test.components)?t.test.components.forEach((i,n)=>{if(typeof i!="object"||i===null)e.push(`test.components[${n}] must be an object`);else {typeof i.name!="string"&&e.push(`test.components[${n}].name must be a string`),i.contractPath!==void 0&&typeof i.contractPath!="string"&&e.push(`test.components[${n}].contractPath must be a string when provided`),i.strategyPath!==void 0&&typeof i.strategyPath!="string"&&e.push(`test.components[${n}].strategyPath must be a string when provided`),i.strictness!==void 0&&!["minimal","balanced","strict","paranoid"].includes(i.strictness)&&e.push(`test.components[${n}].strictness must be one of: minimal, balanced, strict, paranoid`),i.disableTimeouts!==void 0&&typeof i.disableTimeouts!="boolean"&&e.push(`test.components[${n}].disableTimeouts must be a boolean when provided`);let a=["actionTimeoutMs","assertionTimeoutMs","navigationTimeoutMs","componentReadyTimeoutMs"];for(let o of a){let p=i[o];p!==void 0&&(typeof p!="number"||!Number.isFinite(p)||p<0)&&e.push(`test.components[${n}].${o} must be a non-negative number when provided`);}}}):e.push("test.components must be an array")),t.test.strictness!==void 0&&(["minimal","balanced","strict","paranoid"].includes(t.test.strictness)||e.push("test.strictness must be one of: minimal, balanced, strict, paranoid"));}return t.contracts!==void 0&&(Array.isArray(t.contracts)?t.contracts.forEach((r,i)=>{typeof r!="object"||r===null?e.push(`contracts[${i}] must be an object`):(typeof r.src!="string"&&e.push(`contracts[${i}].src is required and must be a string`),r.out!==void 0&&typeof r.out!="string"&&e.push(`contracts[${i}].out must be a string`));}):e.push("contracts must be an array")),{valid:e.length===0,errors:e}}async function Vt(c){try{let e=Be__default.default.extname(c);if(e===".json"){let t=await Fe__default.default.readFile(c,"utf-8");return JSON.parse(t)}else if([".js",".mjs",".cjs",".ts"].includes(e)){let t=await import(c);return t.default||t}return null}catch{return null}}async function Ut(c=process.cwd()){let e=["ariaease.config.js","ariaease.config.mjs","ariaease.config.cjs","ariaease.config.json","ariaease.config.ts"],t=null,r=null,i=[];for(let n of e){let a=Be__default.default.resolve(c,n);if(await Fe__default.default.pathExists(a)){if(r=a,t=await Vt(a),t===null){i.push(`Found config at ${n} but failed to load it. Check for syntax errors.`);continue}let o=Ft(t);if(!o.valid){i.push(`Config validation failed in ${n}:`),i.push(...o.errors.map(p=>` - ${p}`)),t=null;continue}break}}return {config:t||{},configPath:t?r:null,errors:i}}var Ye=x(()=>{});var Qe={};q(Qe,{MenuComponentStrategy:()=>$e});var $e,Xe=x(()=>{$e=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.main&&(await e.locator(this.selectors.main).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close menu between tests. Menu remains visible after trying:
2
2
  1. Escape key
3
3
  2. Clicking trigger
4
4
  3. Clicking outside
5
- This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus();}async shouldSkipTest(e,t){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return false;let i=this.selectors.submenuTrigger;return i?await t.locator(i).count()===0:true}getMainSelector(){return this.mainSelector}};});var Xe={};_(Xe,{AccordionComponentStrategy:()=>Ce});var Ce,Ze=x(()=>{Ce=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger)return;let t=this.selectors.trigger,r=this.selectors.panel;if(!t||!r)return;let i=await e.locator(t).all();for(let n of i){let a=await n.getAttribute("aria-expanded")==="true",o=await n.getAttribute("aria-controls");if(a&&o){await n.click({timeout:this.actionTimeoutMs});let f=e.locator(`#${o}`);await test.expect(f).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var et={};_(et,{ComboboxComponentStrategy:()=>Ae});var Ae,tt=x(()=>{Ae=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
5
+ This indicates a problem with the menu component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear(),this.selectors.main&&await e.locator(this.selectors.main).first().focus();}async shouldSkipTest(e,t){if(!(e.action.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")||e.assertions.some(a=>a.target==="submenu"||a.target==="submenuTrigger"||a.target==="submenuItems")))return false;let i=this.selectors.submenuTrigger;return i?await t.locator(i).count()===0:true}getMainSelector(){return this.mainSelector}};});var Ze={};q(Ze,{AccordionComponentStrategy:()=>Ce});var Ce,et=x(()=>{Ce=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.panel||!this.selectors.trigger)return;let t=this.selectors.trigger,r=this.selectors.panel;if(!t||!r)return;let i=await e.locator(t).all();for(let n of i){let a=await n.getAttribute("aria-expanded")==="true",o=await n.getAttribute("aria-controls");if(a&&o){await n.click({timeout:this.actionTimeoutMs});let p=e.locator(`#${o}`);await test.expect(p).toBeHidden({timeout:this.assertionTimeoutMs}).catch(()=>{});}}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var tt={};q(tt,{ComboboxComponentStrategy:()=>Ae});var Ae,st=x(()=>{Ae=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.popup)return;let t=this.selectors.popup,r=e.locator(t).first();if(!await r.isVisible().catch(()=>false))return;let n=false,a=this.selectors.main;if(a&&(await e.locator(a).first().focus(),await e.keyboard.press("Escape"),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n&&this.selectors.button&&(await e.locator(this.selectors.button).first().click({timeout:this.actionTimeoutMs}),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),n||(await e.mouse.click(10,10),n=await test.expect(r).toBeHidden({timeout:this.assertionTimeoutMs}).then(()=>true).catch(()=>false)),!n)throw new Error(`\u274C FATAL: Cannot close combobox popup between tests. Popup remains visible after trying:
6
6
  1. Escape key
7
7
  2. Clicking button
8
8
  3. Clicking outside
9
- This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear();}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var st={};_(st,{TabsComponentStrategy:()=>Re});var Re,rt=x(()=>{Re=class{constructor(e,t){this.mainSelector=e;this.selectors=t;}async resetState(){}async shouldSkipTest(e,t){if(e.orientation!==void 0&&this.selectors.tablist){let r=this.selectors.tablist,n=await t.locator(r).first().getAttribute("aria-orientation");if(e.orientation!==n)return true}return false}getMainSelector(){return this.mainSelector}};});var it={};_(it,{RadioComponentStrategy:()=>Me});var Me,nt=x(()=>{Me=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.radio||!this.selectors.relative)return;let t=this.selectors.radio;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-checked")==="true"){await i.evaluate(o=>o.setAttribute("aria-checked","false"),{timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var ot={};_(ot,{CheckboxComponentStrategy:()=>xe});var xe,at=x(()=>{xe=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.checkbox||!this.selectors.relative)return;let t=this.selectors.checkbox;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-checked")==="true"){await i.click({timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var ct={};_(ct,{ToggleComponentStrategy:()=>Ee});var Ee,lt=x(()=>{Ee=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.toggle||!this.selectors.relative)return;let t=this.selectors.toggle;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-pressed")==="true"){await i.click({timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-pressed","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var fe,pt=x(()=>{fe=class{builtInStrategies=new Map;constructor(){this.registerBuiltInStrategies();}registerBuiltInStrategies(){this.builtInStrategies.set("menu",()=>Promise.resolve().then(()=>(Qe(),Ye)).then(e=>e.MenuComponentStrategy)),this.builtInStrategies.set("accordion",()=>Promise.resolve().then(()=>(Ze(),Xe)).then(e=>e.AccordionComponentStrategy)),this.builtInStrategies.set("combobox",()=>Promise.resolve().then(()=>(tt(),et)).then(e=>e.ComboboxComponentStrategy)),this.builtInStrategies.set("tabs",()=>Promise.resolve().then(()=>(rt(),st)).then(e=>e.TabsComponentStrategy)),this.builtInStrategies.set("radio",()=>Promise.resolve().then(()=>(nt(),it)).then(e=>e.RadioComponentStrategy)),this.builtInStrategies.set("checkbox",()=>Promise.resolve().then(()=>(at(),ot)).then(e=>e.CheckboxComponentStrategy)),this.builtInStrategies.set("toggle",()=>Promise.resolve().then(()=>(lt(),ct)).then(e=>e.ToggleComponentStrategy));}async loadStrategy(e,t,r){try{if(t)try{let n=Be__default.default.isAbsolute(t)?t:Be__default.default.resolve(r||process.cwd(),t),a=await import(url.pathToFileURL(n).href),o=a.default||a;if(!o)throw new Error(`No default export found in ${t}`);return o}catch(n){throw new Error(`Failed to load custom strategy from ${t}: ${n instanceof Error?n.message:String(n)}`)}let i=this.builtInStrategies.get(e);return i?i():null}catch(i){throw new Error(`Strategy loading failed for ${e}: ${i instanceof Error?i.message:String(i)}`)}}has(e,t){return !!t||this.builtInStrategies.has(e)}};});var ge,ft=x(()=>{pt();ge=class{static strategyRegistry=new fe;static isComponentConfig(e){return typeof e=="object"&&e!==null}static async detect(e,t,r=400,i=400,n){let a=this.isComponentConfig(t)?t:void 0,o=a?.contractPath;if(!o)throw new Error(`Contract path not found for component: ${e}`);let f=(()=>{if(Be__default.default.isAbsolute(o))return o;if(n){let ue=Be__default.default.resolve(n,o);try{return fs.readFileSync(ue,"utf-8"),ue}catch{}}let ee=Be__default.default.resolve(process.cwd(),o);try{return fs.readFileSync(ee,"utf-8"),ee}catch{return new URL(o,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),$=fs.readFileSync(f,"utf-8"),P=JSON.parse($).selectors,B=await this.strategyRegistry.loadStrategy(e,a?.strategyPath,n);if(!B)return null;let G=P.main;return e==="tabs"?new B(G,P):new B(G,P,r,i)}};});var de,gt=x(()=>{de=class{startTime=0;componentName="";staticPasses=0;staticFailures=0;staticWarnings=0;dynamicResults=[];totalTests=0;skipped=0;warnings=0;isPlaywright=false;isCustomContract=false;apgUrl="https://www.w3.org/WAI/ARIA/apg/";hasPrintedStaticSection=false;hasPrintedDynamicSection=false;constructor(e=false,t=false){this.isPlaywright=e,this.isCustomContract=t;}log(e){process.stderr.write(e+`
9
+ This indicates a problem with the combobox component's close functionality.`);this.selectors.input&&await e.locator(this.selectors.input).first().clear();}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var rt={};q(rt,{TabsComponentStrategy:()=>Re});var Re,it=x(()=>{Re=class{constructor(e,t){this.mainSelector=e;this.selectors=t;}async resetState(){}async shouldSkipTest(e,t){if(e.orientation!==void 0&&this.selectors.tablist){let r=this.selectors.tablist,n=await t.locator(r).first().getAttribute("aria-orientation");if(e.orientation!==n)return true}return false}getMainSelector(){return this.mainSelector}};});var nt={};q(nt,{RadioComponentStrategy:()=>Me});var Me,ot=x(()=>{Me=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.radio||!this.selectors.relative)return;let t=this.selectors.radio;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-checked")==="true"){await i.evaluate(o=>o.setAttribute("aria-checked","false"),{timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var at={};q(at,{CheckboxComponentStrategy:()=>xe});var xe,ct=x(()=>{xe=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.checkbox||!this.selectors.relative)return;let t=this.selectors.checkbox;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-checked")==="true"){await i.click({timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-checked","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var lt={};q(lt,{ToggleComponentStrategy:()=>Ee});var Ee,ut=x(()=>{Ee=class{constructor(e,t,r=400,i=400){this.mainSelector=e;this.selectors=t;this.actionTimeoutMs=r;this.assertionTimeoutMs=i;}async resetState(e){if(!this.selectors.toggle||!this.selectors.relative)return;let t=this.selectors.toggle;if(!t)return;let r=await e.locator(t).all();for(let i of r)if(await i.getAttribute("aria-pressed")==="true"){await i.click({timeout:this.actionTimeoutMs});let a=e.locator(`#${i}`);await test.expect(a).toHaveAttribute("aria-pressed","false",{timeout:this.assertionTimeoutMs}).catch(()=>{});}}async shouldSkipTest(){return false}getMainSelector(){return this.mainSelector}};});var pe,ft=x(()=>{pe=class{builtInStrategies=new Map;constructor(){this.registerBuiltInStrategies();}registerBuiltInStrategies(){this.builtInStrategies.set("menu",()=>Promise.resolve().then(()=>(Xe(),Qe)).then(e=>e.MenuComponentStrategy)),this.builtInStrategies.set("accordion",()=>Promise.resolve().then(()=>(et(),Ze)).then(e=>e.AccordionComponentStrategy)),this.builtInStrategies.set("combobox",()=>Promise.resolve().then(()=>(st(),tt)).then(e=>e.ComboboxComponentStrategy)),this.builtInStrategies.set("tabs",()=>Promise.resolve().then(()=>(it(),rt)).then(e=>e.TabsComponentStrategy)),this.builtInStrategies.set("radio",()=>Promise.resolve().then(()=>(ot(),nt)).then(e=>e.RadioComponentStrategy)),this.builtInStrategies.set("checkbox",()=>Promise.resolve().then(()=>(ct(),at)).then(e=>e.CheckboxComponentStrategy)),this.builtInStrategies.set("toggle",()=>Promise.resolve().then(()=>(ut(),lt)).then(e=>e.ToggleComponentStrategy));}async loadStrategy(e,t,r){try{if(t)try{let n=Be__default.default.isAbsolute(t)?t:Be__default.default.resolve(r||process.cwd(),t),a=await import(url.pathToFileURL(n).href),o=a.default||a;if(!o)throw new Error(`No default export found in ${t}`);return o}catch(n){throw new Error(`Failed to load custom strategy from ${t}: ${n instanceof Error?n.message:String(n)}`)}let i=this.builtInStrategies.get(e);return i?i():null}catch(i){throw new Error(`Strategy loading failed for ${e}: ${i instanceof Error?i.message:String(i)}`)}}has(e,t){return !!t||this.builtInStrategies.has(e)}};});var fe,gt=x(()=>{ft();fe=class{static strategyRegistry=new pe;static isComponentConfig(e){return typeof e=="object"&&e!==null}static async detect(e,t,r=400,i=400,n){let a=this.isComponentConfig(t)?t:void 0,o=a?.contractPath;if(!o)throw new Error(`Contract path not found for component: ${e}`);let p=(()=>{if(Be__default.default.isAbsolute(o))return o;if(n){let le=Be__default.default.resolve(n,o);try{return fs.readFileSync(le,"utf-8"),le}catch{}}let Z=Be__default.default.resolve(process.cwd(),o);try{return fs.readFileSync(Z,"utf-8"),Z}catch{return new URL(o,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),$=fs.readFileSync(p,"utf-8"),E=JSON.parse($).selectors,P=await this.strategyRegistry.loadStrategy(e,a?.strategyPath,n);if(!P)return null;let z=E.main;return e==="tabs"?new P(z,E):new P(z,E,r,i)}};});var ge,dt=x(()=>{ge=class{startTime=0;componentName="";staticPasses=0;staticFailures=0;staticWarnings=0;dynamicResults=[];totalTests=0;skipped=0;warnings=0;isPlaywright=false;isCustomContract=false;apgUrl="https://www.w3.org/WAI/ARIA/apg/";hasPrintedStaticSection=false;hasPrintedDynamicSection=false;constructor(e=false,t=false){this.isPlaywright=e,this.isCustomContract=t;}log(e){process.stderr.write(e+`
10
10
  `);}start(e,t,r){this.startTime=Date.now(),this.componentName=e,this.totalTests=t,this.hasPrintedStaticSection=false,this.hasPrintedDynamicSection=false,r&&(this.apgUrl=r);let i="Playwright (Real Browser)";this.log(`
11
11
  ${"\u2550".repeat(60)}`),this.log(`\u{1F50D} Testing ${e.charAt(0).toUpperCase()+e.slice(1)} Component - ${i}`),this.log(`${"\u2550".repeat(60)}
12
12
  `);}reportStatic(e,t,r=0){this.staticPasses=e,this.staticFailures=t,this.staticWarnings=r;}reportStaticTest(e,t,r,i){this.hasPrintedStaticSection||(this.log(`${"\u2500".repeat(60)}`),this.log("\u{1F9EA} Static Assertions"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedStaticSection=true);let n=t==="pass"?"\u2713":t==="warn"?"\u26A0":t==="skip"?"\u25CB":"\u2717";this.log(` ${n} ${e}`),i&&this.log(` \u21B3 level=${i}`),(t==="fail"||t==="warn"||t==="skip")&&r&&this.log(` \u21B3 ${r}`);}reportTest(e,t,r){this.hasPrintedDynamicSection||(this.log(""),this.log(`${"\u2500".repeat(60)}`),this.log("\u2328\uFE0F Dynamic Interaction Tests"),this.log(`${"\u2500".repeat(60)}`),this.hasPrintedDynamicSection=true);let i={description:e.description,status:t,failureMessage:r,level:e.level};t==="skip"&&(i.skipReason="Requires real browser (addEventListener events)"),this.dynamicResults.push(i);let n={pass:"\u2713",fail:"\u2717",warn:"\u26A0",skip:"\u25CB"},a=e.level?`[${e.level.toUpperCase()}] `:"";this.log(` ${n[t]} ${a}${e.description}`),t==="skip"&&!this.isPlaywright&&this.log(" \u21B3 Skipped (runs only in Playwright)"),t==="fail"&&r&&this.log(` \u21B3 ${r}`),t==="warn"&&r&&this.log(` \u21B3 ${r}`),t==="skip"&&r&&this.log(` \u21B3 ${r}`);}reportFailures(e){e.length!==0&&(this.log(`
@@ -21,62 +21,62 @@ ${"\u2500".repeat(60)}`),this.log(`\u2139\uFE0F Skipped Tests (${this.skipped})
21
21
  `),this.log("These tests use native keyboard events via addEventListener,"),this.log(`which only run in Playwright (real browser).
22
22
  `),e.forEach((t,r)=>{this.log(`${r+1}. ${t.description}`);}),this.log(`
23
23
  \u{1F4A1} Run with Playwright for full validation:`),this.log(` testUiComponent('${this.componentName}', null, 'http://localhost:5173/test-harness?component=component_name')
24
- `);}summary(e){let t=Date.now()-this.startTime,r=this.dynamicResults.filter(y=>y.status==="pass").length,i=this.dynamicResults.filter(y=>y.status==="fail").length,n=this.dynamicResults.filter(y=>y.status==="warn").length;this.skipped=this.dynamicResults.filter(y=>y.status==="skip").length,this.warnings=this.staticWarnings+n;let a=this.staticPasses+r,o=this.staticFailures+i,f=a+o+this.warnings,$=()=>{let y=`${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)}`;return this.isCustomContract?`${y} component validates against your custom accessibility policy \u2713`:`${y} component meets Aria-Ease baseline WAI-ARIA expectations \u2713`};return e.length>0&&this.reportFailures(e),this.reportWarnings(),this.reportSkipped(),this.log(`
24
+ `);}summary(e){let t=Date.now()-this.startTime,r=this.dynamicResults.filter(v=>v.status==="pass").length,i=this.dynamicResults.filter(v=>v.status==="fail").length,n=this.dynamicResults.filter(v=>v.status==="warn").length;this.skipped=this.dynamicResults.filter(v=>v.status==="skip").length,this.warnings=this.staticWarnings+n;let a=this.staticPasses+r,o=this.staticFailures+i,p=a+o+this.warnings,$=()=>{let v=`${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)}`;return this.isCustomContract?`${v} component validates against your custom accessibility policy \u2713`:`${v} component meets Aria-Ease baseline WAI-ARIA expectations \u2713`};return e.length>0&&this.reportFailures(e),this.reportWarnings(),this.reportSkipped(),this.log(`
25
25
  ${"\u2550".repeat(60)}`),this.log(`\u{1F4CA} Summary
26
- `),o===0&&this.skipped===0&&this.warnings===0?(this.log(`\u2705 All ${f} tests passed!`),this.log(` ${$()}`)):o===0?(this.log(`\u2705 ${a}/${f} tests passed`),this.skipped>0&&this.log(`\u25CB ${this.skipped} tests skipped`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.log(` ${$()}`)):(this.log(`\u274C ${o} test${o>1?"s":""} failed`),this.log(`\u2705 ${a} test${a>1?"s":""} passed`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.skipped>0&&this.log(`\u25CB ${this.skipped} test${this.skipped>1?"s":""} skipped`)),this.log(`\u23F1\uFE0F Duration: ${t}ms`),this.log(`${"\u2550".repeat(60)}
26
+ `),o===0&&this.skipped===0&&this.warnings===0?(this.log(`\u2705 All ${p} tests passed!`),this.log(` ${$()}`)):o===0?(this.log(`\u2705 ${a}/${p} tests passed`),this.skipped>0&&this.log(`\u25CB ${this.skipped} tests skipped`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.log(` ${$()}`)):(this.log(`\u274C ${o} test${o>1?"s":""} failed`),this.log(`\u2705 ${a} test${a>1?"s":""} passed`),this.warnings>0&&this.log(`\u26A0\uFE0F ${this.warnings} warning${this.warnings>1?"s":""}`),this.skipped>0&&this.log(`\u25CB ${this.skipped} test${this.skipped>1?"s":""} skipped`)),this.log(`\u23F1\uFE0F Duration: ${t}ms`),this.log(`${"\u2550".repeat(60)}
27
27
  `),o>0?(this.log("\u{1F527} Next Steps:"),this.log(" 1. Review the failures above"),this.log(" 2. Fix ARIA attributes and keyboard handlers"),this.log(` 3. Re-run tests to verify fixes
28
28
  `)):!this.isPlaywright&&this.skipped>0&&this.log(`\u2728 Optional: Run Playwright tests for complete validation
29
29
  `),{passes:a,failures:o,skipped:this.skipped,duration:t}}error(e,t){this.log(`
30
- \u274C Error: ${e}`),t&&this.log(` Context: ${t}`),this.log("");}};});var dt={};_(dt,{RelativeTargetResolver:()=>O});var O,me=x(()=>{O=class{static async resolve(e,t,r){let i=await e.locator(t).all();if(typeof r=="number")return i[r-1];switch(r){case "first":return i[0];case "second":return i[1];case "last":return i[i.length-1];case "next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])+1)%i.length;return i[a]}case "previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])-1+i.length)%i.length;return i[a]}default:return null}}};});var ne,mt=x(()=>{me();ne=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,t,r){try{if(e==="virtual"&&r){let n=this.selectors.main;if(!n)return {success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(n).first();return await a.count()?(await a.evaluate((f,$)=>{f.setAttribute("aria-activedescendant",$);},r),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return {success:!1,error:"Relative selector not defined for focus action."};let a=await O.resolve(this.page,n,t);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for focus.`}}let i=this.selectors[e];return i?(await this.page.locator(i).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to focus ${e}: ${i instanceof Error?i.message:String(i)}`}}}async type(e,t){try{let r=this.selectors[e];return r?(await this.page.locator(r).first().fill(t,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to type into ${e}: ${r instanceof Error?r.message:String(r)}`}}}async click(e,t){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for click action."};let n=await O.resolve(this.page,i,t);return n?(await n.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for click.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to click ${e}: ${r instanceof Error?r.message:String(r)}`}}}async keypress(e,t,r){try{let n={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[t]||t;if(n==="Space"?n=" ":n.includes(" ")&&(n=n.replace(/ /g,"")),e==="relative"){if(r==null)return {success:!1,error:"relativeTarget must be provided for relative keypress."};let $=this.selectors.relative;if(!$)return {success:!1,error:"Relative selector not defined for keypress action."};let y=await O.resolve(this.page,$,r);return y?(await y.press(n,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for keypress.`}}let a=this.selectors[e];if(!a)return {success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(n,{timeout:this.timeoutMs}),{success:!0})}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to press ${t} on ${e}: ${i instanceof Error?i.message:String(i)}`}}}async hover(e,t){try{if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for hover action."};let n=await O.resolve(this.page,i,t);return n?(await n.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for hover.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to hover ${e}: ${r instanceof Error?r.message:String(r)}`}}}};});var le,ht=x(()=>{me();le=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}async resolveTarget(e,t,r){try{if(e==="relative"){let n=r?this.selectors[r]:this.selectors.relative;if(!n)return {target:null,error:"Relative selector is not defined in the contract."};if(!t)return {target:null,error:"Relative target or expected value is not defined."};let a=await O.resolve(this.page,n,t);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let i=this.selectors[e];return i?{target:this.page.locator(i).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(i){return {target:null,error:`Failed to resolve target ${e}: ${i instanceof Error?i.message:String(i)}`}}}async validateVisibility(e,t,r,i,n){try{return r?(await test.expect(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is visible as expected. Test: "${n}".`}):(await test.expect(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is not visible as expected. Test: "${n}".`})}catch{let a=this.selectors[t]||"",o=await this.page.evaluate(f=>{let $=f?document.querySelector(f):null;if(!$)return "element not found";let y=window.getComputedStyle($);return `display:${y.display}, visibility:${y.visibility}, opacity:${y.opacity}`},a);return r?{success:false,failMessage:`${i} (actual: ${o})`}:{success:false,failMessage:`${i} ${t} is still visible (actual: ${o}).`}}}async validateAttribute(e,t,r,i,n,a){if(i==="!empty"){let $=await e.getAttribute(r);return $&&$.trim()!==""?{success:true,passMessage:`${t} has non-empty "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should not be empty, found "${$}".`}}if(typeof i!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",i),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(i)}`);let o=i.split(" | ").map($=>$.trim()),f=await e.getAttribute(r);return f!==null&&o.includes(f)?{success:true,passMessage:`${t} has expected "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should be "${i}", found "${f}".`}}async validateValue(e,t,r,i,n){let a=await e.inputValue().catch(()=>"");return r==="!empty"?a&&a.trim()!==""?{success:true,passMessage:`${t} has non-empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should not be empty, found "${a}".`}:r===""?a===""?{success:true,passMessage:`${t} has empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be empty, found "${a}".`}:a===r?{success:true,passMessage:`${t} has expected value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be "${r}", found "${a}".`}}async validateFocus(e,t,r,i,n){try{return r?(await test.expect(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} has focus as expected. Test: "${n}".`}):(await test.expect(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} does not have focus as expected. Test: "${n}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return {success:false,failMessage:`${i} (actual focus: ${a})`}}}async validateRole(e,t,r,i,n){let a=await e.getAttribute("role");return a===r?{success:true,passMessage:`${t} has role "${r}". Test: "${n}".`}:{success:false,failMessage:`${i} Expected role "${r}", found "${a}".`}}async validate(e,t){if(this.page.isClosed())return {success:false,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let r=null,i;if(e.controlledBy){let n=e.controlledBy,a=this.selectors[n.target];if(!a)return {success:false,failMessage:`Selector for controlledBy.target '${n.target}' not found.`,target:null};let o=null;if(n.relativeTarget?o=await O.resolve(this.page,a,n.relativeTarget):o=this.page.locator(a).first(),!o)return {success:false,failMessage:"Controlling element for controlledBy not found.",target:null};let f=n.attribute||"aria-controls",$=await o.getAttribute(f);if(!$)return {success:false,failMessage:`Controlling element does not have attribute '${f}'.`,target:null};if(r=this.page.locator(`#${$}`),!r||await r.count()===0)return {success:false,failMessage:`Controlled element with id '${$}' not found.`,target:null}}else {let n=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(r=n.target,i=n.error,i||!r)return {success:false,failMessage:i||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let n=await O.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=n?await n.getAttribute("id"):null,o=await r.getAttribute("aria-activedescendant");return a&&o===a?{success:true,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${t}".`}:{success:false,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case "toBeVisible":return this.validateVisibility(r,e.target,true,e.failureMessage||"",t);case "notToBeVisible":return this.validateVisibility(r,e.target,false,e.failureMessage||"",t);case "toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(r,e.target,e.attribute,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case "toHaveValue":return e.expectedValue!==void 0?this.validateValue(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveValue assertion"};case "toHaveFocus":return this.validateFocus(r,e.target,true,e.failureMessage||"",t);case "notToHaveFocus":return this.validateFocus(r,e.target,false,e.failureMessage||"",t);case "toHaveRole":return e.expectedValue!==void 0?this.validateRole(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return {success:false,failMessage:`Unknown assertion type: ${e.assertion}`}}}};});var yt={};_(yt,{runContractTestsPlaywright:()=>Dt});async function Dt(c,e,t,r,i){let n=r?.test?.components?.find(h=>h.name===c),a=!!n?.contractPath,o=new de(true,a),f={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},$=r?.test?.disableTimeouts===true,P=n?.disableTimeouts===true||$,B=(h,J,K)=>{if(P)return 0;let D=h??J;return typeof D!="number"||!Number.isFinite(D)||D<0?K:D},G=B(n?.actionTimeoutMs,r?.test?.actionTimeoutMs,f.actionTimeoutMs),ee=B(n?.assertionTimeoutMs,r?.test?.assertionTimeoutMs,f.assertionTimeoutMs),ue=B(n?.navigationTimeoutMs,r?.test?.navigationTimeoutMs,f.navigationTimeoutMs),ye=B(n?.componentReadyTimeoutMs,r?.test?.componentReadyTimeoutMs,f.componentReadyTimeoutMs),Ue=ce(t),te=n?.contractPath;if(!te)throw new Error(`Contract path not found for component: ${c}`);let St=(()=>{if(Be__default.default.isAbsolute(te))return te;if(i){let J=Be__default.default.resolve(i,te);try{return fs.readFileSync(J,"utf-8"),J}catch{}}let h=Be__default.default.resolve(process.cwd(),te);try{return fs.readFileSync(h,"utf-8"),h}catch{return new URL(te,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),$t=fs.readFileSync(St,"utf-8"),C=JSON.parse($t),Ct=(C.relationships?.length||0)+(C.static.length||0)+C.dynamic.length,kt=C.meta?.source?.apg,H=[],N=[],Y=[],I=[],T=null,E=(h,J)=>{let K=Z(J),D=Je(K,Ue);if(D==="error")return H.push(h),{status:"fail",level:K,detail:h};if(D==="warning")return N.push(h),{status:"warn",level:K,detail:h};let z=`${h} (ignored by strictness=${Ue}, level=${K})`;return I.push(z),{status:"skip",level:K,detail:z}};try{if(T=await qe(),e){try{await T.goto(e,{waitUntil:"domcontentloaded",timeout:ue});}catch(s){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${s instanceof Error?s.message:String(s)}`)}await T.addStyleTag({content:"* { transition: none !important; animation: none !important; }"});}let h=await ge.detect(c,n,G,ee,i);if(!h)throw new Error(`Unsupported component: ${c}`);let J=h.getMainSelector();if(!J)throw new Error(`CRITICAL: No selector found in contract for ${c}`);try{await T.locator(J).first().waitFor({state:"attached",timeout:ye});}catch(s){throw new Error(`
30
+ \u274C Error: ${e}`),t&&this.log(` Context: ${t}`),this.log("");}};});var mt={};q(mt,{RelativeTargetResolver:()=>D});var D,de=x(()=>{D=class{static async resolve(e,t,r){let i=await e.locator(t).all();if(typeof r=="number")return i[r-1];switch(r){case "first":return i[0];case "second":return i[1];case "last":return i[i.length-1];case "next":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])+1)%i.length;return i[a]}case "previous":{let a=(await e.evaluate(([o])=>Array.from(document.querySelectorAll(o)).indexOf(document.activeElement),[t])-1+i.length)%i.length;return i[a]}default:return null}}};});var ne,ht=x(()=>{de();ne=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}isBrowserClosedError(e){return e instanceof Error&&e.message.includes("Target page, context or browser has been closed")}async focus(e,t,r){try{if(e==="virtual"&&r){let n=this.selectors.main;if(!n)return {success:!1,error:"Main selector not defined for virtual focus."};let a=this.page.locator(n).first();return await a.count()?(await a.evaluate((p,$)=>{p.setAttribute("aria-activedescendant",$);},r),{success:!0}):{success:!1,error:"Main element not found for virtual focus."}}if(e==="relative"&&t){let n=this.selectors.relative;if(!n)return {success:!1,error:"Relative selector not defined for focus action."};let a=await D.resolve(this.page,n,t);return a?(await a.focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for focus.`}}let i=this.selectors[e];return i?(await this.page.locator(i).first().focus({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for focus target ${e} not found.`}}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to focus ${e}: ${i instanceof Error?i.message:String(i)}`}}}async type(e,t){try{let r=this.selectors[e];return r?(await this.page.locator(r).first().fill(t,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for type target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to type into ${e}: ${r instanceof Error?r.message:String(r)}`}}}async click(e,t){try{if(e==="document")return await this.page.mouse.click(10,10),{success:!0};if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for click action."};let n=await D.resolve(this.page,i,t);return n?(await n.click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for click.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().click({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for action target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to click ${e}: ${r instanceof Error?r.message:String(r)}`}}}async keypress(e,t,r){try{let n={Space:"Space",Enter:"Enter",Escape:"Escape","Arrow Up":"ArrowUp","Arrow Down":"ArrowDown","Arrow Left":"ArrowLeft","Arrow Right":"ArrowRight",Home:"Home",End:"End",Tab:"Tab"}[t]||t;if(n==="Space"?n=" ":n.includes(" ")&&(n=n.replace(/ /g,"")),e==="relative"){if(r==null)return {success:!1,error:"relativeTarget must be provided for relative keypress."};let $=this.selectors.relative;if(!$)return {success:!1,error:"Relative selector not defined for keypress action."};let v=await D.resolve(this.page,$,r);return v?(await v.press(n,{timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${r} for keypress.`}}let a=this.selectors[e];if(!a)return {success:!1,error:`Selector for keypress target ${e} not found.`};let o=this.page.locator(a).first();return await o.count()===0?{success:!1,error:`${e} element not found.`,shouldBreak:!0}:(await o.press(n,{timeout:this.timeoutMs}),{success:!0})}catch(i){return this.isBrowserClosedError(i)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to press ${t} on ${e}: ${i instanceof Error?i.message:String(i)}`}}}async hover(e,t){try{if(e==="relative"&&t){let i=this.selectors.relative;if(!i)return {success:!1,error:"Relative selector not defined for hover action."};let n=await D.resolve(this.page,i,t);return n?(await n.hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Could not resolve relative target ${t} for hover.`}}let r=this.selectors[e];return r?(await this.page.locator(r).first().hover({timeout:this.timeoutMs}),{success:!0}):{success:!1,error:`Selector for hover target ${e} not found.`}}catch(r){return this.isBrowserClosedError(r)?{success:false,error:"CRITICAL: Browser/page closed during test execution. Remaining actions skipped.",shouldBreak:true}:{success:false,error:`Failed to hover ${e}: ${r instanceof Error?r.message:String(r)}`}}}};});var ce,yt=x(()=>{de();ce=class{constructor(e,t,r=400){this.page=e;this.selectors=t;this.timeoutMs=r;}async resolveTarget(e,t,r){try{if(e==="relative"){let n=r?this.selectors[r]:this.selectors.relative;if(!n)return {target:null,error:"Relative selector is not defined in the contract."};if(!t)return {target:null,error:"Relative target or expected value is not defined."};let a=await D.resolve(this.page,n,t);return a?{target:a}:{target:null,error:`Target ${e} not found.`}}let i=this.selectors[e];return i?{target:this.page.locator(i).first()}:{target:null,error:`Selector for assertion target ${e} not found.`}}catch(i){return {target:null,error:`Failed to resolve target ${e}: ${i instanceof Error?i.message:String(i)}`}}}async validateVisibility(e,t,r,i,n){try{return r?(await test.expect(e).toBeVisible({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is visible as expected. Test: "${n}".`}):(await test.expect(e).toBeHidden({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} is not visible as expected. Test: "${n}".`})}catch{let a=this.selectors[t]||"",o=await this.page.evaluate(p=>{let $=p?document.querySelector(p):null;if(!$)return "element not found";let v=window.getComputedStyle($);return `display:${v.display}, visibility:${v.visibility}, opacity:${v.opacity}`},a);return r?{success:false,failMessage:`${i} (actual: ${o})`}:{success:false,failMessage:`${i} ${t} is still visible (actual: ${o}).`}}}async validateAttribute(e,t,r,i,n,a){if(i==="!empty"){let $=await e.getAttribute(r);return $&&$.trim()!==""?{success:true,passMessage:`${t} has non-empty "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should not be empty, found "${$}".`}}if(typeof i!="string")throw console.error("[AssertionRunner] expectedValue is not a string:",i),new Error(`AssertionRunner: expectedValue for attribute assertion must be a string, but got: ${JSON.stringify(i)}`);let o=i.split(" | ").map($=>$.trim()),p=await e.getAttribute(r);return p!==null&&o.includes(p)?{success:true,passMessage:`${t} has expected "${r}". Test: "${a}".`}:{success:false,failMessage:`${n} ${t} "${r}" should be "${i}", found "${p}".`}}async validateValue(e,t,r,i,n){let a=await e.inputValue().catch(()=>"");return r==="!empty"?a&&a.trim()!==""?{success:true,passMessage:`${t} has non-empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should not be empty, found "${a}".`}:r===""?a===""?{success:true,passMessage:`${t} has empty value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be empty, found "${a}".`}:a===r?{success:true,passMessage:`${t} has expected value. Test: "${n}".`}:{success:false,failMessage:`${i} ${t} value should be "${r}", found "${a}".`}}async validateFocus(e,t,r,i,n){try{return r?(await test.expect(e).toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} has focus as expected. Test: "${n}".`}):(await test.expect(e).not.toBeFocused({timeout:this.timeoutMs}),{success:!0,passMessage:`${t} does not have focus as expected. Test: "${n}".`})}catch{let a=await this.page.evaluate(()=>{let o=document.activeElement;return o?`${o.tagName}#${o.id||"no-id"}.${o.className||"no-class"}`:"no element focused"});return {success:false,failMessage:`${i} (actual focus: ${a})`}}}async validateRole(e,t,r,i,n){let a=await e.getAttribute("role");return a===r?{success:true,passMessage:`${t} has role "${r}". Test: "${n}".`}:{success:false,failMessage:`${i} Expected role "${r}", found "${a}".`}}async validate(e,t){if(this.page.isClosed())return {success:false,failMessage:"CRITICAL: Browser/page closed before completing all tests. Increase test timeout or reduce test complexity."};let r=null,i;if(e.controlledBy){let n=e.controlledBy,a=this.selectors[n.target];if(!a)return {success:false,failMessage:`Selector for controlledBy.target '${n.target}' not found.`,target:null};let o=null;if(n.relativeTarget?o=await D.resolve(this.page,a,n.relativeTarget):o=this.page.locator(a).first(),!o)return {success:false,failMessage:"Controlling element for controlledBy not found.",target:null};let p=n.attribute||"aria-controls",$=await o.getAttribute(p);if(!$)return {success:false,failMessage:`Controlling element does not have attribute '${p}'.`,target:null};if(r=this.page.locator(`#${$}`),!r||await r.count()===0)return {success:false,failMessage:`Controlled element with id '${$}' not found.`,target:null}}else {let n=await this.resolveTarget(e.target,e.relativeTarget||e.expectedValue,e.selectorKey);if(r=n.target,i=n.error,i||!r)return {success:false,failMessage:i||`Target ${e.target} not found.`,target:null}}if(e.target==="input"&&e.attribute==="aria-activedescendant"&&e.expectedValue==="!empty"&&e.relativeTarget&&e.selectorKey){let n=await D.resolve(this.page,this.selectors[e.selectorKey],e.relativeTarget),a=n?await n.getAttribute("id"):null,o=await r.getAttribute("aria-activedescendant");return a&&o===a?{success:true,passMessage:`input[aria-activedescendant] matches id of ${e.relativeTarget}(${e.selectorKey}). Test: "${t}".`}:{success:false,failMessage:`input[aria-activedescendant] should match id of ${e.relativeTarget}(${e.selectorKey}), found "${o}".`}}switch(e.assertion){case "toBeVisible":return this.validateVisibility(r,e.target,true,e.failureMessage||"",t);case "notToBeVisible":return this.validateVisibility(r,e.target,false,e.failureMessage||"",t);case "toHaveAttribute":return e.attribute&&e.expectedValue!==void 0?this.validateAttribute(r,e.target,e.attribute,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing attribute or expectedValue for toHaveAttribute assertion"};case "toHaveValue":return e.expectedValue!==void 0?this.validateValue(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveValue assertion"};case "toHaveFocus":return this.validateFocus(r,e.target,true,e.failureMessage||"",t);case "notToHaveFocus":return this.validateFocus(r,e.target,false,e.failureMessage||"",t);case "toHaveRole":return e.expectedValue!==void 0?this.validateRole(r,e.target,e.expectedValue,e.failureMessage||"",t):{success:false,failMessage:"Missing expectedValue for toHaveRole assertion"};default:return {success:false,failMessage:`Unknown assertion type: ${e.assertion}`}}}};});var vt={};q(vt,{runContractTestsPlaywright:()=>qt});async function qt(c,e,t,r,i){let n=r?.test?.components?.find(m=>m.name===c),a=!!n?.contractPath,o=new ge(true,a),p={actionTimeoutMs:400,assertionTimeoutMs:400,navigationTimeoutMs:3e4,componentReadyTimeoutMs:5e3},$=r?.test?.disableTimeouts===true,E=n?.disableTimeouts===true||$,P=(m,_,J)=>{if(E)return 0;let j=m??_;return typeof j!="number"||!Number.isFinite(j)||j<0?J:j},z=P(n?.actionTimeoutMs,r?.test?.actionTimeoutMs,p.actionTimeoutMs),Z=P(n?.assertionTimeoutMs,r?.test?.assertionTimeoutMs,p.assertionTimeoutMs),le=P(n?.navigationTimeoutMs,r?.test?.navigationTimeoutMs,p.navigationTimeoutMs),he=P(n?.componentReadyTimeoutMs,r?.test?.componentReadyTimeoutMs,p.componentReadyTimeoutMs),Ue=ae(t),ee=n?.contractPath;if(!ee)throw new Error(`Contract path not found for component: ${c}`);let $t=(()=>{if(Be__default.default.isAbsolute(ee))return ee;if(i){let _=Be__default.default.resolve(i,ee);try{return fs.readFileSync(_,"utf-8"),_}catch{}}let m=Be__default.default.resolve(process.cwd(),ee);try{return fs.readFileSync(m,"utf-8"),m}catch{return new URL(ee,(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))).pathname}})(),Ct=fs.readFileSync($t,"utf-8"),C=JSON.parse(Ct),kt=(C.relationships?.length||0)+(C.static.length||0)+C.dynamic.length,At=C.meta?.source?.apg,W=[],Y=[],Q=[],B=[],T=null,I=(m,_)=>{let J=ie(_),j=Ke(J,Ue);if(j==="error")return W.push(m),{status:"fail",level:J,detail:m};if(j==="warning")return Y.push(m),{status:"warn",level:J,detail:m};let K=`${m} (ignored by strictness=${Ue}, level=${J})`;return B.push(K),{status:"skip",level:J,detail:K}},Rt=m=>m&&typeof m=="object"&&m.success===true;try{if(T=await _e(),e){try{await T.goto(e,{waitUntil:"domcontentloaded",timeout:le});}catch(s){throw new Error(`Failed to navigate to ${e}. Ensure dev server is running and accessible. Original error: ${s instanceof Error?s.message:String(s)}`)}await T.addStyleTag({content:"* { transition: none !important; animation: none !important; }"});}let m=await fe.detect(c,n,z,Z,i);if(!m)throw new Error(`Unsupported component: ${c}`);let _=m.getMainSelector();if(!_)throw new Error(`CRITICAL: No selector found in contract for ${c}`);try{await T.locator(_).first().waitFor({state:"attached",timeout:he});}catch(s){throw new Error(`
31
31
  \u274C CRITICAL: Component not found on page!
32
32
  This usually means:
33
33
  - The component didn't render
34
34
  - The URL is incorrect
35
- - The component selector '${J}' in the contract is wrong
36
- - Original error: ${s}`)}o.start(c,Ct,kt),c==="menu"&&C.selectors.main&&await T.locator(C.selectors.main).first().waitFor({state:"visible",timeout:ye}).catch(()=>{});let K=c==="menu"&&C.selectors.submenuTrigger?await T.locator(C.selectors.submenuTrigger).count()>0:!1,D=s=>s.type==="aria-reference"&&[s.from,s.to].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||""))||s.type==="contains"&&[s.parent,s.child].some(g=>["submenu","submenuTrigger","submenuItems"].includes(g||"")),z=0,F=0,V=0;for(let s of C.relationships||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(m){N.push(`Warning: resetState failed before relationship test: ${m instanceof Error?m.message:String(m)}`);}let g=Z(s.level);if(Array.isArray(s.setup)&&s.setup.length>0){let S=function(p){return v.includes(p)};var je=S;let m=new ne(T,C.selectors,G),R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,v=["focus","type","click","keypress","hover"],w=p=>({...p,type:S(p.type)?p.type:"click"}),k=s.setup.map(w),M=await ve(k,m,h,T,R,["submenu","submenuTrigger","submenuItems"]);if(M.skip){I.push(M.message||"Setup action skipped"),o.reportStaticTest(R,"skip",M.message,g);continue}if(!M.success){let p=`Relationship setup failed: ${M.error}`,u=E(p,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(R,u.status,u.detail,u.level);continue}}if(c==="menu"&&!K&&D(s)){let R=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,v="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";I.push(v),o.reportStaticTest(R,"skip",v,g);continue}if(s.type==="aria-reference"){let m=`${s.from}.${s.attribute} references ${s.to}`,R=C.selectors[s.from],v=C.selectors[s.to];if(!R||!v){let d=E(`Relationship selector missing: from="${s.from}" or to="${s.to}" not found in selectors.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let S=T.locator(R).first(),w=T.locator(v).first(),k=await S.count()>0,M=await w.count()>0;if(!k||!M){if(c==="menu"&&D(s)){let U="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";I.push(U),o.reportStaticTest(m,"skip",U,g);continue}let d=E(`Relationship target not found: ${k?s.to:s.from}.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}let p=await S.getAttribute(s.attribute),u=await w.getAttribute("id");if(!u){let d=E(`Relationship target "${s.to}" must have an id for ${s.attribute} validation.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}if(!(p||"").split(/\s+/).filter(Boolean).includes(u)){let d=E(`Expected ${s.from} ${s.attribute} to reference id "${u}", found "${p||""}".`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(m,d.status,d.detail,d.level);continue}Y.push(`Relationship valid: ${s.from}.${s.attribute} -> ${s.to} (id=${u}).`),z+=1,o.reportStaticTest(m,"pass",void 0,g);continue}if(s.type==="contains"){let m=`${s.parent} contains ${s.child}`,R=C.selectors[s.parent],v=C.selectors[s.child];if(!R||!v){let p=E(`Relationship selector missing: parent="${s.parent}" or child="${s.child}" not found in selectors.`,s.level);p.status==="fail"&&(F+=1),p.status==="warn"&&(V+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}let S=T.locator(R).first();if(!(await S.count()>0)){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";I.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=E(`Relationship parent target not found: ${s.parent}.`,s.level);p.status==="fail"&&(F+=1),p.status==="warn"&&(V+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}if(await S.locator(v).count()<1){if(c==="menu"&&D(s)){let u="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";I.push(u),o.reportStaticTest(m,"skip",u,g);continue}let p=E(`Expected ${s.parent} to contain descendant matching selector for ${s.child}.`,s.level);p.status==="fail"&&(F+=1),p.status==="warn"&&(V+=1),o.reportStaticTest(m,p.status,p.detail,p.level);continue}Y.push(`Relationship valid: ${s.parent} contains ${s.child}.`),z+=1,o.reportStaticTest(m,"pass",void 0,g);}}async function He(s,g,m,R={}){if(!s||typeof s!="object"||!("ref"in s))return s;let v;if(s.ref==="relative"){if(!s.relativeTarget||!R.relativeBaseSelector)return;let S=m.locator(R.relativeBaseSelector),w=await S.count(),k=0;if(s.relativeTarget==="first"?k=0:s.relativeTarget==="second"?k=1:s.relativeTarget==="last"?k=w-1:isNaN(Number(s.relativeTarget))?k=0:k=Number(s.relativeTarget),k<0||k>=w)return;let M=S.nth(k);return await De(M,s.property||s.attribute)}else {if(v=g[s.ref],!v)throw new Error(`Selector for ref '${s.ref}' not found in contract selectors.`);let S=m.locator(v).first();return await De(S,s.property||s.attribute)}}async function De(s,g){if(s)return !g||g==="id"?await s.getAttribute("id")??void 0:g==="class"?await s.getAttribute("class")??void 0:g==="textContent"?await s.evaluate(m=>m.textContent??void 0):g.startsWith("aria-")?await s.getAttribute(g)??void 0:g.endsWith("*")?await s.evaluate(R=>{let v=[];for(let S of Array.from(R.attributes))S.name.startsWith("aria-")&&v.push(`${S.name}=${S.value}`);return v.join(";")}):await s.getAttribute(g)??void 0}let At=new le(T,C.selectors,ee);async function ve(s,g,m,R,v,S=[]){if(!Array.isArray(s)||s.length===0)return {success:!0};m&&typeof m.resetState=="function"&&await m.resetState(R);for(let w of s){let k={success:!0};try{if(w.type==="focus")w.target==="relative"&&w.relativeTarget?k=await g.focus("relative",w.relativeTarget):k=await g.focus(w.target);else if(w.type==="type"&&w.value)k=await g.type(w.target,w.value);else if(w.type==="click")k=await g.click(w.target,w.relativeTarget);else if(w.type==="keypress"&&w.key)k=await g.keypress(w.target,w.key,w.relativeTarget);else if(w.type==="hover")k=await g.hover(w.target,w.relativeTarget);else continue}catch(M){k={success:!1,error:M instanceof Error?M.message:String(M)};}if(!k.success){let M=k.error||"Setup action failed";return S.some(u=>v.includes(u)||M.includes(u))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${M}`}:{success:!1,error:M}}}return {success:!0}}for(let s of C.static||[]){if(h&&typeof h.resetState=="function")try{await h.resetState(T);}catch(p){N.push(`Warning: resetState failed before static test: ${p instanceof Error?p.message:String(p)}`);}if(s.target==="relative")continue;let g=`${s.target}${s.attribute?` (${s.attribute})`:""}`,m=Z(s.level);if(c==="menu"&&s.target==="submenuTrigger"&&!K){let p=`Skipping submenu static assertion for ${s.target}: no submenu capability detected in rendered component.`;I.push(p),o.reportStaticTest(g,"skip",p,m);continue}let R=[];if(s.target||R.push("target"),s.attribute||R.push("attribute"),typeof s.expectedValue>"u"&&R.push("expectedValue"),R.length>0){let p=`${s.target||""}${s.attribute?` (${s.attribute})`:""}`,u=`Static assertion missing required field(s): ${R.join(", ")}`,b=E(u,s.level);b.status==="fail"&&(F+=1),b.status==="warn"&&(V+=1),o.reportStaticTest(p,b.status,b.detail,b.level);continue}if(Array.isArray(s.setup)&&s.setup.length>0){let b=function(l){return u.includes(l)};var je=b;let p=new ne(T,C.selectors,G),u=["focus","type","click","keypress","hover"],W=l=>({...l,type:b(l.type)?l.type:"click"}),d=s.setup.map(W),U=await ve(d,p,h,T,g,["submenu","submenuTrigger","submenuItems"]);if(U.skip){I.push(U.message||"Setup action skipped"),o.reportStaticTest(g,"skip",U.message,m);continue}if(!U.success){let l=`Static setup failed: ${U.error}`,A=E(l,s.level);A.status==="fail"&&(F+=1),A.status==="warn"&&(V+=1),o.reportStaticTest(g,A.status,A.detail,A.level);continue}}let v=C.selectors[s.target];if(!v){let p=`Selector for target ${s.target} not found.`,u=E(p,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let S=T.locator(v).first();if(!(await S.count()>0)){let p=`Target ${s.target} not found.`,u=E(p,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(g,u.status,u.detail,u.level);continue}let k=(p,u,b)=>{let W=new RegExp(`\\[${u}(?:=["']?([^\\]"']+)["']?)?\\]`),d=p.match(W);if(!d)return !1;if(!b)return !0;let U=d[1];return U?b.split(" | ").includes(U):!1},M=s.expectedValue;if(s.expectedValue&&typeof s.expectedValue=="object"&&"ref"in s.expectedValue){let p={},u=s.relativeTarget;if(s.expectedValue.ref==="relative"&&s.target==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}else if(s.expectedValue.ref==="relative"&&u){let b=C.selectors[u];if(!b)throw new Error(`Selector for relativeTarget '${u}' not found in contract selectors.`);p.relativeBaseSelector=b;}M=await He(s.expectedValue,C.selectors,T,p);}if(s.expectedValue)if(k(v,s.attribute,typeof M=="string"?M:void 0))Y.push(`${s.attribute}="${M}" on ${s.target} verified by selector (already present in: ${v}).`),z+=1,o.reportStaticTest(g,"pass",void 0,m);else {let p=M??"",u=await At.validateAttribute(S,s.target,s.attribute,p,s.failureMessage,"Static ARIA Test");if(u.success&&u.passMessage)Y.push(u.passMessage),z+=1,o.reportStaticTest(g,"pass",void 0,m);else if(!u.success&&u.failMessage){let b=E(u.failMessage,s.level);b.status==="fail"&&(F+=1),b.status==="warn"&&(V+=1),o.reportStaticTest(g,b.status,b.detail,b.level);}}else {let p=s.attribute.split(" | "),u=!1,b=!0;for(let W of p){let d=W.trim();if(k(v,d)){Y.push(`${d} on ${s.target} verified by selector (already present in: ${v}).`),u=!0;continue}if(b=!1,await S.getAttribute(d)!==null){u=!0;break}}if(!u&&!b){let W=s.failureMessage+` None of the attributes "${s.attribute}" are present.`,d=E(W,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(g,d.status,d.detail,d.level);}else !b&&u?(Y.push(`At least one of the attributes "${s.attribute}" exists on the element.`),z+=1,o.reportStaticTest(g,"pass",void 0,m)):(z+=1,o.reportStaticTest(g,"pass",void 0,m));}}for(let s of C.dynamic||[]){if(!s.assertions||s.assertions.length===0){let l="Skipping test - no assertions found for this dynamic test.";I.push(l),o.reportTest({description:s.description,level:Z(s.level)},"skip",l);continue}if(!T||T.isClosed()){console.warn(`
35
+ - The component selector '${_}' in the contract is wrong
36
+ - Original error: ${s}`)}o.start(c,kt,At),c==="menu"&&C.selectors.main&&await T.locator(C.selectors.main).first().waitFor({state:"visible",timeout:he}).catch(()=>{});let J=c==="menu"&&C.selectors.submenuTrigger?await T.locator(C.selectors.submenuTrigger).count()>0:!1,j=s=>s.type==="aria-reference"&&[s.from,s.to].some(f=>["submenu","submenuTrigger","submenuItems"].includes(f||""))||s.type==="contains"&&[s.parent,s.child].some(f=>["submenu","submenuTrigger","submenuItems"].includes(f||"")),K=0,F=0,V=0;for(let s of C.relationships||[]){if(m&&typeof m.resetState=="function")try{await m.resetState(T);}catch(h){Y.push(`Warning: resetState failed before relationship test: ${h instanceof Error?h.message:String(h)}`);}let f=ie(s.level);if(Array.isArray(s.setup)&&s.setup.length>0){let S=function(u){return y.includes(u)};var je=S;let h=new ne(T,C.selectors,z),A=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,y=["focus","type","click","keypress","hover"],w=u=>({...u,type:S(u.type)?u.type:"click"}),k=s.setup.map(w),R=await ye(k,h,m,T,A,["submenu","submenuTrigger","submenuItems"]);if(R.skip){B.push(R.message||"Setup action skipped"),o.reportStaticTest(A,"skip",R.message,f);continue}if(!R.success){let u=`Relationship setup failed: ${R.error}`,l=I(u,s.level);l.status==="fail"&&(F+=1),l.status==="warn"&&(V+=1),o.reportStaticTest(A,l.status,l.detail,l.level);continue}}if(c==="menu"&&!J&&j(s)){let A=s.type==="aria-reference"?`${s.from}.${s.attribute} references ${s.to}`:`${s.parent} contains ${s.child}`,y="Skipping submenu relationship assertion: no submenu capability detected in rendered component.";B.push(y),o.reportStaticTest(A,"skip",y,f);continue}if(s.type==="aria-reference"){let h=`${s.from}.${s.attribute} references ${s.to}`,A=C.selectors[s.from],y=C.selectors[s.to];if(!A||!y){let d=I(`Relationship selector missing: from="${s.from}" or to="${s.to}" not found in selectors.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(h,d.status,d.detail,d.level);continue}let S=T.locator(A).first(),w=T.locator(y).first(),k=await S.count()>0,R=await w.count()>0;if(!k||!R){if(c==="menu"&&j(s)){let U="Skipping submenu relationship assertion in static phase: submenu elements are not present until submenu is opened.";B.push(U),o.reportStaticTest(h,"skip",U,f);continue}let d=I(`Relationship target not found: ${k?s.to:s.from}.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(h,d.status,d.detail,d.level);continue}let u=await S.getAttribute(s.attribute),l=await w.getAttribute("id");if(!l){let d=I(`Relationship target "${s.to}" must have an id for ${s.attribute} validation.`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(h,d.status,d.detail,d.level);continue}if(!(u||"").split(/\s+/).filter(Boolean).includes(l)){let d=I(`Expected ${s.from} ${s.attribute} to reference id "${l}", found "${u||""}".`,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(h,d.status,d.detail,d.level);continue}Q.push(`Relationship valid: ${s.from}.${s.attribute} -> ${s.to} (id=${l}).`),K+=1,o.reportStaticTest(h,"pass",void 0,f);continue}if(s.type==="contains"){let h=`${s.parent} contains ${s.child}`,A=C.selectors[s.parent],y=C.selectors[s.child];if(!A||!y){let u=I(`Relationship selector missing: parent="${s.parent}" or child="${s.child}" not found in selectors.`,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(h,u.status,u.detail,u.level);continue}let S=T.locator(A).first();if(!(await S.count()>0)){if(c==="menu"&&j(s)){let l="Skipping submenu relationship assertion in static phase: submenu container is not present until submenu is opened.";B.push(l),o.reportStaticTest(h,"skip",l,f);continue}let u=I(`Relationship parent target not found: ${s.parent}.`,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(h,u.status,u.detail,u.level);continue}if(await S.locator(y).count()<1){if(c==="menu"&&j(s)){let l="Skipping submenu relationship assertion in static phase: submenu descendants are not present until submenu is opened.";B.push(l),o.reportStaticTest(h,"skip",l,f);continue}let u=I(`Expected ${s.parent} to contain descendant matching selector for ${s.child}.`,s.level);u.status==="fail"&&(F+=1),u.status==="warn"&&(V+=1),o.reportStaticTest(h,u.status,u.detail,u.level);continue}Q.push(`Relationship valid: ${s.parent} contains ${s.child}.`),K+=1,o.reportStaticTest(h,"pass",void 0,f);}}async function He(s,f,h,A={}){if(!s||typeof s!="object"||!("ref"in s))return s;let y;if(s.ref==="relative"){if(!s.relativeTarget||!A.relativeBaseSelector)return;let S=h.locator(A.relativeBaseSelector),w=await S.count(),k=0;if(s.relativeTarget==="first"?k=0:s.relativeTarget==="second"?k=1:s.relativeTarget==="last"?k=w-1:isNaN(Number(s.relativeTarget))?k=0:k=Number(s.relativeTarget),k<0||k>=w)return;let R=S.nth(k);return await De(R,s.property||s.attribute)}else {if(y=f[s.ref],!y)throw new Error(`Selector for ref '${s.ref}' not found in contract selectors.`);let S=h.locator(y).first();return await De(S,s.property||s.attribute)}}async function De(s,f){if(s)return !f||f==="id"?await s.getAttribute("id")??void 0:f==="class"?await s.getAttribute("class")??void 0:f==="textContent"?await s.evaluate(h=>h.textContent??void 0):f.startsWith("aria-")?await s.getAttribute(f)??void 0:f.endsWith("*")?await s.evaluate(A=>{let y=[];for(let S of Array.from(A.attributes))S.name.startsWith("aria-")&&y.push(`${S.name}=${S.value}`);return y.join(";")}):await s.getAttribute(f)??void 0}let Mt=new ce(T,C.selectors,Z);async function ye(s,f,h,A,y,S=[]){if(!Array.isArray(s)||s.length===0)return {success:!0};h&&typeof h.resetState=="function"&&await h.resetState(A);for(let w of s){let k={success:!0};try{if(w.type==="focus")w.target==="relative"&&w.relativeTarget?k=await f.focus("relative",w.relativeTarget):k=await f.focus(w.target);else if(w.type==="type"&&w.value)k=await f.type(w.target,w.value);else if(w.type==="click")k=await f.click(w.target,w.relativeTarget);else if(w.type==="keypress"&&w.key)k=await f.keypress(w.target,w.key,w.relativeTarget);else if(w.type==="hover")k=await f.hover(w.target,w.relativeTarget);else continue}catch(R){k={success:!1,error:R instanceof Error?R.message:String(R)};}if(!k.success){let R=k.error||"Setup action failed";return S.some(l=>y.includes(l)||R.includes(l))?{success:!1,skip:!0,message:`Skipping test - capability not present: ${R}`}:{success:!1,error:R}}}return {success:!0}}for(let s of C.static||[]){if(m&&typeof m.resetState=="function")try{await m.resetState(T);}catch(u){Y.push(`Warning: resetState failed before static test: ${u instanceof Error?u.message:String(u)}`);}if(s.target==="relative")continue;let f=`${s.target}${s.attribute?` (${s.attribute})`:""}`,h=ie(s.level);if(c==="menu"&&s.target==="submenuTrigger"&&!J){let u=`Skipping submenu static assertion for ${s.target}: no submenu capability detected in rendered component.`;B.push(u),o.reportStaticTest(f,"skip",u,h);continue}let A=[];if(s.target||A.push("target"),s.attribute||A.push("attribute"),typeof s.expectedValue>"u"&&A.push("expectedValue"),A.length>0){let u=`${s.target||""}${s.attribute?` (${s.attribute})`:""}`,l=`Static assertion missing required field(s): ${A.join(", ")}`,b=I(l,s.level);b.status==="fail"&&(F+=1),b.status==="warn"&&(V+=1),o.reportStaticTest(u,b.status,b.detail,b.level);continue}if(Array.isArray(s.setup)&&s.setup.length>0){let b=function(G){return l.includes(G)};var je=b;let u=new ne(T,C.selectors,z),l=["focus","type","click","keypress","hover"],H=G=>({...G,type:b(G.type)?G.type:"click"}),d=s.setup.map(H),U=await ye(d,u,m,T,f,["submenu","submenuTrigger","submenuItems"]);if(U.skip){B.push(U.message||"Setup action skipped"),o.reportStaticTest(f,"skip",U.message,h);continue}if(!U.success){let G=`Static setup failed: ${U.error}`,X=I(G,s.level);X.status==="fail"&&(F+=1),X.status==="warn"&&(V+=1),o.reportStaticTest(f,X.status,X.detail,X.level);continue}}let y=C.selectors[s.target];if(!y){let u=`Selector for target ${s.target} not found.`,l=I(u,s.level);l.status==="fail"&&(F+=1),l.status==="warn"&&(V+=1),o.reportStaticTest(f,l.status,l.detail,l.level);continue}let S=T.locator(y).first();if(!(await S.count()>0)){let u=`Target ${s.target} not found.`,l=I(u,s.level);l.status==="fail"&&(F+=1),l.status==="warn"&&(V+=1),o.reportStaticTest(f,l.status,l.detail,l.level);continue}let k=(u,l,b)=>{let H=new RegExp(`\\[${l}(?:=["']?([^\\]"']+)["']?)?\\]`),d=u.match(H);if(!d)return !1;if(!b)return !0;let U=d[1];return U?b.split(" | ").includes(U):!1},R=s.expectedValue;if(s.expectedValue&&typeof s.expectedValue=="object"&&"ref"in s.expectedValue){let u={},l=s.relativeTarget;if(s.expectedValue.ref==="relative"&&s.target==="relative"&&l){let b=C.selectors[l];if(!b)throw new Error(`Selector for relativeTarget '${l}' not found in contract selectors.`);u.relativeBaseSelector=b;}else if(s.expectedValue.ref==="relative"&&l){let b=C.selectors[l];if(!b)throw new Error(`Selector for relativeTarget '${l}' not found in contract selectors.`);u.relativeBaseSelector=b;}R=await He(s.expectedValue,C.selectors,T,u);}if(s.expectedValue)if(k(y,s.attribute,typeof R=="string"?R:void 0))Q.push(`${s.attribute}="${R}" on ${s.target} verified by selector (already present in: ${y}).`),K+=1,o.reportStaticTest(f,"pass",void 0,h);else {let u=R??"",l=await Mt.validateAttribute(S,s.target,s.attribute,u,s.failureMessage,"Static ARIA Test");if(l.success&&l.passMessage)Q.push(l.passMessage),K+=1,o.reportStaticTest(f,"pass",void 0,h);else if(!l.success&&l.failMessage){let b=I(l.failMessage,s.level);b.status==="fail"&&(F+=1),b.status==="warn"&&(V+=1),o.reportStaticTest(f,b.status,b.detail,b.level);}}else {let u=s.attribute.split(" | "),l=!1,b=!0;for(let H of u){let d=H.trim();if(k(y,d)){Q.push(`${d} on ${s.target} verified by selector (already present in: ${y}).`),l=!0;continue}if(b=!1,await S.getAttribute(d)!==null){l=!0;break}}if(!l&&!b){let H=s.failureMessage+` None of the attributes "${s.attribute}" are present.`,d=I(H,s.level);d.status==="fail"&&(F+=1),d.status==="warn"&&(V+=1),o.reportStaticTest(f,d.status,d.detail,d.level);}else !b&&l?(Q.push(`At least one of the attributes "${s.attribute}" exists on the element.`),K+=1,o.reportStaticTest(f,"pass",void 0,h)):(K+=1,o.reportStaticTest(f,"pass",void 0,h));}}for(let s of C.dynamic||[]){if(!s.assertions||s.assertions.length===0){let g="Skipping test - no assertions found for this dynamic test.";B.push(g),o.reportTest({description:s.description,level:ie(s.level)},"skip",g);continue}if(!T||T.isClosed()){console.warn(`
37
37
  \u26A0\uFE0F Browser closed - skipping remaining ${C.dynamic.length-C.dynamic.indexOf(s)} tests
38
- `),H.push(`CRITICAL: Browser/page closed before completing all tests. ${C.dynamic.length-C.dynamic.indexOf(s)} tests skipped.`);break}try{await h.resetState(T);}catch(l){let A=l instanceof Error?l.message:String(l);throw o.error(A),l}let{setup:g=[],action:m,assertions:R}=s,v=Z(s.level),S=new ne(T,C.selectors,G);if(Array.isArray(g)&&g.length>0){let A=function(j){return l.includes(j)};var je=A;let l=["focus","type","click","keypress","hover"],se=j=>({...j,type:A(j.type)?j.type:"click"}),we=g.map(se),q=await ve(we,S,h,T,s.description,["submenu","submenuTrigger","submenuItems"]);if(q.skip){I.push(q.message||"Setup action skipped"),o.reportTest({description:s.description,level:v},"skip",q.message);continue}if(!q.success){let j=E(`Setup failed: ${q.error}`,s.level);o.reportTest({description:s.description,level:v},j.status,j.detail);continue}}let w=H.length,k=N.length,M=I.length;if(await h.shouldSkipTest(s,T)){let l="Skipping test - component-specific conditions not met";I.push(l),o.reportTest({description:s.description,level:v},"skip",l);continue}let u=new le(T,C.selectors,ee),b=!1,W=null;for(let l of m){if(!T||T.isClosed()){H.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),b=!0;break}let A;if(l.type==="focus")l.target==="relative"&&l.relativeTarget?A=await S.focus("relative",l.relativeTarget):A=await S.focus(l.target);else if(l.type==="type"&&l.value)A=await S.type(l.target,l.value);else if(l.type==="click")A=await S.click(l.target,l.relativeTarget);else if(l.type==="keypress"&&l.key)A=await S.keypress(l.target,l.key,l.relativeTarget);else if(l.type==="hover")A=await S.hover(l.target,l.relativeTarget);else continue;if(!A.success){if(A.error){let se=E(A.error,s.level);W={status:se.status,detail:se.detail};}b=!0;break}}if(b){o.reportTest({description:s.description,level:v},W?.status||"fail",W?.detail||H[H.length-1]);continue}for(let l of R){let A;if(l.expectedValue&&typeof l.expectedValue=="object"&&"ref"in l.expectedValue)if(l.expectedValue.ref==="relative"){let{RelativeTargetResolver:Q}=await Promise.resolve().then(()=>(me(),dt)),j=C.selectors.relative;if(!j)throw new Error("Relative selector not defined in contract selectors.");let ae=l.relativeTarget||"first",X=await Q.resolve(T,j,ae);if(!X)throw new Error(`Could not resolve relative target '${ae}' for expectedValue.`);let Oe=l.expectedValue.property||l.expectedValue.attribute||"id";if(Oe==="textContent")A=await X.evaluate(pe=>pe.textContent??void 0);else {let pe=await X.getAttribute(Oe);A=pe===null?void 0:pe;}}else A=await He(l.expectedValue,C.selectors,T,{});else typeof l.expectedValue=="string"||typeof l.expectedValue>"u"?A=l.expectedValue:A="";let se={...l,expectedValue:A},we=A??"",q=await u.validate({...se,expectedValue:we},s.description);if(q.success&&q.passMessage)Y.push(q.passMessage);else if(!q.success&&q.failMessage){let Q=[];if(l.target||Q.push("target"),l.assertion||Q.push("assertion"),["toHaveAttribute","toHaveValue","toHaveRole"].includes(l.assertion)&&(typeof l.attribute>"u"&&l.assertion==="toHaveAttribute"&&Q.push("attribute"),typeof l.expectedValue>"u"&&Q.push("expectedValue")),Q.length>0){let j=Z(l.level||s.level),ae=`Dynamic assertion missing required field(s): ${Q.join(", ")}`,X=E(ae,j);if(X.status==="skip")continue;H.push(ae),o.reportTest({description:s.description,level:j},X.status,X.detail);continue}}}let d=H.length,U=N.length,We=I.length;d>w?o.reportTest({description:s.description,level:v},"fail",H[H.length-1]):U>k?o.reportTest({description:s.description,level:v},"warn",N[N.length-1]):We>M?o.reportTest({description:s.description,level:v},"skip",I[I.length-1]):o.reportTest({description:s.description,level:v},"pass");}o.reportStatic(z,F,V),o.summary(H);}catch(h){if(h instanceof Error)throw h.message.includes("Executable doesn't exist")||h.message.includes("browserType.launch")?new Error(`
38
+ `),W.push(`CRITICAL: Browser/page closed before completing all tests. ${C.dynamic.length-C.dynamic.indexOf(s)} tests skipped.`);break}try{await m.resetState(T);}catch(g){let M=g instanceof Error?g.message:String(g);throw o.error(M),g}let{setup:f=[],action:h,assertions:A}=s,y=ie(s.level),S=new ne(T,C.selectors,z);if(Array.isArray(f)&&f.length>0){let M=function(O){return g.includes(O)};var je=M;let g=["focus","type","click","keypress","hover"],te=O=>({...O,type:M(O.type)?O.type:"click"}),ve=f.map(te),N=await ye(ve,S,m,T,s.description,["submenu","submenuTrigger","submenuItems"]);if(N.skip){B.push(N.message||"Setup action skipped"),o.reportTest({description:s.description,level:y},"skip",N.message);continue}if(!N.success){let O=I(`Setup failed: ${N.error}`,s.level);o.reportTest({description:s.description,level:y},O.status,O.detail);continue}}let w=W.length,k=Y.length,R=B.length;if(await m.shouldSkipTest(s,T)){let g="Skipping test - component-specific conditions not met";B.push(g),o.reportTest({description:s.description,level:y},"skip",g);continue}let l=new ce(T,C.selectors,Z),b=!1,H=null;for(let g of h){if(!T||T.isClosed()){W.push("CRITICAL: Browser/page closed during test execution. Remaining actions skipped."),b=!0;break}let M;if(g.type==="focus")g.target==="relative"&&g.relativeTarget?M=await S.focus("relative",g.relativeTarget):M=await S.focus(g.target);else if(g.type==="type"&&g.value)M=await S.type(g.target,g.value);else if(g.type==="click")M=await S.click(g.target,g.relativeTarget);else if(g.type==="keypress"&&g.key)M=await S.keypress(g.target,g.key,g.relativeTarget);else if(g.type==="hover")M=await S.hover(g.target,g.relativeTarget);else continue;if(!M.success){if(M.error){let te=I(M.error,s.level);H={status:te.status,detail:te.detail};}b=!0;break}}if(b){o.reportTest({description:s.description,level:y},H?.status||"fail",H?.detail||W[W.length-1]);continue}let d=!1,U="";for(let g of A){let M;if(g.expectedValue&&typeof g.expectedValue=="object"&&"ref"in g.expectedValue)if(g.expectedValue.ref==="relative"){let{RelativeTargetResolver:xt}=await Promise.resolve().then(()=>(de(),mt)),O=C.selectors.relative;if(!O)throw new Error("Relative selector not defined in contract selectors.");let Oe=g.relativeTarget||"first",we=await xt.resolve(T,O,Oe);if(!we)throw new Error(`Could not resolve relative target '${Oe}' for expectedValue.`);let qe=g.expectedValue.property||g.expectedValue.attribute||"id";if(qe==="textContent")M=await we.evaluate(ue=>ue.textContent??void 0);else {let ue=await we.getAttribute(qe);M=ue===null?void 0:ue;}}else M=await He(g.expectedValue,C.selectors,T,{});else typeof g.expectedValue=="string"||typeof g.expectedValue>"u"?M=g.expectedValue:M="";let te={...g,expectedValue:M},ve=M??"",N=await l.validate({...te,expectedValue:ve},s.description);Rt(N)?Q.push(N.passMessage):(d=!0,U=N.failMessage||"Assertion failed.");}if(d){o.reportTest({description:s.description,level:y},"fail",U);continue}let We=W.length,G=Y.length,X=B.length;We>w?o.reportTest({description:s.description,level:y},"fail",W[W.length-1]):G>k?o.reportTest({description:s.description,level:y},"warn",Y[Y.length-1]):X>R?o.reportTest({description:s.description,level:y},"skip",B[B.length-1]):o.reportTest({description:s.description,level:y},"pass");}o.reportStatic(K,F,V),o.summary(W);}catch(m){if(m instanceof Error)throw m.message.includes("Executable doesn't exist")||m.message.includes("browserType.launch")?new Error(`
39
39
  \u274C CRITICAL: Playwright browsers not found!
40
- \u{1F4E6} Run: npx playwright install chromium`):h.message.includes("net::ERR_CONNECTION_REFUSED")||h.message.includes("NS_ERROR_CONNECTION_REFUSED")?new Error(`
40
+ \u{1F4E6} Run: npx playwright install chromium`):m.message.includes("net::ERR_CONNECTION_REFUSED")||m.message.includes("NS_ERROR_CONNECTION_REFUSED")?new Error(`
41
41
  \u274C CRITICAL: Cannot connect to dev server!
42
- Make sure your dev server is running at ${e}`):h.message.includes("Timeout")&&h.message.includes("waitFor")?new Error(`
42
+ Make sure your dev server is running at ${e}`):m.message.includes("Timeout")&&m.message.includes("waitFor")?new Error(`
43
43
  \u274C CRITICAL: Component not found on page!
44
- The component selector could not be found within ${ye}ms.
44
+ The component selector could not be found within ${he}ms.
45
45
  This usually means:
46
46
  - The component didn't render
47
47
  - The URL is incorrect
48
48
  - The component selector was not provided to the component utility, or a wrong selector was used
49
- `):h.message.includes("Target page, context or browser has been closed")?new Error(`
49
+ `):m.message.includes("Target page, context or browser has been closed")?new Error(`
50
50
  \u274C CRITICAL: Browser/page was closed unexpectedly!
51
51
  This usually means:
52
52
  - The test timeout was too short
53
53
  - The browser crashed
54
- - An external process killed the browser`):h}finally{T&&await T.close();}return {passes:Y,failures:H,skipped:I,warnings:N}}var vt=x(()=>{be();ft();gt();mt();ht();Te();});var wt={};_(wt,{BADGE_CONFIGS:()=>Ve,displayAllBadges:()=>Kt,displayBadgeInfo:()=>qt,getBadgeMarkdown:()=>oe,promptAddBadge:()=>_t});function oe(c){let e=Ve[c];return `[![${e.label}](${e.markdownUrl})](https://github.com/aria-ease/aria-ease)`}function qt(c){let e=oe(c);console.log(L__default.default.cyan(`
54
+ - An external process killed the browser`):m}finally{T&&await T.close();}return {passes:Q,failures:W,skipped:B,warnings:Y}}var wt=x(()=>{be();gt();dt();ht();yt();Te();});var bt={};q(bt,{BADGE_CONFIGS:()=>Ve,displayAllBadges:()=>Nt,displayBadgeInfo:()=>Kt,getBadgeMarkdown:()=>oe,promptAddBadge:()=>zt});function oe(c){let e=Ve[c];return `[![${e.label}](${e.markdownUrl})](https://github.com/aria-ease/aria-ease)`}function Kt(c){let e=oe(c);console.log(L__default.default.cyan(`
55
55
  \u{1F3C5} Show your accessibility commitment!`)),console.log(L__default.default.white(` Add this badge to your README.md:
56
56
  `)),console.log(L__default.default.green(" "+e)),console.log(L__default.default.dim(`
57
57
  This helps others discover accessibility tools and shows you care!
58
- `));}async function _t(c,e=process.cwd()){let t=Be__default.default.join(e,"README.md");if(!await Fe__default.default.pathExists(t)){console.log(L__default.default.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let i=await Fe__default.default.readFile(t,"utf-8"),n=oe(c);if(i.includes(n)||i.includes(Ve[c].fileName)){console.log(L__default.default.gray(" \u2713 Badge already in README.md"));return}let a=Ot__default.default.createInterface({input:process.stdin,output:process.stdout}),o=await new Promise(f=>{a.question(L__default.default.cyan(" Add badge to README.md now? (y/n): "),$=>{a.close(),f($.toLowerCase().trim());});});o==="y"||o==="yes"?(await Jt(t,i,n),console.log(L__default.default.green(" \u2713 Badge added to README.md!"))):console.log(L__default.default.gray(" Skipped. You can add it manually anytime."));}async function Jt(c,e,t){let r=e.split(`
58
+ `));}async function zt(c,e=process.cwd()){let t=Be__default.default.join(e,"README.md");if(!await Fe__default.default.pathExists(t)){console.log(L__default.default.yellow(" \u2139\uFE0F No README.md found in current directory"));return}let i=await Fe__default.default.readFile(t,"utf-8"),n=oe(c);if(i.includes(n)||i.includes(Ve[c].fileName)){console.log(L__default.default.gray(" \u2713 Badge already in README.md"));return}let a=Jt__default.default.createInterface({input:process.stdin,output:process.stdout}),o=await new Promise(p=>{a.question(L__default.default.cyan(" Add badge to README.md now? (y/n): "),$=>{a.close(),p($.toLowerCase().trim());});});o==="y"||o==="yes"?(await Gt(t,i,n),console.log(L__default.default.green(" \u2713 Badge added to README.md!"))):console.log(L__default.default.gray(" Skipped. You can add it manually anytime."));}async function Gt(c,e,t){let r=e.split(`
59
59
  `),i=0;for(let n=0;n<r.length;n++){let a=r[n].trim();if(a.startsWith("[![")||a.startsWith("[!")){i=n+1;continue}if(i>0&&!a.startsWith("[![")&&!a.startsWith("[!")&&a.length>0)break;if(i===0&&a.startsWith("#")){i=n+2;break}}i===0&&(i=1),r.splice(i,0,t),await Fe__default.default.writeFile(c,r.join(`
60
- `),"utf-8");}function Kt(){console.log(L__default.default.cyan(`
60
+ `),"utf-8");}function Nt(){console.log(L__default.default.cyan(`
61
61
  \u{1F4CD} Available badges:`)),console.log(L__default.default.white(`
62
62
  For audits:`)),console.log(L__default.default.green(" "+oe("audit"))),console.log(L__default.default.white(`
63
63
  For component testing:`)),console.log(L__default.default.green(" "+oe("component"))),console.log(L__default.default.white(`
64
- For both (verified):`)),console.log(L__default.default.green(" "+oe("verified"))),console.log("");}var Ve,bt=x(()=>{Ve={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}};});be();Te();async function Gt(c,e,t={}){if(!c||typeof c!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let r={violations:[]};async function i(y){try{let P=await fetch(y,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(P.ok||P.status===304)return y}catch{return null}return null}let n=ce(t.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:y}=await Promise.resolve().then(()=>(Ne(),Ge)),P=await y(process.cwd());if(a=P.config,P.configPath&&(o=Be__default.default.dirname(P.configPath)),t.strictness===void 0){let B=a.test?.components?.find(G=>G?.name===c)?.strictness;n=ce(B??a.test?.strictness);}}catch{t.strictness===void 0&&(n="balanced");}let f;try{if(e){let y=await i(e);if(y){console.log(`\u{1F3AD} Running Playwright tests on ${y}`);let{runContractTestsPlaywright:P}=await Promise.resolve().then(()=>(vt(),yt));f=await P(c,y,n,a,o);}else throw new Error(`\u274C Dev server not running at ${e}
65
- 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(y){throw y instanceof Error?y:new Error(`\u274C Contract test execution failed: ${String(y)}`)}let $={violations:r.violations,raw:r,contract:f};if(f.failures.length>0&&e==="Playwright")throw new Error(`
66
- \u274C ${f.failures.length} accessibility contract test${f.failures.length>1?"s":""} failed (Playwright mode)
67
- \u2705 ${f.passes.length} test${f.passes.length>1?"s":""} passed
64
+ For both (verified):`)),console.log(L__default.default.green(" "+oe("verified"))),console.log("");}var Ve,Tt=x(()=>{Ve={audit:{type:"audit",fileName:"audited-by-aria-ease.svg",label:"Audited by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/audited-by-aria-ease.svg"},component:{type:"component",fileName:"components-tested-aria-ease.svg",label:"Components tested: aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/components-tested-aria-ease.svg"},verified:{type:"verified",fileName:"verified-by-aria-ease.svg",label:"Verified by aria-ease",markdownUrl:"https://cdn.jsdelivr.net/gh/aria-ease/aria-ease@main/badges/verified-by-aria-ease.svg"}};});be();Te();async function Qt(c,e,t={}){if(!c||typeof c!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let r={violations:[]};async function i(v){try{let E=await fetch(v,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(E.ok||E.status===304)return v}catch{return null}return null}let n=ae(t.strictness),a={},o=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:v}=await Promise.resolve().then(()=>(Ye(),Ne)),E=await v(process.cwd());if(a=E.config,E.configPath&&(o=Be__default.default.dirname(E.configPath)),t.strictness===void 0){let P=a.test?.components?.find(z=>z?.name===c)?.strictness;n=ae(P??a.test?.strictness);}}catch{t.strictness===void 0&&(n="balanced");}let p;try{if(e){let v=await i(e);if(v){console.log(`\u{1F3AD} Running Playwright tests on ${v}`);let{runContractTestsPlaywright:E}=await Promise.resolve().then(()=>(wt(),vt));p=await E(c,v,n,a,o);}else throw new Error(`\u274C Dev server not running at ${e}
65
+ 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(v){throw v instanceof Error?v:new Error(`\u274C Contract test execution failed: ${String(v)}`)}let $={violations:r.violations,raw:r,contract:p};if(p.failures.length>0&&e==="Playwright")throw new Error(`
66
+ \u274C ${p.failures.length} accessibility contract test${p.failures.length>1?"s":""} failed (Playwright mode)
67
+ \u2705 ${p.passes.length} test${p.passes.length>1?"s":""} passed
68
68
 
69
69
  \u{1F4CB} Review the detailed test report above for specific failures.
70
- \u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(r.violations.length>0){let y=r.violations.length,P=r.violations.map(B=>`
71
- - ${B.id}: ${B.description}
72
- Impact: ${B.impact}
73
- Affected elements: ${B.nodes.length}
74
- Help: ${B.helpUrl}`).join(`
70
+ \u{1F4A1} Contract tests validate ARIA attributes and keyboard interactions per W3C APG guidelines.`);if(r.violations.length>0){let v=r.violations.length,E=r.violations.map(P=>`
71
+ - ${P.id}: ${P.description}
72
+ Impact: ${P.impact}
73
+ Affected elements: ${P.nodes.length}
74
+ Help: ${P.helpUrl}`).join(`
75
75
  `);throw new Error(`
76
- \u274C ${y} axe accessibility violation${y>1?"s":""} detected
77
- ${P}
76
+ \u274C ${v} axe accessibility violation${v>1?"s":""} detected
77
+ ${E}
78
78
 
79
79
  \u{1F4CB} Full details available in result.violations`)}return $}exports.runTest=async()=>({passes:[],failures:[],skipped:[]});typeof window>"u"&&(exports.runTest=async()=>{console.log(`\u{1F680} Running component accessibility tests...
80
- `);let{exec:c}=await import('child_process'),e=(await import('chalk')).default;return new Promise((t,r)=>{c("npx vitest --run --reporter verbose",async(i,n,a)=>{if(console.log(n),a&&console.error(a),!i||i.code===0){try{let{displayBadgeInfo:f,promptAddBadge:$}=await Promise.resolve().then(()=>(bt(),wt));f("component"),await $("component",process.cwd()),console.log(e.dim(`
80
+ `);let{exec:c}=await import('child_process'),e=(await import('chalk')).default;return new Promise((t,r)=>{c("npx vitest --run --reporter verbose",async(i,n,a)=>{if(console.log(n),a&&console.error(a),!i||i.code===0){try{let{displayBadgeInfo:p,promptAddBadge:$}=await Promise.resolve().then(()=>(Tt(),bt));p("component"),await $("component",process.cwd()),console.log(e.dim(`
81
81
  `+"\u2500".repeat(60))),console.log(e.cyan("\u{1F499} Found aria-ease helpful?")),console.log(e.white(" \u2022 Star us on GitHub: ")+e.blue.underline("https://github.com/aria-ease/aria-ease")),console.log(e.white(" \u2022 Share feedback: ")+e.blue.underline("https://github.com/aria-ease/aria-ease/discussions")),console.log(e.dim("\u2500".repeat(60)+`
82
- `));}catch(f){console.error("Warning: Could not display badge prompt:",f);}t({passes:[],failures:[],skipped:[]}),process.exit(0);}else {let f=i?.code||1;r(new Error(`Tests failed with code ${f}`)),process.exit(f);}});})});async function Nt(){await _e();}exports.cleanupTests=Nt;exports.testUiComponent=Gt;
82
+ `));}catch(p){console.error("Warning: Could not display badge prompt:",p);}t({passes:[],failures:[],skipped:[]}),process.exit(0);}else {let p=i?.code||1;r(new Error(`Tests failed with code ${p}`)),process.exit(p);}});})});async function Xt(){await Je();}exports.cleanupTests=Xt;exports.testUiComponent=Qt;
@@ -5,9 +5,9 @@ interface JestAxeResult {
5
5
  }
6
6
 
7
7
  interface ContractTestResult {
8
- passes: string[];
9
- failures: string[];
10
- skipped: string[];
8
+ passes: string[];
9
+ failures: string[];
10
+ skipped: string[];
11
11
  warnings?: string[];
12
12
  }
13
13
 
@@ -5,9 +5,9 @@ interface JestAxeResult {
5
5
  }
6
6
 
7
7
  interface ContractTestResult {
8
- passes: string[];
9
- failures: string[];
10
- skipped: string[];
8
+ passes: string[];
9
+ failures: string[];
10
+ skipped: string[];
11
11
  warnings?: string[];
12
12
  }
13
13
 
@@ -1,4 +1,4 @@
1
- import {d,b}from'./chunk-APUMBDOT.js';import m from'path';async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=d(c.strictness),o={},d$1=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import('./configLoader-NCYRL2O6.js'),n=await t(process.cwd());if(o=n.config,n.configPath&&(d$1=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=d(r??o.test?.strictness);}}catch{c.strictness===void 0&&(p="balanced");}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import('./contractTestRunnerPlaywright-ZKVK7KUM.js');s=await n(a,t,p,o,d$1);}else throw new Error(`\u274C Dev server not running at ${e}
1
+ import {d,b}from'./chunk-APUMBDOT.js';import m from'path';async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=d(c.strictness),o={},d$1=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import('./configLoader-NCYRL2O6.js'),n=await t(process.cwd());if(o=n.config,n.configPath&&(d$1=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=d(r??o.test?.strictness);}}catch{c.strictness===void 0&&(p="balanced");}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import('./contractTestRunnerPlaywright-7ERFIHCM.js');s=await n(a,t,p,o,d$1);}else throw new Error(`\u274C Dev server not running at ${e}
2
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(t){throw t instanceof Error?t:new Error(`\u274C Contract test execution failed: ${String(t)}`)}let u={violations:i.violations,raw:i,contract:s};if(s.failures.length>0&&e==="Playwright")throw new Error(`
3
3
  \u274C ${s.failures.length} accessibility contract test${s.failures.length>1?"s":""} failed (Playwright mode)
4
4
  \u2705 ${s.passes.length} test${s.passes.length>1?"s":""} passed
@@ -1,4 +1,4 @@
1
- import{b as g,d as f}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";import m from"path";async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=f(c.strictness),o={},d=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import("./configLoader-ZXTSCIP6.js"),n=await t(process.cwd());if(o=n.config,n.configPath&&(d=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=f(r??o.test?.strictness)}}catch{c.strictness===void 0&&(p="balanced")}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import("./contractTestRunnerPlaywright-CJFYO766.js");s=await n(a,t,p,o,d)}else throw new Error(`\u274C Dev server not running at ${e}
1
+ import{b as g,d as f}from"./chunk-APUMBDOT.js";import"./chunk-CNU4N4AY.js";import m from"path";async function y(a,e,c={}){if(!a||typeof a!="string")throw new Error("\u274C testUiComponent requires a valid componentName (string)");if(!e)throw new Error("\u274C testUiComponent requires a URL");if(e&&typeof e!="string")throw new Error("\u274C testUiComponent url parameter must be a string");let i={violations:[]};async function l(t){try{let n=await fetch(t,{method:"HEAD",signal:AbortSignal.timeout(1e3)});if(n.ok||n.status===304)return t}catch{return null}return null}let p=f(c.strictness),o={},d=typeof process<"u"?process.cwd():"";if(typeof process<"u"&&typeof process.cwd=="function")try{let{loadConfig:t}=await import("./configLoader-ZXTSCIP6.js"),n=await t(process.cwd());if(o=n.config,n.configPath&&(d=m.dirname(n.configPath)),c.strictness===void 0){let r=o.test?.components?.find(h=>h?.name===a)?.strictness;p=f(r??o.test?.strictness)}}catch{c.strictness===void 0&&(p="balanced")}let s;try{if(e){let t=await l(e);if(t){console.log(`\u{1F3AD} Running Playwright tests on ${t}`);let{runContractTestsPlaywright:n}=await import("./contractTestRunnerPlaywright-FECB4HSX.js");s=await n(a,t,p,o,d)}else throw new Error(`\u274C Dev server not running at ${e}
2
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(t){throw t instanceof Error?t:new Error(`\u274C Contract test execution failed: ${String(t)}`)}let u={violations:i.violations,raw:i,contract:s};if(s.failures.length>0&&e==="Playwright")throw new Error(`
3
3
  \u274C ${s.failures.length} accessibility contract test${s.failures.length>1?"s":""} failed (Playwright mode)
4
4
  \u2705 ${s.passes.length} test${s.passes.length>1?"s":""} passed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "7.8.0",
3
+ "version": "7.8.1",
4
4
  "description": "Accessibility infrastructure for the entire frontend engineering lifecycle. Build accessible patterns, run automated audits, verify component interactions, and gate deployments — all in one system.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",