UNPKG

@eyeo/snippets

Version:

eye/o snippets for Ads blocker

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