@dev-blinq/cucumber_client 1.0.1284-dev → 1.0.1286-dev

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.
@@ -1,4 +1,4 @@
1
- var Ar=class{getActualParent(t){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");let n=t.parentElement;if(n)return n;let r=t.parentNode;return r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host||null}getFullAncestorChain(t){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");let n=[],r=t;for(;r;)n.push(r),r=this.getActualParent(r);return n}getFullAncestorChainToRoot(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid root provided");if(!this.containsElementCrossShadow(n,t))throw new Error("Root does not contain the element");let r=[],o=t;for(;o&&o!==n&&this.containsElementCrossShadow(n,o);)r.push(o),o=this.getActualParent(o);return o===n&&r.push(o),r}getClimbCountToParent(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid target parent provided");let r=0,o=t;for(;o&&o!==n;)o=this.getActualParent(o),r++;return o===n?r:-1}containsElementCrossShadow(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid target provided");let r=n;for(;r;){if(r===t)return!0;r=this.getActualParent(r)}return!1}findLowestCommonAncestor(t){if(!Array.isArray(t)||t.length===0)throw new Error("Invalid elements array provided");for(let r of t)if(!(r instanceof Element))throw new Error("All items in the array must be DOM Elements");let n=this.getFullAncestorChain(t[0]);n.reverse();for(let r=1;r<t.length;r++){let o=this.getFullAncestorChain(t[r]);o.reverse(),n=n.filter(u=>o.includes(u))}return n.length>0?n[n.length-1]:null}findBranchingParent(t,n){if(!Array.isArray(t)||t.length===0)throw new Error("Invalid elements array provided");if(!(n instanceof Element))throw new Error("Target must be a DOM Element");for(let u of t)if(!(u instanceof Element))throw new Error("All items in the array must be DOM Elements");if(!t.includes(n))return console.warn("Target element must be included in the elements array, returning null"),null;let r=this.getFullAncestorChain(n);r.reverse();let o=null;for(let u of r){let l=t.filter(h=>this.containsElementCrossShadow(u,h));if(l.length===1&&l[0]===n){o=u;break}}return o||null}},Ai=Ar;var Ha=Object.defineProperty;var Nt=(e,t)=>{for(var n in t)Ha(e,n,{get:t[n],enumerable:!0})};var Wa={};Nt(Wa,{__PW:()=>Me});var Ji={};Nt(Ji,{elementMatchesText:()=>an,elementText:()=>Ee,getElementLabels:()=>bs,matchesAttributePart:()=>ys,matchesComponentAttribute:()=>ms,shouldSkipForTextMatching:()=>er});var zi={};Nt(zi,{cacheNormalizedWhitespaces:()=>Yi,escapeForAttributeSelector:()=>Ne,escapeForTextSelector:()=>Ae,escapeHTML:()=>Ja,escapeHTMLAttribute:()=>Ga,escapeRegExp:()=>Zt,escapeTemplateString:()=>Ka,escapeWithQuotes:()=>nn,isString:()=>Va,longestCommonSubstring:()=>eo,normalizeEscapedRegexQuotes:()=>rn,normalizeWhiteSpace:()=>ve,quoteCSSAttributeValue:()=>et,toSnakeCase:()=>Wr,toTitleCase:()=>Xt,trimString:()=>Xi,trimStringWithEllipsis:()=>Mr});function nn(e,t="'"){let n=JSON.stringify(e),r=n.substring(1,n.length-1).replace(/\\"/g,'"');if(t==="'")return t+r.replace(/[']/g,"\\'")+t;if(t==='"')return t+r.replace(/["]/g,'\\"')+t;if(t==="`")return t+r.replace(/[`]/g,"`")+t;throw new Error("Invalid escape char")}function Ka(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Va(e){return typeof e=="string"||e instanceof String}function Xt(e){return e.charAt(0).toUpperCase()+e.substring(1)}function Wr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function et(e){return`"${e.replace(/["\\]/g,t=>"\\"+t)}"`}var Kt;function Yi(){Kt=new Map}function ve(e){let t=Kt==null?void 0:Kt.get(e);return t===void 0&&(t=e.replace(/[\u200b\u00ad]/g,"").trim().replace(/\s+/g," "),Kt==null||Kt.set(e,t)),t}function rn(e){return e.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}function Qi(e){return e.unicode||e.unicodeSets?String(e):String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\$3").replace(/>>/g,"\\>\\>")}function Ae(e,t){return typeof e!="string"?Qi(e):`${JSON.stringify(e)}${t?"s":"i"}`}function Ne(e,t){return typeof e!="string"?Qi(e):`"${e.replace(/\\/g,"\\\\").replace(/["]/g,'\\"')}"${t?"s":"i"}`}function Xi(e,t,n=""){if(e.length<=t)return e;let r=[...e];return r.length>t?r.slice(0,t-n.length).join("")+n:r.join("")}function Mr(e,t){return Xi(e,t,"\u2026")}function Zt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Zi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ga(e){return e.replace(/[&<>"']/ug,t=>Zi[t])}function Ja(e){return e.replace(/[&<]/ug,t=>Zi[t])}function eo(e,t){let n=e.length,r=t.length,o=0,u=0,l=Array(n+1).fill(null).map(()=>Array(r+1).fill(0));for(let h=1;h<=n;h++)for(let p=1;p<=r;p++)e[h-1]===t[p-1]&&(l[h][p]=l[h-1][p-1]+1,l[h][p]>o&&(o=l[h][p],u=h));return e.slice(u-o,u)}var to={};Nt(to,{beginAriaCaches:()=>Xn,endAriaCaches:()=>Zn,getAriaChecked:()=>ns,getAriaDisabled:()=>tn,getAriaExpanded:()=>is,getAriaLabelledByElements:()=>es,getAriaLevel:()=>os,getAriaPressed:()=>ss,getAriaRole:()=>ue,getAriaSelected:()=>ts,getCSSContent:()=>_t,getCheckedAllowMixed:()=>Io,getCheckedWithoutMixed:()=>Lo,getElementAccessibleDescription:()=>Rr,getElementAccessibleErrorMessage:()=>Co,getElementAccessibleName:()=>At,getReadonly:()=>Oo,isElementHiddenForAria:()=>Ce,isElementIgnoredForAria:()=>Zr,kAriaCheckedRoles:()=>Jn,kAriaDisabledRoles:()=>as,kAriaExpandedRoles:()=>Yn,kAriaLevelRoles:()=>Qn,kAriaPressedRoles:()=>zn,kAriaSelectedRoles:()=>Gn,receivesPointerEvents:()=>Po});var ce=function(e,t,n){return e>=t&&e<=n};function xe(e){return ce(e,48,57)}function Ni(e){return xe(e)||ce(e,65,70)||ce(e,97,102)}function za(e){return ce(e,65,90)}function Ya(e){return ce(e,97,122)}function Qa(e){return za(e)||Ya(e)}function Xa(e){return e>=128}function Un(e){return Qa(e)||Xa(e)||e===95}function Ci(e){return Un(e)||xe(e)||e===45}function Za(e){return ce(e,0,8)||e===11||ce(e,14,31)||e===127}function Et(e){return e===10}function De(e){return Et(e)||e===9||e===32}var ec=1114111,Kr=class extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}};function tc(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===13&&e.charCodeAt(n+1)===10&&(r=10,n++),(r===13||r===12)&&(r=10),r===0&&(r=65533),ce(r,55296,56319)&&ce(e.charCodeAt(n+1),56320,57343)){let o=r-55296,u=e.charCodeAt(n+1)-56320;r=Math.pow(2,16)+o*Math.pow(2,10)+u,n++}t.push(r)}return t}function le(e){if(e<=65535)return String.fromCharCode(e);e-=Math.pow(2,16);let t=Math.floor(e/Math.pow(2,10))+55296,n=e%Math.pow(2,10)+56320;return String.fromCharCode(t)+String.fromCharCode(n)}function no(e){let t=tc(e),n=-1,r=[],o,u=0,l=0,h=0,p=function(){u+=1,h=l,l=0},b={line:u,column:l},v=function(q){return q>=t.length?-1:t[q]},m=function(q){if(q===void 0&&(q=1),q>3)throw"Spec Error: no more than three codepoints of lookahead.";return v(n+q)},y=function(q){return q===void 0&&(q=1),n+=q,o=v(n),Et(o)?p():l+=q,!0},w=function(){return n-=1,Et(o)?(u-=1,l=h):l-=1,b.line=u,b.column=l,!0},A=function(q){return q===void 0&&(q=o),q===-1},I=function(){},$=function(){},U=function(){if(B(),y(),De(o)){for(;De(m());)y();return new Wn}else{if(o===34)return ne();if(o===35)if(Ci(m())||ke(m(1),m(2))){let q=new mo("");return se(m(1),m(2),m(3))&&(q.type="id"),q.value=Je(),q}else return new fe(o);else return o===36?m()===61?(y(),new ic):new fe(o):o===39?ne():o===40?new fo:o===41?new Vr:o===42?m()===61?(y(),new oc):new fe(o):o===43?rt()?(w(),V()):new fe(o):o===44?new co:o===45?rt()?(w(),V()):m(1)===45&&m(2)===62?(y(2),new io):we()?(w(),te()):new fe(o):o===46?rt()?(w(),V()):new fe(o):o===58?new oo:o===59?new ao:o===60?m(1)===33&&m(2)===45&&m(3)===45?(y(3),new so):new fe(o):o===64?se(m(1),m(2),m(3))?new go(Je()):new fe(o):o===91?new ho:o===92?D()?(w(),te()):($(),new fe(o)):o===93?new Pr:o===94?m()===61?(y(),new sc):new fe(o):o===123?new lo:o===124?m()===61?(y(),new rc):m()===124?(y(),new po):new fe(o):o===125?new uo:o===126?m()===61?(y(),new nc):new fe(o):xe(o)?(w(),V()):Un(o)?(w(),te()):A()?new jn:new fe(o)}},B=function(){for(;m(1)===47&&m(2)===42;)for(y(2);;)if(y(),o===42&&m()===47){y();break}else if(A()){$();return}},V=function(){let q=ln();if(se(m(1),m(2),m(3))){let J=new ac;return J.value=q.value,J.repr=q.repr,J.type=q.type,J.unit=Je(),J}else if(m()===37){y();let J=new vo;return J.value=q.value,J.repr=q.repr,J}else{let J=new bo;return J.value=q.value,J.repr=q.repr,J.type=q.type,J}},te=function(){let q=Je();if(q.toLowerCase()==="url"&&m()===40){for(y();De(m(1))&&De(m(2));)y();return m()===34||m()===39?new Jt(q):De(m())&&(m(2)===34||m(2)===39)?new Jt(q):ee()}else return m()===40?(y(),new Jt(q)):new Gr(q)},ne=function(q){q===void 0&&(q=o);let J="";for(;y();){if(o===q||A())return new Jr(J);if(Et(o))return $(),w(),new ro;o===92?A(m())?I():Et(m())?y():J+=le(ie()):J+=le(o)}throw new Error("Internal error")},ee=function(){let q=new yo("");for(;De(m());)y();if(A(m()))return q;for(;y();){if(o===41||A())return q;if(De(o)){for(;De(m());)y();return m()===41||A(m())?(y(),q):(me(),new Bn)}else{if(o===34||o===39||o===40||Za(o))return $(),me(),new Bn;if(o===92)if(D())q.value+=le(ie());else return $(),me(),new Bn;else q.value+=le(o)}}throw new Error("Internal error")},ie=function(){if(y(),Ni(o)){let q=[o];for(let ye=0;ye<5&&Ni(m());ye++)y(),q.push(o);De(m())&&y();let J=parseInt(q.map(function(ye){return String.fromCharCode(ye)}).join(""),16);return J>ec&&(J=65533),J}else return A()?65533:o},ke=function(q,J){return!(q!==92||Et(J))},D=function(){return ke(o,m())},se=function(q,J,ye){return q===45?Un(J)||J===45||ke(J,ye):Un(q)?!0:q===92?ke(q,J):!1},we=function(){return se(o,m(1),m(2))},he=function(q,J,ye){return q===43||q===45?!!(xe(J)||J===46&&xe(ye)):q===46?!!xe(J):!!xe(q)},rt=function(){return he(o,m(1),m(2))},Je=function(){let q="";for(;y();)if(Ci(o))q+=le(o);else if(D())q+=le(ie());else return w(),q;throw new Error("Internal parse error")},ln=function(){let q="",J="integer";for((m()===43||m()===45)&&(y(),q+=le(o));xe(m());)y(),q+=le(o);if(m(1)===46&&xe(m(2)))for(y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);let ye=m(1),K=m(2),ze=m(3);if((ye===69||ye===101)&&xe(K))for(y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);else if((ye===69||ye===101)&&(K===43||K===45)&&xe(ze))for(y(),q+=le(o),y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);let it=He(q);return{type:J,value:it,repr:q}},He=function(q){return+q},me=function(){for(;y();){if(o===41||A())return;D()&&ie(),I()}},st=0;for(;!A(m());)if(r.push(U()),st++,st>t.length*2)throw new Error("I'm infinite-looping!");return r}var ae=class{tokenType="";value;toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}},ro=class extends ae{tokenType="BADSTRING"},Bn=class extends ae{tokenType="BADURL"},Wn=class extends ae{tokenType="WHITESPACE";toString(){return"WS"}toSource(){return" "}},so=class extends ae{tokenType="CDO";toSource(){return"<!--"}},io=class extends ae{tokenType="CDC";toSource(){return"-->"}},oo=class extends ae{tokenType=":"},ao=class extends ae{tokenType=";"},co=class extends ae{tokenType=","},Ct=class extends ae{value="";mirror=""},lo=class extends Ct{tokenType="{";constructor(){super(),this.value="{",this.mirror="}"}},uo=class extends Ct{tokenType="}";constructor(){super(),this.value="}",this.mirror="{"}},ho=class extends Ct{tokenType="[";constructor(){super(),this.value="[",this.mirror="]"}},Pr=class extends Ct{tokenType="]";constructor(){super(),this.value="]",this.mirror="["}},fo=class extends Ct{tokenType="(";constructor(){super(),this.value="(",this.mirror=")"}},Vr=class extends Ct{tokenType=")";constructor(){super(),this.value=")",this.mirror="("}},nc=class extends ae{tokenType="~="},rc=class extends ae{tokenType="|="},sc=class extends ae{tokenType="^="},ic=class extends ae{tokenType="$="},oc=class extends ae{tokenType="*="},po=class extends ae{tokenType="||"},jn=class extends ae{tokenType="EOF";toSource(){return""}},fe=class extends ae{tokenType="DELIM";value="";constructor(e){super(),this.value=le(e)}toString(){return"DELIM("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){return this.value==="\\"?`\\
1
+ var Ar=class{getActualParent(t){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(t.assignedSlot)return t.assignedSlot;let n=t.parentElement;if(n)return n;let r=t.parentNode;return r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host||null}getFullAncestorChain(t){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");let n=[],r=t;for(;r;)n.push(r),r=this.getActualParent(r);return n}getFullAncestorChainToRoot(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid root provided");if(!this.containsElementCrossShadow(n,t))throw new Error("Root does not contain the element");let r=[],o=t;for(;o&&o!==n&&this.containsElementCrossShadow(n,o);)r.push(o),o=this.getActualParent(o);return o===n&&r.push(o),r}getClimbCountToParent(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid target parent provided");let r=0,o=t;for(;o&&o!==n;)o=this.getActualParent(o),r++;return o===n?r:-1}containsElementCrossShadow(t,n){if(!t||!(t instanceof Element))throw new Error("Invalid element provided");if(!n||!(n instanceof Element))throw new Error("Invalid target provided");let r=n;for(;r;){if(r===t)return!0;r=this.getActualParent(r)}return!1}findLowestCommonAncestor(t){if(!Array.isArray(t)||t.length===0)throw new Error("Invalid elements array provided");for(let r of t)if(!(r instanceof Element))throw new Error("All items in the array must be DOM Elements");let n=this.getFullAncestorChain(t[0]);n.reverse();for(let r=1;r<t.length;r++){let o=this.getFullAncestorChain(t[r]);o.reverse(),n=n.filter(u=>o.includes(u))}return n.length>0?n[n.length-1]:null}findBranchingParent(t,n){if(!Array.isArray(t)||t.length===0)throw new Error("Invalid elements array provided");if(!(n instanceof Element))throw new Error("Target must be a DOM Element");for(let u of t)if(!(u instanceof Element))throw new Error("All items in the array must be DOM Elements");if(!t.includes(n))return console.warn("Target element must be included in the elements array, returning null"),null;let r=this.getFullAncestorChain(n);r.reverse();let o=null;for(let u of r){let l=t.filter(h=>this.containsElementCrossShadow(u,h));if(l.length===1&&l[0]===n){o=u;break}}return o||null}},Ai=Ar;var Ha=Object.defineProperty;var Nt=(e,t)=>{for(var n in t)Ha(e,n,{get:t[n],enumerable:!0})};var Wa={};Nt(Wa,{__PW:()=>Me});var Ji={};Nt(Ji,{elementMatchesText:()=>an,elementText:()=>Ee,getElementLabels:()=>bs,matchesAttributePart:()=>ys,matchesComponentAttribute:()=>ms,shouldSkipForTextMatching:()=>er});var zi={};Nt(zi,{cacheNormalizedWhitespaces:()=>Yi,escapeForAttributeSelector:()=>Ne,escapeForTextSelector:()=>Ae,escapeHTML:()=>Ja,escapeHTMLAttribute:()=>Ga,escapeRegExp:()=>Zt,escapeTemplateString:()=>Ka,escapeWithQuotes:()=>nn,isString:()=>Va,longestCommonSubstring:()=>eo,normalizeEscapedRegexQuotes:()=>rn,normalizeWhiteSpace:()=>ve,quoteCSSAttributeValue:()=>et,toSnakeCase:()=>Wr,toTitleCase:()=>Xt,trimString:()=>Xi,trimStringWithEllipsis:()=>Mr});function nn(e,t="'"){let n=JSON.stringify(e),r=n.substring(1,n.length-1).replace(/\\"/g,'"');if(t==="'")return t+r.replace(/[']/g,"\\'")+t;if(t==='"')return t+r.replace(/["]/g,'\\"')+t;if(t==="`")return t+r.replace(/[`]/g,"`")+t;throw new Error("Invalid escape char")}function Ka(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Va(e){return typeof e=="string"||e instanceof String}function Xt(e){return e.charAt(0).toUpperCase()+e.substring(1)}function Wr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function et(e){return`"${e.replace(/["\\]/g,t=>"\\"+t)}"`}var Kt;function Yi(){Kt=new Map}function ve(e){let t=Kt==null?void 0:Kt.get(e);return t===void 0&&(t=e.replace(/[\u200b\u00ad]/g,"").trim().replace(/\s+/g," "),Kt==null||Kt.set(e,t)),t}function rn(e){return e.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}function Qi(e){return e.unicode||e.unicodeSets?String(e):String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\$3").replace(/>>/g,"\\>\\>")}function Ae(e,t){return typeof e!="string"?Qi(e):`${JSON.stringify(e)}${t?"s":"i"}`}function Ne(e,t){return typeof e!="string"?Qi(e):`"${e.replace(/\\/g,"\\\\").replace(/["]/g,'\\"')}"${t?"s":"i"}`}function Xi(e,t,n=""){if(e.length<=t)return e;let r=[...e];return r.length>t?r.slice(0,t-n.length).join("")+n:r.join("")}function Mr(e,t){return Xi(e,t,"\u2026")}function Zt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Zi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ga(e){return e.replace(/[&<>"']/ug,t=>Zi[t])}function Ja(e){return e.replace(/[&<]/ug,t=>Zi[t])}function eo(e,t){let n=e.length,r=t.length,o=0,u=0,l=Array(n+1).fill(null).map(()=>Array(r+1).fill(0));for(let h=1;h<=n;h++)for(let p=1;p<=r;p++)e[h-1]===t[p-1]&&(l[h][p]=l[h-1][p-1]+1,l[h][p]>o&&(o=l[h][p],u=h));return e.slice(u-o,u)}var to={};Nt(to,{beginAriaCaches:()=>Xn,endAriaCaches:()=>Zn,getAriaChecked:()=>ns,getAriaDisabled:()=>tn,getAriaExpanded:()=>is,getAriaLabelledByElements:()=>es,getAriaLevel:()=>os,getAriaPressed:()=>ss,getAriaRole:()=>ue,getAriaSelected:()=>ts,getCSSContent:()=>_t,getCheckedAllowMixed:()=>Io,getCheckedWithoutMixed:()=>Lo,getElementAccessibleDescription:()=>Rr,getElementAccessibleErrorMessage:()=>Co,getElementAccessibleName:()=>At,getReadonly:()=>Oo,isElementHiddenForAria:()=>Ce,isElementIgnoredForAria:()=>Zr,kAriaCheckedRoles:()=>Jn,kAriaDisabledRoles:()=>as,kAriaExpandedRoles:()=>Yn,kAriaLevelRoles:()=>Qn,kAriaPressedRoles:()=>zn,kAriaSelectedRoles:()=>Gn,receivesPointerEvents:()=>Po});var ce=function(e,t,n){return e>=t&&e<=n};function xe(e){return ce(e,48,57)}function Ni(e){return xe(e)||ce(e,65,70)||ce(e,97,102)}function za(e){return ce(e,65,90)}function Ya(e){return ce(e,97,122)}function Qa(e){return za(e)||Ya(e)}function Xa(e){return e>=128}function Un(e){return Qa(e)||Xa(e)||e===95}function Ci(e){return Un(e)||xe(e)||e===45}function Za(e){return ce(e,0,8)||e===11||ce(e,14,31)||e===127}function Et(e){return e===10}function De(e){return Et(e)||e===9||e===32}var ec=1114111,Kr=class extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}};function tc(e){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===13&&e.charCodeAt(n+1)===10&&(r=10,n++),(r===13||r===12)&&(r=10),r===0&&(r=65533),ce(r,55296,56319)&&ce(e.charCodeAt(n+1),56320,57343)){let o=r-55296,u=e.charCodeAt(n+1)-56320;r=Math.pow(2,16)+o*Math.pow(2,10)+u,n++}t.push(r)}return t}function le(e){if(e<=65535)return String.fromCharCode(e);e-=Math.pow(2,16);let t=Math.floor(e/Math.pow(2,10))+55296,n=e%Math.pow(2,10)+56320;return String.fromCharCode(t)+String.fromCharCode(n)}function no(e){let t=tc(e),n=-1,r=[],o,u=0,l=0,h=0,p=function(){u+=1,h=l,l=0},b={line:u,column:l},v=function(q){return q>=t.length?-1:t[q]},m=function(q){if(q===void 0&&(q=1),q>3)throw"Spec Error: no more than three codepoints of lookahead.";return v(n+q)},y=function(q){return q===void 0&&(q=1),n+=q,o=v(n),Et(o)?p():l+=q,!0},w=function(){return n-=1,Et(o)?(u-=1,l=h):l-=1,b.line=u,b.column=l,!0},A=function(q){return q===void 0&&(q=o),q===-1},I=function(){},$=function(){},U=function(){if(B(),y(),De(o)){for(;De(m());)y();return new Wn}else{if(o===34)return ne();if(o===35)if(Ci(m())||ke(m(1),m(2))){let q=new mo("");return se(m(1),m(2),m(3))&&(q.type="id"),q.value=Je(),q}else return new fe(o);else return o===36?m()===61?(y(),new ic):new fe(o):o===39?ne():o===40?new fo:o===41?new Vr:o===42?m()===61?(y(),new oc):new fe(o):o===43?rt()?(w(),V()):new fe(o):o===44?new co:o===45?rt()?(w(),V()):m(1)===45&&m(2)===62?(y(2),new io):we()?(w(),te()):new fe(o):o===46?rt()?(w(),V()):new fe(o):o===58?new oo:o===59?new ao:o===60?m(1)===33&&m(2)===45&&m(3)===45?(y(3),new so):new fe(o):o===64?se(m(1),m(2),m(3))?new go(Je()):new fe(o):o===91?new ho:o===92?D()?(w(),te()):($(),new fe(o)):o===93?new Pr:o===94?m()===61?(y(),new sc):new fe(o):o===123?new lo:o===124?m()===61?(y(),new rc):m()===124?(y(),new po):new fe(o):o===125?new uo:o===126?m()===61?(y(),new nc):new fe(o):xe(o)?(w(),V()):Un(o)?(w(),te()):A()?new jn:new fe(o)}},B=function(){for(;m(1)===47&&m(2)===42;)for(y(2);;)if(y(),o===42&&m()===47){y();break}else if(A()){$();return}},V=function(){let q=ln();if(se(m(1),m(2),m(3))){let J=new ac;return J.value=q.value,J.repr=q.repr,J.type=q.type,J.unit=Je(),J}else if(m()===37){y();let J=new vo;return J.value=q.value,J.repr=q.repr,J}else{let J=new bo;return J.value=q.value,J.repr=q.repr,J.type=q.type,J}},te=function(){let q=Je();if(q.toLowerCase()==="url"&&m()===40){for(y();De(m(1))&&De(m(2));)y();return m()===34||m()===39?new Jt(q):De(m())&&(m(2)===34||m(2)===39)?new Jt(q):ee()}else return m()===40?(y(),new Jt(q)):new Gr(q)},ne=function(q){q===void 0&&(q=o);let J="";for(;y();){if(o===q||A())return new Jr(J);if(Et(o))return $(),w(),new ro;o===92?A(m())?I():Et(m())?y():J+=le(ie()):J+=le(o)}throw new Error("Internal error")},ee=function(){let q=new yo("");for(;De(m());)y();if(A(m()))return q;for(;y();){if(o===41||A())return q;if(De(o)){for(;De(m());)y();return m()===41||A(m())?(y(),q):(me(),new Bn)}else{if(o===34||o===39||o===40||Za(o))return $(),me(),new Bn;if(o===92)if(D())q.value+=le(ie());else return $(),me(),new Bn;else q.value+=le(o)}}throw new Error("Internal error")},ie=function(){if(y(),Ni(o)){let q=[o];for(let ye=0;ye<5&&Ni(m());ye++)y(),q.push(o);De(m())&&y();let J=parseInt(q.map(function(ye){return String.fromCharCode(ye)}).join(""),16);return J>ec&&(J=65533),J}else return A()?65533:o},ke=function(q,J){return!(q!==92||Et(J))},D=function(){return ke(o,m())},se=function(q,J,ye){return q===45?Un(J)||J===45||ke(J,ye):Un(q)?!0:q===92?ke(q,J):!1},we=function(){return se(o,m(1),m(2))},he=function(q,J,ye){return q===43||q===45?!!(xe(J)||J===46&&xe(ye)):q===46?!!xe(J):!!xe(q)},rt=function(){return he(o,m(1),m(2))},Je=function(){let q="";for(;y();)if(Ci(o))q+=le(o);else if(D())q+=le(ie());else return w(),q;throw new Error("Internal parse error")},ln=function(){let q="",J="integer";for((m()===43||m()===45)&&(y(),q+=le(o));xe(m());)y(),q+=le(o);if(m(1)===46&&xe(m(2)))for(y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);let ye=m(1),K=m(2),ze=m(3);if((ye===69||ye===101)&&xe(K))for(y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);else if((ye===69||ye===101)&&(K===43||K===45)&&xe(ze))for(y(),q+=le(o),y(),q+=le(o),y(),q+=le(o),J="number";xe(m());)y(),q+=le(o);let it=He(q);return{type:J,value:it,repr:q}},He=function(q){return+q},me=function(){for(;y();){if(o===41||A())return;D()&&ie(),I()}},st=0;for(;!A(m());)if(r.push(U()),st++,st>t.length*2)throw new Error("I'm infinite-looping!");return r}var ae=class{tokenType="";value;toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}},ro=class extends ae{tokenType="BADSTRING"},Bn=class extends ae{tokenType="BADURL"},Wn=class extends ae{tokenType="WHITESPACE";toString(){return"WS"}toSource(){return" "}},so=class extends ae{tokenType="CDO";toSource(){return"<!--"}},io=class extends ae{tokenType="CDC";toSource(){return"-->"}},oo=class extends ae{tokenType=":"},ao=class extends ae{tokenType=";"},co=class extends ae{tokenType=","},Ct=class extends ae{value="";mirror=""},lo=class extends Ct{tokenType="{";constructor(){super(),this.value="{",this.mirror="}"}},uo=class extends Ct{tokenType="}";constructor(){super(),this.value="}",this.mirror="{"}},ho=class extends Ct{tokenType="[";constructor(){super(),this.value="[",this.mirror="]"}},Pr=class extends Ct{tokenType="]";constructor(){super(),this.value="]",this.mirror="["}},fo=class extends Ct{tokenType="(";constructor(){super(),this.value="(",this.mirror=")"}},Vr=class extends Ct{tokenType=")";constructor(){super(),this.value=")",this.mirror="("}},nc=class extends ae{tokenType="~="},rc=class extends ae{tokenType="|="},sc=class extends ae{tokenType="^="},ic=class extends ae{tokenType="$="},oc=class extends ae{tokenType="*="},po=class extends ae{tokenType="||"},jn=class extends ae{tokenType="EOF";toSource(){return""}},fe=class extends ae{tokenType="DELIM";value="";constructor(e){super(),this.value=le(e)}toString(){return"DELIM("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){return this.value==="\\"?`\\
2
2
  `:this.value}},It=class extends ae{value="";ASCIIMatch(e){return this.value.toLowerCase()===e.toLowerCase()}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}},Gr=class extends It{constructor(e){super(),this.value=e}tokenType="IDENT";toString(){return"IDENT("+this.value+")"}toSource(){return sn(this.value)}},Jt=class extends It{tokenType="FUNCTION";mirror;constructor(e){super(),this.value=e,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return sn(this.value)+"("}},go=class extends It{tokenType="AT-KEYWORD";constructor(e){super(),this.value=e}toString(){return"AT("+this.value+")"}toSource(){return"@"+sn(this.value)}},mo=class extends It{tokenType="HASH";type;constructor(e){super(),this.value=e,this.type="unrestricted"}toString(){return"HASH("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.type=this.type,e}toSource(){return this.type==="id"?"#"+sn(this.value):"#"+cc(this.value)}},Jr=class extends It{tokenType="STRING";constructor(e){super(),this.value=e}toString(){return'"'+wo(this.value)+'"'}},yo=class extends It{tokenType="URL";constructor(e){super(),this.value=e}toString(){return"URL("+this.value+")"}toSource(){return'url("'+wo(this.value)+'")'}},bo=class extends ae{tokenType="NUMBER";type;repr;constructor(){super(),this.type="integer",this.repr=""}toString(){return this.type==="integer"?"INT("+this.value+")":"NUMBER("+this.value+")"}toJSON(){let e=super.toJSON();return e.value=this.value,e.type=this.type,e.repr=this.repr,e}toSource(){return this.repr}},vo=class extends ae{tokenType="PERCENTAGE";repr;constructor(){super(),this.repr=""}toString(){return"PERCENTAGE("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.repr=this.repr,e}toSource(){return this.repr+"%"}},ac=class extends ae{tokenType="DIMENSION";type;repr;unit;constructor(){super(),this.type="integer",this.repr="",this.unit=""}toString(){return"DIM("+this.value+","+this.unit+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e.type=this.type,e.repr=this.repr,e.unit=this.unit,e}toSource(){let e=this.repr,t=sn(this.unit);return t[0].toLowerCase()==="e"&&(t[1]==="-"||ce(t.charCodeAt(1),48,57))&&(t="\\65 "+t.slice(1,t.length)),e+t}};function sn(e){e=""+e;let t="",n=e.charCodeAt(0);for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===0)throw new Kr("Invalid character: the input contains U+0000.");ce(o,1,31)||o===127||r===0&&ce(o,48,57)||r===1&&ce(o,48,57)&&n===45?t+="\\"+o.toString(16)+" ":o>=128||o===45||o===95||ce(o,48,57)||ce(o,65,90)||ce(o,97,122)?t+=e[r]:t+="\\"+e[r]}return t}function cc(e){e=""+e;let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===0)throw new Kr("Invalid character: the input contains U+0000.");r>=128||r===45||r===95||ce(r,48,57)||ce(r,65,90)||ce(r,97,122)?t+=e[n]:t+="\\"+r.toString(16)+" "}return t}function wo(e){e=""+e;let t="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r===0)throw new Kr("Invalid character: the input contains U+0000.");ce(r,1,31)||r===127?t+="\\"+r.toString(16)+" ":r===34||r===92?t+="\\"+e[n]:t+=e[n]}return t}var Eo={};Nt(Eo,{box:()=>en,closestCrossShadow:()=>xt,elementSafeTagName:()=>de,enclosingElement:()=>lc,enclosingShadowRootOrDocument:()=>Yr,getElementComputedStyle:()=>Fe,getGlobalOptions:()=>Vn,isElementStyleVisibilityVisible:()=>Qr,isElementVisible:()=>Ge,isInsideScope:()=>on,isVisibleTextNode:()=>Xr,parentElementOrShadowHost:()=>ge,setGlobalOptions:()=>So});var zr={};function So(e){zr=e}function Vn(){return zr}function on(e,t){for(;t;){if(e.contains(t))return!0;t=xo(t)}return!1}function lc(e){return e.nodeType===1?e:e.parentElement??void 0}function ge(e){if(e.parentElement)return e.parentElement;if(e.parentNode&&e.parentNode.nodeType===11&&e.parentNode.host)return e.parentNode.host}function Yr(e){let t=e;for(;t.parentNode;)t=t.parentNode;if(t.nodeType===11||t.nodeType===9)return t}function xo(e){for(;e.parentElement;)e=e.parentElement;return ge(e)}function xt(e,t,n){for(;e;){let r=e.closest(t);if(n&&r!==n&&(r!=null&&r.contains(n)))return;if(r)return r;e=xo(e)}}function Fe(e,t){return e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,t):void 0}function Qr(e,t){if(t=t??Fe(e),!t)return!0;if(Element.prototype.checkVisibility&&zr.browserNameForWorkarounds!=="webkit"){if(!e.checkVisibility())return!1}else{let n=e.closest("details,summary");if(n!==e&&(n==null?void 0:n.nodeName)==="DETAILS"&&!n.open)return!1}return t.visibility==="visible"}function en(e){let t=Fe(e);if(!t)return{visible:!0};if(t.display==="contents"){for(let r=e.firstChild;r;r=r.nextSibling){if(r.nodeType===1&&Ge(r))return{visible:!0,style:t};if(r.nodeType===3&&Xr(r))return{visible:!0,style:t}}return{visible:!1,style:t}}if(!Qr(e,t))return{style:t,visible:!1};let n=e.getBoundingClientRect();return{rect:n,style:t,visible:n.width>0&&n.height>0}}function Ge(e){return en(e).visible}function Xr(e){let t=e.ownerDocument.createRange();t.selectNode(e);let n=t.getBoundingClientRect();return n.width>0&&n.height>0}function de(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function Ii(e){return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")}var Li="article:not([role]), aside:not([role]), main:not([role]), nav:not([role]), section:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]",uc=[["aria-atomic",void 0],["aria-busy",void 0],["aria-controls",void 0],["aria-current",void 0],["aria-describedby",void 0],["aria-details",void 0],["aria-dropeffect",void 0],["aria-flowto",void 0],["aria-grabbed",void 0],["aria-hidden",void 0],["aria-keyshortcuts",void 0],["aria-label",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-labelledby",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-live",void 0],["aria-owns",void 0],["aria-relevant",void 0],["aria-roledescription",["generic"]]];function To(e,t){return uc.some(([n,r])=>!(r!=null&&r.includes(t||""))&&e.hasAttribute(n))}function ko(e){return!Number.isNaN(Number(String(e.getAttribute("tabindex"))))}function hc(e){return!$o(e)&&(fc(e)||ko(e))}function fc(e){let t=de(e);return["BUTTON","DETAILS","SELECT","TEXTAREA"].includes(t)?!0:t==="A"||t==="AREA"?e.hasAttribute("href"):t==="INPUT"?!e.hidden:!1}var Oi={A:e=>e.hasAttribute("href")?"link":null,AREA:e=>e.hasAttribute("href")?"link":null,ARTICLE:()=>"article",ASIDE:()=>"complementary",BLOCKQUOTE:()=>"blockquote",BUTTON:()=>"button",CAPTION:()=>"caption",CODE:()=>"code",DATALIST:()=>"listbox",DD:()=>"definition",DEL:()=>"deletion",DETAILS:()=>"group",DFN:()=>"term",DIALOG:()=>"dialog",DT:()=>"term",EM:()=>"emphasis",FIELDSET:()=>"group",FIGURE:()=>"figure",FOOTER:e=>xt(e,Li)?null:"contentinfo",FORM:e=>Ii(e)?"form":null,H1:()=>"heading",H2:()=>"heading",H3:()=>"heading",H4:()=>"heading",H5:()=>"heading",H6:()=>"heading",HEADER:e=>xt(e,Li)?null:"banner",HR:()=>"separator",HTML:()=>"document",IMG:e=>e.getAttribute("alt")===""&&!e.getAttribute("title")&&!To(e)&&!ko(e)?"presentation":"img",INPUT:e=>{let t=e.type.toLowerCase();if(t==="search")return e.hasAttribute("list")?"combobox":"searchbox";if(["email","tel","text","url",""].includes(t)){let n=Lt(e,e.getAttribute("list"))[0];return n&&de(n)==="DATALIST"?"combobox":"textbox"}return t==="hidden"?null:t==="file"&&!Vn().inputFileRoleTextbox?"button":Sc[t]||"textbox"},INS:()=>"insertion",LI:()=>"listitem",MAIN:()=>"main",MARK:()=>"mark",MATH:()=>"math",MENU:()=>"list",METER:()=>"meter",NAV:()=>"navigation",OL:()=>"list",OPTGROUP:()=>"group",OPTION:()=>"option",OUTPUT:()=>"status",P:()=>"paragraph",PROGRESS:()=>"progressbar",SECTION:e=>Ii(e)?"region":null,SELECT:e=>e.hasAttribute("multiple")||e.size>1?"listbox":"combobox",STRONG:()=>"strong",SUB:()=>"subscript",SUP:()=>"superscript",SVG:()=>"img",TABLE:()=>"table",TBODY:()=>"rowgroup",TD:e=>{let t=xt(e,"table"),n=t?Kn(t):"";return n==="grid"||n==="treegrid"?"gridcell":"cell"},TEXTAREA:()=>"textbox",TFOOT:()=>"rowgroup",TH:e=>{if(e.getAttribute("scope")==="col")return"columnheader";if(e.getAttribute("scope")==="row")return"rowheader";let t=xt(e,"table"),n=t?Kn(t):"";return n==="grid"||n==="treegrid"?"gridcell":"cell"},THEAD:()=>"rowgroup",TIME:()=>"time",TR:()=>"row",UL:()=>"list"},dc={DD:["DL","DIV"],DIV:["DL"],DT:["DL","DIV"],LI:["OL","UL"],TBODY:["TABLE"],TD:["TR"],TFOOT:["TABLE"],TH:["TR"],THEAD:["TABLE"],TR:["THEAD","TBODY","TFOOT","TABLE"]};function $i(e){var t;let n=((t=Oi[de(e)])==null?void 0:t.call(Oi,e))||"";if(!n)return null;let r=e;for(;r;){let o=ge(r),u=dc[de(r)];if(!u||!o||!u.includes(de(o)))break;let l=Kn(o);if((l==="none"||l==="presentation")&&!_o(o,l))return l;r=o}return n}var pc=["alert","alertdialog","application","article","banner","blockquote","button","caption","cell","checkbox","code","columnheader","combobox","complementary","contentinfo","definition","deletion","dialog","directory","document","emphasis","feed","figure","form","generic","grid","gridcell","group","heading","img","insertion","link","list","listbox","listitem","log","main","mark","marquee","math","meter","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","none","note","option","paragraph","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","strong","subscript","superscript","switch","tab","table","tablist","tabpanel","term","textbox","time","timer","toolbar","tooltip","tree","treegrid","treeitem"];function Kn(e){return(e.getAttribute("role")||"").split(" ").map(n=>n.trim()).find(n=>pc.includes(n))||null}function _o(e,t){return To(e,t)||hc(e)}function ue(e){let t=Kn(e);if(!t)return $i(e);if(t==="none"||t==="presentation"){let n=$i(e);if(_o(e,n))return n}return t}function Ao(e){return e===null?void 0:e.toLowerCase()==="true"}function Zr(e){return["STYLE","SCRIPT","NOSCRIPT","TEMPLATE"].includes(de(e))}function Ce(e){if(Zr(e))return!0;let t=Fe(e),n=e.nodeName==="SLOT";if((t==null?void 0:t.display)==="contents"&&!n){for(let o=e.firstChild;o;o=o.nextSibling)if(o.nodeType===1&&!Ce(o)||o.nodeType===3&&Xr(o))return!1;return!0}return!(e.nodeName==="OPTION"&&!!e.closest("select"))&&!n&&!Qr(e,t)?!0:No(e)}function No(e){let t=Tt==null?void 0:Tt.get(e);if(t===void 0){if(t=!1,e.parentElement&&e.parentElement.shadowRoot&&!e.assignedSlot&&(t=!0),!t){let n=Fe(e);t=!n||n.display==="none"||Ao(e.getAttribute("aria-hidden"))===!0}if(!t){let n=ge(e);n&&(t=No(n))}Tt==null||Tt.set(e,t)}return t}function Lt(e,t){if(!t)return[];let n=Yr(e);if(!n)return[];try{let r=t.split(" ").filter(u=>!!u),o=[];for(let u of r){let l=n.querySelector("#"+CSS.escape(u));l&&!o.includes(l)&&o.push(l)}return o}catch{return[]}}function Ue(e){return e.trim()}function zt(e){return e.split("\xA0").map(t=>t.replace(/\r\n/g,`
3
3
  `).replace(/[\u200b\u00ad]/g,"").replace(/\s\s*/g," ")).join("\xA0").trim()}function Mi(e,t){let n=[...e.querySelectorAll(t)];for(let r of Lt(e,e.getAttribute("aria-owns")))r.matches(t)&&n.push(r),n.push(...r.querySelectorAll(t));return n}function _t(e,t){let n=t==="::before"?ds:t==="::after"?ps:fs;if(n!=null&&n.has(e))return n==null?void 0:n.get(e);let r=Fe(e,t),o;return r&&r.display!=="none"&&r.visibility!=="hidden"&&(o=gc(e,r.content,!!t)),t&&o!==void 0&&((r==null?void 0:r.display)||"inline")!=="inline"&&(o=" "+o+" "),n&&n.set(e,o),o}function gc(e,t,n){if(!(!t||t==="none"||t==="normal"))try{let r=no(t).filter(h=>!(h instanceof Wn)),o=r.findIndex(h=>h instanceof fe&&h.value==="/");if(o!==-1)r=r.slice(o+1);else if(!n)return;let u=[],l=0;for(;l<r.length;)if(r[l]instanceof Jr)u.push(r[l].value),l++;else if(l+2<r.length&&r[l]instanceof Jt&&r[l].value==="attr"&&r[l+1]instanceof Gr&&r[l+2]instanceof Vr){let h=r[l+1].value;u.push(e.getAttribute(h)||""),l+=3}else return;return u.join("")}catch{}}function es(e){let t=e.getAttribute("aria-labelledby");if(t===null)return null;let n=Lt(e,t);return n.length?n:null}function mc(e,t){let n=["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"].includes(e),r=t&&["","caption","code","contentinfo","definition","deletion","emphasis","insertion","list","listitem","mark","none","paragraph","presentation","region","row","rowgroup","section","strong","subscript","superscript","table","term","time"].includes(e);return n||r}function At(e,t){let n=t?ls:cs,r=n==null?void 0:n.get(e);return r===void 0&&(r="",["caption","code","definition","deletion","emphasis","generic","insertion","mark","paragraph","presentation","strong","subscript","suggestion","superscript","term","time"].includes(ue(e)||"")||(r=zt($e(e,{includeHidden:t,visitedElements:new Set,embeddedInTargetElement:"self"}))),n==null||n.set(e,r)),r}function Rr(e,t){let n=t?hs:us,r=n==null?void 0:n.get(e);if(r===void 0){if(r="",e.hasAttribute("aria-describedby")){let o=Lt(e,e.getAttribute("aria-describedby"));r=zt(o.map(u=>$e(u,{includeHidden:t,visitedElements:new Set,embeddedInDescribedBy:{element:u,hidden:Ce(u)}})).join(" "))}else e.hasAttribute("aria-description")?r=zt(e.getAttribute("aria-description")||""):r=zt(e.getAttribute("title")||"");n==null||n.set(e,r)}return r}function yc(e){let t=e.getAttribute("aria-invalid");return!t||t.trim()===""||t.toLocaleLowerCase()==="false"?"false":t==="true"||t==="grammar"||t==="spelling"?t:"true"}function bc(e){if("validity"in e){let t=e.validity;return(t==null?void 0:t.valid)===!1}return!1}function Co(e){let t=Yt,n=Yt==null?void 0:Yt.get(e);if(n===void 0){n="";let r=yc(e)!=="false",o=bc(e);if(r||o){let u=e.getAttribute("aria-errormessage");n=Lt(e,u).map(p=>zt($e(p,{visitedElements:new Set,embeddedInDescribedBy:{element:p,hidden:Ce(p)}}))).join(" ").trim()}t==null||t.set(e,n)}return n}function $e(e,t){var n,r,o,u;if(t.visitedElements.has(e))return"";let l={...t,embeddedInTargetElement:t.embeddedInTargetElement==="self"?"descendant":t.embeddedInTargetElement};if(!t.includeHidden){let y=!!((n=t.embeddedInLabelledBy)!=null&&n.hidden)||!!((r=t.embeddedInDescribedBy)!=null&&r.hidden)||!!((o=t.embeddedInNativeTextAlternative)!=null&&o.hidden)||!!((u=t.embeddedInLabel)!=null&&u.hidden);if(Zr(e)||!y&&Ce(e))return t.visitedElements.add(e),""}let h=es(e);if(!t.embeddedInLabelledBy){let y=(h||[]).map(w=>$e(w,{...t,embeddedInLabelledBy:{element:w,hidden:Ce(w)},embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0,embeddedInLabel:void 0,embeddedInNativeTextAlternative:void 0})).join(" ");if(y)return y}let p=ue(e)||"",b=de(e);if(t.embeddedInLabel||t.embeddedInLabelledBy||t.embeddedInTargetElement==="descendant"){let y=[...e.labels||[]].includes(e),w=(h||[]).includes(e);if(!y&&!w){if(p==="textbox")return t.visitedElements.add(e),b==="INPUT"||b==="TEXTAREA"?e.value:e.textContent||"";if(["combobox","listbox"].includes(p)){t.visitedElements.add(e);let A;if(b==="SELECT")A=[...e.selectedOptions],!A.length&&e.options.length&&A.push(e.options[0]);else{let I=p==="combobox"?Mi(e,"*").find($=>ue($)==="listbox"):e;A=I?Mi(I,'[aria-selected="true"]').filter($=>ue($)==="option"):[]}return!A.length&&b==="INPUT"?e.value:A.map(I=>$e(I,l)).join(" ")}if(["progressbar","scrollbar","slider","spinbutton","meter"].includes(p))return t.visitedElements.add(e),e.hasAttribute("aria-valuetext")?e.getAttribute("aria-valuetext")||"":e.hasAttribute("aria-valuenow")?e.getAttribute("aria-valuenow")||"":e.getAttribute("value")||"";if(["menu"].includes(p))return t.visitedElements.add(e),""}}let v=e.getAttribute("aria-label")||"";if(Ue(v))return t.visitedElements.add(e),v;if(!["presentation","none"].includes(p)){if(b==="INPUT"&&["button","submit","reset"].includes(e.type)){t.visitedElements.add(e);let y=e.value||"";return Ue(y)?y:e.type==="submit"?"Submit":e.type==="reset"?"Reset":e.getAttribute("title")||""}if(!Vn().inputFileRoleTextbox&&b==="INPUT"&&e.type==="file"){t.visitedElements.add(e);let y=e.labels||[];return y.length&&!t.embeddedInLabelledBy?jt(y,t):"Choose File"}if(b==="INPUT"&&e.type==="image"){t.visitedElements.add(e);let y=e.labels||[];if(y.length&&!t.embeddedInLabelledBy)return jt(y,t);let w=e.getAttribute("alt")||"";if(Ue(w))return w;let A=e.getAttribute("title")||"";return Ue(A)?A:"Submit"}if(!h&&b==="BUTTON"){t.visitedElements.add(e);let y=e.labels||[];if(y.length)return jt(y,t)}if(!h&&b==="OUTPUT"){t.visitedElements.add(e);let y=e.labels||[];return y.length?jt(y,t):e.getAttribute("title")||""}if(!h&&(b==="TEXTAREA"||b==="SELECT"||b==="INPUT")){t.visitedElements.add(e);let y=e.labels||[];if(y.length)return jt(y,t);let w=b==="INPUT"&&["text","password","search","tel","email","url"].includes(e.type)||b==="TEXTAREA",A=e.getAttribute("placeholder")||"",I=e.getAttribute("title")||"";return!w||I?I:A}if(!h&&b==="FIELDSET"){t.visitedElements.add(e);for(let w=e.firstElementChild;w;w=w.nextElementSibling)if(de(w)==="LEGEND")return $e(w,{...l,embeddedInNativeTextAlternative:{element:w,hidden:Ce(w)}});return e.getAttribute("title")||""}if(!h&&b==="FIGURE"){t.visitedElements.add(e);for(let w=e.firstElementChild;w;w=w.nextElementSibling)if(de(w)==="FIGCAPTION")return $e(w,{...l,embeddedInNativeTextAlternative:{element:w,hidden:Ce(w)}});return e.getAttribute("title")||""}if(b==="IMG"){t.visitedElements.add(e);let y=e.getAttribute("alt")||"";return Ue(y)?y:e.getAttribute("title")||""}if(b==="TABLE"){t.visitedElements.add(e);for(let w=e.firstElementChild;w;w=w.nextElementSibling)if(de(w)==="CAPTION")return $e(w,{...l,embeddedInNativeTextAlternative:{element:w,hidden:Ce(w)}});let y=e.getAttribute("summary")||"";if(y)return y}if(b==="AREA"){t.visitedElements.add(e);let y=e.getAttribute("alt")||"";return Ue(y)?y:e.getAttribute("title")||""}if(b==="SVG"||e.ownerSVGElement){t.visitedElements.add(e);for(let y=e.firstElementChild;y;y=y.nextElementSibling)if(de(y)==="TITLE"&&y.ownerSVGElement)return $e(y,{...l,embeddedInLabelledBy:{element:y,hidden:Ce(y)}})}if(e.ownerSVGElement&&b==="A"){let y=e.getAttribute("xlink:title")||"";if(Ue(y))return t.visitedElements.add(e),y}}let m=b==="SUMMARY"&&!["presentation","none"].includes(p);if(mc(p,t.embeddedInTargetElement==="descendant")||m||t.embeddedInLabelledBy||t.embeddedInDescribedBy||t.embeddedInLabel||t.embeddedInNativeTextAlternative){t.visitedElements.add(e);let y=vc(e,l);if(t.embeddedInTargetElement==="self"?Ue(y):y)return y}if(!["presentation","none"].includes(p)||b==="IFRAME"){t.visitedElements.add(e);let y=e.getAttribute("title")||"";if(Ue(y))return y}return t.visitedElements.add(e),""}function vc(e,t){let n=[],r=(u,l)=>{var h;if(!(l&&u.assignedSlot))if(u.nodeType===1){let p=((h=Fe(u))==null?void 0:h.display)||"inline",b=$e(u,t);(p!=="inline"||u.nodeName==="BR")&&(b=" "+b+" "),n.push(b)}else u.nodeType===3&&n.push(u.textContent||"")};n.push(_t(e,"::before")||"");let o=_t(e);if(o!==void 0)n.push(o);else{let u=e.nodeName==="SLOT"?e.assignedNodes():[];if(u.length)for(let l of u)r(l,!1);else{for(let l=e.firstChild;l;l=l.nextSibling)r(l,!0);if(e.shadowRoot)for(let l=e.shadowRoot.firstChild;l;l=l.nextSibling)r(l,!0);for(let l of Lt(e,e.getAttribute("aria-owns")))r(l,!0)}}return n.push(_t(e,"::after")||""),n.join("")}var Gn=["gridcell","option","row","tab","rowheader","columnheader","treeitem"];function ts(e){return de(e)==="OPTION"?e.selected:Gn.includes(ue(e)||"")?Ao(e.getAttribute("aria-selected"))===!0:!1}var Jn=["checkbox","menuitemcheckbox","option","radio","switch","menuitemradio","treeitem"];function ns(e){let t=rs(e,!0);return t==="error"?!1:t}function Io(e){return rs(e,!0)}function Lo(e){return rs(e,!1)}function rs(e,t){let n=de(e);if(t&&n==="INPUT"&&e.indeterminate)return"mixed";if(n==="INPUT"&&["checkbox","radio"].includes(e.type))return e.checked;if(Jn.includes(ue(e)||"")){let r=e.getAttribute("aria-checked");return r==="true"?!0:t&&r==="mixed"?"mixed":!1}return"error"}var wc=["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox","columnheader","rowheader","searchbox","switch","treegrid"];function Oo(e){let t=de(e);return["INPUT","TEXTAREA","SELECT"].includes(t)?e.hasAttribute("readonly"):wc.includes(ue(e)||"")?e.getAttribute("aria-readonly")==="true":e.isContentEditable?!1:"error"}var zn=["button"];function ss(e){if(zn.includes(ue(e)||"")){let t=e.getAttribute("aria-pressed");if(t==="true")return!0;if(t==="mixed")return"mixed"}return!1}var Yn=["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","rowheader","switch"];function is(e){if(de(e)==="DETAILS")return e.open;if(Yn.includes(ue(e)||"")){let t=e.getAttribute("aria-expanded");return t===null?void 0:t==="true"}}var Qn=["heading","listitem","row","treeitem"];function os(e){let t={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[de(e)];if(t)return t;if(Qn.includes(ue(e)||"")){let n=e.getAttribute("aria-level"),r=n===null?Number.NaN:Number(n);if(Number.isInteger(r)&&r>=1)return r}return 0}var as=["application","button","composite","gridcell","group","input","link","menuitem","scrollbar","separator","tab","checkbox","columnheader","combobox","grid","listbox","menu","menubar","menuitemcheckbox","menuitemradio","option","radio","radiogroup","row","rowheader","searchbox","select","slider","spinbutton","switch","tablist","textbox","toolbar","tree","treegrid","treeitem"];function tn(e){return $o(e)||Mo(e)}function $o(e){return["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(e.tagName)&&(e.hasAttribute("disabled")||Ec(e))}function Ec(e){let t=e==null?void 0:e.closest("FIELDSET[DISABLED]");if(!t)return!1;let n=t.querySelector(":scope > LEGEND");return!n||!n.contains(e)}function Mo(e,t=!1){if(!e)return!1;if(t||as.includes(ue(e)||"")){let n=(e.getAttribute("aria-disabled")||"").toLowerCase();return n==="true"?!0:n==="false"?!1:Mo(ge(e),!0)}return!1}function jt(e,t){return[...e].map(n=>$e(n,{...t,embeddedInLabel:{element:n,hidden:Ce(n)},embeddedInNativeTextAlternative:void 0,embeddedInLabelledBy:void 0,embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0})).filter(n=>!!n).join(" ")}function Po(e){let t=gs,n=e,r,o=[];for(;n;n=ge(n)){let u=t.get(n);if(u!==void 0){r=u;break}o.push(n);let l=Fe(n);if(!l){r=!0;break}let h=l.pointerEvents;if(h){r=h!=="none";break}}r===void 0&&(r=!0);for(let u of o)t.set(u,r);return r}var cs,ls,us,hs,Yt,Tt,fs,ds,ps,gs,Ro=0;function Xn(){++Ro,cs??=new Map,ls??=new Map,us??=new Map,hs??=new Map,Yt??=new Map,Tt??=new Map,fs??=new Map,ds??=new Map,ps??=new Map,gs??=new Map}function Zn(){--Ro||(cs=void 0,ls=void 0,us=void 0,hs=void 0,Yt=void 0,Tt=void 0,fs=void 0,ds=void 0,ps=void 0,gs=void 0)}var Sc={button:"button",checkbox:"checkbox",image:"button",number:"spinbutton",radio:"radio",range:"slider",reset:"button",submit:"button"};function ms(e,t){for(let n of t.jsonPath)e!=null&&(e=e[n]);return ys(e,t)}function ys(e,t){let n=typeof e=="string"&&!t.caseSensitive?e.toUpperCase():e,r=typeof t.value=="string"&&!t.caseSensitive?t.value.toUpperCase():t.value;return t.op==="<truthy>"?!!n:t.op==="="?r instanceof RegExp?typeof n=="string"&&!!n.match(r):n===r:typeof n!="string"||typeof r!="string"?!1:t.op==="*="?n.includes(r):t.op==="^="?n.startsWith(r):t.op==="$="?n.endsWith(r):t.op==="|="?n===r||n.startsWith(r+"-"):t.op==="~="?n.split(" ").includes(r):!1}function er(e){let t=e.ownerDocument;return e.nodeName==="SCRIPT"||e.nodeName==="NOSCRIPT"||e.nodeName==="STYLE"||t.head&&t.head.contains(e)}function Ee(e,t){let n=e.get(t);if(n===void 0){if(n={full:"",normalized:"",immediate:[]},!er(t)){let r="";if(t instanceof HTMLInputElement&&(t.type==="submit"||t.type==="button"))n={full:t.value,normalized:ve(t.value),immediate:[t.value]};else{for(let o=t.firstChild;o;o=o.nextSibling)if(o.nodeType===Node.TEXT_NODE)n.full+=o.nodeValue||"",r+=o.nodeValue||"";else{if(o.nodeType===Node.COMMENT_NODE)continue;r&&n.immediate.push(r),r="",o.nodeType===Node.ELEMENT_NODE&&(n.full+=Ee(e,o).full)}r&&n.immediate.push(r),t.shadowRoot&&(n.full+=Ee(e,t.shadowRoot).full),n.full&&(n.normalized=ve(n.full))}}e.set(t,n)}return n}function an(e,t,n){if(er(t)||!n(Ee(e,t)))return"none";for(let r=t.firstChild;r;r=r.nextSibling)if(r.nodeType===Node.ELEMENT_NODE&&n(Ee(e,r)))return"selfAndChildren";return t.shadowRoot&&n(Ee(e,t.shadowRoot))?"selfAndChildren":"self"}function bs(e,t){let n=es(t);if(n)return n.map(u=>Ee(e,u));let r=t.getAttribute("aria-label");if(r!==null&&r.trim())return[{full:r,normalized:ve(r),immediate:[r]}];let o=t.nodeName==="INPUT"&&t.type!=="hidden";if(["BUTTON","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"].includes(t.nodeName)||o){let u=t.labels;if(u)return[...u].map(l=>Ee(e,l))}return[]}var qo={};Nt(qo,{buildNoTextCandidates:()=>Go,buildTextCandidates:()=>Jo,generateSelector:()=>qr});var Do=10,Ot=Do/2,Pi=1,xc=2,Tc=10,kc=50,Uo=100,Bo=120,jo=140,Fo=160,Fn=180,Ho=200,Ri=250,_c=Bo+Ot,Ac=jo+Ot,Nc=Uo+Ot,Cc=Fo+Ot,Ic=Fn+Ot,Lc=Ho+Ot,Oc=300,$c=500,Wo=510,Nr=520,Ko=530,Vo=1e4,Mc=1e7,Pc=1e3;function qr(e,t,n){e._evaluator.begin();let r={allowText:new Map,disallowText:new Map};Xn();try{let o=[];if(n.forTextExpect){let h=$n(e,t.ownerDocument.documentElement,n);for(let p=t;p;p=ge(p)){let b=yt(r,e,p,{...n,noText:!0});if(!b)continue;if(Ve(b)<=Pc){h=b;break}}o=[Hn(h)]}else{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let h=xt(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n.root);h&&Ge(h)&&(t=h)}if(n.multiple){let h=yt(r,e,t,n),p=yt(r,e,t,{...n,noText:!0}),b=[h,p];if(r.allowText.clear(),r.disallowText.clear(),h&&Cr(h)&&b.push(yt(r,e,t,{...n,noCSSId:!0})),p&&Cr(p)&&b.push(yt(r,e,t,{...n,noText:!0,noCSSId:!0})),b=b.filter(Boolean),!b.length){let v=$n(e,t,n);b.push(v),Cr(v)&&b.push($n(e,t,{...n,noCSSId:!0}))}o=[...new Set(b.map(v=>Hn(v)))]}else{let h=yt(r,e,t,n)||$n(e,t,n);o=[Hn(h)]}}let u=o[0],l=e.parseSelector(u);return{selector:u,selectors:o,elements:e.querySelectorAll(l,n.root??t.ownerDocument)}}finally{Zn(),e._evaluator.end()}}function qi(e){return e.filter(t=>t[0].selector[0]!=="/")}function yt(e,t,n,r){if(r.root&&!on(r.root,n))throw new Error("Target element must belong to the root's subtree");if(n===r.root)return[{engine:"css",selector:":scope",score:1}];if(n.ownerDocument.documentElement===n)return[{engine:"css",selector:"html",score:1}];let o=(l,h)=>{let p=l===n,b=h?Jo(t,l,l===n):[];l!==n&&(b=qi(b));let v=Go(t,l,r).filter(w=>!r.omitInternalEngines||!w.engine.startsWith("internal:")).map(w=>[w]),m=Di(t,r.root??n.ownerDocument,l,[...b,...v],p);b=qi(b);let y=w=>{let A=h&&!w.length,I=[...w,...v].filter(U=>m?Ve(U)<Ve(m):!0),$=I[0];if($)for(let U=ge(l);U&&U!==r.root;U=ge(U)){let B=u(U,A);if(!B||m&&Ve([...B,...$])>=Ve(m))continue;if($=Di(t,U,l,I,p),!$)return;let V=[...B,...$];(!m||Ve(V)<Ve(m))&&(m=V)}};return y(b),l===n&&b.length&&y([]),m},u=(l,h)=>{let p=h?e.allowText:e.disallowText,b=p.get(l);return b===void 0&&(b=o(l,h),p.set(l,b)),b};return o(n,!r.noText)}function Go(e,t,n){let r=[];{for(let l of["data-testid","data-test-id","data-test"])l!==n.testIdAttributeName&&t.getAttribute(l)&&r.push({engine:"css",selector:`[${l}=${et(t.getAttribute(l))}]`,score:xc});if(!n.noCSSId){let l=t.getAttribute("id");l&&!Rc(l)&&r.push({engine:"css",selector:zo(l),score:$c})}r.push({engine:"css",selector:Be(t),score:Ko})}if(t.nodeName==="IFRAME"){for(let l of["name","title"])t.getAttribute(l)&&r.push({engine:"css",selector:`${Be(t)}[${l}=${et(t.getAttribute(l))}]`,score:Tc});return t.getAttribute(n.testIdAttributeName)&&r.push({engine:"css",selector:`[${n.testIdAttributeName}=${et(t.getAttribute(n.testIdAttributeName))}]`,score:Pi}),Dr([r]),r}if(t.getAttribute(n.testIdAttributeName)&&r.push({engine:"internal:testid",selector:`[${n.testIdAttributeName}=${Ne(t.getAttribute(n.testIdAttributeName),!0)}]`,score:Pi}),t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){let l=t;if(l.placeholder){r.push({engine:"internal:attr",selector:`[placeholder=${Ne(l.placeholder,!0)}]`,score:_c});for(let h of kt(l.placeholder))r.push({engine:"internal:attr",selector:`[placeholder=${Ne(h.text,!1)}]`,score:Bo-h.scoreBonus})}}let o=bs(e._evaluator._cacheText,t);for(let l of o){let h=l.normalized;r.push({engine:"internal:label",selector:Ae(h,!0),score:Ac});for(let p of kt(h))r.push({engine:"internal:label",selector:Ae(p.text,!1),score:jo-p.scoreBonus})}let u=ue(t);return u&&!["none","presentation"].includes(u)&&r.push({engine:"internal:role",selector:u,score:Wo}),t.getAttribute("name")&&["BUTTON","FORM","FIELDSET","FRAME","IFRAME","INPUT","KEYGEN","OBJECT","OUTPUT","SELECT","TEXTAREA","MAP","META","PARAM"].includes(t.nodeName)&&r.push({engine:"css",selector:`${Be(t)}[name=${et(t.getAttribute("name"))}]`,score:Nr}),["INPUT","TEXTAREA"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden"&&t.getAttribute("type")&&r.push({engine:"css",selector:`${Be(t)}[type=${et(t.getAttribute("type"))}]`,score:Nr}),["INPUT","TEXTAREA","SELECT"].includes(t.nodeName)&&t.getAttribute("type")!=="hidden"&&r.push({engine:"css",selector:Be(t),score:Nr+1}),Dr([r]),r}function Jo(e,t,n){if(t.nodeName==="SELECT")return[];let r=[],o=t.getAttribute("title");if(o){r.push([{engine:"internal:attr",selector:`[title=${Ne(o,!0)}]`,score:Lc}]);for(let b of kt(o))r.push([{engine:"internal:attr",selector:`[title=${Ne(b.text,!1)}]`,score:Ho-b.scoreBonus}])}let u=t.getAttribute("alt");if(u&&["APPLET","AREA","IMG","INPUT"].includes(t.nodeName)){r.push([{engine:"internal:attr",selector:`[alt=${Ne(u,!0)}]`,score:Cc}]);for(let b of kt(u))r.push([{engine:"internal:attr",selector:`[alt=${Ne(b.text,!1)}]`,score:Fo-b.scoreBonus}])}let l=Ee(e._evaluator._cacheText,t).normalized,h=l?kt(l):[];if(l){if(n){l.length<=80&&r.push([{engine:"internal:text",selector:Ae(l,!0),score:Ic}]);for(let v of h)r.push([{engine:"internal:text",selector:Ae(v.text,!1),score:Fn-v.scoreBonus}])}let b={engine:"css",selector:Be(t),score:Ko};for(let v of h)r.push([b,{engine:"internal:has-text",selector:Ae(v.text,!1),score:Fn-v.scoreBonus}]);if(l.length<=80){let v=new RegExp("^"+Zt(l)+"$");r.push([b,{engine:"internal:has-text",selector:Ae(v,!1),score:Ri}])}}let p=ue(t);if(p&&!["none","presentation"].includes(p)){let b=At(t,!1);if(b){let v={engine:"internal:role",selector:`${p}[name=${Ne(b,!0)}]`,score:Nc};r.push([v]);for(let m of kt(b))r.push([{engine:"internal:role",selector:`${p}[name=${Ne(m.text,!1)}]`,score:Uo-m.scoreBonus}])}else{let v={engine:"internal:role",selector:`${p}`,score:Wo};for(let m of h)r.push([v,{engine:"internal:has-text",selector:Ae(m.text,!1),score:Fn-m.scoreBonus}]);if(l.length<=80){let m=new RegExp("^"+Zt(l)+"$");r.push([v,{engine:"internal:has-text",selector:Ae(m,!1),score:Ri}])}}}return Dr(r),r}function zo(e){return/^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e)?"#"+e:`[id=${et(e)}]`}function Cr(e){return e.some(t=>t.engine==="css"&&(t.selector.startsWith("#")||t.selector.startsWith('[id="')))}function $n(e,t,n){let r=n.root??t.ownerDocument,o=[];function u(h){let p=o.slice();h&&p.unshift(h);let b=p.join(" > "),v=e.parseSelector(b);return e.querySelector(v,r,!1)===t?b:void 0}function l(h){let p={engine:"css",selector:h,score:Mc},b=e.parseSelector(h),v=e.querySelectorAll(b,r);if(v.length===1)return[p];let m={engine:"nth",selector:String(v.indexOf(t)),score:Vo};return[p,m]}for(let h=t;h&&h!==r;h=ge(h)){let p="";if(h.id&&!n.noCSSId){let m=zo(h.id),y=u(m);if(y)return l(y);p=m}let b=h.parentNode,v=[...h.classList].map(qc);for(let m=0;m<v.length;++m){let y="."+v.slice(0,m+1).join("."),w=u(y);if(w)return l(w);!p&&b&&b.querySelectorAll(y).length===1&&(p=y)}if(b){let m=[...b.children],y=h.nodeName,A=m.filter($=>$.nodeName===y).indexOf(h)===0?Be(h):`${Be(h)}:nth-child(${1+m.indexOf(h)})`,I=u(A);if(I)return l(I);p||(p=A)}else p||(p=Be(h));o.unshift(p)}return l(u())}function Dr(e){for(let t of e)for(let n of t)n.score>kc&&n.score<Oc&&(n.score+=Math.min(Do,n.selector.length/10|0))}function Hn(e){let t=[],n="";for(let{engine:r,selector:o}of e)t.length&&(n!=="css"||r!=="css"||o.startsWith(":nth-match("))&&t.push(">>"),n=r,r==="css"?t.push(o):t.push(`${r}=${o}`);return t.join(" ")}function Ve(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].score*(e.length-n);return t}function Di(e,t,n,r,o){let u=r.map(h=>({tokens:h,score:Ve(h)}));u.sort((h,p)=>h.score-p.score);let l=null;for(let{tokens:h}of u){let p=e.parseSelector(Hn(h)),b=e.querySelectorAll(p,t);if(b[0]===n&&b.length===1)return h;let v=b.indexOf(n);if(!o||l||v===-1||b.length>5)continue;let m={engine:"nth",selector:String(v),score:Vo};l=[...h,m]}return l}function Rc(e){let t,n=0;for(let r=0;r<e.length;++r){let o=e[r],u;if(!(o==="-"||o==="_")){if(o>="a"&&o<="z"?u="lower":o>="A"&&o<="Z"?u="upper":o>="0"&&o<="9"?u="digit":u="other",u==="lower"&&t==="upper"){t=u;continue}t&&t!==u&&++n,t=u}}return n>=e.length/4}function Mn(e,t){if(e.length<=t)return e;e=e.substring(0,t);let n=e.match(/^(.*)\b(.+?)$/);return n?n[1].trimEnd():""}function kt(e){let t=[];{let n=e.match(/^([\d.,]+)[^.,\w]/),r=n?n[1].length:0;if(r){let o=Mn(e.substring(r).trimStart(),80);t.push({text:o,scoreBonus:o.length<=30?2:1})}}{let n=e.match(/[^.,\w]([\d.,]+)$/),r=n?n[1].length:0;if(r){let o=Mn(e.substring(0,e.length-r).trimEnd(),80);t.push({text:o,scoreBonus:o.length<=30?2:1})}}return e.length<=30?t.push({text:e,scoreBonus:0}):(t.push({text:Mn(e,80),scoreBonus:0}),t.push({text:Mn(e,30),scoreBonus:1})),t=t.filter(n=>n.text),t.length||t.push({text:e.substring(0,80),scoreBonus:0}),t}function Be(e){return e.nodeName.toLocaleLowerCase().replace(/[:\.]/g,t=>"\\"+t)}function qc(e){let t="";for(let n=0;n<e.length;n++)t+=Dc(e,n);return t}function Dc(e,t){let n=e.charCodeAt(t);return n===0?"\uFFFD":n>=1&&n<=31||n>=48&&n<=57&&(t===0||t===1&&e.charCodeAt(0)===45)?"\\"+n.toString(16)+" ":t===0&&n===45&&e.length===1?"\\"+e.charAt(t):n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122?e.charAt(t):"\\"+e.charAt(t)}function Uc(e,t,n={}){var r;let o=new e.LineCounter,u={keepSourceTokens:!0,lineCounter:o,...n},l=e.parseDocument(t,u),h=[],p=w=>[o.linePos(w[0]),o.linePos(w[1])],b=w=>{h.push({message:w.message,range:[o.linePos(w.pos[0]),o.linePos(w.pos[1])]})},v=(w,A)=>{for(let I of A.items){if(I instanceof e.Scalar&&typeof I.value=="string"){let B=Ui.parse(I,u,h);B&&(w.children=w.children||[],w.children.push(B));continue}if(I instanceof e.YAMLMap){m(w,I);continue}h.push({message:"Sequence items should be strings or maps",range:p(I.range||A.range)})}},m=(w,A)=>{for(let I of A.items){if(w.children=w.children||[],!(I.key instanceof e.Scalar&&typeof I.key.value=="string")){h.push({message:"Only string keys are supported",range:p(I.key.range||A.range)});continue}let U=I.key,B=I.value;if(U.value==="text"){if(!(B instanceof e.Scalar&&typeof B.value=="string")){h.push({message:"Text value should be a string",range:p(I.value.range||A.range)});continue}w.children.push({kind:"text",text:Ir(B.value)});continue}if(U.value==="/children"){if(!(B instanceof e.Scalar&&typeof B.value=="string")||B.value!=="contain"&&B.value!=="equal"&&B.value!=="deep-equal"){h.push({message:'Strict value should be "contain", "equal" or "deep-equal"',range:p(I.value.range||A.range)});continue}w.containerMode=B.value;continue}if(U.value.startsWith("/")){if(!(B instanceof e.Scalar&&typeof B.value=="string")){h.push({message:"Property value should be a string",range:p(I.value.range||A.range)});continue}w.props=w.props??{},w.props[U.value.slice(1)]=Ir(B.value);continue}let V=Ui.parse(U,u,h);if(!V)continue;if(B instanceof e.Scalar){let ee=typeof B.value;if(ee!=="string"&&ee!=="number"&&ee!=="boolean"){h.push({message:"Node value should be a string or a sequence",range:p(I.value.range||A.range)});continue}w.children.push({...V,children:[{kind:"text",text:Ir(String(B.value))}]});continue}if(B instanceof e.YAMLSeq){w.children.push(V),v(V,B);continue}h.push({message:"Map values should be strings or sequences",range:p(I.value.range||A.range)})}},y={kind:"role",role:"fragment"};return l.errors.forEach(b),h.length?{errors:h,fragment:y}:(l.contents instanceof e.YAMLSeq||h.push({message:'Aria snapshot must be a YAML sequence, elements starting with " -"',range:l.contents?p(l.contents.range):[{line:0,col:0},{line:0,col:0}]}),h.length?{errors:h,fragment:y}:(v(y,l.contents),h.length?{errors:h,fragment:Bc}:((r=y.children)==null?void 0:r.length)===1?{fragment:y.children[0],errors:h}:{fragment:y,errors:h}))}var Bc={kind:"role",role:"fragment"};function Yo(e){return e.replace(/[\u200b\u00ad]/g,"").replace(/[\r\n\s\t]+/g," ").trim()}function Ir(e){return e.startsWith("/")&&e.endsWith("/")&&e.length>1?{pattern:e.slice(1,-1)}:Yo(e)}var Ui=class Qo{_input;_pos;_length;static parse(t,n,r){try{return new Qo(t.value)._parse()}catch(o){if(o instanceof Bi){let u=n.prettyErrors===!1?o.message:o.message+`:
4
4
 
@@ -15,7 +15,7 @@ ${e.stack}`,{e:{n:e.name,m:e.message,s:l}}}if(Ql(e))return{d:e.toJSON()};if(Xl(e
15
15
  })()`);return new n(this,t)}async viewportRatio(e){return await new Promise(t=>{let n=new IntersectionObserver(r=>{t(r[0].intersectionRatio),n.disconnect()});n.observe(e),this.utils.builtins.requestAnimationFrame(()=>{})})}getElementBorderWidth(e){if(e.nodeType!==Node.ELEMENT_NODE||!e.ownerDocument||!e.ownerDocument.defaultView)return{left:0,top:0};let t=e.ownerDocument.defaultView.getComputedStyle(e);return{left:parseInt(t.borderLeftWidth||"",10),top:parseInt(t.borderTopWidth||"",10)}}describeIFrameStyle(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return"error:notconnected";let t=e.ownerDocument.defaultView;for(let r=e;r;r=ge(r))if(t.getComputedStyle(r).transform!=="none")return"transformed";let n=t.getComputedStyle(e);return{left:parseInt(n.borderLeftWidth||"",10)+parseInt(n.paddingLeft||"",10),top:parseInt(n.borderTopWidth||"",10)+parseInt(n.paddingTop||"",10)}}retarget(e,t){let n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n)return null;if(t==="none")return n;if(!n.matches("input, textarea, select")&&!n.isContentEditable&&(t==="button-link"?n=n.closest("button, [role=button], a, [role=link]")||n:n=n.closest("button, [role=button], [role=checkbox], [role=radio]")||n),t==="follow-label"&&!n.matches("a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=radio]")&&!n.isContentEditable){let r=n.closest("label");r&&r.control&&(n=r.control)}return n}async checkElementStates(e,t){if(t.includes("stable")){let n=await this._checkElementIsStable(e);if(n===!1)return{missingState:"stable"};if(n==="error:notconnected")return"error:notconnected"}for(let n of t)if(n!=="stable"){let r=this.elementState(e,n);if(r.received==="error:notconnected")return"error:notconnected";if(!r.matches)return{missingState:n}}}async _checkElementIsStable(e){let t=Symbol("continuePolling"),n,r=0,o=0,u=()=>{let v=this.retarget(e,"no-follow-label");if(!v)return"error:notconnected";let m=this.utils.builtins.performance.now();if(this._stableRafCount>1&&m-o<15)return t;o=m;let y=v.getBoundingClientRect(),w={x:y.top,y:y.left,width:y.width,height:y.height};if(n){if(!(w.x===n.x&&w.y===n.y&&w.width===n.width&&w.height===n.height))return!1;if(++r>=this._stableRafCount)return!0}return n=w,t},l,h,p=new Promise((v,m)=>{l=v,h=m}),b=()=>{try{let v=u();v!==t?l(v):this.utils.builtins.requestAnimationFrame(b)}catch(v){h(v)}};return this.utils.builtins.requestAnimationFrame(b),p}_createAriaRefEngine(){return{queryAll:(t,n)=>{var r,o;let u=(o=(r=this._lastAriaSnapshot)==null?void 0:r.elements)==null?void 0:o.get(n);return u&&u.isConnected?[u]:[]}}}elementState(e,t){let n=this.retarget(e,["visible","hidden"].includes(t)?"none":"follow-label");if(!n||!n.isConnected)return t==="hidden"?{matches:!0,received:"hidden"}:{matches:!1,received:"error:notconnected"};if(t==="visible"||t==="hidden"){let r=Ge(n);return{matches:t==="visible"?r:!r,received:r?"visible":"hidden"}}if(t==="disabled"||t==="enabled"){let r=tn(n);return{matches:t==="disabled"?r:!r,received:r?"disabled":"enabled"}}if(t==="editable"){let r=tn(n),o=Oo(n);if(o==="error")throw this.createStacklessError("Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]");return{matches:!r&&!o,received:r?"disabled":o?"readOnly":"editable"}}if(t==="checked"||t==="unchecked"){let r=t==="checked",o=Lo(n);if(o==="error")throw this.createStacklessError("Not a checkbox or radio button");return{matches:r===o,received:o?"checked":"unchecked"}}if(t==="indeterminate"){let r=Io(n);if(r==="error")throw this.createStacklessError("Not a checkbox or radio button");return{matches:r==="mixed",received:r===!0?"checked":r===!1?"unchecked":"mixed"}}throw this.createStacklessError(`Unexpected element state "${t}"`)}selectOptions(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()!=="select")throw this.createStacklessError("Element is not a <select> element");let r=n,o=[...r.options],u=[],l=t.slice();for(let h=0;h<o.length;h++){let p=o[h],b=v=>{if(v instanceof Node)return p===v;let m=!0;return v.valueOrLabel!==void 0&&(m=m&&(v.valueOrLabel===p.value||v.valueOrLabel===p.label)),v.value!==void 0&&(m=m&&v.value===p.value),v.label!==void 0&&(m=m&&v.label===p.label),v.index!==void 0&&(m=m&&v.index===h),m};if(l.some(b))if(u.push(p),r.multiple)l=l.filter(v=>!b(v));else{l=[];break}}return l.length?"error:optionsnotfound":(r.value=void 0,u.forEach(h=>h.selected=!0),r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0})),u.map(h=>h.value))}fill(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()==="input"){let r=n,o=r.type.toLowerCase(),u=new Set(["color","date","time","datetime-local","month","range","week"]);if(!new Set(["","email","number","password","search","tel","text","url"]).has(o)&&!u.has(o))throw this.createStacklessError(`Input of type "${o}" cannot be filled`);if(o==="number"&&(t=t.trim(),isNaN(Number(t))))throw this.createStacklessError("Cannot type text into input[type=number]");if(u.has(o)){if(t=t.trim(),r.focus(),r.value=t,r.value!==t)throw this.createStacklessError("Malformed value");return n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),"done"}}else if(n.nodeName.toLowerCase()!=="textarea"){if(!n.isContentEditable)throw this.createStacklessError("Element is not an <input>, <textarea> or [contenteditable] element")}return this.selectText(n),"needsinput"}selectText(e){let t=this.retarget(e,"follow-label");if(!t)return"error:notconnected";if(t.nodeName.toLowerCase()==="input"){let o=t;return o.select(),o.focus(),"done"}if(t.nodeName.toLowerCase()==="textarea"){let o=t;return o.selectionStart=0,o.selectionEnd=o.value.length,o.focus(),"done"}let n=t.ownerDocument.createRange();n.selectNodeContents(t);let r=t.ownerDocument.defaultView.getSelection();return r&&(r.removeAllRanges(),r.addRange(n)),t.focus(),"done"}_activelyFocused(e){let t=e.getRootNode().activeElement,n=t===e&&!!e.ownerDocument&&e.ownerDocument.hasFocus();return{activeElement:t,isFocused:n}}focusNode(e,t){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");let{activeElement:n,isFocused:r}=this._activelyFocused(e);if(e.isContentEditable&&!r&&n&&n.blur&&n.blur(),e.focus(),e.focus(),t&&!r&&e.nodeName.toLowerCase()==="input")try{e.setSelectionRange(0,0)}catch{}return"done"}blurNode(e){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");return e.blur(),"done"}setInputFiles(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"Node is not of type HTMLElement";let n=e;if(n.nodeName!=="INPUT")return"Not an <input> element";let r=n;if((r.getAttribute("type")||"").toLowerCase()!=="file")return"Not an input[type=file] element";let u=t.map(h=>{let p=Uint8Array.from(atob(h.buffer),b=>b.charCodeAt(0));return new File([p],h.name,{type:h.mimeType,lastModified:h.lastModifiedMs})}),l=new DataTransfer;for(let h of u)l.items.add(h);r.files=l.files,r.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))}expectHitTarget(e,t){let n=[],r=t;for(;r;){let m=Yr(r);if(!m||(n.push(m),m.nodeType===9))break;r=m.host}let o;for(let m=n.length-1;m>=0;m--){let y=n[m],w=y.elementsFromPoint(e.x,e.y),A=y.elementFromPoint(e.x,e.y);if(A&&w[0]&&ge(A)===w[0]){let $=this.window.getComputedStyle(A);($==null?void 0:$.display)==="contents"&&w.unshift(A)}w[0]&&w[0].shadowRoot===y&&w[1]===A&&w.shift();let I=w[0];if(!I||(o=I,m&&I!==n[m-1].host))break}let u=[],l=[];for(;o&&o!==t;)u.push(o),l.push(["sticky","fixed"].includes(this.window.getComputedStyle(o).position)),o=ge(o);if(o===t)return"done";let h=this.previewNode(u[0]||this.document.documentElement),p=l.some(m=>m),b,v=t;for(;v;){let m=u.indexOf(v);if(m!==-1){m>1&&(b=this.previewNode(u[m-1])),p=l.slice(0,m).some(y=>y);break}v=ge(v)}return b?{hitTargetDescription:`${h} from ${b} subtree`,hasPositionStickyOrFixed:p}:{hitTargetDescription:h,hasPositionStickyOrFixed:p}}setupHitTargetInterceptor(e,t,n,r){let o=this.retarget(e,"button-link");if(!o||!o.isConnected)return"error:notconnected";if(n){let b=this.expectHitTarget(n,o);if(b!=="done")return JSON.stringify(b)}if(t==="drag")return{stop:()=>"done"};let u={hover:this._hoverHitTargetInterceptorEvents,tap:this._tapHitTargetInterceptorEvents,mouse:this._mouseHitTargetInterceptorEvents}[t],l,h=b=>{if(!u.has(b.type)||!b.isTrusted)return;let v=this.window.TouchEvent&&b instanceof this.window.TouchEvent?b.touches[0]:b;l===void 0&&v&&(l=this.expectHitTarget({x:v.clientX,y:v.clientY},o)),(r||l!=="done"&&l!==void 0)&&(b.preventDefault(),b.stopPropagation(),b.stopImmediatePropagation())},p=()=>(this._hitTargetInterceptor===h&&(this._hitTargetInterceptor=void 0),l||"done");return this._hitTargetInterceptor=h,{stop:p}}dispatchEvent(e,t,n){var r,o,u;let l,h={bubbles:!0,cancelable:!0,composed:!0,...n};switch(this._eventTypes.get(t)){case"mouse":l=new MouseEvent(t,h);break;case"keyboard":l=new KeyboardEvent(t,h);break;case"touch":{if(this._browserName==="webkit"){let p=v=>{var m,y;if(v instanceof Touch)return v;let w=v.pageX;w===void 0&&v.clientX!==void 0&&(w=v.clientX+(((m=this.document.scrollingElement)==null?void 0:m.scrollLeft)||0));let A=v.pageY;return A===void 0&&v.clientY!==void 0&&(A=v.clientY+(((y=this.document.scrollingElement)==null?void 0:y.scrollTop)||0)),this.document.createTouch(this.window,v.target??e,v.identifier,w,A,v.screenX,v.screenY,v.radiusX,v.radiusY,v.rotationAngle,v.force)},b=v=>v instanceof TouchList||!v?v:this.document.createTouchList(...v.map(p));h.target??=e,h.touches=b(h.touches),h.targetTouches=b(h.targetTouches),h.changedTouches=b(h.changedTouches),l=new TouchEvent(t,h)}else h.target??=e,h.touches=(r=h.touches)==null?void 0:r.map(p=>p instanceof Touch?p:new Touch({...p,target:p.target??e})),h.targetTouches=(o=h.targetTouches)==null?void 0:o.map(p=>p instanceof Touch?p:new Touch({...p,target:p.target??e})),h.changedTouches=(u=h.changedTouches)==null?void 0:u.map(p=>p instanceof Touch?p:new Touch({...p,target:p.target??e})),l=new TouchEvent(t,h);break}case"pointer":l=new PointerEvent(t,h);break;case"focus":l=new FocusEvent(t,h);break;case"drag":l=new DragEvent(t,h);break;case"wheel":l=new WheelEvent(t,h);break;case"deviceorientation":try{l=new DeviceOrientationEvent(t,h)}catch{let{bubbles:p,cancelable:b,alpha:v,beta:m,gamma:y,absolute:w}=h;l=this.document.createEvent("DeviceOrientationEvent"),l.initDeviceOrientationEvent(t,p,b,v,m,y,w)}break;case"devicemotion":try{l=new DeviceMotionEvent(t,h)}catch{let{bubbles:p,cancelable:b,acceleration:v,accelerationIncludingGravity:m,rotationRate:y,interval:w}=h;l=this.document.createEvent("DeviceMotionEvent"),l.initDeviceMotionEvent(t,p,b,v,m,y,w)}break;default:l=new Event(t,h);break}e.dispatchEvent(l)}previewNode(e){if(e.nodeType===Node.TEXT_NODE)return Rn(`#text=${e.nodeValue||""}`);if(e.nodeType!==Node.ELEMENT_NODE)return Rn(`<${e.nodeName.toLowerCase()} />`);let t=e,n=[];for(let h=0;h<t.attributes.length;h++){let{name:p,value:b}=t.attributes[h];p!=="style"&&(!b&&this._booleanAttributes.has(p)?n.push(` ${p}`):n.push(` ${p}="${b}"`))}n.sort((h,p)=>h.length-p.length);let r=Mr(n.join(""),500);if(this._autoClosingTags.has(t.nodeName))return Rn(`<${t.nodeName.toLowerCase()}${r}/>`);let o=t.childNodes,u=!1;if(o.length<=5){u=!0;for(let h=0;h<o.length;h++)u=u&&o[h].nodeType===Node.TEXT_NODE}let l=u?t.textContent||"":o.length?"\u2026":"";return Rn(`<${t.nodeName.toLowerCase()}${r}>${Mr(l,50)}</${t.nodeName.toLowerCase()}>`)}strictModeViolationError(e,t){let n=t.slice(0,10).map(o=>({preview:this.previewNode(o),selector:this.generateSelectorSimple(o)})),r=n.map((o,u)=>`
16
16
  ${u+1}) ${o.preview} aka ${Qt(this._sdkLanguage,o.selector)}`);return n.length<t.length&&r.push(`
17
17
  ...`),this.createStacklessError(`strict mode violation: ${Qt(this._sdkLanguage,je(e))} resolved to ${t.length} elements:${r.join("")}
18
- `)}createStacklessError(e){if(this._browserName==="firefox"){let n=new Error("Error: "+e);return n.stack="",n}let t=new Error(e);return delete t.stack,t}createHighlight(){return new Or(this)}maskSelectors(e,t){this._highlight&&this.hideHighlight(),this._highlight=new Or(this),this._highlight.install();let n=[];for(let r of e)n.push(this.querySelectorAll(r,this.document.documentElement));this._highlight.maskElements(n.flat(),t)}highlight(e){this._highlight||(this._highlight=new Or(this),this._highlight.install()),this._highlight.runHighlightOnRaf(e)}hideHighlight(){this._highlight&&(this._highlight.uninstall(),delete this._highlight)}markTargetElements(e,t){var n,r;((n=this._markedElements)==null?void 0:n.callId)!==t&&(this._markedElements=void 0);let o=((r=this._markedElements)==null?void 0:r.elements)||new Set,u=new CustomEvent("__playwright_unmark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let h of o)e.has(h)||h.dispatchEvent(u);let l=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let h of e)o.has(h)||h.dispatchEvent(l);this._markedElements={callId:t,elements:e}}_setupGlobalListenersRemovalDetection(){let e="__playwright_global_listeners_check__",t=!1,n=()=>t=!0;this.window.addEventListener(e,n),new MutationObserver(r=>{if(r.some(u=>Array.from(u.addedNodes).includes(this.document.documentElement))&&(t=!1,this.window.dispatchEvent(new CustomEvent(e)),!t)){this.window.addEventListener(e,n);for(let u of this.onGlobalListenersRemoved)u()}}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=n=>{var r;return(r=this._hitTargetInterceptor)==null?void 0:r.call(this,n)},t=()=>{for(let n of this._allHitTargetInterceptorEvents)this.window.addEventListener(n,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,n){return t.expression==="to.have.count"||t.expression.endsWith(".array")?this.expectArray(n,t):e?await this.expectSingleElement(e,t):!t.isNot&&t.expression==="to.be.hidden"?{matches:!0}:t.isNot&&t.expression==="to.be.visible"?{matches:!1}:!t.isNot&&t.expression==="to.be.detached"?{matches:!0}:t.isNot&&t.expression==="to.be.attached"?{matches:!1}:t.isNot&&t.expression==="to.be.in.viewport"?{matches:!1}:{matches:t.isNot,missingReceived:!0}}async expectSingleElement(e,t){var n;let r=t.expression;{let o;if(r==="to.have.attribute"){let u=e.hasAttribute(t.expressionArg);o={matches:u,received:u?"attribute present":"attribute not present"}}else if(r==="to.be.checked"){let{checked:u,indeterminate:l}=t.expectedValue;if(l){if(u!==void 0)throw this.createStacklessError("Can't assert indeterminate and checked at the same time");o=this.elementState(e,"indeterminate")}else o=this.elementState(e,u===!1?"unchecked":"checked")}else if(r==="to.be.disabled")o=this.elementState(e,"disabled");else if(r==="to.be.editable")o=this.elementState(e,"editable");else if(r==="to.be.readonly")o=this.elementState(e,"editable"),o.matches=!o.matches;else if(r==="to.be.empty")if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let u=e.value;o={matches:!u,received:u?"notEmpty":"empty"}}else{let u=(n=e.textContent)==null?void 0:n.trim();o={matches:!u,received:u?"notEmpty":"empty"}}else if(r==="to.be.enabled")o=this.elementState(e,"enabled");else if(r==="to.be.focused"){let u=this._activelyFocused(e).isFocused;o={matches:u,received:u?"focused":"inactive"}}else r==="to.be.hidden"?o=this.elementState(e,"hidden"):r==="to.be.visible"?o=this.elementState(e,"visible"):r==="to.be.attached"?o={matches:!0,received:"attached"}:r==="to.be.detached"&&(o={matches:!1,received:"attached"});if(o){if(o.received==="error:notconnected")throw this.createStacklessError("Element is not connected");return o}}if(r==="to.have.property"){let o=e,u=t.expressionArg.split(".");for(let p=0;p<u.length-1;p++){if(typeof o!="object"||!(u[p]in o))return{received:void 0,matches:!1};o=o[u[p]]}let l=o[u[u.length-1]],h=Hr(l,t.expectedValue);return{received:l,matches:h}}if(r==="to.be.in.viewport"){let o=await this.viewportRatio(e);return{received:`viewport ratio ${o}`,matches:o>0&&o>(t.expectedNumber??0)-1e-9}}if(r==="to.have.values"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="SELECT"||!e.multiple)throw this.createStacklessError("Not a select element with a multiple attribute");let o=[...e.selectedOptions].map(u=>u.value);return o.length!==t.expectedText.length?{received:o,matches:!1}:{received:o,matches:o.map((u,l)=>new Dn(t.expectedText[l]).matches(u)).every(Boolean)}}if(r==="to.match.aria"){let o=al(e,t.expectedValue);return{received:o.received,matches:!!o.matches.length}}{let o;if(r==="to.have.attribute.value"){let u=e.getAttribute(t.expressionArg);if(u===null)return{received:null,matches:!1};o=u}else if(["to.have.class","to.contain.class"].includes(r)){if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+r);return{received:e.classList.toString(),matches:new Dn(t.expectedText[0]).matchesClassList(this,e.classList,r==="to.contain.class")}}else if(r==="to.have.css")o=this.window.getComputedStyle(e).getPropertyValue(t.expressionArg);else if(r==="to.have.id")o=e.id;else if(r==="to.have.text")o=t.useInnerText?e.innerText:Ee(new Map,e).full;else if(r==="to.have.accessible.name")o=At(e,!1);else if(r==="to.have.accessible.description")o=Rr(e,!1);else if(r==="to.have.accessible.error.message")o=Co(e);else if(r==="to.have.role")o=ue(e)||"";else if(r==="to.have.title")o=this.document.title;else if(r==="to.have.url")o=this.document.location.href;else if(r==="to.have.value"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"&&e.nodeName!=="SELECT")throw this.createStacklessError("Not an input element");o=e.value}if(o!==void 0&&t.expectedText){let u=new Dn(t.expectedText[0]);return{received:o,matches:u.matches(o)}}}throw this.createStacklessError("Unknown expect matcher: "+r)}expectArray(e,t){let n=t.expression;if(n==="to.have.count"){let h=e.length,p=h===t.expectedNumber;return{received:h,matches:p}}if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);if(["to.have.class.array","to.contain.class.array"].includes(n)){let h=e.map(v=>v.classList),p=h.map(String);if(h.length!==t.expectedText.length)return{received:p,matches:!1};let b=this._matchSequentially(t.expectedText,h,(v,m)=>v.matchesClassList(this,m,n==="to.contain.class.array"));return{received:p,matches:b}}if(!["to.contain.text.array","to.have.text.array"].includes(n))throw this.createStacklessError("Unknown expect matcher: "+n);let r=e.map(h=>t.useInnerText?h.innerText:Ee(new Map,h).full),o=n!=="to.contain.text.array";if(!(r.length===t.expectedText.length||!o))return{received:r,matches:!1};let l=this._matchSequentially(t.expectedText,r,(h,p)=>h.matches(p));return{received:r,matches:l}}_matchSequentially(e,t,n){let r=e.map(l=>new Dn(l)),o=0,u=0;for(;o<r.length&&u<t.length;)n(r[o],t[u])&&++o,++u;return o===r.length}};function Rn(e){return e.replace(/\n/g,"\u21B5").replace(/\t/g,"\u21C6")}function ou(e){if(e=e.substring(1,e.length-1),!e.includes("\\"))return e;let t=[],n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length&&n++,t.push(e[n++]);return t.join("")}function qn(e,t){if(e[0]==="/"&&e.lastIndexOf("/")>0){let o=e.lastIndexOf("/"),u=new RegExp(e.substring(1,o),e.substring(o+1));return{matcher:l=>u.test(l.full),kind:"regex"}}let n=t?JSON.parse.bind(JSON):ou,r=!1;return e.length>1&&e[0]==='"'&&e[e.length-1]==='"'?(e=n(e),r=!0):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="i"?(e=n(e.substring(0,e.length-1)),r=!1):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="s"?(e=n(e.substring(0,e.length-1)),r=!0):e.length>1&&e[0]==="'"&&e[e.length-1]==="'"&&(e=n(e),r=!0),e=ve(e),r?t?{kind:"strict",matcher:u=>u.normalized===e}:{matcher:u=>!e&&!u.immediate.length?!0:u.immediate.some(l=>ve(l)===e),kind:"strict"}:(e=e.toLowerCase(),{kind:"lax",matcher:o=>o.normalized.toLowerCase().includes(e)})}var Dn=class{_string;_substring;_regex;_normalizeWhiteSpace;_ignoreCase;constructor(e){if(this._normalizeWhiteSpace=e.normalizeWhiteSpace,this._ignoreCase=e.ignoreCase,this._string=e.matchSubstring?void 0:this.normalize(e.string),this._substring=e.matchSubstring?this.normalize(e.string):void 0,e.regexSource){let t=new Set((e.regexFlags||"").split(""));e.ignoreCase===!1&&t.delete("i"),e.ignoreCase===!0&&t.add("i"),this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){return this._regex||(e=this.normalize(e)),this._string!==void 0?e===this._string:this._substring!==void 0?e.includes(this._substring):this._regex?!!this._regex.test(e):!1}matchesClassList(e,t,n){if(n){if(this._regex)throw e.createStacklessError("Partial matching does not support regular expressions. Please provide a string value.");return this._string.split(/\s+/g).filter(Boolean).every(r=>t.contains(r))}return this.matches(t.toString())}normalize(e){return e&&(this._normalizeWhiteSpace&&(e=ve(e)),this._ignoreCase&&(e=e.toLocaleLowerCase()),e)}};function Hr(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!Hr(e[r],t[r]))return!1;return!0}if(e instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;++r)if(!t.hasOwnProperty(n[r]))return!1;for(let r of n)if(!Hr(e[r],t[r]))return!1;return!0}return typeof e=="number"&&typeof t=="number"?isNaN(e)&&isNaN(t):!1}var Me={selectorUtils:Ji,roleUtils:to,domUtils:Eo,selectorGenerator:qo,stringUtils:zi,InjectedScript:iu},pa=function(){if(!Me.InjectedScript)throw new Error("InjectedScript is not available yet.");let e=Me.InjectedScript,t=this.options||{sdkLanguage:"javascript",testIdAttributeName:"blinq-test-id",stableRafCount:0,browserName:"chromium",inputFileRoleTextbox:!1,customEngines:[],isUnderTest:!0};return new e(window,t)};var au=["slot","alt","name","placeholder","title","aria-label","aria-placeholder","role","data-testid","data-cy"];function cu(e){return`"${e.replace(/["\\]/g,t=>"\\"+t)}"`}function lu(e){return/^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e)?"#"+e:`[id=${cu(e)}]`}function uu(e){let t="";for(let n=0;n<e.length;n++)t+=hu(e,n);return t}function hu(e,t){let n=e.charCodeAt(t);return n===0?"\uFFFD":n>=1&&n<=31||n>=48&&n<=57&&(t===0||t===1&&e.charCodeAt(0)===45)?"\\"+n.toString(16)+" ":t===0&&n===45&&e.length===1?"\\"+e.charAt(t):n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122?e.charAt(t):"\\"+e.charAt(t)}var Ts=class{constructor(t,n={}){this.locatorStrategies={text:"basic",no_text:"no_text",custom:"custom",context:"context",digitIgnore:"ignore_digit",text_with_index:"text_with_index"},this.options=n,this.dom_Parent=new Ai,this.PW=Me,this.injectedScript=t,this.cache=new Map}generateUniqueCSSSelector(t,n){var y;let r=(n==null?void 0:n.root)||window.document,o=(n==null?void 0:n.separator)||" > ",u=(n==null?void 0:n.isunique)||(w=>this.getMatchingElements(w,n).length===1),l=(n==null?void 0:n.noCSSId)||!1;if(!(t instanceof Element)||!r.contains(t))return"";let h="",p=t.getAttribute("id");if(p&&!/\d/.test(p)&&!l&&(h=lu(p),u(h))||t.tagName&&(h=t.tagName.toLowerCase()+h,u(h)))return h;let b=Array.from(t.classList).filter(w=>!/\d/.test(w));if(b.length&&(h+=b.map(w=>"."+uu(w)).join(""),u(h)))return h;for(let w of au)if(t.hasAttribute(w)){let A=t.getAttribute(w);if(A===""||/\d/.test(A))continue;A=A.replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g,"\\$&"),h+=`[${w}="${this.PW.stringUtils.escapeForAttributeSelector(A)}"]`}if(u(h)||t===r)return h;let v=t.parentElement;if(v){if(v!==r&&(t.assignedSlot&&(v=t.assignedSlot.parentElement??t.assignedSlot.parentNode.host),v&&v!==r&&(h=this.generateUniqueCSSSelector(v,n)+o+h,u(h))))return h}else if(t.parentNode instanceof ShadowRoot){let w=t.parentNode.host;if(w&&w!==r&&(h=this.generateUniqueCSSSelector(w,n)+" >>> "+h,u(h)))return h}let m=(y=t.parentElement)==null?void 0:y.children;if(m){for(let w=0;w<m.length;w++)if(m[w]===t)return h+`:nth-child(${w+1})`}return""}getMatchingElements(t,n={}){let{root:r=window.document,prefix:o,visible:u=!0}=n;return u&&(t=`${t} >> visible=true`),o&&(t=`${o} >> ${t}`),this.injectedScript.querySelectorAll(this.injectedScript.parseSelector(t),r)}getLocatorStrategies(){return this.locatorStrategies}getTextLocators(t,n){let r=this.injectedScript,o=this.PW.selectorGenerator.buildTextCandidates(r,t,n),u=[];for(let l of o){let h=0,p=[];for(let m of l){let{engine:y,selector:w}=m;y==="css"?p.push(w):p.push(`${y}=${w}`),h+=m.score}let b=p.join(" >> "),v=h/l.length;u.push({css:b,score:v})}return u}getNoTextLocators(t,n){let r=this.injectedScript,o=this.PW.selectorGenerator.buildNoTextCandidates(r,t,n);for(let u of o)u.engine==="css"?u.css=u.selector:u.css=`${u.engine}=${u.selector}`,delete u.engine,delete u.selector;return o}getCustomLocators(t,n){let{customAttributes:r=[]}=this.options;if(!r||!Array.isArray(r))return console.error("Custom attributes must be an array"),[];let o=[],u=[];for(let l of r){if(!l||typeof l!="string"){console.error("Custom attribute must be a string");continue}let h=t.getAttribute(l);h!==null&&(u.push(l),o.push({css:`[${l}=${this.PW.stringUtils.escapeForAttributeSelector(h)}]`,score:1,priority:1}))}return o}getContextLocators(t,n){if(!n||!Array.isArray(n))return console.error("Locators must be an array"),[];let r=[],o=new Set;for(let u of n){let l=u.css;if(!l||typeof l!="string"){console.error("Locator must have a valid css selector");continue}let p=this.injectedScript.parseSelector(l).parts;if(!p||!Array.isArray(p)||p.length===0){console.error("Locator must have a valid css selector");continue}if(p.length<3)continue;let b=p[0];if(b.name!=="internal:text")continue;let v=b.body;if(!v||typeof v!="string"||v.length===0){console.error("Locator must have a valid text in the first part to be a context locator");continue}let m=p[1];if(m.name!=="xpath")continue;let y=m.body;if(!y||typeof y!="string"||y.length===0)continue;let w=m.body;if(!w||typeof w!="string"||w.length===0)continue;let A=/(\.\.)(\/\.\.)*/;try{if(A.test(w)){let $=w.split("..").length-1,U=l.indexOf(w),B=l.substring(U+w.length+3).trim();if(B.length===0)continue;let V=`internal:text=${v}`,te=this.getMatchingElements(V,{});if(te.length!==1){console.error("Context locator must have exactly one element matching the text part");continue}let ne=te[0],ee=this.injectedScript.utils.elementText(new Map,ne).full,ie=`${V} >> xpath=${y} >> ${B}`,ke=this.getMatchingElements(ie,{});if(ke.length!==1){console.error("Context locator must have exactly one element matching the full selector");continue}if(ke[0]!==t){console.error("Context locator must have the text element as the full element");continue}if(!o.has(ee)){o.add(ee);let se={css:B,climb:$,text:ee,priority:1};u.index!==void 0&&(se.index=u.index),r.push(se)}}}catch(I){console.error("Error parsing climb string:",I);continue}}return r.sort((u,l)=>u.text.length-l.text.length),r}getDigitIgnoreLocators(t,n){let r=[];if(!n||!Array.isArray(n))return console.error("Locators must be an array"),[];for(let o of n){let u=o.css;if(!u||typeof u!="string"){console.error("Locator must have a valid css selector");continue}let h=this.injectedScript.parseSelector(u).parts;if(!h||!Array.isArray(h)||h.length===0){console.error("Locator must have a valid css selector");continue}let p="",b=!1;for(let v of h){if(v.name!=="internal:text"){p+=`${v.name==="css"?"":v.name+"="}${v.source} >> `;continue}if(typeof v.body!="string"||v.body.length===0){p+=`${v.name==="css"?"":v.name+"="}${v.source} >> `;continue}let m=v.body,y=/\d+/g;b=y.test(m);let w=this.PW.stringUtils.escapeRegExp(m.substring(1,m.length-2));w=w.replace(y,"\\d+"),p+=`internal:text=/${w}/ >> `}if(b&&(p.endsWith(" >> ")&&(p=p.slice(0,-4)),p)){let v=this.getMatchingElements(p,{});if(v.length!==1){console.error("Digit ignore locator must have exactly one element matching the final selector");continue}if(v[0]!==t){console.error("Digit ignore locator must match the original element");continue}r.push({css:p,priority:o.priority||1})}}return r}getTextwithIndexLocators(t){if(!t||!Array.isArray(t))return console.error("Locators must be an array"),[];let n=[];for(let r of t){if(!r||!r.css||typeof r.css!="string"){console.error("Locator must have a valid css selector");continue}let o=r.index;if(typeof o!="number"||o<0){console.error("Locator must have a valid index");continue}n.push(r)}return n}getXPathSelector(t){if(typeof t!="number"||t<0)return console.error("Climb must be a non-negative integer"),"";if(t===0)return"";let n="xpath=..";if(t===1)return n;for(let r=1;r<t;r++)n+="/..";return n}categorizeLocators(t,n,r){let o=[],u=[];for(let l of n){let h=this.getMatchingElements(l.css,r);if(h.length===0){console.warn(`No elements found for locator: ${l.css}`);continue}else if(h.length===1){if(t===h[0])l.priority=1,o.push(l);else if(t.contains(h[0])){l.priority=1;let p=this.dom_Parent.getClimbCountToParent(h[0],t),b=this.getXPathSelector(p),v=`${l.css} >> ${b}`;l.css=v,o.push(l)}}else l.priority=2,l.elements=h,u.push(l)}return{unique:o,nonUnique:u}}getUniqueLocators(t,n=this.getNoTextLocators,r={}){return this.getUniqueLocators2(t,n,r)}getUniqueLocators1(t,n=this.getNoTextLocators,r={}){try{let{maxLocators:o=5,root:u=window.document.body,next:l="LCA",minLocators:h=3}=r;if(!t)return[];if(t===u)return t===window.document.documentElement?[{css:"html",score:1,priority:1},{css:":root",score:1,priority:1}]:[{css:":root",score:1,priority:1}];console.log("Generating locators for element:",t);let p=n(t,r);if(console.log("Generated locators:",p),!p||!Array.isArray(p))return console.error("Locator generator did not return an array of locators"),[];console.log("Categorizing locators for element:",t);let b=this.categorizeLocators(t,p,r);console.log("Categorized locators:",b);let{unique:v,nonUnique:m}=b,y=[];if(v.length>0&&y.push(...v),y.length>=o)return y.slice(0,o);let w=null;for(let A of m){let I=A.css??A.selector,$=A.elements||this.getMatchingElements(I,r);if(l==="parent"?w=this.dom_Parent.getActualParent(t):w=this.dom_Parent.findBranchingParent($,t),w&&w!==t)if(u.contains(w)){let U=this.getUniqueLocators(w,n,{...r,root:u});for(let B of U){if(y.length>=o)return y.slice(0,o);let te=`${B.css??B.selector} >> ${I}`,ne=this.getMatchingElements(te,r),ee=(B.score+A.score)/2+100;if(ne.length===1&&ne[0]===t)B.css=te,B.score=ee,B.priority=1,y.push(B);else{let ie=ne.indexOf(t);ie!==-1&&ie<5&&(B.css=te,B.index=ie,B.priority=2,B.score=ee,y.push(B))}}}else{let U=$.indexOf(t);U!==-1&&U<5&&(A.index=U,A.priority=2,y.push(A))}else{let U=$.indexOf(t);U!==-1&&U<5&&(A.index=U,A.priority=2,y.push(A))}delete A.elements,delete A.strategy,delete A.engine,delete A.selector}if(y.length<h&&u&&u.contains(t)){let A=this.dom_Parent.getActualParent(t),I=this.getUniqueLocators(A,n,{...r,root:u});y.push(...I)}return y.sort((A,I)=>A.score-I.score),console.log("Final locators:",y,t),console.groupEnd(),y.slice(0,o)}catch(o){return console.error("Error in getUniqueLocators:",o),[]}}getUniqueLocators2(t,n=this.getNoTextLocators,r={}){try{let{maxLocators:o=5,root:u=window.document.body}=r;if(!t)return[];if(t===u)return t===window.document.documentElement?[{css:"html",score:1,priority:1},{css:":root",score:1,priority:1}]:[{css:":root",score:1,priority:1}];console.log("Generating locators for element:",t);let l=n(t,r);if(console.log("Generated locators:",l),!l||!Array.isArray(l))return console.error("Locator generator did not return an array of locators"),[];console.log("Categorizing locators for element:",t);let h=this.categorizeLocators(t,l,r);console.log("Categorized locators:",h);let{unique:p,nonUnique:b}=h,v=[];if(p.length>0&&v.push(...p),v.length>=o)return v.slice(0,o);let m=new Map,y=this.dom_Parent.getFullAncestorChainToRoot(t,u);y.shift();let w=[];for(let I of y){let $=n(I,r);if(!$||!Array.isArray($)||$.length===0)continue;let U=this.categorizeLocators(I,$,r);if(w.push({element:I,locators:U}),m.set(I,U),U.unique.length>0)break}let A=w[w.length-1];for(let I of b){let $=I.css??I.selector;if((I.elements||this.getMatchingElements($,r)).length===0){console.warn(`No elements found for locator: ${$}`);continue}for(let B of A.locators.unique){let V=`${B.css} >> ${$}`,te=this.getMatchingElements(V,r);if(te.length===1&&te[0]===t){let ne=(B.score+I.score)/2+100,ee={...B,css:V,score:ne,priority:1};v.push(ee)}else{let ne=te.indexOf(t);if(ne!==-1&&ne<5){let ee=(B.score+I.score)/2,ie={...B,css:V,index:ne,score:ee+200,priority:2};v.push(ie)}}}}return v.sort((I,$)=>I.score-$.score),console.log("Final locators:",v,t),console.groupEnd(),v.slice(0,o)}catch(o){return console.error("Error in getUniqueLocators:",o),[]}}getElementLocators(t,n={}){var b;let{excludeText:r=!1}=n,o={};if((b=this.options)!=null&&b.customAttributes){console.groupCollapsed("Generating Custom locators for element:",t);let v=this.getUniqueLocators(t,this.getCustomLocators.bind(this),n);v.length>0&&(o[this.locatorStrategies.custom]=v)}if(console.groupEnd(),!r){console.groupCollapsed("Generating Text locators for element:",t);let v=this.getUniqueLocators(t,this.getTextLocators.bind(this),n);console.groupEnd(),v.length>0&&(o[this.locatorStrategies.text]=v);let m=this.getTextwithIndexLocators(v);m.length>0&&(o[this.locatorStrategies.text_with_index]=m);let y=this.getDigitIgnoreLocators(t,v);y.length>0&&(o[this.locatorStrategies.digitIgnore]=y);let w=this.getContextLocators(t,v);w.length>0&&(o[this.locatorStrategies.context]=w)}console.groupCollapsed("Generating No Text locators for element:",t);let u=this.getUniqueLocators(t,this.getNoTextLocators.bind(this),n);if(u.length>0)o[this.locatorStrategies.no_text]=u;else{let v=[];v.push({css:this.generateUniqueCSSSelector(t,n),score:500,priority:3}),v.length>0&&(o[this.locatorStrategies.no_text]=v)}console.groupEnd();let l=this.getBestStrategy(o);l||(console.warn("No locators found for element:",t),l=this.locatorStrategies.no_text),o.strategy=l;let h=o[o.strategy]??[],p={allStrategyLocators:o,locators:h,element_name:""};return console.log("Generated locators:",p),p}getBestStrategy(t){let n=[this.locatorStrategies.custom,this.locatorStrategies.context,this.locatorStrategies.text,this.locatorStrategies.text_with_index,this.locatorStrategies.digitIgnore,this.locatorStrategies.no_text];for(let r of n)if(t[r]&&t[r].length>0)return r;return null}},ga=Ts;var ks=class{constructor(t={}){let{inlineImages:n=!0,inlineStyles:r=!0,excludeSelectors:o=[]}=t;this.inlineImages=n,this.inlineStyles=r,this.excludeSelectors=o}imageToDataURL(t,n){try{let r=n.createElement("canvas");return r.width=t.naturalWidth||t.width,r.height=t.naturalHeight||t.height,r.getContext("2d").drawImage(t,0,0),r.toDataURL("image/png")}catch(r){return console.warn(`Failed to inline image: ${t.src}`,r),t.src}}processStyles(t){if(!this.inlineStyles)return;let n=Array.from(t.styleSheets);for(let r of n)try{if(!r.href)continue;let o=t.createElement("style"),u="",l=Array.from(r.cssRules||[]);for(let h of l)h.cssText&&(u+=h.cssText+`
18
+ `)}createStacklessError(e){if(this._browserName==="firefox"){let n=new Error("Error: "+e);return n.stack="",n}let t=new Error(e);return delete t.stack,t}createHighlight(){return new Or(this)}maskSelectors(e,t){this._highlight&&this.hideHighlight(),this._highlight=new Or(this),this._highlight.install();let n=[];for(let r of e)n.push(this.querySelectorAll(r,this.document.documentElement));this._highlight.maskElements(n.flat(),t)}highlight(e){this._highlight||(this._highlight=new Or(this),this._highlight.install()),this._highlight.runHighlightOnRaf(e)}hideHighlight(){this._highlight&&(this._highlight.uninstall(),delete this._highlight)}markTargetElements(e,t){var n,r;((n=this._markedElements)==null?void 0:n.callId)!==t&&(this._markedElements=void 0);let o=((r=this._markedElements)==null?void 0:r.elements)||new Set,u=new CustomEvent("__playwright_unmark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let h of o)e.has(h)||h.dispatchEvent(u);let l=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,detail:t,composed:!0});for(let h of e)o.has(h)||h.dispatchEvent(l);this._markedElements={callId:t,elements:e}}_setupGlobalListenersRemovalDetection(){let e="__playwright_global_listeners_check__",t=!1,n=()=>t=!0;this.window.addEventListener(e,n),new MutationObserver(r=>{if(r.some(u=>Array.from(u.addedNodes).includes(this.document.documentElement))&&(t=!1,this.window.dispatchEvent(new CustomEvent(e)),!t)){this.window.addEventListener(e,n);for(let u of this.onGlobalListenersRemoved)u()}}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=n=>{var r;return(r=this._hitTargetInterceptor)==null?void 0:r.call(this,n)},t=()=>{for(let n of this._allHitTargetInterceptorEvents)this.window.addEventListener(n,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,n){return t.expression==="to.have.count"||t.expression.endsWith(".array")?this.expectArray(n,t):e?await this.expectSingleElement(e,t):!t.isNot&&t.expression==="to.be.hidden"?{matches:!0}:t.isNot&&t.expression==="to.be.visible"?{matches:!1}:!t.isNot&&t.expression==="to.be.detached"?{matches:!0}:t.isNot&&t.expression==="to.be.attached"?{matches:!1}:t.isNot&&t.expression==="to.be.in.viewport"?{matches:!1}:{matches:t.isNot,missingReceived:!0}}async expectSingleElement(e,t){var n;let r=t.expression;{let o;if(r==="to.have.attribute"){let u=e.hasAttribute(t.expressionArg);o={matches:u,received:u?"attribute present":"attribute not present"}}else if(r==="to.be.checked"){let{checked:u,indeterminate:l}=t.expectedValue;if(l){if(u!==void 0)throw this.createStacklessError("Can't assert indeterminate and checked at the same time");o=this.elementState(e,"indeterminate")}else o=this.elementState(e,u===!1?"unchecked":"checked")}else if(r==="to.be.disabled")o=this.elementState(e,"disabled");else if(r==="to.be.editable")o=this.elementState(e,"editable");else if(r==="to.be.readonly")o=this.elementState(e,"editable"),o.matches=!o.matches;else if(r==="to.be.empty")if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let u=e.value;o={matches:!u,received:u?"notEmpty":"empty"}}else{let u=(n=e.textContent)==null?void 0:n.trim();o={matches:!u,received:u?"notEmpty":"empty"}}else if(r==="to.be.enabled")o=this.elementState(e,"enabled");else if(r==="to.be.focused"){let u=this._activelyFocused(e).isFocused;o={matches:u,received:u?"focused":"inactive"}}else r==="to.be.hidden"?o=this.elementState(e,"hidden"):r==="to.be.visible"?o=this.elementState(e,"visible"):r==="to.be.attached"?o={matches:!0,received:"attached"}:r==="to.be.detached"&&(o={matches:!1,received:"attached"});if(o){if(o.received==="error:notconnected")throw this.createStacklessError("Element is not connected");return o}}if(r==="to.have.property"){let o=e,u=t.expressionArg.split(".");for(let p=0;p<u.length-1;p++){if(typeof o!="object"||!(u[p]in o))return{received:void 0,matches:!1};o=o[u[p]]}let l=o[u[u.length-1]],h=Hr(l,t.expectedValue);return{received:l,matches:h}}if(r==="to.be.in.viewport"){let o=await this.viewportRatio(e);return{received:`viewport ratio ${o}`,matches:o>0&&o>(t.expectedNumber??0)-1e-9}}if(r==="to.have.values"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="SELECT"||!e.multiple)throw this.createStacklessError("Not a select element with a multiple attribute");let o=[...e.selectedOptions].map(u=>u.value);return o.length!==t.expectedText.length?{received:o,matches:!1}:{received:o,matches:o.map((u,l)=>new Dn(t.expectedText[l]).matches(u)).every(Boolean)}}if(r==="to.match.aria"){let o=al(e,t.expectedValue);return{received:o.received,matches:!!o.matches.length}}{let o;if(r==="to.have.attribute.value"){let u=e.getAttribute(t.expressionArg);if(u===null)return{received:null,matches:!1};o=u}else if(["to.have.class","to.contain.class"].includes(r)){if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+r);return{received:e.classList.toString(),matches:new Dn(t.expectedText[0]).matchesClassList(this,e.classList,r==="to.contain.class")}}else if(r==="to.have.css")o=this.window.getComputedStyle(e).getPropertyValue(t.expressionArg);else if(r==="to.have.id")o=e.id;else if(r==="to.have.text")o=t.useInnerText?e.innerText:Ee(new Map,e).full;else if(r==="to.have.accessible.name")o=At(e,!1);else if(r==="to.have.accessible.description")o=Rr(e,!1);else if(r==="to.have.accessible.error.message")o=Co(e);else if(r==="to.have.role")o=ue(e)||"";else if(r==="to.have.title")o=this.document.title;else if(r==="to.have.url")o=this.document.location.href;else if(r==="to.have.value"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"&&e.nodeName!=="SELECT")throw this.createStacklessError("Not an input element");o=e.value}if(o!==void 0&&t.expectedText){let u=new Dn(t.expectedText[0]);return{received:o,matches:u.matches(o)}}}throw this.createStacklessError("Unknown expect matcher: "+r)}expectArray(e,t){let n=t.expression;if(n==="to.have.count"){let h=e.length,p=h===t.expectedNumber;return{received:h,matches:p}}if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);if(["to.have.class.array","to.contain.class.array"].includes(n)){let h=e.map(v=>v.classList),p=h.map(String);if(h.length!==t.expectedText.length)return{received:p,matches:!1};let b=this._matchSequentially(t.expectedText,h,(v,m)=>v.matchesClassList(this,m,n==="to.contain.class.array"));return{received:p,matches:b}}if(!["to.contain.text.array","to.have.text.array"].includes(n))throw this.createStacklessError("Unknown expect matcher: "+n);let r=e.map(h=>t.useInnerText?h.innerText:Ee(new Map,h).full),o=n!=="to.contain.text.array";if(!(r.length===t.expectedText.length||!o))return{received:r,matches:!1};let l=this._matchSequentially(t.expectedText,r,(h,p)=>h.matches(p));return{received:r,matches:l}}_matchSequentially(e,t,n){let r=e.map(l=>new Dn(l)),o=0,u=0;for(;o<r.length&&u<t.length;)n(r[o],t[u])&&++o,++u;return o===r.length}};function Rn(e){return e.replace(/\n/g,"\u21B5").replace(/\t/g,"\u21C6")}function ou(e){if(e=e.substring(1,e.length-1),!e.includes("\\"))return e;let t=[],n=0;for(;n<e.length;)e[n]==="\\"&&n+1<e.length&&n++,t.push(e[n++]);return t.join("")}function qn(e,t){if(e[0]==="/"&&e.lastIndexOf("/")>0){let o=e.lastIndexOf("/"),u=new RegExp(e.substring(1,o),e.substring(o+1));return{matcher:l=>u.test(l.full),kind:"regex"}}let n=t?JSON.parse.bind(JSON):ou,r=!1;return e.length>1&&e[0]==='"'&&e[e.length-1]==='"'?(e=n(e),r=!0):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="i"?(e=n(e.substring(0,e.length-1)),r=!1):t&&e.length>1&&e[0]==='"'&&e[e.length-2]==='"'&&e[e.length-1]==="s"?(e=n(e.substring(0,e.length-1)),r=!0):e.length>1&&e[0]==="'"&&e[e.length-1]==="'"&&(e=n(e),r=!0),e=ve(e),r?t?{kind:"strict",matcher:u=>u.normalized===e}:{matcher:u=>!e&&!u.immediate.length?!0:u.immediate.some(l=>ve(l)===e),kind:"strict"}:(e=e.toLowerCase(),{kind:"lax",matcher:o=>o.normalized.toLowerCase().includes(e)})}var Dn=class{_string;_substring;_regex;_normalizeWhiteSpace;_ignoreCase;constructor(e){if(this._normalizeWhiteSpace=e.normalizeWhiteSpace,this._ignoreCase=e.ignoreCase,this._string=e.matchSubstring?void 0:this.normalize(e.string),this._substring=e.matchSubstring?this.normalize(e.string):void 0,e.regexSource){let t=new Set((e.regexFlags||"").split(""));e.ignoreCase===!1&&t.delete("i"),e.ignoreCase===!0&&t.add("i"),this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){return this._regex||(e=this.normalize(e)),this._string!==void 0?e===this._string:this._substring!==void 0?e.includes(this._substring):this._regex?!!this._regex.test(e):!1}matchesClassList(e,t,n){if(n){if(this._regex)throw e.createStacklessError("Partial matching does not support regular expressions. Please provide a string value.");return this._string.split(/\s+/g).filter(Boolean).every(r=>t.contains(r))}return this.matches(t.toString())}normalize(e){return e&&(this._normalizeWhiteSpace&&(e=ve(e)),this._ignoreCase&&(e=e.toLocaleLowerCase()),e)}};function Hr(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!Hr(e[r],t[r]))return!1;return!0}if(e instanceof RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;++r)if(!t.hasOwnProperty(n[r]))return!1;for(let r of n)if(!Hr(e[r],t[r]))return!1;return!0}return typeof e=="number"&&typeof t=="number"?isNaN(e)&&isNaN(t):!1}var Me={selectorUtils:Ji,roleUtils:to,domUtils:Eo,selectorGenerator:qo,stringUtils:zi,InjectedScript:iu},pa=function(){if(!Me.InjectedScript)throw new Error("InjectedScript is not available yet.");let e=Me.InjectedScript,t=this.options||{sdkLanguage:"javascript",testIdAttributeName:"blinq-test-id",stableRafCount:0,browserName:"chromium",inputFileRoleTextbox:!1,customEngines:[],isUnderTest:!0};return new e(window,t)};var au=["slot","alt","name","placeholder","title","aria-label","aria-placeholder","role","data-testid","data-cy"];function cu(e){return`"${e.replace(/["\\]/g,t=>"\\"+t)}"`}function lu(e){return/^[a-zA-Z][a-zA-Z0-9\-\_]+$/.test(e)?"#"+e:`[id=${cu(e)}]`}function uu(e){let t="";for(let n=0;n<e.length;n++)t+=hu(e,n);return t}function hu(e,t){let n=e.charCodeAt(t);return n===0?"\uFFFD":n>=1&&n<=31||n>=48&&n<=57&&(t===0||t===1&&e.charCodeAt(0)===45)?"\\"+n.toString(16)+" ":t===0&&n===45&&e.length===1?"\\"+e.charAt(t):n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122?e.charAt(t):"\\"+e.charAt(t)}var Ts=class{constructor(t,n={}){this.locatorStrategies={text:"basic",no_text:"no_text",custom:"custom",context:"context",digitIgnore:"ignore_digit",text_with_index:"text_with_index"},this.options=n,this.dom_Parent=new Ai,this.PW=Me,this.injectedScript=t,this.cache=new Map}generateUniqueCSSSelector(t,n){var y;let r=(n==null?void 0:n.root)||window.document,o=(n==null?void 0:n.separator)||" > ",u=(n==null?void 0:n.isunique)||(w=>this.getMatchingElements(w,n).length===1),l=(n==null?void 0:n.noCSSId)||!1;if(!(t instanceof Element)||!r.contains(t))return"";let h="",p=t.getAttribute("id");if(p&&!/\d/.test(p)&&!l&&(h=lu(p),u(h))||t.tagName&&(h=t.tagName.toLowerCase()+h,u(h)))return h;let b=Array.from(t.classList).filter(w=>!/\d/.test(w));if(b.length&&(h+=b.map(w=>"."+uu(w)).join(""),u(h)))return h;for(let w of au)if(t.hasAttribute(w)){let A=t.getAttribute(w);if(A===""||/\d/.test(A))continue;A=A.replace(/[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g,"\\$&"),h+=`[${w}="${this.PW.stringUtils.escapeForAttributeSelector(A)}"]`}if(u(h)||t===r)return h;let v=t.parentElement;if(v){if(v!==r&&(t.assignedSlot&&(v=t.assignedSlot.parentElement??t.assignedSlot.parentNode.host),v&&v!==r&&(h=this.generateUniqueCSSSelector(v,n)+o+h,u(h))))return h}else if(t.parentNode instanceof ShadowRoot){let w=t.parentNode.host;if(w&&w!==r&&(h=this.generateUniqueCSSSelector(w,n)+" >>> "+h,u(h)))return h}let m=(y=t.parentElement)==null?void 0:y.children;if(m){for(let w=0;w<m.length;w++)if(m[w]===t)return h+`:nth-child(${w+1})`}return""}getMatchingElements(t,n={}){let{root:r=window.document,prefix:o,visible:u=!0}=n;return u&&(t=`${t} >> visible=true`),o&&(t=`${o} >> ${t}`),this.injectedScript.querySelectorAll(this.injectedScript.parseSelector(t),r)}getLocatorStrategies(){return this.locatorStrategies}getTextLocators(t,n){let r=this.injectedScript,o=this.PW.selectorGenerator.buildTextCandidates(r,t,n),u=[];for(let l of o){let h=0,p=[];for(let m of l){let{engine:y,selector:w}=m;y==="css"?p.push(w):p.push(`${y}=${w}`),h+=m.score}let b=p.join(" >> "),v=h/l.length;u.push({css:b,score:v})}return u}getNoTextLocators(t,n){let r=this.injectedScript,o=this.PW.selectorGenerator.buildNoTextCandidates(r,t,n);for(let u of o)u.engine==="css"?u.css=u.selector:u.css=`${u.engine}=${u.selector}`,delete u.engine,delete u.selector;return o}getCustomLocators(t,n){let{customAttributes:r=[]}=this.options;if(!r||!Array.isArray(r))return console.error("Custom attributes must be an array"),[];let o=[],u=[];for(let l of r){if(!l||typeof l!="string"){console.error("Custom attribute must be a string");continue}let h=t.getAttribute(l);h!==null&&(u.push(l),o.push({css:`[${l}=${this.PW.stringUtils.escapeForAttributeSelector(h)}]`,score:1,priority:1}))}return o}getContextLocators(t,n){if(!n||!Array.isArray(n))return console.error("Locators must be an array"),[];let r=[],o=new Set;for(let u of n){let l=u.css;if(!l||typeof l!="string"){console.error("Locator must have a valid css selector");continue}let p=this.injectedScript.parseSelector(l).parts;if(!p||!Array.isArray(p)||p.length===0){console.error("Locator must have a valid css selector");continue}if(p.length<3)continue;let b=p[0];if(b.name!=="internal:text")continue;let v=b.body;if(!v||typeof v!="string"||v.length===0){console.error("Locator must have a valid text in the first part to be a context locator");continue}let m=p[1];if(m.name!=="xpath")continue;let y=m.body;if(!y||typeof y!="string"||y.length===0)continue;let w=m.body;if(!w||typeof w!="string"||w.length===0)continue;let A=/(\.\.)(\/\.\.)*/;try{if(A.test(w)){let $=w.split("..").length-1,U=l.indexOf(w),B=l.substring(U+w.length+3).trim();if(B.length===0)continue;let V=`internal:text=${v}`,te=this.getMatchingElements(V,{});if(te.length!==1){console.error("Context locator must have exactly one element matching the text part");continue}let ne=te[0],ee=this.injectedScript.utils.elementText(new Map,ne).full,ie=`${V} >> xpath=${y} >> ${B}`,ke=this.getMatchingElements(ie,{});if(ke.length!==1){console.error("Context locator must have exactly one element matching the full selector");continue}if(ke[0]!==t){console.error("Context locator must have the text element as the full element");continue}if(!o.has(ee)){o.add(ee);let se={css:B,climb:$,text:ee,priority:1};u.index!==void 0&&(se.index=u.index),r.push(se)}}}catch(I){console.error("Error parsing climb string:",I);continue}}return r.sort((u,l)=>u.text.length-l.text.length),r}getDigitIgnoreLocators(t,n){let r=[];if(!n||!Array.isArray(n))return console.error("Locators must be an array"),[];for(let o of n){let u=o.css;if(!u||typeof u!="string"){console.error("Locator must have a valid css selector");continue}let h=this.injectedScript.parseSelector(u).parts;if(!h||!Array.isArray(h)||h.length===0){console.error("Locator must have a valid css selector");continue}let p="",b=!1;for(let v of h){if(v.name!=="internal:text"){p+=`${v.name==="css"?"":v.name+"="}${v.source} >> `;continue}if(typeof v.body!="string"||v.body.length===0){p+=`${v.name==="css"?"":v.name+"="}${v.source} >> `;continue}let m=v.body,y=/\d+/g;b=y.test(m);let w=this.PW.stringUtils.escapeRegExp(m.substring(1,m.length-2));w=w.replace(y,"\\d+"),p+=`internal:text=/${w}/ >> `}if(b&&(p.endsWith(" >> ")&&(p=p.slice(0,-4)),p)){let v=this.getMatchingElements(p,{});if(v.length!==1){console.error("Digit ignore locator must have exactly one element matching the final selector");continue}if(v[0]!==t){console.error("Digit ignore locator must match the original element");continue}r.push({css:p,priority:o.priority||1})}}return r}getTextwithIndexLocators(t){if(!t||!Array.isArray(t))return console.error("Locators must be an array"),[];let n=[];for(let r of t){if(!r||!r.css||typeof r.css!="string"){console.error("Locator must have a valid css selector");continue}let o=r.index;if(typeof o!="number"||o<0){console.error("Locator must have a valid index");continue}n.push(r)}return n}getXPathSelector(t){if(typeof t!="number"||t<0)return console.error("Climb must be a non-negative integer"),"";if(t===0)return"";let n="xpath=..";if(t===1)return n;for(let r=1;r<t;r++)n+="/..";return n}categorizeLocators(t,n,r){let o=[],u=[];for(let l of n){let h=this.getMatchingElements(l.css,r);if(h.length===0){console.warn(`No elements found for locator: ${l.css}`);continue}else if(h.length===1){if(t===h[0])l.priority=1,o.push(l);else if(t.contains(h[0])){l.priority=1;let p=this.dom_Parent.getClimbCountToParent(h[0],t),b=this.getXPathSelector(p),v=`${l.css} >> ${b}`;l.css=v,o.push(l)}}else l.priority=2,l.elements=h,u.push(l)}return{unique:o,nonUnique:u}}getUniqueLocators(t,n=this.getNoTextLocators,r={}){return this.getUniqueLocators2(t,n,r)}getUniqueLocators1(t,n=this.getNoTextLocators,r={}){try{let{maxLocators:o=5,root:u=window.document.body,next:l="LCA",minLocators:h=3}=r;if(!t)return[];if(t===u)return t===window.document.documentElement?[{css:"html",score:1,priority:1},{css:":root",score:1,priority:1}]:[{css:":root",score:1,priority:1}];console.log("Generating locators for element:",t);let p=n(t,r);if(console.log("Generated locators:",p),!p||!Array.isArray(p))return console.error("Locator generator did not return an array of locators"),[];console.log("Categorizing locators for element:",t);let b=this.categorizeLocators(t,p,r);console.log("Categorized locators:",b);let{unique:v,nonUnique:m}=b,y=[];if(v.length>0&&y.push(...v),y.length>=o)return y.slice(0,o);let w=null;for(let A of m){let I=A.css??A.selector,$=A.elements||this.getMatchingElements(I,r);if(l==="parent"?w=this.dom_Parent.getActualParent(t):w=this.dom_Parent.findBranchingParent($,t),w&&w!==t)if(u.contains(w)){let U=this.getUniqueLocators(w,n,{...r,root:u});for(let B of U){if(y.length>=o)return y.slice(0,o);let te=`${B.css??B.selector} >> ${I}`,ne=this.getMatchingElements(te,r),ee=(B.score+A.score)/2+100;if(ne.length===1&&ne[0]===t)B.css=te,B.score=ee,B.priority=1,y.push(B);else{let ie=ne.indexOf(t);ie!==-1&&ie<5&&(B.css=te,B.index=ie,B.priority=2,B.score=ee,y.push(B))}}}else{let U=$.indexOf(t);U!==-1&&U<5&&(A.index=U,A.priority=2,y.push(A))}else{let U=$.indexOf(t);U!==-1&&U<5&&(A.index=U,A.priority=2,y.push(A))}delete A.elements,delete A.strategy,delete A.engine,delete A.selector}if(y.length<h&&u&&u.contains(t)){let A=this.dom_Parent.getActualParent(t),I=this.getUniqueLocators(A,n,{...r,root:u});y.push(...I)}return y.sort((A,I)=>A.score-I.score),console.log("Final locators:",y,t),console.groupEnd(),y.slice(0,o)}catch(o){return console.error("Error in getUniqueLocators:",o),[]}}getUniqueLocators2(t,n=this.getNoTextLocators,r={}){try{let{maxLocators:o=5,root:u=window.document.body}=r;if(!t)return[];if(t===u)return t===window.document.documentElement?[{css:"html",score:1,priority:1},{css:":root",score:1,priority:1}]:[{css:":root",score:1,priority:1}];console.log("Generating locators for element:",t);let l=n(t,r);if(console.log("Generated locators:",l),!l||!Array.isArray(l))return console.error("Locator generator did not return an array of locators"),[];console.log("Categorizing locators for element:",t);let h=this.categorizeLocators(t,l,r);console.log("Categorized locators:",h);let{unique:p,nonUnique:b}=h,v=[];if(p.length>0&&v.push(...p),v.length>=o)return v.slice(0,o);let m=new Map,y=this.dom_Parent.getFullAncestorChainToRoot(t,u);y.shift();let w=[];for(let I of y){let $=n(I,r);if(!$||!Array.isArray($)||$.length===0)continue;let U=this.categorizeLocators(I,$,r);if(w.push({element:I,locators:U}),m.set(I,U),U.unique.length>0)break}let A=w[w.length-1];for(let I of b){let $=I.css??I.selector;if((I.elements||this.getMatchingElements($,r)).length===0){console.warn(`No elements found for locator: ${$}`);continue}for(let B of A.locators.unique){let V=`${B.css} >> ${$}`,te=this.getMatchingElements(V,r);if(te.length===1&&te[0]===t){let ne=(B.score+I.score)/2+100,ee={...B,css:V,score:ne,priority:1};v.push(ee)}else{let ne=te.indexOf(t);if(ne!==-1&&ne<5){let ee=(B.score+I.score)/2,ie={...B,css:V,index:ne,score:ee+200,priority:2};v.push(ie)}}}}return v.sort((I,$)=>I.score-$.score),console.log("Final locators:",v,t),console.groupEnd(),v.slice(0,o)}catch(o){return console.error("Error in getUniqueLocators:",o),[]}}getElementLocators(t,n={}){var r;try{let{excludeText:o=!1}=n,u={};if((r=this.options)!=null&&r.customAttributes){console.groupCollapsed("Generating Custom locators for element:",t);let v=this.getUniqueLocators(t,this.getCustomLocators.bind(this),n);v.length>0&&(u[this.locatorStrategies.custom]=v)}if(console.groupEnd(),!o){console.groupCollapsed("Generating Text locators for element:",t);let v=this.getUniqueLocators(t,this.getTextLocators.bind(this),n);console.groupEnd(),v.length>0&&(u[this.locatorStrategies.text]=v);let m=this.getTextwithIndexLocators(v);m.length>0&&(u[this.locatorStrategies.text_with_index]=m);let y=this.getDigitIgnoreLocators(t,v);y.length>0&&(u[this.locatorStrategies.digitIgnore]=y);let w=this.getContextLocators(t,v);w.length>0&&(u[this.locatorStrategies.context]=w)}console.groupCollapsed("Generating No Text locators for element:",t);let l=this.getUniqueLocators(t,this.getNoTextLocators.bind(this),n);if(l.length>0)u[this.locatorStrategies.no_text]=l;else{let v=[];v.push({css:this.generateUniqueCSSSelector(t,n),score:500,priority:3}),v.length>0&&(u[this.locatorStrategies.no_text]=v)}console.groupEnd();let h=this.getBestStrategy(u);if(!h)throw new Error("No locators found for element: "+t);u.strategy=h;let b={locators:u[u.strategy]??[],element_name:""};return Object.keys(u).length>1&&(b.allStrategyLocators=u),console.log("Generated locators:",b),b}catch(o){return console.error("Error in getElementLocators:",o),{locators:[],element_name:""}}}getBestStrategy(t){let n=[this.locatorStrategies.custom,this.locatorStrategies.context,this.locatorStrategies.text,this.locatorStrategies.text_with_index,this.locatorStrategies.digitIgnore,this.locatorStrategies.no_text];for(let r of n)if(t[r]&&t[r].length>0)return r;return null}},ga=Ts;var ks=class{constructor(t={}){let{inlineImages:n=!0,inlineStyles:r=!0,excludeSelectors:o=[]}=t;this.inlineImages=n,this.inlineStyles=r,this.excludeSelectors=o}imageToDataURL(t,n){try{let r=n.createElement("canvas");return r.width=t.naturalWidth||t.width,r.height=t.naturalHeight||t.height,r.getContext("2d").drawImage(t,0,0),r.toDataURL("image/png")}catch(r){return console.warn(`Failed to inline image: ${t.src}`,r),t.src}}processStyles(t){if(!this.inlineStyles)return;let n=Array.from(t.styleSheets);for(let r of n)try{if(!r.href)continue;let o=t.createElement("style"),u="",l=Array.from(r.cssRules||[]);for(let h of l)h.cssText&&(u+=h.cssText+`
19
19
  `);o.textContent=u,r.ownerNode&&r.ownerNode.parentNode?r.ownerNode.parentNode.replaceChild(o,r.ownerNode):r.ownerNode&&t.head.appendChild(o)}catch(o){console.warn(`Error processing stylesheet: ${r.href}`,o)}}processImages(t){if(!this.inlineImages)return;t.querySelectorAll("img").forEach(r=>{if(!(r.src.startsWith("data:")||r.src.endsWith(".svg"))&&!this.excludeSelectors.some(o=>r.matches(o))&&r.complete&&r.naturalWidth!==0)try{r.setAttribute("src",this.imageToDataURL(r,t))}catch(o){console.warn(`Failed to process image: ${r.src}`,o)}})}removeExcludedElements(t){this.excludeSelectors.forEach(n=>{t.querySelectorAll(n).forEach(o=>{var u;(u=o.parentNode)==null||u.removeChild(o)})})}processComputedStyles(t){t.querySelectorAll("*").forEach(r=>{if(this.excludeSelectors.some(h=>r.matches(h)))return;let o=window.getComputedStyle(r),u=["display","position","width","height","margin","padding","color","background-color","font-family","font-size","text-align","line-height","border","box-shadow","opacity"],l=[];if(u.forEach(h=>{let p=o.getPropertyValue(h);p&&l.push(`${h}: ${p}`)}),l.length>0){let h=r.getAttribute("style")||"";r.setAttribute("style",h+l.join("; ")+";")}})}createSnapshot(){let t=window.document.cloneNode(!0),n=window.document,r=t;this.processStyles(r),this.processImages(r),this.removeExcludedElements(r),this.processComputedStyles(r);let o=n.doctype?new XMLSerializer().serializeToString(n.doctype):"<!DOCTYPE html>",u=r.documentElement.outerHTML;return`${o}${u}`}},ma=ks;var _s=class{isLeafNode(t){return t.kind==="text"?!0:!t.children||t.children.length===0}deepClone(t){if(t.kind==="text")return t.text;{let n={kind:"role",role:t.role};return"checked"in t&&(n.checked=t.checked),"disabled"in t&&(n.disabled=t.disabled),"expanded"in t&&(n.expanded=t.expanded),"level"in t&&(n.level=t.level),"pressed"in t&&(n.pressed=t.pressed),"selected"in t&&(n.selected=t.selected),t.name!==void 0&&(n.name=t.name),t.props&&(n.props=Object.assign({},t.props)),t.containerMode&&(n.containerMode=t.containerMode),t.children&&(n.children=t.children.map(r=>this.deepClone(r))),n}}yamlEscapeKeyIfNeeded(t){return this.yamlStringNeedsQuotes(t)?"'"+t.replace(/'/g,"''")+"'":t}yamlEscapeValueIfNeeded(t){return this.yamlStringNeedsQuotes(t)?'"'+t.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,n=>{switch(n){case"\\":return"\\\\";case'"':return'\\"';case"\b":return"\\b";case"\f":return"\\f";case`
