(()=>{var E=function(e,r,t){return e>=r&&e<=t};function A(e){return E(e,48,57)}function Oe(e){return A(e)||E(e,65,70)||E(e,97,102)}function tt(e){return E(e,65,90)}function nt(e){return E(e,97,122)}function rt(e){return tt(e)||nt(e)}function it(e){return e>=128}function ne(e){return rt(e)||it(e)||e===95}function Re(e){return ne(e)||A(e)||e===45}function st(e){return E(e,0,8)||e===11||E(e,14,31)||e===127}function F(e){return e===10}function I(e){return F(e)||e===9||e===32}var ot=1114111;class re extends Error{constructor(e){super(e);this.name="InvalidCharacterError"}}function at(e){let r=[];for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);if(i===13&&e.charCodeAt(t+1)===10)i=10,t++;if(i===13||i===12)i=10;if(i===0)i=65533;if(E(i,55296,56319)&&E(e.charCodeAt(t+1),56320,57343)){let n=i-55296,s=e.charCodeAt(t+1)-56320;i=Math.pow(2,16)+n*Math.pow(2,10)+s,t++}r.push(i)}return r}function v(e){if(e<=65535)return String.fromCharCode(e);e-=Math.pow(2,16);let r=Math.floor(e/Math.pow(2,10))+55296,t=e%Math.pow(2,10)+56320;return String.fromCharCode(r)+String.fromCharCode(t)}function ke(e){let r=at(e),t=-1,i=[],n,s=0,f=0,o=0,h=function(){s+=1,o=f,f=0},p={line:s,column:f},y=function(l){if(l>=r.length)return-1;return r[l]},c=function(l){if(l===void 0)l=1;if(l>3)throw"Spec Error: no more than three codepoints of lookahead.";return y(t+l)},d=function(l){if(l===void 0)l=1;if(t+=l,n=y(t),F(n))h();else f+=l;return!0},T=function(){if(t-=1,F(n))s-=1,f=o;else f-=1;return p.line=s,p.column=f,!0},g=function(l){if(l===void 0)l=n;return l===-1},x=function(){},u=function(){},w=function(){if(S(),d(),I(n)){while(I(c()))d();return new z}else if(n===34)return X();else if(n===35)if(Re(c())||H(c(1),c(2))){let l=new we("");if(N(c(1),c(2),c(3)))l.type="id";return l.value=te(),l}else return new L(n);else if(n===36)if(c()===61)return d(),new qe;else return new L(n);else if(n===39)return X();else if(n===40)return new fe;else if(n===41)return new ge;else if(n===42)if(c()===61)return d(),new We;else return new L(n);else if(n===43)if(Te())return T(),$();else return new L(n);else if(n===44)return new ce;else if(n===45)if(Te())return T(),$();else if(c(1)===45&&c(2)===62)return d(2),new oe;else if(O())return T(),W();else return new L(n);else if(n===46)if(Te())return T(),$();else return new L(n);else if(n===58)return new ae;else if(n===59)return new le;else if(n===60)if(c(1)===33&&c(2)===45&&c(3)===45)return d(3),new se;else return new L(n);else if(n===64)if(N(c(1),c(2),c(3)))return new me(te());else return new L(n);else if(n===91)return new pe;else if(n===92)if(a())return T(),W();else return u(),new L(n);else if(n===93)return new J;else if(n===94)if(c()===61)return d(),new Pe;else return new L(n);else if(n===123)return new ue;else if(n===124)if(c()===61)return d(),new He;else if(c()===124)return d(),new de;else return new L(n);else if(n===125)return new he;else if(n===126)if(c()===61)return d(),new Ie;else return new L(n);else if(A(n))return T(),$();else if(ne(n))return T(),W();else if(g())return new U;else return new L(n)},S=function(){while(c(1)===47&&c(2)===42){d(2);while(!0)if(d(),n===42&&c()===47){d();break}else if(g()){u();return}}},$=function(){let l=Ke();if(N(c(1),c(2),c(3))){let m=new je;return m.value=l.value,m.repr=l.repr,m.type=l.type,m.unit=te(),m}else if(c()===37){d();let m=new Ee;return m.value=l.value,m.repr=l.repr,m}else{let m=new ye;return m.value=l.value,m.repr=l.repr,m.type=l.type,m}},W=function(){let l=te();if(l.toLowerCase()==="url"&&c()===40){d();while(I(c(1))&&I(c(2)))d();if(c()===34||c()===39)return new M(l);else if(I(c())&&(c(2)===34||c(2)===39))return new M(l);else return ee()}else if(c()===40)return d(),new M(l);else return new xe(l)},X=function(l){if(l===void 0)l=n;let m="";while(d())if(n===l||g())return new Se(m);else if(F(n))return u(),T(),new ie;else if(n===92)if(g(c()))x();else if(F(c()))d();else m+=v(j());else m+=v(n);throw Error("Internal error")},ee=function(){let l=new be("");while(I(c()))d();if(g(c()))return l;while(d())if(n===41||g())return l;else if(I(n)){while(I(c()))d();if(c()===41||g(c()))return d(),l;else return Le(),new B}else if(n===34||n===39||n===40||st(n))return u(),Le(),new B;else if(n===92)if(a())l.value+=v(j());else return u(),Le(),new B;else l.value+=v(n);throw Error("Internal error")},j=function(){if(d(),Oe(n)){let l=[n];for(let R=0;R<5;R++)if(Oe(c()))d(),l.push(n);else break;if(I(c()))d();let m=parseInt(l.map(function(R){return String.fromCharCode(R)}).join(""),16);if(m>ot)m=65533;return m}else if(g())return 65533;else return n},H=function(l,m){if(l!==92)return!1;if(F(m))return!1;return!0},a=function(){return H(n,c())},N=function(l,m,R){if(l===45)return ne(m)||m===45||H(m,R);else if(ne(l))return!0;else if(l===92)return H(l,m);else return!1},O=function(){return N(n,c(1),c(2))},Ge=function(l,m,R){if(l===43||l===45){if(A(m))return!0;if(m===46&&A(R))return!0;return!1}else if(l===46){if(A(m))return!0;return!1}else if(A(l))return!0;else return!1},Te=function(){return Ge(n,c(1),c(2))},te=function(){let l="";while(d())if(Re(n))l+=v(n);else if(a())l+=v(j());else return T(),l;throw Error("Internal parse error")},Ke=function(){let l="",m="integer";if(c()===43||c()===45)d(),l+=v(n);while(A(c()))d(),l+=v(n);if(c(1)===46&&A(c(2))){d(),l+=v(n),d(),l+=v(n),m="number";while(A(c()))d(),l+=v(n)}let R=c(1),$e=c(2),Xe=c(3);if((R===69||R===101)&&A($e)){d(),l+=v(n),d(),l+=v(n),m="number";while(A(c()))d(),l+=v(n)}else if((R===69||R===101)&&($e===43||$e===45)&&A(Xe)){d(),l+=v(n),d(),l+=v(n),d(),l+=v(n),m="number";while(A(c()))d(),l+=v(n)}let et=Ze(l);return{type:m,value:et,repr:l}},Ze=function(l){return+l},Le=function(){while(d())if(n===41||g())return;else if(a())j(),x();else x()},Ae=0;while(!g(c()))if(i.push(w()),Ae++,Ae>r.length*2)throw Error("I'm infinite-looping!");return i}class b{tokenType="";value;toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}}class ie extends b{tokenType="BADSTRING"}class B extends b{tokenType="BADURL"}class z extends b{tokenType="WHITESPACE";toString(){return"WS"}toSource(){return" "}}class se extends b{tokenType="CDO";toSource(){return"<!--"}}class oe extends b{tokenType="CDC";toSource(){return"-->"}}class ae extends b{tokenType=":"}class le extends b{tokenType=";"}class ce extends b{tokenType=","}class P extends b{value="";mirror=""}class ue extends P{tokenType="{";constructor(){super();this.value="{",this.mirror="}"}}class he extends P{tokenType="}";constructor(){super();this.value="}",this.mirror="{"}}class pe extends P{tokenType="[";constructor(){super();this.value="[",this.mirror="]"}}class J extends P{tokenType="]";constructor(){super();this.value="]",this.mirror="["}}class fe extends P{tokenType="(";constructor(){super();this.value="(",this.mirror=")"}}class ge extends P{tokenType=")";constructor(){super();this.value=")",this.mirror="("}}class Ie extends b{tokenType="~="}class He extends b{tokenType="|="}class Pe extends b{tokenType="^="}class qe extends b{tokenType="$="}class We extends b{tokenType="*="}class de extends b{tokenType="||"}class U extends b{tokenType="EOF";toSource(){return""}}class L extends b{tokenType="DELIM";value="";constructor(e){super();this.value=v(e)}toString(){return"DELIM("+this.value+")"}toJSON(){let e=this.constructor.prototype.constructor.prototype.toJSON.call(this);return e.value=this.value,e}toSource(){if(this.value==="\\")return"\\\n";else return this.value}}class q extends b{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}}class xe extends q{constructor(e){super();this.value=e}tokenType="IDENT";toString(){return"IDENT("+this.value+")"}toSource(){return V(this.value)}}class M extends q{tokenType="FUNCTION";mirror;constructor(e){super();this.value=e,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return V(this.value)+"("}}class me extends q{tokenType="AT-KEYWORD";constructor(e){super();this.value=e}toString(){return"AT("+this.value+")"}toSource(){return"@"+V(this.value)}}class we extends q{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(){if(this.type==="id")return"#"+V(this.value);else return"#"+lt(this.value)}}class Se extends q{tokenType="STRING";constructor(e){super();this.value=e}toString(){return'"'+Fe(this.value)+'"'}}class be extends q{tokenType="URL";constructor(e){super();this.value=e}toString(){return"URL("+this.value+")"}toSource(){return'url("'+Fe(this.value)+'")'}}class ye extends b{tokenType="NUMBER";type;repr;constructor(){super();this.type="integer",this.repr=""}toString(){if(this.type==="integer")return"INT("+this.value+")";return"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}}class Ee extends b{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+"%"}}class je extends b{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,r=V(this.unit);if(r[0].toLowerCase()==="e"&&(r[1]==="-"||E(r.charCodeAt(1),48,57)))r="\\65 "+r.slice(1,r.length);return e+r}}function V(e){e=""+e;let r="",t=e.charCodeAt(0);for(let i=0;i<e.length;i++){let n=e.charCodeAt(i);if(n===0)throw new re("Invalid character: the input contains U+0000.");if(E(n,1,31)||n===127||i===0&&E(n,48,57)||i===1&&E(n,48,57)&&t===45)r+="\\"+n.toString(16)+" ";else if(n>=128||n===45||n===95||E(n,48,57)||E(n,65,90)||E(n,97,122))r+=e[i];else r+="\\"+e[i]}return r}function lt(e){e=""+e;let r="";for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);if(i===0)throw new re("Invalid character: the input contains U+0000.");if(i>=128||i===45||i===95||E(i,48,57)||E(i,65,90)||E(i,97,122))r+=e[t];else r+="\\"+i.toString(16)+" "}return r}function Fe(e){e=""+e;let r="";for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);if(i===0)throw new re("Invalid character: the input contains U+0000.");if(E(i,1,31)||i===127)r+="\\"+i.toString(16)+" ";else if(i===34||i===92)r+="\\"+e[t];else r+=e[t]}return r}class _ extends Error{}function Be(e,r){let t;try{if(t=ke(e),!(t[t.length-1]instanceof U))t.push(new U)}catch(a){let N=a.message+` while parsing css selector "${e}". Did you mean to CSS.escape it?`,O=(a.stack||"").indexOf(a.message);if(O!==-1)a.stack=a.stack.substring(0,O)+N+a.stack.substring(O+a.message.length);throw a.message=N,a}let i=t.find((a)=>{return a instanceof me||a instanceof ie||a instanceof B||a instanceof de||a instanceof se||a instanceof oe||a instanceof le||a instanceof ue||a instanceof he||a instanceof be||a instanceof Ee});if(i)throw new _(`Unsupported token "${i.toSource()}" while parsing css selector "${e}". Did you mean to CSS.escape it?`);let n=0,s=new Set;function f(){return new _(`Unexpected token "${t[n].toSource()}" while parsing css selector "${e}". Did you mean to CSS.escape it?`)}function o(){while(t[n]instanceof z)n++}function h(a=n){return t[a]instanceof xe}function p(a=n){return t[a]instanceof Se}function y(a=n){return t[a]instanceof ye}function c(a=n){return t[a]instanceof ce}function d(a=n){return t[a]instanceof fe}function T(a=n){return t[a]instanceof ge}function g(a=n){return t[a]instanceof M}function x(a=n){return t[a]instanceof L&&t[a].value==="*"}function u(a=n){return t[a]instanceof U}function w(a=n){return t[a]instanceof L&&[">","+","~"].includes(t[a].value)}function S(a=n){return c(a)||T(a)||u(a)||w(a)||t[a]instanceof z}function $(){let a=[W()];while(!0){if(o(),!c())break;n++,a.push(W())}return a}function W(){if(o(),y())return t[n++].value;if(p())return t[n++].value;return X()}function X(){let a={simples:[]};if(o(),w())a.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""});else a.simples.push({selector:ee(),combinator:""});while(!0){if(o(),w())a.simples[a.simples.length-1].combinator=t[n++].value,o();else if(S())break;a.simples.push({combinator:"",selector:ee()})}return a}function ee(){let a="",N=[];while(!S())if(h()||x())a+=t[n++].toSource();else if(t[n]instanceof we)a+=t[n++].toSource();else if(t[n]instanceof L&&t[n].value===".")if(n++,h())a+="."+t[n++].toSource();else throw f();else if(t[n]instanceof ae)if(n++,h())if(!r.has(t[n].value.toLowerCase()))a+=":"+t[n++].toSource();else{let O=t[n++].value.toLowerCase();N.push({name:O,args:[]}),s.add(O)}else if(g()){let O=t[n++].value.toLowerCase();if(!r.has(O))a+=`:${O}(${j()})`;else N.push({name:O,args:$()}),s.add(O);if(o(),!T())throw f();n++}else throw f();else if(t[n]instanceof pe){a+="[",n++;while(!(t[n]instanceof J)&&!u())a+=t[n++].toSource();if(!(t[n]instanceof J))throw f();a+="]",n++}else throw f();if(!a&&!N.length)throw f();return{css:a||void 0,functions:N}}function j(){let a="",N=1;while(!u()){if(d()||g())N++;if(T())N--;if(!N)break;a+=t[n++].toSource()}return a}let H=$();if(!u())throw f();if(H.some((a)=>typeof a!=="object"||!("simples"in a)))throw new _(`Error while parsing css selector "${e}". Did you mean to CSS.escape it?`);return{selector:H,names:Array.from(s)}}var Me=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),ut=new Set(["left-of","right-of","above","below","near"]),ht=new Set(["not","is","where","has","scope","light","visible","text","text-matches","text-is","has-text","above","below","right-of","left-of","near","nth-match"]);function _e(e){let r=ft(e),t=[];for(let i of r.parts){if(i.name==="css"||i.name==="css:light"){if(i.name==="css:light")i.body=":light("+i.body+")";let n=Be(i.body,ht);t.push({name:"css",body:n.selector,source:i.body});continue}if(Me.has(i.name)){let n,s;try{let p=JSON.parse("["+i.body+"]");if(!Array.isArray(p)||p.length<1||p.length>2||typeof p[0]!=="string")throw new _(`Malformed selector: ${i.name}=`+i.body);if(n=p[0],p.length===2){if(typeof p[1]!=="number"||!ut.has(i.name))throw new _(`Malformed selector: ${i.name}=`+i.body);s=p[1]}}catch(p){throw new _(`Malformed selector: ${i.name}=`+i.body)}let f={name:i.name,source:i.body,body:{parsed:_e(n),distance:s}},o=[...f.body.parsed.parts].reverse().find((p)=>p.name==="internal:control"&&p.body==="enter-frame"),h=o?f.body.parsed.parts.indexOf(o):-1;if(h!==-1&&pt(f.body.parsed.parts.slice(0,h+1),t.slice(0,h+1)))f.body.parsed.parts.splice(0,h+1);t.push(f);continue}t.push({...i,source:i.body})}if(Me.has(t[0].name))throw new _(`"${t[0].name}" selector cannot be first`);return{capture:r.capture,parts:t}}function pt(e,r){return k({parts:e})===k({parts:r})}function k(e,r){if(typeof e==="string")return e;return e.parts.map((t,i)=>{let n=!0;if(!r&&i!==e.capture){if(t.name==="css")n=!1;else if(t.name==="xpath"&&t.source.startsWith("//")||t.source.startsWith(".."))n=!1}let s=n?t.name+"=":"";return`${i===e.capture?"*":""}${s}${t.source}`}).join(" >> ")}function ft(e){let r=0,t,i=0,n={parts:[]},s=()=>{let o=e.substring(i,r).trim(),h=o.indexOf("="),p,y;if(h!==-1&&o.substring(0,h).trim().match(/^[a-zA-Z_0-9-+:*]+$/))p=o.substring(0,h).trim(),y=o.substring(h+1);else if(o.length>1&&o[0]==='"'&&o[o.length-1]==='"')p="text",y=o;else if(o.length>1&&o[0]==="'"&&o[o.length-1]==="'")p="text",y=o;else if(/^\(*\/\//.test(o)||o.startsWith(".."))p="xpath",y=o;else p="css",y=o;let c=!1;if(p[0]==="*")c=!0,p=p.substring(1);if(n.parts.push({name:p,body:y}),c){if(n.capture!==void 0)throw new _("Only one of the selectors can capture using * modifier");n.capture=n.parts.length-1}};if(!e.includes(">>"))return r=e.length,s(),n;let f=()=>{let h=e.substring(i,r).match(/^\s*text\s*=(.*)$/);return!!h&&!!h[1]};while(r<e.length){let o=e[r];if(o==="\\"&&r+1<e.length)r+=2;else if(o===t)t=void 0,r++;else if(!t&&(o==='"'||o==="'"||o==="`")&&!f())t=o,r++;else if(!t&&o===">"&&e[r+1]===">")s(),r+=2,i=r;else r++}return s(),n}function ve(e,r){let t=0,i=e.length===0,n=()=>e[t]||"",s=()=>{let u=n();return++t,i=t>=e.length,u},f=(u)=>{if(i)throw new _(`Unexpected end of selector while parsing selector \`${e}\``);throw new _(`Error while parsing selector \`${e}\` - unexpected symbol "${n()}" at position ${t}`+(u?" during "+u:""))};function o(){while(!i&&/\s/.test(n()))s()}function h(u){return u>=""||u>="0"&&u<="9"||u>="A"&&u<="Z"||u>="a"&&u<="z"||u>="0"&&u<="9"||u==="_"||u==="-"}function p(){let u="";o();while(!i&&h(n()))u+=s();return u}function y(u){let w=s();if(w!==u)f("parsing quoted string");while(!i&&n()!==u){if(n()==="\\")s();w+=s()}if(n()!==u)f("parsing quoted string");return w+=s(),w}function c(){if(s()!=="/")f("parsing regular expression");let u="",w=!1;while(!i){if(n()==="\\"){if(u+=s(),i)f("parsing regular expression")}else if(w&&n()==="]")w=!1;else if(!w&&n()==="[")w=!0;else if(!w&&n()==="/")break;u+=s()}if(s()!=="/")f("parsing regular expression");let S="";while(!i&&n().match(/[dgimsuy]/))S+=s();try{return new RegExp(u,S)}catch($){throw new _(`Error while parsing selector \`${e}\`: ${$.message}`)}}function d(){let u="";if(o(),n()==="'"||n()==='"')u=y(n()).slice(1,-1);else u=p();if(!u)f("parsing property path");return u}function T(){o();let u="";if(!i)u+=s();if(!i&&u!=="=")u+=s();if(!["=","*=","^=","$=","|=","~="].includes(u))f("parsing operator");return u}function g(){s();let u=[];u.push(d()),o();while(n()===".")s(),u.push(d()),o();if(n()==="]")return s(),{name:u.join("."),jsonPath:u,op:"<truthy>",value:null,caseSensitive:!1};let w=T(),S=void 0,$=!0;if(o(),n()==="/"){if(w!=="=")throw new _(`Error while parsing selector \`${e}\` - cannot use ${w} in attribute with regular expression`);S=c()}else if(n()==="'"||n()==='"'){if(S=y(n()).slice(1,-1),o(),n()==="i"||n()==="I")$=!1,s();else if(n()==="s"||n()==="S")$=!0,s()}else{S="";while(!i&&(h(n())||n()==="+"||n()==="."))S+=s();if(S==="true")S=!0;else if(S==="false")S=!1;else if(!r){if(S=+S,Number.isNaN(S))f("parsing attribute value")}}if(o(),n()!=="]")f("parsing attribute value");if(s(),w!=="="&&typeof S!=="string")throw new _(`Error while parsing selector \`${e}\` - cannot use ${w} in attribute with non-string matching value - ${S}`);return{name:u.join("."),jsonPath:u,op:w,value:S,caseSensitive:$}}let x={name:"",attributes:[]};x.name=p(),o();while(n()==="[")x.attributes.push(g()),o();if(!i)f(void 0);if(!x.name&&!x.attributes.length)throw new _(`Error while parsing selector \`${e}\` - selector cannot be empty`);return x}function Q(e,r="'"){let t=JSON.stringify(e),i=t.substring(1,t.length-1).replace(/\\"/g,'"');if(r==="'")return r+i.replace(/[']/g,"\\'")+r;if(r==='"')return r+i.replace(/["]/g,"\\\"")+r;if(r==="`")return r+i.replace(/[`]/g,"\\`")+r;throw Error("Invalid escape char")}function Y(e){return e.charAt(0).toUpperCase()+e.substring(1)}function Ce(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function G(e){return e.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}var Et=new RegExp("([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))","g");function Ue(e,r,t=!1){return gt(e,r,t,1)[0]}function gt(e,r,t=!1,i=20,n){try{return D(new xt[e](n),_e(r),t,i)}catch(s){return[r]}}function D(e,r,t=!1,i=20){let n=[...r.parts],s=[],f=t?"frame-locator":"page";for(let o=0;o<n.length;o++){let h=n[o],p=f;if(f="locator",h.name==="internal:describe")continue;if(h.name==="nth"){if(h.body==="0")s.push([e.generateLocator(p,"first",""),e.generateLocator(p,"nth","0")]);else if(h.body==="-1")s.push([e.generateLocator(p,"last",""),e.generateLocator(p,"nth","-1")]);else s.push([e.generateLocator(p,"nth",h.body)]);continue}if(h.name==="visible"){s.push([e.generateLocator(p,"visible",h.body),e.generateLocator(p,"default",`visible=${h.body}`)]);continue}if(h.name==="internal:text"){let{exact:g,text:x}=K(h.body);s.push([e.generateLocator(p,"text",x,{exact:g})]);continue}if(h.name==="internal:has-text"){let{exact:g,text:x}=K(h.body);if(!g){s.push([e.generateLocator(p,"has-text",x,{exact:g})]);continue}}if(h.name==="internal:has-not-text"){let{exact:g,text:x}=K(h.body);if(!g){s.push([e.generateLocator(p,"has-not-text",x,{exact:g})]);continue}}if(h.name==="internal:has"){let g=D(e,h.body.parsed,!1,i);s.push(g.map((x)=>e.generateLocator(p,"has",x)));continue}if(h.name==="internal:has-not"){let g=D(e,h.body.parsed,!1,i);s.push(g.map((x)=>e.generateLocator(p,"hasNot",x)));continue}if(h.name==="internal:and"){let g=D(e,h.body.parsed,!1,i);s.push(g.map((x)=>e.generateLocator(p,"and",x)));continue}if(h.name==="internal:or"){let g=D(e,h.body.parsed,!1,i);s.push(g.map((x)=>e.generateLocator(p,"or",x)));continue}if(h.name==="internal:chain"){let g=D(e,h.body.parsed,!1,i);s.push(g.map((x)=>e.generateLocator(p,"chain",x)));continue}if(h.name==="internal:label"){let{exact:g,text:x}=K(h.body);s.push([e.generateLocator(p,"label",x,{exact:g})]);continue}if(h.name==="internal:role"){let g=ve(h.body,!0),x={attrs:[]};for(let u of g.attributes)if(u.name==="name")x.exact=u.caseSensitive,x.name=u.value;else{if(u.name==="level"&&typeof u.value==="string")u.value=+u.value;x.attrs.push({name:u.name==="include-hidden"?"includeHidden":u.name,value:u.value})}s.push([e.generateLocator(p,"role",g.name,x)]);continue}if(h.name==="internal:testid"){let g=ve(h.body,!0),{value:x}=g.attributes[0];s.push([e.generateLocator(p,"test-id",x)]);continue}if(h.name==="internal:attr"){let g=ve(h.body,!0),{name:x,value:u,caseSensitive:w}=g.attributes[0],S=u,$=!!w;if(x==="placeholder"){s.push([e.generateLocator(p,"placeholder",S,{exact:$})]);continue}if(x==="alt"){s.push([e.generateLocator(p,"alt",S,{exact:$})]);continue}if(x==="title"){s.push([e.generateLocator(p,"title",S,{exact:$})]);continue}}if(h.name==="internal:control"&&h.body==="enter-frame"){let g=s[s.length-1],x=n[o-1],u=g.map((w)=>e.chainLocators([w,e.generateLocator(p,"frame","")]));if(["xpath","css"].includes(x.name))u.push(e.generateLocator(p,"frame-locator",k({parts:[x]})),e.generateLocator(p,"frame-locator",k({parts:[x]},!0)));g.splice(0,g.length,...u),f="frame-locator";continue}let y=n[o+1],c=k({parts:[h]}),d=e.generateLocator(p,"default",c);if(y&&["internal:has-text","internal:has-not-text"].includes(y.name)){let{exact:g,text:x}=K(y.body);if(!g){let u=e.generateLocator("locator",y.name==="internal:has-text"?"has-text":"has-not-text",x,{exact:g}),w={};if(y.name==="internal:has-text")w.hasText=x;else w.hasNotText=x;let S=e.generateLocator(p,"default",c,w);s.push([e.chainLocators([d,u]),S]),o++;continue}}let T;if(["xpath","css"].includes(h.name)){let g=k({parts:[h]},!0);T=e.generateLocator(p,"default",g)}s.push([d,T].filter(Boolean))}return dt(e,s,i)}function dt(e,r,t){let i=r.map(()=>""),n=[],s=(f)=>{if(f===r.length)return n.push(e.chainLocators(i)),n.length<t;for(let o of r[f])if(i[f]=o,!s(f+1))return!1;return!0};return s(0),n}function K(e){let r=!1,t=e.match(/^\/(.*)\/([igm]*)$/);if(t)return{text:new RegExp(t[1],t[2])};if(e.endsWith('"'))e=JSON.parse(e),r=!0;else if(e.endsWith('"s'))e=JSON.parse(e.substring(0,e.length-1)),r=!0;else if(e.endsWith('"i'))e=JSON.parse(e.substring(0,e.length-1)),r=!1;return{exact:r,text:e}}class De{preferredQuote;constructor(e){this.preferredQuote=e}generateLocator(e,r,t,i={}){switch(r){case"default":if(i.hasText!==void 0)return`locator(${this.quote(t)}, { hasText: ${this.toHasText(i.hasText)} })`;if(i.hasNotText!==void 0)return`locator(${this.quote(t)}, { hasNotText: ${this.toHasText(i.hasNotText)} })`;return`locator(${this.quote(t)})`;case"frame-locator":return`frameLocator(${this.quote(t)})`;case"frame":return"contentFrame()";case"nth":return`nth(${t})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter({ visible: ${t==="true"?"true":"false"} })`;case"role":let n=[];if(C(i.name))n.push(`name: ${this.regexToSourceString(i.name)}`);else if(typeof i.name==="string"){if(n.push(`name: ${this.quote(i.name)}`),i.exact)n.push("exact: true")}for(let{name:f,value:o}of i.attrs)n.push(`${f}: ${typeof o==="string"?this.quote(o):o}`);let s=n.length?`, { ${n.join(", ")} }`:"";return`getByRole(${this.quote(t)}${s})`;case"has-text":return`filter({ hasText: ${this.toHasText(t)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(t)} })`;case"has":return`filter({ has: ${t} })`;case"hasNot":return`filter({ hasNot: ${t} })`;case"and":return`and(${t})`;case"or":return`or(${t})`;case"chain":return`locator(${t})`;case"test-id":return`getByTestId(${this.toTestIdValue(t)})`;case"text":return this.toCallWithExact("getByText",t,!!i.exact);case"alt":return this.toCallWithExact("getByAltText",t,!!i.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",t,!!i.exact);case"label":return this.toCallWithExact("getByLabel",t,!!i.exact);case"title":return this.toCallWithExact("getByTitle",t,!!i.exact);default:throw Error("Unknown selector kind "+r)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return G(String(e))}toCallWithExact(e,r,t){if(C(r))return`${e}(${this.regexToSourceString(r)})`;return t?`${e}(${this.quote(r)}, { exact: true })`:`${e}(${this.quote(r)})`}toHasText(e){if(C(e))return this.regexToSourceString(e);return this.quote(e)}toTestIdValue(e){if(C(e))return this.regexToSourceString(e);return this.quote(e)}quote(e){return Q(e,this.preferredQuote??"'")}}class ze{generateLocator(e,r,t,i={}){switch(r){case"default":if(i.hasText!==void 0)return`locator(${this.quote(t)}, has_text=${this.toHasText(i.hasText)})`;if(i.hasNotText!==void 0)return`locator(${this.quote(t)}, has_not_text=${this.toHasText(i.hasNotText)})`;return`locator(${this.quote(t)})`;case"frame-locator":return`frame_locator(${this.quote(t)})`;case"frame":return"content_frame";case"nth":return`nth(${t})`;case"first":return"first";case"last":return"last";case"visible":return`filter(visible=${t==="true"?"True":"False"})`;case"role":let n=[];if(C(i.name))n.push(`name=${this.regexToString(i.name)}`);else if(typeof i.name==="string"){if(n.push(`name=${this.quote(i.name)}`),i.exact)n.push("exact=True")}for(let{name:f,value:o}of i.attrs){let h=typeof o==="string"?this.quote(o):o;if(typeof o==="boolean")h=o?"True":"False";n.push(`${Ce(f)}=${h}`)}let s=n.length?`, ${n.join(", ")}`:"";return`get_by_role(${this.quote(t)}${s})`;case"has-text":return`filter(has_text=${this.toHasText(t)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(t)})`;case"has":return`filter(has=${t})`;case"hasNot":return`filter(has_not=${t})`;case"and":return`and_(${t})`;case"or":return`or_(${t})`;case"chain":return`locator(${t})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(t)})`;case"text":return this.toCallWithExact("get_by_text",t,!!i.exact);case"alt":return this.toCallWithExact("get_by_alt_text",t,!!i.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",t,!!i.exact);case"label":return this.toCallWithExact("get_by_label",t,!!i.exact);case"title":return this.toCallWithExact("get_by_title",t,!!i.exact);default:throw Error("Unknown selector kind "+r)}}chainLocators(e){return e.join(".")}regexToString(e){let r=e.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${G(e.source).replace(/\\\//,"/").replace(/"/g,"\\\"")}"${r})`}toCallWithExact(e,r,t){if(C(r))return`${e}(${this.regexToString(r)})`;if(t)return`${e}(${this.quote(r)}, exact=True)`;return`${e}(${this.quote(r)})`}toHasText(e){if(C(e))return this.regexToString(e);return`${this.quote(e)}`}toTestIdValue(e){if(C(e))return this.regexToString(e);return this.quote(e)}quote(e){return Q(e,'"')}}class Je{generateLocator(e,r,t,i={}){let n;switch(e){case"page":n="Page";break;case"frame-locator":n="FrameLocator";break;case"locator":n="Locator";break}switch(r){case"default":if(i.hasText!==void 0)return`locator(${this.quote(t)}, new ${n}.LocatorOptions().setHasText(${this.toHasText(i.hasText)}))`;if(i.hasNotText!==void 0)return`locator(${this.quote(t)}, new ${n}.LocatorOptions().setHasNotText(${this.toHasText(i.hasNotText)}))`;return`locator(${this.quote(t)})`;case"frame-locator":return`frameLocator(${this.quote(t)})`;case"frame":return"contentFrame()";case"nth":return`nth(${t})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter(new ${n}.FilterOptions().setVisible(${t==="true"?"true":"false"}))`;case"role":let s=[];if(C(i.name))s.push(`.setName(${this.regexToString(i.name)})`);else if(typeof i.name==="string"){if(s.push(`.setName(${this.quote(i.name)})`),i.exact)s.push(".setExact(true)")}for(let{name:o,value:h}of i.attrs)s.push(`.set${Y(o)}(${typeof h==="string"?this.quote(h):h})`);let f=s.length?`, new ${n}.GetByRoleOptions()${s.join("")}`:"";return`getByRole(AriaRole.${Ce(t).toUpperCase()}${f})`;case"has-text":return`filter(new ${n}.FilterOptions().setHasText(${this.toHasText(t)}))`;case"has-not-text":return`filter(new ${n}.FilterOptions().setHasNotText(${this.toHasText(t)}))`;case"has":return`filter(new ${n}.FilterOptions().setHas(${t}))`;case"hasNot":return`filter(new ${n}.FilterOptions().setHasNot(${t}))`;case"and":return`and(${t})`;case"or":return`or(${t})`;case"chain":return`locator(${t})`;case"test-id":return`getByTestId(${this.toTestIdValue(t)})`;case"text":return this.toCallWithExact(n,"getByText",t,!!i.exact);case"alt":return this.toCallWithExact(n,"getByAltText",t,!!i.exact);case"placeholder":return this.toCallWithExact(n,"getByPlaceholder",t,!!i.exact);case"label":return this.toCallWithExact(n,"getByLabel",t,!!i.exact);case"title":return this.toCallWithExact(n,"getByTitle",t,!!i.exact);default:throw Error("Unknown selector kind "+r)}}chainLocators(e){return e.join(".")}regexToString(e){let r=e.flags.includes("i")?", Pattern.CASE_INSENSITIVE":"";return`Pattern.compile(${this.quote(G(e.source))}${r})`}toCallWithExact(e,r,t,i){if(C(t))return`${r}(${this.regexToString(t)})`;if(i)return`${r}(${this.quote(t)}, new ${e}.${Y(r)}Options().setExact(true))`;return`${r}(${this.quote(t)})`}toHasText(e){if(C(e))return this.regexToString(e);return this.quote(e)}toTestIdValue(e){if(C(e))return this.regexToString(e);return this.quote(e)}quote(e){return Q(e,'"')}}class Ve{generateLocator(e,r,t,i={}){switch(r){case"default":if(i.hasText!==void 0)return`Locator(${this.quote(t)}, new() { ${this.toHasText(i.hasText)} })`;if(i.hasNotText!==void 0)return`Locator(${this.quote(t)}, new() { ${this.toHasNotText(i.hasNotText)} })`;return`Locator(${this.quote(t)})`;case"frame-locator":return`FrameLocator(${this.quote(t)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${t})`;case"first":return"First";case"last":return"Last";case"visible":return`Filter(new() { Visible = ${t==="true"?"true":"false"} })`;case"role":let n=[];if(C(i.name))n.push(`NameRegex = ${this.regexToString(i.name)}`);else if(typeof i.name==="string"){if(n.push(`Name = ${this.quote(i.name)}`),i.exact)n.push("Exact = true")}for(let{name:f,value:o}of i.attrs)n.push(`${Y(f)} = ${typeof o==="string"?this.quote(o):o}`);let s=n.length?`, new() { ${n.join(", ")} }`:"";return`GetByRole(AriaRole.${Y(t)}${s})`;case"has-text":return`Filter(new() { ${this.toHasText(t)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(t)} })`;case"has":return`Filter(new() { Has = ${t} })`;case"hasNot":return`Filter(new() { HasNot = ${t} })`;case"and":return`And(${t})`;case"or":return`Or(${t})`;case"chain":return`Locator(${t})`;case"test-id":return`GetByTestId(${this.toTestIdValue(t)})`;case"text":return this.toCallWithExact("GetByText",t,!!i.exact);case"alt":return this.toCallWithExact("GetByAltText",t,!!i.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",t,!!i.exact);case"label":return this.toCallWithExact("GetByLabel",t,!!i.exact);case"title":return this.toCallWithExact("GetByTitle",t,!!i.exact);default:throw Error("Unknown selector kind "+r)}}chainLocators(e){return e.join(".")}regexToString(e){let r=e.flags.includes("i")?", RegexOptions.IgnoreCase":"";return`new Regex(${this.quote(G(e.source))}${r})`}toCallWithExact(e,r,t){if(C(r))return`${e}(${this.regexToString(r)})`;if(t)return`${e}(${this.quote(r)}, new() { Exact = true })`;return`${e}(${this.quote(r)})`}toHasText(e){if(C(e))return`HasTextRegex = ${this.regexToString(e)}`;return`HasText = ${this.quote(e)}`}toTestIdValue(e){if(C(e))return this.regexToString(e);return this.quote(e)}toHasNotText(e){if(C(e))return`HasNotTextRegex = ${this.regexToString(e)}`;return`HasNotText = ${this.quote(e)}`}quote(e){return Q(e,'"')}}class Qe{generateLocator(e,r,t,i={}){return JSON.stringify({kind:r,body:t,options:i})}chainLocators(e){let r=e.map((t)=>JSON.parse(t));for(let t=0;t<r.length-1;++t)r[t].next=r[t+1];return JSON.stringify(r[0])}}var xt={javascript:De,python:ze,java:Je,csharp:Ve,jsonl:Qe};function C(e){return e instanceof RegExp}var Ne=`/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
:host {
font-size: 13px;
font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif;
color: #333;
}
svg {
position: absolute;
height: 0;
}
x-pw-tooltip {
backdrop-filter: blur(5px);
background-color: white;
border-radius: 6px;
box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
display: none;
font-size: 12.8px;
font-weight: normal;
left: 0;
line-height: 1.5;
max-width: 600px;
position: absolute;
top: 0;
padding: 0;
flex-direction: column;
overflow: hidden;
}
x-pw-tooltip-line {
display: flex;
max-width: 600px;
padding: 6px;
user-select: none;
cursor: pointer;
}
x-pw-tooltip-footer {
display: flex;
max-width: 600px;
padding: 6px;
user-select: none;
color: #777;
}
x-pw-dialog {
background-color: white;
pointer-events: auto;
border-radius: 6px;
box-shadow: 0 0.5rem 1.2rem rgba(0,0,0,.3);
display: flex;
flex-direction: column;
position: absolute;
z-index: 10;
font-size: 13px;
}
x-pw-dialog:not(.autosize) {
width: 400px;
height: 150px;
}
x-pw-dialog-body {
display: flex;
flex-direction: column;
flex: auto;
}
x-pw-dialog-body label {
margin: 5px 8px;
display: flex;
flex-direction: row;
align-items: center;
}
x-pw-highlight {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
}
x-pw-action-point {
position: absolute;
width: 20px;
height: 20px;
background: red;
border-radius: 10px;
margin: -10px 0 0 -10px;
z-index: 2;
}
x-pw-title {
position: absolute;
backdrop-filter: blur(5px);
background-color: rgba(0, 0, 0, 0.5);
color: white;
border-radius: 6px;
padding: 6px;
font-size: 24px;
line-height: 1.4;
white-space: nowrap;
user-select: none;
z-index: 3;
}
x-pw-user-overlays, x-pw-user-overlay {
position: absolute;
inset: 0;
}
@keyframes pw-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
x-pw-separator {
height: 1px;
margin: 6px 9px;
background: rgb(148 148 148 / 90%);
}
x-pw-tool-gripper {
height: 28px;
width: 24px;
margin: 2px 0;
cursor: grab;
}
x-pw-tool-gripper:active {
cursor: grabbing;
}
x-pw-tool-gripper > x-div {
width: 16px;
height: 16px;
margin: 6px 4px;
clip-path: url(#icon-gripper);
background-color: #555555;
}
x-pw-tools-list > label {
display: flex;
align-items: center;
margin: 0 10px;
user-select: none;
}
x-pw-tools-list {
display: flex;
width: 100%;
border-bottom: 1px solid #dddddd;
}
x-pw-tool-item {
pointer-events: auto;
height: 28px;
width: 28px;
border-radius: 3px;
}
x-pw-tool-item:not(.disabled) {
cursor: pointer;
}
x-pw-tool-item:not(.disabled):hover {
background-color: hsl(0, 0%, 86%);
}
x-pw-tool-item.toggled {
background-color: rgba(138, 202, 228, 0.5);
}
x-pw-tool-item.toggled:not(.disabled):hover {
background-color: #8acae4c4;
}
x-pw-tool-item > x-div {
width: 16px;
height: 16px;
margin: 6px;
background-color: #3a3a3a;
}
x-pw-tool-item.disabled > x-div {
background-color: rgba(97, 97, 97, 0.5);
cursor: default;
}
x-pw-tool-item.record.toggled {
background-color: transparent;
}
x-pw-tool-item.record.toggled:not(.disabled):hover {
background-color: hsl(0, 0%, 86%);
}
x-pw-tool-item.record.toggled > x-div {
background-color: #a1260d;
}
x-pw-tool-item.record.disabled.toggled > x-div {
opacity: 0.8;
}
x-pw-tool-item.accept > x-div {
background-color: #388a34;
}
x-pw-tool-item.record > x-div {
/* codicon: circle-large-filled */
clip-path: url(#icon-circle-large-filled);
}
x-pw-tool-item.record.toggled > x-div {
/* codicon: stop-circle */
clip-path: url(#icon-stop-circle);
}
x-pw-tool-item.pick-locator > x-div {
/* codicon: inspect */
clip-path: url(#icon-inspect);
}
x-pw-tool-item.text > x-div {
/* codicon: whole-word */
clip-path: url(#icon-whole-word);
}
x-pw-tool-item.visibility > x-div {
/* codicon: eye */
clip-path: url(#icon-eye);
}
x-pw-tool-item.value > x-div {
/* codicon: symbol-constant */
clip-path: url(#icon-symbol-constant);
}
x-pw-tool-item.snapshot > x-div {
/* codicon: eye */
clip-path: url(#icon-gist);
}
x-pw-tool-item.accept > x-div {
clip-path: url(#icon-check);
}
x-pw-tool-item.cancel > x-div {
clip-path: url(#icon-close);
}
x-pw-tool-item.succeeded > x-div {
/* codicon: pass */
clip-path: url(#icon-pass);
background-color: #388a34 !important;
}
x-pw-overlay {
position: absolute;
top: 0;
max-width: min-content;
z-index: 2147483647;
background: transparent;
pointer-events: auto;
}
x-pw-overlay x-pw-tools-list {
background-color: #ffffffdd;
box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 5px;
border-radius: 3px;
border-bottom: none;
}
x-pw-overlay x-pw-tool-item {
margin: 2px;
}
textarea.text-editor {
font-family: system-ui,Ubuntu,Droid Sans,sans-serif;
flex: auto;
border: none;
margin: 6px 10px;
color: #333;
outline: 1px solid transparent!important;
resize: none;
padding: 0;
font-size: 13px;
}
textarea.text-editor.does-not-match {
outline: 1px solid red !important;
}
x-div {
display: block;
}
x-spacer {
flex: auto;
}
* {
box-sizing: border-box;
}
*[hidden] {
display: none !important;
}
x-locator-editor {
flex: none;
width: 100%;
height: 60px;
padding: 4px;
border-bottom: 1px solid #dddddd;
outline: 1px solid transparent;
}
x-locator-editor.does-not-match {
outline: 1px solid red;
}
.CodeMirror {
width: 100% !important;
height: 100% !important;
}
x-pw-action-list {
flex: auto;
display: flex;
flex-direction: column;
user-select: none;
}
x-pw-action-item {
padding: 6px 10px;
cursor: pointer;
overflow: hidden;
}
x-pw-action-item:hover {
background-color: hsl(0, 0%, 95%);
}
x-pw-action-item:last-child {
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
`;class Z{_glassPaneElement;_glassPaneShadow;_renderedEntries=[];_actionPointElement;_titleElement;_userOverlayContainer;_userOverlays=new Map;_userOverlayHidden=!1;_isUnderTest;_injectedScript;_rafRequest;_language="javascript";_elementHighlightSelectors=new Map;constructor(e){this._injectedScript=e;let r=e.document;if(this._isUnderTest=e.isUnderTest,this._glassPaneElement=r.createElement("x-pw-glass"),this._glassPaneElement.setAttribute("popover","manual"),this._glassPaneElement.style.inset="0",this._glassPaneElement.style.width="100%",this._glassPaneElement.style.height="100%",this._glassPaneElement.style.maxWidth="none",this._glassPaneElement.style.maxHeight="none",this._glassPaneElement.style.padding="0",this._glassPaneElement.style.margin="0",this._glassPaneElement.style.border="none",this._glassPaneElement.style.overflow="visible",this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.display="flex",this._glassPaneElement.style.backgroundColor="transparent",this._actionPointElement=r.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._titleElement=r.createElement("x-pw-title"),this._titleElement.setAttribute("hidden","true"),this._userOverlayContainer=r.createElement("x-pw-user-overlays"),this._userOverlayContainer.setAttribute("hidden","true"),this._glassPaneShadow=this._glassPaneElement.attachShadow({mode:this._isUnderTest?"open":"closed"}),typeof this._glassPaneShadow.adoptedStyleSheets.push==="function"){let t=new this._injectedScript.window.CSSStyleSheet;t.replaceSync(Ne),this._glassPaneShadow.adoptedStyleSheets.push(t)}else{let t=this._injectedScript.document.createElement("style");t.textContent=Ne,this._glassPaneShadow.appendChild(t)}this._glassPaneShadow.appendChild(this._actionPointElement),this._glassPaneShadow.appendChild(this._titleElement),this._glassPaneShadow.appendChild(this._userOverlayContainer)}install(){if(!this._injectedScript.document.documentElement)return;if(!this._injectedScript.document.documentElement.contains(this._glassPaneElement)||this._glassPaneElement.nextElementSibling)this._injectedScript.document.documentElement.appendChild(this._glassPaneElement);this._bringToFront()}_bringToFront(){this._glassPaneElement.hidePopover(),this._glassPaneElement.showPopover()}setLanguage(e){this._language=e}addElementHighlight(e,r){let t=k(e);this._elementHighlightSelectors.set(t,{selector:e,cssStyle:r}),this._ensureElementHighlightRaf()}removeElementHighlight(e){let r=k(e);if(!this._elementHighlightSelectors.delete(r))return;if(this._elementHighlightSelectors.size===0){if(this._rafRequest)this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0;this.clearHighlight()}}_ensureElementHighlightRaf(){if(this._rafRequest)return;let e=()=>{let r=[];for(let{selector:t,cssStyle:i}of this._elementHighlightSelectors.values()){let n=this._injectedScript.querySelectorAll(t,this._injectedScript.document.documentElement),s=Ue(this._language,k(t)),f=n.length>1?"#f6b26b7f":"#6fa8dc7f";for(let o=0;o<n.length;++o){let h=n.length>1?` [${o+1} of ${n.length}]`:"";r.push({element:n[o],color:f,tooltipText:s+h,cssStyle:i})}}this.updateHighlight(r),this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)};this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)}uninstall(){if(this._rafRequest)this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0;this._elementHighlightSelectors.clear(),this._glassPaneElement.remove()}showActionPoint(e,r,t){if(this._actionPointElement.style.top=r+"px",this._actionPointElement.style.left=e+"px",this._actionPointElement.hidden=!1,t)this._actionPointElement.style.animation=`pw-fade-out ${t}ms ease-out forwards`;else this._actionPointElement.style.animation=""}hideActionPoint(){this._actionPointElement.hidden=!0}showActionTitle(e,r,t,i){if(this._titleElement.textContent=e,this._titleElement.hidden=!1,r){let n=r/4;this._titleElement.style.animation=`pw-fade-out ${n}ms ease-out ${r-n}ms forwards`}else this._titleElement.style.animation="";switch(this._titleElement.style.top="",this._titleElement.style.bottom="",this._titleElement.style.left="",this._titleElement.style.right="",this._titleElement.style.transform="",t){case"top-left":this._titleElement.style.top="6px",this._titleElement.style.left="6px";break;case"top":this._titleElement.style.top="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-left":this._titleElement.style.bottom="6px",this._titleElement.style.left="6px";break;case"bottom":this._titleElement.style.bottom="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-right":this._titleElement.style.bottom="6px",this._titleElement.style.right="6px";break;case"top-right":default:this._titleElement.style.top="6px",this._titleElement.style.right="6px";break}if(i)this._titleElement.style.fontSize=i+"px"}hideActionTitle(){this._titleElement.hidden=!0}addUserOverlay(e,r){let t=this._injectedScript.document.createElement("div");t.className="x-pw-user-overlay",t.innerHTML=r;for(let i of t.querySelectorAll("script"))i.remove();for(let i of t.querySelectorAll("*"))for(let n of[...i.attributes])if(n.name.startsWith("on"))i.removeAttribute(n.name);return this._userOverlays.set(e,t),this._userOverlayContainer.appendChild(t),this._userOverlayContainer.hidden=this._userOverlayHidden,e}getUserOverlay(e){return this._userOverlays.get(e)}removeUserOverlay(e){let r=this._userOverlays.get(e);if(r)r.remove(),this._userOverlays.delete(e);if(this._userOverlays.size===0)this._userOverlayContainer.hidden=!0}setUserOverlaysVisible(e){this._userOverlayHidden=!e,this._userOverlayContainer.hidden=!e||this._userOverlays.size===0}clearHighlight(){for(let e of this._renderedEntries)e.highlightElement?.remove(),e.tooltipElement?.remove();this._renderedEntries=[]}maskElements(e,r){this.updateHighlight(e.map((t)=>({element:t,color:r})))}updateHighlight(e){if(this._highlightIsUpToDate(e))return;this.clearHighlight();for(let r of e){let t=this._createHighlightElement();this._glassPaneShadow.appendChild(t);let i;if(r.tooltipText){i=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(i),i.style.top="0",i.style.left="0",i.style.display="flex";let n=this._injectedScript.document.createElement("x-pw-tooltip-line");n.textContent=r.tooltipText,i.appendChild(n)}this._renderedEntries.push({targetElement:r.element,box:Ye(r.box),color:r.color,borderColor:r.borderColor,fadeDuration:r.fadeDuration,cssStyle:r.cssStyle,tooltipElement:i,highlightElement:t})}for(let r of this._renderedEntries){if(!r.box&&!r.targetElement)continue;if(r.box=r.box||r.targetElement.getBoundingClientRect(),!r.tooltipElement)continue;let{anchorLeft:t,anchorTop:i}=this.tooltipPosition(r.box,r.tooltipElement);r.tooltipTop=i,r.tooltipLeft=t}for(let r of this._renderedEntries){if(r.tooltipElement)r.tooltipElement.style.top=r.tooltipTop+"px",r.tooltipElement.style.left=r.tooltipLeft+"px";let t=r.box;if(r.highlightElement.style.backgroundColor=r.color,r.highlightElement.style.left=t.x+"px",r.highlightElement.style.top=t.y+"px",r.highlightElement.style.width=t.width+"px",r.highlightElement.style.height=t.height+"px",r.highlightElement.style.display="block",r.borderColor)r.highlightElement.style.border="2px solid "+r.borderColor;if(r.fadeDuration)r.highlightElement.style.animation=`pw-fade-out ${r.fadeDuration}ms ease-out forwards`;if(r.cssStyle)r.highlightElement.style.cssText+=";"+r.cssStyle;if(this._isUnderTest)console.error("Highlight box for test: "+JSON.stringify({x:t.x,y:t.y,width:t.width,height:t.height}))}}firstBox(){return this._renderedEntries[0]?.box}firstTooltipBox(){let e=this._renderedEntries[0];if(!e||!e.tooltipElement||e.tooltipLeft===void 0||e.tooltipTop===void 0)return;return{x:e.tooltipLeft,y:e.tooltipTop,left:e.tooltipLeft,top:e.tooltipTop,width:e.tooltipElement.offsetWidth,height:e.tooltipElement.offsetHeight,bottom:e.tooltipTop+e.tooltipElement.offsetHeight,right:e.tooltipLeft+e.tooltipElement.offsetWidth,toJSON:()=>{}}}tooltipPosition(e,r){let{offsetWidth:t,offsetHeight:i}=r,n=this._glassPaneElement.offsetWidth,s=this._glassPaneElement.offsetHeight,f=Math.max(5,e.left);if(f+t>n-5)f=n-t-5;let o=Math.max(0,e.bottom)+5;if(o+i>s-5)if(Math.max(0,e.top)>i+5)o=Math.max(0,e.top)-i-5;else o=s-5-i;return{anchorLeft:f,anchorTop:o}}_highlightIsUpToDate(e){if(e.length!==this._renderedEntries.length)return!1;for(let r=0;r<this._renderedEntries.length;++r){if(e[r].element!==this._renderedEntries[r].targetElement)return!1;if(e[r].color!==this._renderedEntries[r].color)return!1;if(e[r].cssStyle!==this._renderedEntries[r].cssStyle)return!1;let t=this._renderedEntries[r].box;if(!t)return!1;let i=e[r].box?Ye(e[r].box):e[r].element.getBoundingClientRect();if(i.top!==t.top||i.right!==t.right||i.bottom!==t.bottom||i.left!==t.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(e){this._glassPaneShadow.appendChild(e)}onGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="auto",this._glassPaneElement.style.backgroundColor="rgba(0, 0, 0, 0.3)",this._glassPaneElement.addEventListener("click",e)}offGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.backgroundColor="transparent",this._glassPaneElement.removeEventListener("click",e)}}function Ye(e){if(!e)return;return new DOMRect(e.x,e.y,e.width,e.height)}(()=>{let e=window.__fd,r=e?._injected;if(!e||!r||e.__recorderSupport)return;e.__recorderSupport=!0;let t;r.createHighlight=()=>new Z(r),r.hideHighlight=()=>{if(t)t.uninstall(),t=void 0},r.addHighlight=(i,n)=>{t??=new Z(r),t.install(),t.addElementHighlight(i,n)},r.removeHighlight=(i)=>{t??=new Z(r),t.install(),t.removeElementHighlight(i)}})();})();