UNPKG

@eyeo/snippets

Version:

eye/o snippets for Ads blocker

19 lines (18 loc) 58.5 kB
/*! * 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/>. */ const callback = (environment, ...filters) => { const e=Proxy,{apply:t,bind:n,call:r}=Function,o=r.bind(t),i=r.bind(n),s=r.bind(r),a={get:(e,t)=>i(r,e[t])},c=t=>new e(t,a),l=(t,n)=>new e(t,{apply:(e,t,r)=>o(n,t,r)}),u={get:(e,t)=>i(e[t],e)},d=t=>new e(t,u),{assign:f,defineProperties:p,freeze:h,getOwnPropertyDescriptor:g,getOwnPropertyDescriptors:m,getPrototypeOf:w}=d(Object),{hasOwnProperty:y}=c({}),{species:v}=Symbol,b={get(e,t){const n=e[t];class r extends n{}const o=m(n.prototype);delete o.constructor,h(p(r.prototype,o));const i=m(n);return delete i.length,delete i.prototype,i[v]={value:r},h(p(r,i))}},E=t=>new e(t,b),k="undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:x,ownKeys:T}=d(Reflect),S="world"in k,M=S&&"ISOLATED"===k.world,L=S&&"MAIN"===k.world,$="object"==typeof chrome&&!!chrome.runtime,R="object"==typeof browser&&!!browser.runtime,C=!L&&(M||$||R),P=e=>C?e:O(e,N(e)),{create:O,defineProperties:A,defineProperty:j,freeze:I,getOwnPropertyDescriptor:W,getOwnPropertyDescriptors:N}=d(Object),D=d(globalThis),F=C?globalThis:E(globalThis),{Map:H,RegExp:z,Set:B,WeakMap:V,WeakSet:q}=F,U=(e,t,n=null)=>{const r=T(t);for(const o of T(e)){if(r.includes(o))continue;const i=W(e,o);if(n&&"value"in i){const{value:e}=i;"function"==typeof e&&(i.value=n(e))}j(t,o,i)}},X=e=>{const t=F[e];class n extends t{}const{toString:r,valueOf:o}=t.prototype;A(n.prototype,{toString:{value:r},valueOf:{value:o}});const i=e.toLowerCase(),s=e=>function(){const t=x(e,this,arguments);return typeof t===i?new n(t):t};return U(t,n,s),U(t.prototype,n.prototype,s),n},G=I({frozen:new V,hidden:new q,iframePropertiesToAbort:{read:new B,write:new B},abortedIframes:new V}),J=new z("^[A-Z]"),_=C&&($&&chrome||R&&browser)||void 0;var K=new Proxy(new H([["chrome",_],["browser",_],["isExtensionContext",C],["variables",G],["console",P(console)],["document",globalThis.document],["JSON",P(JSON)],["Map",H],["Math",P(Math)],["Number",C?Number:X("Number")],["RegExp",z],["Set",B],["String",C?String:X("String")],["WeakMap",V],["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)?F:D)[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const Q={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Y}=Reflect;const{Map:Z,WeakMap:ee,WeakSet:te,setTimeout:ne}=K;let re=!0,oe=e=>{e.clear(),re=!re};var ie=function(e){const{WeakSet:t,WeakMap:n,WeakValue:r}=this||Q,o=new t,i=new n,s=new r;return function(t){if(o.has(t))return t;if(i.has(t))return i.get(t);if(s.has(t))return s.get(t);const n=Y(e,this,arguments);return o.add(n),n!==t&&("object"==typeof t&&t?i:s).set(t,n),n}}.bind({WeakMap:ee,WeakSet:te,WeakValue:class extends Z{set(e,t){return re&&(re=!re,ne(oe,0,this)),super.set(e,t)}}});const{concat:se,includes:ae,join:ce,reduce:le,unshift:ue}=c([]),de=E(globalThis),{Map:fe,WeakMap:pe}=de,he=new fe,ge=t=>{const n=(e=>{const t=[];let n=e;for(;n;){if(he.has(n))ue(t,he.get(n));else{const e=m(n);he.set(n,e),ue(t,e)}n=w(n)}return ue(t,{}),o(f,null,t)})("function"==typeof t?t.prototype:t),r={get(e,t){if(t in n){const{value:r,get:o}=n[t];if(o)return s(o,e);if("function"==typeof r)return i(r,e)}return e[t]},set(e,t,r){if(t in n){const{set:o}=n[t];if(o)return s(o,e,r),!0}return e[t]=r,!0}};return t=>new e(t,r)},{isExtensionContext:me,Array:we,Number:ye,String:ve,Object:be}=K,{isArray:Ee}=we,{getOwnPropertyDescriptor:ke,setPrototypeOf:xe}=be,{toString:Te}=be.prototype,{slice:Se}=ve.prototype,{get:Me}=ke(Node.prototype,"nodeType"),Le=me?{}:{Attr:ge(Attr),CanvasRenderingContext2D:ge(CanvasRenderingContext2D),CSSStyleDeclaration:ge(CSSStyleDeclaration),Document:ge(Document),Element:ge(Element),HTMLCanvasElement:ge(HTMLCanvasElement),HTMLElement:ge(HTMLElement),HTMLImageElement:ge(HTMLImageElement),HTMLScriptElement:ge(HTMLScriptElement),MutationRecord:ge(MutationRecord),Node:ge(Node),ShadowRoot:ge(ShadowRoot),get CSS2Properties(){return Le.CSSStyleDeclaration}},$e=(e,t)=>{if("Element"!==t&&t in Le)return Le[t](e);if(Ee(e))return xe(e,we.prototype);const n=(e=>s(Se,s(Te,e),8,-1))(e);if(n in Le)return Le[n](e);if(n in K)return xe(e,K[n].prototype);if("nodeType"in e)switch(s(Me,e)){case 1:if(!(t in Le))throw new Error("unknown hint "+t);return Le[t](e);case 2:return Le.Attr(e);case 3:return Le.Node(e);case 9:return Le.Document(e)}throw new Error("unknown brand "+n)};var Re=me?e=>e===window||e===globalThis?K:e:ie(((e,t="Element")=>{if(e===window||e===globalThis)return K;switch(typeof e){case"object":return e&&$e(e,t);case"string":return new ve(e);case"number":return new ye(e);default:throw new Error("unsupported value")}}));const Ce={get(e,t){const n=e;for(;!y(e,t);)e=w(e);const{get:r,set:i}=g(e,t);return function(){return arguments.length?o(i,n,arguments):s(r,n)}}},Pe=t=>new e(t,Ce);let{Math:Oe,setInterval:Ae,performance:je}=Re(window);const Ie={mark(){},end(){},toString:()=>"{mark(){},end(){}}"};let We=!0;function Ne(){We=!1}function De(e,t=10){if(We)return Ie;function n(){let e=Re([]);for(let{name:t,duration:n}of je.getEntriesByType("measure"))e.push({name:t,duration:n});e.length&&je.clearMeasures()}return De[e]||(De[e]=Ae(n,Oe.round(6e4/Oe.min(60,t)))),{mark(){je.mark(e)},end(t=!1){je.measure(e,e);const r=je.getEntriesByName(e,"measure"),o=r.length>0?r[r.length-1]:null;console.log("PROFILER:",o),je.clearMarks(e),t&&(clearInterval(De[e]),delete De[e],n())}}}let Fe=!1;function He(){return Fe}function ze(){Fe=!0}const{console:Be}=Re(window),Ve=()=>{};function qe(...e){let{mark:t,end:n}=De("log");if(He()){const t=["%c DEBUG","font-weight: bold;"],n=e.indexOf("error"),r=e.indexOf("warn"),o=e.indexOf("success"),i=e.indexOf("info");-1!==n?(t[0]+=" - ERROR",t[1]+="color: red; border:2px solid red",Re(e).splice(n,1)):-1!==r?(t[0]+=" - WARNING",t[1]+="color: orange; border:2px solid orange ",Re(e).splice(r,1)):-1!==o?(t[0]+=" - SUCCESS",t[1]+="color: green; border:2px solid green",Re(e).splice(o,1)):-1!==i&&(t[1]+="color: black;",Re(e).splice(i,1)),Re(e).unshift(...t)}t(),Be.log(...e),n()}function Ue(e){return i(He()?qe:Ve,null,e)}let{Array:Xe,Math:Ge,RegExp:Je}=Re(window);function _e(e){let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||t>2&&Re(e).endsWith("/i")){let t=[Re(e).slice(1,n?-1:-2)];return n||t.push("i"),new Je(...t)}}return new Je(Re(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}function Ke(){return Re(Ge.floor(2116316160*Ge.random()+60466176)).toString(36)}function Qe(e){return Re(Xe.from(e)).map((e=>`'${e}'`)).join(" ")}let{parseFloat:Ye,variables:Ze,Array:et,Error:tt,Map:nt,Object:rt,ReferenceError:ot,Set:it,WeakMap:st}=Re(window),{onerror:at}=Pe(window),ct=Node.prototype,lt=Element.prototype,ut=null;function dt(e,t,n,r=!0){let o=Re(t),i=o.indexOf(".");if(-1==i){let o=rt.getOwnPropertyDescriptor(e,t);if(o&&!o.configurable)return;let i=rt.assign({},n,{configurable:r});if(!o&&!i.get&&i.set){let n=e[t];i.get=()=>n}return void rt.defineProperty(e,t,i)}let s=o.slice(0,i).toString();t=o.slice(i+1).toString();let a=e[s];!a||"object"!=typeof a&&"function"!=typeof a||dt(a,t,n);let c=rt.getOwnPropertyDescriptor(e,s);if(c&&!c.configurable)return;ut||(ut=new st),ut.has(e)||ut.set(e,new nt);let l=ut.get(e);if(l.has(s))return void l.get(s).set(t,n);let u=new nt([[t,n]]);l.set(s,u),rt.defineProperty(e,s,{get:()=>a,set(e){if(a=e,a&&("object"==typeof a||"function"==typeof a))for(let[e,t]of u)dt(a,e,t)},configurable:r})}function ft(e){let t=at();at(((...n)=>{let r=n.length&&n[0];return!("string"!=typeof r||!Re(r).includes(e))||("function"==typeof t?o(t,this,n):void 0)}))}function pt(e,t,n,r="",o=!0){let i=Ue(e);if(!n)return void i("error","no property to abort on read");let s=Ke();i("info",`aborting on ${n} access`),dt(t,n,{get:function(){throw i("success",`${n} access aborted`,`\nFILTER: ${e} ${r}`),new ot(s)},set(){}},o),ft(s)}function ht(e,t,n,r="",o=!0){let i=Ue(e);if(!n)return void i("error","no property to abort on write");let s=Ke();i("info",`aborting when setting ${n}`),dt(t,n,{set:function(){throw i("success",`setting ${n} aborted`,`\nFILTER: ${e} ${r}`),new ot(s)}},o),ft(s)}function gt(e,t=!1,n=!1){let r=Ze.abortedIframes,i=Ze.iframePropertiesToAbort;const a=Qe(e);for(let o of et.from(window.frames))if(r.has(o))for(let i of e)t&&r.get(o).read.add({property:i,formattedProperties:a}),n&&r.get(o).write.add({property:i,formattedProperties:a});for(let r of e)t&&i.read.add({property:r,formattedProperties:a}),n&&i.write.add({property:r,formattedProperties:a});function c(){for(let e of et.from(window.frames)){r.has(e)||r.set(e,{read:new it(i.read),write:new it(i.write)});let t=r.get(e).read;if(t.size>0){let n=et.from(t);t.clear();for(let{property:t,formattedProperties:r}of n)pt("abort-on-iframe-property-read",e,t,r)}let n=r.get(e).write;if(n.size>0){let t=et.from(n);n.clear();for(let{property:n,formattedProperties:r}of t)ht("abort-on-iframe-property-write",e,n,r)}}}c(),r.has(document)||(r.set(document,!0),function(e){let t;function n(e,t){for(let n of t){dt(e,n,r(e,n))}}function r(t,n){let r=t[n];return{get:()=>function(...t){let n;return n=o(r,this,t),e&&e(),n}}}function i(t,n){let r=rt.getOwnPropertyDescriptor(t,n),{set:o}=r||{};return{set(t){let n;return n=s(o,this,t),e&&e(),n}}}n(ct,["appendChild","insertBefore","replaceChild"]),n(lt,["append","prepend","replaceWith","after","before","insertAdjacentElement","insertAdjacentHTML"]),t=i(lt,"innerHTML"),dt(lt,"innerHTML",t),t=i(lt,"outerHTML"),dt(lt,"outerHTML",t)}(c))}let{Object:mt}=window;function wt(e,t){if(!(e instanceof mt))return;let n=e,r=Re(t).split(".");if(0===r.length)return;for(let e=0;e<r.length-1;e++){let t=r[e];if(!y(n,t))return;if(n=n[t],!(n instanceof mt))return}let o=r[r.length-1];return y(n,o)?[n,o]:void 0}const yt=Re(/^\d+$/);function vt(e){switch(e){case"false":return!1;case"true":return!0;case"null":return null;case"noopFunc":return()=>{};case"trueFunc":return()=>!0;case"falseFunc":return()=>!1;case"emptyArray":return[];case"emptyObj":return{};case"undefined":return;case"":return e;default:if(yt.test(e))return Ye(e);throw new tt(`[override-property-read snippet]: Value "${e}" is not valid.`)}}function bt(e,t,n){var r,o;n?"load"===n?(e("info","Waiting until window.load"),window.addEventListener("load",(()=>{e("info","Window.load fired."),t()}))):"loading"===n||"interactive"===n||"complete"===n?(e("info","Waiting document state until :",n),document.addEventListener("readystatechange",(()=>{e("info","Document state changed:",document.readyState),document.readyState===n&&t()}))):(e("info","Waiting until ",n," event is triggered on document"),(r=document,o=n,new Promise((e=>{const t=()=>{r.removeEventListener(o,t),e()};r.addEventListener(o,t)}))).then((()=>{e("info",n," is triggered on document, starting the snippet"),t()})).catch((t=>{e("error","There was an error while waiting for the event.",t)}))):t()}let{HTMLScriptElement:Et,Object:kt,ReferenceError:xt}=Re(window),Tt=kt.getPrototypeOf(Et);const{Error:St,Object:Mt,Array:Lt,Map:$t}=Re(window);let Rt=null;function Ct(e,t,n){let r=e;for(const e of n){if(!r||!y(r,e))return!1;r=r[e]}if("string"==typeof r||"number"==typeof r){const e=r.toString();return t.test(e)}return!1}const{Array:Pt,Blob:Ot,Error:At,Object:jt,Reflect:It}=Re(window),Wt=[];let{Error:Nt,URL:Dt}=Re(window),{cookie:Ft}=Pe(document);const{Map:Ht,Object:zt,Reflect:Bt,WeakMap:Vt}=Re(window),qt=window.EventTarget.prototype.addEventListener,Ut=window.EventTarget.prototype.removeEventListener,Xt=new Vt;let Gt=[];let{console:Jt,document:_t,getComputedStyle:Kt,isExtensionContext:Qt,variables:Yt,Array:Zt,MutationObserver:en,Object:tn,XPathEvaluator:nn,XPathExpression:rn,XPathResult:on}=Re(window);const{querySelectorAll:sn}=_t,an=sn&&i(sn,_t);function cn(e,t=!1){try{const n=navigator.userAgent.includes("Firefox")?e.openOrClosedShadowRoot:browser.dom.openOrClosedShadowRoot(e);return null===n&&He()&&!t&&Jt.log("Shadow root not found or not added in element yet",e),n}catch(n){return He()&&!t&&Jt.log("Error while accessing shadow root",e,n),null}}function ln(e,t=!1){return fn(e,an.bind(_t),_t,t)}function un(e,t,n,r){const o=t.getAttribute("xlink:href")||t.getAttribute("href");if(o){const s=an(o)[0];if(!s&&He())return Jt.log("No elements found matching",o),!1;if(!(i=e)||0===i.length||i.every((e=>""===e.trim()))){const e=r.length>0?r:[];return n.push({element:s,rootParents:[...e,t]}),!1}const a=s.querySelectorAll.bind(s);return{nextBoundElement:s,nestedSelectorsString:e.join("^^"),next$$:a}}var i}function dn(e,t){const n=cn(t);if(n){const{querySelectorAll:r}=n,o=r&&i(r,n).bind(n);return{nextBoundElement:t,nestedSelectorsString:":host "+e.join("^^"),next$$:o}}return!1}function fn(e,t,n,r,o=[]){if(e.includes("^^")){const[i,s,...a]=e.split("^^");let c,l;switch(s){case"svg":l=un;break;case"sh":l=dn;break;default:return He()&&Jt.log(s," is not supported. Supported commands are: \n^^sh^^\n^^svg^^"),[]}c=""===i.trim()?[n]:t(i);const u=[];for(const e of c){const t=l(a,e,u,o);if(!t)continue;const{next$$:n,nestedSelectorsString:i,nextBoundElement:s}=t,c=fn(i,n,s,r,[...o,e]);c&&u.push(...c)}return u}const i=t(e);return r?[...i].map((e=>({element:e,rootParents:o.length>0?o:[]}))):i}function pn(e,t,n=[]){if(t.includes("^^svg^^")&&(t=t.split("^^svg^^")[0]),t.includes("^^sh^^")){const r=t.split("^^sh^^"),o=r.length-1;if(t=`:host ${r[o]}`,o===n.length)return e.closest(t);return n[o].closest(t)}return n[0]?n[0].closest(t):e.closest(t)}const{assign:hn,setPrototypeOf:gn}=tn;class mn extends rn{evaluate(...e){return gn(o(super.evaluate,this,e),on.prototype)}}class wn extends nn{createExpression(...e){return gn(o(super.createExpression,this,e),mn.prototype)}}function yn(e){if(Yt.hidden.has(e))return!1;!function(e){Qt&&"function"==typeof checkElement&&checkElement(e)}(e),Yt.hidden.add(e);let{style:t}=Re(e),n=Re(t,"CSSStyleDeclaration"),r=Re([]),{debugCSSProperties:o}=k;for(let[e,t]of o||[["display","none"]])n.setProperty(e,t,"important"),r.push([e,n.getPropertyValue(e)]);return new en((()=>{for(let[e,t]of r){let r=n.getPropertyValue(e),o=n.getPropertyPriority(e);r==t&&"important"==o||n.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:["style"]}),!0}function vn(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),n=(new wn).createExpression(e,null),r=on.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=n.evaluate(_t,r,null),{snapshotLength:o}=t;for(let n=0;n<o;n++)e(t.snapshotItem(n))}}return t=>ln(e).forEach(t)}function bn(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=vn(e);return()=>{let e=Re([]);return t((t=>e.push(t))),e}}return()=>Zt.from(ln(e))}function En(e,t,n,r){let o;null==n&&(n=t);const i=()=>{for(const{element:i,rootParents:s}of ln(n,!0)){const n=pn(Re(i),t,s);n&&e(i,n,s)&&(o(),yn(n)&&"function"==typeof r&&r(n))}};return hn(new en(i),{race(e){o=e,this.observe(_t,{childList:!0,characterData:!0,subtree:!0}),i()}})}function kn(e,t,n,r){let o=Re(t,"CSSStyleDeclaration");if("none"==o.getPropertyValue("display"))return!1;let i=o.getPropertyValue("visibility");if("hidden"==i||"collapse"==i)return!1;if(!n||e==n)return!0;let s=Re(e).parentElement;if(!s){if(!r||!r.length)return!0;s=r[r.length-1],r=r.slice(0,-1)}return kn(s,Kt(s),n,r)}function xn(e){let t=Kt(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return Re(n).trim()}let{ELEMENT_NODE:Tn,TEXT_NODE:Sn,prototype:Mn}=Node,{prototype:Ln}=Element,{prototype:$n}=HTMLElement,{console:Rn,variables:Cn,DOMParser:Pn,Error:On,MutationObserver:An,Object:jn,ReferenceError:In}=Re(window),{getOwnPropertyDescriptor:Wn}=jn;const{CanvasRenderingContext2D:Nn,document:Dn,Map:Fn,MutationObserver:Hn,Object:zn,Set:Bn,WeakSet:Vn}=Re(window);let qn,Un=new Bn,Xn=new Vn;function Gn(e,t,n,r){Un.add({canvasElement:e,rule:t,functionName:n,text:r})}let{Array:Jn,Error:_n,Map:Kn,parseInt:Qn}=Re(window),Yn=null,Zn=null;function er(e,t){if(null===Yn)return Ve;let n=Yn,{participants:r}=n;return r.set(o,t),o;function o(){if(n.winners<1)return;if(Ue("race")("success",`${e} won the race`),n===Yn)Zn.push(o);else if(r.delete(o),--n.winners<1){for(let e of r.values())e();r.clear()}}}const{Map:tr,MutationObserver:nr,Object:rr,Set:or,WeakSet:ir}=Re(window);let sr=Element.prototype,{attachShadow:ar}=sr,cr=new ir,lr=new tr,ur=null;const{Array:dr,Error:fr,JSON:pr,Map:hr,Object:gr,Response:mr}=Re(window);let wr=null;let{Array:yr,Error:vr,JSON:br,Map:Er,Object:kr,Response:xr,URL:Tr}=Re(window),Sr=null;let{Error:Mr}=Re(window);let{Error:Lr,Map:$r,Object:Rr,console:Cr}=Re(window),{toString:Pr}=Function.prototype,Or=EventTarget.prototype,{addEventListener:Ar}=Or,jr=null;let{fetch:Ir}=Re(window),Wr=!1;const Nr=[],Dr=[],Fr=()=>{Wr||(window.fetch=l(Ir,((...e)=>{let[t]=e;if(Nr.length>0&&"string"==typeof t){let n;try{n=new URL(t)}catch(e){if(!(e instanceof TypeError))throw e;n=new URL(t,Re(document).location)}Nr.forEach((e=>e(n))),e[0]=n.href}return o(Ir,self,e).then((e=>{let t=e;return Dr.forEach((e=>{t=e(t)})),t}))})),Wr=!0)};let Hr,{Map:zr,Object:Br,RegExp:Vr,Response:qr}=Re(window);let Ur,Xr,{RegExp:Gr,XMLHttpRequest:Jr,WeakMap:_r}=Re(window);let Kr,{delete:Qr,has:Yr}=c(URLSearchParams.prototype);const Zr={"abort-current-inline-script":function(e,t=null){const n=Qe(arguments),r=Ue("abort-current-inline-script"),{mark:o,end:i}=De("abort-current-inline-script"),a=t?_e(t):null,c=Ke(),l=Re(document).currentScript;let u=window;const d=Re(e).split("."),f=Re(d).pop();for(let e of Re(d))if(u=u[e],!u||"object"!=typeof u&&"function"!=typeof u)return void r("warn",d," is not found");const{get:p,set:h}=kt.getOwnPropertyDescriptor(u,f)||{};let g=u[f];void 0===g&&r("warn","The property",f,"doesn't exist yet. Check typos.");const m=()=>{const e=Re(document).currentScript;if(e instanceof Tt&&""==Re(e,"HTMLScriptElement").src&&e!=l&&(!a||a.test(Re(e).textContent)))throw r("success",d," is aborted \n",e,"\nFILTER: abort-current-inline-script",n),new xt(c)},w={get(){return m(),p?s(p,this):g},set(e){m(),h?s(h,this,e):g=e}};o(),dt(u,f,w),i(),ft(c)},"abort-on-iframe-property-read":function(...e){const{mark:t,end:n}=De("abort-on-iframe-property-read");t(),gt(e,!0,!1),n()},"abort-on-iframe-property-write":function(...e){const{mark:t,end:n}=De("abort-on-iframe-property-write");t(),gt(e,!1,!0),n()},"abort-on-property-read":function(e,t){const n=!("false"===t),r=Qe(arguments),{mark:o,end:i}=De("abort-on-property-read");o(),pt("abort-on-property-read",window,e,r,n),i()},"abort-on-property-write":function(e,t){const n=Qe(arguments),{mark:r,end:o}=De("abort-on-property-write"),i=!("false"===t);r(),ht("abort-on-property-write",window,e,n,i),o()},"array-override":function(e,t,n="false",r){if(!e)throw new St("[array-override snippet]: Missing method to override.");if(!t)throw new St("[array-override snippet]: Missing needle.");Rt||(Rt=new $t);let i=Ue("array-override");const{mark:s,end:a}=De("array-override"),c=Qe(arguments);if("push"!==e||Rt.has("push"))if("includes"!==e||Rt.has("includes")){if("forEach"===e&&!Rt.has("forEach")){s();const{forEach:e}=Lt.prototype;Rt.set("forEach",Re([])),Mt.defineProperty(window.Array.prototype,"forEach",{value:l(e,(function(t,n){const r=Rt.get("forEach");return o(e,this,[function(e,s,a){for(const{needleRegex:t,pathSegments:n}of r)if(n.length||"string"!=typeof e&&"number"!=typeof e){if(n.length&&"object"==typeof e&&null!==e&&Ct(e,t,n))return void i("success",`Array.forEach skipped callback for object containing needle: ${t}\nFILTER: array-override ${c}`)}else{const n=e.toString();if(n.match&&n.match(t))return void i("success",`Array.forEach skipped callback for item matching needle: ${t}\nFILTER: array-override ${c}`)}return o(t,n||this,[e,s,a])},n])}))}),i("info","Wrapped Array.prototype.forEach"),a()}}else{s();const{includes:e}=Lt.prototype;Rt.set("includes",Re([])),Mt.defineProperty(window.Array.prototype,"includes",{value:l(e,(function(t){const n=Rt.get("includes");for(const{needleRegex:e,retVal:r,pathSegments:o}of n)if(o.length||"string"!=typeof t&&"number"!=typeof t){if(o.length&&"object"==typeof t&&null!==t&&Ct(t,e,o))return i("success",`Array.includes returned ${r} for object containing ${e}\nFILTER: array-override ${c}`),r}else if(t.toString().match&&t.toString().match(e))return i("success",`Array.includes returned ${r} for ${e}\nFILTER: array-override ${c}`),r;return o(e,this,arguments)}))}),i("info","Wrapped Array.prototype.includes"),a()}else{s();const{push:e}=Lt.prototype;Rt.set("push",Re([])),Mt.defineProperty(window.Array.prototype,"push",{value:l(e,(function(t){const n=Rt.get("push");for(const{needleRegex:e,pathSegments:r}of n)if(r.length||"string"!=typeof t&&"number"!=typeof t){if(r.length&&"object"==typeof t&&null!==t&&Ct(t,e,r))return void i("success",`Array.push is ignored for object containing needle: ${e}\nFILTER: array-override ${c}`)}else{const n=t.toString();if(n.match&&n.match(e))return void i("success",`Array.push is ignored for needle: ${e}\nFILTER: array-override ${c}`)}return o(e,this,arguments)}))}),i("info","Wrapped Array.prototype.push"),a()}const u=_e(t);let d=[];r&&(d=r.split("."));const f=Rt.get(e),p="true"===n;f.push({needleRegex:u,retVal:p,pathSegments:d}),Rt.set(e,f)},"blob-override":function(e,t="",n=null){if(!e)throw new At("[blob-override snippet]: Missing parameter search.");const r=Ue("blob-override"),o=Qe(arguments),{mark:i,end:s}=De("blob-override");if(i(),Wt.push({match:_e(e),replaceWith:t,needle:n?_e(n):null,formattedArgs:o}),Wt.length>1)return;const a=Ot;function c(e,t={}){Pt.isArray(e)&&(e=Re(e).map((e=>{if("string"!=typeof e)return e;let t=Re(e);for(const e of Re(Wt))e.needle&&!e.needle.test(t)||!e.match.test(t)||(t=t.replace(e.match,e.replaceWith),r("success",`Replaced: ${e.match} → ${e.replaceWith},\nFILTER: blob-override ${e.formattedArgs}`));return t})));const n=It.construct(a,[e,t]);return jt.setPrototypeOf(n,c.prototype),n}c.prototype=a.prototype,jt.setPrototypeOf(c,a),window.Blob=c,r("info","Wrapped Blob constructor in context "),s()},"cookie-remover":function(e,t=!1){if(!e)throw new Nt("[cookie-remover snippet]: No cookie to remove.");const n=Qe(arguments);let r=Ue("cookie-remover");const{mark:o,end:i}=De("cookie-remover");let s=_e(e);if(!Re(/^http|^about/).test(location.protocol))return void r("warn","Snippet only works for http or https and about.");function a(){return Re(Ft()).split(";").filter((e=>s.test(Re(e).split("=")[0])))}const c=()=>{r("info","Parsing cookies for matches"),o();for(const e of Re(a())){let t=Re(location.hostname);!t&&Re(location.ancestorOrigins)&&Re(location.ancestorOrigins[0])&&(t=new Dt(Re(location.ancestorOrigins[0])).hostname);const o=Re(e).split("=")[0],i="expires=Thu, 01 Jan 1970 00:00:00 GMT",s="path=/",a=t.split(".");for(let e=a.length;e>0;e--){const t=a.slice(a.length-e).join(".");Ft(`${Re(o).trim()}=;${i};${s};domain=${t}`),Ft(`${Re(o).trim()}=;${i};${s};domain=.${t}`),r("success",`Set expiration date on ${o}`,"\nFILTER: cookie-remover",n)}}i()};if(c(),t){let e=a();setInterval((()=>{let t=a();if(t!==e)try{c()}finally{e=t}}),1e3)}},profile:Ne,debug:ze,"event-override":function(e,t,n=null){const r=Qe(arguments),i={eventType:e,mode:t,needle:n?_e(n):null,formattedArgs:r};if(Gt.includes(i)||Gt.push(i),Gt.length>1)return;let a=Ue("[event-override]");const{mark:c,end:u}=De("event-override"),d=zt.getOwnPropertyDescriptor(window.EventTarget.prototype,"addEventListener");d.configurable&&zt.defineProperty(window.EventTarget.prototype,"addEventListener",{...d,value:l(qt,(function(e,t,n){c();const r=Gt.filter((t=>t.eventType===e));if(!r.length||e!==r[0].eventType)return u(),o(qt,this,arguments);const i=r.find((e=>"disable"===e.mode&&(!e.needle||e.needle.test(t.toString()))));if(i)return a("success",`Disabling ${i.eventType} event, \nFILTER: event-override ${i.formattedArgs}`),void u();const l=r.filter((e=>"trusted"===e.mode&&(!e.needle||e.needle.test(t.toString()))));if("function"!=typeof t&&(!t||"function"!=typeof t.handleEvent)||!l.length||e!==l[0].eventType)return u(),o(qt,this,arguments);const d=function(e){const n=new Proxy(e,{get(t,n){if("isTrusted"===n)return a("success",`Providing trusted value for ${e.type} event`),!0;const r=Bt.get(t,n);return"function"==typeof r?function(...e){return o(r,t,e)}:r}});return"function"==typeof t?s(t,this,n):s(t.handleEvent,t,n)};return d.originalListener=t,Xt.has(t)||Xt.set(t,new Ht),Xt.get(t).set(e,d),a("info",`\nWrapping event listener for ${e}`),u(),o(qt,this,[e,d,n])}))});const f=zt.getOwnPropertyDescriptor(window.EventTarget.prototype,"removeEventListener");f.configurable&&zt.defineProperty(window.EventTarget.prototype,"removeEventListener",{...f,value:l(Ut,(function(e,t,n){if(t&&Xt.has(t)&&Xt.get(t).has(e)){const r=Xt.get(t).get(e);return Xt.get(t).delete(e),o(Ut,this,[e,r,n])}return o(Ut,this,arguments)}))}),a("info","Initialized event-override snippet")},"freeze-element":function(e,t="",...n){let r,i,a=!1,c=!1,l=Re(n).filter((e=>!h(e))),u=Re(n).filter((e=>h(e))).map(_e),d=Ke(),f=bn(e);!function(){let n=Re(t).split("+");1===n.length&&""===n[0]&&(n=[]);for(let t of n)switch(t){case"subtree":a=!0;break;case"abort":c=!0;break;default:throw new On("[freeze] Unknown option passed to the snippet. [selector]: "+e+" [option]: "+t)}}();let p={selector:e,shouldAbort:c,rid:d,exceptionSelectors:l,regexExceptions:u,changeId:0};function h(e){return e.length>=2&&"/"==e[0]&&"/"==e[e.length-1]}function g(){i=f(),m(i,!1)}function m(e,t=!0){for(let n of e)Cn.frozen.has(n)||(Cn.frozen.set(n,p),!t&&a&&new An((e=>{for(let t of Re(e))m(Re(t,"MutationRecord").addedNodes)})).observe(n,{childList:!0,subtree:!0}),a&&Re(n).nodeType===Tn&&m(Re(n).childNodes))}function w(e,...t){qe(`[freeze][${e}] `,...t)}function y(e,t,n,r){let o=r.selector,i=r.changeId,s="string"==typeof e,a=r.shouldAbort?"aborting":"watching";switch(Rn.groupCollapsed(`[freeze][${i}] ${a}: ${o}`),n){case"appendChild":case"append":case"prepend":case"insertBefore":case"replaceChild":case"insertAdjacentElement":case"insertAdjacentHTML":case"insertAdjacentText":case"innerHTML":case"outerHTML":w(i,s?"text: ":"node: ",e),w(i,"added to node: ",t);break;case"replaceWith":case"after":case"before":w(i,s?"text: ":"node: ",e),w(i,"added to node: ",Re(t).parentNode);break;case"textContent":case"innerText":case"nodeValue":w(i,"content of node: ",t),w(i,"changed to: ",e)}w(i,`using the function "${n}"`),Rn.groupEnd(),r.changeId++}function v(e,t){if(t)for(let n of t)if(n.test(e))return!0;return!1}function b(e){throw new In(e)}function E(e,t,n,r){let o=new Pn,{body:i}=Re(o.parseFromString(e,"text/html")),s=k(Re(i).childNodes,t,n,r);return Re(s).map((e=>{switch(Re(e).nodeType){case Tn:return Re(e).outerHTML;case Sn:return Re(e).textContent;default:return""}})).join("")}function k(e,t,n,r){let o=Re([]);for(let i of e)x(i,t,n,r)&&o.push(i);return o}function x(e,t,n,r){let o=r.shouldAbort,i=r.regexExceptions,s=r.exceptionSelectors,a=r.rid;if("string"==typeof e){let s=e;return!!v(s,i)||(He()&&y(s,t,n,r),o&&b(a),He())}let c=e;switch(Re(c).nodeType){case Tn:return!!function(e,t){if(t){let n=Re(e);for(let e of t)if(n.matches(e))return!0}return!1}(c,s)||(o&&(He()&&y(c,t,n,r),b(a)),!!He()&&(yn(c),y(c,t,n,r),!0));case Sn:return!!v(Re(c).textContent,i)||(He()&&y(c,t,n,r),o&&b(a),!1);default:return!0}}function T(e,t,n,r){let i=Wn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(n(this)){let n=r(this);if(n){let r=e[0];if(!x(r,this,t,n))return r}}return o(a,this,e)}}}function S(e,t,n,r){let i=Wn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(!n(this))return o(a,this,e);let i=r(this);if(!i)return o(a,this,e);let s=k(e,this,t,i);return s.length>0?o(a,this,s):void 0}}}function M(e,t,n,r){let i=Wn(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){let[i,c]=e,l="afterbegin"===i||"beforeend"===i;if(n(this,l)){let e=r(this,l);if(e){let n,r=l?this:Re(this).parentNode;switch(t){case"insertAdjacentElement":if(!x(c,r,t,e))return c;break;case"insertAdjacentHTML":return n=E(c,r,t,e),n?s(a,this,i,n):void 0;case"insertAdjacentText":if(!x(c,r,t,e))return}}}return o(a,this,e)}}}function L(e,t,n,r){let o=Wn(e,t)||{},{set:i}=o;if(i)return{set(e){if(!n(this))return s(i,this,e);let o=r(this);if(!o)return s(i,this,e);let a=E(e,this,t,o);return a?s(i,this,a):void 0}}}function $(e,t,n,r){let o=Wn(e,t)||{},{set:i}=o;if(i)return{set(e){if(!n(this))return s(i,this,e);let o=r(this);return o?x(e,this,t,o)?s(i,this,e):void 0:s(i,this,e)}}}Cn.frozen.has(document)||(Cn.frozen.set(document,!0),function(){let e;function t(e){return e&&Cn.frozen.has(e)}function n(e){try{return e&&(Cn.frozen.has(e)||Cn.frozen.has(Re(e).parentNode))}catch(e){return!1}}function r(e,t){try{return e&&(Cn.frozen.has(e)&&t||Cn.frozen.has(Re(e).parentNode)&&!t)}catch(e){return!1}}function o(e){return Cn.frozen.get(e)}function i(e){try{if(Cn.frozen.has(e))return Cn.frozen.get(e);let t=Re(e).parentNode;return Cn.frozen.get(t)}catch(e){}}function s(e,t){try{if(Cn.frozen.has(e)&&t)return Cn.frozen.get(e);let n=Re(e).parentNode;return Cn.frozen.get(n)}catch(e){}}e=T(Mn,"appendChild",t,o),dt(Mn,"appendChild",e),e=T(Mn,"insertBefore",t,o),dt(Mn,"insertBefore",e),e=T(Mn,"replaceChild",t,o),dt(Mn,"replaceChild",e),e=S(Ln,"append",t,o),dt(Ln,"append",e),e=S(Ln,"prepend",t,o),dt(Ln,"prepend",e),e=S(Ln,"replaceWith",n,i),dt(Ln,"replaceWith",e),e=S(Ln,"after",n,i),dt(Ln,"after",e),e=S(Ln,"before",n,i),dt(Ln,"before",e),e=M(Ln,"insertAdjacentElement",r,s),dt(Ln,"insertAdjacentElement",e),e=M(Ln,"insertAdjacentHTML",r,s),dt(Ln,"insertAdjacentHTML",e),e=M(Ln,"insertAdjacentText",r,s),dt(Ln,"insertAdjacentText",e),e=L(Ln,"innerHTML",t,o),dt(Ln,"innerHTML",e),e=L(Ln,"outerHTML",n,i),dt(Ln,"outerHTML",e),e=$(Mn,"textContent",t,o),dt(Mn,"textContent",e),e=$($n,"innerText",t,o),dt($n,"innerText",e),e=$(Mn,"nodeValue",t,o),dt(Mn,"nodeValue",e)}()),r=new An(g),r.observe(document,{childList:!0,subtree:!0}),g()},"hide-if-canvas-contains":function(e,t="canvas"){const n=Ue("hide-if-canvas-contains"),r=Qe(arguments),{mark:i,end:s}=De("hide-if-canvas-contains");if(!e)return void n("error","The parameter 'search' is required");if(!qn){i();const c=Nn.prototype;function u(e){const t=c[e];zn.defineProperty(window.CanvasRenderingContext2D.prototype,e,{value:l(t,(function(r,...i){for(const[t,o]of qn)if(t.test(r)){const t=this.canvas;let i=Re(t).closest(o.selector);i&&!Xn.has(i)?(yn(i),Xn.add(i),n("success","Matched: ",i,`\nFILTER: hide-if-canvas-contains ${o.formattedArguments}`)):Gn(t,o,e,r)}return o(t,this,[r,...i])}))})}n("info","CanvasRenderingContext2D proxied"),u("fillText"),u("strokeText"),qn=new Fn;new Hn((e=>{for(let t of Re(e))"childList"===t.type&&Un.forEach((({canvasElement:e,rule:t,functionName:n,text:r})=>{let o=Re(e).closest(t.selector);o&&!Xn.has(o)&&(yn(o),Xn.add(o),Un.delete({canvasElement:e,rule:t,functionName:n,text:r}),Ue("hide-if-canvas-contains")("success","Matched: ",o,`\nFILTER: hide-if-canvas-contains ${t.formattedArguments}`))}))})).observe(Dn,{childList:!0,subtree:!0}),s()}const a=_e(e);qn.set(a,{selector:t,formattedArguments:r})},"hide-if-shadow-contains":function(e,t="*"){const n=Qe(arguments);let r=`${e}\\${t}`;lr.has(r)||lr.set(r,[_e(e),t,er("hide-if-shadow-contains",(()=>{lr.delete(r)}))],n);const i=Ue("hide-if-shadow-contains"),{mark:s,end:a}=De("hide-if-shadow-contains");ur||(ur=new nr((e=>{s();let t=new or;for(let{target:r}of Re(e)){let e=Re(r).parentNode;for(;e;)[r,e]=[e,Re(r).parentNode];if(!cr.has(r)&&!t.has(r)){t.add(r);for(let[e,t,o]of lr.values())if(e.test(Re(r).textContent)){let e=Re(r.host).closest(t);e&&(o(),Re(r).appendChild(document.createElement("style")).textContent=":host {display: none !important}",yn(e),cr.add(r),i("success","Hiding: ",e,`\nFILTER: hide-if-shadow-contains ${n}`)),a()}}}})),rr.defineProperty(sr,"attachShadow",{value:l(ar,(function(){let e=o(ar,this,arguments);return i("info","attachShadow is called for: ",e),ur.observe(e,{childList:!0,characterData:!0,subtree:!0}),e}))}))},"json-override":function(e,t,n="",r=""){if(!e)throw new fr("[json-override snippet]: Missing paths to override.");if(void 0===t)throw new fr("[json-override snippet]: No value to override with.");if(!wr){let s=Ue("json-override");const{mark:a,end:c}=De("json-override");function u(e,t){for(let{formattedArgs:n,prune:r,needle:o,filter:i,value:s}of wr.values())if(!i||i.test(t)){if(Re(o).some((t=>!wt(e,t))))return e;for(let t of r)t.includes("{}")||t.includes("[]")?d(e,t,s,n):f(e,t,s,n)}return e}function d(e,t,n,r){let o=Re(t).split("."),i=e;for(let e=0;e<o.length;e++){let a=o[e];if("[]"===a)return void(dr.isArray(i)&&(s("info",`Iterating over array at: ${a}`),Re(i).forEach((t=>{null!=t&&d(t,o.slice(e+1).join("."),n,r)}))));if("{}"===a)return void(i&&"object"==typeof i&&(s("info",`Iterating over object at: ${a}`),gr.keys(i).forEach((t=>{let s=i[t];null!=s&&d(s,o.slice(e+1).join("."),n,r)}))));if(!i||"object"!=typeof i||!y(i,a))return;e===o.length-1?(s("success",`Found ${t}, replaced it with ${n}`,`\nFILTER: json-override ${r}`),i[a]=vt(n)):i=i[a]}}function f(e,t,n,r){let o=wt(e,t);void 0!==o&&(s("success",`Found ${t}, replaced it with ${n}`,`\nFILTER: json-override ${r}`),o[0][o[1]]=vt(n))}a();let{parse:p}=pr;wr=new hr,gr.defineProperty(window.JSON,"parse",{value:l(p,(function(e){return u(o(p,this,arguments),e)}))}),s("info","Wrapped JSON.parse for override");let{json:h}=mr.prototype;gr.defineProperty(window.Response.prototype,"json",{value:l(h,(function(e){return o(h,this,arguments).then((t=>u(t,e)))}))}),s("info","Wrapped Response.json for override"),c()}const i=Qe(arguments);wr.set(e,{formattedArgs:i,prune:Re(e).split(/ +/),needle:n.length?Re(n).split(/ +/):[],filter:r?_e(r):null,value:t})},"json-prune":function(e,t="",n=""){if(!e)throw new vr("Missing paths to prune");if(!Sr){let i=Ue("json-prune");const{mark:s,end:a}=De("json-prune");function c(e){for(let{prune:t,needle:n,stackNeedle:r,formattedArgs:o}of Sr.values()){if(Re(n).length>0&&Re(n).some((t=>!wt(e,t))))return e;if(Re(r)&&Re(r).length>0&&!f(r))return e;for(let n of t)n.includes("{}")||n.includes("[]")?u(e,n,o):d(e,n,o)}return e}function u(e,t,n){let r=Re(t).split("."),o=e;for(let e=0;e<r.length;e++){let s=r[e];if("[]"===s)return void(yr.isArray(o)&&(i("info",`Iterating over array at: ${s}`),Re(o).forEach((t=>u(t,r.slice(e+1).join("."),n)))));if("{}"===s)return void("object"==typeof o&&null!==o&&(i("info",`Iterating over object at: ${s}`),kr.keys(o).forEach((t=>u(o[t],r.slice(e+1).join("."),n)))));if(!o||"object"!=typeof o||!y(o,s))return;e===r.length-1?(i("success",`Found ${t} and deleted, \nFILTER: json-prune ${n}`),delete o[s]):o=o[s]}}function d(e,t,n){let r=wt(e,t);void 0!==r&&(i("success",`Found ${t} and deleted`,`\nFILTER: json-prune ${n}`),delete r[0][r[1]])}function f(e){if(!e)return!1;const t=Ke(),n=new vr(t),r=new Tr(self.location.href);r.hash="";const o=/(.*?@)?(\S+)(:\d+):\d+\)?$/,s=[];for(let e of n.stack.split(/[\n\r]+/)){if(Re(e).includes(t))continue;e=Re(e).trim();const n=Re(o).exec(e);if(null===n)continue;let i=n[2];Re(i).startsWith("(")&&(i=Re(i).slice(1)),i===r.href?i="inlineScript":Re(i).startsWith("<anonymous>")&&(i="injectedScript");let a=n[1]?Re(n[1]).slice(0,-1):Re(e).slice(0,Re(n).index).trim();Re(a).startsWith("at")&&(a=Re(a).slice(2).trim());let c=n[3];Re(s).push(" "+`${a} ${i}${c}:1`.trim())}s[0]="stackDepth:"+(s.length-1);const a=Re(s).join("\n");for(let t of e){if(_e(t).test(a))return i("info",`Found needle in stack trace: ${t}`),!0;i("info",`Needle ${t} not found in stack trace: ${a}`)}}s();let{parse:p}=br;Sr=new Er,kr.defineProperty(window.JSON,"parse",{value:l(p,(function(){return c(o(p,this,arguments))}))}),i("info","Wrapped JSON.parse for prune");let{json:h}=xr.prototype;kr.defineProperty(window.Response.prototype,"json",{value:l(h,(function(){return o(h,this,arguments).then((e=>c(e)))}))}),i("info","Wrapped Response.json for prune"),a()}const r=Qe(arguments);Sr.set(e,{formattedArgs:r,prune:Re(e).split(/ +/),needle:t.length?Re(t).split(/ +/):[],stackNeedle:n.length?Re(n).split(/ +/):[]})},"override-property-read":function(e,t,n){if(!e)throw new Mr("[override-property-read snippet]: No property to override.");if(void 0===t)throw new Mr("[override-property-read snippet]: No value to override with.");const r=Qe(arguments);let o=Ue("override-property-read");const{mark:i,end:s}=De("override-property-read");let a=vt(t);o("info",`Overriding ${e}.`);const c=!("false"===n);i(),dt(window,e,{get:()=>(o("success",`${e} override done.`,"\nFILTER: override-property-read",r),a),set(){}},c),s()},"prevent-listener":function(e,t,n){if(!e)throw new Lr("[prevent-listener snippet]: No event type.");if(!jr){jr=new $r;let e=Ue("[prevent]");const{mark:t,end:n}=De("prevent-listener");Rr.defineProperty(Or,"addEventListener",{value:l(Ar,(function(r,i){t();for(let{evt:t,handlers:n,selectors:o}of jr.values()){if(!t.test(r))continue;let a=this instanceof Element;for(let l=0;l<n.length;l++){const u=n[l],d=o[l];if(!d||a&&Re(this).matches(d)){if(u){const t=function(){try{const e=String("function"==typeof i?i:i.handleEvent);return u.test(e)}catch(t){return e("error","Error while trying to stringify listener: ",t),!1}};if(!function(){try{const e=s(Pr,"function"==typeof i?i:i.handleEvent);return u.test(e)}catch(t){return e("error","Error while trying to stringify listener: ",t),!1}}()&&!t())continue}return void(He()&&(Cr.groupCollapsed("DEBUG [prevent] was successful",`\nFILTER: prevent-listener ${c}`),e("success",`type: ${r} matching ${t}`),e("success","handler:",i),u&&e("success",`matching ${u}`),d&&e("success","on element: ",this,` matching ${d}`),e("success","was prevented from being added"),Cr.groupEnd()))}}}return n(),o(Ar,this,arguments)}))}),e("info","Wrapped addEventListener")}const r=Qe(arguments);jr.has(e)||jr.set(e,{evt:_e(e),handlers:[],selectors:[],formattedArgs:r});let{handlers:i,selectors:a,formattedArgs:c}=jr.get(e);i.push(t?_e(t):null),a.push(n)},"replace-fetch-response":function(e,t="",n=null){const r=Qe(arguments),o=Ue("replace-fetch-response"),{mark:i,end:s}=De("replace-fetch-response");if(!e)return void o("error","The parameter 'search' is required");if(!Hr){const e=e=>{i();return Re(e).clone().text().then((t=>{let n=Re(t);for(const[e,{replacement:r,needle:i,formattedArgs:s}]of Hr){if(i){if(!_e(i).test(n)){He()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] warn: '${i}' not found in fetch response`),o("warn",`${n}`),console.groupEnd());continue}He()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] success: '${i}' found in fetch response`),o("info",`${n}`),console.groupEnd())}n=n.replace(e,r),He()&&n.toString()!==t.toString()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] success: '${e}' replaced with '${r}' in fetch response`,`\nFILTER: replace-fetch-response ${s}`),o("success",`${n}`),console.groupEnd())}if(n.toString()===t.toString())return e;const r=new qr(n.toString(),{status:e.status,statusText:e.statusText,headers:e.headers});return Br.defineProperties(r,{ok:{value:e.ok},redirected:{value:e.redirected},type:{value:e.type},url:{value:e.url}}),s(),r}))};Hr=new zr,o("info","Network API proxied"),a=e,Dr.push(a),Fr()}var a;const c=_e(e),l=new Vr(c,"g");Hr.set(l,{replacement:t,needle:n,formattedArgs:r})},"replace-xhr-response":function(e,t="",n=null){const r=Qe(arguments),o=Ue("replace-xhr-response"),{mark:i,end:s}=De("replace-xhr-response");if(!e)return void o("error","The parameter 'pattern' is required");Ur||(Ur=new _r,Xr=new Map,o("info","XMLHttpRequest proxied"),window.XMLHttpRequest=class extends Jr{open(e,t,...n){const r={method:e,url:t};return Ur.set(this,r),super.open(e,t,...n)}send(...e){return super.send(...e)}get response(){const e=super.response,t=Ur.get(this);if(void 0===t)return e;i();const n="string"==typeof e?e.length:void 0;if(t.lastResponseLength!==n&&(t.response=void 0,t.lastResponseLength=n),void 0!==t.response)return t.response;if("string"!=typeof e)return t.response=e;let r=e;for(const[t,{replacement:n,needle:i,formattedArgs:s}]of Xr){if(i){if(!_e(i).test(r)){He()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] warn: '${i}' not found in XHR response`),o("warn",r),console.groupEnd());continue}He()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] success: '${i}' found in XHR response`),o("info",r),console.groupEnd())}r=Re(r).replace(t,n).toString(),He()&&e.toString()!==r.toString()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] success: '${t}' replaced with '${n}' in XHR response`,`\nFILTER: replace-xhr-response ${s}`),o("success",r),console.groupEnd())}return s(),t.response=r.toString()}get responseText(){const e=this.response;return"string"!=typeof e?super.responseText:e}});const a=_e(e),c=new Gr(a,"g");Xr.set(c,{replacement:t,needle:n,formattedArgs:r})},"strip-fetch-query-parameter":function(e,t=null){const n=Qe(arguments),r=Ue("strip-fetch-query-parameter"),{mark:o,end:i}=De("strip-fetch-query-parameter"),s=e=>{o();for(let[t,n]of Kr.entries()){const{reg:o,args:i}=n;o&&!o.test(e)||Yr(e.searchParams,t)&&(r("success",`${t} has been stripped from url ${e}`,`\nFILTER: strip-fetch-query-parameter ${i}`),Qr(e.searchParams,t))}i()};var a;Kr||(Kr=new Map,a=s,Nr.push(a),Fr()),Kr.set(e,{reg:t&&_e(t),args:n})},trace:function(...e){o(qe,null,e)}};let{MutationObserver:eo,WeakSet:to,getComputedStyle:no}=Re(window);let{clearTimeout:ro,fetch:oo,getComputedStyle:io,setTimeout:so,Map:ao,MutationObserver:co,Uint8Array:lo}=Re(window);let uo=new ao;function fo(e,{as:t="arrayBuffer",cleanup:n=6e4}={}){let r=t+":"+e,o=uo.get(r)||{remove:()=>uo.delete(r),result:null,timer:0};return ro(o.timer),o.timer=so(o.remove,n),o.result||(o.result=oo(e).then((e=>e[t]())).catch(o.remove),uo.set(r,o)),o.result}const{parseFloat:po,Math:ho,MutationObserver:go,WeakSet:mo}=Re(window),{min:wo}=ho,yo=(e,t)=>{const n=e.length+1,r=t.length+1,o=[[0]];let i=0,s=0;for(;++i<r;)o[0][i]=i;for(i=0;++i<n;){const n=e[s];let a=0,c=0;for(o[i]=[i];++a<r;)o[i][a]=wo(o[s][a]+1,o[i][c]+1,o[s][c]+(n!=t[c])),++c;++s}return o[n-1][r-1]};let{getComputedStyle:vo,Map:bo,WeakSet:Eo,parseFloat:ko,DOMMatrix:xo,Math:To}=Re(window);const{ELEMENT_NODE:So,TEXT_NODE:Mo}=Node;let{MutationObserver:Lo,WeakSet:$o,getComputedStyle:Ro}=Re(window);let{getComputedStyle:Co,MutationObserver:Po,WeakSet:Oo}=Re(window);let{MutationObserver:Ao,WeakSet:jo}=Re(window);const{ELEMENT_NODE:Io}=Node;let{MutationObserver:Wo,WeakSet:No}=Re(window);const{ELEMENT_NODE:Do}=Node;let{parseInt:Fo,setTimeout:Ho,Error:zo,MouseEvent:Bo,MutationObserver:Vo,WeakSet:qo}=Re(window);const Uo=["auxclick","click","dblclick","gotpointercapture","lostpointercapture","mouseenter","mousedown","mouseleave","mousemove","mouseout","mouseover","mouseup","pointerdown","pointerenter","pointermove","pointerover","pointerout","pointerup","pointercancel","pointerleave"];let{isNaN:Xo,MutationObserver:Go,parseInt:Jo,parseFloat:_o,setTimeout:Ko}=Re(window);const Qo={...Zr,...{log:qe,race:function(e,t="1"){switch(e){case"start":Yn={winners:Qn(t,10)||1,participants:new Kn},Zn=new Jn;break;case"end":case"finish":case"stop":Yn=null;for(let e of Zn)e();Zn=null;break;default:throw new _n(`Invalid action: ${e}`)}},debug:ze,profile:Ne,"hide-if-matches-xpath":function(e,t,n){const{mark:r,end:o}=De("hide-if-matches-xpath"),i=Qe(arguments),s=Ue("hide-if-matches-xpath");bt(s,(()=>{const n=n=>{const a=vn(`xpath(${e})`),c=new jo,l=e=>{c.add(e),f(),Re(e).nodeType===Io?yn(e):Re(e).textContent="",s("success","Matched: ",e,"\nFILTER: hide-if-matches-xpath",i)},u=()=>{r(),a((e=>{if(c.has(e))return!1;if(t){vn(`xpath(${t})`)((t=>{if(!t.contains(e))return!1;l(e)}))}else l(e)})),o()},d=new Ao(u),f=er("hide-if-matches-xpath",(()=>d.disconnect()));d.observe(n,{characterData:!0,childList:!0,subtree:!0}),u()};if(t){let e,r=0;const o=vn(`xpath(${t})`),i=()=>{o((e=>{n(e),r++})),r>0&&e.disconnect()};e=new Ao(i),e.observe(document,{characterData:!0,childList:!0,subtree:!0}),i()}else n(document)}),n)},"hide-if-matches-computed-xpath":function(e,t,n,r){const{mark:o,end:i}=De("hide-if-matches-computed-xpath"),s=Qe(arguments),a=Ue("hide-if-matches-computed-xpath");if(!t||!e)return void a("error","No query or searchQuery provided.");const c=t=>{const n=(t=>e.replace("{{}}",t))(t);a("info","Starting hiding elements that match query: ",n);const r=vn(`xpath(${n})`),c=new No,l=()=>{o(),r((e=>{if(c.has(e))return!1;c.add(e),d(),Re(e).nodeType===Do?yn(e):Re(e).textContent="",a("success","Matched: ",e,"\nFILTER: hide-if-matches-computed-xpath",s)})),i()},u=new Wo(l),d=er("hide-if-matches-computed-xpath",(()=>u.disconnect()));u.observe(document,{characterData:!0,childList:!0,subtree:!0}),l()},l=_e(n);bt(a,(()=>{if(t){a("info","Started searching for: ",t);const e=new No;let n;const r=vn(`xpath(${t})`),o=()=>{r((t=>{if(e.has(t))return!1;if(e.add(t),a("info","Found node: ",t),t.innerHTML){a("info","Searching in: ",t.innerHTML);const e=t.innerHTML.match(l);if(e&&e.length){let t="";t=e[1]?e[1]:e[0],a("info","Matched search query: ",t),c(t)}}}))};n=new Wo(o),n.observe(document,{characterData:!0,childList:!0,subtree:!0}),o()}}),r)},"hide-if-contains":function(e,t="*",n=null){const r=Qe(arguments),o=Ue("hide-if-contains"),{mark:i,end:s}=De("hide-if-contains");let a=_e(e);const c=En((e=>a.test(Re(e).textContent)),t,n,(e=>{i(),o("success","Matched: ",e,"\nFILTER: hide-if-contains",r),s()}));c.race(er("hide-if-contains",(()=>{c.disconnect()})))},"hide-if-contains-similar-text":function(e,t,n=null,r=0,o=0){const i=new mo,s=Qe(arguments),a=Ue("hide-if-contains-similar-text"),{mark:c,end:l}=De("hide-if-contains-similar-text"),u=Re(e),{length:d}=u,f=d+po(r)||0,p=Re([...u]).sort(),h=po(o)||1/0;null==n&&(n=t),a("info","Looking for similar text: "+u);const g=()=>{c();for(const{element:e,rootParents:o}of ln(n,!0)){if(i.has(e))continue;i.add(e);const{innerText:n}=Re(e),c=wo(h,n.length-f+1);for(let i=0;i<c;i++){const c=Re(n).substr(i,f);if(yo(p,Re([...c]).sort())-r<=0){const n=pn(Re(e),t,o);if(a("success","Found similar text: "+u,n,"\nFILTER: hide-if-contains-similar-text",s),n){w(),yn(n);break}}}}l()};let m=new go(g),w=er("hide-if-contains-similar-text",(()=>m.disconnect()));m.observe(document,{childList:!0,characterData:!0,subtree:!0}),g()},"hide-if-contains-visible-text":function(e,t,n=null,...r){const{mark:o,end:i}=De("hide-if-contains-visible-text"),s=Qe(arguments);let a=Re([]);const c=new bo([["-snippet-box-margin","2"],["-disable-bg-color-check","false"],["-check-is-contained","false"],["-pseudo-box-margin","2"],["-ignore-padding","false"]]);for(let e of r){e=Re(e);let t=e.indexOf(":");if(t<0)continue;let n=e.slice(0,t).trim().toString(),r=e.slice(t+1).trim().toString();n&&r&&(c.has(n)?c.set(n,r):a.push([n,r]))}let l=Re([["opacity","0"],["font-size","0px"],["color","rgba(0, 0, 0, 0)"]]),u=new bo(l.concat(a));function d(e,t,{bgColorCheck:n=!0,pseudoElemCheck:r=!1}={}){t||(t=vo(e)),t=Re(t);for(const[e,n]of u){if(_e(n).test(t.getPropertyValue(e)))return!1}const o=t.getPropertyValue("color");if(n&&t.getPropertyValue("background-color")===o)return!1;if(!r){const t=vo(e,"::first-line");if(t)return d(e,t,{bgColorCheck:n,pseudoElemCheck:!0})}const i=t.getPropertyValue("text-shadow");return!o.includes("rgba(0, 0, 0, 0)")||"none"!==i&&!i.includes("rgba(0, 0, 0, 0)")}function f(e,t=null){let n=vo(e,t).transform;return"none"===n&&(n="matrix(1, 0, 0, 1, 0, 0)"),new xo(n)}function p(e,t,n,{bgColorCheck:r=!0,translateThresh:o=2}={}){let i=vo(e,t);if(!kn(e,i)||!d(e,i,{bgColorCheck:r}))return"";let{content:s}=Re(i);if(s&&"none"!==s){let r=Re([]);const i=f(e,t),a=n.multiply(i),c=To.atan2(a.b,a.a)*(180/To.PI);if(To.abs(c)>5)return"";return To.abs(a.e)>o||To.abs(a.f)>o?"":(s=Re(s).trim().replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,(e=>""+(r.push(Re(e).slice(1,-1))-1))),s=s.replace(/\s*attr\(\s*([^\s,)]+)[^)]*?\)\s*/g,((t,n)=>Re(e).getAttribute(n)||"")),s.replace(/\x01(\d+)/g,((e,t)=>r[t])))}return""}function h(e,t,{boxMargin:n=2,ignorePadding:r=!1}={}){let o=Re(e).getBoundingClientRect();if(r){const t=vo(e),n=ko(t.paddingTop)||0,r=ko(t.paddingRight)||0,i=ko(t.paddingBottom)||0,s=ko(t.paddingLeft)||0;o={left:o.left+s,right:o.right-r,top:o.top+n,bottom:o.bottom-i}}const i=Re(t).getBoundingClientRect(),s=i.left-n,a=i.right+n,c=i.top-n,l=i.bottom+n;return s<=o.left&&o.left<=a&&c<=o.top&&o.top<=l&&c<=o.bottom&&o.bottom<=l&&s<=o.right&&o.right<=a}function g(e,t,n,r,o,i,s,{boxMargin:a=2,bgColorCheck:c,checkIsContained:l,translateThresh:u}={}){let m=!n;if(m&&(n=vo(e)),!kn(e,n,m&&t,i))return"";r||"hidden"!==Re(n).getPropertyValue("overflow-x")&&"hidden"!==Re(n).getPropertyValue("overflow-y")||(r=e);let w=p(e,":before",s=s?s.multiply(f(e)):f(e),{bgColorCheck:c,translateThresh:u});for(let t of function(e,t=!0){const n=cn(e,t);return n?n.childNodes:Re(e).childNodes}(Re(e)))switch(Re(t).nodeType){case So:w+=g(t,e,vo(t),r,o,i,s,{boxMargin:a,bgColorCheck:c,checkIsContained:l,translateThresh:u});break;case Mo:if(r)h(e,r,{boxMargin:a,ignorePadding:b})&&d(e,n,{bgColorCheck:c})&&(w+=Re(t).nodeValue);else if(d(e,n,{bgColorCheck:c})){if(l&&!h(e,o,{boxMargin:a,ignorePadding:b}))continue;w+=Re(t).nodeValue}}return w+=p(e,":after",s,{bgColorCheck:c,translateThresh:u}),w}const m=c.get("-snippet-box-margin"),w=ko(m)||0,y=!("true"===c.get("-disable-bg-color-check")),v="true"===c.get("-check-is-contained"),b="true"===c.get("-ignore-padding"),E=c.get("-pseudo-box-margin"),k=ko(E)||0;let x=_e(e),T=new Eo;const S=En(((e,t,n)=