20
20
  `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return"\\x"+n.charCodeAt(0).toString(16).padStart(2,"0")}})+'"':t}yamlStringNeedsQuotes(t){return t?!!(t.length===0||/^\s|\s$/.test(t)||/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(t)||/^-/.test(t)||/[\n:](\s|$)/.test(t)||/\s#/.test(t)||/[\n\r]/.test(t)||/^[&*\],?!>|@"'#%]/.test(t)||/[{}`]/.test(t)||/^\[/.test(t)||!isNaN(Number(t))||["y","n","yes","no","true","false","on","off","null"].includes(t.toLowerCase())):!1}filterParentToChildren(t,n){let r=n.some(o=>JSON.stringify(o)===JSON.stringify(t));if(r||this.isLeafNode(t))return r?this.deepClone(t):null;if(t.kind==="role"&&t.children&&t.children.length>0){let o=t.children.map(u=>this.filterParentToChildren(u,n)).filter(u=>u!==null);if(o.length>0){let u=this.deepClone(t);return u.children=o,u}}return null}serializeAriaSnapshot(t,n=0){let r=[],o=(l,h,p)=>{if(typeof l=="string"){let y=this.yamlEscapeValueIfNeeded(l);y&&r.push(p+"- text: "+y);return}let b=l.role;if(l.name&&l.name.length<=900){let y=l.name;if(y){let w=y.startsWith("/")&&y.endsWith("/")?y:JSON.stringify(y);b+=" "+w}}l.checked==="mixed"&&(b+=" [checked=mixed]"),l.checked===!0&&(b+=" [checked]"),l.disabled&&(b+=" [disabled]"),l.expanded&&(b+=" [expanded]"),l.level&&(b+=` [level=${l.level}]`),l.pressed==="mixed"&&(b+=" [pressed=mixed]"),l.pressed===!0&&(b+=" [pressed]"),l.selected===!0&&(b+=" [selected]");let v=p+"- "+this.yamlEscapeKeyIfNeeded(b);l.props===void 0&&(l.props={}),l.children===void 0&&(l.children=[]);let m=!!Object.keys(l.props).length;if(!l.children.length&&!m)r.push(v);else if(l.children.length===1&&typeof l.children[0]=="string"&&!m){let y=l.children[0];y?r.push(v+": "+this.yamlEscapeValueIfNeeded(y)):r.push(v)}else{r.push(v+":");for(let[y,w]of Object.entries(l.props)||[])r.push(p+" - /"+y+": "+this.yamlEscapeValueIfNeeded(w));for(let y of l.children||[])o(y,l,p+" ")}},u=t;if(u.role==="fragment")for(let l of u.children||[])o(l,u,"");else o(u,null,"");return r.join(`
21
21
  `)}isSnapshotAvailable(t,n){if(n.has(t))return t}findMatchingElements(t,n){let r=new Map,o=t.trim().split(`
@@ -160,7 +160,7 @@ ${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.pus
160
160
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
161
161
  `,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(s){var c;let i=s.items[s.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let f="end"in i.value?i.value.end:void 0,d=Array.isArray(f)?f[f.length-1]:void 0;(d==null?void 0:d.type)==="comment"?f==null||f.push(this.sourceToken):s.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)s.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,s.indent)){let f=s.items[s.items.length-2],d=(c=f==null?void 0:f.value)==null?void 0:c.end;if(Array.isArray(d))return Array.prototype.push.apply(d,i.start),d.push(this.sourceToken),void s.items.pop()}i.start.push(this.sourceToken)}return}if(this.indent>=s.indent){let f=!this.onKeyLine&&this.indent===s.indent,d=f&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",g=[];if(d&&i.sep&&!i.value){let E=[];for(let k=0;k<i.sep.length;++k){let T=i.sep[k];switch(T.type){case"newline":E.push(k);break;case"space":break;case"comment":T.indent>s.indent&&(E.length=0);break;default:E.length=0}}E.length>=2&&(g=i.sep.splice(E[1]))}switch(this.type){case"anchor":case"tag":return void(d||i.value?(g.push(this.sourceToken),s.items.push({start:g}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken));case"explicit-key-ind":return i.sep||i.explicitKey?d||i.value?(g.push(this.sourceToken),s.items.push({start:g,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(i.start.push(this.sourceToken),i.explicitKey=!0),void(this.onKeyLine=!0);case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)s.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ke(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:g,key:null,sep:[this.sourceToken]}]});else if(Si(i.key)&&!Ke(i.sep,"newline")){let E=gt(i.start),k=i.key,T=i.sep;T.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:E,key:k,sep:T}]})}else g.length>0?i.sep=i.sep.concat(g,this.sourceToken):i.sep.push(this.sourceToken);else if(Ke(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let E=gt(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:E,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||d?s.items.push({start:g,key:null,sep:[this.sourceToken]}):Ke(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let E=this.flowScalar(this.type);return void(d||i.value?(s.items.push({start:g,key:E,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(E):(Object.assign(i,{key:E,sep:[]}),this.onKeyLine=!0))}default:{let E=this.startBlockValue(s);if(E){if(E.type==="block-seq"){if(!i.explicitKey&&i.sep&&!Ke(i.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else f&&s.items.push({start:g});return void this.stack.push(E)}}}}yield*this.pop(),yield*this.step()}*blockSequence(s){var c;let i=s.items[s.items.length-1];switch(this.type){case"newline":if(i.value){let f="end"in i.value?i.value.end:void 0,d=Array.isArray(f)?f[f.length-1]:void 0;(d==null?void 0:d.type)==="comment"?f==null||f.push(this.sourceToken):s.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)s.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,s.indent)){let f=s.items[s.items.length-2],d=(c=f==null?void 0:f.value)==null?void 0:c.end;if(Array.isArray(d))return Array.prototype.push.apply(d,i.start),d.push(this.sourceToken),void s.items.pop()}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=s.indent)break;return void i.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==s.indent)break;return void(i.value||Ke(i.start,"seq-item-ind")?s.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken))}if(this.indent>s.indent){let f=this.startBlockValue(s);if(f)return void this.stack.push(f)}yield*this.pop(),yield*this.step()}*flowCollection(s){let i=s.items[s.items.length-1];if(this.type==="flow-error-end"){let c;do yield*this.pop(),c=this.peek(1);while(c&&c.type==="flow-collection")}else if(s.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":return void(!i||i.sep?s.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken));case"map-value-ind":return void(!i||i.value?s.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!i||i.value?s.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let f=this.flowScalar(this.type);return void(!i||i.value?s.items.push({start:[],key:f,sep:[]}):i.sep?this.stack.push(f):Object.assign(i,{key:f,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void s.end.push(this.sourceToken)}let c=this.startBlockValue(s);c?this.stack.push(c):(yield*this.pop(),yield*this.step())}else{let c=this.peek(2);if(c.type==="block-map"&&(this.type==="map-value-ind"&&c.indent===s.indent||this.type==="newline"&&!c.items[c.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&c.type!=="flow-collection"){let f=gt(On(c));xi(s);let d=s.end.splice(1,s.end.length);d.push(this.sourceToken);let g={type:"block-map",offset:s.offset,indent:s.indent,items:[{start:f,key:s,sep:d}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=g}else yield*this.lineEnd(s)}}flowScalar(s){if(this.onNewLine){let i=this.source.indexOf(`
162
162
  `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
163
- `,i)+1}return{type:s,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(s){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=gt(On(s));return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=gt(On(s));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(s,i){return this.type==="comment"&&!(this.indent<=i)&&s.every(c=>c.type==="newline"||c.type==="space")}*documentEnd(s){this.type!=="doc-mode"&&(s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(s){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ti(a){let s=a.prettyErrors!==!1;return{lineCounter:a.lineCounter||s&&new wi||null,prettyErrors:s}}function ki(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i==null?void 0:i.addNewLine),d=new Er(s),g=null;for(let E of d.compose(f.parse(a),!0,a.length))if(g){if(g.options.logLevel!=="silent"){g.errors.push(new Xe(E.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else g=E;return c&&i&&(g.errors.forEach(kn(a,i)),g.warnings.forEach(kn(a,i))),g}return e.Alias=q,e.CST=Ba,e.Composer=Er,e.Document=ft,e.Lexer=vi,e.LineCounter=wi,e.Pair=be,e.Parser=kr,e.Scalar=K,e.Schema=Tn,e.YAMLError=gr,e.YAMLMap=_e,e.YAMLParseError=Xe,e.YAMLSeq=We,e.YAMLWarning=ii,e.isAlias=p,e.isCollection=A,e.isDocument=b,e.isMap=v,e.isNode=I,e.isPair=m,e.isScalar=y,e.isSeq=w,e.parse=function(a,s,i){let c;typeof s=="function"?c=s:i===void 0&&s&&typeof s=="object"&&(i=s);let f=ki(a,i);if(!f)return null;if(f.warnings.forEach(d=>Rs(f.options.logLevel,d)),f.errors.length>0){if(f.options.logLevel!=="silent")throw f.errors[0];f.errors=[]}return f.toJS(Object.assign({reviver:c},i))},e.parseAllDocuments=function(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i==null?void 0:i.addNewLine),d=new Er(s),g=Array.from(d.compose(f.parse(a)));if(c&&i)for(let E of g)E.errors.forEach(kn(a,i)),E.warnings.forEach(kn(a,i));return g.length>0?g:Object.assign([],{empty:!0},d.streamInfo())},e.parseDocument=ki,e.stringify=function(a,s,i){let c=null;if(typeof s=="function"||Array.isArray(s)?c=s:i===void 0&&s&&(i=s),typeof i=="string"&&(i=i.length),typeof i=="number"){let f=Math.round(i);i=f<1?void 0:f>8?{indent:8}:{indent:f}}if(a===void 0){let{keepUndefined:f}=i??s??{};if(!f)return}return b(a)&&!c?a.toString(i):new ft(a,c,i).toString(i)},e.visit=te,e.visitAsync=ee,e}({}),As=fu;var du=Me.domUtils.closestCrossShadow,pu=Me.domUtils.isElementVisible,cn=class{deepEventTarget(t){return t.composedPath()[0]}deepActiveElement(t){let n=t.activeElement;for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}modifiersForEvent(t){return(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0)}buttonForEvent(t){switch(t.which){case 1:return"left";case 2:return"middle";case 3:return"right"}return"left"}positionForEvent(t){if(t.target.nodeName==="CANVAS")return{x:t.offsetX,y:t.offsetY}}consumeEvent(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}asCheckbox(t){if(!t||t.nodeName!=="INPUT")return null;let n=t;return["checkbox","radio"].includes(n.type)?n:null}isRangeInput(t){return!t||t.nodeName!=="INPUT"?!1:t.type.toLowerCase()==="range"}addEventListener(t,n,r,o){return t.addEventListener(n,r,o),()=>{t.removeEventListener(n,r,o)}}removeEventListeners(t){for(let n of t)n();t.splice(0,t.length)}getNearestInteractiveElement(t,n=window.document){try{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let r=du(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n);if(r&&pu(r))return r}return t}catch(r){return console.error(r),t}}shouldGenerateKeyPressFor(t){if(t.key==="Enter"&&(this.deepEventTarget(t).nodeName==="TEXTAREA"||this.deepEventTarget(t).isContentEditable)||["Backspace","Delete","AltGraph"].includes(t.key)||t.key==="@"&&t.code==="KeyL")return!1;if(navigator.platform.includes("Mac")){if(t.key==="v"&&t.metaKey)return!1}else if(t.key==="v"&&t.ctrlKey||t.key==="Insert"&&t.shiftKey)return!1;if(["Shift","Control","Meta","Alt","Process"].includes(t.key))return!1;let n=t.ctrlKey||t.altKey||t.metaKey;return t.key.length===1&&!n?!!this.asCheckbox(this.deepEventTarget(t)):!0}};var gu=Math.random().toString(36).substring(7),ba=0,Ns=()=>(ba++,`bvt_input_${ba}_${gu}`),mu=e=>{var n;if(e instanceof HTMLInputElement&&(e.type==="button"||e.type==="submit"))return((n=e.value)==null?void 0:n.length)>0;let t=e.innerText;if((t==null?void 0:t.length)>0){if(e.childNodes.length===0)return!0;for(let r=0;r<e.childNodes.length;r++){let o=e.childNodes[r];if(o.nodeType===Node.TEXT_NODE&&o.nodeValue.trim().length>0)return!0}}},nt={recordCommand:e=>__bvt_recordCommand(e),setMode:e=>__bvt_setMode(e),revertMode:()=>__bvt_revertMode(),recordPageClose:()=>__bvt_recordPageClose(),getMode:()=>__bvt_getMode(),log:e=>__bvt_log(e),sendObject:e=>__bvt_getObject(e)},va=null,Pe=class{constructor(t,n){this.name=t,this.getAction=n.getAction,this.getInterestedElement=n.getInterestedElement,this.hoverOutlineStyle=n.hoverOutlineStyle,this.start=n.start}},Cs=class{#t=null;#e="noop";contextElement=null;debugListener=!1;debugMouseOut=!1;debugMouseOver=!1;debugFocusOut=!1;debugFocusIn=!1;#n=Symbol("outline");#r=!1;toolbar=null;activeElement=null;cleanup=null;rect=null;offsetX=null;offsetY=null;popupHandlers=[];disableHighlight=!1;improviseLocators=!0;snapshotCapturer=new ma({excludeSelectors:["script","x-bvt-toolbar"]});injectedScript=pa();locatorGenerator=new ga(this.injectedScript);PW=Me;snapshotUtils=new ya;eventUtils=new cn;constructor(t={}){let{disableHighlight:n=!1,improviseLocators:r=!0,popupHandlers:o=[],testAttributes:u=[]}=t;this.disableHighlight=n,this.improviseLocators=r,this.popupHandlers=o,this.locatorGenerator.options.customAttributes=u,this.init()}init({mode:t="noop"}={}){this.addRecorderStates(),this.mode=t,this.addOverrides(),this.addListeners(),this.addHighlightListeners(window),window.addEventListener("DOMContentLoaded",async()=>{this.addToolbar(),this.mode=await nt.getMode()})}collectElementsFromAriaSnapshot(t,n){if(!(t.element&&t.element.tagName==="X-BVT-TOOL")){t.element&&n.add({element:t.element,snapshot:this.injectedScript.ariaSnapshot(t.element)});for(let r of t.children)typeof r!="string"&&this.collectElementsFromAriaSnapshot(r,n)}}addRecorderStates(){let t=new Pe("noop",{getAction:m=>{this.eventUtils.consumeEvent(m)},getInterestedElement:()=>{},hoverOutlineStyle:""}),n=new Pe("idle",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show()}},getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),r=new Pe("running",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show()}},getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),o=new Pe("inspecting",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show(),this.resetHighlight(this.activeElement)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);return{details:{name:"click"},element:y}}}}),u=new Pe("multiInspecting",{start:()=>{var y;(y=this.toolbar)==null||y.hide();let m=document.getElementsByTagName("body")[0];this.pageSnapshot=this.injectedScript.ariaSnapshot(m),this.lastSnapshot=this.injectedScript._lastAriaSnapshot,this.snapshotElements=new Set,this.interestedElements=new Map,this.collectElementsFromAriaSnapshot(this.lastSnapshot.root,this.snapshotElements),this.elementSet=new Set;for(let{element:w}of this.snapshotElements)this.elementSet.add(w);return()=>{var w;(w=this.toolbar)==null||w.show();for(let A of this.interestedElements.keys())A.style.background=A.__originalBackground,delete A.__originalBackground}},getInterestedElement:m=>this.snapshotUtils.isSnapshotAvailable(m,this.elementSet),hoverOutlineStyle:"2px solid red",getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=this.eventUtils.deepEventTarget(m),w=this.injectedScript.ariaSnapshot(y);if(this.snapshotUtils.isSnapshotAvailable(y,this.elementSet)){if(this.interestedElements.has(y)?(this.interestedElements.delete(y),y.style.background=y.__originalBackground,delete y.__originalBackground):(y.__originalBackground=y.style.background,y.style.background="rgba(255, 204, 0, 0.3)",this.interestedElements.set(y,w)),Array.from(this.interestedElements.keys()).length===0)return{details:{name:"click",value:""},element:y};let I=this.injectedScript.utils.parseAriaSnapshot(As,this.pageSnapshot).fragment,U=Array.from(this.interestedElements.values()).map(V=>this.injectedScript.utils.parseAriaSnapshot(As,V).fragment),B=this.snapshotUtils.filterParentToChildren(I,U);return w=this.snapshotUtils.serializeAriaSnapshot(B),{details:{name:"click",value:w},element:y}}}}}),l=this,h=new Pe("recordingText",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show(),this.resetHighlight(this.activeElement)}},getInterestedElement:m=>{if(mu(m))return m},hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);if(this.getInterestedElement(y))return{details:{name:"click"},element:y}}}}),p=new Pe("recordingHover",{start:()=>(this.toolbar&&(this.toolbar.hoverTool.selected=!0),()=>{this.resetHighlight(this.activeElement),this.toolbar&&(this.toolbar.hoverTool.selected=!1)}),getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="click")return{details:{name:"click"},element:this.eventUtils.deepEventTarget(m)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid blue"}),b=new Pe("recordingInput",{start:()=>()=>{this.resetHighlight(this.activeElement)},getAction:m=>{switch(m.type){case"pointerdown":{if(m.button===2)return;let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m)),w=this.eventUtils.asCheckbox(y);return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?void 0:w?{details:{name:w.checked?"uncheck":"check"},element:y}:{details:{name:"click",position:this.eventUtils.positionForEvent(m),button:this.eventUtils.buttonForEvent(m),modifiers:this.eventUtils.modifiersForEvent(m),clickCount:m.detail},element:y}}case"input":{let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m));return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?{details:{name:"setInputFiles",files:[...y.files||[]].map(w=>w.name)},element:y}:this.eventUtils.isRangeInput(y)?{details:{name:"fill",text:y.value},element:y}:["INPUT","TEXTAREA"].includes(y.nodeName)||y.isContentEditable?y.nodeName==="INPUT"&&["checkbox","radio"].includes(y.type.toLowerCase())?void 0:{details:{name:"fill",text:y.isContentEditable?y.innerText:y.value},element:y}:y.nodeName==="SELECT"?{details:{name:"select",options:[...y.selectedOptions].map(A=>A.value)},element:y}:void 0}case"keydown":{if(!this.eventUtils.shouldGenerateKeyPressFor(m))return;if(m.key===" "){let y=this.eventUtils.asCheckbox(this.eventUtils.deepEventTarget(m));if(y)return{details:{name:y.checked?"uncheck":"check"},element:y}}return{details:{name:"press",key:m.key,modifiers:this.eventUtils.modifiersForEvent(m)},element:this.eventUtils.deepEventTarget(m)}}}},getInterestedElement:m=>{let y=this.eventUtils.getNearestInteractiveElement(m);return y||m},hoverOutlineStyle:"2px solid red"}),v={noop:t,idle:n,running:r,recordingText:h,recordingContext:h,recordingInput:b,recordingHover:p,inspecting:o,multiInspecting:u};this.RecorderStateMap=v}addOverrides(){let t=window.close.bind(window);window.close=async function(){nt.recordPageClose(),t()};let n=this,r=Element.prototype.attachShadow;Element.prototype.attachShadow=function(o){let u=r.call(this,o);return n.addHighlightListeners(u),u}}set mode(t){let n=this.RecorderStateMap[t];n&&(this.cleanup&&this.cleanup(),this.#t=n,this.#t.start&&(this.cleanup=this.#t.start()),this.#e=t)}get mode(){return this.#e}getFrameDetails(){return{url:window.location.href,title:window.document.title,isTop:window.top===window,viewport:{width:window.innerWidth,height:window.innerHeight}}}setHighlight(t){if(t.closest("x-bvt-toolbar"))return;let n=this.#t.getInterestedElement(t);n&&(this.activeElement=n,n[this.#n]===void 0&&(n[this.#n]=n.style.outline,n.style.outline=this.#t.hoverOutlineStyle,n.styleUpdateFn&&n.styleUpdateFn(n)))}resetHighlight(t){if(!t)return;let n=this.#t.getInterestedElement(t);n&&n[this.#n]!==void 0&&(n.style.outline=n[this.#n],n[this.#n]=void 0,n.styleUpdateFn&&n.styleUpdateFn(n))}addHighlightListeners(t){t.addEventListener("mouseover",n=>{if(this.debugMouseOver)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("mouseout",n=>{if(this.debugMouseOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)}),t.addEventListener("focusin",n=>{if(this.debugFocusIn)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("focusout",n=>{if(this.debugFocusOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)})}addToolbar(){if(window.top!==window)return;let t=document.createElement("x-bvt-toolbar");t.id="bvt-toolbar",this.toolbar=t,document.body.appendChild(t)}handleStateTransition(t){if(this.#e==="recordingContext"){this.contextElement=t,nt.revertMode();return}this.#e==="recordingHover"&&nt.revertMode(),this.contextElement=null}getElementProperties(t){if(!t||!(t instanceof HTMLElement||t instanceof SVGElement))throw new Error("Please provide a valid HTML element");let n={properties:{},attributes:{},dataset:{}},r={},o={},u={};for(let h in t)try{let p=t[h];typeof p!="function"&&typeof p!="object"&&p!==null&&p!==void 0&&!h.includes("_")&&(r[h]=p)}catch{r[h]="[Error accessing property]"}if(t.attributes)for(let h of t.attributes)h.name!=="data-input-id"&&h.name!=="data-blinq-id"&&(o[h.name]=h.value);if(t.dataset)for(let[h,p]of Object.entries(t.dataset))h!=="inputId"&&h!=="blinqId"&&(u[h]=p);let l=h=>Object.fromEntries(Object.entries(h).sort(([p],[b])=>p.localeCompare(b)));return n.properties=l(r),n.attributes=l(o),n.dataset=l(u),n}getElementDetails(t,n){var l,h;(va!==t.dataset.inputId||n!=="input")&&(t.dataset.inputId=Ns(),va=t.dataset.inputId,t.__locators=this.getLocatorsObject(t));let r=this.PW.roleUtils.getAriaRole(t),o=this.PW.roleUtils.getElementAccessibleName(t,!1)||this.PW.roleUtils.getElementAccessibleName(t,!0)||"",u=this.getElementProperties(t);return{role:r,label:o,inputID:t.dataset.inputId,tagName:t.tagName,type:t.type,text:this.PW.selectorUtils.elementText(new Map,t).full,parent:`tagname: ${(l=t.parentElement)==null?void 0:l.tagName}
163
+ `,i)+1}return{type:s,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(s){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=gt(On(s));return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=gt(On(s));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(s,i){return this.type==="comment"&&!(this.indent<=i)&&s.every(c=>c.type==="newline"||c.type==="space")}*documentEnd(s){this.type!=="doc-mode"&&(s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(s){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:s.end?s.end.push(this.sourceToken):s.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ti(a){let s=a.prettyErrors!==!1;return{lineCounter:a.lineCounter||s&&new wi||null,prettyErrors:s}}function ki(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i==null?void 0:i.addNewLine),d=new Er(s),g=null;for(let E of d.compose(f.parse(a),!0,a.length))if(g){if(g.options.logLevel!=="silent"){g.errors.push(new Xe(E.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else g=E;return c&&i&&(g.errors.forEach(kn(a,i)),g.warnings.forEach(kn(a,i))),g}return e.Alias=q,e.CST=Ba,e.Composer=Er,e.Document=ft,e.Lexer=vi,e.LineCounter=wi,e.Pair=be,e.Parser=kr,e.Scalar=K,e.Schema=Tn,e.YAMLError=gr,e.YAMLMap=_e,e.YAMLParseError=Xe,e.YAMLSeq=We,e.YAMLWarning=ii,e.isAlias=p,e.isCollection=A,e.isDocument=b,e.isMap=v,e.isNode=I,e.isPair=m,e.isScalar=y,e.isSeq=w,e.parse=function(a,s,i){let c;typeof s=="function"?c=s:i===void 0&&s&&typeof s=="object"&&(i=s);let f=ki(a,i);if(!f)return null;if(f.warnings.forEach(d=>Rs(f.options.logLevel,d)),f.errors.length>0){if(f.options.logLevel!=="silent")throw f.errors[0];f.errors=[]}return f.toJS(Object.assign({reviver:c},i))},e.parseAllDocuments=function(a,s={}){let{lineCounter:i,prettyErrors:c}=Ti(s),f=new kr(i==null?void 0:i.addNewLine),d=new Er(s),g=Array.from(d.compose(f.parse(a)));if(c&&i)for(let E of g)E.errors.forEach(kn(a,i)),E.warnings.forEach(kn(a,i));return g.length>0?g:Object.assign([],{empty:!0},d.streamInfo())},e.parseDocument=ki,e.stringify=function(a,s,i){let c=null;if(typeof s=="function"||Array.isArray(s)?c=s:i===void 0&&s&&(i=s),typeof i=="string"&&(i=i.length),typeof i=="number"){let f=Math.round(i);i=f<1?void 0:f>8?{indent:8}:{indent:f}}if(a===void 0){let{keepUndefined:f}=i??s??{};if(!f)return}return b(a)&&!c?a.toString(i):new ft(a,c,i).toString(i)},e.visit=te,e.visitAsync=ee,e}({}),As=fu;var du=Me.domUtils.closestCrossShadow,pu=Me.domUtils.isElementVisible,cn=class{deepEventTarget(t){return t.composedPath()[0]}deepActiveElement(t){let n=t.activeElement;for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}modifiersForEvent(t){return(t.altKey?1:0)|(t.ctrlKey?2:0)|(t.metaKey?4:0)|(t.shiftKey?8:0)}buttonForEvent(t){switch(t.which){case 1:return"left";case 2:return"middle";case 3:return"right"}return"left"}positionForEvent(t){if(t.target.nodeName==="CANVAS")return{x:t.offsetX,y:t.offsetY}}consumeEvent(t){t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}asCheckbox(t){if(!t||t.nodeName!=="INPUT")return null;let n=t;return["checkbox","radio"].includes(n.type)?n:null}isRangeInput(t){return!t||t.nodeName!=="INPUT"?!1:t.type.toLowerCase()==="range"}addEventListener(t,n,r,o){return t.addEventListener(n,r,o),()=>{t.removeEventListener(n,r,o)}}removeEventListeners(t){for(let n of t)n();t.splice(0,t.length)}getNearestInteractiveElement(t,n=window.document){try{if(!t.matches("input,textarea,select")&&!t.isContentEditable){let r=du(t,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",n);if(r&&pu(r))return r}return t}catch(r){return console.error(r),t}}shouldGenerateKeyPressFor(t){if(t.key==="Enter"&&(this.deepEventTarget(t).nodeName==="TEXTAREA"||this.deepEventTarget(t).isContentEditable)||["Backspace","Delete","AltGraph"].includes(t.key)||t.key==="@"&&t.code==="KeyL")return!1;if(navigator.platform.includes("Mac")){if(t.key==="v"&&t.metaKey)return!1}else if(t.key==="v"&&t.ctrlKey||t.key==="Insert"&&t.shiftKey)return!1;if(["Shift","Control","Meta","Alt","Process"].includes(t.key))return!1;let n=t.ctrlKey||t.altKey||t.metaKey;return t.key.length===1&&!n?!!this.asCheckbox(this.deepEventTarget(t)):!0}};var gu=Math.random().toString(36).substring(7),ba=0,Ns=()=>(ba++,`bvt_input_${ba}_${gu}`),mu=e=>{var n;if(e instanceof HTMLInputElement&&(e.type==="button"||e.type==="submit"))return((n=e.value)==null?void 0:n.length)>0;let t=e.innerText;if((t==null?void 0:t.length)>0){if(e.childNodes.length===0)return!0;for(let r=0;r<e.childNodes.length;r++){let o=e.childNodes[r];if(o.nodeType===Node.TEXT_NODE&&o.nodeValue.trim().length>0)return!0}}},nt={recordCommand:e=>__bvt_recordCommand(e),setMode:e=>__bvt_setMode(e),revertMode:()=>__bvt_revertMode(),recordPageClose:()=>__bvt_recordPageClose(),getMode:()=>__bvt_getMode(),log:e=>__bvt_log(e),sendObject:e=>__bvt_getObject(e)},va=null,Pe=class{constructor(t,n){this.name=t,this.getAction=n.getAction,this.getInterestedElement=n.getInterestedElement,this.hoverOutlineStyle=n.hoverOutlineStyle,this.start=n.start}},Cs=class{#t=null;#e="noop";contextElement=null;debugListener=!1;debugMouseOut=!1;debugMouseOver=!1;debugFocusOut=!1;debugFocusIn=!1;#n=Symbol("outline");#r=!1;toolbar=null;activeElement=null;cleanup=null;rect=null;offsetX=null;offsetY=null;popupHandlers=[];disableHighlight=!1;improviseLocators=!0;snapshotCapturer=new ma({excludeSelectors:["script","x-bvt-toolbar"]});injectedScript=pa();locatorGenerator=new ga(this.injectedScript);PW=Me;snapshotUtils=new ya;eventUtils=new cn;constructor(t={}){let{disableHighlight:n=!1,improviseLocators:r=!0,popupHandlers:o=[],testAttributes:u=[]}=t;this.disableHighlight=n,this.improviseLocators=r,this.popupHandlers=o,this.locatorGenerator.options.customAttributes=u,this.init()}init({mode:t="noop"}={}){this.addRecorderStates(),this.mode=t,this.addOverrides(),this.addListeners(),this.addHighlightListeners(window),window.addEventListener("DOMContentLoaded",async()=>{this.addToolbar(),this.mode=await nt.getMode()})}collectElementsFromAriaSnapshot(t,n){if(!(t.element&&t.element.tagName==="X-BVT-TOOL")){t.element&&n.add({element:t.element,snapshot:this.injectedScript.ariaSnapshot(t.element)});for(let r of t.children)typeof r!="string"&&this.collectElementsFromAriaSnapshot(r,n)}}addRecorderStates(){let t=new Pe("noop",{getAction:m=>{this.eventUtils.consumeEvent(m)},getInterestedElement:()=>{},hoverOutlineStyle:""}),n=new Pe("idle",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show()}},getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),r=new Pe("running",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show()}},getAction:()=>null,getInterestedElement:()=>{},hoverOutlineStyle:""}),o=new Pe("inspecting",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show(),this.resetHighlight(this.activeElement)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);return{details:{name:"click"},element:y}}}}),u=new Pe("multiInspecting",{start:()=>{var y;(y=this.toolbar)==null||y.hide();let m=document.getElementsByTagName("body")[0];this.pageSnapshot=this.injectedScript.ariaSnapshot(m),this.lastSnapshot=this.injectedScript._lastAriaSnapshot,this.snapshotElements=new Set,this.interestedElements=new Map,this.collectElementsFromAriaSnapshot(this.lastSnapshot.root,this.snapshotElements),this.elementSet=new Set;for(let{element:w}of this.snapshotElements)this.elementSet.add(w);return()=>{var w;(w=this.toolbar)==null||w.show();for(let A of this.interestedElements.keys())A.style.background=A.__originalBackground,delete A.__originalBackground}},getInterestedElement:m=>this.snapshotUtils.isSnapshotAvailable(m,this.elementSet),hoverOutlineStyle:"2px solid red",getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=this.eventUtils.deepEventTarget(m),w=this.injectedScript.ariaSnapshot(y);if(this.snapshotUtils.isSnapshotAvailable(y,this.elementSet)){if(this.interestedElements.has(y)?(this.interestedElements.delete(y),y.style.background=y.__originalBackground,delete y.__originalBackground):(y.__originalBackground=y.style.background,y.style.background="rgba(255, 204, 0, 0.3)",this.interestedElements.set(y,w)),Array.from(this.interestedElements.keys()).length===0)return{details:{name:"click",value:""},element:y};let I=this.injectedScript.utils.parseAriaSnapshot(As,this.pageSnapshot).fragment,U=Array.from(this.interestedElements.values()).map(V=>this.injectedScript.utils.parseAriaSnapshot(As,V).fragment),B=this.snapshotUtils.filterParentToChildren(I,U);return w=this.snapshotUtils.serializeAriaSnapshot(B),{details:{name:"click",value:w},element:y}}}}}),l=this,h=new Pe("recordingText",{start:()=>{var m;return(m=this.toolbar)==null||m.hide(),()=>{var y;(y=this.toolbar)==null||y.show(),this.resetHighlight(this.activeElement)}},getInterestedElement:m=>{if(mu(m))return m},hoverOutlineStyle:"2px solid red",getAction(m){if(l.eventUtils.consumeEvent(m),m.type==="pointerdown"){let y=l.eventUtils.deepEventTarget(m);if(this.getInterestedElement(y))return{details:{name:"click"},element:y}}}}),p=new Pe("recordingHover",{start:()=>(this.toolbar&&(this.toolbar.hoverTool.selected=!0),()=>{this.resetHighlight(this.activeElement),this.toolbar&&(this.toolbar.hoverTool.selected=!1)}),getAction:m=>{if(this.eventUtils.consumeEvent(m),m.type==="click")return{details:{name:"click"},element:this.eventUtils.deepEventTarget(m)}},getInterestedElement:m=>m,hoverOutlineStyle:"2px solid blue"}),b=new Pe("recordingInput",{start:()=>()=>{this.resetHighlight(this.activeElement)},getAction:m=>{switch(m.type){case"pointerdown":{if(m.button===2)return;let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m)),w=this.eventUtils.asCheckbox(y);return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?void 0:w?{details:{name:w.checked?"uncheck":"check"},element:y}:{details:{name:"click",position:this.eventUtils.positionForEvent(m),button:this.eventUtils.buttonForEvent(m),modifiers:this.eventUtils.modifiersForEvent(m),clickCount:m.detail},element:y}}case"input":{let y=this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(m));return y.nodeName==="INPUT"&&y.type.toLowerCase()==="file"?{details:{name:"setInputFiles",files:[...y.files||[]].map(w=>w.name)},element:y}:this.eventUtils.isRangeInput(y)?{details:{name:"fill",text:y.value},element:y}:["INPUT","TEXTAREA"].includes(y.nodeName)||y.isContentEditable?y.nodeName==="INPUT"&&["checkbox","radio"].includes(y.type.toLowerCase())?void 0:{details:{name:"fill",text:y.isContentEditable?y.innerText:y.value},element:y}:y.nodeName==="SELECT"?{details:{name:"select",options:[...y.selectedOptions].map(A=>A.value)},element:y}:void 0}case"keydown":{if(!this.eventUtils.shouldGenerateKeyPressFor(m))return;if(m.key===" "){let y=this.eventUtils.asCheckbox(this.eventUtils.deepEventTarget(m));if(y)return{details:{name:y.checked?"uncheck":"check"},element:y}}return{details:{name:"press",key:m.key,modifiers:this.eventUtils.modifiersForEvent(m)},element:this.eventUtils.deepEventTarget(m)}}}},getInterestedElement:m=>{let y=this.eventUtils.getNearestInteractiveElement(m);return y||m},hoverOutlineStyle:"2px solid red"}),v={noop:t,idle:n,running:r,recordingText:h,recordingContext:h,recordingInput:b,recordingHover:p,inspecting:o,multiInspecting:u};this.RecorderStateMap=v}addOverrides(){let t=window.close.bind(window);window.close=async function(){nt.recordPageClose(),t()};let n=this,r=Element.prototype.attachShadow;Element.prototype.attachShadow=function(o){let u=r.call(this,o);return n.addHighlightListeners(u),u}}set mode(t){let n=this.RecorderStateMap[t];n&&(this.cleanup&&this.cleanup(),this.#t=n,this.#t.start&&(this.cleanup=this.#t.start()),this.#e=t)}get mode(){return this.#e}getFrameDetails(){return{url:window.location.href,title:window.document.title,isTop:window.top===window,viewport:{width:window.innerWidth,height:window.innerHeight}}}setHighlight(t){if(t.closest("x-bvt-toolbar"))return;let n=this.#t.getInterestedElement(t);n&&(this.activeElement=n,n[this.#n]===void 0&&(n[this.#n]=n.style.outline,n.style.outline=this.#t.hoverOutlineStyle,n.styleUpdateFn&&n.styleUpdateFn(n)))}resetHighlight(t){if(!t)return;let n=this.#t.getInterestedElement(t);n&&n[this.#n]!==void 0&&(n.style.outline=n[this.#n],n[this.#n]=void 0,n.styleUpdateFn&&n.styleUpdateFn(n))}addHighlightListeners(t){t.addEventListener("mouseover",n=>{if(this.debugMouseOver)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("mouseout",n=>{if(this.debugMouseOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)}),t.addEventListener("focusin",n=>{if(this.debugFocusIn)debugger;let r=this.eventUtils.deepEventTarget(n);this.setHighlight(r)}),t.addEventListener("focusout",n=>{if(this.debugFocusOut)debugger;let r=this.eventUtils.deepEventTarget(n);this.resetHighlight(r)})}addToolbar(){if(window.top!==window)return;let t=document.createElement("x-bvt-toolbar");t.id="bvt-toolbar",this.toolbar=t,document.body.appendChild(t)}handleStateTransition(t){if(this.#e==="recordingContext"){this.contextElement=t,nt.revertMode();return}this.#e==="recordingHover"&&nt.revertMode(),this.contextElement=null}getElementProperties(t){if(!t||!(t instanceof HTMLElement||t instanceof SVGElement))throw new Error("Please provide a valid HTML element");let n={properties:{},attributes:{},dataset:{}},r={},o={},u={};for(let h in t)try{let p=t[h];typeof p!="function"&&typeof p!="object"&&p!==null&&p!==void 0&&!h.includes("_")&&(r[h]=p)}catch{r[h]="[Error accessing property]"}if(t.attributes)for(let h of t.attributes)h.name!=="data-input-id"&&h.name!=="data-blinq-id"&&(o[h.name]=h.value);if(t.dataset)for(let[h,p]of Object.entries(t.dataset))h!=="inputId"&&h!=="blinqId"&&(u[h]=p);let l=h=>Object.fromEntries(Object.entries(h).sort(([p],[b])=>p.localeCompare(b)));return n.properties=l(r),n.attributes=l(o),n.dataset=l(u),n}getElementDetails(t,n){var l,h;(va!==t.dataset.inputId||n!=="input")&&(t.dataset.inputId=Ns(),va=t.dataset.inputId,t.__locators=this.getLocatorsObject(t));let r=this.PW.roleUtils.getAriaRole(t),o=this.PW.roleUtils.getElementAccessibleName(t,!1)||this.PW.roleUtils.getElementAccessibleName(t,!0)||"",u=this.getElementProperties(t);return{role:r,label:o,inputID:t.dataset.inputId,tagName:t.tagName,type:t.type,text:this.PW.selectorUtils.elementText(new Map,t).full.trim(),parent:`tagname: ${(l=t.parentElement)==null?void 0:l.tagName}
164
164
  innerText: ${(h=t.parentElement)==null?void 0:h.innerText}`,attrs:{placeholder:t.getAttribute("placeholder"),src:t.getAttribute("src"),href:t.getAttribute("href"),alt:t.getAttribute("alt"),value:t.value,tagName:t.tagName,text:t.textContent,type:t.type,disabled:t.disabled,readOnly:t.readOnly,required:t.required,checked:t.checked,innerText:t.innerText},attributes:u.attributes,properties:u.properties,dataset:u.dataset}}handleEvent(t){if(!this.toolbar)return!0;let n=this.eventUtils.deepEventTarget(t);switch(t.type){case"pointerdown":{let r=n.closest("x-bvt-tool");if((r==null?void 0:r.name)==="drag")return this.rect=this.toolbar.getBoundingClientRect(),this.offsetX=t.clientX-this.rect.left,this.offsetY=t.clientY-this.rect.top,this.#r=!0,!1;if(r)return!1;break}case"pointerup":{if(this.#r)return this.#r=!1,!1;break}case"mousemove":{if(this.#r){let r=t.clientX-this.offsetX,o=t.clientY-this.offsetY;return r<0||o<0||r+this.rect.width>window.innerWidth||o+this.rect.height>window.innerHeight?void 0:(this.toolbar.style.left=`${r}px`,!1)}break}case"click":{let r=n.closest("x-bvt-tool");if((r==null?void 0:r.name)==="hover")return r.selected?nt.revertMode():nt.setMode("recordingHover"),!1;break}}return!0}isPopupCloseEvent(t){let n=t.type,r=n==="pointerdown",o=n==="keydown"&&t.key==="Enter";if(!r&&!o)return!1;let u=this.eventUtils.deepEventTarget(t);return this.popupHandlers.some(l=>{let h=l.locator.css,p=l.close_dialog_locator.css,b=document.querySelector(h);if(!b)return!1;let v=window.getComputedStyle(b);return v.display==="none"||v.visibility==="hidden"?!1:u.matches(p)})}getLocatorsObject(t){if(this.contextElement){let r=this.contextElement.innerText,o=this.contextElement,u=this.locatorGenerator.dom_Parent.findLowestCommonAncestor([o,t]),l=this.locatorGenerator.dom_Parent.getClimbCountToParent(o,u),h=this.locatorGenerator.getElementLocators(t,{excludeText:!0,root:u});return h.locators.forEach(p=>{p.text=r,p.climb=l}),h}let n=this.#e==="recordingText";return this.locatorGenerator.getElementLocators(t,{excludeText:n})}addListeners(){["input","keydown","click","pointerdown","pointerup","mousemove"].forEach(n=>{window.addEventListener(n,async r=>{var m;if(this.debugListener)debugger;if(performance.mark("command-received"),!this.handleEvent(r))return;let u=this.#t.getAction(r);if(!u)return;let l=u.element,h=document.querySelector("[data-blinq-id]");h&&h.removeAttribute("data-blinq-id"),l.setAttribute("data-blinq-id",Ns());let p=document.querySelector("[data-blinq-context-id]");p&&p.removeAttribute("data-blinq-context-id"),this.contextElement&&this.contextElement.setAttribute("data-blinq-context-id",Ns()),performance.mark("command-send");let b={mode:this.#e,action:u.details,element:this.getElementDetails(l,n),isPopupCloseClick:this.isPopupCloseEvent(r),...l.__locators??this.getLocatorsObject(l),frame:this.getFrameDetails(),statistics:{time:`${performance.measure("command-received","command-send").duration.toFixed(2)} ms`}},v={id:l.getAttribute("data-blinq-id"),contextId:(m=this.contextElement)==null?void 0:m.getAttribute("data-blinq-context-id"),doc:this.snapshotCapturer.createSnapshot({excludeSelectors:["x-bvt-toolbar","script","style","link[rel=stylesheet]"]})};b.snapshotDetails=v,await nt.recordCommand(b),this.handleStateTransition(u.element)},{capture:!0})})}setPopupHandlers(t){this.popupHandlers=t}setDisableHighlight(t){this.disableHighlight=t}setImproviseLocators(t){this.improviseLocators=t}deselectAriaElements(){for(let t of this.interestedElements.keys())t.style.background=t.__originalBackground,delete t.__originalBackground;this.interestedElements.clear()}processAriaSnapshot(t){let n=this.findMatchingElements(t,this.snapshotElements);for(let r of n.values()){let o=r;o&&(o.__originalOutline=o.style.outline,o.style.outline="2px solid blue",setTimeout(()=>{o.style.outline=o.__originalOutline,delete o.__originalOutline},2e3))}}setTestAttributes(t){this.locatorGenerator.options.customAttributes=t}};window.__bvt_Recorder=new Cs(window.__bvt_Recorder_config);var Is=class extends HTMLElement{#t=!1;tooltipText=null;#e=null;#n=!1;constructor(t,n){super()}connectedCallback(){this.#n||(this.init(),this.addEventListener("mouseenter",this.showTooltip),this.addEventListener("mouseleave",this.hideTooltip),this.#n=!0)}init(){this.setAttribute("role","button"),this.style.cssText=`
165
165
  display: inline-flex;
166
166
  align-items: center;
@@ -6,6 +6,10 @@ class DOM_Parent {
6
6
  }
7
7
 
8
8
  // TODO: account for slotted elements
9
+
10
+ if (element.assignedSlot) {
11
+ return element.assignedSlot
12
+ }
9
13
  // Get the actual parent element, skipping shadow DOM if necessary
10
14
  let parent = element.parentElement;
11
15
  if (parent) {
@@ -690,7 +690,7 @@ class BVTRecorder {
690
690
  inputID: el.dataset.inputId,
691
691
  tagName: el.tagName,
692
692
  type: el.type,
693
- text: this.PW.selectorUtils.elementText(new Map(), el).full,
693
+ text: this.PW.selectorUtils.elementText(new Map(), el).full.trim(),
694
694
  parent: `tagname: ${el.parentElement?.tagName}\ninnerText: ${el.parentElement?.innerText}`,
695
695
  attrs: {
696
696
  placeholder: el.getAttribute("placeholder"),
@@ -1,5 +1,5 @@
1
1
  import DOM_Parent from "./dom_parent";
2
- import { __PW } from "./pw"
2
+ import { __PW } from "./pw";
3
3
  const candidateAttributes = [
4
4
  "slot",
5
5
  "alt",
@@ -21,19 +21,16 @@ function makeSelectorForId(id) {
21
21
 
22
22
  function escapeClassName(className) {
23
23
  let result = "";
24
- for (let i = 0; i < className.length; i++)
25
- result += cssEscapeCharacter(className, i);
24
+ for (let i = 0; i < className.length; i++) result += cssEscapeCharacter(className, i);
26
25
  return result;
27
26
  }
28
27
  function cssEscapeCharacter(s, i) {
29
28
  const c = s.charCodeAt(i);
30
- if (c === 0)
31
- return "\uFFFD";
32
- if (c >= 1 && c <= 31 || c >= 48 && c <= 57 && (i === 0 || i === 1 && s.charCodeAt(0) === 45))
29
+ if (c === 0) return "\uFFFD";
30
+ if ((c >= 1 && c <= 31) || (c >= 48 && c <= 57 && (i === 0 || (i === 1 && s.charCodeAt(0) === 45))))
33
31
  return "\\" + c.toString(16) + " ";
34
- if (i === 0 && c === 45 && s.length === 1)
35
- return "\\" + s.charAt(i);
36
- if (c >= 128 || c === 45 || c === 95 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122)
32
+ if (i === 0 && c === 45 && s.length === 1) return "\\" + s.charAt(i);
33
+ if (c >= 128 || c === 45 || c === 95 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122))
37
34
  return s.charAt(i);
38
35
  return "\\" + s.charAt(i);
39
36
  }
@@ -66,7 +63,7 @@ class LocatorGenerator {
66
63
 
67
64
  let selector = "";
68
65
  const id = element.getAttribute("id");
69
- if (id && !/\d/.test(id) && (!noCSSId)) {
66
+ if (id && !/\d/.test(id) && !noCSSId) {
70
67
  selector = makeSelectorForId(id);
71
68
  if (isUnique(selector)) return selector;
72
69
  }
@@ -128,7 +125,7 @@ class LocatorGenerator {
128
125
  }
129
126
  }
130
127
  }
131
- return ""
128
+ return "";
132
129
  }
133
130
 
134
131
  getMatchingElements(selector, options = {}) {
@@ -139,9 +136,7 @@ class LocatorGenerator {
139
136
  if (prefix) {
140
137
  selector = `${prefix} >> ${selector}`;
141
138
  }
142
- return this.injectedScript.querySelectorAll(
143
- this.injectedScript.parseSelector(selector),
144
- root)
139
+ return this.injectedScript.querySelectorAll(this.injectedScript.parseSelector(selector), root);
145
140
  }
146
141
 
147
142
  getLocatorStrategies() {
@@ -194,7 +189,7 @@ class LocatorGenerator {
194
189
  }
195
190
 
196
191
  const result = [];
197
- let hasAttribures = []
192
+ let hasAttribures = [];
198
193
  for (const customAttribute of customAttributes) {
199
194
  if (!customAttribute || typeof customAttribute !== "string") {
200
195
  console.error("Custom attribute must be a string");
@@ -207,13 +202,12 @@ class LocatorGenerator {
207
202
  css: `[${customAttribute}=${this.PW.stringUtils.escapeForAttributeSelector(val)}]`,
208
203
  score: 1,
209
204
  priority: 1,
210
- })
205
+ });
211
206
  }
212
207
  }
213
208
  return result;
214
209
  }
215
210
  getContextLocators(element, locators) {
216
-
217
211
  if (!locators || !Array.isArray(locators)) {
218
212
  console.error("Locators must be an array");
219
213
  return [];
@@ -279,7 +273,6 @@ class LocatorGenerator {
279
273
  // throw new Error("Context locator must have exactly one element matching the text part");
280
274
  console.error("Context locator must have exactly one element matching the text part");
281
275
  continue;
282
-
283
276
  }
284
277
  const textElement = elements[0];
285
278
  // const text = this.PW.selectorUtils.elementText(textElement);
@@ -305,7 +298,7 @@ class LocatorGenerator {
305
298
  climb: climbCount,
306
299
  text,
307
300
  priority: 1,
308
- }
301
+ };
309
302
  if (locator.index !== undefined) {
310
303
  loc.index = locator.index;
311
304
  }
@@ -316,7 +309,6 @@ class LocatorGenerator {
316
309
  console.error("Error parsing climb string:", error);
317
310
  continue;
318
311
  }
319
-
320
312
  }
321
313
  // Sort by text length to prioritize shorter texts
322
314
  result.sort((a, b) => a.text.length - b.text.length);
@@ -344,7 +336,6 @@ class LocatorGenerator {
344
336
  let finalSelector = "";
345
337
  let hasDigitsInText = false;
346
338
  for (const part of parts) {
347
-
348
339
  if (part.name !== "internal:text") {
349
340
  finalSelector += `${part.name === "css" ? "" : part.name + "="}${part.source} >> `;
350
341
  continue;
@@ -361,10 +352,9 @@ class LocatorGenerator {
361
352
  let pattern = this.PW.stringUtils.escapeRegExp(text.substring(1, text.length - 2));
362
353
  pattern = pattern.replace(digitsRegex, "\\d+");
363
354
  finalSelector += `internal:text=/${pattern}/ >> `;
364
-
365
355
  }
366
356
  if (!hasDigitsInText) {
367
- continue
357
+ continue;
368
358
  }
369
359
  if (finalSelector.endsWith(` >> `)) {
370
360
  finalSelector = finalSelector.slice(0, -4);
@@ -423,7 +413,6 @@ class LocatorGenerator {
423
413
  selector += "/..";
424
414
  }
425
415
  return selector;
426
-
427
416
  }
428
417
  categorizeLocators(element, locators, options) {
429
418
  const unique = [];
@@ -459,7 +448,6 @@ class LocatorGenerator {
459
448
  }
460
449
  getUniqueLocators1(element, locatorGenerator = this.getNoTextLocators, options = {}) {
461
450
  try {
462
-
463
451
  const { maxLocators = 5, root = window.document.body, next = "LCA", minLocators = 3 } = options;
464
452
 
465
453
  if (!element) {
@@ -467,27 +455,30 @@ class LocatorGenerator {
467
455
  }
468
456
  if (element === root) {
469
457
  if (element === window.document.documentElement) {
470
- return [{
471
- css: "html",
472
- score: 1,
473
- priority: 1,
474
- }, {
475
- css: ":root",
476
- score: 1,
477
- priority: 1,
478
- }
479
- ]
458
+ return [
459
+ {
460
+ css: "html",
461
+ score: 1,
462
+ priority: 1,
463
+ },
464
+ {
465
+ css: ":root",
466
+ score: 1,
467
+ priority: 1,
468
+ },
469
+ ];
480
470
  } else {
481
- return [{
482
- css: ":root",
483
- score: 1,
484
- priority: 1,
485
- // }, {
486
- // css: ":root",
487
- // score: 1,
488
- // priority: 1,
489
- }
490
- ]
471
+ return [
472
+ {
473
+ css: ":root",
474
+ score: 1,
475
+ priority: 1,
476
+ // }, {
477
+ // css: ":root",
478
+ // score: 1,
479
+ // priority: 1,
480
+ },
481
+ ];
491
482
  }
492
483
  }
493
484
 
@@ -522,9 +513,8 @@ class LocatorGenerator {
522
513
  if (next === "parent") {
523
514
  nextElement = this.dom_Parent.getActualParent(element);
524
515
  } else {
525
-
526
516
  // find the branching element the child of common parent that contains the element
527
- const branchingParent = this.dom_Parent.findBranchingParent(elements, element)
517
+ const branchingParent = this.dom_Parent.findBranchingParent(elements, element);
528
518
  nextElement = branchingParent;
529
519
  }
530
520
 
@@ -535,7 +525,6 @@ class LocatorGenerator {
535
525
  root,
536
526
  });
537
527
  for (const _locator of _result) {
538
-
539
528
  if (result.length >= maxLocators) {
540
529
  return result.slice(0, maxLocators);
541
530
  }
@@ -559,22 +548,19 @@ class LocatorGenerator {
559
548
  result.push(_locator);
560
549
  }
561
550
  }
562
-
563
551
  }
564
-
565
552
  } else {
566
553
  const index = elements.indexOf(element);
567
554
  if (index !== -1 && index < 5) {
568
- locator.index = index
555
+ locator.index = index;
569
556
  locator.priority = 2; // non-unique locators have lower priority
570
557
  result.push(locator);
571
558
  }
572
559
  }
573
-
574
560
  } else {
575
561
  const index = elements.indexOf(element);
576
562
  if (index !== -1 && index < 5) {
577
- locator.index = index
563
+ locator.index = index;
578
564
  locator.priority = 2; // non-unique locators have lower priority
579
565
  result.push(locator);
580
566
  }
@@ -590,18 +576,16 @@ class LocatorGenerator {
590
576
  const parent = this.dom_Parent.getActualParent(element);
591
577
  const locs = this.getUniqueLocators(parent, locatorGenerator, {
592
578
  ...options,
593
- root
579
+ root,
594
580
  });
595
581
  result.push(...locs);
596
582
  }
597
583
 
598
-
599
584
  result.sort((a, b) => a.score - b.score);
600
585
  console.log("Final locators:", result, element);
601
586
  console.groupEnd();
602
587
  return result.slice(0, maxLocators);
603
- }
604
- catch (error) {
588
+ } catch (error) {
605
589
  console.error("Error in getUniqueLocators:", error);
606
590
  return [];
607
591
  }
@@ -609,7 +593,6 @@ class LocatorGenerator {
609
593
 
610
594
  getUniqueLocators2(element, locatorGenerator = this.getNoTextLocators, options = {}) {
611
595
  try {
612
-
613
596
  const { maxLocators = 5, root = window.document.body } = options;
614
597
 
615
598
  if (!element) {
@@ -617,27 +600,26 @@ class LocatorGenerator {
617
600
  }
618
601
  if (element === root) {
619
602
  if (element === window.document.documentElement) {
620
- return [{
621
- css: "html",
622
- score: 1,
623
- priority: 1,
624
- }, {
625
- css: ":root",
626
- score: 1,
627
- priority: 1,
628
- }
629
- ]
603
+ return [
604
+ {
605
+ css: "html",
606
+ score: 1,
607
+ priority: 1,
608
+ },
609
+ {
610
+ css: ":root",
611
+ score: 1,
612
+ priority: 1,
613
+ },
614
+ ];
630
615
  } else {
631
- return [{
632
- css: ":root",
633
- score: 1,
634
- priority: 1,
635
- // }, {
636
- // css: ":root",
637
- // score: 1,
638
- // priority: 1,
639
- }
640
- ]
616
+ return [
617
+ {
618
+ css: ":root",
619
+ score: 1,
620
+ priority: 1,
621
+ },
622
+ ];
641
623
  }
642
624
  }
643
625
 
@@ -645,7 +627,6 @@ class LocatorGenerator {
645
627
  const locators = locatorGenerator(element, options);
646
628
  console.log("Generated locators:", locators);
647
629
  if (!locators || !Array.isArray(locators)) {
648
- // throw new Error("Locator generator did not return an array of locators");
649
630
  console.error("Locator generator did not return an array of locators");
650
631
  return [];
651
632
  }
@@ -653,8 +634,6 @@ class LocatorGenerator {
653
634
  console.log("Categorizing locators for element:", element);
654
635
  const categorizedLocators = this.categorizeLocators(element, locators, options);
655
636
  console.log("Categorized locators:", categorizedLocators);
656
- // categorizedLocators.unique = limitLocators(categorizedLocators.unique, options);
657
- // categorizedLocators.nonUnique = limitLocators(categorizedLocators.nonUnique, options);
658
637
 
659
638
  const { unique, nonUnique } = categorizedLocators;
660
639
  const result = [];
@@ -673,8 +652,7 @@ class LocatorGenerator {
673
652
  const ancestorLocators = [];
674
653
  for (const ancestor of allAncestors) {
675
654
  const _locators = locatorGenerator(ancestor, options);
676
- if (!_locators || !Array.isArray(_locators) || _locators.length
677
- === 0) {
655
+ if (!_locators || !Array.isArray(_locators) || _locators.length === 0) {
678
656
  continue;
679
657
  }
680
658
  const _categorized = this.categorizeLocators(ancestor, _locators, options);
@@ -725,89 +703,91 @@ class LocatorGenerator {
725
703
  }
726
704
  }
727
705
  }
728
-
729
706
  }
730
707
  result.sort((a, b) => a.score - b.score);
731
708
  console.log("Final locators:", result, element);
732
709
  console.groupEnd();
733
710
  return result.slice(0, maxLocators);
734
- }
735
- catch (error) {
711
+ } catch (error) {
736
712
  console.error("Error in getUniqueLocators:", error);
737
713
  return [];
738
714
  }
739
715
  }
740
716
  getElementLocators(element, options = {}) {
741
-
742
- const { excludeText = false } = options;
743
-
744
- const allStrategyLocators = {
745
- // [LOCATOR_STRATEGIES.text]: basicLocators,
746
- // [LOCATOR_STRATEGIES.no_text]: noTextLocators,
747
- }
748
- if (this.options?.customAttributes) {
749
- console.groupCollapsed("Generating Custom locators for element:", element);
750
- const customLocators = this.getUniqueLocators(element, this.getCustomLocators.bind(this), options);
751
- if (customLocators.length > 0) {
752
- allStrategyLocators[this.locatorStrategies.custom] = customLocators;
753
-
717
+ try {
718
+ const { excludeText = false } = options;
719
+
720
+ const allStrategyLocators = {};
721
+ if (this.options?.customAttributes) {
722
+ console.groupCollapsed("Generating Custom locators for element:", element);
723
+ const customLocators = this.getUniqueLocators(element, this.getCustomLocators.bind(this), options);
724
+ if (customLocators.length > 0) {
725
+ allStrategyLocators[this.locatorStrategies.custom] = customLocators;
726
+ }
754
727
  }
755
- }
756
- console.groupEnd();
757
- if (!excludeText) {
758
- console.groupCollapsed("Generating Text locators for element:", element);
759
- const basicLocators = this.getUniqueLocators(element, this.getTextLocators.bind(this), options);
760
728
  console.groupEnd();
761
- if (basicLocators.length > 0) {
762
- allStrategyLocators[this.locatorStrategies.text] = basicLocators;
763
- }
729
+ if (!excludeText) {
730
+ console.groupCollapsed("Generating Text locators for element:", element);
731
+ const basicLocators = this.getUniqueLocators(element, this.getTextLocators.bind(this), options);
732
+ console.groupEnd();
733
+ if (basicLocators.length > 0) {
734
+ allStrategyLocators[this.locatorStrategies.text] = basicLocators;
735
+ }
764
736
 
765
- const textWithIndexLocators = this.getTextwithIndexLocators(basicLocators);
766
- if (textWithIndexLocators.length > 0) {
767
- allStrategyLocators[this.locatorStrategies.text_with_index] = textWithIndexLocators;
768
- }
769
- const digitIgnoreLocators = this.getDigitIgnoreLocators(element, basicLocators);
770
- if (digitIgnoreLocators.length > 0) {
771
- allStrategyLocators[this.locatorStrategies.digitIgnore] = digitIgnoreLocators;
772
- }
773
- const contextLocators = this.getContextLocators(element, basicLocators);
774
- if (contextLocators.length > 0) {
775
- allStrategyLocators[this.locatorStrategies.context] = contextLocators;
776
- }
777
- }
778
- console.groupCollapsed("Generating No Text locators for element:", element);
779
- const noTextLocators = this.getUniqueLocators(element, this.getNoTextLocators.bind(this), options);
780
-
781
- if (noTextLocators.length > 0) {
782
- allStrategyLocators[this.locatorStrategies.no_text] = noTextLocators;
783
- } else {
784
- const _locators = []
785
- _locators.push({
786
- css: this.generateUniqueCSSSelector(element, options),
787
- score: 500,
788
- priority: 3,
789
- })
790
- if (_locators.length > 0) {
791
- allStrategyLocators[this.locatorStrategies.no_text] = _locators;
737
+ const textWithIndexLocators = this.getTextwithIndexLocators(basicLocators);
738
+ if (textWithIndexLocators.length > 0) {
739
+ allStrategyLocators[this.locatorStrategies.text_with_index] = textWithIndexLocators;
740
+ }
741
+ const digitIgnoreLocators = this.getDigitIgnoreLocators(element, basicLocators);
742
+ if (digitIgnoreLocators.length > 0) {
743
+ allStrategyLocators[this.locatorStrategies.digitIgnore] = digitIgnoreLocators;
744
+ }
745
+ const contextLocators = this.getContextLocators(element, basicLocators);
746
+ if (contextLocators.length > 0) {
747
+ allStrategyLocators[this.locatorStrategies.context] = contextLocators;
748
+ }
792
749
  }
793
- }
794
- console.groupEnd();
750
+ console.groupCollapsed("Generating No Text locators for element:", element);
751
+ const noTextLocators = this.getUniqueLocators(element, this.getNoTextLocators.bind(this), options);
795
752
 
796
- let bestStrategy = this.getBestStrategy(allStrategyLocators);
797
- if (!bestStrategy) {
798
- console.warn("No locators found for element:", element);
799
- bestStrategy = this.locatorStrategies.no_text;
800
- }
801
- allStrategyLocators.strategy = bestStrategy;
753
+ if (noTextLocators.length > 0) {
754
+ allStrategyLocators[this.locatorStrategies.no_text] = noTextLocators;
755
+ } else {
756
+ const _locators = [];
757
+ _locators.push({
758
+ css: this.generateUniqueCSSSelector(element, options),
759
+ score: 500,
760
+ priority: 3,
761
+ });
762
+ if (_locators.length > 0) {
763
+ allStrategyLocators[this.locatorStrategies.no_text] = _locators;
764
+ }
765
+ }
766
+ console.groupEnd();
802
767
 
803
- const locators = allStrategyLocators[allStrategyLocators.strategy] ?? [];
804
- const result = {
805
- allStrategyLocators,
806
- locators,
807
- element_name: ""
768
+ let bestStrategy = this.getBestStrategy(allStrategyLocators);
769
+ if (!bestStrategy) {
770
+ throw new Error("No locators found for element: " + element);
771
+ }
772
+ allStrategyLocators.strategy = bestStrategy;
773
+
774
+ const locators = allStrategyLocators[allStrategyLocators.strategy] ?? [];
775
+ const result = {
776
+ locators,
777
+ element_name: "",
778
+ };
779
+ if (Object.keys(allStrategyLocators).length > 1) {
780
+ result.allStrategyLocators = allStrategyLocators;
781
+ }
782
+ console.log("Generated locators:", result);
783
+ return result;
784
+ } catch (error) {
785
+ console.error("Error in getElementLocators:", error);
786
+ return {
787
+ locators: [],
788
+ element_name: "",
789
+ };
808
790
  }
809
- console.log("Generated locators:", result);
810
- return result
811
791
  }
812
792
  getBestStrategy(allStrategyLocators) {
813
793
  const orderedPriorities = [
@@ -816,7 +796,7 @@ class LocatorGenerator {
816
796
  this.locatorStrategies.text,
817
797
  this.locatorStrategies.text_with_index,
818
798
  this.locatorStrategies.digitIgnore,
819
- this.locatorStrategies.no_text
799
+ this.locatorStrategies.no_text,
820
800
  ];
821
801
  for (const strategy of orderedPriorities) {
822
802
  if (allStrategyLocators[strategy] && allStrategyLocators[strategy].length > 0) {
@@ -827,4 +807,4 @@ class LocatorGenerator {
827
807
  }
828
808
  }
829
809
 
830
- export default LocatorGenerator;
810
+ export default LocatorGenerator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1284-dev",
3
+ "version": "1.0.1286-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "@cucumber/tag-expressions": "^6.1.1",
33
33
  "@dev-blinq/cucumber-js": "1.0.176-dev",
34
34
  "@faker-js/faker": "^8.1.0",
35
- "automation_model": "1.0.760-dev",
35
+ "automation_model": "1.0.761-dev",
36
36
  "axios": "^1.7.4",
37
37
  "chokidar": "^3.6.0",
38
38
  "create-require": "^1.1.1",