Professional Documents
Culture Documents
t) => {
/*!
* This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets),
* Copyright (C) 2006-present eyeo GmbH
*
* @eyeo/snippets is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* @eyeo/snippets is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with @eyeo/snippets. If not, see <http://www.gnu.org/licenses/>.
*/
((environment, ...filters) => {
const e=Proxy,
{apply:t,bind:n,call:o}=Function,r=o.bind(t),i=o.bind(n),s=o.bind(o),a={get:
(e,t)=>i(o,e[t])},c=t=>new e(t,a),l={get:(e,t)=>i(e[t],e)},u=t=>new e(t,l),
{assign:d,defineProperties:h,freeze:f,getOwnPropertyDescriptor:p,getOwnPropertyDesc
riptors:w,getPrototypeOf:g}=u(Object),{hasOwnProperty:m}=c({}),
{species:b}=Symbol,y={get(e,t){const n=e[t];class o extends n{}const
r=w(n.prototype);delete r.constructor,f(h(o.prototype,r));const i=w(n);return
delete i.length,delete i.prototype,i[b]={value:o},f(h(o,i))}},v=t=>new
e(t,y),S="undefined"!=typeof environment?environment:{};"undefined"==typeof
globalThis&&(window.globalThis=window);const{apply:k,ownKeys:E}=u(Reflect),M="world
"in S,x=M&&"ISOLATED"===S.world,C=M&&"MAIN"===S.world,T="object"==typeof chrome&&!!
chrome.runtime,W="object"==typeof browser&&!!browser.runtime,L=!C&&(x||T||
W),O=e=>L?e:P(e,R(e)),
{create:P,defineProperties:D,defineProperty:N,freeze:I,getOwnPropertyDescriptor:A,g
etOwnPropertyDescriptors:R}=u(Object),V=u(globalThis),$=L?globalThis:v(globalThis),
{Map:H,RegExp:j,Set:F,WeakMap:_,WeakSet:q}=$,B=(e,t,n=null)=>{const
o=E(t);for(const r of E(e)){if(o.includes(r))continue;const
i=A(e,r);if(n&&"value"in i){const{value:e}=i;"function"==typeof
e&&(i.value=n(e))}N(t,r,i)}},z=e=>{const t=$[e];class n extends
t{}const{toString:o,valueOf:r}=t.prototype;D(n.prototype,{toString:
{value:o},valueOf:{value:r}});const i=e.toLowerCase(),s=e=>function(){const
t=k(e,this,arguments);return typeof t===i?new n(t):t};return
B(t,n,s),B(t.prototype,n.prototype,s),n},X=I({frozen:new _,hidden:new
q,iframePropertiesToAbort:{read:new F,write:new F},abortedIframes:new _}),J=new
j("^[A-Z]");var U=new Proxy(new H([["chrome",L&&(T&&chrome||W&&browser)||void 0],
["isExtensionContext",L],["variables",X],["console",O(console)],
["document",globalThis.document],["performance",O(performance)],["JSON",O(JSON)],
["Map",H],["Math",O(Math)],["Number",L?Number:z("Number")],["RegExp",j],["Set",F],
["String",L?String:z("String")],["WeakMap",_],["WeakSet",q],
["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let
n=globalThis[t];return"function"==typeof n&&(n=(J.test(t)?$:V)
[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const
G={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},
{apply:K}=Reflect;const{Map:Q,WeakMap:Y,WeakSet:Z,setTimeout:ee}=U;let te=!
0,ne=e=>{e.clear(),te=!te};var oe=function(e)
{const{WeakSet:t,WeakMap:n,WeakValue:o}=this||G,r=new t,i=new n,s=new o;return
function(t){if(r.has(t))return t;if(i.has(t))return i.get(t);if(s.has(t))return
s.get(t);const n=K(e,this,arguments);return r.add(n),n!==t&&("object"==typeof t&&t?
i:s).set(t,n),n}}.bind({WeakMap:Y,WeakSet:Z,WeakValue:class extends Q{set(e,t)
{return te&&(te=!
te,ee(ne,0,this)),super.set(e,t)}}});const{concat:re,includes:ie,join:se,reduce:ae,
unshift:ce}=c([]),le=v(globalThis),{Map:ue,WeakMap:de}=le,he=new ue,fe=t=>{const
n=(e=>{const t=[];let n=e;for(;n;){if(he.has(n))ce(t,he.get(n));else{const
e=w(n);he.set(n,e),ce(t,e)}n=g(n)}return ce(t,{}),r(d,null,t)})("function"==typeof
t?t.prototype:t),o={get(e,t){if(t in n){const{value:o,get:r}=n[t];if(r)return
s(r,e);if("function"==typeof o)return i(o,e)}return e[t]},set(e,t,o){if(t in n)
{const{set:r}=n[t];if(r)return s(r,e,o),!0}return e[t]=o,!0}};return t=>new
e(t,o)},{isExtensionContext:pe,Array:we,Number:ge,String:me,Object:be}=U,
{isArray:ye}=we,{getOwnPropertyDescriptor:ve,setPrototypeOf:Se}=be,
{toString:ke}=be.prototype,{slice:Ee}=me.prototype,
{get:Me}=ve(Node.prototype,"nodeType"),xe=pe?{}:
{Attr:fe(Attr),CanvasRenderingContext2D:fe(CanvasRenderingContext2D),CSSStyleDeclar
ation:fe(CSSStyleDeclaration),Document:fe(Document),Element:fe(Element),HTMLCanvasE
lement:fe(HTMLCanvasElement),HTMLElement:fe(HTMLElement),HTMLImageElement:fe(HTMLIm
ageElement),HTMLScriptElement:fe(HTMLScriptElement),MutationRecord:fe(MutationRecor
d),Node:fe(Node),ShadowRoot:fe(ShadowRoot),get CSS2Properties(){return
xe.CSSStyleDeclaration}},Ce=(e,t)=>{if("Element"!==t&&t in xe)return xe[t]
(e);if(ye(e))return Se(e,we.prototype);const n=(e=>s(Ee,s(ke,e),8,-1))(e);if(n in
xe)return xe[n](e);if(n in U)return Se(e,U[n].prototype);if("nodeType"in
e)switch(s(Me,e)){case 1:if(!(t in xe))throw new Error("unknown hint "+t);return
xe[t](e);case 2:return xe.Attr(e);case 3:return xe.Node(e);case 9:return
xe.Document(e)}throw new Error("unknown brand "+n)};var Te=pe?e=>e===window||
e===globalThis?U:e:oe(((e,t="Element")=>{if(e===window||e===globalThis)return
U;switch(typeof e){case"object":return e&&Ce(e,t);case"string":return new
me(e);case"number":return new ge(e);default:throw new Error("unsupported
value")}}));let{document:We,getComputedStyle:Le,isExtensionContext:Oe,variables:Pe,
Array:De,MutationObserver:Ne,Object:Ie,XPathEvaluator:Ae,XPathExpression:Re,XPathRe
sult:Ve}=Te(window),{querySelectorAll:
$e}=We,He=$e&&i($e,We);const{assign:je,setPrototypeOf:Fe}=Ie;class _e extends
Re{evaluate(...e){return Fe(r(super.evaluate,this,e),Ve.prototype)}}class qe
extends Ae{createExpression(...e){return
Fe(r(super.createExpression,this,e),_e.prototype)}}function Be(e)
{if(Pe.hidden.has(e))return!1;!function(e){Oe&&"function"==typeof
checkElement&&checkElement(e)}
(e),Pe.hidden.add(e);let{style:t}=Te(e),n=Te(t,"CSSStyleDeclaration"),o=Te([]),
{debugCSSProperties:r}=S;for(let[e,t]of r||
[["display","none"]])n.setProperty(e,t,"important"),o.push([e,n.getPropertyValue(e)
]);return new Ne((()=>{for(let[e,t]of o){let
o=n.getPropertyValue(e),r=n.getPropertyPriority(e);o==t&&"important"==r||
n.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:
["style"]}),!0}function ze(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")"))
{let e=t.slice(6,-1),n=(new
qe).createExpression(e,null),o=Ve.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!
e)return;let t=n.evaluate(We,o,null),{snapshotLength:r}=t;for(let n=0;n<r;n+
+)e(t.snapshotItem(n))}}return t=>He(e).forEach(t)}function Xe(e,t,n,o){let
r;null==n&&(n=t);const i=()=>{for(const i of He(n)){const
n=Te(i).closest(t);n&&e(i,n)&&(r(),Be(n)&&"function"==typeof o&&o(n))}};return
je(new Ne(i),{race(e){r=e,this.observe(We,{childList:!0,characterData:!0,subtree:!
0}),i()}})}function Je(e,t,n){let
o=Te(t,"CSSStyleDeclaration");if("none"==o.getPropertyValue("display"))return!1;let
r=o.getPropertyValue("visibility");if("hidden"==r||"collapse"==r)return!1;if(!n||
e==n)return!0;let i=Te(e).parentElement;return!i||Je(i,Le(i),n)}function Ue(e){let
t=Le(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return
Te(n).trim()}let{Math:Ge,RegExp:Ke}=Te(window);function Qe(e)
{let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||
t>2&&Te(e).endsWith("/i")){let t=[Te(e).slice(1,n?-1:-2)];return n||t.push("i"),new
Ke(...t)}}return new Ke(Te(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}let Ye=!
1;function Ze(){return Ye}const{console:et}=Te(window),tt=()=>{};function nt(...e)
{Ze()&&Te(e).unshift("%c DEBUG","font-weight: bold"),et.log(...e)}function ot(e)
{return i(Ze()?
nt:tt,null,e)}let{Array:rt,Error:it,Map:st,parseInt:at}=Te(window),ct=null,lt=null;
function ut(e,t){if(null===ct)return tt;let n=ct,{participants:o}=n;return
o.set(r,t),r;function r(){if(n.winners<1)return;if(ot("race")(`${e} won the
race`),n===ct)lt.push(r);else if(o.delete(r),--n.winners<1){for(let e of
o.values())e();o.clear()}}}const dt={get(e,t){const n=e;for(;!
m(e,t);)e=g(e);const{get:o,set:i}=p(e,t);return function(){return arguments.length?
r(i,n,arguments):s(o,n)}}};var ht;function ft(e,t,n){var o,r;n?"load"===n?
(e("Waiting until window.load"),window.addEventListener("load",(()=>{e("Window.load
fired."),t()}))):"loading"===n||"interactive"===n||"complete"===n?(e("Waiting
document state until :",n),document.addEventListener("readystatechange",
(()=>{e("Document state
changed:",document.readyState),document.readyState===n&&t()}))):(e("Waiting until
",n," event is triggered on document"),(o=document,r=n,new Promise((e=>{const
t=()=>{o.removeEventListener(r,t),e()};o.addEventListener(r,t)}))).then((()=>{e(n,"
is triggered on document, starting the snippet"),t()})).catch((t=>{e("There was an
error while waiting for the event.",t)}))):t()}Te(window),ht=window,new
e(ht,dt),Te(/^\d+
$/);let{MutationObserver:pt,WeakSet:wt,getComputedStyle:gt}=Te(window);let{clearTim
eout:mt,fetch:bt,getComputedStyle:yt,setTimeout:vt,Map:St,MutationObserver:kt,Uint8
Array:Et}=Te(window);let Mt=new St;function xt(e,
{as:t="arrayBuffer",cleanup:n=6e4}={}){let o=t+":"+e,r=Mt.get(o)||{remove:
()=>Mt.delete(o),result:null,timer:0};return
mt(r.timer),r.timer=vt(r.remove,n),r.result||(r.result=bt(e).then((e=>e[t]
())).catch(r.remove),Mt.set(o,r)),r.result}function Ct(e){return
e.reduce(((e,t)=>e+function(e,t=2){let n=Te(e).toString(16);return
n.length<t&&(n=Te("0").repeat(t-n.length)+n),n}
(t)),"")}const{parseFloat:Tt,Math:Wt,MutationObserver:Lt,WeakSet:Ot}=Te(window),
{min:Pt}=Wt,Dt=(e,t)=>{const n=e.length+1,o=t.length+1,r=[[0]];let i=0,s=0;for(;+
+i<o;)r[0][i]=i;for(i=0;++i<n;){const n=e[s];let a=0,c=0;for(r[i]=[i];++a<o;)r[i]
[a]=Pt(r[s][a]+1,r[i][c]+1,r[s][c]+(n!=t[c])),++c;++s}return r[n-1][o-
1]};let{getComputedStyle:Nt,Map:It,WeakSet:At,parseFloat:Rt}=Te(window);const{ELEME
NT_NODE:Vt,TEXT_NODE:
$t}=Node;let{MutationObserver:Ht,WeakSet:jt,getComputedStyle:Ft}=Te(window);let{get
ComputedStyle:_t,MutationObserver:qt,WeakSet:Bt}=Te(window);Te(window);const
zt={mark(){},end(){},toString:()=>"{mark(){},end(){}}"};function Xt(e,t=10){return
zt}let{MutationObserver:Jt,WeakSet:Ut}=Te(window);const{ELEMENT_NODE:Gt}=Node;let{M
utationObserver:Kt,WeakSet:Qt}=Te(window);const{ELEMENT_NODE:Yt}=Node;let{parseInt:
Zt,setTimeout:en,Error:tn,MouseEvent:nn,MutationObserver:on,WeakSet:rn}=Te(window);
let{parseInt:sn,setTimeout:an,Error:cn,MouseEvent:ln,MutationObserver:un,WeakSet:dn
}=Te(window);const
hn=["auxclick","click","dblclick","gotpointercapture","lostpointercapture","mouseen
ter","mousedown","mouseleave","mousemove","mouseout","mouseover","mouseup","pointer
down","pointerenter","pointermove","pointerover","pointerout","pointerup","pointerc
ancel","
pointerleave"];let{isNaN:fn,MutationObserver:pn,parseInt:wn,parseFloat:gn,setTimeou
t:mn}=Te(window);const bn={log:nt,race:function(e,t="1"){switch(e)
{case"start":ct={winners:at(t,10)||1,participants:new st},lt=new
rt;break;case"end":case"finish":case"stop":ct=null;for(let e of
lt)e();lt=null;break;default:throw new it(`Invalid action: $
{e}`)}},debug:function(){Ye=!0},"hide-if-matches-xpath":function(e,t)
{const{mark:n,end:o}=Xt(),r=ot("hide-if-matches-xpath"),i=t=>{const i=ze(`xpath($
{e})`),s=new Ut,a=()=>{n(),i((t=>{if(s.has(t))return!
1;s.add(t),l(),Te(t).nodeType===Gt?Be(t):Te(t).textContent="",r("Matched: ",t," for
selector: ",e)})),o()},c=new Jt(a),l=ut("hide-if-matches-xpath",
(()=>c.disconnect()));c.observe(t,{characterData:!0,childList:!0,subtree:!
0}),a()};if(t){let e,n=0;const o=ze(`xpath(${t})`),r=()=>{o((e=>{i(e),n+
+})),n>0&&e.disconnect()};e=new Jt(r),e.observe(document,{characterData:!
0,childList:!0,subtree:!0}),r()}else i(document)},"hide-if-matches-computed-
xpath":function(e,t,n,o){const{mark:r,end:i}=Xt(),s=ot("hide-if-matches-computed-
xpath");if(!t||!e)return void s("No query or searchQuery provided.");const
a=t=>{const n=(t=>e.replace("{{}}",t))(t);s("Starting hiding elements that match
query: ",n);const o=ze(`xpath(${n})`),a=new
Qt,c=()=>{r(),o((t=>{if(a.has(t))return!1;a.add(t),u(),Te(t).nodeType===Yt?
Be(t):Te(t).textContent="",s("Matched: ",t," for selector: ",e)})),i()},l=new
Kt(c),u=ut("hide-if-matches-computed-xpath",
(()=>l.disconnect()));l.observe(document,{characterData:!0,childList:!0,subtree:!
0}),c()},c=Qe(n);ft(s,(()=>{if(t){s("Started searching for: ",t);const e=new Qt;let
n;const o=ze(`xpath(${t})`),r=()=>{o((t=>{if(e.has(t))return!1;if(e.add(t),s("Found
node: ",t),t.innerHTML){s("Searching in: ",t.innerHTML);const
e=t.innerHTML.match(c);if(e&&e.length){let t="";t=e[1]?e[1]:e[0],s("Matched search
query: ",t),a(t)}}}))};n=new Kt(r),n.observe(document,{characterData:!0,childList:!
0,subtree:!0}),r()}}),o)},"hide-if-contains":function(e,t="*",n=null){const
o=ot("hide-if-contains");let r=Qe(e);const i=Xe((e=>r.test(Te(e).textContent)),t,n,
(e=>{o("Matched: ",e," for selector: ",t,n)}));i.race(ut("hide-if-contains",
(()=>{i.disconnect()})))},"hide-if-contains-similar-
text":function(e,t,n=null,o=0,r=0){const i=new Ot,s=ot("hide-if-contains-similar-
text"),a=Te(e),{length:c}=a,l=c+Tt(o)||0,u=Te([...a]).sort(),d=Tt(r)||
1/0;null==n&&(n=t),s("Looking for similar text: "+a);const h=()=>{for(const e of
He(n)){if(i.has(e))continue;i.add(e);const{innerText:n}=Te(e),r=Pt(d,n.length-
l+1);for(let i=0;i<r;i++){const r=Te(n).substr(i,l);if(Dt(u,Te([...r]).sort())-
o<=0){const n=Te(e).closest(t);if(s("Found similar text: "+a,n),n)
{p(),Be(n);break}}}}};let f=new Lt(h),p=ut("hide-if-contains-similar-text",
(()=>f.disconnect()));f.observe(document,{childList:!0,characterData:!0,subtree:!
0}),h()},"hide-if-contains-visible-text":function(e,t,n=null,...o){let
r=Te([]);const i=new It([["-snippet-box-margin","2"],["-disable-bg-color-
check","false"],["-check-is-contained","false"]]);for(let e of o){e=Te(e);let
t=e.indexOf(":");if(t<0)continue;let
n=e.slice(0,t).trim().toString(),o=e.slice(t+1).trim().toString();n&&o&&(i.has(n)?
i.set(n,o):r.push([n,o]))}let s=Te([["opacity","0"],["font-size","0px"],
["color","rgba(0, 0, 0, 0)"]]),a=new It(s.concat(r));function c(e,t,
{bgColorCheck:n=!0}={}){t||(t=Nt(e)),t=Te(t);for(const[e,n]of a)
{if(Qe(n).test(t.getPropertyValue(e)))return!1}let
o=t.getPropertyValue("color");return!n||t.getPropertyValue("background-color")!
=o}function l(e,t,{bgColorCheck:n=!0}={}){let o=Nt(e,t);if(!Je(e,o)||!c(e,o,
{bgColorCheck:n}))return"";let{content:r}=Te(o);if(r&&"none"!==r){let
t=Te([]);return r=Te(r).trim().replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,(e=>"#"+
(t.push(Te(e).slice(1,-1))-1))),r=r.replace(/\s*attr\(\s*([^\s,)]+)[^)]*?\)\s*/g,
((t,n)=>Te(e).getAttribute(n)||"")),r.replace(/\x01(\d+)/g,
((e,n)=>t[n]))}return""}function u(e,t,{boxMargin:n=2}={}){const
o=Te(e).getBoundingClientRect(),r=Te(t).getBoundingClientRect(),i=r.left-
n,s=r.right+n,a=r.top-n,c=r.bottom+n;return
i<=o.left&&o.left<=s&&a<=o.top&&o.top<=c&&a<=o.bottom&&o.bottom<=c&&i<=o.right&&o.r
ight<=s}function d(e,t,n,o,r,{boxMargin:i=2,bgColorCheck:s,checkIsContained:a}={})
{let h=!n;if(h&&(n=Nt(e)),!Je(e,n,h&&t))return"";o||"hidden"!
==Te(n).getPropertyValue("overflow-x")&&"hidden"!
==Te(n).getPropertyValue("overflow-y")||(o=e);let f=l(e,":before",
{bgColorCheck:s});for(let t of Te(e).childNodes)switch(Te(t).nodeType){case
Vt:f+=d(t,e,Nt(t),o,r,{boxMargin:i,bgColorCheck:s,checkIsContained:a});break;case
$t:if(o)u(e,o,{boxMargin:i})&&c(e,n,{bgColorCheck:s})&&(f+=Te(t).nodeValue);else
if(c(e,n,{bgColorCheck:s})){if(a&&!u(e,r,
{boxMargin:i}))continue;f+=Te(t).nodeValue}}return f+l(e,":after",
{bgColorCheck:s})}const h=i.get("-snippet-box-margin"),f=Rt(h)||0,p=!
("true"===i.get("-disable-bg-color-check")),w="true"===i.get("-check-is-
contained");let g=Qe(e),m=new At;const b=Xe(((e,t)=>{if(m.has(e))return!
1;m.add(e);let n=d(e,t,null,null,e,
{boxMargin:f,bgColorCheck:p,checkIsContained:w}),o=g.test(n);return
Ze()&&n.length&&nt(o,g,n),o}),t,n);b.race(ut("hide-if-contains-visible-text",
(()=>{b.disconnect()})))},"hide-if-contains-and-matches-
style":function(e,t="*",n=null,o=null,r=null,i,s=null,a=null){const c=ot("hide-if-
contains-and-matches-style"),l=new wt,u=Ze()&&new wt;null==n&&(n=t);const
d=Qe(e),h=o?Qe(o):null,f=r?Qe(r):null,p=()=>{const e=()=>{if(!
(s&&window.innerWidth<s||a&&window.innerWidth>a))for(const e of He(n))if(!
l.has(e)&&d.test(Te(e).textContent))if(!f||f.test(Ue(e))){const
n=Te(e).closest(t);if(!n)continue;if(!h||
h.test(Ue(n)))r(),Be(n),l.add(e),c("Matched: ",n,"which contains: ",e," for params:
",...arguments);else{if(!u||u.has(n))continue;c("In this element the searchStyle
matched but style didn't:\n",n,gt(n),...arguments),u.add(n)}}else{if(!u||
u.has(e))continue;c("In this element the searchStyle didn't match:\
n",e,gt(e),...arguments),u.add(e)}},o=new pt(e),r=ut("hide-if-contains-and-matches-
style",(()=>o.disconnect()));o.observe(document,{childList:!0,characterData:!
0,subtree:!0}),e()};ft(c,p,i)},"hide-if-has-and-matches-
style":function(e,t="*",n=null,o=null,r=null,i=null,s=null,a=null){const
c=ot("hide-if-has-and-matches-style"),l=new jt,u=Ze()&&new jt;null==n&&(n=t);const
d=o?Qe(o):null,h=r?Qe(r):null,f=()=>{const o=()=>{if(!(s&&window.innerWidth<s||
a&&window.innerWidth>a))for(const o of He(n))if(!l.has(o))if(!
Te(o).querySelector(e)||h&&!h.test(Ue(o))){if(!u||u.has(o))continue;c("In this
element the searchStyle didn't match:\n",o,Ft(o),...arguments),u.add(o)}else{const
e=Te(o).closest(t);if(!e||d&&!d.test(Ue(e))){if(!u||u.has(e))continue;c("In this
element the searchStyle matched but style didn't:\
n",e,Ft(e),...arguments),u.add(e)}else i(),Be(e),l.add(o),c("Matched: ",e,"which
contains: ",o," for params: ",...arguments)}},r=new Ht(o),i=ut("hide-if-has-and-
matches-style",(()=>r.disconnect()));r.observe(document,{childList:!0,subtree:!
0}),o()};ft(c,f,i)},"hide-if-labelled-by":function(e,t,n=null){let
o=null==n,r=Qe(e),i=new Bt,s=()=>{for(let e of He(t)){let t=o?
e:Te(e).closest(n);if(!t||!Je(e,_t(e),t))continue;let s=Te(e).getAttribute("aria-
labelledby"),a=()=>{i.has(t)||r.test(Te(e).getAttribute("aria-
label")||"")&&(c(),i.add(t),Be(t))};if(s)for(let e of Te(s).split(/\s+/)){let
n=Te(document).getElementById(e);n?!
i.has(n)&&r.test(n.innerText)&&(c(),i.add(n),Be(t)):a()}else a()}},a=new
qt(s),c=ut("hide-if-labelled-by",(()=>a.disconnect()));a.observe(document,
{characterData:!0,childList:!0,subtree:!0}),s()},"hide-if-contains-
image":function(e,t,n){null==n&&(n=t);let o=Qe(e);const r=ot("hide-if-contains-
image");let i=()=>{for(let e of He(n)){let n=yt(e),i=Te(n["background-
image"]).match(/^url\("(.*)"\)$/);i&&xt(i[1]).then((n=>{if(o.test(Ct(new Et(n))))
{let n=Te(e).closest(t);n&&(a(),Be(n),r("Matched: ",n,"
for:",...arguments))}}))}},s=new kt(i),a=ut("hide-if-contains-image",
(()=>s.disconnect()));s.observe(document,{childList:!0,subtree:!0}),i()},"simulate-
event-poc":function(e,t,n="0"){if(!e)throw new tn("[simulate-event snippet]: No
event type provided.");if(!t)throw new tn("[simulate-event snippet]: No selector
provided.");let o=ze(t),r=Zt(n,10),i=new rn;function s(){o((t=>{i.has(t)||
(i.add(t),en((()=>{Te(t).dispatchEvent(new nn(e,{bubbles:!0,cancelable:!
0}))}),r))}))}new on(s).observe(document,{childList:!0,subtree:!0}),s()},"simulate-
mouse-event":function(...e){const t=ot("simulate-mouse-event");if(e.length<1)throw
new cn("[simulate-mouse-event snippet]: No selector
provided.");e.length>7&&(e=e.slice(0,7));const n=Te([]);function o(){return
n.forEach((e=>{if(!e.found){(function(e){let
t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=ze(e);return()=>{let
e=Te([]);return t((t=>e.push(t))),e}}return()=>De.from(He(e))})(e.selector)
().length>0&&(e.found=!0)}})),n.every((e=>e.found))}function r(e,n,o)
{e&&n&&("click"===n&&e.click?(e.click(),t("Clicked on this node:\n",e,"\nwith a
delay of",o,"ms")):(e.dispatchEvent(new ln(n,{bubbles:!0,cancelable:!
0})),t("A",n,"event was dispatched with a delay of",o,"ms on this node:\
n",e)))}Te(e).forEach((e=>{const o=function(e){if(!e)return null;const
n={selector:"",continue:!1,trigger:!1,event:"click",delay:"500",clicked:!1,found:!
1},o=e.split("$");let r=[];o.length>=2&&(r=o[1].toLowerCase().split(",")),
[n.selector]=o;for(const e of r)if("trigger"===e)n.trigger=!0;else
if("continue"===e)n.continue=!0;else if(e.startsWith("event")){const
t=e.toLowerCase().split("=");t[1]?n.event=t[1]:n.event="click"}else
if(e.startsWith("delay")){const t=e.toLowerCase().split("=");t[1]?
n.delay=t[1]:n.delay="500"}return hn.includes(n.event)||t(n.event," might be
misspelled, check for typos.\n","These are the supported events:",hn),n}
(e);n.push(o)}));let i=!1;const[s]=n.slice(-1);s.trigger=!0;let a=new dn;function
c(){if(i||(i=o()),i)for(const e of n){const
t=ze(e.selector),n=sn(e.delay,10);e.trigger&&t((t=>{a.has(t)||(a.add(t),e.continue?
setInterval((()=>{r(t,e.event,e.delay)}),n):an((()=>{r(t,e.event,e.delay)}),n))
}))}}new un(c).observe(document,{childList:!0,subtree:!0}),c()},"skip-
video":function(e,t,n=-.1,o=10,r=10){const i=gn(n||-.1),s=wn(o||10,10),a=wn(r||
10,10),c=ot("skip-video"),l=ze(`xpath(${t})`),u=(n=0)=>{l((o=>{c("Matched: ",o,"
for selector: ",t),c("Running video skipping logic.");const r=He(e)
[0];for(;fn(r.duration)&&n<s;)return void mn((()=>{const e=n+1;c("Running video
skipping logic. Attempt: ",e),u(e)}),a);fn(r.duration)||(r.muted=!0,c("Muted
video..."),i<=0?r.currentTime=r.duration+i:r.currentTime+=i,c("Skipped
duration..."),r.paused&&r.play())}))};new pn(u).observe(document,{characterData:!
0,childList:!0,subtree:!0}),u()}};
const snippets=bn;
let context;
for (const [name, ...args] of filters) {
if (snippets.hasOwnProperty(name)) {
try { context = snippets[name].apply(context, args); }
catch (error) { console.error(error); }
}
}
context = void 0;
})(e, ...t);