(()=>{var j=function(w,H,_){return w>=H&&w<=_};function f(w){return j(w,48,57)}function h0(w){return f(w)||j(w,65,70)||j(w,97,102)}function _1(w){return j(w,65,90)}function Y1(w){return j(w,97,122)}function H1(w){return _1(w)||Y1(w)}function X1(w){return w>=128}function Y0(w){return H1(w)||X1(w)||w===95}function C0(w){return Y0(w)||f(w)||w===45}function Z1(w){return j(w,0,8)||w===11||j(w,14,31)||w===127}function l(w){return w===10}function T(w){return l(w)||w===9||w===32}var $1=1114111;class H0 extends Error{constructor(w){super(w);this.name="InvalidCharacterError"}}function K1(w){let H=[];for(let _=0;_<w.length;_++){let X=w.charCodeAt(_);if(X===13&&w.charCodeAt(_+1)===10)X=10,_++;if(X===13||X===12)X=10;if(X===0)X=65533;if(j(X,55296,56319)&&j(w.charCodeAt(_+1),56320,57343)){let Y=X-55296,Z=w.charCodeAt(_+1)-56320;X=Math.pow(2,16)+Y*Math.pow(2,10)+Z,_++}H.push(X)}return H}function A(w){if(w<=65535)return String.fromCharCode(w);w-=Math.pow(2,16);let H=Math.floor(w/Math.pow(2,10))+55296,_=w%Math.pow(2,10)+56320;return String.fromCharCode(H)+String.fromCharCode(_)}function g0(w){let H=K1(w),_=-1,X=[],Y,Z=0,B=0,$=0,G=function(){Z+=1,$=B,B=0},Q={line:Z,column:B},O=function(J){if(J>=H.length)return-1;return H[J]},U=function(J){if(J===void 0)J=1;if(J>3)throw"Spec Error: no more than three codepoints of lookahead.";return O(_+J)},q=function(J){if(J===void 0)J=1;if(_+=J,Y=O(_),l(Y))G();else B+=J;return!0},z=function(){if(_-=1,l(Y))Z-=1,B=$;else B-=1;return Q.line=Z,Q.column=B,!0},V=function(J){if(J===void 0)J=Y;return J===-1},N=function(){},M=function(){},R=function(){if(I(),q(),T(Y)){while(T(U()))q();return new i}else if(Y===34)return e();else if(Y===35)if(C0(U())||x(U(1),U(2))){let J=new R0("");if(E(U(1),U(2),U(3)))J.type="id";return J.value=_0(),J}else return new L(Y);else if(Y===36)if(U()===61)return q(),new b0;else return new L(Y);else if(Y===39)return e();else if(Y===40)return new B0;else if(Y===41)return new V0;else if(Y===42)if(U()===61)return q(),new m0;else return new L(Y);else if(Y===43)if(z0())return z(),F();else return new L(Y);else if(Y===44)return new U0;else if(Y===45)if(z0())return z(),F();else if(U(1)===45&&U(2)===62)return q(2),new $0;else if(h())return z(),m();else return new L(Y);else if(Y===46)if(z0())return z(),F();else return new L(Y);else if(Y===58)return new K0;else if(Y===59)return new J0;else if(Y===60)if(U(1)===33&&U(2)===45&&U(3)===45)return q(3),new Z0;else return new L(Y);else if(Y===64)if(E(U(1),U(2),U(3)))return new W0(_0());else return new L(Y);else if(Y===91)return new Q0;else if(Y===92)if(K())return z(),m();else return M(),new L(Y);else if(Y===93)return new c;else if(Y===94)if(U()===61)return q(),new S0;else return new L(Y);else if(Y===123)return new M0;else if(Y===124)if(U()===61)return q(),new x0;else if(U()===124)return q(),new q0;else return new L(Y);else if(Y===125)return new G0;else if(Y===126)if(U()===61)return q(),new T0;else return new L(Y);else if(f(Y))return z(),F();else if(Y0(Y))return z(),m();else if(V())return new u;else return new L(Y)},I=function(){while(U(1)===47&&U(2)===42){q(2);while(!0)if(q(),Y===42&&U()===47){q();break}else if(V()){M();return}}},F=function(){let J=o0();if(E(U(1),U(2),U(3))){let W=new k0;return W.value=J.value,W.repr=J.repr,W.type=J.type,W.unit=_0(),W}else if(U()===37){q();let W=new j0;return W.value=J.value,W.repr=J.repr,W}else{let W=new O0;return W.value=J.value,W.repr=J.repr,W.type=J.type,W}},m=function(){let J=_0();if(J.toLowerCase()==="url"&&U()===40){q();while(T(U(1))&&T(U(2)))q();if(U()===34||U()===39)return new p(J);else if(T(U())&&(U(2)===34||U(2)===39))return new p(J);else return w0()}else if(U()===40)return q(),new p(J);else return new N0(J)},e=function(J){if(J===void 0)J=Y;let W="";while(q())if(Y===J||V())return new I0(W);else if(l(Y))return M(),z(),new X0;else if(Y===92)if(V(U()))N();else if(l(U()))q();else W+=A(k());else W+=A(Y);throw Error("Internal error")},w0=function(){let J=new D0("");while(T(U()))q();if(V(U()))return J;while(q())if(Y===41||V())return J;else if(T(Y)){while(T(U()))q();if(U()===41||V(U()))return q(),J;else return L0(),new y}else if(Y===34||Y===39||Y===40||Z1(Y))return M(),L0(),new y;else if(Y===92)if(K())J.value+=A(k());else return M(),L0(),new y;else J.value+=A(Y);throw Error("Internal error")},k=function(){if(q(),h0(Y)){let J=[Y];for(let C=0;C<5;C++)if(h0(U()))q(),J.push(Y);else break;if(T(U()))q();let W=parseInt(J.map(function(C){return String.fromCharCode(C)}).join(""),16);if(W>$1)W=65533;return W}else if(V())return 65533;else return Y},x=function(J,W){if(J!==92)return!1;if(l(W))return!1;return!0},K=function(){return x(Y,U())},E=function(J,W,C){if(J===45)return Y0(W)||W===45||x(W,C);else if(Y0(J))return!0;else if(J===92)return x(J,W);else return!1},h=function(){return E(Y,U(1),U(2))},r0=function(J,W,C){if(J===43||J===45){if(f(W))return!0;if(W===46&&f(C))return!0;return!1}else if(J===46){if(f(W))return!0;return!1}else if(f(J))return!0;else return!1},z0=function(){return r0(Y,U(1),U(2))},_0=function(){let J="";while(q())if(C0(Y))J+=A(Y);else if(K())J+=A(k());else return z(),J;throw Error("Internal parse error")},o0=function(){let J="",W="integer";if(U()===43||U()===45)q(),J+=A(Y);while(f(U()))q(),J+=A(Y);if(U(1)===46&&f(U(2))){q(),J+=A(Y),q(),J+=A(Y),W="number";while(f(U()))q(),J+=A(Y)}let C=U(1),F0=U(2),e0=U(3);if((C===69||C===101)&&f(F0)){q(),J+=A(Y),q(),J+=A(Y),W="number";while(f(U()))q(),J+=A(Y)}else if((C===69||C===101)&&(F0===43||F0===45)&&f(e0)){q(),J+=A(Y),q(),J+=A(Y),q(),J+=A(Y),W="number";while(f(U()))q(),J+=A(Y)}let w1=t0(J);return{type:W,value:w1,repr:J}},t0=function(J){return+J},L0=function(){while(q())if(Y===41||V())return;else if(K())k(),N();else N()},f0=0;while(!V(U()))if(X.push(R()),f0++,f0>H.length*2)throw Error("I'm infinite-looping!");return X}class D{tokenType="";value;toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}}class X0 extends D{tokenType="BADSTRING"}class y extends D{tokenType="BADURL"}class i extends D{tokenType="WHITESPACE";toString(){return"WS"}toSource(){return" "}}class Z0 extends D{tokenType="CDO";toSource(){return"<!--"}}class $0 extends D{tokenType="CDC";toSource(){return"-->"}}class K0 extends D{tokenType=":"}class J0 extends D{tokenType=";"}class U0 extends D{tokenType=","}class S extends D{value="";mirror=""}class M0 extends S{tokenType="{";constructor(){super();this.value="{",this.mirror="}"}}class G0 extends S{tokenType="}";constructor(){super();this.value="}",this.mirror="{"}}class Q0 extends S{tokenType="[";constructor(){super();this.value="[",this.mirror="]"}}class c extends S{tokenType="]";constructor(){super();this.value="]",this.mirror="["}}class B0 extends S{tokenType="(";constructor(){super();this.value="(",this.mirror=")"}}class V0 extends S{tokenType=")";constructor(){super();this.value=")",this.mirror="("}}class T0 extends D{tokenType="~="}class x0 extends D{tokenType="|="}class S0 extends D{tokenType="^="}class b0 extends D{tokenType="$="}class m0 extends D{tokenType="*="}class q0 extends D{tokenType="||"}class u extends D{tokenType="EOF";toSource(){return""}}class L extends D{tokenType="DELIM";value="";constructor(w){super();this.value=A(w)}toString(){return"DELIM("+this.value+")"}toJSON(){let w=this.constructor.prototype.constructor.prototype.toJSON.call(this);return w.value=this.value,w}toSource(){if(this.value==="\\")return"\\\n";else return this.value}}class b extends D{value="";ASCIIMatch(w){return this.value.toLowerCase()===w.toLowerCase()}toJSON(){let w=this.constructor.prototype.constructor.prototype.toJSON.call(this);return w.value=this.value,w}}class N0 extends b{constructor(w){super();this.value=w}tokenType="IDENT";toString(){return"IDENT("+this.value+")"}toSource(){return n(this.value)}}class p extends b{tokenType="FUNCTION";mirror;constructor(w){super();this.value=w,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return n(this.value)+"("}}class W0 extends b{tokenType="AT-KEYWORD";constructor(w){super();this.value=w}toString(){return"AT("+this.value+")"}toSource(){return"@"+n(this.value)}}class R0 extends b{tokenType="HASH";type;constructor(w){super();this.value=w,this.type="unrestricted"}toString(){return"HASH("+this.value+")"}toJSON(){let w=this.constructor.prototype.constructor.prototype.toJSON.call(this);return w.value=this.value,w.type=this.type,w}toSource(){if(this.type==="id")return"#"+n(this.value);else return"#"+J1(this.value)}}class I0 extends b{tokenType="STRING";constructor(w){super();this.value=w}toString(){return'"'+l0(this.value)+'"'}}class D0 extends b{tokenType="URL";constructor(w){super();this.value=w}toString(){return"URL("+this.value+")"}toSource(){return'url("'+l0(this.value)+'")'}}class O0 extends D{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 w=super.toJSON();return w.value=this.value,w.type=this.type,w.repr=this.repr,w}toSource(){return this.repr}}class j0 extends D{tokenType="PERCENTAGE";repr;constructor(){super();this.repr=""}toString(){return"PERCENTAGE("+this.value+")"}toJSON(){let w=this.constructor.prototype.constructor.prototype.toJSON.call(this);return w.value=this.value,w.repr=this.repr,w}toSource(){return this.repr+"%"}}class k0 extends D{tokenType="DIMENSION";type;repr;unit;constructor(){super();this.type="integer",this.repr="",this.unit=""}toString(){return"DIM("+this.value+","+this.unit+")"}toJSON(){let w=this.constructor.prototype.constructor.prototype.toJSON.call(this);return w.value=this.value,w.type=this.type,w.repr=this.repr,w.unit=this.unit,w}toSource(){let w=this.repr,H=n(this.unit);if(H[0].toLowerCase()==="e"&&(H[1]==="-"||j(H.charCodeAt(1),48,57)))H="\\65 "+H.slice(1,H.length);return w+H}}function n(w){w=""+w;let H="",_=w.charCodeAt(0);for(let X=0;X<w.length;X++){let Y=w.charCodeAt(X);if(Y===0)throw new H0("Invalid character: the input contains U+0000.");if(j(Y,1,31)||Y===127||X===0&&j(Y,48,57)||X===1&&j(Y,48,57)&&_===45)H+="\\"+Y.toString(16)+" ";else if(Y>=128||Y===45||Y===95||j(Y,48,57)||j(Y,65,90)||j(Y,97,122))H+=w[X];else H+="\\"+w[X]}return H}function J1(w){w=""+w;let H="";for(let _=0;_<w.length;_++){let X=w.charCodeAt(_);if(X===0)throw new H0("Invalid character: the input contains U+0000.");if(X>=128||X===45||X===95||j(X,48,57)||j(X,65,90)||j(X,97,122))H+=w[_];else H+="\\"+X.toString(16)+" "}return H}function l0(w){w=""+w;let H="";for(let _=0;_<w.length;_++){let X=w.charCodeAt(_);if(X===0)throw new H0("Invalid character: the input contains U+0000.");if(j(X,1,31)||X===127)H+="\\"+X.toString(16)+" ";else if(X===34||X===92)H+="\\"+w[_];else H+=w[_]}return H}class P extends Error{}function y0(w,H){let _;try{if(_=g0(w),!(_[_.length-1]instanceof u))_.push(new u)}catch(K){let E=K.message+` while parsing css selector "${w}". Did you mean to CSS.escape it?`,h=(K.stack||"").indexOf(K.message);if(h!==-1)K.stack=K.stack.substring(0,h)+E+K.stack.substring(h+K.message.length);throw K.message=E,K}let X=_.find((K)=>{return K instanceof W0||K instanceof X0||K instanceof y||K instanceof q0||K instanceof Z0||K instanceof $0||K instanceof J0||K instanceof M0||K instanceof G0||K instanceof D0||K instanceof j0});if(X)throw new P(`Unsupported token "${X.toSource()}" while parsing css selector "${w}". Did you mean to CSS.escape it?`);let Y=0,Z=new Set;function B(){return new P(`Unexpected token "${_[Y].toSource()}" while parsing css selector "${w}". Did you mean to CSS.escape it?`)}function $(){while(_[Y]instanceof i)Y++}function G(K=Y){return _[K]instanceof N0}function Q(K=Y){return _[K]instanceof I0}function O(K=Y){return _[K]instanceof O0}function U(K=Y){return _[K]instanceof U0}function q(K=Y){return _[K]instanceof B0}function z(K=Y){return _[K]instanceof V0}function V(K=Y){return _[K]instanceof p}function N(K=Y){return _[K]instanceof L&&_[K].value==="*"}function M(K=Y){return _[K]instanceof u}function R(K=Y){return _[K]instanceof L&&[">","+","~"].includes(_[K].value)}function I(K=Y){return U(K)||z(K)||M(K)||R(K)||_[K]instanceof i}function F(){let K=[m()];while(!0){if($(),!U())break;Y++,K.push(m())}return K}function m(){if($(),O())return _[Y++].value;if(Q())return _[Y++].value;return e()}function e(){let K={simples:[]};if($(),R())K.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""});else K.simples.push({selector:w0(),combinator:""});while(!0){if($(),R())K.simples[K.simples.length-1].combinator=_[Y++].value,$();else if(I())break;K.simples.push({combinator:"",selector:w0()})}return K}function w0(){let K="",E=[];while(!I())if(G()||N())K+=_[Y++].toSource();else if(_[Y]instanceof R0)K+=_[Y++].toSource();else if(_[Y]instanceof L&&_[Y].value===".")if(Y++,G())K+="."+_[Y++].toSource();else throw B();else if(_[Y]instanceof K0)if(Y++,G())if(!H.has(_[Y].value.toLowerCase()))K+=":"+_[Y++].toSource();else{let h=_[Y++].value.toLowerCase();E.push({name:h,args:[]}),Z.add(h)}else if(V()){let h=_[Y++].value.toLowerCase();if(!H.has(h))K+=`:${h}(${k()})`;else E.push({name:h,args:F()}),Z.add(h);if($(),!z())throw B();Y++}else throw B();else if(_[Y]instanceof Q0){K+="[",Y++;while(!(_[Y]instanceof c)&&!M())K+=_[Y++].toSource();if(!(_[Y]instanceof c))throw B();K+="]",Y++}else throw B();if(!K&&!E.length)throw B();return{css:K||void 0,functions:E}}function k(){let K="",E=1;while(!M()){if(q()||V())E++;if(z())E--;if(!E)break;K+=_[Y++].toSource()}return K}let x=F();if(!M())throw B();if(x.some((K)=>typeof K!=="object"||!("simples"in K)))throw new P(`Error while parsing css selector "${w}". Did you mean to CSS.escape it?`);return{selector:x,names:Array.from(Z)}}var p0=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),M1=new Set(["left-of","right-of","above","below","near"]),G1=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 P0(w){let H=B1(w),_=[];for(let X of H.parts){if(X.name==="css"||X.name==="css:light"){if(X.name==="css:light")X.body=":light("+X.body+")";let Y=y0(X.body,G1);_.push({name:"css",body:Y.selector,source:X.body});continue}if(p0.has(X.name)){let Y,Z;try{let Q=JSON.parse("["+X.body+"]");if(!Array.isArray(Q)||Q.length<1||Q.length>2||typeof Q[0]!=="string")throw new P(`Malformed selector: ${X.name}=`+X.body);if(Y=Q[0],Q.length===2){if(typeof Q[1]!=="number"||!M1.has(X.name))throw new P(`Malformed selector: ${X.name}=`+X.body);Z=Q[1]}}catch(Q){throw new P(`Malformed selector: ${X.name}=`+X.body)}let B={name:X.name,source:X.body,body:{parsed:P0(Y),distance:Z}},$=[...B.body.parsed.parts].reverse().find((Q)=>Q.name==="internal:control"&&Q.body==="enter-frame"),G=$?B.body.parsed.parts.indexOf($):-1;if(G!==-1&&Q1(B.body.parsed.parts.slice(0,G+1),_.slice(0,G+1)))B.body.parsed.parts.splice(0,G+1);_.push(B);continue}_.push({...X,source:X.body})}if(p0.has(_[0].name))throw new P(`"${_[0].name}" selector cannot be first`);return{capture:H.capture,parts:_}}function Q1(w,H){return g({parts:w})===g({parts:H})}function g(w,H){if(typeof w==="string")return w;return w.parts.map((_,X)=>{let Y=!0;if(!H&&X!==w.capture){if(_.name==="css")Y=!1;else if(_.name==="xpath"&&_.source.startsWith("//")||_.source.startsWith(".."))Y=!1}let Z=Y?_.name+"=":"";return`${X===w.capture?"*":""}${Z}${_.source}`}).join(" >> ")}function B1(w){let H=0,_,X=0,Y={parts:[]},Z=()=>{let $=w.substring(X,H).trim(),G=$.indexOf("="),Q,O;if(G!==-1&&$.substring(0,G).trim().match(/^[a-zA-Z_0-9-+:*]+$/))Q=$.substring(0,G).trim(),O=$.substring(G+1);else if($.length>1&&$[0]==='"'&&$[$.length-1]==='"')Q="text",O=$;else if($.length>1&&$[0]==="'"&&$[$.length-1]==="'")Q="text",O=$;else if(/^\(*\/\//.test($)||$.startsWith(".."))Q="xpath",O=$;else Q="css",O=$;let U=!1;if(Q[0]==="*")U=!0,Q=Q.substring(1);if(Y.parts.push({name:Q,body:O}),U){if(Y.capture!==void 0)throw new P("Only one of the selectors can capture using * modifier");Y.capture=Y.parts.length-1}};if(!w.includes(">>"))return H=w.length,Z(),Y;let B=()=>{let G=w.substring(X,H).match(/^\s*text\s*=(.*)$/);return!!G&&!!G[1]};while(H<w.length){let $=w[H];if($==="\\"&&H+1<w.length)H+=2;else if($===_)_=void 0,H++;else if(!_&&($==='"'||$==="'"||$==="`")&&!B())_=$,H++;else if(!_&&$===">"&&w[H+1]===">")Z(),H+=2,X=H;else H++}return Z(),Y}function A0(w,H){let _=0,X=w.length===0,Y=()=>w[_]||"",Z=()=>{let M=Y();return++_,X=_>=w.length,M},B=(M)=>{if(X)throw new P(`Unexpected end of selector while parsing selector \`${w}\``);throw new P(`Error while parsing selector \`${w}\` - unexpected symbol "${Y()}" at position ${_}`+(M?" during "+M:""))};function $(){while(!X&&/\s/.test(Y()))Z()}function G(M){return M>=""||M>="0"&&M<="9"||M>="A"&&M<="Z"||M>="a"&&M<="z"||M>="0"&&M<="9"||M==="_"||M==="-"}function Q(){let M="";$();while(!X&&G(Y()))M+=Z();return M}function O(M){let R=Z();if(R!==M)B("parsing quoted string");while(!X&&Y()!==M){if(Y()==="\\")Z();R+=Z()}if(Y()!==M)B("parsing quoted string");return R+=Z(),R}function U(){if(Z()!=="/")B("parsing regular expression");let M="",R=!1;while(!X){if(Y()==="\\"){if(M+=Z(),X)B("parsing regular expression")}else if(R&&Y()==="]")R=!1;else if(!R&&Y()==="[")R=!0;else if(!R&&Y()==="/")break;M+=Z()}if(Z()!=="/")B("parsing regular expression");let I="";while(!X&&Y().match(/[dgimsuy]/))I+=Z();try{return new RegExp(M,I)}catch(F){throw new P(`Error while parsing selector \`${w}\`: ${F.message}`)}}function q(){let M="";if($(),Y()==="'"||Y()==='"')M=O(Y()).slice(1,-1);else M=Q();if(!M)B("parsing property path");return M}function z(){$();let M="";if(!X)M+=Z();if(!X&&M!=="=")M+=Z();if(!["=","*=","^=","$=","|=","~="].includes(M))B("parsing operator");return M}function V(){Z();let M=[];M.push(q()),$();while(Y()===".")Z(),M.push(q()),$();if(Y()==="]")return Z(),{name:M.join("."),jsonPath:M,op:"<truthy>",value:null,caseSensitive:!1};let R=z(),I=void 0,F=!0;if($(),Y()==="/"){if(R!=="=")throw new P(`Error while parsing selector \`${w}\` - cannot use ${R} in attribute with regular expression`);I=U()}else if(Y()==="'"||Y()==='"'){if(I=O(Y()).slice(1,-1),$(),Y()==="i"||Y()==="I")F=!1,Z();else if(Y()==="s"||Y()==="S")F=!0,Z()}else{I="";while(!X&&(G(Y())||Y()==="+"||Y()==="."))I+=Z();if(I==="true")I=!0;else if(I==="false")I=!1;else if(!H){if(I=+I,Number.isNaN(I))B("parsing attribute value")}}if($(),Y()!=="]")B("parsing attribute value");if(Z(),R!=="="&&typeof I!=="string")throw new P(`Error while parsing selector \`${w}\` - cannot use ${R} in attribute with non-string matching value - ${I}`);return{name:M.join("."),jsonPath:M,op:R,value:I,caseSensitive:F}}let N={name:"",attributes:[]};N.name=Q(),$();while(Y()==="[")N.attributes.push(V()),$();if(!X)B(void 0);if(!N.name&&!N.attributes.length)throw new P(`Error while parsing selector \`${w}\` - selector cannot be empty`);return N}function a(w,H="'"){let _=JSON.stringify(w),X=_.substring(1,_.length-1).replace(/\\"/g,'"');if(H==="'")return H+X.replace(/[']/g,"\\'")+H;if(H==='"')return H+X.replace(/["]/g,"\\\"")+H;if(H==="`")return H+X.replace(/[`]/g,"\\`")+H;throw Error("Invalid escape char")}function s(w){return w.charAt(0).toUpperCase()+w.substring(1)}function v0(w){return w.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function r(w){return w.replace(/(^|[^\\])(\\\\)*\\(['"`])/g,"$1$2$3")}var j1=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 u0(w,H,_=!1){return V1(w,H,_,1)[0]}function V1(w,H,_=!1,X=20,Y){try{return d(new N1[w](Y),P0(H),_,X)}catch(Z){return[H]}}function d(w,H,_=!1,X=20){let Y=[...H.parts],Z=[],B=_?"frame-locator":"page";for(let $=0;$<Y.length;$++){let G=Y[$],Q=B;if(B="locator",G.name==="internal:describe")continue;if(G.name==="nth"){if(G.body==="0")Z.push([w.generateLocator(Q,"first",""),w.generateLocator(Q,"nth","0")]);else if(G.body==="-1")Z.push([w.generateLocator(Q,"last",""),w.generateLocator(Q,"nth","-1")]);else Z.push([w.generateLocator(Q,"nth",G.body)]);continue}if(G.name==="visible"){Z.push([w.generateLocator(Q,"visible",G.body),w.generateLocator(Q,"default",`visible=${G.body}`)]);continue}if(G.name==="internal:text"){let{exact:V,text:N}=o(G.body);Z.push([w.generateLocator(Q,"text",N,{exact:V})]);continue}if(G.name==="internal:has-text"){let{exact:V,text:N}=o(G.body);if(!V){Z.push([w.generateLocator(Q,"has-text",N,{exact:V})]);continue}}if(G.name==="internal:has-not-text"){let{exact:V,text:N}=o(G.body);if(!V){Z.push([w.generateLocator(Q,"has-not-text",N,{exact:V})]);continue}}if(G.name==="internal:has"){let V=d(w,G.body.parsed,!1,X);Z.push(V.map((N)=>w.generateLocator(Q,"has",N)));continue}if(G.name==="internal:has-not"){let V=d(w,G.body.parsed,!1,X);Z.push(V.map((N)=>w.generateLocator(Q,"hasNot",N)));continue}if(G.name==="internal:and"){let V=d(w,G.body.parsed,!1,X);Z.push(V.map((N)=>w.generateLocator(Q,"and",N)));continue}if(G.name==="internal:or"){let V=d(w,G.body.parsed,!1,X);Z.push(V.map((N)=>w.generateLocator(Q,"or",N)));continue}if(G.name==="internal:chain"){let V=d(w,G.body.parsed,!1,X);Z.push(V.map((N)=>w.generateLocator(Q,"chain",N)));continue}if(G.name==="internal:label"){let{exact:V,text:N}=o(G.body);Z.push([w.generateLocator(Q,"label",N,{exact:V})]);continue}if(G.name==="internal:role"){let V=A0(G.body,!0),N={attrs:[]};for(let M of V.attributes)if(M.name==="name")N.exact=M.caseSensitive,N.name=M.value;else{if(M.name==="level"&&typeof M.value==="string")M.value=+M.value;N.attrs.push({name:M.name==="include-hidden"?"includeHidden":M.name,value:M.value})}Z.push([w.generateLocator(Q,"role",V.name,N)]);continue}if(G.name==="internal:testid"){let V=A0(G.body,!0),{value:N}=V.attributes[0];Z.push([w.generateLocator(Q,"test-id",N)]);continue}if(G.name==="internal:attr"){let V=A0(G.body,!0),{name:N,value:M,caseSensitive:R}=V.attributes[0],I=M,F=!!R;if(N==="placeholder"){Z.push([w.generateLocator(Q,"placeholder",I,{exact:F})]);continue}if(N==="alt"){Z.push([w.generateLocator(Q,"alt",I,{exact:F})]);continue}if(N==="title"){Z.push([w.generateLocator(Q,"title",I,{exact:F})]);continue}}if(G.name==="internal:control"&&G.body==="enter-frame"){let V=Z[Z.length-1],N=Y[$-1],M=V.map((R)=>w.chainLocators([R,w.generateLocator(Q,"frame","")]));if(["xpath","css"].includes(N.name))M.push(w.generateLocator(Q,"frame-locator",g({parts:[N]})),w.generateLocator(Q,"frame-locator",g({parts:[N]},!0)));V.splice(0,V.length,...M),B="frame-locator";continue}let O=Y[$+1],U=g({parts:[G]}),q=w.generateLocator(Q,"default",U);if(O&&["internal:has-text","internal:has-not-text"].includes(O.name)){let{exact:V,text:N}=o(O.body);if(!V){let M=w.generateLocator("locator",O.name==="internal:has-text"?"has-text":"has-not-text",N,{exact:V}),R={};if(O.name==="internal:has-text")R.hasText=N;else R.hasNotText=N;let I=w.generateLocator(Q,"default",U,R);Z.push([w.chainLocators([q,M]),I]),$++;continue}}let z;if(["xpath","css"].includes(G.name)){let V=g({parts:[G]},!0);z=w.generateLocator(Q,"default",V)}Z.push([q,z].filter(Boolean))}return q1(w,Z,X)}function q1(w,H,_){let X=H.map(()=>""),Y=[],Z=(B)=>{if(B===H.length)return Y.push(w.chainLocators(X)),Y.length<_;for(let $ of H[B])if(X[B]=$,!Z(B+1))return!1;return!0};return Z(0),Y}function o(w){let H=!1,_=w.match(/^\/(.*)\/([igm]*)$/);if(_)return{text:new RegExp(_[1],_[2])};if(w.endsWith('"'))w=JSON.parse(w),H=!0;else if(w.endsWith('"s'))w=JSON.parse(w.substring(0,w.length-1)),H=!0;else if(w.endsWith('"i'))w=JSON.parse(w.substring(0,w.length-1)),H=!1;return{exact:H,text:w}}class d0{preferredQuote;constructor(w){this.preferredQuote=w}generateLocator(w,H,_,X={}){switch(H){case"default":if(X.hasText!==void 0)return`locator(${this.quote(_)}, { hasText: ${this.toHasText(X.hasText)} })`;if(X.hasNotText!==void 0)return`locator(${this.quote(_)}, { hasNotText: ${this.toHasText(X.hasNotText)} })`;return`locator(${this.quote(_)})`;case"frame-locator":return`frameLocator(${this.quote(_)})`;case"frame":return"contentFrame()";case"nth":return`nth(${_})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter({ visible: ${_==="true"?"true":"false"} })`;case"role":let Y=[];if(v(X.name))Y.push(`name: ${this.regexToSourceString(X.name)}`);else if(typeof X.name==="string"){if(Y.push(`name: ${this.quote(X.name)}`),X.exact)Y.push("exact: true")}for(let{name:B,value:$}of X.attrs)Y.push(`${B}: ${typeof $==="string"?this.quote($):$}`);let Z=Y.length?`, { ${Y.join(", ")} }`:"";return`getByRole(${this.quote(_)}${Z})`;case"has-text":return`filter({ hasText: ${this.toHasText(_)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(_)} })`;case"has":return`filter({ has: ${_} })`;case"hasNot":return`filter({ hasNot: ${_} })`;case"and":return`and(${_})`;case"or":return`or(${_})`;case"chain":return`locator(${_})`;case"test-id":return`getByTestId(${this.toTestIdValue(_)})`;case"text":return this.toCallWithExact("getByText",_,!!X.exact);case"alt":return this.toCallWithExact("getByAltText",_,!!X.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",_,!!X.exact);case"label":return this.toCallWithExact("getByLabel",_,!!X.exact);case"title":return this.toCallWithExact("getByTitle",_,!!X.exact);default:throw Error("Unknown selector kind "+H)}}chainLocators(w){return w.join(".")}regexToSourceString(w){return r(String(w))}toCallWithExact(w,H,_){if(v(H))return`${w}(${this.regexToSourceString(H)})`;return _?`${w}(${this.quote(H)}, { exact: true })`:`${w}(${this.quote(H)})`}toHasText(w){if(v(w))return this.regexToSourceString(w);return this.quote(w)}toTestIdValue(w){if(v(w))return this.regexToSourceString(w);return this.quote(w)}quote(w){return a(w,this.preferredQuote??"'")}}class i0{generateLocator(w,H,_,X={}){switch(H){case"default":if(X.hasText!==void 0)return`locator(${this.quote(_)}, has_text=${this.toHasText(X.hasText)})`;if(X.hasNotText!==void 0)return`locator(${this.quote(_)}, has_not_text=${this.toHasText(X.hasNotText)})`;return`locator(${this.quote(_)})`;case"frame-locator":return`frame_locator(${this.quote(_)})`;case"frame":return"content_frame";case"nth":return`nth(${_})`;case"first":return"first";case"last":return"last";case"visible":return`filter(visible=${_==="true"?"True":"False"})`;case"role":let Y=[];if(v(X.name))Y.push(`name=${this.regexToString(X.name)}`);else if(typeof X.name==="string"){if(Y.push(`name=${this.quote(X.name)}`),X.exact)Y.push("exact=True")}for(let{name:B,value:$}of X.attrs){let G=typeof $==="string"?this.quote($):$;if(typeof $==="boolean")G=$?"True":"False";Y.push(`${v0(B)}=${G}`)}let Z=Y.length?`, ${Y.join(", ")}`:"";return`get_by_role(${this.quote(_)}${Z})`;case"has-text":return`filter(has_text=${this.toHasText(_)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(_)})`;case"has":return`filter(has=${_})`;case"hasNot":return`filter(has_not=${_})`;case"and":return`and_(${_})`;case"or":return`or_(${_})`;case"chain":return`locator(${_})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(_)})`;case"text":return this.toCallWithExact("get_by_text",_,!!X.exact);case"alt":return this.toCallWithExact("get_by_alt_text",_,!!X.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",_,!!X.exact);case"label":return this.toCallWithExact("get_by_label",_,!!X.exact);case"title":return this.toCallWithExact("get_by_title",_,!!X.exact);default:throw Error("Unknown selector kind "+H)}}chainLocators(w){return w.join(".")}regexToString(w){let H=w.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${r(w.source).replace(/\\\//,"/").replace(/"/g,"\\\"")}"${H})`}toCallWithExact(w,H,_){if(v(H))return`${w}(${this.regexToString(H)})`;if(_)return`${w}(${this.quote(H)}, exact=True)`;return`${w}(${this.quote(H)})`}toHasText(w){if(v(w))return this.regexToString(w);return`${this.quote(w)}`}toTestIdValue(w){if(v(w))return this.regexToString(w);return this.quote(w)}quote(w){return a(w,'"')}}class c0{generateLocator(w,H,_,X={}){let Y;switch(w){case"page":Y="Page";break;case"frame-locator":Y="FrameLocator";break;case"locator":Y="Locator";break}switch(H){case"default":if(X.hasText!==void 0)return`locator(${this.quote(_)}, new ${Y}.LocatorOptions().setHasText(${this.toHasText(X.hasText)}))`;if(X.hasNotText!==void 0)return`locator(${this.quote(_)}, new ${Y}.LocatorOptions().setHasNotText(${this.toHasText(X.hasNotText)}))`;return`locator(${this.quote(_)})`;case"frame-locator":return`frameLocator(${this.quote(_)})`;case"frame":return"contentFrame()";case"nth":return`nth(${_})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter(new ${Y}.FilterOptions().setVisible(${_==="true"?"true":"false"}))`;case"role":let Z=[];if(v(X.name))Z.push(`.setName(${this.regexToString(X.name)})`);else if(typeof X.name==="string"){if(Z.push(`.setName(${this.quote(X.name)})`),X.exact)Z.push(".setExact(true)")}for(let{name:$,value:G}of X.attrs)Z.push(`.set${s($)}(${typeof G==="string"?this.quote(G):G})`);let B=Z.length?`, new ${Y}.GetByRoleOptions()${Z.join("")}`:"";return`getByRole(AriaRole.${v0(_).toUpperCase()}${B})`;case"has-text":return`filter(new ${Y}.FilterOptions().setHasText(${this.toHasText(_)}))`;case"has-not-text":return`filter(new ${Y}.FilterOptions().setHasNotText(${this.toHasText(_)}))`;case"has":return`filter(new ${Y}.FilterOptions().setHas(${_}))`;case"hasNot":return`filter(new ${Y}.FilterOptions().setHasNot(${_}))`;case"and":return`and(${_})`;case"or":return`or(${_})`;case"chain":return`locator(${_})`;case"test-id":return`getByTestId(${this.toTestIdValue(_)})`;case"text":return this.toCallWithExact(Y,"getByText",_,!!X.exact);case"alt":return this.toCallWithExact(Y,"getByAltText",_,!!X.exact);case"placeholder":return this.toCallWithExact(Y,"getByPlaceholder",_,!!X.exact);case"label":return this.toCallWithExact(Y,"getByLabel",_,!!X.exact);case"title":return this.toCallWithExact(Y,"getByTitle",_,!!X.exact);default:throw Error("Unknown selector kind "+H)}}chainLocators(w){return w.join(".")}regexToString(w){let H=w.flags.includes("i")?", Pattern.CASE_INSENSITIVE":"";return`Pattern.compile(${this.quote(r(w.source))}${H})`}toCallWithExact(w,H,_,X){if(v(_))return`${H}(${this.regexToString(_)})`;if(X)return`${H}(${this.quote(_)}, new ${w}.${s(H)}Options().setExact(true))`;return`${H}(${this.quote(_)})`}toHasText(w){if(v(w))return this.regexToString(w);return this.quote(w)}toTestIdValue(w){if(v(w))return this.regexToString(w);return this.quote(w)}quote(w){return a(w,'"')}}class n0{generateLocator(w,H,_,X={}){switch(H){case"default":if(X.hasText!==void 0)return`Locator(${this.quote(_)}, new() { ${this.toHasText(X.hasText)} })`;if(X.hasNotText!==void 0)return`Locator(${this.quote(_)}, new() { ${this.toHasNotText(X.hasNotText)} })`;return`Locator(${this.quote(_)})`;case"frame-locator":return`FrameLocator(${this.quote(_)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${_})`;case"first":return"First";case"last":return"Last";case"visible":return`Filter(new() { Visible = ${_==="true"?"true":"false"} })`;case"role":let Y=[];if(v(X.name))Y.push(`NameRegex = ${this.regexToString(X.name)}`);else if(typeof X.name==="string"){if(Y.push(`Name = ${this.quote(X.name)}`),X.exact)Y.push("Exact = true")}for(let{name:B,value:$}of X.attrs)Y.push(`${s(B)} = ${typeof $==="string"?this.quote($):$}`);let Z=Y.length?`, new() { ${Y.join(", ")} }`:"";return`GetByRole(AriaRole.${s(_)}${Z})`;case"has-text":return`Filter(new() { ${this.toHasText(_)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(_)} })`;case"has":return`Filter(new() { Has = ${_} })`;case"hasNot":return`Filter(new() { HasNot = ${_} })`;case"and":return`And(${_})`;case"or":return`Or(${_})`;case"chain":return`Locator(${_})`;case"test-id":return`GetByTestId(${this.toTestIdValue(_)})`;case"text":return this.toCallWithExact("GetByText",_,!!X.exact);case"alt":return this.toCallWithExact("GetByAltText",_,!!X.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",_,!!X.exact);case"label":return this.toCallWithExact("GetByLabel",_,!!X.exact);case"title":return this.toCallWithExact("GetByTitle",_,!!X.exact);default:throw Error("Unknown selector kind "+H)}}chainLocators(w){return w.join(".")}regexToString(w){let H=w.flags.includes("i")?", RegexOptions.IgnoreCase":"";return`new Regex(${this.quote(r(w.source))}${H})`}toCallWithExact(w,H,_){if(v(H))return`${w}(${this.regexToString(H)})`;if(_)return`${w}(${this.quote(H)}, new() { Exact = true })`;return`${w}(${this.quote(H)})`}toHasText(w){if(v(w))return`HasTextRegex = ${this.regexToString(w)}`;return`HasText = ${this.quote(w)}`}toTestIdValue(w){if(v(w))return this.regexToString(w);return this.quote(w)}toHasNotText(w){if(v(w))return`HasNotTextRegex = ${this.regexToString(w)}`;return`HasNotText = ${this.quote(w)}`}quote(w){return a(w,'"')}}class a0{generateLocator(w,H,_,X={}){return JSON.stringify({kind:H,body:_,options:X})}chainLocators(w){let H=w.map((_)=>JSON.parse(_));for(let _=0;_<H.length-1;++_)H[_].next=H[_+1];return JSON.stringify(H[0])}}var N1={javascript:d0,python:i0,java:c0,csharp:n0,jsonl:a0};function v(w){return w instanceof RegExp}var E0=`/**
* 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 t{_glassPaneElement;_glassPaneShadow;_renderedEntries=[];_actionPointElement;_titleElement;_userOverlayContainer;_userOverlays=new Map;_userOverlayHidden=!1;_isUnderTest;_injectedScript;_rafRequest;_language="javascript";_elementHighlightSelectors=new Map;constructor(w){this._injectedScript=w;let H=w.document;if(this._isUnderTest=w.isUnderTest,this._glassPaneElement=H.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=H.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._titleElement=H.createElement("x-pw-title"),this._titleElement.setAttribute("hidden","true"),this._userOverlayContainer=H.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 _=new this._injectedScript.window.CSSStyleSheet;_.replaceSync(E0),this._glassPaneShadow.adoptedStyleSheets.push(_)}else{let _=this._injectedScript.document.createElement("style");_.textContent=E0,this._glassPaneShadow.appendChild(_)}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(w){this._language=w}addElementHighlight(w,H){let _=g(w);this._elementHighlightSelectors.set(_,{selector:w,cssStyle:H}),this._ensureElementHighlightRaf()}removeElementHighlight(w){let H=g(w);if(!this._elementHighlightSelectors.delete(H))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 w=()=>{let H=[];for(let{selector:_,cssStyle:X}of this._elementHighlightSelectors.values()){let Y=this._injectedScript.querySelectorAll(_,this._injectedScript.document.documentElement),Z=u0(this._language,g(_)),B=Y.length>1?"#f6b26b7f":"#6fa8dc7f";for(let $=0;$<Y.length;++$){let G=Y.length>1?` [${$+1} of ${Y.length}]`:"";H.push({element:Y[$],color:B,tooltipText:Z+G,cssStyle:X})}}this.updateHighlight(H),this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(w)};this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(w)}uninstall(){if(this._rafRequest)this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0;this._elementHighlightSelectors.clear(),this._glassPaneElement.remove()}showActionPoint(w,H,_){if(this._actionPointElement.style.top=H+"px",this._actionPointElement.style.left=w+"px",this._actionPointElement.hidden=!1,_)this._actionPointElement.style.animation=`pw-fade-out ${_}ms ease-out forwards`;else this._actionPointElement.style.animation=""}hideActionPoint(){this._actionPointElement.hidden=!0}showActionTitle(w,H,_,X){if(this._titleElement.textContent=w,this._titleElement.hidden=!1,H){let Y=H/4;this._titleElement.style.animation=`pw-fade-out ${Y}ms ease-out ${H-Y}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="",_){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(X)this._titleElement.style.fontSize=X+"px"}hideActionTitle(){this._titleElement.hidden=!0}addUserOverlay(w,H){let _=this._injectedScript.document.createElement("div");_.className="x-pw-user-overlay",_.innerHTML=H;for(let X of _.querySelectorAll("script"))X.remove();for(let X of _.querySelectorAll("*"))for(let Y of[...X.attributes])if(Y.name.startsWith("on"))X.removeAttribute(Y.name);return this._userOverlays.set(w,_),this._userOverlayContainer.appendChild(_),this._userOverlayContainer.hidden=this._userOverlayHidden,w}getUserOverlay(w){return this._userOverlays.get(w)}removeUserOverlay(w){let H=this._userOverlays.get(w);if(H)H.remove(),this._userOverlays.delete(w);if(this._userOverlays.size===0)this._userOverlayContainer.hidden=!0}setUserOverlaysVisible(w){this._userOverlayHidden=!w,this._userOverlayContainer.hidden=!w||this._userOverlays.size===0}clearHighlight(){for(let w of this._renderedEntries)w.highlightElement?.remove(),w.tooltipElement?.remove();this._renderedEntries=[]}maskElements(w,H){this.updateHighlight(w.map((_)=>({element:_,color:H})))}updateHighlight(w){if(this._highlightIsUpToDate(w))return;this.clearHighlight();for(let H of w){let _=this._createHighlightElement();this._glassPaneShadow.appendChild(_);let X;if(H.tooltipText){X=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(X),X.style.top="0",X.style.left="0",X.style.display="flex";let Y=this._injectedScript.document.createElement("x-pw-tooltip-line");Y.textContent=H.tooltipText,X.appendChild(Y)}this._renderedEntries.push({targetElement:H.element,box:s0(H.box),color:H.color,borderColor:H.borderColor,fadeDuration:H.fadeDuration,cssStyle:H.cssStyle,tooltipElement:X,highlightElement:_})}for(let H of this._renderedEntries){if(!H.box&&!H.targetElement)continue;if(H.box=H.box||H.targetElement.getBoundingClientRect(),!H.tooltipElement)continue;let{anchorLeft:_,anchorTop:X}=this.tooltipPosition(H.box,H.tooltipElement);H.tooltipTop=X,H.tooltipLeft=_}for(let H of this._renderedEntries){if(H.tooltipElement)H.tooltipElement.style.top=H.tooltipTop+"px",H.tooltipElement.style.left=H.tooltipLeft+"px";let _=H.box;if(H.highlightElement.style.backgroundColor=H.color,H.highlightElement.style.left=_.x+"px",H.highlightElement.style.top=_.y+"px",H.highlightElement.style.width=_.width+"px",H.highlightElement.style.height=_.height+"px",H.highlightElement.style.display="block",H.borderColor)H.highlightElement.style.border="2px solid "+H.borderColor;if(H.fadeDuration)H.highlightElement.style.animation=`pw-fade-out ${H.fadeDuration}ms ease-out forwards`;if(H.cssStyle)H.highlightElement.style.cssText+=";"+H.cssStyle;if(this._isUnderTest)console.error("Highlight box for test: "+JSON.stringify({x:_.x,y:_.y,width:_.width,height:_.height}))}}firstBox(){return this._renderedEntries[0]?.box}firstTooltipBox(){let w=this._renderedEntries[0];if(!w||!w.tooltipElement||w.tooltipLeft===void 0||w.tooltipTop===void 0)return;return{x:w.tooltipLeft,y:w.tooltipTop,left:w.tooltipLeft,top:w.tooltipTop,width:w.tooltipElement.offsetWidth,height:w.tooltipElement.offsetHeight,bottom:w.tooltipTop+w.tooltipElement.offsetHeight,right:w.tooltipLeft+w.tooltipElement.offsetWidth,toJSON:()=>{}}}tooltipPosition(w,H){let{offsetWidth:_,offsetHeight:X}=H,Y=this._glassPaneElement.offsetWidth,Z=this._glassPaneElement.offsetHeight,B=Math.max(5,w.left);if(B+_>Y-5)B=Y-_-5;let $=Math.max(0,w.bottom)+5;if($+X>Z-5)if(Math.max(0,w.top)>X+5)$=Math.max(0,w.top)-X-5;else $=Z-5-X;return{anchorLeft:B,anchorTop:$}}_highlightIsUpToDate(w){if(w.length!==this._renderedEntries.length)return!1;for(let H=0;H<this._renderedEntries.length;++H){if(w[H].element!==this._renderedEntries[H].targetElement)return!1;if(w[H].color!==this._renderedEntries[H].color)return!1;if(w[H].cssStyle!==this._renderedEntries[H].cssStyle)return!1;let _=this._renderedEntries[H].box;if(!_)return!1;let X=w[H].box?s0(w[H].box):w[H].element.getBoundingClientRect();if(X.top!==_.top||X.right!==_.right||X.bottom!==_.bottom||X.left!==_.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(w){this._glassPaneShadow.appendChild(w)}onGlassPaneClick(w){this._glassPaneElement.style.pointerEvents="auto",this._glassPaneElement.style.backgroundColor="rgba(0, 0, 0, 0.3)",this._glassPaneElement.addEventListener("click",w)}offGlassPaneClick(w){this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.backgroundColor="transparent",this._glassPaneElement.removeEventListener("click",w)}}function s0(w){if(!w)return;return new DOMRect(w.x,w.y,w.width,w.height)}(()=>{let w=window.__fd,H=w?._injected;if(!w||!H||w.__recorderSupport)return;w.__recorderSupport=!0;let _;H.createHighlight=()=>new t(H),H.hideHighlight=()=>{if(_)_.uninstall(),_=void 0},H.addHighlight=(X,Y)=>{_??=new t(H),_.install(),_.addElementHighlight(X,Y)},H.removeHighlight=(X)=>{_??=new t(H),_.install(),_.removeElementHighlight(X)}})();})();