@eyeo/snippets
Version:
eye/o snippets for Ads blocker
20 lines (19 loc) • 69 kB
JavaScript
/*!
* 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/>.
*/
let currentEnvironment = {initial: true};
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);"undefined"!=typeof currentEnvironment&¤tEnvironment.initial&&"undefined"!=typeof environment&&(currentEnvironment=environment);const k=()=>"undefined"!=typeof currentEnvironment?currentEnvironment:"undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:x,ownKeys:S}=d(Reflect),T=k(),$="world"in T,M=$&&"ISOLATED"===T.world,L=$&&"MAIN"===T.world,R="object"==typeof chrome&&!!chrome.runtime,C="object"==typeof browser&&!!browser.runtime,j=!L&&(M||R||C),P=e=>j?e:O(e,F(e)),{create:O,defineProperties:A,defineProperty:N,freeze:I,getOwnPropertyDescriptor:W,getOwnPropertyDescriptors:F}=d(Object),D=d(globalThis),H=j?globalThis:E(globalThis),{Map:z,RegExp:B,Set:V,WeakMap:q,WeakSet:U}=H,G=(e,t,n=null)=>{const r=S(t);for(const o of S(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))}N(t,o,i)}},J=e=>{const t=H[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 G(t,n,s),G(t.prototype,n.prototype,s),n},X=I({frozen:new q,hidden:new U,iframePropertiesToAbort:{read:new V,write:new V},abortedIframes:new q}),_=new B("^[A-Z]"),K=j&&(R&&chrome||C&&browser)||void 0;var Q=new Proxy(new z([["chrome",K],["browser",K],["isExtensionContext",j],["variables",X],["console",P(console)],["document",globalThis.document],["JSON",P(JSON)],["Map",z],["Math",P(Math)],["Number",j?Number:J("Number")],["RegExp",B],["Set",V],["String",j?String:J("String")],["WeakMap",q],["WeakSet",U],["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let n=globalThis[t];return"function"==typeof n&&(n=(_.test(t)?H:D)[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const Y={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Z}=Reflect;const{Map:ee,WeakMap:te,WeakSet:ne,setTimeout:re}=Q;let oe=!0,ie=e=>{e.clear(),oe=!oe};var se=function(e){const{WeakSet:t,WeakMap:n,WeakValue:r}=this||Y,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=Z(e,this,arguments);return o.add(n),n!==t&&("object"==typeof t&&t?i:s).set(t,n),n}}.bind({WeakMap:te,WeakSet:ne,WeakValue:class extends ee{set(e,t){return oe&&(oe=!oe,re(ie,0,this)),super.set(e,t)}}});const{concat:ae,includes:ce,join:le,reduce:ue,unshift:de}=c([]),fe=E(globalThis),{Map:pe,WeakMap:he}=fe,ge=new pe,me=t=>{const n=(e=>{const t=[];let n=e;for(;n;){if(ge.has(n))de(t,ge.get(n));else{const e=m(n);ge.set(n,e),de(t,e)}n=w(n)}return de(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:we,Array:ye,Number:ve,String:be,Object:Ee}=Q,{isArray:ke}=ye,{getOwnPropertyDescriptor:xe,setPrototypeOf:Se}=Ee,{toString:Te}=Ee.prototype,{slice:$e}=be.prototype,{get:Me}=xe(Node.prototype,"nodeType"),Le=we?{}:{Attr:me(Attr),CanvasRenderingContext2D:me(CanvasRenderingContext2D),CSSStyleDeclaration:me(CSSStyleDeclaration),Document:me(Document),Element:me(Element),HTMLCanvasElement:me(HTMLCanvasElement),HTMLElement:me(HTMLElement),HTMLImageElement:me(HTMLImageElement),HTMLScriptElement:me(HTMLScriptElement),MutationRecord:me(MutationRecord),Node:me(Node),ShadowRoot:me(ShadowRoot),get CSS2Properties(){return Le.CSSStyleDeclaration}},Re=(e,t)=>{if("Element"!==t&&t in Le)return Le[t](e);if(ke(e))return Se(e,ye.prototype);const n=(e=>s($e,s(Te,e),8,-1))(e);if(n in Le)return Le[n](e);if(n in Q)return Se(e,Q[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 Ce=we?e=>e===window||e===globalThis?Q:e:se(((e,t="Element")=>{if(e===window||e===globalThis)return Q;switch(typeof e){case"object":return e&&Re(e,t);case"string":return new be(e);case"number":return new ve(e);default:throw new Error("unsupported value")}}));const je={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,je);let{Math:Oe,setInterval:Ae,performance:Ne}=Ce(window);const Ie={mark(){},end(){},toString:()=>"{mark(){},end(){}}"};let We=!0;function Fe(){We=!1}function De(e,t=10){if(We)return Ie;function n(){let e=Ce([]);for(let{name:t,duration:n}of Ne.getEntriesByType("measure"))e.push({name:t,duration:n});e.length&&Ne.clearMeasures()}return De[e]||(De[e]=Ae(n,Oe.round(6e4/Oe.min(60,t)))),{mark(){Ne.mark(e)},end(t=!1){Ne.measure(e,e);const r=Ne.getEntriesByName(e,"measure"),o=r.length>0?r[r.length-1]:null;console.log("PROFILER:",o),Ne.clearMarks(e),t&&(clearInterval(De[e]),delete De[e],n())}}}let He=!1;function ze(){return He}function Be(){He=!0}const{console:Ve}=Ce(window),qe=()=>{};function Ue(...e){let{mark:t,end:n}=De("log");if(ze()){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",Ce(e).splice(n,1)):-1!==r?(t[0]+=" - WARNING",t[1]+="color: orange; border:2px solid orange ",Ce(e).splice(r,1)):-1!==o?(t[0]+=" - SUCCESS",t[1]+="color: green; border:2px solid green",Ce(e).splice(o,1)):-1!==i&&(t[1]+="color: black;",Ce(e).splice(i,1)),Ce(e).unshift(...t)}t(),Ve.log(...e),n()}function Ge(e){return i(ze()?Ue:qe,null,e)}let{Array:Je,Math:Xe,RegExp:_e}=Ce(window);function Ke(e){let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||t>2&&Ce(e).endsWith("/i")){let t=[Ce(e).slice(1,n?-1:-2)];return n||t.push("i"),new _e(...t)}}return new _e(Ce(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}function Qe(){return Ce(Xe.floor(2116316160*Xe.random()+60466176)).toString(36)}function Ye(e){return Ce(Je.from(e)).map((e=>`'${e}'`)).join(" ")}function Ze(e){return e.reduce(((e,t)=>e+function(e,t=2){let n=Ce(e).toString(16);return n.length<t&&(n=Ce("0").repeat(t-n.length)+n),n}(t)),"")}let{parseFloat:et,variables:tt,clearTimeout:nt,fetch:rt,setTimeout:ot,Array:it,Error:st,Map:at,Object:ct,ReferenceError:lt,Set:ut,WeakMap:dt}=Ce(window),{onerror:ft}=Pe(window),pt=Node.prototype,ht=Element.prototype,gt=null;function mt(e,t,n,r=!0){let o=Ce(t),i=o.indexOf(".");if(-1==i){let o=ct.getOwnPropertyDescriptor(e,t);if(o&&!o.configurable)return;let i=ct.assign({},n,{configurable:r});if(!o&&!i.get&&i.set){let n=e[t];i.get=()=>n}return void ct.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||mt(a,t,n);let c=ct.getOwnPropertyDescriptor(e,s);if(c&&!c.configurable)return;gt||(gt=new dt),gt.has(e)||gt.set(e,new at);let l=gt.get(e);if(l.has(s))return void l.get(s).set(t,n);let u=new at([[t,n]]);l.set(s,u),ct.defineProperty(e,s,{get:()=>a,set(e){if(a=e,a&&("object"==typeof a||"function"==typeof a))for(let[e,t]of u)mt(a,e,t)},configurable:r})}function wt(e){let t=ft();ft(((...n)=>{let r=n.length&&n[0];return!("string"!=typeof r||!Ce(r).includes(e))||("function"==typeof t?o(t,this,n):void 0)}))}function yt(e,t,n,r="",o=!0){let i=Ge(e);if(!n)return void i("error","no property to abort on read");let s=Qe();i("info",`aborting on ${n} access`),mt(t,n,{get:function(){throw i("success",`${n} access aborted`,`\nFILTER: ${e} ${r}`),new lt(s)},set(){}},o),wt(s)}function vt(e,t,n,r="",o=!0){let i=Ge(e);if(!n)return void i("error","no property to abort on write");let s=Qe();i("info",`aborting when setting ${n}`),mt(t,n,{set:function(){throw i("success",`setting ${n} aborted`,`\nFILTER: ${e} ${r}`),new lt(s)}},o),wt(s)}function bt(e,t=!1,n=!1){let r=tt.abortedIframes,i=tt.iframePropertiesToAbort;const a=Ye(e);for(let o of it.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 it.from(window.frames)){r.has(e)||r.set(e,{read:new ut(i.read),write:new ut(i.write)});let t=r.get(e).read;if(t.size>0){let n=it.from(t);t.clear();for(let{property:t,formattedProperties:r}of n)yt("abort-on-iframe-property-read",e,t,r)}let n=r.get(e).write;if(n.size>0){let t=it.from(n);n.clear();for(let{property:n,formattedProperties:r}of t)vt("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){mt(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=ct.getOwnPropertyDescriptor(t,n),{set:o}=r||{};return{set(t){let n;return n=s(o,this,t),e&&e(),n}}}n(pt,["appendChild","insertBefore","replaceChild"]),n(ht,["append","prepend","replaceWith","after","before","insertAdjacentElement","insertAdjacentHTML"]),t=i(ht,"innerHTML"),mt(ht,"innerHTML",t),t=i(ht,"outerHTML"),mt(ht,"outerHTML",t)}(c))}let{Object:Et}=window;function kt(e,t){if(!(e instanceof Et))return;let n=e,r=Ce(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 Et))return}let o=r[r.length-1];return y(n,o)?[n,o]:void 0}const xt=Ce(/^\d+$/);function St(e){switch(e){case"false":return!1;case"true":return!0;case"falseStr":return"false";case"trueStr":return"true";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:return xt.test(e)?et(e):e}}function Tt(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()}function $t(e,t){if(!e||!e.length)return!0;const n=Qe(),r=new st(n),o=new URL(self.location.href);o.hash="";const i=/(.*?@)?(\S+)(:\d+):\d+\)?$/,s=[];for(let e of r.stack.split(/[\n\r]+/)){if(Ce(e).includes(n))continue;e=Ce(e).trim();const t=Ce(i).exec(e);if(null===t)continue;let r=t[2];Ce(r).startsWith("(")&&(r=Ce(r).slice(1)),r===o.href?r="inlineScript":Ce(r).startsWith("<anonymous>")&&(r="injectedScript");let a=t[1]?Ce(t[1]).slice(0,-1):Ce(e).slice(0,Ce(t).index).trim();Ce(a).startsWith("at")&&(a=Ce(a).slice(2).trim());let c=t[3];Ce(s).push(" "+`${a} ${r}${c}:1`.trim())}s[0]="stackDepth:"+(s.length-1);const a=Ce(s).join("\n");for(let n of e){if(Ke(n).test(a))return t("info",`Found needle in stack trace: ${n}`),!0}return t("info",`Stack trace does not match any needle. Stack trace: ${a}`),!1}let Mt=new at;function Lt(e,{as:t="arrayBuffer",cleanup:n=6e4}={}){let r=t+":"+e,o=Mt.get(r)||{remove:()=>Mt.delete(r),result:null,timer:0};return nt(o.timer),o.timer=ot(o.remove,n),o.result||(o.result=rt(e).then((e=>e[t]())).catch(o.remove),Mt.set(r,o)),o.result}let{HTMLScriptElement:Rt,Object:Ct,ReferenceError:jt}=Ce(window),Pt=Ct.getPrototypeOf(Rt);const{Error:Ot,Object:At,Array:Nt,Map:It}=Ce(window);let Wt=null;function Ft(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:Dt,Blob:Ht,Error:zt,Object:Bt,Reflect:Vt}=Ce(window),qt=[];let{Error:Ut,URL:Gt}=Ce(window),{cookie:Jt}=Pe(document);const{Map:Xt,Object:_t,Reflect:Kt,WeakMap:Qt}=Ce(window),Yt=window.EventTarget.prototype.addEventListener,Zt=window.EventTarget.prototype.removeEventListener,en=new Qt;let tn=[];let{console:nn,document:rn,getComputedStyle:on,isExtensionContext:sn,variables:an,Array:cn,MutationObserver:ln,Object:un,XPathEvaluator:dn,XPathExpression:fn,XPathResult:pn}=Ce(window);const{querySelectorAll:hn}=rn,gn=hn&&i(hn,rn);function mn(e,t=!1){try{const n=navigator.userAgent.includes("Firefox")?e.openOrClosedShadowRoot:browser.dom.openOrClosedShadowRoot(e);return null===n&&ze()&&!t&&nn.log("Shadow root not found or not added in element yet",e),n}catch(n){return ze()&&!t&&nn.log("Error while accessing shadow root",e,n),null}}function wn(e,t=!1){return bn(e,gn.bind(rn),rn,t)}function yn(e,t,n,r){const o=t.getAttribute("xlink:href")||t.getAttribute("href");if(o){const s=gn(o)[0];if(!s&&ze())return nn.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 vn(e,t){const n=mn(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 bn(e,t,n,r,o=[]){if(e.includes("^^")){const[i,s,...a]=e.split("^^");let c,l;switch(s){case"svg":l=yn;break;case"sh":l=vn;break;default:return ze()&&nn.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=bn(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 En(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:kn,setPrototypeOf:xn}=un;class Sn extends fn{evaluate(...e){return xn(o(super.evaluate,this,e),pn.prototype)}}class Tn extends dn{createExpression(...e){return xn(o(super.createExpression,this,e),Sn.prototype)}}function $n(e){if(an.hidden.has(e))return!1;!function(e){sn&&"function"==typeof checkElement&&checkElement(e)}(e),an.hidden.add(e);let{style:t}=Ce(e),n=Ce(t,"CSSStyleDeclaration"),r=Ce([]);const o=k();let{debugCSSProperties:i}=o;for(let[e,t]of i||[["display","none"]])n.setProperty(e,t,"important"),r.push([e,n.getPropertyValue(e)]);return new ln((()=>{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 Mn(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),n=(new Tn).createExpression(e,null),r=pn.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=n.evaluate(rn,r,null),{snapshotLength:o}=t;for(let n=0;n<o;n++)e(t.snapshotItem(n))}}return t=>wn(e).forEach(t)}function Ln(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=Mn(e);return()=>{let e=Ce([]);return t((t=>e.push(t))),e}}return()=>cn.from(wn(e))}function Rn(e,t,n,r){let o;null==n&&(n=t);const i=()=>{for(const{element:i,rootParents:s}of wn(n,!0)){const n=En(Ce(i),t,s);n&&e(i,n,s)&&(o(),$n(n)&&"function"==typeof r&&r(n))}};return kn(new ln(i),{race(e){o=e,this.observe(rn,{childList:!0,characterData:!0,subtree:!0}),i()}})}function Cn(e,t,n,r){let o=Ce(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=Ce(e).parentElement;if(!s){if(!r||!r.length)return!0;s=r[r.length-1],r=r.slice(0,-1)}return Cn(s,on(s),n,r)}function jn(e){let t=on(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return Ce(n).trim()}let{ELEMENT_NODE:Pn,TEXT_NODE:On,prototype:An}=Node,{prototype:Nn}=Element,{prototype:In}=HTMLElement,{console:Wn,variables:Fn,DOMParser:Dn,Error:Hn,MutationObserver:zn,Object:Bn,ReferenceError:Vn}=Ce(window),{getOwnPropertyDescriptor:qn}=Bn;const{CanvasRenderingContext2D:Un,document:Gn,Map:Jn,MutationObserver:Xn,Object:_n,Set:Kn,WeakSet:Qn}=Ce(window);let Yn,Zn=new Kn,er=new Qn;function tr(e,t,n,r){Zn.add({canvasElement:e,rule:t,functionName:n,text:r})}let{Array:nr,Error:rr,Map:or,parseInt:ir}=Ce(window),sr=null,ar=null;function cr(e,t){if(null===sr)return qe;let n=sr,{participants:r}=n;return r.set(o,t),o;function o(){if(n.winners<1)return;if(Ge("race")("success",`${e} won the race`),n===sr)ar.push(o);else if(r.delete(o),--n.winners<1){for(let e of r.values())e();r.clear()}}}const{Map:lr,MutationObserver:ur,Object:dr,Set:fr,WeakSet:pr}=Ce(window);let hr=Element.prototype,{attachShadow:gr}=hr,mr=new pr,wr=new lr,yr=null;const{Array:vr,Error:br,JSON:Er,Map:kr,Object:xr,Response:Sr}=Ce(window);let Tr=null;let{Array:$r,Error:Mr,JSON:Lr,Map:Rr,Object:Cr,Response:jr}=Ce(window),Pr=null;const{Error:Or,Object:Ar,Map:Nr}=Ce(window);let Ir=null;function Wr(e,t,n){if(!n.length){if("string"==typeof e||"number"==typeof e){const n=e.toString();return t.test(n)}return!1}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}let{Error:Fr}=Ce(window);let{Error:Dr,Map:Hr,Object:zr,console:Br}=Ce(window),{toString:Vr}=Function.prototype,qr=EventTarget.prototype,{addEventListener:Ur}=qr,Gr=null;let{fetch:Jr}=Ce(window),Xr=!1;const _r=[],Kr=[],Qr=()=>{Xr||(window.fetch=l(Jr,((...e)=>{let[t]=e;if(_r.length>0&&"string"==typeof t){let n;try{n=new URL(t)}catch(e){if(!(e instanceof TypeError))throw e;n=new URL(t,Ce(document).location)}_r.forEach((e=>e(n))),e[0]=n.href}return o(Jr,self,e).then((e=>{let t=e;return Kr.forEach((e=>{t=e(t)})),t}))})),Xr=!0)};let Yr,{Map:Zr,Object:eo,RegExp:to,Response:no}=Ce(window);const{Error:ro,Object:oo,atob:io,btoa:so,RegExp:ao}=Ce(window);let co,lo,{RegExp:uo,XMLHttpRequest:fo,WeakMap:po}=Ce(window);let ho,{delete:go,has:mo}=c(URLSearchParams.prototype);const wo={"abort-current-inline-script":function(e,t=null){const n=Ye(arguments),r=Ge("abort-current-inline-script"),{mark:o,end:i}=De("abort-current-inline-script"),a=t?Ke(t):null,c=Qe(),l=Ce(document).currentScript;let u=window;const d=Ce(e).split("."),f=Ce(d).pop();for(let e of Ce(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}=Ct.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=Ce(document).currentScript;if(e instanceof Pt&&""==Ce(e,"HTMLScriptElement").src&&e!=l&&(!a||a.test(Ce(e).textContent)))throw r("success",d," is aborted \n",e,"\nFILTER: abort-current-inline-script",n),new jt(c)},w={get(){return m(),p?s(p,this):g},set(e){m(),h?s(h,this,e):g=e}};o(),mt(u,f,w),i(),wt(c)},"abort-on-iframe-property-read":function(...e){const{mark:t,end:n}=De("abort-on-iframe-property-read");t(),bt(e,!0,!1),n()},"abort-on-iframe-property-write":function(...e){const{mark:t,end:n}=De("abort-on-iframe-property-write");t(),bt(e,!1,!0),n()},"abort-on-property-read":function(e,t){const n=!("false"===t),r=Ye(arguments),{mark:o,end:i}=De("abort-on-property-read");o(),yt("abort-on-property-read",window,e,r,n),i()},"abort-on-property-write":function(e,t){const n=Ye(arguments),{mark:r,end:o}=De("abort-on-property-write"),i=!("false"===t);r(),vt("abort-on-property-write",window,e,n,i),o()},"array-override":function(e,t,n="false",r,i){if(!e)throw new Ot("[array-override snippet]: Missing method to override.");if(!t)throw new Ot("[array-override snippet]: Missing needle.");Wt||(Wt=new It);let s=Ge("array-override");const{mark:a,end:c}=De("array-override"),u=Ye(arguments);if("push"!==e||Wt.has("push"))if("includes"!==e||Wt.has("includes")){if("forEach"===e&&!Wt.has("forEach")){a();const{forEach:e}=Nt.prototype;Wt.set("forEach",Ce([])),At.defineProperty(window.Array.prototype,"forEach",{value:l(e,(function(t,n){const r=Wt.get("forEach");return o(e,this,[function(e,i,a){for(const{needleRegex:t,pathSegments:n,stackNeedles:o}of r)if(n.length||"string"!=typeof e&&"number"!=typeof e){if(n.length&&"object"==typeof e&&null!==e&&Ft(e,t,n)&&$t(o,s))return void s("success",`Array.forEach skipped callback for object containing needle: ${t}\nFILTER: array-override ${u}`)}else{const n=e.toString();if(n.match&&n.match(t)&&$t(o,s))return void s("success",`Array.forEach skipped callback for item matching needle: ${t}\nFILTER: array-override ${u}`)}return o(t,n||this,[e,i,a])},n])}))}),s("info","Wrapped Array.prototype.forEach"),c()}}else{a();const{includes:e}=Nt.prototype;Wt.set("includes",Ce([])),At.defineProperty(window.Array.prototype,"includes",{value:l(e,(function(t){const n=Wt.get("includes");for(const{needleRegex:e,retVal:r,pathSegments:o,stackNeedles:i}of n)if(o.length||"string"!=typeof t&&"number"!=typeof t){if(o.length&&"object"==typeof t&&null!==t&&Ft(t,e,o)&&$t(i,s))return s("success",`Array.includes returned ${r} for object containing ${e}\nFILTER: array-override ${u}`),r}else if(t.toString().match&&t.toString().match(e)&&$t(i,s))return s("success",`Array.includes returned ${r} for ${e}\nFILTER: array-override ${u}`),r;return o(e,this,arguments)}))}),s("info","Wrapped Array.prototype.includes"),c()}else{a();const{push:e}=Nt.prototype;Wt.set("push",Ce([])),At.defineProperty(window.Array.prototype,"push",{value:l(e,(function(t){const n=Wt.get("push");for(const{needleRegex:e,pathSegments:r,stackNeedles:o}of n)if(r.length||"string"!=typeof t&&"number"!=typeof t){if(r.length&&"object"==typeof t&&null!==t&&Ft(t,e,r)&&$t(o,s))return void s("success",`Array.push is ignored for object containing needle: ${e}\nFILTER: array-override ${u}`)}else{const n=t.toString();if(n.match&&n.match(e)&&$t(o,s))return void s("success",`Array.push is ignored for needle: ${e}\nFILTER: array-override ${u}`)}return o(e,this,arguments)}))}),s("info","Wrapped Array.prototype.push"),c()}const d=Ke(t);let f=[];r&&(f=r.split("."));let p=[];i&&(p=i.split(",").map((e=>e.trim())));const h=Wt.get(e),g="true"===n;h.push({needleRegex:d,retVal:g,pathSegments:f,stackNeedles:p}),Wt.set(e,h)},"blob-override":function(e,t="",n=null){if(!e)throw new zt("[blob-override snippet]: Missing parameter search.");const r=Ge("blob-override"),o=Ye(arguments),{mark:i,end:s}=De("blob-override");if(i(),qt.push({match:Ke(e),replaceWith:t,needle:n?Ke(n):null,formattedArgs:o}),qt.length>1)return;const a=Ht;function c(e,t={}){if(Dt.isArray(e)){let t=Ce(e).join("");for(const e of Ce(qt))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}`));e=[t]}const n=Vt.construct(a,[e,t]);return Bt.setPrototypeOf(n,c.prototype),n}c.prototype=a.prototype,Bt.setPrototypeOf(c,a),window.Blob=c,r("info","Wrapped Blob constructor in context "),s()},"cookie-remover":function(e,t=!1){if(!e)throw new Ut("[cookie-remover snippet]: No cookie to remove.");const n=Ye(arguments);let r=Ge("cookie-remover");const{mark:o,end:i}=De("cookie-remover");let s=Ke(e);if(!Ce(/^http|^about/).test(location.protocol))return void r("warn","Snippet only works for http or https and about.");function a(){return Ce(Jt()).split(";").filter((e=>s.test(Ce(e).split("=")[0])))}const c=()=>{r("info","Parsing cookies for matches"),o();for(const e of Ce(a())){let t=Ce(location.hostname);!t&&Ce(location.ancestorOrigins)&&Ce(location.ancestorOrigins[0])&&(t=new Gt(Ce(location.ancestorOrigins[0])).hostname);const o=Ce(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(".");Jt(`${Ce(o).trim()}=;${i};${s};domain=${t}`),Jt(`${Ce(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:Fe,debug:Be,"event-override":function(e,t,n=null){const r=Ye(arguments),i={eventType:e,mode:t,needle:n?Ke(n):null,formattedArgs:r};if(tn.includes(i)||tn.push(i),tn.length>1)return;let a=Ge("[event-override]");const{mark:c,end:u}=De("event-override"),d=_t.getOwnPropertyDescriptor(window.EventTarget.prototype,"addEventListener");d.configurable&&_t.defineProperty(window.EventTarget.prototype,"addEventListener",{...d,value:l(Yt,(function(e,t,n){c();const r=tn.filter((t=>t.eventType===e));if(!r.length||e!==r[0].eventType)return u(),o(Yt,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(Yt,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=Kt.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,en.has(t)||en.set(t,new Xt),en.get(t).set(e,d),a("info",`\nWrapping event listener for ${e}`),u(),o(Yt,this,[e,d,n])}))});const f=_t.getOwnPropertyDescriptor(window.EventTarget.prototype,"removeEventListener");f.configurable&&_t.defineProperty(window.EventTarget.prototype,"removeEventListener",{...f,value:l(Zt,(function(e,t,n){if(t&&en.has(t)&&en.get(t).has(e)){const r=en.get(t).get(e);return en.get(t).delete(e),o(Zt,this,[e,r,n])}return o(Zt,this,arguments)}))}),a("info","Initialized event-override snippet")},"freeze-element":function(e,t="",...n){let r,i,a=!1,c=!1,l=Ce(n).filter((e=>!h(e))),u=Ce(n).filter((e=>h(e))).map(Ke),d=Qe(),f=Ln(e);!function(){let n=Ce(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 Hn("[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)Fn.frozen.has(n)||(Fn.frozen.set(n,p),!t&&a&&new zn((e=>{for(let t of Ce(e))m(Ce(t,"MutationRecord").addedNodes)})).observe(n,{childList:!0,subtree:!0}),a&&Ce(n).nodeType===Pn&&m(Ce(n).childNodes))}function w(e,...t){Ue(`[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(Wn.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: ",Ce(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}"`),Wn.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 Vn(e)}function E(e,t,n,r){let o=new Dn,{body:i}=Ce(o.parseFromString(e,"text/html")),s=k(Ce(i).childNodes,t,n,r);return Ce(s).map((e=>{switch(Ce(e).nodeType){case Pn:return Ce(e).outerHTML;case On:return Ce(e).textContent;default:return""}})).join("")}function k(e,t,n,r){let o=Ce([]);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)||(ze()&&y(s,t,n,r),o&&b(a),ze())}let c=e;switch(Ce(c).nodeType){case Pn:return!!function(e,t){if(t){let n=Ce(e);for(let e of t)if(n.matches(e))return!0}return!1}(c,s)||(o&&(ze()&&y(c,t,n,r),b(a)),!!ze()&&($n(c),y(c,t,n,r),!0));case On:return!!v(Ce(c).textContent,i)||(ze()&&y(c,t,n,r),o&&b(a),!1);default:return!0}}function S(e,t,n,r){let i=qn(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 T(e,t,n,r){let i=qn(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 $(e,t,n,r){let i=qn(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:Ce(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 M(e,t,n,r){let o=qn(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 L(e,t,n,r){let o=qn(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)}}}Fn.frozen.has(document)||(Fn.frozen.set(document,!0),function(){let e;function t(e){return e&&Fn.frozen.has(e)}function n(e){try{return e&&(Fn.frozen.has(e)||Fn.frozen.has(Ce(e).parentNode))}catch(e){return!1}}function r(e,t){try{return e&&(Fn.frozen.has(e)&&t||Fn.frozen.has(Ce(e).parentNode)&&!t)}catch(e){return!1}}function o(e){return Fn.frozen.get(e)}function i(e){try{if(Fn.frozen.has(e))return Fn.frozen.get(e);let t=Ce(e).parentNode;return Fn.frozen.get(t)}catch(e){}}function s(e,t){try{if(Fn.frozen.has(e)&&t)return Fn.frozen.get(e);let n=Ce(e).parentNode;return Fn.frozen.get(n)}catch(e){}}e=S(An,"appendChild",t,o),mt(An,"appendChild",e),e=S(An,"insertBefore",t,o),mt(An,"insertBefore",e),e=S(An,"replaceChild",t,o),mt(An,"replaceChild",e),e=T(Nn,"append",t,o),mt(Nn,"append",e),e=T(Nn,"prepend",t,o),mt(Nn,"prepend",e),e=T(Nn,"replaceWith",n,i),mt(Nn,"replaceWith",e),e=T(Nn,"after",n,i),mt(Nn,"after",e),e=T(Nn,"before",n,i),mt(Nn,"before",e),e=$(Nn,"insertAdjacentElement",r,s),mt(Nn,"insertAdjacentElement",e),e=$(Nn,"insertAdjacentHTML",r,s),mt(Nn,"insertAdjacentHTML",e),e=$(Nn,"insertAdjacentText",r,s),mt(Nn,"insertAdjacentText",e),e=M(Nn,"innerHTML",t,o),mt(Nn,"innerHTML",e),e=M(Nn,"outerHTML",n,i),mt(Nn,"outerHTML",e),e=L(An,"textContent",t,o),mt(An,"textContent",e),e=L(In,"innerText",t,o),mt(In,"innerText",e),e=L(An,"nodeValue",t,o),mt(An,"nodeValue",e)}()),r=new zn(g),r.observe(document,{childList:!0,subtree:!0}),g()},"hide-if-canvas-contains":function(e,t="canvas"){const n=Ge("hide-if-canvas-contains"),r=Ye(arguments),{mark:i,end:s}=De("hide-if-canvas-contains");if(!e)return void n("error","The parameter 'search' is required");if(!Yn){i();const c=Un.prototype;function u(e){const t=c[e];_n.defineProperty(window.CanvasRenderingContext2D.prototype,e,{value:l(t,(function(r,...i){for(const[t,o]of Yn)if(t.test(r)){const t=this.canvas;let i=Ce(t).closest(o.selector);i&&!er.has(i)?($n(i),er.add(i),n("success","Matched: ",i,`\nFILTER: hide-if-canvas-contains ${o.formattedArguments}`)):tr(t,o,e,r)}return o(t,this,[r,...i])}))})}n("info","CanvasRenderingContext2D proxied"),u("fillText"),u("strokeText"),Yn=new Jn;new Xn((e=>{for(let t of Ce(e))"childList"===t.type&&Zn.forEach((({canvasElement:e,rule:t,functionName:n,text:r})=>{let o=Ce(e).closest(t.selector);o&&!er.has(o)&&($n(o),er.add(o),Zn.delete({canvasElement:e,rule:t,functionName:n,text:r}),Ge("hide-if-canvas-contains")("success","Matched: ",o,`\nFILTER: hide-if-canvas-contains ${t.formattedArguments}`))}))})).observe(Gn,{childList:!0,subtree:!0}),s()}const a=Ke(e);Yn.set(a,{selector:t,formattedArguments:r})},"hide-if-shadow-contains":function(e,t="*"){const n=Ye(arguments);let r=`${e}\\${t}`;wr.has(r)||wr.set(r,[Ke(e),t,cr("hide-if-shadow-contains",(()=>{wr.delete(r)}))],n);const i=Ge("hide-if-shadow-contains"),{mark:s,end:a}=De("hide-if-shadow-contains");yr||(yr=new ur((e=>{s();let t=new fr;for(let{target:r}of Ce(e)){let e=Ce(r).parentNode;for(;e;)[r,e]=[e,Ce(r).parentNode];if(!mr.has(r)&&!t.has(r)){t.add(r);for(let[e,t,o]of wr.values())if(e.test(Ce(r).textContent)){let e=Ce(r.host).closest(t);e&&(o(),Ce(r).appendChild(document.createElement("style")).textContent=":host {display: none !important}",$n(e),mr.add(r),i("success","Hiding: ",e,`\nFILTER: hide-if-shadow-contains ${n}`)),a()}}}})),dr.defineProperty(hr,"attachShadow",{value:l(gr,(function(){let e=o(gr,this,arguments);return i("info","attachShadow is called for: ",e),yr.observe(e,{childList:!0,characterData:!0,subtree:!0}),e}))}))},"json-override":function(e,t,n="",r=""){if(!e)throw new br("[json-override snippet]: Missing paths to override.");if(void 0===t)throw new br("[json-override snippet]: No value to override with.");if(!Tr){let s=Ge("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 Tr.values())if(!i||i.test(t)){if(Ce(o).some((t=>!kt(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=Ce(t).split("."),i=e;for(let e=0;e<o.length;e++){let a=o[e];if("[]"===a)return void(vr.isArray(i)&&(s("info",`Iterating over array at: ${a}`),Ce(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}`),xr.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]=St(n)):i=i[a]}}function f(e,t,n,r){let o=kt(e,t);void 0!==o&&(s("success",`Found ${t}, replaced it with ${n}`,`\nFILTER: json-override ${r}`),o[0][o[1]]=St(n))}a();let{parse:p}=Er;Tr=new kr,xr.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}=Sr.prototype;xr.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=Ye(arguments);Tr.set(e,{formattedArgs:i,prune:Ce(e).split(/ +/),needle:n.length?Ce(n).split(/ +/):[],filter:r?Ke(r):null,value:t})},"json-prune":function(e,t="",n=""){if(!e)throw new Mr("Missing paths to prune");if(!Pr){let i=Ge("json-prune");const{mark:s,end:a}=De("json-prune");function c(e){for(let{prune:t,needle:n,stackNeedle:r,formattedArgs:o}of Pr.values()){if(Ce(n).length>0&&Ce(n).some((t=>!kt(e,t))))return e;if(Ce(r)&&Ce(r).length>0&&!$t(r,i))return e;for(let n of t)n.includes("{}")||n.includes("[]")||n.includes("{-}")||n.includes("[-]")?u(e,n,o):f(e,n,o)}return e}function u(e,t,n){let r=Ce(t).split("."),o=e;for(let e=0;e<r.length;e++){let s=r[e];if("[]"===s)return void($r.isArray(o)&&(i("info",`Iterating over array at: ${s}`),Ce(o).forEach((t=>u(t,r.slice(e+1).join("."),n)))));if("[-]"===s){if($r.isArray(o)){i("info",`Iterating over array with element removal at: ${s}`);let t=r.slice(e+1).join("."),a=[];Ce(o).forEach(((e,n)=>{d(e,t)&&a.push(n)}));for(let e=a.length-1;e>=0;e--)i("success",`Found element at index ${a[e]} matching ${t} and removed entire element, \nFILTER: json-prune ${n}`),o.splice(a[e],1)}return}if("{}"===s)return void("object"==typeof o&&null!==o&&(i("info",`Iterating over object at: ${s}`),Cr.keys(o).forEach((t=>u(o[t],r.slice(e+1).join("."),n)))));if("{-}"===s){if("object"==typeof o&&null!==o){i("info",`Iterating over object with element removal at: ${s}`);let t=r.slice(e+1).join("."),a=[];Cr.keys(o).forEach((e=>{d(o[e],t)&&a.push(e)})),a.forEach((e=>{i("success",`Found object key ${e} matching ${t} and removed entire element, \nFILTER: json-prune ${n}`),delete o[e]}))}return}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){if(!t||""===t)return!0;let n=Ce(t).split("."),r=e;for(let e=0;e<n.length;e++){let t=n[e];if("[]"===t)return!!$r.isArray(r)&&Ce(r).some((t=>d(t,n.slice(e+1).join("."))));if("{}"===t)return"object"==typeof r&&null!==r&&Cr.keys(r).some((t=>d(r[t],n.slice(e+1).join("."))));if(!r||"object"!=typeof r||!y(r,t))return!1;if(e===n.length-1)return!0;r=r[t]}return!1}function f(e,t,n){let r=kt(e,t);void 0!==r&&(i("success",`Found ${t} and deleted`,`\nFILTER: json-prune ${n}`),delete r[0][r[1]])}s();let{parse:p}=Lr;Pr=new Rr,Cr.defineProperty(window.JSON,"parse",{value:l(p,(function(){return c(o(p,this,arguments))}))}),i("info","Wrapped JSON.parse for prune");let{json:h}=jr.prototype;Cr.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=Ye(arguments);Pr.set(e,{formattedArgs:r,prune:Ce(e).split(/ +/),needle:t.length?Ce(t).split(/ +/):[],stackNeedle:n.length?Ce(n).split(/ +/):[]})},"map-override":function(e,t,n="",r,i){if(!e)throw new Or("[map-override snippet]: Missing method to override.");if(!t)throw new Or("[map-override snippet]: Missing needle.");Ir||(Ir=new Nr);let a=Ge("map-override");const{mark:c,end:u}=De("map-override"),{set:d,get:f,has:p}=Nr.prototype,h=Ye(arguments);"set"!==e||Ir.has("set")?"get"!==e||Ir.has("get")?"has"!==e||Ir.has("has")||(c(),s(d,Ir,"has",Ce([])),Ar.defineProperty(window.Map.prototype,"has",{value:l(p,(function(e){const t=s(f,Ir,"has");for(const{needleRegex:n,retVal:r,stackNeedles:o}of t)if("string"==typeof e||"number"==typeof e){const t=e.toString();if(n.test(t)&&$t(o,a))return a("success",`Map.has returned ${r} for key: ${t}\nFILTER: map-override ${h}`),r}return o(p,this,arguments)}))}),a("info","Wrapped Map.prototype.has"),u()):(c(),s(d,Ir,"get",Ce([])),Ar.defineProperty(window.Map.prototype,"get",{value:l(f,(function(e){const t=s(f,Ir,"get");for(const{needleRegex:n,retVal:r,stackNeedles:o}of t)if("string"==typeof e||"number"==typeof e){const t=e.toString();if(n.test(t)&&$t(o,a))return a("success",`Map.get returned ${r} for key: ${t}\nFILTER: map-override ${h}`),r}return o(f,this,arguments)}))}),a("info","Wrapped Map.prototype.get"),u()):(c(),s(d,Ir,"set",Ce([])),Ar.defineProperty(window.Map.prototype,"set",{value:l(d,(function(e,t){const n=s(f,Ir,"set");for(const{needleRegex:e,pathSegments:r,stackNeedles:o}of n)if(Wr(t,e,r)&&$t(o,a))return a("success",`Map.set is ignored for value matching needle: ${e}\nFILTER: map-override ${h}`),this;return o(d,this,arguments)}))}),a("info","Wrapped Map.prototype.set"),u());const g=Ke(t);let m=[];r&&(m=r.split("."));let w=[];i&&(w=i.split(",").map((e=>e.trim())));const y=s(f,Ir,e);let v;"get"===e?v=""===n?void 0:n:"has"===e&&(v="true"===n),y.push({needleRegex:g,retVal:v,pathSegments:m,stackNeedles:w}),s(d,Ir,e,y)},"override-property-read":function(e,t,n){if(!e)throw new Fr("[override-property-read snippet]: No property to override.");if(void 0===t)throw new Fr("[override-property-read snippet]: No value to override with.");const r=Ye(arguments);let o=Ge("override-property-read");const{mark:i,end:s}=De("override-property-read");let a=St(t);o("info",`Overriding ${e}.`);const c=!("false"===n);i(),mt(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 Dr("[prevent-listener snippet]: No event type.");if(!Gr){Gr=new Hr;let e=Ge("[prevent]");const{mark:t,end:n}=De("prevent-listener");zr.defineProperty(qr,"addEventListener",{value:l(Ur,(function(r,i){t();for(let{evt:t,handlers:n,selectors:o}of Gr.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&&Ce(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(Vr,"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(ze()&&(Br.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"),Br.groupEnd()))}}}return n(),o(Ur,this,arguments)}))}),e("info","Wrapped addEventListener")}const r=Ye(arguments);Gr.has(e)||Gr.set(e,{evt:Ke(e),handlers:[],selectors:[],formattedArgs:r});let{handlers:i,selectors:a,formattedArgs:c}=Gr.get(e);i.push(t?Ke(t):null),a.push(n)},"replace-fetch-response":function(e,t="",n=null){const r=Ye(arguments),o=Ge("replace-fetch-response"),{mark:i,end:s}=De("replace-fetch-response");if(!e)return void o("error","The parameter 'search' is required");if(!Yr){const e=e=>{i();return Ce(e).clone().text().then((t=>{let n=Ce(t);for(const[e,{replacement:r,needle:i,formattedArgs:s}]of Yr){if(i){if(!Ke(i).test(n)){ze()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] warn: '${i}' not found in fetch response`),o("warn",`${n}`),console.groupEnd());continue}ze()&&(console.groupCollapsed(`DEBUG [replace-fetch-response] success: '${i}' found in fetch response`),o("info",`${n}`),console.groupEnd())}n=n.replace(e,r),ze()&&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 no(n.toString(),{status:e.status,statusText:e.statusText,headers:e.headers});return eo.defineProperties(r,{ok:{value:e.ok},redirected:{value:e.redirected},type:{value:e.type},url:{value:e.url}}),s(),r}))};Yr=new Zr,o("info","Network API proxied"),a=e,Kr.push(a),Qr()}var a;const c=Ke(e),l=new to(c,"g");Yr.set(l,{replacement:t,needle:n,formattedArgs:r})},"replace-outbound-value":function(e,t="",n="",r="",i="",s=""){if(!e)throw new ro("[replace-outbound-value snippet]: Missing method path.");let a=Ge("replace-outbound-value");const{mark:c,end:u}=De("replace-outbound-value");function d(e,t,n,r){if("base64"===r)try{if(function(e){try{if(""===e)return!1;const t=io(e),n=so(t),r=Ce(e).replace(/=+$/,"").toString();return Ce(n).replace(/=+$/,"").toString()===r}catch(e){return!1}}(e)){const r=io(e);a("info",`Decoded base64 content: ${r}`);const o=t?Ce(r).replace(t,n).toString():r;a("info",o!==r?`Modified decoded content: ${o}`:"Decoded content was not modified");const i=so(o);return a("info",`Re-encoded to base64: ${i}`),i}a("info",`Content is plain text: ${e}`);const r=t?Ce(e).replace(t,n).toString():e;a("info",r!==e?`Modified plain text content: ${r}`:"Plain text content was not modified");const o=so(r);return a("info",`Encoded to base64: ${o}`),o}catch(t){return a("info",`Error processing base64 content: ${t.message}`),e}return t?Ce(e).replace(t,n).toString():e}function f(e,t,n,r,o,i){const s=n?new ao(Ke(n),"g"):null;if(t.length&&"object"==typeof e&&null!==e){const c=n?function(e,t,n,r,o){if(!t.length)return e;let i=e;for(let n=0;n<t.length-1;n++){if(!i||"object"!=typeof i)return a("info",`Cannot navigate to path: property '${t[n]}' not found`),e;i=i[t[n]]}const s=t[t.length-1];if(!i||"object"!=typeof i||!(s in i))return a("info",`Target property '${s}' not found at path`),e;const c=i[s];if("string"!=typeof c)return a("info","Property at path is not a string: "+typeof c),e;const l=d(c,n,r,o);if(l!==c){const n=JSON.parse(JSON.stringify(e));let r=n;for(let e=0;e<t.length-1;e++)r=r[t[e]];return r[s]=l,a("info",`Replaced value at path '${t.join(".")}': '${c}' -> '${l}'`),n}return e}(e,t,s,r,o):e;return c!==e&&a("success",`Replaced outbound value\nFILTER: replace-outbound-value ${i}`),c}if("string"==typeof e){n||a("info",`Original text content: ${e}`);const t=n?d(e,s,r,o):e;return t!==e&&a("success",`Replaced outbound value: ${t} \nFILTER: replace-outbound-value ${i}`),t}return e}Ye(arguments),c();const p=function(e,t){let n=e,r=Ce(t).split(".");for(let e=0;e<r.length-1;e++){let t=r[e];if(!n||"object"!=typeof n&&"function"!=typeof n)return{base:n,prop:t,remainingPath:r.slice(e).join("."),success:!1};n=n[t]}return{base:n,prop:r[r.length-1],success:!0}}(window,e);if(!p.success)return a("error",`Could not reach the end of the prop chain: ${e}. Remaining path: ${p.remainingPath}`),void u();const{base:h,prop:g}=p,m=h[g];if(!m||"function"!=typeof m)return a("error",`Could not retrieve the method: ${e}`),void u();let w=[];i&&(w=Ce(i).split("."));let y=[];s&&(y=Ce(s).split(",").map((e=>e.trim())));let v=!1;oo.defineProperty(h,g,{value:l(m,(function(){if(v)return o(m,this,arguments);v=!0;const e=o(m,this,arguments);if(y.length&&!$t(y,a))return v=!1,e;if(e&&"function"==typeof e.then)return a("info","Method returned a Promise, modifying resolved value"),v=!1,e.then((e=>{const o="object"==typeof e?JSON.stringify(e):e;return a("info",`Promise resolved with value: ${o}`),f(e,w,t,n,r,i)})).catch((e=>{throw a("info",`Promise rejected: ${e.message}`),e}));const s=f(e,w,t,n,r,i);return v=!1,s}))}),a("info",`Wrapped ${e}`),u()},"replace-xhr-response":function(e,t="",n=null){const r=Ye(arguments),o=Ge("replace-xhr-response"),{mark:i,end:s}=De("replace-xhr-response");if(!e)return void o("error","The parameter 'pattern' is required");co||(co=new po,lo=new Map,o("info","XMLHttpRequest proxied"),window.XMLHttpRequest=class extends fo{open(e,t,...n){const r={method:e,url:t};return co.set(this,r),super.open(e,t,...n)}send(...e){return super.send(...e)}get response(){const e=super.response,t=co.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 lo){if(i){if(!Ke(i).test(r)){ze()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] warn: '${i}' not found in XHR response`),o("warn",r),console.groupEnd());continue}ze()&&(console.groupCollapsed(`DEBUG [replace-xhr-response] success: '${i}' found in XHR response`),o("info",r),console.groupEnd())}r=Ce(r).replace(t,n).toString(),ze()&&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=Ke(e),c=new uo(a,"g");lo.set(c,{replacement:t,needle:n,formattedArgs:r})},"strip-fetch-query-parameter":function(e,t=null){const n=Ye(arguments),r=Ge("strip-fetch-query-parameter"),{mark:o,end:i}=De("strip-fetch-query-parameter"),s=e=>{o();for(let[t,n]of ho.entries()){const{reg:o,args:i}=n;o&&!o.test(e)||mo(e.searchParams,t)&&(r("success",`${t} has been stripped from url ${e}`,`\nFILTER: strip-fetch-query-parameter ${i}`),go(e.searchParams,t))}i()};var a;ho||(ho=new Map,a=s,_r.push(a),Qr()),ho.set(e,{reg:t&&Ke(t),args:n})},trace:function(...e){o(Ue,null,e)}};let{MutationObserver:yo,WeakSet:vo,getComputedStyle:bo}=Ce(window);let{getComputedStyle:Eo,MutationObserver:ko,Uint8Array:xo}=Ce(window);const{parseFloat:So,Math:To,MutationObserver:$o,WeakSet:Mo}=Ce(window),{min:Lo}=To,Ro=(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]=Lo(o[s][a]+1,o[i][c]+1,o[s][c]+(n!=t[c])),++c;++s}return o[n-1][r-1]};let{getComputedStyle:Co,Map:jo,WeakSet:Po,parseFloat:Oo,DOMMatrix:Ao,Math:No}=Ce(window);const{ELEMENT_NODE:Io,TEXT_NODE:Wo}=Node;let{MutationObserver:Fo,WeakSet:Do,getComputedStyle:Ho}=Ce(window);let{getComputedStyle:zo,MutationObserver:Bo,WeakSet:Vo}=Ce(window);let{MutationObserver:qo,WeakSet: