diff --git a/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/Autoconsent.kt b/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/Autoconsent.kt index f8cb1c5bf9c2..02c4eeec8186 100644 --- a/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/Autoconsent.kt +++ b/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/Autoconsent.kt @@ -36,6 +36,16 @@ interface Autoconsent { */ fun changeSetting(setting: Boolean) + /** + * Updates the user's cookie pop-up blocking preference. + */ + fun changeCookiePopUpPreference(preference: CookiePopUpPreference) + + /** + * @return the user's cookie pop-up blocking preference. + */ + fun getCookiePopUpPreference(): CookiePopUpPreference + /** * @return `true` if autoconsent was enabled by the user, `false` otherwise. */ diff --git a/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/CookiePopUpPreference.kt b/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/CookiePopUpPreference.kt new file mode 100644 index 000000000000..02d96ed41c2f --- /dev/null +++ b/autoconsent/autoconsent-api/src/main/java/com/duckduckgo/autoconsent/api/CookiePopUpPreference.kt @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2026 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.autoconsent.api + +enum class CookiePopUpPreference { + OFF, + DEFAULT, + MAX, +} diff --git a/autoconsent/autoconsent-impl/libs/autoconsent-bundle.js b/autoconsent/autoconsent-impl/libs/autoconsent-bundle.js index 3bc75ecdbfde..e7e0b72e4a3e 100644 --- a/autoconsent/autoconsent-impl/libs/autoconsent-bundle.js +++ b/autoconsent/autoconsent-impl/libs/autoconsent-bundle.js @@ -1 +1 @@ -!function(){"use strict";var e=e=>{throw TypeError(e)},t=(t,n,o)=>n.has(t)||e("Cannot "+o),n=(e,n,o)=>(t(e,n,"read from private field"),o?o.call(e):n.get(e)),o=class e{static setBase(t){e.base=t}static findElement(t,n=null,o=!1){let i=null;return i=null!=n?Array.from(n.querySelectorAll(t.selector)):null!=e.base?Array.from(e.base.querySelectorAll(t.selector)):Array.from(document.querySelectorAll(t.selector)),null!=t.textFilter&&(i=i.filter(e=>{const n=e.textContent.toLowerCase();if(Array.isArray(t.textFilter)){let e=!1;for(const o of t.textFilter)if(-1!==n.indexOf(o.toLowerCase())){e=!0;break}return e}return null!=t.textFilter&&-1!==n.indexOf(t.textFilter.toLowerCase())})),null!=t.styleFilters&&(i=i.filter(e=>{const n=window.getComputedStyle(e);let o=!0;for(const e of t.styleFilters){const t=n[e.option];o=e.negated?o&&t!==e.value:o&&t===e.value}return o})),null!=t.displayFilter&&(i=i.filter(e=>t.displayFilter?0!==e.offsetHeight:0===e.offsetHeight)),null!=t.iframeFilter&&(i=i.filter(()=>t.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location)),null!=t.childFilter&&(i=i.filter(n=>{const o=e.base;e.setBase(n);const i=e.find(t.childFilter);return e.setBase(o),null!=i.target})),o?i:(i.length>1&&console.warn("Multiple possible targets: ",i,t,n),i[0])}static find(t,n=!1){const o=[];if(null!=t.parent){const i=e.findElement(t.parent,null,n);if(null!=i){if(i instanceof Array)return i.forEach(i=>{const s=e.findElement(t.target,i,n);s instanceof Array?s.forEach(e=>{o.push({parent:i,target:e})}):o.push({parent:i,target:s})}),o;{const s=e.findElement(t.target,i,n);s instanceof Array?s.forEach(e=>{o.push({parent:i,target:e})}):o.push({parent:i,target:s})}}}else{const i=e.findElement(t.target,null,n);i instanceof Array?i.forEach(e=>{o.push({parent:null,target:e})}):o.push({parent:null,target:i})}return 0===o.length&&o.push({parent:null,target:null}),n?o:(1!==o.length&&console.warn("Multiple results found, even though multiple false",o),o[0])}};o.base=null;var i=o;function s(e){const t=i.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function r(e,t){switch(e.type){case"click":return async function(e){const t=i.find(e);null!=t.target&&t.target.click();return a(c)}(e);case"list":return async function(e,t){for(const n of e.actions)await r(n,t)}(e,t);case"consent":return async function(e,t){for(const n of e.consents){const e=-1!==t.indexOf(n.type);if(n.matcher&&n.toggleAction){s(n.matcher)!==e&&await r(n.toggleAction)}else e?await r(n.trueAction):await r(n.falseAction)}}(e,t);case"ifcss":return async function(e,t){const n=i.find(e);n.target?e.falseAction&&await r(e.falseAction,t):e.trueAction&&await r(e.trueAction,t)}(e,t);case"waitcss":return async function(e){await new Promise(t=>{let n=e.retries||10;const o=e.waitTime||250,s=()=>{const r=i.find(e);(e.negated&&r.target||!e.negated&&!r.target)&&n>0?(n-=1,setTimeout(s,o)):t()};s()})}(e);case"foreach":return async function(e,t){const n=i.find(e,!0),o=i.base;for(const o of n)o.target&&(i.setBase(o.target),await r(e.action,t));i.setBase(o)}(e,t);case"hide":return async function(e){const t=i.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=i.find(e),n=i.find(e.dragTarget);if(t.target){const e=t.target.getBoundingClientRect(),o=n.target.getBoundingClientRect();let i=o.top-e.top,s=o.left-e.left;"y"===this.config.axis.toLowerCase()&&(s=0),"x"===this.config.axis.toLowerCase()&&(i=0);const r=window.screenX+e.left+e.width/2,c=window.screenY+e.top+e.height/2,a=e.left+e.width/2,l=e.top+e.height/2,u=document.createEvent("MouseEvents");u.initMouseEvent("mousedown",!0,!0,window,0,r,c,a,l,!1,!1,!1,!1,0,t.target);const p=document.createEvent("MouseEvents");p.initMouseEvent("mousemove",!0,!0,window,0,r+s,c+i,a+s,l+i,!1,!1,!1,!1,0,t.target);const d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,r+s,c+i,a+s,l+i,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(u),await this.waitTimeout(10),t.target.dispatchEvent(p),await this.waitTimeout(10),t.target.dispatchEvent(d)}}(e);case"close":return async function(){window.close()}();case"wait":return async function(e){await a(e.waitTime)}(e);case"eval":return async function(e){return console.log("eval!",e.code),new Promise(t=>{try{e.async?(window.eval(e.code),setTimeout(()=>{t(window.eval("window.__consentCheckResult"))},e.timeout||250)):t(window.eval(e.code))}catch(n){console.warn("eval error",n,e.code),t(!1)}})}(e);default:throw new Error("Unknown action type: "+e.type)}}var c=0;function a(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function l(){return crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString()}var u=class{constructor(e,t=1e3){this.id=e,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t}),this.timer=window.setTimeout(()=>{this.reject(new Error("timeout"))},t)}},p={pending:new Map,sendContentMessage:null};var d={EVAL_0:()=>console.log(1),EVAL_DIDOMI_OPT_OUT:()=>!!window.Didomi&&(window.Didomi.setUserDisagreeToAll(),!0),EVAL_DIDOMI_TEST:()=>{const e=window.Didomi?.getCurrentUserStatus?.()?.purposes;if(e)return Object.values(e).some(e=>!e.enabled);const t=window.Didomi?.getUserConsentStatusForAll?.()?.purposes?.disabled;return Array.isArray(t)&&t.length>0},EVAL_CONSENTMANAGER_1:()=>window.__cmp&&"object"==typeof __cmp("getCMPData"),EVAL_CONSENTMANAGER_2:()=>!__cmp("consentStatus").userChoiceExists,EVAL_CONSENTMANAGER_3:()=>__cmp("setConsent",0),EVAL_CONSENTMANAGER_4:()=>__cmp("setConsent",1),EVAL_CONSENTMANAGER_5:()=>__cmp("consentStatus").userChoiceExists,EVAL_COOKIEBOT_1:()=>!!window.Cookiebot,EVAL_COOKIEBOT_2:()=>!window.Cookiebot.hasResponse&&!0===window.Cookiebot.dialog?.visible,EVAL_COOKIEBOT_3:()=>window.Cookiebot.withdraw()||!0,EVAL_COOKIEBOT_4:()=>window.Cookiebot.hide()||!0,EVAL_COOKIEBOT_5:()=>!0===window.Cookiebot.declined,EVAL_KLARO_1:()=>{const e=globalThis.klaroConfig||globalThis.klaro?.getManager&&globalThis.klaro.getManager().config;if(!e)return!0;const t=(e.services||e.apps).filter(e=>!e.required).map(e=>e.name);if(klaro&&klaro.getManager){const e=klaro.getManager();return t.every(t=>!e.consents[t])}if(klaroConfig&&"cookie"===klaroConfig.storageMethod){const e=klaroConfig.cookieName||klaroConfig.storageName,n=JSON.parse(decodeURIComponent(document.cookie.split(";").find(t=>t.trim().startsWith(e)).split("=")[1]));return Object.keys(n).filter(e=>t.includes(e)).every(e=>!1===n[e])}},EVAL_KLARO_OPEN_POPUP:()=>{klaro.show(void 0,!0)},EVAL_KLARO_TRY_API_OPT_OUT:()=>{if(window.klaro&&"function"==typeof klaro.show&&"function"==typeof klaro.getManager)try{return klaro.getManager().changeAll(!1),klaro.getManager().saveAndApplyConsents(),!0}catch(e){return console.warn(e),!1}return!1},EVAL_ONETRUST_1:()=>window.OnetrustActiveGroups.split(",").filter(e=>e.length>0).length<=1,EVAL_TRUSTARC_TOP:()=>window&&window.truste&&"0"===window.truste.eu.bindMap.prefCookie,EVAL_TRUSTARC_FRAME_TEST:()=>window&&window.QueryString&&"0"===window.QueryString.preferences,EVAL_TRUSTARC_FRAME_GTM:()=>window&&window.QueryString&&"1"===window.QueryString.gtm,EVAL_ADOPT_TEST:()=>!!localStorage.getItem("adoptConsentMode"),EVAL_ADULTFRIENDFINDER_TEST:()=>!!localStorage.getItem("cookieConsent"),EVAL_BAHN_TEST:()=>1===utag.gdpr.getSelectedCategories().length,EVAL_BIGCOMMERCE_CONSENT_MANAGER_DETECT:()=>!(!window.consentManager||!window.consentManager.version),EVAL_BORLABS_0:()=>!JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>-1!==e.indexOf("borlabs-cookie")).split("=",2)[1])).consents.statistics,EVAL_CC_BANNER2_0:()=>!!document.cookie.match(/sncc=[^;]+D%3Dtrue/),EVAL_COINBASE_0:()=>JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length<=1,EVAL_COOKIE_LAW_INFO_0:()=>(CLI.disableAllCookies&&CLI.disableAllCookies(),CLI.reject_close&&CLI.reject_close(),document.body.classList.remove("cli-barmodal-open"),!0),EVAL_COOKIE_LAW_INFO_DETECT:()=>!!window.CLI,EVAL_COOKIE_MANAGER_POPUP_0:()=>!1===JSON.parse(document.cookie.split(";").find(e=>e.trim().startsWith("CookieLevel")).split("=")[1]).social,EVAL_COOKIEALERT_0:()=>document.querySelector("body").removeAttribute("style")||!0,EVAL_COOKIEALERT_1:()=>document.querySelector("body").removeAttribute("style")||!0,EVAL_COOKIEALERT_2:()=>!0===window.CookieConsent.declined,EVAL_COOKIEFIRST_0:()=>{return!1===(e=JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>-1!==e.indexOf("cookiefirst")).trim()).split("=")[1])).performance&&!1===e.functional&&!1===e.advertising;var e},EVAL_COOKIEFIRST_1:()=>document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach(e=>"true"===e.getAttribute("aria-checked")&&e.click())||!0,EVAL_COOKIEINFORMATION_0:()=>CookieInformation.declineAllCategories()||!0,EVAL_COOKIEINFORMATION_1:()=>CookieInformation.submitAllCategories()||!0,EVAL_ETSY_0:()=>document.querySelectorAll(".gdpr-overlay-body input").forEach(e=>{e.checked=!1})||!0,EVAL_ETSY_1:()=>document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click()||!0,EVAL_EZOIC_0:()=>ezCMP.handleAcceptAllClick(),EVAL_FIDES_DETECT_POPUP:()=>window.Fides?.initialized,EVAL_GDPR_LEGAL_COOKIE_DETECT_CMP:()=>!!window.GDPR_LC,EVAL_GDPR_LEGAL_COOKIE_TEST:()=>!!window.GDPR_LC?.userConsentSetting,EVAL_IUBENDA_0:()=>document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach(e=>{e.checked&&e.click()})||!0,EVAL_IUBENDA_1:()=>!!document.cookie.match(/_iub_cs-\d+=/),EVAL_MICROSOFT_0:()=>Array.from(document.querySelectorAll("div > button")).filter(e=>e.innerText.match("Reject|Ablehnen"))[0].click()||!0,EVAL_MICROSOFT_1:()=>Array.from(document.querySelectorAll("div > button")).filter(e=>e.innerText.match("Accept|Annehmen"))[0].click()||!0,EVAL_MICROSOFT_2:()=>!!document.cookie.match("MSCC|GHCC"),EVAL_MOOVE_0:()=>document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach(e=>{e.disabled||(e.checked="moove_gdpr_strict_cookies"===e.name||"moove_gdpr_strict_cookies"===e.id)})||!0,EVAL_NHNIEUWS_TEST:()=>!!localStorage.getItem("psh:cookies-seen"),EVAL_OSANO_DETECT:()=>!!window.Osano?.cm?.dialogOpen,EVAL_PANDECTES_TEST:()=>document.cookie.includes("_pandectes_gdpr=")&&"deny"===JSON.parse(atob(document.cookie.split(";").find(e=>e.trim().startsWith("_pandectes_gdpr")).split("=")[1])).status,EVAL_POVR_GOBACK:()=>window.history.back()||!0,EVAL_PUBTECH_0:()=>document.cookie.includes("euconsent-v2")&&(document.cookie.match(/.YAAAAAAAAAAA/)||document.cookie.match(/.aAAAAAAAAAAA/)||document.cookie.match(/.YAAACFgAAAAA/)),EVAL_SHOPIFY_TEST:()=>document.cookie.includes("gdpr_cookie_consent=0")||document.cookie.includes("_tracking_consent=")&&!1===JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>e.trim().startsWith("_tracking_consent")).split("=")[1])).purposes.a,EVAL_SKYSCANNER_TEST:()=>document.cookie.match(/gdpr=[^;]*adverts:::false/)&&!document.cookie.match(/gdpr=[^;]*init:::true/),EVAL_SIRDATA_UNBLOCK_SCROLL:()=>(document.documentElement.classList.forEach(e=>{e.startsWith("sd-cmp-")&&document.documentElement.classList.remove(e)}),!0),EVAL_STEAMPOWERED_0:()=>2===JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>e.trim().startsWith("cookieSettings")).split("=")[1])).preference_state,EVAL_TAKEALOT_0:()=>document.body.classList.remove("freeze")||(document.body.style="")||!0,EVAL_TARTEAUCITRON_0:()=>tarteaucitron.userInterface.respondAll(!1)||!0,EVAL_TARTEAUCITRON_1:()=>tarteaucitron.userInterface.respondAll(!0)||!0,EVAL_TARTEAUCITRON_2:()=>document.cookie.match(/tarteaucitron=[^;]*/)?.[0].includes("false"),EVAL_TEALIUM_0:()=>void 0!==window.utag&&"object"==typeof utag.gdpr,EVAL_TEALIUM_1:()=>utag.gdpr.setConsentValue(!1)||!0,EVAL_TEALIUM_DONOTSELL:()=>utag.gdpr.dns?.setDnsState(!1)||!0,EVAL_TEALIUM_2:()=>utag.gdpr.setConsentValue(!0)||!0,EVAL_TEALIUM_3:()=>1!==utag.gdpr.getConsentState(),EVAL_TEALIUM_DONOTSELL_CHECK:()=>1!==utag.gdpr.dns?.getDnsState(),EVAL_TESTCMP_STEP:()=>!!document.querySelector("#reject-all"),EVAL_TESTCMP_0:()=>"button_clicked"===window.results.results[0],EVAL_TESTCMP_COSMETIC_0:()=>"banner_hidden"===window.results.results[0],EVAL_THEFREEDICTIONARY_0:()=>cmpUi.showPurposes()||cmpUi.rejectAll()||!0,EVAL_THEFREEDICTIONARY_1:()=>cmpUi.allowAll()||!0,EVAL_USERCENTRICS_API_0:()=>"object"==typeof UC_UI,EVAL_USERCENTRICS_API_1:()=>!!UC_UI.closeCMP(),EVAL_USERCENTRICS_API_2:()=>!!UC_UI.denyAllConsents(),EVAL_USERCENTRICS_API_3:()=>!!UC_UI.acceptAllConsents(),EVAL_USERCENTRICS_API_4:()=>!!UC_UI.closeCMP(),EVAL_USERCENTRICS_API_5:()=>!0===UC_UI.areAllConsentsAccepted(),EVAL_USERCENTRICS_API_6:()=>!1===UC_UI.areAllConsentsAccepted(),EVAL_USERCENTRICS_BUTTON_0:()=>JSON.parse(localStorage.getItem("usercentrics")).consents.every(e=>e.isEssential||!e.consentStatus),EVAL_WAITROSE_0:()=>Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach(e=>e.click())||!0};function h(e="autoconsent-css-rules"){const t=`style#${e}`,n=document.querySelector(t);if(n&&n instanceof HTMLStyleElement)return n;{const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement,n=document.createElement("style");return n.id=e,t.appendChild(n),n}}function m(e,t,n="display"){const o=`${t} { ${function(e){return("opacity"===e?"opacity: 0":"display: none")+" !important; z-index: -1 !important; pointer-events: none !important;"}(n)} } `;return e instanceof HTMLStyleElement&&(e.innerText+=o,t.length>0)}async function g(e,t,n){const o=await e();return!o&&t>0?new Promise(o=>{setTimeout(async()=>{o(g(e,t-1,n))},n)}):Promise.resolve(o)}function k(e){if(!e)return!1;if(null!==e.offsetParent)return!0;{const t=window.getComputedStyle(e);if("fixed"===t.position&&"none"!==t.display)return!0}return!1}function y(e){const t={enabled:!0,autoAction:"optOut",disabledCmps:[],enablePrehide:!0,enableCosmeticRules:!0,enableGeneratedRules:!0,enableHeuristicDetection:!1,enableHeuristicAction:!1,enablePopupMutationObserver:!1,detectRetries:20,isMainWorld:!1,prehideTimeout:2e3,enableFilterList:!1,visualTest:!1,logs:{lifecycle:!1,rulesteps:!1,detectionsteps:!1,evals:!1,errors:!0,messages:!1,waits:!1},performanceLoggingEnabled:!1,heuristicPopupSearchTimeout:100},n=(o=t,globalThis.structuredClone?structuredClone(o):JSON.parse(JSON.stringify(o)));var o;for(const o of Object.keys(t))void 0!==e[o]&&(n[o]=e[o]);return n}function w(e){if(!e.style)return;if(void 0!==e.__oldStyles)return;e.hasAttribute("style")&&(e.__oldStyles=e.style.cssText),e.style.animation="pulsate .5s infinite",e.style.outline="solid red";let t=document.querySelector("style#autoconsent-debug-styles");t||(t=document.createElement("style"),t.id="autoconsent-debug-styles"),t.textContent="\n @keyframes pulsate {\n 0% {\n outline-width: 8px;\n outline-offset: -4px;\n }\n 50% {\n outline-width: 4px;\n outline-offset: -2px;\n }\n 100% {\n outline-width: 8px;\n outline-offset: -4px;\n }\n }\n ",document.head.appendChild(t)}function f(e){e.style&&e.hasAttribute("style")&&(void 0!==e.__oldStyles?(e.style.cssText=e.__oldStyles,delete e.__oldStyles):e.removeAttribute("style"))}function _(){return window.top===window&&(!globalThis.location.ancestorOrigins||0===globalThis.location.ancestorOrigins.length)}var b=[/accept cookies/gi,/accept all/gi,/reject all/gi,/only necessary cookies/gi,/(?:by continuing.{0,100}cookie)|(?:cookie.{0,100}by continuing)/gi,/(?:by continuing.{0,100}privacy)|(?:privacy.{0,100}by continuing)/gi,/by clicking.{0,100}(?:accept|agree|allow)/gi,/we (?:use|serve)(?: optional)? cookies/gi,/we are using cookies/gi,/use of cookies/gi,/(?:this|our) (?:web)?site.{0,100}cookies/gi,/cookies (?:and|or) .{0,100} technologies/gi,/such as cookies/gi,/read more about.{0,100}cookies/gi,/consent to.{0,100}cookies/gi,/we and our partners.{0,100}cookies/gi,/we.{0,100}store.{0,100}information.{0,100}such as.{0,100}cookies/gi,/store and\/or access information.{0,100}on a device/gi,/personalised ads and content, ad and content measurement/gi,/utilisons.{0,100}des.{0,100}cookies/gi,/nous.{0,100}utilisons.{0,100}des/gi,/des.{0,100}cookies.{0,100}pour/gi,/des.{0,100}informations.{0,100}sur/gi,/retirer.{0,100}votre.{0,100}consentement/gi,/accéder.{0,100}à.{0,100}des/gi,/à.{0,100}des.{0,100}informations/gi,/et.{0,100}nos.{0,100}partenaires/gi,/publicités.{0,100}et.{0,100}du.{0,100}contenu/gi,/utilise.{0,100}des.{0,100}cookies/gi,/utilisent.{0,100}des.{0,100}cookies/gi,/stocker.{0,100}et.{0,100}ou.{0,100}accéder/gi,/consentement.{0,100}à.{0,100}tout.{0,100}moment/gi,/votre.{0,100}consentement/gi,/accepter.{0,100}tout/gi,/utilisation.{0,100}des.{0,100}cookies/gi,/cookies.{0,100}ou.{0,100}technologies/gi,/acceptez.{0,100}l.{0,100}utilisation/gi,/continuer sans accepter/gi,/tout refuser/gi,/(?:refuser|rejeter) tous les cookies/gi,/je refuse/gi,/refuser et continuer/gi,/refuser les cookies/gi,/seulement nécessaires/gi,/je désactive les finalités non essentielles/gi,/cookies essentiels uniquement/gi,/nécessaires uniquement/gi,/wir.{0,100}verwenden.{0,100}cookies/gi,/wir.{0,100}und.{0,100}unsere.{0,100}partner/gi,/zugriff.{0,100}auf.{0,100}informationen.{0,100}auf/gi,/inhalte.{0,100}messung.{0,100}von.{0,100}werbeleistung.{0,100}und/gi,/cookies.{0,100}und.{0,100}andere/gi,/verwendung.{0,100}von.{0,100}cookies/gi,/wir.{0,100}nutzen.{0,100}cookies/gi,/verwendet.{0,100}cookies/gi,/sie.{0,100}können.{0,100}ihre.{0,100}auswahl/gi,/und.{0,100}ähnliche.{0,100}technologien/gi,/cookies.{0,100}wir.{0,100}verwenden/gi,/alles?.{0,100}ablehnen/gi,/(?:nur|nicht).{0,100}(?:zusätzliche|essenzielle|funktionale|notwendige|erforderliche).{0,100}(?:cookies|akzeptieren|erlauben|ablehnen)/gi,/weiter.{0,100}(?:ohne|mit).{0,100}(?:einwilligung|zustimmung|cookies)/gi,/(?:cookies|einwilligung).{0,100}ablehnen/gi,/nur funktionale cookies akzeptieren/gi,/optionale ablehnen/gi,/zustimmung verweigern/gi,/gebruik.{0,100}van.{0,100}cookies/gi,/(?:we|wij).{0,100}gebruiken.{0,100}cookies.{0,100}om/gi,/cookies.{0,100}en.{0,100}vergelijkbare/gi,/(?:alles|cookies).{0,100}(?:afwijzen|weigeren|verwerpen)/gi,/alleen.{0,100}noodzakelijke?\b/gi,/cookies weigeren/gi,/weiger.{0,100}(?:cookies|alles)/gi,/doorgaan zonder (?:te accepteren|akkoord te gaan)/gi,/alleen.{0,100}(?:optionele|functionele|functioneel|noodzakelijke|essentiële).{0,100}cookies/gi,/wijs alles af/gi],E=[/^\s*(i)?\s*(reject|deny|refuse|decline|disable)\s*(all)?\s*(non-essential|optional|additional|targeting|analytics|marketing|unrequired|non-necessary|extra|tracking|advertising)?\s*(cookies)?\s*(\(?\s*except\s+(strictly\s+)?(necessary|essential)\s*\)?)?\s*$/is,/^\s*(i)?\s*do\s+not\s+accept\s*(cookies)?\s*$/is,/^\s*(continue|proceed|continue\s+browsing)\s+without\s+(accepting|agreeing|consent|cookies|tracking)(\s*→)?\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*(strictly)?\s*(necessary|essentials?|required)?\s*(cookies)?\s*only\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*(strictly)?\s*(necessary|essentials?|required)\s*(cookies)?\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*only\s*(strictly)?\s*(necessary|essentials?|required)?\s*(cookies)?\s*$/is,/^\s*do\s+not\s+sell(\s+or\s+share)?\s*my\s*personal\s*information\s*$/is,"allow selection","disagree and close","weigeren","alles afwijzen","alleen noodzakelijke cookies","afwijzen","alles weigeren","cookies weigeren","alleen noodzakelijk","weiger","weiger cookies","selectie toestaan","doorgaan zonder te accepteren","alleen functionele cookies","alleen functioneel","alleen noodzakelijke","alleen essentiële cookies","functioneel","alle cookies verwerpen","doorgaan zonder akkoord te gaan","weiger alles","nee, bedankt","alle cookies weigeren","weiger alle cookies","alleen noodzakelijke cookies accepteren","alleen strikt noodzakelijk","ik weiger","optionele cookies weigeren","alle weigeren","accepteer alleen noodzakelijke cookies","alleen functionele cookies accepteren","enkel noodzakelijke cookies","niet accepteren","weiger niet-essentiële cookies","weiger niet-noodzakelijke cookies","wijs alles af","alle cookies afwijzen","alleen vereiste cookies","cookies afwijzen","doorgaan zonder accepteren","hier weigeren","weiger alle","aanvaard enkel essentiële cookies","aanvullende cookies weigeren","accepteren weigeren","alle afwijzen","alle niet functionele afwijzen","alle optionele weigeren","alleen noodzakelijke accepteren","alleen strikt noodzakelijke cookies","allen afwijzen","clear weigeren","enkel functioneel","enkel noodzakelijke cookies aanvaarden","functioneel altijd actief","nee, accepteer alleen de noodzakelijke","nee, geen cookies a.u.b.","nee, weiger cookies","nee, weigeren","niet-noodzakelijke cookies weigeren","optioneel afwijzen","tracking cookies weigeren","weigeren cookies","weigeren?","weigeren.","strikt noodzakelijk","weiger optionele cookies","noodzakelijke cookies","essentiële cookies","ga verder zonder aanvaarden","doorgaan zonder cookies","accepteer noodzakelijke cookies","noodzakelijke","indien je enkel technisch noodzakelijke cookies wenst te accepteren, klik dan hier","weiger","alleen de noodzakelijke cookies","alleen noodzakelijk","alleen verplichte cookies","ik wil alleen minimale cookies","doorgaan zonder te accepteren","geen cookies toestaan","liever geen cookies","nee, geen persoonlijke cookies","nee, liever geen cookies","ga door zonder te accepteren","verder zonder accepteren","essentiële accepteren","functionele cookies","strikt noodzakelijke cookies","alleen basic cookies","alleen basiscookies","alleen standaard cookies","alle cookies verwerpen","noodzakelijk","noodzakelijk cookies accepteren","noodzakelijke cookies accepteren","accepteer alleen noodzakelijk","enkel noodzakelijke toestaan","enkel strikt noodzakelijke cookies","ik wijs ze liever af","ik weiger cookies","ik weiger optionele cookies","weiger alle cookies","weiger alle niet-noodzakelijke cookies","weiger alle onnodige cookies","weiger alle optionele","weiger alles","weiger targeting en third party cookies.","continuer sans accepter","tout refuser","refuser","refuser tous les cookies","non merci","interdire tous les cookies","je refuse","refuser tout","tout rejeter","refuser et continuer","rejeter","refuser les cookies","cookies nécessaires uniquement","seulement nécessaires","rejeter tout","refuser les cookies optionnels","je désactive les finalités non essentielles","refuser les cookies non nécessaires","rejeter tous les cookies","cookies essentiels uniquement","nécessaires uniquement","refuser les cookies non essentiels","tout refuser et fermer","tout refuser sauf les cookies techniques","continuer sans accepter x","je refuse lutilisation de cookies","non merci, seulement des cookies techniques","non, tout refuser","refuser tous les cookies non nécessaires","rejeter les cookies","uniquement les essentiels","refuser tous","accepter uniquement les nécessaires","allow anonymous analytics","autoriser les cookies essentiels uniquement","autoriser uniquement les nécessaires","cookies essentiels seulement","cookies nécessaires seulement","cookies techniques uniquement","je préfère les rejeter","je refuse :(","je refuse les cookies","je refuse tous les cookies","je refuse tout","ne pas accepter","non, accepter les nécessaires uniquement","refuser (sauf cookies nécessaires)","refuser ce cookie","refuser les coockies","refuser les cookies facultatifs","refuser tout, sauf les cookies techniques","refuser toutes","refuser toutes les options","rejeter la bannière","rejeter les cookies non essentiels","rejeter les cookies optionnels","rejeter tous les non fonctionnels","rejeter tout optionnel","tout refuser, sauf les cookies techniques","uniquement nécessaires","x continuer sans accepter","strictement nécessaires","utiliser uniquement les cookies nécessaires","cookies nécessaires","accepter uniquement les cookies essentiels","accepter les cookies nécessaires","uniquement les cookies nécessaires","autoriser uniquement les cookies essentiels","autoriser uniquement les cookies nécessaires","si vous ne souhaitez pas accepter les cookies à lexception des cookies techniquement nécessaires, veuillez cliquer ici","cookies strictement nécessaires","accepter les cookies strictement nécessaires","autoriser les cookies essentiels","non, merci, uniquement les cookies nécessaires","indispensable uniquement","uniquement autoriser les cookies essentiels","utiliser que les cookies nécessaires","uniquement les sdk nécessaires","uniquement nécessaire","utiliser uniquement les cookies fonctionnels","refus","refusez","naccepter que les cookies indispensables","naccepter que les cookies nécessaires","naccepter que les cookies techniques","nécessaires seulement","ablehnen","alle ablehnen","nur notwendige cookies","nur essenzielle cookies akzeptieren","nur notwendige cookies verwenden","nur technisch notwendige","nur essentielle cookies akzeptieren","alles ablehnen","nur notwendige","alle cookies ablehnen","weiter ohne einwilligung","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nur essenzielle cookies akzeptieren.","cookies ablehnen","optionale cookies ablehnen","nur erforderliche cookies","einwilligung ablehnen","nur erforderliche","nur notwendige cookies zulassen","nur funktionale cookies akzeptieren","nur notwendige cookies akzeptieren","nur notwendige technologien","verweigern","webanalyse ablehnen","weiter ohne zustimmung","optionale ablehnen","nur notwendige akzeptieren","nur funktionale cookies","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons ablehnen.","nur notwendige cookies erlauben","zustimmung verweigern","nein, danke","nur erforderliche cookies akzeptieren","zusätzliche cookies ablehnen","ablehnen und nur essenzielle cookies akzeptieren","nicht erforderliche ablehnen","nicht essenzielle cookies daten ablehnen","nur technisch notwendige cookies","nur technisch notwendige cookies akzeptieren","ablehnen speichern","alle funktionen ablehnen","alle optionalen cookies ablehnen","alles verweigern","mit erforderlichen einstellungen fortfahren","nicht notwendige ablehnen","notwendige cookies akzeptieren","nur erforderliche technologien","nur essenzielle cookies","nur essenzielle cookies erlauben","technisch nicht notwendige cookies ablehnen","tippen sie zum ablehnen bitte hier","ablehnen deny","fortfahren ohne zu akzeptieren","nur erforderliche akzeptieren","nur notwendige erlauben","ablehnen ...nur technisch notwendige cookies verwendet werden","ablehnen (außer notwendige cookies)","ablehnen und fortfahren","ablehnen und schließen","ablehnen: nur grundfunktionen","akzeptieren nur notwendige cookies","alle ablehnen (außer notwendige cookies)","alle nicht essenziellen cookies ablehnen","alle nicht notwendigen cookies ablehnen","alle optionale ablehnen","alle optionalen ablehnen","alle verweigern","analyse cookies ablehnen","cookie einstellungenablehnen","erforderliche cookies akzeptieren","erforderliche cookies zulassen","externe inhalte ablehnen","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons ablehnen und nur essenzielle cookies akzeptieren.","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nicht-essenzielle cookies verweigern.","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nur essenzielle akzeptieren.","mit erforderlichen cookies fortfahren","mit notwendigen fortfahren","nein, bitte nicht","nein, ich stimme nicht zu","nicht funktionale cookies ablehnen","nicht notwendige cookies ablehnen","nicht-essenzielle cookies ablehnen","nicht-essenzielle cookies verweigern","notwendige cookies zulassen","nur erforderliche cookies erlauben","nur erforderliche cookies setzen","nur erforderliche cookies verwenden","nur essenzielle akzeptieren","nur notwendige cookies annehmen","nur notwendige cookies speichern","nur notwendige cookies verwenden.","nur notwendige funktionscookies akzeptieren","nur notwendigen cookies zustimmen","nur notwendiges akzeptieren","nur wesentliche cookies annehmen","opt. cookies ablehnen","optionale dienste ablehnen","optionale tools ablehnen","sie alle cookies ablehnen","technisch notwendige annehmen","nur essentielle cookies","nur essentielle","nur funktionale akzeptieren","nur technisch notwendige akzeptieren","nur technisch notwendige daten und cookies ...","nur technisch notwendige zulassen","nur wesentliche","ohne einverständnis fortfahren","ohne einwilligung","ohne zustimmung fortfahren","ohne zustimmung weiter","weiter mit essentiellen cookies","weiter ohne annahme","weiter ohne statistische analyse-cookies","weiter ohne statistische cookies","wesentliche cookies","fortfahren ohne zustimmung","rifiuta","rifiuta cookies","rifiuta i cookie","rifiuta i cookies","rifiuta tutti i cookie","rifiuta tutti i cookies","rifiuta cookie non necessari","rifiuta i cookie non tecnici","rifiuta non necessari","rifiuta tutto","rifiuta tutti","rifiuta e chiudi","chiudi rifiuta tutti i cookie","chiudi e rifiuta tutti i cookie","chiudi e rifiuta tutto","nega","nega tutti","negare","non accetto","accetta solo i necessari","usa solo i cookie necessari","accetta solo necessari","solo necessari","continua senza accettare x","continua senza accettare","rifiutare","rifiutare i cookie","rifiutare tutti i cookie","rifiutare tutti","rifiutare e continuare","installa solo i cookie strettamente necessari","solo cookies tecnici","accetta necessari","solo cookie tecnici","solo cookie necessari","strettamente necessari","tecnici","accetta solo cookie di navigazione","chiudi e prosegui solo con i cookies tecnici necessari","consenti solo i cookie tecnici","solo cookie essenziali","blocca i cookie non essenziali","accetta i cookie necessari","accetta solo cookie tecnici","accetta solo i cookie essenziali","accetta solo i cookie necessari","accetta solo i necessary","accetta i cookie essenziali","accetta cookie tecnici","necessari","usa solo i cookie tecnici","usa solo i necessari","rifiuto","essenziali","accetta cookie essenziali","accetta cookie necessari","accetta solo cookie essenziali","accetta solo cookie necessari","rifiuta cookie non necessari","rifiuta cookie non essenziali","rifiuta i cookie non necessari","rifiuta i cookie non essenziali","rifiuta tutti i cookie e chiudi","rifiuta tutto e chiudi","rifiuta tutti i cookie chiudi","continuare senza accettare","rifiutare cookies","rifiutare i cookies","rifiutare non necessari","rifiutare tutto","rifiutare e chiudere","solo essenziali","solo tecnici","negare tutti",/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*$/is,/^\s*(continuar|prosseguir|seguir)\s*(sem\s*aceitar)\s*$/is,/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*(tudo|o)?\s*(opcional|(não[-\s](essencial|funcional|obrigatório|necessário)))?\s*$/is,/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*(todos)?\s*(os)?\s*(cookies)?\s*(opcionais|(não[-\s](essenciais|funcionais|obrigatórios|necessários)))?\s*$/is,/^\s*(aceitar|utilizar)?\s*(apenas|somente|só)?\s*(o)?\s*(essencial|funcional|obrigatório|necessário)\s*$/is,/^\s*(aceitar|utilizar)?\s*(apenas|somente|só)?\s*(os)?\s*(cookies)?\s*(essenciais|funcionais|obrigatórios|necessários)\s*$/is,"rechazar","rechazar todo","rechazar todas","denegar","rechazar cookies","rechazarlas todas","no acepto","rechazar todas las cookies","rechazar y cerrar","denegar todas","solo necesarias","rechazar cookies opcionales","rechazar opcionales","cookies estrictamente necesarias","aceptar sólo necesarias","continuar sin aceptar","denegar todo","clear rechazar cookies","configurar rechazar cookies","denegar cookies","rechazar y continuar","rechazar las cookies","clear rechazar","denegar todas las cookies","rechazar cookies no esenciales","rechazarlas","no, no acepto","permitir sólo necesarias","rechazar cookies adicionales","rechazar cookies analíticas","rechazar no necesarias","rechazar opcional","rechazar todo lo opcional","solo cookies estrictamente necesarias","solo esenciales","x rechazar todas las cookies","solo usar cookies necesarias","solo cookies necesarias","declinar","aceptar solo las cookies esenciales","necesarias","aceptar cookies opcionales","aceptar solo lo necesario","solo funcionales","declinar y cerrar","déclin","declina","declinar consentimiento","declinar todas","solo las cookies necesarias","només sutilitzen cookies quan és necessari","no, sólo las estrictamente necesarias","solo las necesarias","acceptar només les necessàries","acepta solo las necesarias","aceptar solo lo esencial","aceptar las obligatorias","permitir solo cookies técnicas","cookies técnicas","permitir solo cookies técnicas","usar solo cookies técnicas","aceptar solo las esenciales","avvisa","endast nödvändiga","avvisa alla","endast nödvändiga cookies","neka","neka alla","avvisa allt","avvisa alla cookies","tillåt bara nödvändiga cookies","bara nödvändiga","bara nödvändiga cookies","tillåt bara nödvändiga kakor","endast nödvändiga kakor","tillåt endast nödvändiga","fortsätt utan att acceptera","godkänn endast nödvändiga","acceptera endast nödvändiga","avvisa cookies","tillåt endast nödvändiga kakor","acceptera endast nödvändiga cookies","neka kakor","bara nödvändiga kakor","neka alla cookies","använd endast nödvändiga","avvisa alla utom nödvändiga","hantera eller avvisa","neka alla utom nödvändiga kakor","neka och stäng","tillåt bara nödvändiga tjänster","avvisa alla utom nödvändiga kakor","avvisa alla valfria","godkänn bara nödvändiga cookies","acceptera endast nödvändiga kakor","använd endast nödvändiga cookies","avvisa alla kakor","avvisa alla valmöjligheter","avvisa ej nödvändiga","avvisa icke-nödvändiga","förneka","godkänn bara nödvändiga","godkänn bara nödvändiga kakor","godkänn endast nödvändiga cookies","godkänn endast nödvändiga kakor","godta endast nödvändiga","jag godkänner bara nödvändiga kakor","nej, avvisa alla","nej, bara nödvändiga","nej, bara nödvändiga cookies","neka alla utom nödvändiga","neka alla.","neka cookies","neka samtliga","ok, endast nödvändiga","spara endast nödvändiga","stäng och avvisa","tillåt bara nödvändiga","godkänn nödvändiga kakor","godkänn nödvändiga","acceptera nödvändiga","strikt nödvändigt","tillåt nödvändiga","nödvändiga","enbart nödvändiga","jag godkänner nödvändiga kakor","acceptera nödvändiga kakor","godkänn enbart nödvändiga kakor","godkänn nödvändiga cookies","om du inte vill acceptera andra cookies än de som är tekniskt nödvändiga klickar du här","acceptera enbart nödvändiga","nödvändiga cookies","jag godkänner enbart att ni använder nödvändiga cookies","+ strikt nödvändiga cookies","använd enbart nödvändiga cookies","enbart nödvändiga cookies","godkänn nödvändiga kakor stäng","ok till nödvändiga","strikt nödvändiga","fortsätt utan att godkänna","avböj alla cookies","jag accepterar endast grundläggande kakor","nej, jag avböjer","tillåt inte cookies"],A=[/pay|subscribe/is,/abonneer/is,/abonnier/is,/abonner/is,/abbonati/is,/iscriviti/is,/abbonare/is,/iscrivere/is,/sostienici/is,/suscribir/is],v='button, input[type="button"], input[type="submit"], a, [role="button"], [class*="button"]';function C(e,t=b){e=e.slice(0,1e5);const n=[],o=[];for(const i of t){const t=e?.match(i);t&&(n.push(i.toString()),o.push(...t.map(e=>e.substring(0,200))))}return{patterns:n,snippets:o}}function S(e=100){const t=function(e=100){const t=!_();if(t&&window.parent&&window.parent!==window.top)return[];return function(e,t=100){let n=[];if(e){const e=document.body||document.documentElement;e&&k(e)&&e.innerText&&n.push(e)}else n=function(e=100){const t=performance.now(),n=document.createTreeWalker(document.documentElement,NodeFilter.SHOW_ELEMENT,{acceptNode(n){if("BODY"===n.tagName)return NodeFilter.FILTER_SKIP;if(k(n)){const e=window.getComputedStyle(n).position;if("fixed"===e||"sticky"===e)return NodeFilter.FILTER_ACCEPT;if(function(e){if("DIALOG"===e.tagName&&e.hasAttribute("open"))return!0;if("dialog"===e.getAttribute("role")||"true"===e.getAttribute("aria-modal"))return!0;return!1}(n))return NodeFilter.FILTER_ACCEPT}return performance.now()-t>e?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}}),o=[];for(let e=n.nextNode();e;e=n.nextNode())o.push(e);return F(o)}(t);const o=[];for(const e of n)e.innerText&&o.push({text:e.innerText,element:e,buttons:x(e)});return o}(t,e)}(e);return t.reduce((e,t)=>{const n=t.text?.trim();if(n){const{patterns:o}=C(n);if(o.length>0){const{rejectButtons:n,otherButtons:o}=function(e){const t=[],n=[];for(const o of e)T(o.text)?t.push(o):n.push(o);return{rejectButtons:t,otherButtons:n}}(t.buttons);n.length>0&&e.push({...t,rejectButtons:n,otherButtons:o})}}return e},[])}function T(e,t=E,n=A){if(!e)return!1;const o=function(e){let t=e.toLowerCase();return t=t.replace(/[“”"'/#&[\]→✕×⟩❯><✗ב’›«»]+/g,""),t=t.replace(/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u2600-\u26FF\u2700-\u27BF\u{1F900}-\u{1F9FF}\u{1FA70}-\u{1FAFF}]/gu,""),t=t.replace(/\n+/g," "),t=t.replace(/\s+/g," "),t=t.trim(),t}(e);return!n.some(e=>e.test(o))&&t.some(e=>e instanceof RegExp&&e.test(o)||e===o)}function x(e){const t=F(function(e){return Array.from(e.querySelectorAll(v))}(e)).filter(e=>k(e)&&!function(e){return"disabled"in e&&Boolean(e.disabled)||e.hasAttribute("disabled")}(e)&&(e.innerText?.trim()||e instanceof HTMLInputElement&&["submit","button"].includes(e.type)&&e.value?.trim()));return t.map(e=>({text:(e.innerText||e.textContent||"").trim()||e.value?.trim()||"",element:e}))}function F(e){const t=[];if(e.length>0)for(let n=e.length-1;n>=0;n--){let o=!1;for(let t=0;t(n.evals&&console.error("error evaluating rule",e,t),!1))}checkRunContext(){return!!this.checkFrameContext(_())&&!(this.runContext.urlPattern&&!this.hasMatchingUrlPattern())}checkFrameContext(e){const t={...O,...this.runContext};return!(e&&!t.main)&&!(!e&&!t.frame)}hasMatchingUrlPattern(){return Boolean(this.runContext?.urlPattern&&window.location.href.match(this.runContext.urlPattern))}detectCmp(){throw new Error("Not Implemented")}async detectPopup(){return!1}optOut(){throw new Error("Not Implemented")}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){return Promise.resolve(!0)}async highlightElements(e,t=!1,n=2e3){if(0!==e.length){t||(e=[e[0]]),this.autoconsent.sendContentMessage({type:"visualDelay",timeout:n});for(const t of e)this.autoconsent.config.logs.rulesteps&&console.log("highlighting",t),w(t);await this.wait(n);for(const t of e)f(t)}}async clickElement(e){return this.autoconsent.config.visualTest&&await this.highlightElements([e]),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.clickElement(e)}async click(e,t=!1){return this.autoconsent.config.visualTest&&await this.highlightElements(this.elementSelector(e),t),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.click(e,t)}elementExists(e){return this.autoconsent.domActions.elementExists(e)}elementVisible(e,t){return this.autoconsent.domActions.elementVisible(e,t)}waitForElement(e,t){return this.autoconsent.domActions.waitForElement(e,t)}waitForVisible(e,t,n){return this.autoconsent.domActions.waitForVisible(e,t,n)}async waitForThenClick(e,t,n){return this.autoconsent.config.visualTest&&await this.highlightElements(this.elementSelector(e),n),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.waitForThenClick(e,t,n)}wait(e){return this.autoconsent.domActions.wait(e)}hide(e,t){return this.autoconsent.domActions.hide(e,t)}removeClass(e,t){return this.autoconsent.domActions.removeClass(e,t)}setStyle(e,t){return this.autoconsent.domActions.setStyle(e,t)}addStyle(e,t){return this.autoconsent.domActions.addStyle(e,t)}cookieContains(e){return this.autoconsent.domActions.cookieContains(e)}prehide(e){return this.autoconsent.domActions.prehide(e)}undoPrehide(){return this.autoconsent.domActions.undoPrehide()}querySingleReplySelector(e,t){return this.autoconsent.domActions.querySingleReplySelector(e,t)}querySelectorChain(e){return this.autoconsent.domActions.querySelectorChain(e)}elementSelector(e){return this.autoconsent.domActions.elementSelector(e)}waitForMutation(e){return this.autoconsent.domActions.waitForMutation(e)}},I=class extends P{constructor(e,t){super(t),this.rule=e,this.name=e.name,this.runContext=e.runContext||O}get hasSelfTest(){return!!this.rule.test&&this.rule.test.length>0}get isIntermediate(){return!!this.rule.intermediate}get isCosmetic(){return!!this.rule.cosmetic}get prehideSelectors(){return this.rule.prehideSelectors||[]}async detectCmp(){return!!this.rule.detectCmp&&this._runRulesSequentially(this.rule.detectCmp,this.autoconsent.config.logs.detectionsteps)}async detectPopup(){return!!this.rule.detectPopup&&this._runRulesSequentially(this.rule.detectPopup,this.autoconsent.config.logs.detectionsteps)}async optOut(){const e=this.autoconsent.config.logs;return!!this.rule.optOut&&(e.lifecycle&&console.log("Initiated optOut()",this.rule.optOut),this._runRulesSequentially(this.rule.optOut,this.autoconsent.config.logs.rulesteps))}async optIn(){const e=this.autoconsent.config.logs;return!!this.rule.optIn&&(e.lifecycle&&console.log("Initiated optIn()",this.rule.optIn),this._runRulesSequentially(this.rule.optIn,this.autoconsent.config.logs.rulesteps))}async openCmp(){return!!this.rule.openCmp&&this._runRulesSequentially(this.rule.openCmp,this.autoconsent.config.logs.rulesteps)}async test(){return this.hasSelfTest&&this.rule.test?this._runRulesSequentially(this.rule.test,this.autoconsent.config.logs.rulesteps):super.test()}async evaluateRuleStep(e){const t=[],n=this.autoconsent.config.logs;if(e.exists&&t.push(this.elementExists(e.exists)),e.visible&&t.push(this.elementVisible(e.visible,e.check)),e.eval){const n=this.mainWorldEval(e.eval);t.push(n)}if(e.waitFor&&t.push(this.waitForElement(e.waitFor,e.timeout)),e.waitForVisible&&t.push(this.waitForVisible(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(this.click(e.click,e.all)),e.waitForThenClick&&t.push(this.waitForThenClick(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(this.wait(e.wait)),e.hide&&t.push(this.hide(e.hide,e.method)),void 0!==e.removeClass&&t.push(!!e.selector&&this.removeClass(e.selector,e.removeClass)),void 0!==e.setStyle&&t.push(!!e.selector&&this.setStyle(e.selector,e.setStyle)),void 0!==e.addStyle&&t.push(!!e.selector&&this.addStyle(e.selector,e.addStyle)),e.cookieContains&&t.push(this.cookieContains(e.cookieContains)),e.if){if(!e.if.exists&&!e.if.visible)return console.error("invalid conditional rule",e.if),!1;if(!e.then)return console.error('invalid conditional rule, missing "then" step',e.if),!1;const o=await this.evaluateRuleStep(e.if);n.rulesteps&&console.log("Condition is",o),o?t.push(this._runRulesSequentially(e.then,n.rulesteps)):e.else?t.push(this._runRulesSequentially(e.else,n.rulesteps)):t.push(!0)}if(e.any){let n=!1;for(const t of e.any)if(await this.evaluateRuleStep(t)){n=!0;break}t.push(n)}if(0===t.length)return n.errors&&console.warn("Unrecognized rule",e),!1;const o=(await Promise.all(t)).reduce((e,t)=>e&&t,!0);return e.negated?!o:o}async _runRulesParallel(e){const t=e.map(e=>this.evaluateRuleStep(e));return(await Promise.all(t)).every(e=>!!e)}async _runRulesSequentially(e,t=!0){for(const n of e){t&&console.log("Running rule...",n);const e=await this.evaluateRuleStep(n);if(t&&console.log("...rule result",e),!e&&!n.optional)return!1}return!0}},L=class extends P{constructor(e){super(e),this.popups=[],this.name="HEURISTIC",this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return await new Promise(e=>setTimeout(e,0)),this.autoconsent.config.performanceLoggingEnabled&&performance.mark("heuristicDetectorStart"),this.popups=S(this.autoconsent.config.heuristicPopupSearchTimeout),this.autoconsent.config.performanceLoggingEnabled&&performance.mark("heuristicDetectorEnd"),this.autoconsent.config.performanceLoggingEnabled&&performance.measure("heuristicDetector","heuristicDetectorStart","heuristicDetectorEnd"),this.popups.length>0?Promise.resolve(!0):Promise.resolve(!1)}async detectPopup(){return this.popups.length>0&&((this.popups.length>1||this.popups[0].rejectButtons&&this.popups[0].rejectButtons.length>1)&&this.autoconsent.config.logs.errors&&console.warn("Heuristic found multiple reject buttons"),!0)}optOut(){const e=this.popups[0]?.rejectButtons?.[0];return e?this.clickElement(e.element):Promise.resolve(!1)}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){const e=this.popups[0].rejectButtons?.[0];return!!e&&(await this.wait(500),!k(e.element))}},z=class{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=O,this.isCosmetic=!1,t.methods.forEach(e=>{e.action&&this.methods.set(e.name,e.action)}),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}checkFrameContext(e){return!0}hasMatchingUrlPattern(){return!1}async detectCmp(){return this.config.detectors.map(e=>s(e.presentMatcher)).some(e=>!!e)}async detectPopup(){return this.config.detectors.map(e=>s(e.showingMatcher)).some(e=>!!e)}async executeAction(e,t){return!this.methods.has(e)||r(this.methods.get(e),t)}async optOut(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",[]),await this.executeAction("SAVE_CONSENT"),!0}async optIn(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),await this.executeAction("HIDE_CMP"),await this.executeAction("DO_CONSENT",["D","A","B","E","F","X"]),await this.executeAction("SAVE_CONSENT"),!0}async openCmp(){return await this.executeAction("HIDE_CMP"),await this.executeAction("OPEN_OPTIONS"),!0}async test(){return!0}},R="#truste-show-consent",N="#truste-consent-required",M="#truste-consent-track",V=[class extends P{constructor(e){super(e),this.name="TrustArc-top",this.prehideSelectors=[".trustarc-banner-container",`.truste_popframe,.truste_overlay,.truste_box_overlay,${M}`],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!0}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}get isCosmetic(){return!1}async detectCmp(){const e=this.elementExists(`${R},${M}`);return e&&(this._shortcutButton=document.querySelector(N)),e}async detectPopup(){return this.elementVisible(`#truste-consent-content,#trustarc-banner-overlay,${M}`,"any")}async optOut(){return this.elementExists(N)?(this.click(N),!0):(m(h(),`.truste_popframe, .truste_overlay, .truste_box_overlay, ${M}`),await this.click(R),setTimeout(()=>{h().remove()},1e4),!0)}async optIn(){return this._optInDone=!0,await this.click("#truste-consent-button")}async openCmp(){return!0}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_TRUSTARC_TOP")}},class extends P{constructor(){super(...arguments),this.name="TrustArc-frame",this.runContext={main:!1,frame:!0,urlPattern:"^https://consent-pref\\.trustarc\\.com/\\?"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return!0}async detectPopup(){return this.elementVisible("#defaultpreferencemanager","any")&&this.elementVisible(".mainContent","any")}async navigateToSettings(){return await g(async()=>this.elementExists(".shp")||this.elementVisible(".advance","any")||this.elementExists(".switch span:first-child"),10,500),this.elementExists(".shp")&&await this.click(".shp"),await this.waitForElement(".prefPanel",5e3),this.elementVisible(".advance","any")&&await this.click(".advance"),await g(()=>this.elementVisible(".switch span:first-child","any"),5,1e3)}async optOut(){let e=3e3;return await this.mainWorldEval("EVAL_TRUSTARC_FRAME_GTM")&&(e=1500),await g(()=>"complete"===document.readyState,20,100),await this.waitForElement(".mainContent[aria-hidden=false]",e),!!await this.click(".rejectAll,.declineAllButtonLower",!0)||(this.elementExists(".prefPanel")&&await this.waitForElement('.prefPanel[style="visibility: visible;"]',e),await this.click("#catDetails0")?(await this.click(".submit"),this.waitForThenClick("#gwt-debug-close_id",e),!0):await this.click(".required")?(this.waitForThenClick("#gwt-debug-close_id",e),!0):(await this.navigateToSettings(),await this.click(".switch span:nth-child(1):not(.active)",!0),await this.click(".submit"),this.waitForThenClick("#gwt-debug-close_id",10*e),!0))}async optIn(){return await this.click(".call")||(await this.navigateToSettings(),await this.click(".switch span:nth-child(2)",!0),await this.click(".submit"),this.waitForElement("#gwt-debug-close_id",3e5).then(()=>{this.click("#gwt-debug-close_id")})),!0}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_TRUSTARC_FRAME_TEST")}},class extends P{constructor(){super(...arguments),this.name="Cybotcookiebot",this.prehideSelectors=["#CybotCookiebotDialog,#CybotCookiebotDialogBodyUnderlay,#dtcookie-container,#cookiebanner,#cb-cookieoverlay,.modal--cookie-banner,#cookiebanner_outer,#CookieBanner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return await this.mainWorldEval("EVAL_COOKIEBOT_1")}async detectPopup(){return this.mainWorldEval("EVAL_COOKIEBOT_2")}async optOut(){if(this.elementVisible("#CybotCookiebotDialogBodyLevelButtonLevelOptinDeclineAll"))return await this.click("#CybotCookiebotDialogBodyLevelButtonLevelOptinDeclineAll");await this.wait(500);let e=await this.mainWorldEval("EVAL_COOKIEBOT_3");return await this.wait(1e3),e=e&&await this.mainWorldEval("EVAL_COOKIEBOT_4"),e}async optIn(){return this.elementExists("#dtcookie-container")?await this.click(".h-dtcookie-accept"):(await this.click(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),await this.click("#CybotCookiebotDialogBodyLevelButtonAccept"),await this.click("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_COOKIEBOT_5")}},class extends P{constructor(){super(...arguments),this.name="Sourcepoint-frame",this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay","#sp_privacy_manager_container"],this.ccpaNotice=!1,this.ccpaPopup=!1,this.runContext={main:!0,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaNotice=!0,!0):"ccpa-pm.sp-prod.net"===e.hostname?(this.ccpaPopup=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname||"/ccpa_pm/index.html"===e.pathname||"/us_pm/index.html"===e.pathname)&&(e.searchParams.has("message_id")||e.searchParams.has("requestUUID")||e.searchParams.has("consentUUID"))}async detectPopup(){return!!this.ccpaNotice||(this.ccpaPopup?await this.waitForElement(".priv-save-btn",2e3):(await this.waitForElement(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL,.sp_choice_type_SAVE_AND_EXIT",2e3),!this.elementExists(".sp_choice_type_9")))}async optIn(){return await this.waitForElement(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!await this.click(".sp_choice_type_11")||!!await this.click(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===location.pathname||"/ccpa_pm/index.html"===location.pathname||"/us_pm/index.html"===location.pathname&&!document.querySelector(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL")}async optOut(){await this.wait(500);const e=this.autoconsent.config.logs;if(this.ccpaPopup){const e=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.neutral.on .right");for(const t of e)t.click();const t=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.switch-bg.on");for(const e of t)e.click();return await this.click(".priv-save-btn")}if(this.elementVisible(".sp_choice_type_SE","any"))return await this.click(["xpath///div[contains(., 'Do not share my personal information') and contains(@class, 'switch-container')]",".pm-switch[aria-checked=false] .slider"],!1),await this.click(".sp_choice_type_SE");if(!this.isManagerOpen()){const e='.sp_choice_type_12,[data-choice]:not([class*="sp_choice_type_"])';if(!await this.waitForVisible(`${e},.sp_choice_type_13`))return!1;if(this.elementVisible(".sp_choice_type_13","any"))return await this.click(".sp_choice_type_13");await this.click(e),await g(()=>this.isManagerOpen(),200,100)}await this.waitForElement(".type-modal",2e4),this.elementExists("[role=tablist]")&&await this.waitForElement("[role=tablist] [role=tab]",1e4),this.waitForThenClick(".ccpa-stack .pm-switch[aria-checked=true] .slider",500,!0);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",n=await Promise.race([this.waitForElement(e,2e3).then(e=>e?0:-1),this.waitForElement(t,2e3).then(e=>e?1:-1),this.waitForElement(".pm-features",2e3).then(e=>e?2:-1)]);if(0===n)return await this.waitForVisible(e),await this.click(e);1===n?await this.click(t):2===n&&(await this.waitForElement(".pm-features",1e4),await this.click(".checked > span",!0),await this.click(".chevron"))}catch(t){e.errors&&console.warn(t)}return await this.click(".sp_choice_type_SAVE_AND_EXIT")}},class extends P{constructor(){super(...arguments),this.name="consentmanager.net",this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.apiAvailable=await this.mainWorldEval("EVAL_CONSENTMANAGER_1"),!!this.apiAvailable||this.elementExists("#cmpbox")}async detectPopup(){return!!this.elementVisible("#cmpbox .cmpmore","any")||!!this.apiAvailable&&(await this.wait(500),await this.mainWorldEval("EVAL_CONSENTMANAGER_2"))}async optOut(){return await this.wait(500),this.apiAvailable?await this.mainWorldEval("EVAL_CONSENTMANAGER_3"):!!await this.click(".cmpboxbtnno")||(this.elementExists(".cmpwelcomeprpsbtn")?(await this.click(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),await this.click(".cmpboxbtnsave"),!0):(await this.click(".cmpboxbtncustom"),await this.waitForElement(".cmptblbox",2e3),await this.click(".cmptdchoice > a[aria-checked=true]",!0),await this.click(".cmpboxbtnyescustomchoices"),this.hide("#cmpwrapper,#cmpbox","display"),!0))}async optIn(){return this.apiAvailable?await this.mainWorldEval("EVAL_CONSENTMANAGER_4"):await this.click(".cmpboxbtnyes")}async test(){return!!this.apiAvailable&&await this.mainWorldEval("EVAL_CONSENTMANAGER_5")}},class extends P{constructor(){super(...arguments),this.name="Evidon"}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("#_evidon_banner")}async detectPopup(){return this.elementVisible("#_evidon_banner","any")}async optOut(){return await this.click("#_evidon-decline-button")||(m(h(),"#evidon-prefdiag-overlay,#evidon-prefdiag-background,#_evidon-background"),await this.waitForThenClick("#_evidon-option-button"),await this.waitForElement("#evidon-prefdiag-overlay",5e3),await this.wait(500),await this.waitForThenClick("#evidon-prefdiag-decline")),!0}async optIn(){return await this.click("#_evidon-accept-button")}},class extends P{constructor(){super(...arguments),this.name="Onetrust",this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("#onetrust-banner-sdk")||this.elementVisible("#onetrust-pc-sdk","any")}async detectPopup(){return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk","any")}async optOut(){if(await this.wait(500),this.elementVisible("#onetrust-reject-all-handler","any"))return await this.click("#onetrust-reject-all-handler");if(this.elementVisible(".ot-pc-refuse-all-handler","any"))return await this.click(".ot-pc-refuse-all-handler");if(this.elementVisible(".js-reject-cookies","any"))return await this.click(".js-reject-cookies");if(this.elementVisible(".onetrust-close-btn-handler","any")){const e=document.querySelector(".onetrust-close-btn-handler"),t=e?.textContent?.toLowerCase()||"";if(["without","ohne","sans","sin ","zonder","senza","refuse","decline","reject","ablehnen"].some(e=>t.includes(e)))return await this.click(".onetrust-close-btn-handler");const n=document.getElementById("onetrust-banner-sdk");if(n?.classList.contains("ot-close-btn-link")&&!this.elementExists("#onetrust-accept-btn-handler,#onetrust-reject-all-handler,#onetrust-pc-btn-handler,.ot-sdk-show-settings,button.js-cookie-settings"))return await this.click(".onetrust-close-btn-handler")}return this.elementExists("#onetrust-pc-btn-handler")?await this.click("#onetrust-pc-btn-handler"):await this.click(".ot-sdk-show-settings,button.js-cookie-settings"),await this.waitForElement("#onetrust-consent-sdk",2e3),await this.wait(1e3),await this.click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await this.wait(1e3),await this.waitForElement(".save-preference-btn-handler,.js-consent-save",2e3),await this.click(".save-preference-btn-handler,.js-consent-save"),await this.waitForVisible("#onetrust-banner-sdk",5e3,"none"),!0}async optIn(){return await this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies")}async test(){return await g(()=>this.mainWorldEval("EVAL_ONETRUST_1"),10,500)}},class extends P{constructor(){super(...arguments),this.name="Klaro",this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):this.elementExists(".klaro > .cookie-notice")}async detectPopup(){return this.elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!await this.mainWorldEval("EVAL_KLARO_TRY_API_OPT_OUT")||(!!await this.click(".klaro .cn-decline")||(await this.mainWorldEval("EVAL_KLARO_OPEN_POPUP"),!!await this.click(".klaro .cn-decline")||(await this.click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked,.required,.only-required),.cm-purpose:not(.cm-toggle-all) > div > input:not(.half-checked,.required,.only-required)",!0),await this.click(".cm-btn-accept,.cm-button"))))}async optIn(){return!!await this.click(".klaro .cm-btn-accept-all")||(this.settingsOpen?(await this.click(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),await this.click(".cm-btn-accept")):await this.click(".klaro .cookie-notice .cm-btn-success"))}async test(){return await this.mainWorldEval("EVAL_KLARO_1")}},class extends P{constructor(){super(...arguments),this.name="Uniconsent"}get prehideSelectors(){return[".unic",".modal:has(.unic)"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".unic .unic-box,.unic .unic-bar,.unic .unic-modal")}async detectPopup(){return this.elementVisible(".unic .unic-box,.unic .unic-bar,.unic .unic-modal","any")}async optOut(){if(await this.waitForElement(".unic button",1e3),document.querySelectorAll(".unic button").forEach(e=>{const t=e.textContent;(t.includes("Manage Options")||t.includes("Optionen verwalten"))&&e.click()}),await this.waitForElement(".unic input[type=checkbox]",1e3)){await this.waitForElement(".unic button",1e3),document.querySelectorAll(".unic input[type=checkbox]").forEach(e=>{e.checked&&e.click()});for(const e of document.querySelectorAll(".unic button")){const t=e.textContent;for(const n of["Confirm Choices","Save Choices","Auswahl speichern"])if(t.includes(n))return e.click(),await this.wait(500),!0}}return!1}async optIn(){return this.waitForThenClick(".unic #unic-agree")}async test(){await this.wait(1e3);return!this.elementExists(".unic .unic-box,.unic .unic-bar")}},class extends P{constructor(){super(...arguments),this.prehideSelectors=[".cmp-root"],this.name="Conversant"}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".cmp-root .cmp-receptacle")}async detectPopup(){return this.elementVisible(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await this.waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await this.waitForElement(".cmp-view-tab-tabs"))return!1;await this.waitForThenClick(".cmp-view-tab-tabs > :first-child"),await this.waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");for(const e of Array.from(document.querySelectorAll(".cmp-accordion-item"))){e.querySelector(".cmp-accordion-item-title").click(),await g(()=>!!e.querySelector(".cmp-accordion-item-content.cmp-active"),10,50);const t=e.querySelector(".cmp-accordion-item-content.cmp-active");t.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach(e=>e.click()),t.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach(e=>e.click())}return await this.click(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return this.waitForThenClick(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}},class extends P{constructor(){super(...arguments),this.name="tiktok.com",this.runContext={urlPattern:"tiktok"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}getShadowRoot(){const e=document.querySelector("tiktok-cookie-banner");return e?e.shadowRoot:null}async detectCmp(){return this.elementExists("tiktok-cookie-banner")}async detectPopup(){const e=this.getShadowRoot()?.querySelector(".tiktok-cookie-banner");return k(e)}async optOut(){const e=this.autoconsent.config.logs,t=this.getShadowRoot()?.querySelector(".button-wrapper button:first-child");return t?(e.rulesteps&&console.log("[clicking]",t),t.click(),!0):(e.errors&&console.log("no decline button found"),!1)}async optIn(){const e=this.autoconsent.config.logs,t=this.getShadowRoot()?.querySelector(".button-wrapper button:last-child");return t?(e.rulesteps&&console.log("[clicking]",t),t.click(),!0):(e.errors&&console.log("no accept button found"),!1)}async test(){const e=document.cookie.match(/cookie-consent=([^;]+)/);if(!e)return!1;const t=JSON.parse(decodeURIComponent(e[1]));return Object.values(t).every(e=>"boolean"!=typeof e||!1===e)}},class extends P{constructor(){super(...arguments),this.name="tumblr-com",this.runContext={urlPattern:"^https://(www\\.)?tumblr\\.com/"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}get prehideSelectors(){return["#cmp-app-container"]}async detectCmp(){return this.elementExists("#cmp-app-container")}async detectPopup(){return this.elementVisible("#cmp-app-container","any")}async optOut(){let e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-secondary");return!!t&&(t.click(),await g(()=>{const e=document.querySelector("#cmp-app-container iframe");return!!e?.contentDocument?.querySelector(".cmp__dialog input")},5,500),e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-secondary"),!!t&&(t.click(),!0))}async optIn(){const e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-primary");return!!t&&(t.click(),!0)}},class extends P{constructor(){super(...arguments),this.name="Admiral"}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]")}async detectPopup(){return this.elementVisible("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]","any")}async optOut(){const e="xpath///button[contains(., 'Afvis alle') or contains(., 'Reject all') or contains(., 'Odbaci sve') or contains(., 'Rechazar todo') or contains(., 'Atmesti visus') or contains(., 'Odmítnout vše') or contains(., 'Απόρριψη όλων') or contains(., 'Rejeitar tudo') or contains(., 'Tümünü reddet') or contains(., 'Отклонить все') or contains(., 'Noraidīt visu') or contains(., 'Avvisa alla') or contains(., 'Odrzuć wszystkie') or contains(., 'Alles afwijzen') or contains(., 'Отхвърляне на всички') or contains(., 'Rifiuta tutto') or contains(., 'Zavrni vse') or contains(., 'Az összes elutasítása') or contains(., 'Respingeți tot') or contains(., 'Alles ablehnen') or contains(., 'Tout rejeter') or contains(., 'Odmietnuť všetko') or contains(., 'Lükka kõik tagasi') or contains(., 'Hylkää kaikki')]";if(await this.waitForElement(e,500))return await this.click(e);const t="xpath///button[contains(., 'Spara & avsluta') or contains(., 'Save & exit') or contains(., 'Uložit a ukončit') or contains(., 'Enregistrer et quitter') or contains(., 'Speichern & Verlassen') or contains(., 'Tallenna ja poistu') or contains(., 'Išsaugoti ir išeiti') or contains(., 'Opslaan & afsluiten') or contains(., 'Guardar y salir') or contains(., 'Shrani in zapri') or contains(., 'Uložiť a ukončiť') or contains(., 'Kaydet ve çıkış yap') or contains(., 'Сохранить и выйти') or contains(., 'Salvesta ja välju') or contains(., 'Salva ed esci') or contains(., 'Gem & afslut') or contains(., 'Αποθήκευση και έξοδος') or contains(., 'Saglabāt un iziet') or contains(., 'Mentés és kilépés') or contains(., 'Guardar e sair') or contains(., 'Zapisz & zakończ') or contains(., 'Salvare și ieșire') or contains(., 'Spremi i izađi') or contains(., 'Запазване и изход')]";if(await this.waitForThenClick("xpath///button[contains(., 'Zwecke') or contains(., 'Σκοποί') or contains(., 'Purposes') or contains(., 'Цели') or contains(., 'Eesmärgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., 'Účely') or contains(., 'Finalidades') or contains(., 'Mērķi') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., 'Ändamål') or contains(., 'Finalités') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Amaçlar') or contains(., 'Nameni') or contains(., 'Célok') or contains(., 'Formål')]")&&await this.waitForVisible(t)){const e=this.elementSelector(t)[0].parentElement?.parentElement,n=e?.querySelectorAll("input[type=checkbox]:checked");return n?.forEach(e=>e.click()),await this.click(t)}return!1}async optIn(){return await this.click("xpath///button[contains(., 'Sprejmi vse') or contains(., 'Prihvati sve') or contains(., 'Godkänn alla') or contains(., 'Prijať všetko') or contains(., 'Принять все') or contains(., 'Aceptar todo') or contains(., 'Αποδοχή όλων') or contains(., 'Zaakceptuj wszystkie') or contains(., 'Accetta tutto') or contains(., 'Priimti visus') or contains(., 'Pieņemt visu') or contains(., 'Tümünü kabul et') or contains(., 'Az összes elfogadása') or contains(., 'Accept all') or contains(., 'Приемане на всички') or contains(., 'Accepter alle') or contains(., 'Hyväksy kaikki') or contains(., 'Tout accepter') or contains(., 'Alles accepteren') or contains(., 'Aktsepteeri kõik') or contains(., 'Přijmout vše') or contains(., 'Alles akzeptieren') or contains(., 'Aceitar tudo') or contains(., 'Acceptați tot')]")}}],j=class{constructor(e){this.autoconsentInstance=e}async clickElement(e){return!!(e&&e instanceof HTMLElement)&&(this.autoconsentInstance.config.logs.rulesteps&&console.log("[clickElement]",e),e.click(),!0)}async click(e,t=!1){const n=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[click]",e,t,n),n.length>0&&(t?n.forEach(e=>e.click()):n[0].click()),n.length>0}elementExists(e){return this.elementSelector(e).length>0}elementVisible(e,t="all"){const n=this.elementSelector(e),o=new Array(n.length);return n.forEach((e,t)=>{o[t]=k(e)}),"none"===t?o.every(e=>!e):0!==o.length&&("any"===t?o.some(e=>e):o.every(e=>e))}waitForElement(e,t=1e4){const n=Math.ceil(t/200);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[waitForElement]",e),g(()=>this.elementSelector(e).length>0,n,200)}waitForVisible(e,t=1e4,n="any"){const o=Math.ceil(t/200);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[waitForVisible]",e),g(()=>this.elementVisible(e,n),o,200)}async waitForThenClick(e,t=1e4,n=!1){return await this.waitForElement(e,t),await this.click(e,n)}wait(e){return this.autoconsentInstance.config.logs.rulesteps&&this.autoconsentInstance.config.logs.waits&&console.log("[wait]",e),new Promise(t=>{setTimeout(()=>{t(!0)},e)})}cookieContains(e){return document.cookie.includes(e)}hide(e,t){this.autoconsentInstance.config.logs.rulesteps&&console.log("[hide]",e);return m(h(),e,t)}removeClass(e,t){const n=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[removeClass]",e,t,n),n.forEach(e=>e.classList.remove(t)),n.length>0}setStyle(e,t){const n=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[setStyle]",e,t,n),n.forEach(e=>e.style.cssText=t),n.length>0}addStyle(e,t){const n=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[addStyle]",e,t,n),n.forEach(e=>e.style.cssText+="; "+t),n.length>0}prehide(e){const t=h("autoconsent-prehide");return this.autoconsentInstance.config.logs.lifecycle&&console.log("[prehide]",t,location.href),m(t,e,"opacity")}undoPrehide(){const e=h("autoconsent-prehide");this.autoconsentInstance.config.logs.lifecycle&&console.log("[undoprehide]",e,location.href),e.remove()}async createOrUpdateStyleSheet(e,t){return t||(t=new CSSStyleSheet),t=await t.replace(e)}removeStyleSheet(e){return!!e&&(e.replace(""),!0)}querySingleReplySelector(e,t=document){if(e.startsWith("aria/"))return[];if(e.startsWith("xpath/")){const n=e.slice(6),o=document.evaluate(n,t,null,XPathResult.ANY_TYPE,null);let i=null;const s=[];for(;i=o.iterateNext();)s.push(i);return s}return e.startsWith("text/")||e.startsWith("pierce/")?[]:t.shadowRoot?Array.from(t.shadowRoot.querySelectorAll(e)):t.contentDocument?.querySelectorAll?Array.from(t.contentDocument.querySelectorAll(e)):Array.from(t.querySelectorAll(e))}querySelectorChain(e){let t=document,n=[];for(const o of e){if(n=this.querySingleReplySelector(o,t),0===n.length)return[];t=n[0]}return n}elementSelector(e){return"string"==typeof e?this.querySingleReplySelector(e):this.querySelectorChain(e)}waitForMutation(e,t=6e4){const n=this.elementSelector(e);if(0===n.length)throw new Error(`${e} did not match any elements`);return new Promise((e,o)=>{const i=setTimeout(()=>{o(new Error("Timed out waiting for mutation")),s.disconnect()},t),s=new MutationObserver(()=>{clearTimeout(i),s.disconnect(),e(!0)});s.observe(n[0],{subtree:!0,childList:!0,attributes:!0})})}},D=[["exists","e"],["visible","v"],["waitForThenClick","c"],["click","k"],["waitFor","w"],["waitForVisible","wv"],["hide","h"],["cookieContains","cc"]];function q(e){return 1===e||0!==e&&void 0}var U,B=class{constructor(e,t){this.intermediate=!1,this.optIn=[],this.r=e,this.s=t,this.r[10]&&this.r[10].intermediate&&(this.intermediate=this.r[10].intermediate)}_decodeRuleStep(e){const t={...e},n=this._decodeRuleStep.bind(this);for(const[e,n]of D)void 0!==t[n]&&(t[e]=this.s[t[n]],delete t[n]);return e.if&&(t.if=n(e.if),t.then=e.then&&e.then.map(n),e.else&&(t.else=e.else.map(n))),e.any&&(t.any=e.any.map(n)),{...t}}get minimumRuleStepVersion(){return this.r[0]}get name(){return this.r[1]}get cosmetic(){return q(this.r[2])}get runContext(){const e={},t=this.r[3],n=this.r[4],o=q(Math.floor(n/10)%10),i=q(n%10);return void 0!==o&&(e.main=o),void 0!==i&&(e.frame=i),""!==t&&(e.urlPattern=t),e}get prehideSelectors(){return this.r[5].map(e=>this.s[e].toString())}get detectCmp(){return this.r[6].map(this._decodeRuleStep.bind(this))}get detectPopup(){return this.r[7].map(this._decodeRuleStep.bind(this))}get optOut(){return this.r[8].map(this._decodeRuleStep.bind(this))}get test(){return this.r[9].map(this._decodeRuleStep.bind(this))}};U=new WeakMap;const H=new class{constructor(t,n=null,o=null){var i,s,r;if(this.id=l(),this.rules=[],i=this,(s=U).has(i)?e("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(i):s.set(i,r),this.state={cosmeticFiltersOn:!1,filterListReported:!1,lifecycle:"loading",prehideOn:!1,findCmpAttempts:0,detectedCmps:[],detectedPopups:[],heuristicPatterns:[],heuristicSnippets:[],selfTest:null,clicks:0,startTime:0,endTime:0},p.sendContentMessage=t,this.sendContentMessage=t,this.rules=[],this.updateState({lifecycle:"loading"}),this.addDynamicRules(),n)this.initialize(n,o);else{o&&this.parseDeclarativeRules(o);t({type:"init",url:window.location.href}),this.updateState({lifecycle:"waitingForInitResponse"})}this.domActions=new j(this)}get config(){if(!n(this,U))throw new Error("AutoConsent is not initialized yet");return n(this,U)}initialize(e,n){const o=y(e);var i,s,r,c;if(o.logs.lifecycle&&console.log("autoconsent init",window.location.href),r=o,t(i=this,s=U,"write to private field"),c?c.call(i,r):s.set(i,r),o.enabled){if(n&&this.parseDeclarativeRules(n),e.enableFilterList&&this.initializeFilterList(),this.rules=function(e,t){return e.filter(e=>(!t.disabledCmps||!t.disabledCmps.includes(e.name))&&(t.enableCosmeticRules||!e.isCosmetic)&&(t.enableGeneratedRules||!e.name.startsWith("auto_")))}(this.rules,o),this.shouldPrehide)if(document.documentElement)this.prehideElements();else{const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.prehideElements()};window.addEventListener("DOMContentLoaded",e)}if("loading"===document.readyState){const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.start()};window.addEventListener("DOMContentLoaded",e)}else this.start();this.updateState({lifecycle:"initialized"})}else o.logs.lifecycle&&console.log("autoconsent is disabled")}initializeFilterList(){}get shouldPrehide(){return this.config.enablePrehide&&!this.config.visualTest}saveFocus(){this.focusedElement=document.activeElement,this.focusedElement&&this.config.logs.lifecycle&&console.log("saving focus",this.focusedElement,location.href)}restoreFocus(){if(this.focusedElement){this.config.logs.lifecycle&&console.log("restoring focus",this.focusedElement,location.href);try{this.focusedElement.focus({preventScroll:!0})}catch(e){this.config.logs.errors&&console.warn("error restoring focus",e)}this.focusedElement=void 0}}addDynamicRules(){V.forEach(e=>{this.rules.push(new e(this))})}parseDeclarativeRules(e){const t=n(this,U)?.performanceLoggingEnabled;if(t&&performance.mark("parseDeclarativeRulesStart"),e.consentomatic)for(const[t,n]of Object.entries(e.consentomatic))this.addConsentomaticCMP(t,n);if(e.autoconsent&&e.autoconsent.forEach(e=>{this.addDeclarativeCMP(e)}),e.compact)try{(function(e){if(e.v>1)throw new Error("Unsupported rule format.");return e.r.filter(e=>e[0]<=2).map(t=>new B(t,e.s))})(e.compact).forEach(this.addDeclarativeCMP.bind(this))}catch(e){n(this,U)?.logs.errors&&console.error(e)}t&&performance.mark("parseDeclarativeRulesEnd"),t&&performance.measure("parseDeclarativeRules","parseDeclarativeRulesStart","parseDeclarativeRulesEnd")}addDeclarativeCMP(e){(e.minimumRuleStepVersion||1)<=2&&this.rules.push(new I(e,this))}addConsentomaticCMP(e,t){this.rules.push(new z(`com_${e}`,t))}start(){!function(e,t=500){globalThis.requestIdleCallback?requestIdleCallback(e,{timeout:t}):setTimeout(e,0)}(()=>this._start())}async _start(){const e=this.config.logs;e.lifecycle&&console.log(`Detecting CMPs on ${window.location.href}`),this.updateState({lifecycle:"started"});const t=await this.findCmp(this.config.detectRetries);if(this.updateState({detectedCmps:t.map(e=>e.name)}),this.config.performanceLoggingEnabled&&this.updateState({performance:this.measurePerformance()}),0===t.length)return e.lifecycle&&console.log("no CMP found",location.href),this.shouldPrehide&&this.undoPrehide(),this.filterListFallback();this.updateState({lifecycle:"cmpDetected"});const n=[],o=[];for(const e of t)e.isCosmetic?o.push(e):n.push(e);let i=!1,s=await this.detectPopups(n,async e=>{i=await this.handlePopup(e)});if(0===s.length&&(s=await this.detectPopups(o,async e=>{i=await this.handlePopup(e)})),0===s.length)return e.lifecycle&&console.log("no popup found"),this.shouldPrehide&&this.undoPrehide(),!1;if(s.length>1){const t={msg:"Found multiple CMPs, check the detection rules.",cmps:s.map(e=>e.name)};e.errors&&console.warn(t.msg,t.cmps),this.sendContentMessage({type:"autoconsentError",details:t})}return i}async findCmp(e){const t=this.config.logs;this.updateState({findCmpAttempts:this.state.findCmpAttempts+1});const n=[],o=_(),i=[],s=[];this.rules.forEach(e=>{if(e.checkFrameContext(o)){const t=!!e.runContext.urlPattern;e.hasMatchingUrlPattern()?i.push(e):t||s.push(e)}});const r=o&&this.config.enableHeuristicAction&&this.state.findCmpAttempts%2==0?[new L(this)]:[],c=[["site-specific",i],["generic",s],["heuristic",r]],a=async e=>{try{await e.detectCmp()&&(t.lifecycle&&console.log(`Found CMP: ${e.name} ${window.location.href}`),this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:e.name}),n.push(e))}catch(n){t.errors&&console.warn(`error detecting ${e.name}`,n)}},l=this.domActions.waitForMutation("html");l.catch(()=>{});for(const[e,o]of c)if(t.lifecycle&&o.length>0&&console.log(`Trying ${e} rules`,o.map(e=>e.name)),this.config.performanceLoggingEnabled&&performance.mark(`findCmpStage_${e}`),await Promise.all(o.map(a)),this.config.performanceLoggingEnabled&&performance.mark(`findCmpStageEnd_${e}`),this.config.performanceLoggingEnabled&&performance.measure(`findCmp_${e}`,`findCmpStage_${e}`,`findCmpStageEnd_${e}`),n.length>0)break;if(this.detectHeuristics(),0===n.length&&e>0){const t=[this.domActions.wait(500)];this.state.findCmpAttempts>1&&t.push(l);try{await Promise.all(t)}catch(e){return[]}return this.findCmp(e-1)}return n}detectHeuristics(){if(this.config.enableHeuristicDetection){this.config.performanceLoggingEnabled&&performance.mark("detectHeuristicsStart");const{patterns:e,snippets:t}=C(document.documentElement?.innerText||"");e.length>0&&(e.length!==this.state.heuristicPatterns.length||this.state.heuristicPatterns.some((t,n)=>t!==e[n]))&&(this.config.logs.lifecycle&&console.log("Heuristic patterns found",e,t),this.updateState({heuristicPatterns:e,heuristicSnippets:t})),this.config.performanceLoggingEnabled&&performance.mark("detectHeuristicsEnd"),this.config.performanceLoggingEnabled&&performance.measure("detectHeuristics","detectHeuristicsStart","detectHeuristicsEnd")}}async detectPopup(e){if(await this.waitForPopup(e).catch(t=>(this.config.logs.errors&&console.warn(`error waiting for a popup for ${e.name}`,t),!1)))return this.updateState({detectedPopups:this.state.detectedPopups.concat([e.name])}),this.sendContentMessage({type:"popupFound",cmp:e.name,url:location.href}),e;throw new Error("Popup is not shown")}async detectPopups(e,t){const n=e.map(e=>this.detectPopup(e));await Promise.any(n).then(e=>{this.detectHeuristics(),t(e)}).catch(()=>{});const o=await Promise.allSettled(n),i=[];for(const e of o)"fulfilled"===e.status&&i.push(e.value);return i}async handlePopup(e){return this.updateState({lifecycle:"openPopupDetected",startTime:Date.now()}),this.shouldPrehide&&!this.state.prehideOn&&this.prehideElements(),this.state.cosmeticFiltersOn&&this.undoCosmetics(),this.foundCmp=e,"optOut"===this.config.autoAction?await this.doOptOut():"optIn"===this.config.autoAction?await this.doOptIn():(this.config.logs.lifecycle&&console.log("waiting for opt-out signal...",location.href),!0)}async doOptOut(){const e=this.config.logs;let t;return this.updateState({lifecycle:"runningOptOut"}),this.saveFocus(),this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: opt out on ${window.location.href}`),t=await this.foundCmp.optOut(),e.lifecycle&&console.log(`${this.foundCmp.name}: opt out result ${t}`)):(e.errors&&console.log("no CMP to opt out"),t=!1),this.shouldPrehide&&this.undoPrehide(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:Boolean(this.foundCmp&&this.foundCmp.hasSelfTest),url:location.href}),t&&this.foundCmp&&!this.foundCmp.isIntermediate?(this.state.endTime=Date.now(),e.lifecycle&&console.log(`${this.foundCmp.name}: done in ${this.state.endTime-this.state.startTime}ms with ${this.state.clicks} clicks`),this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp?.name,isCosmetic:this.foundCmp?.isCosmetic,url:location.href,duration:this.state.endTime-this.state.startTime,totalClicks:this.state.clicks}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optOutSucceeded":"optOutFailed"}),this.restoreFocus(),t}async doOptIn(){const e=this.config.logs;let t;return this.updateState({lifecycle:"runningOptIn"}),this.saveFocus(),this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: opt in on ${window.location.href}`),t=await this.foundCmp.optIn(),e.lifecycle&&console.log(`${this.foundCmp.name}: opt in result ${t}`)):(e.errors&&console.log("no CMP to opt in"),t=!1),this.shouldPrehide&&this.undoPrehide(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:!1,url:location.href}),t&&this.foundCmp&&!this.foundCmp.isIntermediate?(this.state.endTime=Date.now(),e.lifecycle&&console.log(`${this.foundCmp.name}: done in ${this.state.endTime-this.state.startTime}ms with ${this.state.clicks} clicks`),this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href,duration:this.state.endTime-this.state.startTime,totalClicks:this.state.clicks}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optInSucceeded":"optInFailed"}),this.restoreFocus(),t}async doSelfTest(){const e=this.config.logs;let t;return this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: self-test on ${window.location.href}`),t=await this.foundCmp.test()):(e.errors&&console.log("no CMP to self test"),t=!1),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,url:location.href}),this.updateState({selfTest:t}),t}async waitForPopup(e,t=10,n=500){const o=this.config.logs;o.lifecycle&&console.log("checking if popup is open...",e.name);let i=null;this.config.enablePopupMutationObserver&&(i=this.domActions.waitForMutation("html",1e4),i.catch(()=>{}));const s=await e.detectPopup().catch(t=>(o.errors&&console.warn(`error detecting popup for ${e.name}`,t),!1));if(!s&&t>0){if(i)try{await Promise.all([this.domActions.wait(n),i])}catch(t){o.lifecycle&&console.log(e.name,"popup detection timed out waiting for DOM mutation")}else await this.domActions.wait(n);return this.waitForPopup(e,t-1,n)}return o.lifecycle&&console.log(e.name,"popup is "+(s?"open":"not open")),s}prehideElements(){const e=this.config.logs,t=this.rules.filter(e=>e.prehideSelectors&&e.checkRunContext()).reduce((e,t)=>[...e||[],...t.prehideSelectors||[]],["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]);return this.updateState({prehideOn:!0}),setTimeout(()=>{this.shouldPrehide&&this.state.prehideOn&&!["runningOptOut","runningOptIn"].includes(this.state.lifecycle)&&(e.lifecycle&&console.log("Process is taking too long, unhiding elements"),this.undoPrehide())},this.config.prehideTimeout||2e3),this.domActions.prehide(t.join(","))}undoPrehide(){this.updateState({prehideOn:!1}),this.domActions.undoPrehide()}undoCosmetics(){}reportFilterlist(){this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:"filterList"}),this.sendContentMessage({type:"popupFound",cmp:"filterList",url:location.href}),this.updateState({filterListReported:!0})}filterListFallback(){return this.updateState({lifecycle:"nothingDetected"}),!1}updateState(e){Object.assign(this.state,e),this.sendContentMessage({type:"report",instanceId:this.id,url:window.location.href,mainFrame:_(),state:this.state})}async receiveMessageCallback(e){const t=n(this,U)?.logs;switch(t?.messages&&console.log("received from background",e,window.location.href),e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optIn":await this.doOptIn();break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,t){const n=p.pending.get(e);n?(p.pending.delete(e),n.timer&&window.clearTimeout(n.timer),n.resolve(t)):console.warn("no eval #",e)}(e.id,e.result);break;case"measurePerformance":this.updateState({performance:this.measurePerformance()})}}measurePerformance(){const e=e=>performance.getEntriesByName(e).map(e=>Number(e.duration.toFixed(3)));return{detectHeuristics:e("detectHeuristics"),heuristicDetector:e("heuristicDetector"),findCmpSiteSpecific:e("findCmp_site-specific"),findCmpGeneric:e("findCmp_generic"),findCmpHeuristic:e("findCmp_heuristic"),parseDeclarativeRules:e("parseDeclarativeRules")}}}(e=>{AutoconsentAndroid.process(JSON.stringify(e))},null,{consentomatic:{oil:{detectors:[{presentMatcher:{target:{selector:".as-oil-content-overlay"},type:"css"},showingMatcher:{target:{selector:".as-oil-content-overlay"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".as-js-advanced-settings"},type:"click"},{retries:"10",target:{selector:".as-oil-cpc__purpose-container"},type:"waitcss",waitTime:"250"}],type:"list"},name:"OPEN_OPTIONS"},{action:{actions:[{consents:[{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Information storage and access","Opbevaring af og adgang til oplysninger på din enhed"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Information storage and access","Opbevaring af og adgang til oplysninger på din enhed"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"D"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personlige annoncer","Personalisation"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personlige annoncer","Personalisation"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"E"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Annoncevalg, levering og rapportering","Ad selection, delivery, reporting"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Annoncevalg, levering og rapportering","Ad selection, delivery, reporting"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"F"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personalisering af indhold","Content selection, delivery, reporting"]},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:["Personalisering af indhold","Content selection, delivery, reporting"]},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"E"},{matcher:{parent:{childFilter:{target:{selector:".as-oil-cpc__purpose-header",textFilter:["Måling","Measurement"]}},selector:".as-oil-cpc__purpose-container"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{childFilter:{target:{selector:".as-oil-cpc__purpose-header",textFilter:["Måling","Measurement"]}},selector:".as-oil-cpc__purpose-container"},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"B"},{matcher:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:"Google"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".as-oil-cpc__purpose-container",textFilter:"Google"},target:{selector:".as-oil-cpc__switch"},type:"click"},type:"F"}],type:"consent"}],type:"list"},name:"DO_CONSENT"},{action:{target:{selector:".as-oil__btn-optin"},type:"click"},name:"SAVE_CONSENT"},{action:{target:{selector:"div.as-oil"},type:"hide"},name:"HIDE_CMP"}]},optanon:{detectors:[{presentMatcher:{target:{selector:"#optanon-menu, .optanon-alert-box-wrapper"},type:"css"},showingMatcher:{target:{displayFilter:!0,selector:".optanon-alert-box-wrapper"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".optanon-alert-box-wrapper .optanon-toggle-display, a[onclick*='OneTrust.ToggleInfoDisplay()'], a[onclick*='Optanon.ToggleInfoDisplay()']"},type:"click"}],type:"list"},name:"OPEN_OPTIONS"},{action:{actions:[{target:{selector:".preference-menu-item #Your-privacy"},type:"click"},{target:{selector:"#optanon-vendor-consent-text"},type:"click"},{action:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},target:{selector:"#optanon-vendor-consent-list .vendor-item"},type:"foreach"},{target:{selector:".vendor-consent-back-link"},type:"click"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-performance"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-performance"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-functional"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-functional"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-advertising"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-advertising"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-social"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-social"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Social Media Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Social Media Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalisation"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalisation"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Site monitoring cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Site monitoring cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Third party privacy-enhanced content"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Third party privacy-enhanced content"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Performance & Advertising Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Performance & Advertising Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Information storage and access"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Information storage and access"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"D"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad selection, delivery, reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad selection, delivery, reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content selection, delivery, reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content selection, delivery, reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Measurement"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Measurement"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Recommended Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Recommended Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Unclassified Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Unclassified Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"X"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Analytical Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Analytical Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"B"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Marketing Cookies"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Marketing Cookies"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalization"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Personalization"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad Selection, Delivery & Reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Ad Selection, Delivery & Reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},type:"ifcss"},{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content Selection, Delivery & Reporting"},trueAction:{actions:[{parent:{selector:"#optanon-menu, .optanon-menu"},target:{selector:".menu-item-necessary",textFilter:"Content Selection, Delivery & Reporting"},type:"click"},{consents:[{matcher:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status input"},type:"checkbox"},toggleAction:{parent:{selector:"#optanon-popup-body-right"},target:{selector:".optanon-status label"},type:"click"},type:"E"}],type:"consent"}],type:"list"},type:"ifcss"}],type:"list"},name:"DO_CONSENT"},{action:{parent:{selector:".optanon-save-settings-button"},target:{selector:".optanon-white-button-middle"},type:"click"},name:"SAVE_CONSENT"},{action:{actions:[{target:{selector:"#optanon-popup-wrapper"},type:"hide"},{target:{selector:"#optanon-popup-bg"},type:"hide"},{target:{selector:".optanon-alert-box-wrapper"},type:"hide"}],type:"list"},name:"HIDE_CMP"}]},quantcast2:{detectors:[{presentMatcher:{target:{selector:"[data-tracking-opt-in-overlay]"},type:"css"},showingMatcher:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-learn-more]"},type:"css"}}],methods:[{action:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-learn-more]"},type:"click"},name:"OPEN_OPTIONS"},{action:{actions:[{type:"wait",waitTime:500},{action:{actions:[{target:{selector:"div",textFilter:["Information storage and access"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"D"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Personalization"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"F"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Ad selection, delivery, reporting"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"F"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Content selection, delivery, reporting"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"E"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Measurement"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"B"}],type:"consent"},type:"ifcss"},{target:{selector:"div",textFilter:["Other Partners"]},trueAction:{consents:[{matcher:{target:{selector:"input"},type:"checkbox"},toggleAction:{target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},type:"ifcss"}],type:"list"},parent:{childFilter:{target:{selector:"input"}},selector:"[data-tracking-opt-in-overlay] > div > div"},target:{childFilter:{target:{selector:"input"}},selector:":scope > div"},type:"foreach"}],type:"list"},name:"DO_CONSENT"},{action:{target:{selector:"[data-tracking-opt-in-overlay] [data-tracking-opt-in-save]"},type:"click"},name:"SAVE_CONSENT"}]},springer:{detectors:[{presentMatcher:{parent:null,target:{selector:".cmp-app_gdpr"},type:"css"},showingMatcher:{parent:null,target:{displayFilter:!0,selector:".cmp-popup_popup"},type:"css"}}],methods:[{action:{actions:[{target:{selector:".cmp-intro_rejectAll"},type:"click"},{type:"wait",waitTime:250},{target:{selector:".cmp-purposes_purposeItem:not(.cmp-purposes_selectedPurpose)"},type:"click"}],type:"list"},name:"OPEN_OPTIONS"},{action:{consents:[{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Przechowywanie informacji na urządzeniu lub dostęp do nich",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Przechowywanie informacji na urządzeniu lub dostęp do nich",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"D"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór podstawowych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór podstawowych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"F"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"F"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"E"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Tworzenie profilu spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"E"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Wybór spersonalizowanych treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności reklam",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Pomiar wydajności treści",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"B"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Stosowanie badań rynkowych w celu generowania opinii odbiorców",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Stosowanie badań rynkowych w celu generowania opinii odbiorców",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"X"},{matcher:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Opracowywanie i ulepszanie produktów",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch .cmp-switch_isSelected"},type:"css"},toggleAction:{parent:{selector:".cmp-purposes_detailHeader",textFilter:"Opracowywanie i ulepszanie produktów",childFilter:{target:{selector:".cmp-switch_switch"}}},target:{selector:".cmp-switch_switch:not(.cmp-switch_isSelected)"},type:"click"},type:"X"}],type:"consent"},name:"DO_CONSENT"},{action:{target:{selector:".cmp-details_save"},type:"click"},name:"SAVE_CONSENT"}]},wordpressgdpr:{detectors:[{presentMatcher:{parent:null,target:{selector:".wpgdprc-consent-bar"},type:"css"},showingMatcher:{parent:null,target:{displayFilter:!0,selector:".wpgdprc-consent-bar"},type:"css"}}],methods:[{action:{parent:null,target:{selector:".wpgdprc-consent-bar .wpgdprc-consent-bar__settings",textFilter:null},type:"click"},name:"OPEN_OPTIONS"},{action:{actions:[{target:{selector:".wpgdprc-consent-modal .wpgdprc-button",textFilter:"Eyeota"},type:"click"},{consents:[{description:"Eyeota Cookies",matcher:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Eyeota"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Eyeota"},target:{selector:"label"},type:"click"},type:"X"}],type:"consent"},{target:{selector:".wpgdprc-consent-modal .wpgdprc-button",textFilter:"Advertising"},type:"click"},{consents:[{description:"Advertising Cookies",matcher:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Advertising"},target:{selector:"input"},type:"checkbox"},toggleAction:{parent:{selector:".wpgdprc-consent-modal__description",textFilter:"Advertising"},target:{selector:"label"},type:"click"},type:"F"}],type:"consent"}],type:"list"},name:"DO_CONSENT"},{action:{parent:null,target:{selector:".wpgdprc-button",textFilter:"Save my settings"},type:"click"},name:"SAVE_CONSENT"}]}}});window.autoconsentMessageCallback=e=>{H.receiveMessageCallback(e)}}(); +!function(){"use strict";var e=e=>{throw TypeError(e)},t=(t,i,n)=>i.has(t)||e("Cannot "+n),i=(e,i,n)=>(t(e,i,"read from private field"),n?n.call(e):i.get(e));function n(){return crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString()}var o=class{constructor(e,t=1e3){this.id=e,this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t}),this.timer=window.setTimeout(()=>{this.reject(new Error("timeout"))},t)}},s={pending:new Map,sendContentMessage:null};function a(e="autoconsent-css-rules"){const t=`style#${e}`,i=document.querySelector(t);if(i&&i instanceof HTMLStyleElement)return i;{const t=document.head||document.getElementsByTagName("head")[0]||document.documentElement,i=document.createElement("style");return i.id=e,t.appendChild(i),i}}function r(e,t,i="display"){const n=`${t} { ${function(e){return("opacity"===e?"opacity: 0":"display: none")+" !important; z-index: -1 !important; pointer-events: none !important;"}(i)} } `;return e instanceof HTMLStyleElement&&(e.innerText+=n,t.length>0)}async function c(e,t,i){const n=await e();return!n&&t>0?new Promise(n=>{setTimeout(async()=>{n(c(e,t-1,i))},i)}):Promise.resolve(n)}function l(e){if(!e)return!1;if(null!==e.offsetParent)return!0;{const t=window.getComputedStyle(e);if("fixed"===t.position&&"none"!==t.display)return!0}return!1}function u(e){const t={enabled:!0,autoAction:"optOut",disabledCmps:[],enablePrehide:!0,enableCosmeticRules:!0,enableGeneratedRules:!0,enableHeuristicDetection:!1,enablePopupMutationObserver:!1,detectRetries:20,isMainWorld:!1,prehideTimeout:2e3,visualTest:!1,logs:{lifecycle:!1,rulesteps:!1,detectionsteps:!1,evals:!1,errors:!0,messages:!1,waits:!1},performanceLoggingEnabled:!1,heuristicPopupSearchTimeout:100,heuristicMode:"off"},i=(n=t,globalThis.structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n)));var n;for(const n of Object.keys(t))void 0!==e[n]&&(i[n]=e[n]);return i}function d(e){const t=e;if(!e.style)return;if(void 0!==t.__oldStyles)return;e.hasAttribute("style")&&(t.__oldStyles=e.style.cssText),e.style.animation="pulsate .5s infinite",e.style.outline="solid red";let i=document.querySelector("style#autoconsent-debug-styles");i||(i=document.createElement("style"),i.id="autoconsent-debug-styles"),i.textContent="\n @keyframes pulsate {\n 0% {\n outline-width: 8px;\n outline-offset: -4px;\n }\n 50% {\n outline-width: 4px;\n outline-offset: -2px;\n }\n 100% {\n outline-width: 8px;\n outline-offset: -4px;\n }\n }\n ",document.head.appendChild(i)}function h(e){const t=e;e.style&&e.hasAttribute("style")&&(void 0!==t.__oldStyles?(e.style.cssText=t.__oldStyles,delete t.__oldStyles):e.removeAttribute("style"))}function p(){return window.top===window&&(!globalThis.location.ancestorOrigins||0===globalThis.location.ancestorOrigins.length)}var m={EVAL_0:()=>console.log(1),EVAL_DIDOMI_OPT_OUT:()=>!!window.Didomi&&(window.Didomi.setUserDisagreeToAll(),!0),EVAL_DIDOMI_TEST:()=>{const e=window.Didomi?.getCurrentUserStatus?.()?.purposes;if(e)return Object.values(e).some(e=>!e.enabled);const t=window.Didomi?.getUserConsentStatusForAll?.()?.purposes?.disabled;return Array.isArray(t)&&t.length>0},EVAL_CONSENTMANAGER_1:()=>window.__cmp&&"object"==typeof __cmp("getCMPData"),EVAL_CONSENTMANAGER_2:()=>!__cmp("consentStatus").userChoiceExists,EVAL_CONSENTMANAGER_3:()=>__cmp("setConsent",0),EVAL_CONSENTMANAGER_4:()=>__cmp("setConsent",1),EVAL_CONSENTMANAGER_5:()=>__cmp("consentStatus").userChoiceExists,EVAL_COOKIEBOT_1:()=>!!window.Cookiebot,EVAL_COOKIEBOT_2:()=>!window.Cookiebot.hasResponse&&!0===window.Cookiebot.dialog?.visible,EVAL_COOKIEBOT_3:()=>window.Cookiebot.withdraw()||!0,EVAL_COOKIEBOT_4:()=>window.Cookiebot.hide()||!0,EVAL_COOKIEBOT_5:()=>!0===window.Cookiebot.declined,EVAL_KLARO_1:()=>{const e=globalThis.klaroConfig||globalThis.klaro?.getManager&&globalThis.klaro.getManager().config;if(!e)return!0;const t=(e.services||e.apps).filter(e=>!e.required).map(e=>e.name);if(klaro&&klaro.getManager){const e=klaro.getManager();return t.every(t=>!e.consents[t])}if(klaroConfig&&"cookie"===klaroConfig.storageMethod){const e=klaroConfig.cookieName||klaroConfig.storageName,i=JSON.parse(decodeURIComponent(document.cookie.split(";").find(t=>t.trim().startsWith(e)).split("=")[1]));return Object.keys(i).filter(e=>t.includes(e)).every(e=>!1===i[e])}},EVAL_KLARO_OPEN_POPUP:()=>{klaro.show(void 0,!0)},EVAL_KLARO_TRY_API_OPT_OUT:()=>{if(window.klaro&&"function"==typeof klaro.show&&"function"==typeof klaro.getManager)try{return klaro.getManager().changeAll(!1),klaro.getManager().saveAndApplyConsents(),!0}catch(e){return console.warn(e),!1}return!1},EVAL_ONETRUST_1:()=>window.OnetrustActiveGroups.split(",").filter(e=>e.length>0).length<=1,EVAL_TRUSTARC_TOP:()=>window&&window.truste&&"0"===window.truste.eu.bindMap.prefCookie,EVAL_TRUSTARC_FRAME_TEST:()=>window&&window.QueryString&&"0"===window.QueryString.preferences,EVAL_TRUSTARC_FRAME_GTM:()=>window&&window.QueryString&&"1"===window.QueryString.gtm,EVAL_ADOPT_TEST:()=>!!localStorage.getItem("adoptConsentMode"),EVAL_ADULTFRIENDFINDER_TEST:()=>!!localStorage.getItem("cookieConsent"),EVAL_BAHN_TEST:()=>1===utag.gdpr.getSelectedCategories().length,EVAL_BIGCOMMERCE_CONSENT_MANAGER_DETECT:()=>!(!window.consentManager||!window.consentManager.version),EVAL_BORLABS_0:()=>!JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>-1!==e.indexOf("borlabs-cookie")).split("=",2)[1])).consents.statistics,EVAL_CC_BANNER2_0:()=>!!document.cookie.match(/sncc=[^;]+D%3Dtrue/),EVAL_COINBASE_0:()=>JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length<=1,EVAL_COOKIE_LAW_INFO_0:()=>(CLI.disableAllCookies&&CLI.disableAllCookies(),CLI.reject_close&&CLI.reject_close(),document.body.classList.remove("cli-barmodal-open"),!0),EVAL_COOKIE_LAW_INFO_DETECT:()=>!!window.CLI,EVAL_COOKIE_MANAGER_POPUP_0:()=>!1===JSON.parse(document.cookie.split(";").find(e=>e.trim().startsWith("CookieLevel")).split("=")[1]).social,EVAL_COOKIEALERT_0:()=>document.querySelector("body").removeAttribute("style")||!0,EVAL_COOKIEALERT_1:()=>document.querySelector("body").removeAttribute("style")||!0,EVAL_COOKIEALERT_2:()=>!0===window.CookieConsent.declined,EVAL_COOKIEFIRST_0:()=>{return!1===(e=JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>-1!==e.indexOf("cookiefirst")).trim()).split("=")[1])).performance&&!1===e.functional&&!1===e.advertising;var e},EVAL_COOKIEFIRST_1:()=>document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach(e=>"true"===e.getAttribute("aria-checked")&&e.click())||!0,EVAL_COOKIEINFORMATION_0:()=>CookieInformation.declineAllCategories()||!0,EVAL_COOKIEINFORMATION_1:()=>CookieInformation.submitAllCategories()||!0,EVAL_ETSY_0:()=>document.querySelectorAll(".gdpr-overlay-body input").forEach(e=>{e.checked=!1})||!0,EVAL_ETSY_1:()=>document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click()||!0,EVAL_EZOIC_0:()=>ezCMP.handleAcceptAllClick(),EVAL_FIDES_DETECT_POPUP:()=>window.Fides?.initialized,EVAL_GDPR_LEGAL_COOKIE_DETECT_CMP:()=>!!window.GDPR_LC,EVAL_GDPR_LEGAL_COOKIE_TEST:()=>!!window.GDPR_LC?.userConsentSetting,EVAL_IUBENDA_0:()=>document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach(e=>{e.checked&&e.click()})||!0,EVAL_IUBENDA_1:()=>!!document.cookie.match(/_iub_cs-\d+=/),EVAL_MICROSOFT_0:()=>Array.from(document.querySelectorAll("div > button")).filter(e=>e.innerText.match("Reject|Ablehnen"))[0].click()||!0,EVAL_MICROSOFT_1:()=>Array.from(document.querySelectorAll("div > button")).filter(e=>e.innerText.match("Accept|Annehmen"))[0].click()||!0,EVAL_MICROSOFT_2:()=>!!document.cookie.match("MSCC|GHCC"),EVAL_MOOVE_0:()=>document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach(e=>{e.disabled||(e.checked="moove_gdpr_strict_cookies"===e.name||"moove_gdpr_strict_cookies"===e.id)})||!0,EVAL_NHNIEUWS_TEST:()=>!!localStorage.getItem("psh:cookies-seen"),EVAL_OSANO_DETECT:()=>!!window.Osano?.cm?.dialogOpen,EVAL_PANDECTES_TEST:()=>document.cookie.includes("_pandectes_gdpr=")&&"deny"===JSON.parse(atob(document.cookie.split(";").find(e=>e.trim().startsWith("_pandectes_gdpr")).split("=")[1])).status,EVAL_POVR_GOBACK:()=>window.history.back()||!0,EVAL_PUBTECH_0:()=>document.cookie.includes("euconsent-v2")&&(document.cookie.match(/.YAAAAAAAAAAA/)||document.cookie.match(/.aAAAAAAAAAAA/)||document.cookie.match(/.YAAACFgAAAAA/)),EVAL_SHOPIFY_TEST:()=>document.cookie.includes("gdpr_cookie_consent=0")||document.cookie.includes("_tracking_consent=")&&!1===JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>e.trim().startsWith("_tracking_consent")).split("=")[1])).purposes.a,EVAL_SKYSCANNER_TEST:()=>document.cookie.match(/gdpr=[^;]*adverts:::false/)&&!document.cookie.match(/gdpr=[^;]*init:::true/),EVAL_SIRDATA_UNBLOCK_SCROLL:()=>(document.documentElement.classList.forEach(e=>{e.startsWith("sd-cmp-")&&document.documentElement.classList.remove(e)}),!0),EVAL_STEAMPOWERED_0:()=>2===JSON.parse(decodeURIComponent(document.cookie.split(";").find(e=>e.trim().startsWith("cookieSettings")).split("=")[1])).preference_state,EVAL_TAKEALOT_0:()=>document.body.classList.remove("freeze")||(document.body.style="")||!0,EVAL_TARTEAUCITRON_0:()=>tarteaucitron.userInterface.respondAll(!1)||!0,EVAL_TARTEAUCITRON_1:()=>tarteaucitron.userInterface.respondAll(!0)||!0,EVAL_TARTEAUCITRON_2:()=>document.cookie.match(/tarteaucitron=[^;]*/)?.[0].includes("false"),EVAL_TEALIUM_0:()=>void 0!==window.utag&&"object"==typeof utag.gdpr,EVAL_TEALIUM_1:()=>utag.gdpr.setConsentValue(!1)||!0,EVAL_TEALIUM_DONOTSELL:()=>utag.gdpr.dns?.setDnsState(!1)||!0,EVAL_TEALIUM_2:()=>utag.gdpr.setConsentValue(!0)||!0,EVAL_TEALIUM_3:()=>1!==utag.gdpr.getConsentState(),EVAL_TEALIUM_DONOTSELL_CHECK:()=>1!==utag.gdpr.dns?.getDnsState(),EVAL_TESTCMP_STEP:()=>!!document.querySelector("#reject-all"),EVAL_TESTCMP_0:()=>"button_clicked"===window.results.results[0],EVAL_TESTCMP_COSMETIC_0:()=>"banner_hidden"===window.results.results[0],EVAL_THEFREEDICTIONARY_0:()=>cmpUi.showPurposes()||cmpUi.rejectAll()||!0,EVAL_THEFREEDICTIONARY_1:()=>cmpUi.allowAll()||!0,EVAL_USERCENTRICS_API_0:()=>"object"==typeof UC_UI,EVAL_USERCENTRICS_API_1:()=>!!UC_UI.closeCMP(),EVAL_USERCENTRICS_API_2:()=>!!UC_UI.denyAllConsents(),EVAL_USERCENTRICS_API_3:()=>!!UC_UI.acceptAllConsents(),EVAL_USERCENTRICS_API_4:()=>!!UC_UI.closeCMP(),EVAL_USERCENTRICS_API_5:()=>!0===UC_UI.areAllConsentsAccepted(),EVAL_USERCENTRICS_API_6:()=>!1===UC_UI.areAllConsentsAccepted(),EVAL_USERCENTRICS_BUTTON_0:()=>JSON.parse(localStorage.getItem("usercentrics")).consents.every(e=>e.isEssential||!e.consentStatus),EVAL_WAITROSE_0:()=>Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach(e=>e.click())||!0};var g=[/accept cookies/gi,/accept all/gi,/reject all/gi,/only necessary cookies/gi,/(?:by continuing.{0,100}cookie)|(?:cookie.{0,100}by continuing)/gi,/(?:by continuing.{0,100}privacy)|(?:privacy.{0,100}by continuing)/gi,/by clicking.{0,100}(?:accept|agree|allow)/gi,/we (?:use|serve)(?: optional)? cookies/gi,/we are using cookies/gi,/use of cookies/gi,/(?:this|our) (?:web)?site.{0,100}cookies/gi,/cookies (?:and|or) .{0,100} technologies/gi,/such as cookies/gi,/read more about.{0,100}cookies/gi,/consent to.{0,100}cookies/gi,/we and our partners.{0,100}cookies/gi,/we.{0,100}store.{0,100}information.{0,100}such as.{0,100}cookies/gi,/store and\/or access information.{0,100}on a device/gi,/personalised ads and content, ad and content measurement/gi,/utilisons.{0,100}des.{0,100}cookies/gi,/nous.{0,100}utilisons.{0,100}des/gi,/des.{0,100}cookies.{0,100}pour/gi,/des.{0,100}informations.{0,100}sur/gi,/retirer.{0,100}votre.{0,100}consentement/gi,/accéder.{0,100}à.{0,100}des/gi,/à.{0,100}des.{0,100}informations/gi,/et.{0,100}nos.{0,100}partenaires/gi,/publicités.{0,100}et.{0,100}du.{0,100}contenu/gi,/utilise.{0,100}des.{0,100}cookies/gi,/utilisent.{0,100}des.{0,100}cookies/gi,/stocker.{0,100}et.{0,100}ou.{0,100}accéder/gi,/consentement.{0,100}à.{0,100}tout.{0,100}moment/gi,/votre.{0,100}consentement/gi,/accepter.{0,100}tout/gi,/utilisation.{0,100}des.{0,100}cookies/gi,/cookies.{0,100}ou.{0,100}technologies/gi,/acceptez.{0,100}l.{0,100}utilisation/gi,/continuer sans accepter/gi,/tout refuser/gi,/(?:refuser|rejeter) tous les cookies/gi,/je refuse/gi,/refuser et continuer/gi,/refuser les cookies/gi,/seulement nécessaires/gi,/je désactive les finalités non essentielles/gi,/cookies essentiels uniquement/gi,/nécessaires uniquement/gi,/wir.{0,100}verwenden.{0,100}cookies/gi,/wir.{0,100}und.{0,100}unsere.{0,100}partner/gi,/zugriff.{0,100}auf.{0,100}informationen.{0,100}auf/gi,/inhalte.{0,100}messung.{0,100}von.{0,100}werbeleistung.{0,100}und/gi,/cookies.{0,100}und.{0,100}andere/gi,/verwendung.{0,100}von.{0,100}cookies/gi,/wir.{0,100}nutzen.{0,100}cookies/gi,/verwendet.{0,100}cookies/gi,/sie.{0,100}können.{0,100}ihre.{0,100}auswahl/gi,/und.{0,100}ähnliche.{0,100}technologien/gi,/cookies.{0,100}wir.{0,100}verwenden/gi,/alles?.{0,100}ablehnen/gi,/(?:nur|nicht).{0,100}(?:zusätzliche|essenzielle|funktionale|notwendige|erforderliche).{0,100}(?:cookies|akzeptieren|erlauben|ablehnen)/gi,/weiter.{0,100}(?:ohne|mit).{0,100}(?:einwilligung|zustimmung|cookies)/gi,/(?:cookies|einwilligung).{0,100}ablehnen/gi,/nur funktionale cookies akzeptieren/gi,/optionale ablehnen/gi,/zustimmung verweigern/gi,/gebruik.{0,100}van.{0,100}cookies/gi,/(?:we|wij).{0,100}gebruiken.{0,100}cookies.{0,100}om/gi,/cookies.{0,100}en.{0,100}vergelijkbare/gi,/(?:alles|cookies).{0,100}(?:afwijzen|weigeren|verwerpen)/gi,/alleen.{0,100}noodzakelijke?\b/gi,/cookies weigeren/gi,/weiger.{0,100}(?:cookies|alles)/gi,/doorgaan zonder (?:te accepteren|akkoord te gaan)/gi,/alleen.{0,100}(?:optionele|functionele|functioneel|noodzakelijke|essentiële).{0,100}cookies/gi,/wijs alles af/gi],k=[/^\s*(i)?\s*(reject|deny|refuse|decline|disable)\s*(all)?\s*(non-essential|optional|additional|targeting|analytics|marketing|unrequired|non-necessary|extra|tracking|advertising)?\s*(cookies)?\s*(\(?\s*except\s+(strictly\s+)?(necessary|essential)\s*\)?)?\s*$/is,/^\s*(i)?\s*do\s+not\s+accept\s*(cookies)?\s*$/is,/^\s*(continue|proceed|continue\s+browsing)\s+without\s+(accepting|agreeing|consent|cookies|tracking)(\s*→)?\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*(strictly)?\s*(necessary|essentials?|required)?\s*(cookies)?\s*only\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*(strictly)?\s*(necessary|essentials?|required)\s*(cookies)?\s*$/is,/^\s*(use|accept|allow|continue\s+with)?\s*only\s*(strictly)?\s*(necessary|essentials?|required)?\s*(cookies)?\s*$/is,/^\s*do\s+not\s+sell(\s+or\s+share)?\s*my\s*personal\s*info(rmation)?\s*$/is,"allow selection","disagree and close",/^(i)?\s*disagree\s*(and\s+close)?$/i,"no",/^no,? thanks$/is,/^opt[ -]out$/is,"weigeren","alles afwijzen","alleen noodzakelijke cookies","afwijzen","alles weigeren","cookies weigeren","alleen noodzakelijk","weiger","weiger cookies","selectie toestaan","doorgaan zonder te accepteren","alleen functionele cookies","alleen functioneel","alleen noodzakelijke","alleen essentiële cookies","functioneel","alle cookies verwerpen","doorgaan zonder akkoord te gaan","weiger alles","nee, bedankt","alle cookies weigeren","weiger alle cookies","alleen noodzakelijke cookies accepteren","alleen strikt noodzakelijk","ik weiger","optionele cookies weigeren","alle weigeren","accepteer alleen noodzakelijke cookies","alleen functionele cookies accepteren","enkel noodzakelijke cookies","niet accepteren","weiger niet-essentiële cookies","weiger niet-noodzakelijke cookies","wijs alles af","alle cookies afwijzen","alleen vereiste cookies","cookies afwijzen","doorgaan zonder accepteren","hier weigeren","weiger alle","aanvaard enkel essentiële cookies","aanvullende cookies weigeren","accepteren weigeren","alle afwijzen","alle niet functionele afwijzen","alle optionele weigeren","alleen noodzakelijke accepteren","alleen strikt noodzakelijke cookies","allen afwijzen","clear weigeren","enkel functioneel","enkel noodzakelijke cookies aanvaarden","functioneel altijd actief","nee, accepteer alleen de noodzakelijke","nee, geen cookies a.u.b.","nee, weiger cookies","nee, weigeren","niet-noodzakelijke cookies weigeren","optioneel afwijzen","tracking cookies weigeren","weigeren cookies","weigeren?","weigeren.","strikt noodzakelijk","weiger optionele cookies","noodzakelijke cookies","essentiële cookies","ga verder zonder aanvaarden","doorgaan zonder cookies","accepteer noodzakelijke cookies","noodzakelijke","indien je enkel technisch noodzakelijke cookies wenst te accepteren, klik dan hier","weiger","alleen de noodzakelijke cookies","alleen noodzakelijk","alleen verplichte cookies","ik wil alleen minimale cookies","doorgaan zonder te accepteren","geen cookies toestaan","liever geen cookies","nee, geen persoonlijke cookies","nee, liever geen cookies","ga door zonder te accepteren","verder zonder accepteren","essentiële accepteren","functionele cookies","strikt noodzakelijke cookies","alleen basic cookies","alleen basiscookies","alleen standaard cookies","alle cookies verwerpen","noodzakelijk","noodzakelijk cookies accepteren","noodzakelijke cookies accepteren","accepteer alleen noodzakelijk","enkel noodzakelijke toestaan","enkel strikt noodzakelijke cookies","ik wijs ze liever af","ik weiger cookies","ik weiger optionele cookies","weiger alle cookies","weiger alle niet-noodzakelijke cookies","weiger alle onnodige cookies","weiger alle optionele","weiger alles","weiger targeting en third party cookies.","continuer sans accepter","tout refuser","refuser","refuser tous les cookies","non merci","interdire tous les cookies","je refuse","refuser tout","tout rejeter","refuser et continuer","rejeter","refuser les cookies","cookies nécessaires uniquement","seulement nécessaires","rejeter tout","refuser les cookies optionnels","je désactive les finalités non essentielles","refuser les cookies non nécessaires","rejeter tous les cookies","cookies essentiels uniquement","nécessaires uniquement","refuser les cookies non essentiels","tout refuser et fermer","tout refuser sauf les cookies techniques","continuer sans accepter x","je refuse lutilisation de cookies","non merci, seulement des cookies techniques","non, tout refuser","refuser tous les cookies non nécessaires","rejeter les cookies","uniquement les essentiels","refuser tous","accepter uniquement les nécessaires","allow anonymous analytics","autoriser les cookies essentiels uniquement","autoriser uniquement les nécessaires","cookies essentiels seulement","cookies nécessaires seulement","cookies techniques uniquement","je préfère les rejeter","je refuse :(","je refuse les cookies","je refuse tous les cookies","je refuse tout","ne pas accepter","non, accepter les nécessaires uniquement","refuser (sauf cookies nécessaires)","refuser ce cookie","refuser les coockies","refuser les cookies facultatifs","refuser tout, sauf les cookies techniques","refuser toutes","refuser toutes les options","rejeter la bannière","rejeter les cookies non essentiels","rejeter les cookies optionnels","rejeter tous les non fonctionnels","rejeter tout optionnel","tout refuser, sauf les cookies techniques","uniquement nécessaires","x continuer sans accepter","strictement nécessaires","utiliser uniquement les cookies nécessaires","cookies nécessaires","accepter uniquement les cookies essentiels","accepter les cookies nécessaires","uniquement les cookies nécessaires","autoriser uniquement les cookies essentiels","autoriser uniquement les cookies nécessaires","si vous ne souhaitez pas accepter les cookies à lexception des cookies techniquement nécessaires, veuillez cliquer ici","cookies strictement nécessaires","accepter les cookies strictement nécessaires","autoriser les cookies essentiels","non, merci, uniquement les cookies nécessaires","indispensable uniquement","uniquement autoriser les cookies essentiels","utiliser que les cookies nécessaires","uniquement les sdk nécessaires","uniquement nécessaire","utiliser uniquement les cookies fonctionnels","refus","refusez","naccepter que les cookies indispensables","naccepter que les cookies nécessaires","naccepter que les cookies techniques","nécessaires seulement","ablehnen","alle ablehnen","nur notwendige cookies","nur essenzielle cookies akzeptieren","nur notwendige cookies verwenden","nur technisch notwendige","nur essentielle cookies akzeptieren","alles ablehnen","nur notwendige","alle cookies ablehnen","weiter ohne einwilligung","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nur essenzielle cookies akzeptieren.","cookies ablehnen","optionale cookies ablehnen","nur erforderliche cookies","einwilligung ablehnen","nur erforderliche","nur notwendige cookies zulassen","nur funktionale cookies akzeptieren","nur notwendige cookies akzeptieren","nur notwendige technologien","verweigern","webanalyse ablehnen","weiter ohne zustimmung","optionale ablehnen","nur notwendige akzeptieren","nur funktionale cookies","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons ablehnen.","nur notwendige cookies erlauben","zustimmung verweigern","nein, danke","nur erforderliche cookies akzeptieren","zusätzliche cookies ablehnen","ablehnen und nur essenzielle cookies akzeptieren","nicht erforderliche ablehnen","nicht essenzielle cookies daten ablehnen","nur technisch notwendige cookies","nur technisch notwendige cookies akzeptieren","ablehnen speichern","alle funktionen ablehnen","alle optionalen cookies ablehnen","alles verweigern","mit erforderlichen einstellungen fortfahren","nicht notwendige ablehnen","notwendige cookies akzeptieren","nur erforderliche technologien","nur essenzielle cookies","nur essenzielle cookies erlauben","technisch nicht notwendige cookies ablehnen","tippen sie zum ablehnen bitte hier","ablehnen deny","fortfahren ohne zu akzeptieren","nur erforderliche akzeptieren","nur notwendige erlauben","ablehnen ...nur technisch notwendige cookies verwendet werden","ablehnen (außer notwendige cookies)","ablehnen und fortfahren","ablehnen und schließen","ablehnen: nur grundfunktionen","akzeptieren nur notwendige cookies","alle ablehnen (außer notwendige cookies)","alle nicht essenziellen cookies ablehnen","alle nicht notwendigen cookies ablehnen","alle optionale ablehnen","alle optionalen ablehnen","alle verweigern","analyse cookies ablehnen","cookie einstellungenablehnen","erforderliche cookies akzeptieren","erforderliche cookies zulassen","externe inhalte ablehnen","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons ablehnen und nur essenzielle cookies akzeptieren.","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nicht-essenzielle cookies verweigern.","mit diesem button wird der dialog geschlossen. seine funktionalität ist identisch mit der des buttons nur essenzielle akzeptieren.","mit erforderlichen cookies fortfahren","mit notwendigen fortfahren","nein, bitte nicht","nein, ich stimme nicht zu","nicht funktionale cookies ablehnen","nicht notwendige cookies ablehnen","nicht-essenzielle cookies ablehnen","nicht-essenzielle cookies verweigern","notwendige cookies zulassen","nur erforderliche cookies erlauben","nur erforderliche cookies setzen","nur erforderliche cookies verwenden","nur essenzielle akzeptieren","nur notwendige cookies annehmen","nur notwendige cookies speichern","nur notwendige cookies verwenden.","nur notwendige funktionscookies akzeptieren","nur notwendigen cookies zustimmen","nur notwendiges akzeptieren","nur wesentliche cookies annehmen","opt. cookies ablehnen","optionale dienste ablehnen","optionale tools ablehnen","sie alle cookies ablehnen","technisch notwendige annehmen","nur essentielle cookies","nur essentielle","nur funktionale akzeptieren","nur technisch notwendige akzeptieren","nur technisch notwendige daten und cookies ...","nur technisch notwendige zulassen","nur wesentliche","ohne einverständnis fortfahren","ohne einwilligung","ohne zustimmung fortfahren","ohne zustimmung weiter","weiter mit essentiellen cookies","weiter ohne annahme","weiter ohne statistische analyse-cookies","weiter ohne statistische cookies","wesentliche cookies","fortfahren ohne zustimmung","rifiuta","rifiuta cookies","rifiuta i cookie","rifiuta i cookies","rifiuta tutti i cookie","rifiuta tutti i cookies","rifiuta cookie non necessari","rifiuta i cookie non tecnici","rifiuta non necessari","rifiuta tutto","rifiuta tutti","rifiuta e chiudi","chiudi rifiuta tutti i cookie","chiudi e rifiuta tutti i cookie","chiudi e rifiuta tutto","nega","nega tutti","negare","non accetto","accetta solo i necessari","usa solo i cookie necessari","accetta solo necessari","solo necessari","continua senza accettare x","continua senza accettare","rifiutare","rifiutare i cookie","rifiutare tutti i cookie","rifiutare tutti","rifiutare e continuare","installa solo i cookie strettamente necessari","solo cookies tecnici","accetta necessari","solo cookie tecnici","solo cookie necessari","strettamente necessari","tecnici","accetta solo cookie di navigazione","chiudi e prosegui solo con i cookies tecnici necessari","consenti solo i cookie tecnici","solo cookie essenziali","blocca i cookie non essenziali","accetta i cookie necessari","accetta solo cookie tecnici","accetta solo i cookie essenziali","accetta solo i cookie necessari","accetta solo i necessary","accetta i cookie essenziali","accetta cookie tecnici","necessari","usa solo i cookie tecnici","usa solo i necessari","rifiuto","essenziali","accetta cookie essenziali","accetta cookie necessari","accetta solo cookie essenziali","accetta solo cookie necessari","rifiuta cookie non necessari","rifiuta cookie non essenziali","rifiuta i cookie non necessari","rifiuta i cookie non essenziali","rifiuta tutti i cookie e chiudi","rifiuta tutto e chiudi","rifiuta tutti i cookie chiudi","continuare senza accettare","rifiutare cookies","rifiutare i cookies","rifiutare non necessari","rifiutare tutto","rifiutare e chiudere","solo essenziali","solo tecnici","negare tutti",/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*$/is,/^\s*(continuar|prosseguir|seguir)\s*(sem\s*aceitar)\s*$/is,/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*(tudo|o)?\s*(opcional|(não[-\s](essencial|funcional|obrigatório|necessário)))?\s*$/is,/^\s*(rejeitar|recusar|desativar|bloquear|negar|não\s*aceito|não \s*aceitar)\s*(todos)?\s*(os)?\s*(cookies)?\s*(opcionais|(não[-\s](essenciais|funcionais|obrigatórios|necessários)))?\s*$/is,/^\s*(aceitar|utilizar)?\s*(apenas|somente|só)?\s*(o)?\s*(essencial|funcional|obrigatório|necessário)\s*$/is,/^\s*(aceitar|utilizar)?\s*(apenas|somente|só)?\s*(os)?\s*(cookies)?\s*(essenciais|funcionais|obrigatórios|necessários)\s*$/is,"rechazar","rechazar todo","rechazar todas","denegar","rechazar cookies","rechazarlas todas","no acepto","rechazar todas las cookies","rechazar y cerrar","denegar todas","solo necesarias","rechazar cookies opcionales","rechazar opcionales","cookies estrictamente necesarias","aceptar sólo necesarias","continuar sin aceptar","denegar todo","clear rechazar cookies","configurar rechazar cookies","denegar cookies","rechazar y continuar","rechazar las cookies","clear rechazar","denegar todas las cookies","rechazar cookies no esenciales","rechazarlas","no, no acepto","permitir sólo necesarias","rechazar cookies adicionales","rechazar cookies analíticas","rechazar no necesarias","rechazar opcional","rechazar todo lo opcional","solo cookies estrictamente necesarias","solo esenciales","x rechazar todas las cookies","solo usar cookies necesarias","solo cookies necesarias","declinar","aceptar solo las cookies esenciales","necesarias","aceptar cookies opcionales","aceptar solo lo necesario","solo funcionales","declinar y cerrar","déclin","declina","declinar consentimiento","declinar todas","solo las cookies necesarias","només sutilitzen cookies quan és necessari","no, sólo las estrictamente necesarias","solo las necesarias","acceptar només les necessàries","acepta solo las necesarias","aceptar solo lo esencial","aceptar las obligatorias","permitir solo cookies técnicas","cookies técnicas","permitir solo cookies técnicas","usar solo cookies técnicas","aceptar solo las esenciales","avvisa","endast nödvändiga","avvisa alla","endast nödvändiga cookies","neka","neka alla","avvisa allt","avvisa alla cookies","tillåt bara nödvändiga cookies","bara nödvändiga","bara nödvändiga cookies","tillåt bara nödvändiga kakor","endast nödvändiga kakor","tillåt endast nödvändiga","fortsätt utan att acceptera","godkänn endast nödvändiga","acceptera endast nödvändiga","avvisa cookies","tillåt endast nödvändiga kakor","acceptera endast nödvändiga cookies","neka kakor","bara nödvändiga kakor","neka alla cookies","använd endast nödvändiga","avvisa alla utom nödvändiga","hantera eller avvisa","neka alla utom nödvändiga kakor","neka och stäng","tillåt bara nödvändiga tjänster","avvisa alla utom nödvändiga kakor","avvisa alla valfria","godkänn bara nödvändiga cookies","acceptera endast nödvändiga kakor","använd endast nödvändiga cookies","avvisa alla kakor","avvisa alla valmöjligheter","avvisa ej nödvändiga","avvisa icke-nödvändiga","förneka","godkänn bara nödvändiga","godkänn bara nödvändiga kakor","godkänn endast nödvändiga cookies","godkänn endast nödvändiga kakor","godta endast nödvändiga","jag godkänner bara nödvändiga kakor","nej, avvisa alla","nej, bara nödvändiga","nej, bara nödvändiga cookies","neka alla utom nödvändiga","neka alla.","neka cookies","neka samtliga","ok, endast nödvändiga","spara endast nödvändiga","stäng och avvisa","tillåt bara nödvändiga","godkänn nödvändiga kakor","godkänn nödvändiga","acceptera nödvändiga","strikt nödvändigt","tillåt nödvändiga","nödvändiga","enbart nödvändiga","jag godkänner nödvändiga kakor","acceptera nödvändiga kakor","godkänn enbart nödvändiga kakor","godkänn nödvändiga cookies","om du inte vill acceptera andra cookies än de som är tekniskt nödvändiga klickar du här","acceptera enbart nödvändiga","nödvändiga cookies","jag godkänner enbart att ni använder nödvändiga cookies","+ strikt nödvändiga cookies","använd enbart nödvändiga cookies","enbart nödvändiga cookies","godkänn nödvändiga kakor stäng","ok till nödvändiga","strikt nödvändiga","fortsätt utan att godkänna","avböj alla cookies","jag accepterar endast grundläggande kakor","nej, jag avböjer","tillåt inte cookies"],f=[/pay|subscribe/is,/abonneer/is,/abonnier/is,/abonner/is,/abbonati/is,/iscriviti/is,/abbonare/is,/iscrivere/is,/sostienici/is,/suscribir/is],w=["settings","preferences",/customi(s|z)e/is,"show details","more options",/(manage|configure) (my|your) (preferences|choices|cookies)/is,"manage choices",/(cookie )?preference center/is,"change settings","configure","change my preferences","cookie manager","cookie preference","let me choose","cookieconsent preferences",/privacy choices/is,/(privacy|cookie|custom) settings/is,/cookies? (settings|preferences|setting)/is,/(manage|customize|customise|opt-out|edit).*(cookies|preferences|settings|options)/is,"cookie consent options","privacy controls","show purposes","einstellungen"],y=[/^(accept|allow)( all)?( cookies)?$/is,/i (accept|allow)( all)?/is,"yes",/^(i )?agree$/is,"continue with all","accept and continue",/accept all above/is,/^(accept|agree) and close/is,"accept continue","agree proceed","allow and continue","close and accept",/accept all$/is,"im ok with that","accept optional cookies",/^alle (cookies )?akzeptieren$/is],b=["ok","close","continue","x",/^got it!?$/,"i understand","dismiss","okay","acknowledge",/^close (banner|cookie notification)$/is,/understood$/is,"confirm my choices"],E='button, input[type="button"], input[type="submit"], a, [role="button"], [class*="button"]';function _(e,t=g){e=e.slice(0,1e5);const i=[],n=[];for(const o of t){const t=e?.match(o);t&&(i.push(o.toString()),n.push(...t.map(e=>e.substring(0,200))))}return{patterns:i,snippets:n}}function C(e="reject",t=100){const i="tier2"===e?["reject","tier1","tier2"]:"tier1"===e?["reject","tier1"]:["reject"];if(0===i.length)return[];const n=function(e=100){const t=!p();if(t&&window.parent&&window.parent!==window.top)return[];return function(e,t=100){let i=[];if(e){const e=document.body||document.documentElement;e&&l(e)&&e.innerText&&i.push(e)}else i=function(e=100){const t=performance.now(),i=document.createTreeWalker(document.documentElement,NodeFilter.SHOW_ELEMENT,{acceptNode(i){if("BODY"===i.tagName)return NodeFilter.FILTER_SKIP;if(l(i)){const e=window.getComputedStyle(i).position;if("fixed"===e||"sticky"===e)return NodeFilter.FILTER_ACCEPT;if(function(e){if("DIALOG"===e.tagName&&e.hasAttribute("open"))return!0;if("dialog"===e.getAttribute("role")||"true"===e.getAttribute("aria-modal"))return!0;return!1}(i))return NodeFilter.FILTER_ACCEPT}return performance.now()-t>e?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}}),n=[];for(let e=i.nextNode();e;e=i.nextNode())n.push(e);return T(n)}(t);const n=[];for(const e of i)e.innerText&&n.push({text:e.innerText,element:e,buttons:S(e)});return n}(t,e)}(t);return n.reduce((e,t)=>{const i=t.text?.trim();if(i){const{patterns:n}=_(i);n.length>0&&(!function(e){for(const t of e)t.regexClassification=A(t.text)}(t.buttons),t.regexClassification=function(e){const{reject:t,settings:i,accept:n,acknowledge:o}=e.reduce((e,t)=>(t.regexClassification&&"other"!==t.regexClassification&&e[t.regexClassification]++,e),{reject:0,settings:0,accept:0,acknowledge:0});if(t>0)return"reject";if(i>0)return"none";if(o>0)return"tier1";if(n>0)return 1===n?"tier2":"none";return"none"}(t.buttons),e.push({...t}))}return e},[]).filter(e=>void 0!==e.regexClassification&&i.includes(e.regexClassification)).sort((e,t)=>(e.regexClassification??"")>(t.regexClassification??"")?1:-1)}function v(e,t,i){if(!e)return!1;const n=function(e){let t=e.toLowerCase();return t=t.replace(/[“”"'/#&[\]→✕×⟩❯><✗ב’›«»]+/g,""),t=t.replace(/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}\u2600-\u26FF\u2700-\u27BF\u{1F900}-\u{1F9FF}\u{1FA70}-\u{1FAFF}]/gu,""),t=t.replace(/\n+/g," "),t=t.replace(/\s+/g," "),t=t.trim(),t}(e);return!i.some(e=>e instanceof RegExp&&e.test(n)||e===n)&&t.some(e=>e instanceof RegExp&&e.test(n)||e===n)}function A(e){return v(e,k,f)?"reject":v(e,w,f)?"settings":v(e,y,f)?"accept":v(e,b,f)?"acknowledge":"other"}function S(e){const t=T(function(e){return Array.from(e.querySelectorAll(E))}(e)).filter(e=>l(e)&&!function(e){return"disabled"in e&&Boolean(e.disabled)||e.hasAttribute("disabled")}(e)&&(e.innerText?.trim()||e instanceof HTMLInputElement&&["submit","button"].includes(e.type)&&e.value?.trim()));return t.map(e=>({text:(e.innerText||e.textContent||"").trim()||e.value?.trim()||"",element:e}))}function T(e){const t=[];if(e.length>0)for(let i=e.length-1;i>=0;i--){let n=!1;for(let t=0;t(i.evals&&console.error("error evaluating rule",e,t),!1))}checkRunContext(){return!!this.checkFrameContext(p())&&!(this.runContext.urlPattern&&!this.hasMatchingUrlPattern())}checkFrameContext(e){const t={...O,...this.runContext};return!(e&&!t.main)&&!(!e&&!t.frame)}hasMatchingUrlPattern(){return Boolean(this.runContext?.urlPattern&&window.location.href.match(this.runContext.urlPattern))}detectCmp(){throw new Error("Not Implemented")}async detectPopup(){return!1}optOut(){throw new Error("Not Implemented")}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){return Promise.resolve(!0)}async highlightElements(e,t=!1,i=2e3){if(0!==e.length){t||(e=[e[0]]),this.autoconsent.sendContentMessage({type:"visualDelay",timeout:i});for(const t of e)this.autoconsent.config.logs.rulesteps&&console.log("highlighting",t),d(t);await this.wait(i);for(const t of e)h(t)}}async clickElement(e){return this.autoconsent.config.visualTest&&await this.highlightElements([e]),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.clickElement(e)}async click(e,t=!1){return this.autoconsent.config.visualTest&&await this.highlightElements(this.elementSelector(e),t),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.click(e,t)}elementExists(e){return this.autoconsent.domActions.elementExists(e)}elementVisible(e,t){return this.autoconsent.domActions.elementVisible(e,t)}waitForElement(e,t){return this.autoconsent.domActions.waitForElement(e,t)}waitForVisible(e,t,i){return this.autoconsent.domActions.waitForVisible(e,t,i)}async waitForThenClick(e,t,i){return this.autoconsent.config.visualTest&&await this.highlightElements(this.elementSelector(e),i),this.autoconsent.updateState({clicks:this.autoconsent.state.clicks+1}),this.autoconsent.domActions.waitForThenClick(e,t,i)}wait(e){return this.autoconsent.domActions.wait(e)}hide(e,t){return this.autoconsent.domActions.hide(e,t)}removeClass(e,t){return this.autoconsent.domActions.removeClass(e,t)}setStyle(e,t){return this.autoconsent.domActions.setStyle(e,t)}addStyle(e,t){return this.autoconsent.domActions.addStyle(e,t)}cookieContains(e){return this.autoconsent.domActions.cookieContains(e)}prehide(e){return this.autoconsent.domActions.prehide(e)}undoPrehide(){return this.autoconsent.domActions.undoPrehide()}querySingleReplySelector(e,t){return this.autoconsent.domActions.querySingleReplySelector(e,t)}querySelectorChain(e){return this.autoconsent.domActions.querySelectorChain(e)}elementSelector(e){return this.autoconsent.domActions.elementSelector(e)}waitForMutation(e){return this.autoconsent.domActions.waitForMutation(e)}},L=class extends I{constructor(e,t){super(t),this.rule=e,this.name=e.name,this.runContext=e.runContext||O}get hasSelfTest(){return!!this.rule.test&&this.rule.test.length>0}get isIntermediate(){return!!this.rule.intermediate}get isCosmetic(){return!!this.rule.cosmetic}get prehideSelectors(){return this.rule.prehideSelectors||[]}async detectCmp(){return!!this.rule.detectCmp&&this._runRulesSequentially(this.rule.detectCmp,this.autoconsent.config.logs.detectionsteps)}async detectPopup(){return!!this.rule.detectPopup&&this._runRulesSequentially(this.rule.detectPopup,this.autoconsent.config.logs.detectionsteps)}async optOut(){const e=this.autoconsent.config.logs;return!!this.rule.optOut&&(e.lifecycle&&console.log("Initiated optOut()",this.rule.optOut),this._runRulesSequentially(this.rule.optOut,this.autoconsent.config.logs.rulesteps))}async optIn(){const e=this.autoconsent.config.logs;return!!this.rule.optIn&&(e.lifecycle&&console.log("Initiated optIn()",this.rule.optIn),this._runRulesSequentially(this.rule.optIn,this.autoconsent.config.logs.rulesteps))}async openCmp(){return!!this.rule.openCmp&&this._runRulesSequentially(this.rule.openCmp,this.autoconsent.config.logs.rulesteps)}async test(){return this.hasSelfTest&&this.rule.test?this._runRulesSequentially(this.rule.test,this.autoconsent.config.logs.rulesteps):super.test()}async evaluateRuleStep(e){const t=[],i=this.autoconsent.config.logs;if(e.exists&&t.push(this.elementExists(e.exists)),e.visible&&t.push(this.elementVisible(e.visible,e.check)),e.eval){const i=this.mainWorldEval(e.eval);t.push(i)}if(e.waitFor&&t.push(this.waitForElement(e.waitFor,e.timeout)),e.waitForVisible&&t.push(this.waitForVisible(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(this.click(e.click,e.all)),e.waitForThenClick&&t.push(this.waitForThenClick(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(this.wait(e.wait)),e.hide&&t.push(this.hide(e.hide,e.method)),void 0!==e.removeClass&&t.push(!!e.selector&&this.removeClass(e.selector,e.removeClass)),void 0!==e.setStyle&&t.push(!!e.selector&&this.setStyle(e.selector,e.setStyle)),void 0!==e.addStyle&&t.push(!!e.selector&&this.addStyle(e.selector,e.addStyle)),e.cookieContains&&t.push(this.cookieContains(e.cookieContains)),e.if){if(!e.if.exists&&!e.if.visible)return console.error("invalid conditional rule",e.if),!1;if(!e.then)return console.error('invalid conditional rule, missing "then" step',e.if),!1;const n=await this.evaluateRuleStep(e.if);i.rulesteps&&console.log("Condition is",n),n?t.push(this._runRulesSequentially(e.then,i.rulesteps)):e.else?t.push(this._runRulesSequentially(e.else,i.rulesteps)):t.push(!0)}if(e.any){let i=!1;for(const t of e.any)if(await this.evaluateRuleStep(t)){i=!0;break}t.push(i)}if(0===t.length)return i.errors&&console.warn("Unrecognized rule",e),!1;const n=(await Promise.all(t)).reduce((e,t)=>e&&t,!0);return e.negated?!n:n}async _runRulesParallel(e){const t=e.map(e=>this.evaluateRuleStep(e));return(await Promise.all(t)).every(e=>!!e)}async _runRulesSequentially(e,t=!0){for(const i of e){t&&console.log("Running rule...",i);const e=await this.evaluateRuleStep(i);if(t&&console.log("...rule result",e),!e&&!i.optional)return!1}return!0}},P=class extends I{constructor(e,t="reject"){super(e),this.popups=[],this.name="HEURISTIC",this.runContext={main:!0,frame:!1},this.mode=t}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return await new Promise(e=>setTimeout(e,0)),this.autoconsent.config.performanceLoggingEnabled&&performance.mark("heuristicDetectorStart"),this.popups=C(this.mode,this.autoconsent.config.heuristicPopupSearchTimeout),this.autoconsent.config.performanceLoggingEnabled&&performance.mark("heuristicDetectorEnd"),this.autoconsent.config.performanceLoggingEnabled&&performance.measure("heuristicDetector","heuristicDetectorStart","heuristicDetectorEnd"),this.popups.length>0?(this.name=`HEURISTIC-${this.popups[0].regexClassification?.toUpperCase()}`,Promise.resolve(!0)):Promise.resolve(!1)}async detectPopup(){return this.popups.length>0&&(this.popups.length>1&&this.autoconsent.config.logs.errors&&console.warn("Heuristic found multiple popups"),!0)}getTargetButton(){const e=this.popups[0],t=e.regexClassification,i=e.buttons,n="reject"===t?"reject":"tier1"===t?"acknowledge":"accept";return i.find(e=>e.regexClassification===n)}optOut(){const e=this.getTargetButton();return e?this.clickElement(e.element):Promise.resolve(!1)}optIn(){throw new Error("Not Implemented")}openCmp(){throw new Error("Not Implemented")}async test(){const e=this.getTargetButton();return!!e&&(await this.wait(500),!l(e.element))}},z="#truste-show-consent",R="#truste-consent-required",x="#truste-consent-track",F=[class extends I{constructor(e){super(e),this.name="TrustArc-top",this.prehideSelectors=[".trustarc-banner-container",`.truste_popframe,.truste_overlay,.truste_box_overlay,${x}`],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!0}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}get isCosmetic(){return!1}async detectCmp(){const e=this.elementExists(`${z},${x}`);return e&&(this._shortcutButton=document.querySelector(R)),e}async detectPopup(){return this.elementVisible(`#truste-consent-content,#trustarc-banner-overlay,${x}`,"any")}async optOut(){return this.elementExists(R)?(this.click(R),!0):(r(a(),`.truste_popframe, .truste_overlay, .truste_box_overlay, ${x}`),await this.click(z),setTimeout(()=>{a().remove()},1e4),!0)}async optIn(){return this._optInDone=!0,await this.click("#truste-consent-button")}async openCmp(){return!0}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_TRUSTARC_TOP")}},class extends I{constructor(){super(...arguments),this.name="TrustArc-frame",this.runContext={main:!1,frame:!0,urlPattern:"^https://consent-pref\\.trustarc\\.com/\\?"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return!0}async detectPopup(){return this.elementVisible("#defaultpreferencemanager","any")&&this.elementVisible(".mainContent","any")}async navigateToSettings(){return await c(async()=>this.elementExists(".shp")||this.elementVisible(".advance","any")||this.elementExists(".switch span:first-child"),10,500),this.elementExists(".shp")&&await this.click(".shp"),await this.waitForElement(".prefPanel",5e3),this.elementVisible(".advance","any")&&await this.click(".advance"),await c(()=>this.elementVisible(".switch span:first-child","any"),5,1e3)}async optOut(){let e=3e3;return await this.mainWorldEval("EVAL_TRUSTARC_FRAME_GTM")&&(e=1500),await c(()=>"complete"===document.readyState,20,100),await this.waitForElement(".mainContent[aria-hidden=false]",e),!!await this.click(".rejectAll,.declineAllButtonLower",!0)||(this.elementExists(".prefPanel")&&await this.waitForElement('.prefPanel[style="visibility: visible;"]',e),await this.click("#catDetails0")?(await this.click(".submit"),this.waitForThenClick("#gwt-debug-close_id",e),!0):await this.click(".required")?(this.waitForThenClick("#gwt-debug-close_id",e),!0):(await this.navigateToSettings(),await this.click(".switch span:nth-child(1):not(.active)",!0),await this.click(".submit"),this.waitForThenClick("#gwt-debug-close_id",10*e),!0))}async optIn(){return await this.click(".call")||(await this.navigateToSettings(),await this.click(".switch span:nth-child(2)",!0),await this.click(".submit"),this.waitForElement("#gwt-debug-close_id",3e5).then(()=>{this.click("#gwt-debug-close_id")})),!0}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_TRUSTARC_FRAME_TEST")}},class extends I{constructor(){super(...arguments),this.name="Cybotcookiebot",this.prehideSelectors=["#CybotCookiebotDialog,#CybotCookiebotDialogBodyUnderlay,#dtcookie-container,#cookiebanner,#cb-cookieoverlay,.modal--cookie-banner,#cookiebanner_outer,#CookieBanner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return await this.mainWorldEval("EVAL_COOKIEBOT_1")}async detectPopup(){return this.mainWorldEval("EVAL_COOKIEBOT_2")}async optOut(){if(this.elementVisible("#CybotCookiebotDialogBodyLevelButtonLevelOptinDeclineAll"))return await this.click("#CybotCookiebotDialogBodyLevelButtonLevelOptinDeclineAll");await this.wait(500);let e=await this.mainWorldEval("EVAL_COOKIEBOT_3");return await this.wait(1e3),e=e&&await this.mainWorldEval("EVAL_COOKIEBOT_4"),e}async optIn(){return this.elementExists("#dtcookie-container")?await this.click(".h-dtcookie-accept"):(await this.click(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),await this.click("#CybotCookiebotDialogBodyLevelButtonAccept"),await this.click("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return await this.wait(500),await this.mainWorldEval("EVAL_COOKIEBOT_5")}},class extends I{constructor(){super(...arguments),this.name="Sourcepoint-frame",this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay","#sp_privacy_manager_container"],this.ccpaNotice=!1,this.ccpaPopup=!1,this.runContext={main:!0,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaNotice=!0,!0):"ccpa-pm.sp-prod.net"===e.hostname?(this.ccpaPopup=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname||"/ccpa_pm/index.html"===e.pathname||"/us_pm/index.html"===e.pathname)&&(e.searchParams.has("message_id")||e.searchParams.has("requestUUID")||e.searchParams.has("consentUUID"))}async detectPopup(){return!!this.ccpaNotice||(this.ccpaPopup?await this.waitForElement(".priv-save-btn",2e3):(await this.waitForElement(".sp_choice_type_11,.sp_choice_type_12,.sp_choice_type_13,.sp_choice_type_ACCEPT_ALL,.sp_choice_type_SAVE_AND_EXIT",2e3),!this.elementExists(".sp_choice_type_9")))}async optIn(){return await this.waitForElement(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!await this.click(".sp_choice_type_11")||!!await this.click(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===location.pathname||"/ccpa_pm/index.html"===location.pathname||"/us_pm/index.html"===location.pathname&&!document.querySelector(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL")}async optOut(){await this.wait(500);const e=this.autoconsent.config.logs;if(this.ccpaPopup){const e=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.neutral.on .right");for(const t of e)t.click();const t=document.querySelectorAll(".priv-purpose-container .sp-switch-arrow-block a.switch-bg.on");for(const e of t)e.click();return await this.click(".priv-save-btn")}if(this.elementVisible(".sp_choice_type_SE","any"))return await this.click(["xpath///div[contains(., 'Do not share my personal information') and contains(@class, 'switch-container')]",".pm-switch[aria-checked=false] .slider"],!1),await this.click(".sp_choice_type_SE");if(!this.isManagerOpen()){const e='.sp_choice_type_12,[data-choice]:not([class*="sp_choice_type_"])';if(!await this.waitForVisible(`${e},.sp_choice_type_13`))return!1;if(this.elementVisible(".sp_choice_type_13","any"))return await this.click(".sp_choice_type_13");await this.click(e),await c(()=>this.isManagerOpen(),200,100)}await this.waitForElement(".type-modal",2e4),this.elementExists("[role=tablist]")&&await this.waitForElement("[role=tablist] [role=tab]",1e4),this.waitForThenClick(".ccpa-stack .pm-switch[aria-checked=true] .slider",500,!0);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",i=await Promise.race([this.waitForElement(e,2e3).then(e=>e?0:-1),this.waitForElement(t,2e3).then(e=>e?1:-1),this.waitForElement(".pm-features",2e3).then(e=>e?2:-1)]);if(0===i)return await this.waitForVisible(e),await this.click(e);1===i?await this.click(t):2===i&&(await this.waitForElement(".pm-features",1e4),await this.click(".checked > span",!0),await this.click(".chevron"))}catch(t){e.errors&&console.warn(t)}return await this.click(".sp_choice_type_SAVE_AND_EXIT")}},class extends I{constructor(){super(...arguments),this.name="consentmanager.net",this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.apiAvailable=await this.mainWorldEval("EVAL_CONSENTMANAGER_1"),!!this.apiAvailable||this.elementExists("#cmpbox")}async detectPopup(){return!!this.elementVisible("#cmpbox .cmpmore","any")||!!this.apiAvailable&&(await this.wait(500),await this.mainWorldEval("EVAL_CONSENTMANAGER_2"))}async optOut(){return await this.wait(500),this.apiAvailable?await this.mainWorldEval("EVAL_CONSENTMANAGER_3"):!!await this.click(".cmpboxbtnno")||(this.elementExists(".cmpwelcomeprpsbtn")?(await this.click(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),await this.click(".cmpboxbtnsave"),!0):(await this.click(".cmpboxbtncustom"),await this.waitForElement(".cmptblbox",2e3),await this.click(".cmptdchoice > a[aria-checked=true]",!0),await this.click(".cmpboxbtnyescustomchoices"),this.hide("#cmpwrapper,#cmpbox","display"),!0))}async optIn(){return this.apiAvailable?await this.mainWorldEval("EVAL_CONSENTMANAGER_4"):await this.click(".cmpboxbtnyes")}async test(){return!!this.apiAvailable&&await this.mainWorldEval("EVAL_CONSENTMANAGER_5")}},class extends I{constructor(){super(...arguments),this.name="Evidon"}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("#_evidon_banner")}async detectPopup(){return this.elementVisible("#_evidon_banner","any")}async optOut(){return await this.click("#_evidon-decline-button")||(r(a(),"#evidon-prefdiag-overlay,#evidon-prefdiag-background,#_evidon-background"),await this.waitForThenClick("#_evidon-option-button"),await this.waitForElement("#evidon-prefdiag-overlay",5e3),await this.wait(500),await this.waitForThenClick("#evidon-prefdiag-decline")),!0}async optIn(){return await this.click("#_evidon-accept-button")}},class extends I{constructor(){super(...arguments),this.name="Onetrust",this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("#onetrust-banner-sdk")||this.elementVisible("#onetrust-pc-sdk","any")}async detectPopup(){return this.elementVisible("#onetrust-banner-sdk,#onetrust-pc-sdk","any")}async optOut(){if(await this.wait(500),this.elementVisible("#onetrust-reject-all-handler","any"))return await this.click("#onetrust-reject-all-handler");if(this.elementVisible(".ot-pc-refuse-all-handler","any"))return await this.click(".ot-pc-refuse-all-handler");if(this.elementVisible(".js-reject-cookies","any"))return await this.click(".js-reject-cookies");if(this.elementVisible(".onetrust-close-btn-handler","any")){const e=document.querySelector(".onetrust-close-btn-handler"),t=e?.textContent?.toLowerCase()||"";if(["without","ohne","sans","sin ","zonder","senza","refuse","decline","reject","ablehnen"].some(e=>t.includes(e)))return await this.click(".onetrust-close-btn-handler");const i=document.getElementById("onetrust-banner-sdk");if(i?.classList.contains("ot-close-btn-link")&&!this.elementExists("#onetrust-accept-btn-handler,#onetrust-reject-all-handler,#onetrust-pc-btn-handler,.ot-sdk-show-settings,button.js-cookie-settings"))return await this.click(".onetrust-close-btn-handler")}return this.elementExists("#onetrust-pc-btn-handler")?await this.click("#onetrust-pc-btn-handler"):await this.click(".ot-sdk-show-settings,button.js-cookie-settings"),await this.waitForElement("#onetrust-consent-sdk",2e3),await this.wait(1e3),await this.click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await this.wait(1e3),await this.waitForElement(".save-preference-btn-handler,.js-consent-save",2e3),await this.click(".save-preference-btn-handler,.js-consent-save"),await this.waitForVisible("#onetrust-banner-sdk",5e3,"none"),!0}async optIn(){return await this.click("#onetrust-accept-btn-handler,#accept-recommended-btn-handler,.js-accept-cookies")}async test(){return await c(()=>this.mainWorldEval("EVAL_ONETRUST_1"),10,500)}},class extends I{constructor(){super(...arguments),this.name="Klaro",this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):this.elementExists(".klaro > .cookie-notice")}async detectPopup(){return this.elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!await this.mainWorldEval("EVAL_KLARO_TRY_API_OPT_OUT")||(!!await this.click(".klaro .cn-decline")||(await this.mainWorldEval("EVAL_KLARO_OPEN_POPUP"),!!await this.click(".klaro .cn-decline")||(await this.click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked,.required,.only-required),.cm-purpose:not(.cm-toggle-all) > div > input:not(.half-checked,.required,.only-required)",!0),await this.click(".cm-btn-accept,.cm-button"))))}async optIn(){return!!await this.click(".klaro .cm-btn-accept-all")||(this.settingsOpen?(await this.click(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),await this.click(".cm-btn-accept")):await this.click(".klaro .cookie-notice .cm-btn-success"))}async test(){return await this.mainWorldEval("EVAL_KLARO_1")}},class extends I{constructor(){super(...arguments),this.name="Uniconsent"}get prehideSelectors(){return[".unic",".modal:has(.unic)"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".unic .unic-box,.unic .unic-bar,.unic .unic-modal")}async detectPopup(){return this.elementVisible(".unic .unic-box,.unic .unic-bar,.unic .unic-modal","any")}async optOut(){if(await this.waitForElement(".unic button",1e3),document.querySelectorAll(".unic button").forEach(e=>{const t=e.textContent||"";(t.includes("Manage Options")||t.includes("Optionen verwalten"))&&e.click()}),await this.waitForElement(".unic input[type=checkbox]",1e3)){await this.waitForElement(".unic button",1e3),document.querySelectorAll(".unic input[type=checkbox]").forEach(e=>{e.checked&&e.click()});for(const e of document.querySelectorAll(".unic button")){const t=e.textContent||"";for(const i of["Confirm Choices","Save Choices","Auswahl speichern"])if(t.includes(i))return e.click(),await this.wait(500),!0}}return!1}async optIn(){return this.waitForThenClick(".unic #unic-agree")}async test(){await this.wait(1e3);return!this.elementExists(".unic .unic-box,.unic .unic-bar")}},class extends I{constructor(){super(...arguments),this.prehideSelectors=[".cmp-root"],this.name="Conversant"}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists(".cmp-root .cmp-receptacle")}async detectPopup(){return this.elementVisible(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await this.waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await this.waitForElement(".cmp-view-tab-tabs"))return!1;await this.waitForThenClick(".cmp-view-tab-tabs > :first-child"),await this.waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");for(const e of Array.from(document.querySelectorAll(".cmp-accordion-item"))){e.querySelector(".cmp-accordion-item-title").click(),await c(()=>!!e.querySelector(".cmp-accordion-item-content.cmp-active"),10,50);const t=e.querySelector(".cmp-accordion-item-content.cmp-active");if(!t)return!1;t.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach(e=>e.click()),t.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach(e=>e.click())}return await this.click(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return this.waitForThenClick(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}},class extends I{constructor(){super(...arguments),this.name="tiktok.com",this.runContext={urlPattern:"tiktok"}}get hasSelfTest(){return!0}get isIntermediate(){return!1}get isCosmetic(){return!1}getShadowRoot(){const e=document.querySelector("tiktok-cookie-banner");return e?e.shadowRoot:null}async detectCmp(){return this.elementExists("tiktok-cookie-banner")}async detectPopup(){const e=this.getShadowRoot()?.querySelector(".tiktok-cookie-banner");return l(e)}async optOut(){const e=this.autoconsent.config.logs,t=this.getShadowRoot()?.querySelector(".button-wrapper button:first-child");return t?(e.rulesteps&&console.log("[clicking]",t),t.click(),!0):(e.errors&&console.log("no decline button found"),!1)}async optIn(){const e=this.autoconsent.config.logs,t=this.getShadowRoot()?.querySelector(".button-wrapper button:last-child");return t?(e.rulesteps&&console.log("[clicking]",t),t.click(),!0):(e.errors&&console.log("no accept button found"),!1)}async test(){const e=document.cookie.match(/cookie-consent=([^;]+)/);if(!e)return!1;const t=JSON.parse(decodeURIComponent(e[1]));return Object.values(t).every(e=>"boolean"!=typeof e||!1===e)}},class extends I{constructor(){super(...arguments),this.name="tumblr-com",this.runContext={urlPattern:"^https://(www\\.)?tumblr\\.com/"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}get prehideSelectors(){return["#cmp-app-container"]}async detectCmp(){return this.elementExists("#cmp-app-container")}async detectPopup(){return this.elementVisible("#cmp-app-container","any")}async optOut(){let e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-secondary");return!!t&&(t.click(),await c(()=>{const e=document.querySelector("#cmp-app-container iframe");return!!e?.contentDocument?.querySelector(".cmp__dialog input")},5,500),e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-secondary"),!!t&&(t.click(),!0))}async optIn(){const e=document.querySelector("#cmp-app-container iframe"),t=e?.contentDocument?.querySelector(".cmp-components-button.is-primary");return!!t&&(t.click(),!0)}},class extends I{constructor(){super(...arguments),this.name="Admiral"}get hasSelfTest(){return!1}get isIntermediate(){return!1}get isCosmetic(){return!1}async detectCmp(){return this.elementExists("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]")}async detectPopup(){return this.elementVisible("div > div[class*=Card] > div[class*=Frame] > div[class*=Pills] > button[class*=Pills__StyledPill]","any")}async optOut(){const e="xpath///button[contains(., 'Afvis alle') or contains(., 'Reject all') or contains(., 'Odbaci sve') or contains(., 'Rechazar todo') or contains(., 'Atmesti visus') or contains(., 'Odmítnout vše') or contains(., 'Απόρριψη όλων') or contains(., 'Rejeitar tudo') or contains(., 'Tümünü reddet') or contains(., 'Отклонить все') or contains(., 'Noraidīt visu') or contains(., 'Avvisa alla') or contains(., 'Odrzuć wszystkie') or contains(., 'Alles afwijzen') or contains(., 'Отхвърляне на всички') or contains(., 'Rifiuta tutto') or contains(., 'Zavrni vse') or contains(., 'Az összes elutasítása') or contains(., 'Respingeți tot') or contains(., 'Alles ablehnen') or contains(., 'Tout rejeter') or contains(., 'Odmietnuť všetko') or contains(., 'Lükka kõik tagasi') or contains(., 'Hylkää kaikki')]";if(await this.waitForElement(e,500))return await this.click(e);const t="xpath///button[contains(., 'Spara & avsluta') or contains(., 'Save & exit') or contains(., 'Uložit a ukončit') or contains(., 'Enregistrer et quitter') or contains(., 'Speichern & Verlassen') or contains(., 'Tallenna ja poistu') or contains(., 'Išsaugoti ir išeiti') or contains(., 'Opslaan & afsluiten') or contains(., 'Guardar y salir') or contains(., 'Shrani in zapri') or contains(., 'Uložiť a ukončiť') or contains(., 'Kaydet ve çıkış yap') or contains(., 'Сохранить и выйти') or contains(., 'Salvesta ja välju') or contains(., 'Salva ed esci') or contains(., 'Gem & afslut') or contains(., 'Αποθήκευση και έξοδος') or contains(., 'Saglabāt un iziet') or contains(., 'Mentés és kilépés') or contains(., 'Guardar e sair') or contains(., 'Zapisz & zakończ') or contains(., 'Salvare și ieșire') or contains(., 'Spremi i izađi') or contains(., 'Запазване и изход')]";if(await this.waitForThenClick("xpath///button[contains(., 'Zwecke') or contains(., 'Σκοποί') or contains(., 'Purposes') or contains(., 'Цели') or contains(., 'Eesmärgid') or contains(., 'Tikslai') or contains(., 'Svrhe') or contains(., 'Cele') or contains(., 'Účely') or contains(., 'Finalidades') or contains(., 'Mērķi') or contains(., 'Scopuri') or contains(., 'Fines') or contains(., 'Ändamål') or contains(., 'Finalités') or contains(., 'Doeleinden') or contains(., 'Tarkoitukset') or contains(., 'Scopi') or contains(., 'Amaçlar') or contains(., 'Nameni') or contains(., 'Célok') or contains(., 'Formål')]")&&await this.waitForVisible(t)){const e=this.elementSelector(t)[0].parentElement?.parentElement,i=e?.querySelectorAll("input[type=checkbox]:checked");return i?.forEach(e=>e.click()),await this.click(t)}return!1}async optIn(){return await this.click("xpath///button[contains(., 'Sprejmi vse') or contains(., 'Prihvati sve') or contains(., 'Godkänn alla') or contains(., 'Prijať všetko') or contains(., 'Принять все') or contains(., 'Aceptar todo') or contains(., 'Αποδοχή όλων') or contains(., 'Zaakceptuj wszystkie') or contains(., 'Accetta tutto') or contains(., 'Priimti visus') or contains(., 'Pieņemt visu') or contains(., 'Tümünü kabul et') or contains(., 'Az összes elfogadása') or contains(., 'Accept all') or contains(., 'Приемане на всички') or contains(., 'Accepter alle') or contains(., 'Hyväksy kaikki') or contains(., 'Tout accepter') or contains(., 'Alles accepteren') or contains(., 'Aktsepteeri kõik') or contains(., 'Přijmout vše') or contains(., 'Alles akzeptieren') or contains(., 'Aceitar tudo') or contains(., 'Acceptați tot')]")}}],V=class{constructor(e){this.autoconsentInstance=e}async clickElement(e){return!!(e&&e instanceof HTMLElement)&&(this.autoconsentInstance.config.logs.rulesteps&&console.log("[clickElement]",e),e.click(),!0)}async click(e,t=!1){const i=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[click]",e,t,i),i.length>0&&(t?i.forEach(e=>e.click()):i[0].click()),i.length>0}elementExists(e){return this.elementSelector(e).length>0}elementVisible(e,t="all"){const i=this.elementSelector(e),n=new Array(i.length);return i.forEach((e,t)=>{n[t]=l(e)}),"none"===t?n.every(e=>!e):0!==n.length&&("any"===t?n.some(e=>e):n.every(e=>e))}waitForElement(e,t=1e4){const i=Math.ceil(t/200);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[waitForElement]",e),c(()=>this.elementSelector(e).length>0,i,200)}waitForVisible(e,t=1e4,i="any"){const n=Math.ceil(t/200);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[waitForVisible]",e),c(()=>this.elementVisible(e,i),n,200)}async waitForThenClick(e,t=1e4,i=!1){return await this.waitForElement(e,t),await this.click(e,i)}wait(e){return this.autoconsentInstance.config.logs.rulesteps&&this.autoconsentInstance.config.logs.waits&&console.log("[wait]",e),new Promise(t=>{setTimeout(()=>{t(!0)},e)})}cookieContains(e){return document.cookie.includes(e)}hide(e,t){this.autoconsentInstance.config.logs.rulesteps&&console.log("[hide]",e);return r(a(),e,t)}removeClass(e,t){const i=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[removeClass]",e,t,i),i.forEach(e=>e.classList.remove(t)),i.length>0}setStyle(e,t){const i=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[setStyle]",e,t,i),i.forEach(e=>e.style.cssText=t),i.length>0}addStyle(e,t){const i=this.elementSelector(e);return this.autoconsentInstance.config.logs.rulesteps&&console.log("[addStyle]",e,t,i),i.forEach(e=>e.style.cssText+="; "+t),i.length>0}prehide(e){const t=a("autoconsent-prehide");return this.autoconsentInstance.config.logs.lifecycle&&console.log("[prehide]",t,location.href),r(t,e,"opacity")}undoPrehide(){const e=a("autoconsent-prehide");this.autoconsentInstance.config.logs.lifecycle&&console.log("[undoprehide]",e,location.href),e.remove()}async createOrUpdateStyleSheet(e,t){return t||(t=new CSSStyleSheet),t=await t.replace(e)}removeStyleSheet(e){return!!e&&(e.replace(""),!0)}querySingleReplySelector(e,t=document){if(e.startsWith("aria/"))return[];if(e.startsWith("xpath/")){const i=e.slice(6),n=document.evaluate(i,t,null,XPathResult.ANY_TYPE,null);let o=null;const s=[];for(;o=n.iterateNext();)s.push(o);return s}return e.startsWith("text/")||e.startsWith("pierce/")?[]:t.shadowRoot?Array.from(t.shadowRoot.querySelectorAll(e)):t.contentDocument?.querySelectorAll?Array.from(t.contentDocument.querySelectorAll(e)):Array.from(t.querySelectorAll(e))}querySelectorChain(e){let t=document,i=[];for(const n of e){if(i=this.querySingleReplySelector(n,t),0===i.length)return[];t=i[0]}return i}elementSelector(e){return"string"==typeof e?this.querySingleReplySelector(e):this.querySelectorChain(e)}waitForMutation(e,t=6e4){const i=this.elementSelector(e);if(0===i.length)throw new Error(`${e} did not match any elements`);return new Promise((e,n)=>{const o=setTimeout(()=>{n(new Error("Timed out waiting for mutation")),s.disconnect()},t),s=new MutationObserver(()=>{clearTimeout(o),s.disconnect(),e(!0)});s.observe(i[0],{subtree:!0,childList:!0,attributes:!0})})}},j=[["exists","e"],["visible","v"],["waitForThenClick","c"],["click","k"],["waitFor","w"],["waitForVisible","wv"],["hide","h"],["cookieContains","cc"]];function M(e){return 1===e||0!==e&&void 0}var N,q=class{constructor(e,t){this.intermediate=!1,this.optIn=[],this.r=e,this.s=t,this.r[10]&&this.r[10].intermediate&&(this.intermediate=this.r[10].intermediate)}_decodeRuleStep(e){const t={...e},i=this._decodeRuleStep.bind(this);for(const[e,i]of j)void 0!==t[i]&&(t[e]=this.s[t[i]],delete t[i]);return e.if&&(t.if=i(e.if),t.then=e.then&&e.then.map(i),e.else&&(t.else=e.else.map(i))),e.any&&(t.any=e.any.map(i)),{...t}}get minimumRuleStepVersion(){return this.r[0]}get name(){return this.r[1]}get cosmetic(){return M(this.r[2])}get runContext(){const e={},t=this.r[3],i=this.r[4],n=M(Math.floor(i/10)%10),o=M(i%10);return void 0!==n&&(e.main=n),void 0!==o&&(e.frame=o),""!==t&&(e.urlPattern=t),e}get prehideSelectors(){return this.r[5].map(e=>this.s[e].toString())}get detectCmp(){return this.r[6].map(this._decodeRuleStep.bind(this))}get detectPopup(){return this.r[7].map(this._decodeRuleStep.bind(this))}get optOut(){return this.r[8].map(this._decodeRuleStep.bind(this))}get test(){return this.r[9].map(this._decodeRuleStep.bind(this))}};N=new WeakMap;const D=new class{constructor(t,i=null,o=null){var a,r,c;if(this.id=n(),this.rules=[],a=this,(r=N).has(a)?e("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(a):r.set(a,c),this.state={lifecycle:"loading",prehideOn:!1,findCmpAttempts:0,detectedCmps:[],detectedPopups:[],heuristicPatterns:[],heuristicSnippets:[],selfTest:null,clicks:0,startTime:0,endTime:0},s.sendContentMessage=t,this.sendContentMessage=t,this.rules=[],this.updateState({lifecycle:"loading"}),this.addDynamicRules(),i)this.initialize(i,o);else{o&&this.parseDeclarativeRules(o);t({type:"init",url:window.location.href}),this.updateState({lifecycle:"waitingForInitResponse"})}this.domActions=new V(this)}get config(){if(!i(this,N))throw new Error("AutoConsent is not initialized yet");return i(this,N)}initialize(e,i){const n=u(e);var o,s,a,r;if(n.logs.lifecycle&&console.log("autoconsent init",window.location.href),a=n,t(o=this,s=N,"write to private field"),r?r.call(o,a):s.set(o,a),n.enabled){if(i&&this.parseDeclarativeRules(i),this.rules=function(e,t){return e.filter(e=>(!t.disabledCmps||!t.disabledCmps.includes(e.name))&&(t.enableCosmeticRules||!e.isCosmetic)&&(t.enableGeneratedRules||!e.name.startsWith("auto_")))}(this.rules,n),this.shouldPrehide)if(document.documentElement)this.prehideElements();else{const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.prehideElements()};window.addEventListener("DOMContentLoaded",e)}if("loading"===document.readyState){const e=()=>{window.removeEventListener("DOMContentLoaded",e),this.start()};window.addEventListener("DOMContentLoaded",e)}else this.start();this.updateState({lifecycle:"initialized"})}else n.logs.lifecycle&&console.log("autoconsent is disabled")}get shouldPrehide(){return this.config.enablePrehide&&!this.config.visualTest}saveFocus(){this.focusedElement=document.activeElement,this.focusedElement&&this.config.logs.lifecycle&&console.log("saving focus",this.focusedElement,location.href)}restoreFocus(){if(this.focusedElement){this.config.logs.lifecycle&&console.log("restoring focus",this.focusedElement,location.href);try{this.focusedElement.focus({preventScroll:!0})}catch(e){this.config.logs.errors&&console.warn("error restoring focus",e)}this.focusedElement=void 0}}addDynamicRules(){F.forEach(e=>{this.rules.push(new e(this))})}parseDeclarativeRules(e){const t=i(this,N)?.performanceLoggingEnabled;if(t&&performance.mark("parseDeclarativeRulesStart"),e.autoconsent&&e.autoconsent.forEach(e=>{this.addDeclarativeCMP(e)}),e.compact)try{(function(e){if(e.v>1)throw new Error("Unsupported rule format.");return e.r.filter(e=>e[0]<=2).map(t=>new q(t,e.s))})(e.compact).forEach(this.addDeclarativeCMP.bind(this))}catch(e){i(this,N)?.logs.errors&&console.error(e)}t&&performance.mark("parseDeclarativeRulesEnd"),t&&performance.measure("parseDeclarativeRules","parseDeclarativeRulesStart","parseDeclarativeRulesEnd")}addDeclarativeCMP(e){(e.minimumRuleStepVersion||1)<=2&&this.rules.push(new L(e,this))}start(){!function(e,t=500){globalThis.requestIdleCallback?requestIdleCallback(e,{timeout:t}):setTimeout(e,0)}(()=>this._start())}async _start(){const e=this.config.logs;e.lifecycle&&console.log(`Detecting CMPs on ${window.location.href}`),this.updateState({lifecycle:"started"});const t=await this.findCmp(this.config.detectRetries);if(this.updateState({detectedCmps:t.map(e=>e.name)}),this.config.performanceLoggingEnabled&&this.updateState({performance:this.measurePerformance()}),0===t.length)return e.lifecycle&&console.log("no CMP found",location.href),this.shouldPrehide&&this.undoPrehide(),this.updateState({lifecycle:"nothingDetected"}),!1;this.updateState({lifecycle:"cmpDetected"});const i=[],n=[];for(const e of t)e.isCosmetic?n.push(e):i.push(e);let o=!1,s=await this.detectPopups(i,async e=>{o=await this.handlePopup(e)});if(0===s.length&&(s=await this.detectPopups(n,async e=>{o=await this.handlePopup(e)})),0===s.length)return e.lifecycle&&console.log("no popup found"),this.shouldPrehide&&this.undoPrehide(),!1;if(s.length>1){const t={msg:"Found multiple CMPs, check the detection rules.",cmps:s.map(e=>e.name)};e.errors&&console.warn(t.msg,t.cmps),this.sendContentMessage({type:"autoconsentError",details:t})}return o}async findCmp(e){const t=this.config.logs;this.updateState({findCmpAttempts:this.state.findCmpAttempts+1});const i=[],n=p(),o=[],s=[];this.rules.forEach(e=>{if(e.checkFrameContext(n)){const t=!!e.runContext.urlPattern;e.hasMatchingUrlPattern()?o.push(e):t||s.push(e)}});const a=n&&"off"!==this.config.heuristicMode&&this.state.findCmpAttempts%2==0?[new P(this,this.config.heuristicMode)]:[],r=[["site-specific",o],["generic",s],["heuristic",a]],c=async e=>{try{await e.detectCmp()&&(t.lifecycle&&console.log(`Found CMP: ${e.name} ${window.location.href}`),this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:e.name}),i.push(e))}catch(i){t.errors&&console.warn(`error detecting ${e.name}`,i)}},l=this.domActions.waitForMutation("html");l.catch(()=>{});for(const[e,n]of r)if(t.lifecycle&&n.length>0&&console.log(`Trying ${e} rules`,n.map(e=>e.name)),this.config.performanceLoggingEnabled&&performance.mark(`findCmpStage_${e}`),await Promise.all(n.map(c)),this.config.performanceLoggingEnabled&&performance.mark(`findCmpStageEnd_${e}`),this.config.performanceLoggingEnabled&&performance.measure(`findCmp_${e}`,`findCmpStage_${e}`,`findCmpStageEnd_${e}`),i.length>0)break;if(this.detectHeuristics(),0===i.length&&e>0){const t=[this.domActions.wait(500)];this.state.findCmpAttempts>1&&t.push(l);try{await Promise.all(t)}catch(e){return[]}return this.findCmp(e-1)}return i}detectHeuristics(){if(this.config.enableHeuristicDetection){this.config.performanceLoggingEnabled&&performance.mark("detectHeuristicsStart");const{patterns:e,snippets:t}=_(document.documentElement?.innerText||"");e.length>0&&(e.length!==this.state.heuristicPatterns.length||this.state.heuristicPatterns.some((t,i)=>t!==e[i]))&&(this.config.logs.lifecycle&&console.log("Heuristic patterns found",e,t),this.updateState({heuristicPatterns:e,heuristicSnippets:t})),this.config.performanceLoggingEnabled&&performance.mark("detectHeuristicsEnd"),this.config.performanceLoggingEnabled&&performance.measure("detectHeuristics","detectHeuristicsStart","detectHeuristicsEnd")}}async detectPopup(e){if(await this.waitForPopup(e).catch(t=>(this.config.logs.errors&&console.warn(`error waiting for a popup for ${e.name}`,t),!1)))return this.updateState({detectedPopups:this.state.detectedPopups.concat([e.name])}),this.sendContentMessage({type:"popupFound",cmp:e.name,url:location.href}),e;throw new Error("Popup is not shown")}async detectPopups(e,t){const i=e.map(e=>this.detectPopup(e));await Promise.any(i).then(e=>{this.detectHeuristics(),t(e)}).catch(()=>{});const n=await Promise.allSettled(i),o=[];for(const e of n)"fulfilled"===e.status&&o.push(e.value);return o}async handlePopup(e){return this.updateState({lifecycle:"openPopupDetected",startTime:Date.now()}),this.shouldPrehide&&!this.state.prehideOn&&this.prehideElements(),this.foundCmp=e,"optOut"===this.config.autoAction?await this.doOptOut():"optIn"===this.config.autoAction?await this.doOptIn():(this.config.logs.lifecycle&&console.log("waiting for opt-out signal...",location.href),!0)}async doOptOut(){const e=this.config.logs;let t;return this.updateState({lifecycle:"runningOptOut"}),this.saveFocus(),this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: opt out on ${window.location.href}`),t=await this.foundCmp.optOut(),e.lifecycle&&console.log(`${this.foundCmp.name}: opt out result ${t}`)):(e.errors&&console.log("no CMP to opt out"),t=!1),this.shouldPrehide&&this.undoPrehide(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:Boolean(this.foundCmp&&this.foundCmp.hasSelfTest),url:location.href}),t&&this.foundCmp&&!this.foundCmp.isIntermediate?(this.state.endTime=Date.now(),e.lifecycle&&console.log(`${this.foundCmp.name}: done in ${this.state.endTime-this.state.startTime}ms with ${this.state.clicks} clicks`),this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp?.name,isCosmetic:this.foundCmp?.isCosmetic,url:location.href,duration:this.state.endTime-this.state.startTime,totalClicks:this.state.clicks}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optOutSucceeded":"optOutFailed"}),this.restoreFocus(),t}async doOptIn(){const e=this.config.logs;let t;return this.updateState({lifecycle:"runningOptIn"}),this.saveFocus(),this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: opt in on ${window.location.href}`),t=await this.foundCmp.optIn(),e.lifecycle&&console.log(`${this.foundCmp.name}: opt in result ${t}`)):(e.errors&&console.log("no CMP to opt in"),t=!1),this.shouldPrehide&&this.undoPrehide(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,scheduleSelfTest:!1,url:location.href}),t&&this.foundCmp&&!this.foundCmp.isIntermediate?(this.state.endTime=Date.now(),e.lifecycle&&console.log(`${this.foundCmp.name}: done in ${this.state.endTime-this.state.startTime}ms with ${this.state.clicks} clicks`),this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,isCosmetic:this.foundCmp.isCosmetic,url:location.href,duration:this.state.endTime-this.state.startTime,totalClicks:this.state.clicks}),this.updateState({lifecycle:"done"})):this.updateState({lifecycle:t?"optInSucceeded":"optInFailed"}),this.restoreFocus(),t}async doSelfTest(){const e=this.config.logs;let t;return this.foundCmp?(e.lifecycle&&console.log(`CMP ${this.foundCmp.name}: self-test on ${window.location.href}`),t=await this.foundCmp.test()):(e.errors&&console.log("no CMP to self test"),t=!1),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:t,url:location.href}),this.updateState({selfTest:t}),t}async waitForPopup(e,t=10,i=500){const n=this.config.logs;n.lifecycle&&console.log("checking if popup is open...",e.name);let o=null;this.config.enablePopupMutationObserver&&(o=this.domActions.waitForMutation("html",1e4),o.catch(()=>{}));const s=await e.detectPopup().catch(t=>(n.errors&&console.warn(`error detecting popup for ${e.name}`,t),!1));if(!s&&t>0){if(o)try{await Promise.all([this.domActions.wait(i),o])}catch(t){n.lifecycle&&console.log(e.name,"popup detection timed out waiting for DOM mutation")}else await this.domActions.wait(i);return this.waitForPopup(e,t-1,i)}return n.lifecycle&&console.log(e.name,"popup is "+(s?"open":"not open")),s}prehideElements(){const e=this.config.logs,t=this.rules.filter(e=>e.prehideSelectors&&e.checkRunContext()).reduce((e,t)=>[...e||[],...t.prehideSelectors||[]],["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]);return this.updateState({prehideOn:!0}),setTimeout(()=>{this.shouldPrehide&&this.state.prehideOn&&!["runningOptOut","runningOptIn"].includes(this.state.lifecycle)&&(e.lifecycle&&console.log("Process is taking too long, unhiding elements"),this.undoPrehide())},this.config.prehideTimeout||2e3),this.domActions.prehide(t.join(","))}undoPrehide(){this.updateState({prehideOn:!1}),this.domActions.undoPrehide()}updateState(e){Object.assign(this.state,e),this.sendContentMessage({type:"report",instanceId:this.id,url:window.location.href,mainFrame:p(),state:this.state})}async receiveMessageCallback(e){const t=i(this,N)?.logs;switch(t?.messages&&console.log("received from background",e,window.location.href),e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optIn":await this.doOptIn();break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,t){const i=s.pending.get(e);i?(s.pending.delete(e),i.timer&&window.clearTimeout(i.timer),i.resolve(t)):console.warn("no eval #",e)}(e.id,e.result);break;case"measurePerformance":this.updateState({performance:this.measurePerformance()})}}measurePerformance(){const e=e=>performance.getEntriesByName(e).map(e=>Number(e.duration.toFixed(3)));return{detectHeuristics:e("detectHeuristics"),heuristicDetector:e("heuristicDetector"),findCmpSiteSpecific:e("findCmp_site-specific"),findCmpGeneric:e("findCmp_generic"),findCmpHeuristic:e("findCmp_heuristic"),parseDeclarativeRules:e("parseDeclarativeRules")}}}(e=>{AutoconsentAndroid.process(JSON.stringify(e))});window.autoconsentMessageCallback=e=>{D.receiveMessageCallback(e)}}(); diff --git a/autoconsent/autoconsent-impl/libs/userscript.js b/autoconsent/autoconsent-impl/libs/userscript.js index 1f8509a867c0..c389f8b63108 100644 --- a/autoconsent/autoconsent-impl/libs/userscript.js +++ b/autoconsent/autoconsent-impl/libs/userscript.js @@ -1,12 +1,9 @@ import AutoConsent from '@duckduckgo/autoconsent'; -import { consentomatic } from '@duckduckgo/autoconsent/rules/consentomatic.json' const autoconsent = new AutoConsent( (message) => { AutoconsentAndroid.process(JSON.stringify(message)); - }, - null, - { consentomatic }, + } ); window.autoconsentMessageCallback = (msg) => { autoconsent.receiveMessageCallback(msg); diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/RealAutoconsent.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/RealAutoconsent.kt index b52264e9a234..f26ddb9a7684 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/RealAutoconsent.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/RealAutoconsent.kt @@ -23,6 +23,7 @@ import com.duckduckgo.app.di.IsMainProcess import com.duckduckgo.app.privacy.db.UserAllowListRepository import com.duckduckgo.autoconsent.api.Autoconsent import com.duckduckgo.autoconsent.api.AutoconsentCallback +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.AutoconsentInterface.Companion.AUTOCONSENT_INTERFACE import com.duckduckgo.autoconsent.impl.cache.AutoconsentSettingsCache import com.duckduckgo.autoconsent.impl.handlers.ReplyHandler @@ -86,6 +87,14 @@ class RealAutoconsent @Inject constructor( settingsRepository.userSetting = setting } + override fun changeCookiePopUpPreference(preference: CookiePopUpPreference) { + settingsRepository.cookiePopUpPreference = preference + } + + override fun getCookiePopUpPreference(): CookiePopUpPreference { + return settingsRepository.cookiePopUpPreference + } + override fun isSettingEnabled(): Boolean { return settingsRepository.userSetting } diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt index b80b1ac8a3a7..e9f09d48a56d 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPlugin.kt @@ -21,6 +21,7 @@ import androidx.core.net.toUri import com.duckduckgo.app.di.AppCoroutineScope import com.duckduckgo.autoconsent.api.AutoconsentCallback import com.duckduckgo.autoconsent.api.AutoconsentResult +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.AutoconsentReloadLoopDetector import com.duckduckgo.autoconsent.impl.MessageHandlerPlugin import com.duckduckgo.autoconsent.impl.adapters.JSONObjectAdapter @@ -75,10 +76,15 @@ class InitMessageHandlerPlugin @Inject constructor( reloadLoopDetector.updateUrl(webView, url) - // Remove comment to promote feature and remove @Ignore from tests - val isAutoconsentDisabled = !settingsRepository.userSetting // && settingsRepository.firstPopupHandled + val preference = if (autoconsentFeature.cookiePopUpPreferenceSetting().isEnabled()) { + settingsRepository.cookiePopUpPreference + } else if (settingsRepository.userSetting) { + CookiePopUpPreference.DEFAULT + } else { + CookiePopUpPreference.OFF + } - if (isAutoconsentDisabled) { + if (preference == CookiePopUpPreference.OFF) { autoconsentPixelManager.fireDailyPixel(AutoConsentPixel.AUTOCONSENT_DISABLED_FOR_SITE_DAILY) return@launch } @@ -98,22 +104,8 @@ class InitMessageHandlerPlugin @Inject constructor( ) val settings = settingsCache.getSettings() ?: return@launch - val autoAction = getAutoAction(webView) - val enablePreHide = settingsRepository.userSetting - val detectRetries = 20 - val disabledCmps = settings.disabledCMPs - val config = - Config( - enabled = true, - autoAction, - disabledCmps, - enablePreHide, - detectRetries, - isMainWorld = true, - enableCosmeticRules = true, - enableHeuristicDetection = true, - enableHeuristicAction = autoconsentFeature.heuristicAction().isEnabled(), - ) + val cookiePopUpPreferenceSettingEnabled = autoconsentFeature.cookiePopUpPreferenceSetting().isEnabled() + val config = buildConfig(preference, cookiePopUpPreferenceSettingEnabled, settings.disabledCMPs, webView) val initResp = if (autoconsentFeature.ruleFiltering().isEnabled()) { InitResp(config = config, rules = filterCompactRules(settings.compactRuleList, url)) } else { @@ -143,6 +135,40 @@ class InitMessageHandlerPlugin @Inject constructor( return "optOut" } + private fun buildConfig( + preference: CookiePopUpPreference, + cookiePopUpPreferenceSettingEnabled: Boolean, + disabledCmps: List, + webView: WebView, + ): Config { + return Config( + enabled = true, + autoAction = getAutoAction(webView), + disabledCmps = disabledCmps, + enablePrehide = true, + detectRetries = 20, + isMainWorld = true, + enableCosmeticRules = true, + enableHeuristicDetection = true, + heuristicMode = getHeuristicMode(preference, cookiePopUpPreferenceSettingEnabled), + ) + } + + private fun getHeuristicMode( + preference: CookiePopUpPreference, + cookiePopUpPreferenceSettingEnabled: Boolean, + ): String { + if (!autoconsentFeature.heuristicAction().isEnabled()) { + return "off" + } + + return when (preference) { + CookiePopUpPreference.MAX -> "tier2" + CookiePopUpPreference.DEFAULT -> if (cookiePopUpPreferenceSettingEnabled) "tier1" else "reject" + CookiePopUpPreference.OFF -> "off" + } + } + private fun parseMessage(jsonString: String): InitMessage? { val jsonAdapter: JsonAdapter = moshi.adapter(InitMessage::class.java) return jsonAdapter.fromJson(jsonString) @@ -245,7 +271,7 @@ class InitMessageHandlerPlugin @Inject constructor( val isMainWorld: Boolean, val enableCosmeticRules: Boolean, val enableHeuristicDetection: Boolean, - val enableHeuristicAction: Boolean, + val heuristicMode: String, ) data class AutoconsentRuleset(val compact: Any?) diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/remoteconfig/AutoconsentFeature.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/remoteconfig/AutoconsentFeature.kt index 20c2c666ffa5..12f95d8d2767 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/remoteconfig/AutoconsentFeature.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/remoteconfig/AutoconsentFeature.kt @@ -59,4 +59,10 @@ interface AutoconsentFeature { @Toggle.DefaultValue(DefaultFeatureValue.FALSE) fun heuristicAction(): Toggle + + /** + * Gate for the new Cookie Pop-up Preference settings UI and behavior. + */ + @Toggle.DefaultValue(DefaultFeatureValue.FALSE) + fun cookiePopUpPreferenceSetting(): Toggle } diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/store/AutoconsentSettingsDataStore.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/store/AutoconsentSettingsDataStore.kt index 8b1a49145ae6..2aebb26f6395 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/store/AutoconsentSettingsDataStore.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/store/AutoconsentSettingsDataStore.kt @@ -19,12 +19,14 @@ package com.duckduckgo.autoconsent.impl.store import android.content.Context import android.content.SharedPreferences import androidx.core.content.edit +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature import com.duckduckgo.common.utils.DispatcherProvider import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch interface AutoconsentSettingsDataStore { + var cookiePopUpPreference: CookiePopUpPreference var userSetting: Boolean var firstPopupHandled: Boolean fun invalidateCache() @@ -38,7 +40,8 @@ class RealAutoconsentSettingsDataStore constructor( ) : AutoconsentSettingsDataStore { private val preferences: SharedPreferences by lazy { context.getSharedPreferences(FILENAME, Context.MODE_PRIVATE) } - private var cachedInternalUserSetting: Boolean? = null + private var cachedLegacyUserSetting: Boolean? = null + private var cachedCookiePopUpPreference: CookiePopUpPreference? = null private var _defaultValue: Boolean? = null private val defaultValue: Boolean @@ -51,24 +54,32 @@ class RealAutoconsentSettingsDataStore constructor( init { appCoroutineScope.launch(dispatcherProvider.io()) { - cachedInternalUserSetting = preferences.getBoolean(AUTOCONSENT_USER_SETTING, defaultValue) + cachedLegacyUserSetting = readLegacyUserSetting() + cachedCookiePopUpPreference = readCookiePopUpPreference() } } - override var userSetting: Boolean + override var cookiePopUpPreference: CookiePopUpPreference get() { - return cachedInternalUserSetting ?: preferences.getBoolean(AUTOCONSENT_USER_SETTING, defaultValue).also { - cachedInternalUserSetting = it + return cachedCookiePopUpPreference ?: readCookiePopUpPreference().also { + cachedCookiePopUpPreference = it } } set(value) { preferences.edit(commit = true) { - putBoolean(AUTOCONSENT_USER_SETTING, value) + putString(AUTOCONSENT_COOKIE_POP_UP_PREFERENCE, value.name) }.also { - cachedInternalUserSetting = value + cachedCookiePopUpPreference = value } } + override var userSetting: Boolean + get() = cachedLegacyUserSetting ?: readLegacyUserSetting().also { cachedLegacyUserSetting = it } + set(value) { + writeLegacyUserSetting(value) + cachedLegacyUserSetting = value + } + override var firstPopupHandled: Boolean get() = preferences.getBoolean(AUTOCONSENT_FIRST_POPUP_HANDLED, false) set(value) { @@ -80,13 +91,60 @@ class RealAutoconsentSettingsDataStore constructor( override fun invalidateCache() { appCoroutineScope.launch(dispatcherProvider.io()) { _defaultValue = autoconsentFeature.onByDefault().isEnabled() - cachedInternalUserSetting = null // invalidate cache + cachedLegacyUserSetting = null + cachedCookiePopUpPreference = null + } + } + + private fun readCookiePopUpPreference(): CookiePopUpPreference { + if (preferences.contains(AUTOCONSENT_COOKIE_POP_UP_PREFERENCE)) { + return parsePreference(preferences.getString(AUTOCONSENT_COOKIE_POP_UP_PREFERENCE, null)) + } + val migrated = migrateFromLegacySetting() + if (preferences.contains(AUTOCONSENT_USER_SETTING)) { + preferences.edit(commit = true) { + putString(AUTOCONSENT_COOKIE_POP_UP_PREFERENCE, migrated.name) + } + } + return migrated + } + + private fun migrateFromLegacySetting(): CookiePopUpPreference { + return if (preferences.contains(AUTOCONSENT_USER_SETTING)) { + if (preferences.getBoolean(AUTOCONSENT_USER_SETTING, false)) { + CookiePopUpPreference.DEFAULT + } else { + CookiePopUpPreference.OFF + } + } else if (defaultValue) { + CookiePopUpPreference.DEFAULT + } else { + CookiePopUpPreference.OFF + } + } + + private fun readLegacyUserSetting(): Boolean { + return preferences.getBoolean(AUTOCONSENT_USER_SETTING, defaultValue) + } + + private fun writeLegacyUserSetting(value: Boolean) { + preferences.edit(commit = true) { + putBoolean(AUTOCONSENT_USER_SETTING, value) + } + } + + private fun parsePreference(value: String?): CookiePopUpPreference { + return try { + CookiePopUpPreference.valueOf(value!!) + } catch (_: Exception) { + CookiePopUpPreference.DEFAULT } } companion object { private const val FILENAME = "com.duckduckgo.autoconsent.store.settings" private const val AUTOCONSENT_USER_SETTING = "AutoconsentUserSetting" + private const val AUTOCONSENT_COOKIE_POP_UP_PREFERENCE = "AutoconsentCookiePopUpPreference" private const val AUTOCONSENT_FIRST_POPUP_HANDLED = "AutoconsentFirstPopupHandled" } } diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsActivity.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsActivity.kt index 0164a96c3b43..533c67acd704 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsActivity.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsActivity.kt @@ -27,12 +27,15 @@ import android.text.style.ClickableSpan import android.text.style.URLSpan import android.view.View import android.widget.CompoundButton +import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import com.duckduckgo.anvil.annotations.InjectWith +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.R import com.duckduckgo.autoconsent.impl.databinding.ActivityAutoconsentSettingsBinding +import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature import com.duckduckgo.autoconsent.impl.ui.AutoconsentSettingsViewModel.Command import com.duckduckgo.autoconsent.impl.ui.AutoconsentSettingsViewModel.ViewState import com.duckduckgo.browser.api.ui.BrowserScreens.WebViewActivityWithParams @@ -62,6 +65,9 @@ class AutoconsentSettingsActivity : DuckDuckGoActivity() { @Inject lateinit var edgeToEdgeHandler: EdgeToEdgeHandler + @Inject + lateinit var autoconsentFeature: AutoconsentFeature + private val binding: ActivityAutoconsentSettingsBinding by viewBinding() private val viewModel: AutoconsentSettingsViewModel by bindViewModel() @@ -69,10 +75,21 @@ class AutoconsentSettingsActivity : DuckDuckGoActivity() { private val toolbar get() = binding.includeToolbar.toolbar + private val showCookiePopUpPreferenceSetting: Boolean + get() = autoconsentFeature.cookiePopUpPreferenceSetting().isEnabled() + private val autoconsentToggleListener = CompoundButton.OnCheckedChangeListener { _, isChecked -> viewModel.onUserToggleAutoconsent(isChecked) } + private val autoManageCookiePopUpsToggleListener = CompoundButton.OnCheckedChangeListener { _, isChecked -> + viewModel.onAutoManageCookiePopUpsToggled(isChecked) + } + + private val popUpsWithoutOptOutsToggleListener = CompoundButton.OnCheckedChangeListener { _, isChecked -> + viewModel.onPopUpsWithoutOptOutsToggled(isChecked) + } + private val clickableSpan = object : ClickableSpan() { override fun onClick(widget: View) { viewModel.onLearnMoreSelected() @@ -113,6 +130,8 @@ class AutoconsentSettingsActivity : DuckDuckGoActivity() { private fun configureUiEventHandlers() { binding.autoconsentToggle.setOnCheckedChangeListener(autoconsentToggleListener) + binding.autoManageCookiePopUpsToggle.setOnCheckedChangeListener(autoManageCookiePopUpsToggleListener) + binding.popUpsWithoutOptOutsToggle.setOnCheckedChangeListener(popUpsWithoutOptOutsToggleListener) } private fun observeViewModel() { @@ -127,11 +146,27 @@ class AutoconsentSettingsActivity : DuckDuckGoActivity() { private fun render(viewState: ViewState) { with(binding) { + val isProtectionEnabled = if (showCookiePopUpPreferenceSetting) { + viewState.selectedPreference != CookiePopUpPreference.OFF + } else { + viewState.autoconsentEnabled + } autoconsentHeaderImage.setImageResource( - if (viewState.autoconsentEnabled) R.drawable.cookie_popups_check_128 else R.drawable.cookie_block_128, + if (isProtectionEnabled) R.drawable.cookie_popups_check_128 else R.drawable.cookie_block_128, ) - autoconsentStatusIndicator.setStatus(viewState.autoconsentEnabled) + autoconsentStatusIndicator.setStatus(isProtectionEnabled) + autoconsentToggle.isVisible = !showCookiePopUpPreferenceSetting + cookiePopUpPreferenceContainer.isVisible = showCookiePopUpPreferenceSetting autoconsentToggle.quietlySetIsChecked(viewState.autoconsentEnabled, autoconsentToggleListener) + autoManageCookiePopUpsToggle.quietlySetIsChecked( + viewState.autoManageEnabled, + autoManageCookiePopUpsToggleListener, + ) + popUpsWithoutOptOutsToggle.setSwitchEnabled(viewState.autoManageEnabled) + popUpsWithoutOptOutsToggle.quietlySetIsChecked( + viewState.popUpsWithoutOptOutsEnabled, + popUpsWithoutOptOutsToggleListener, + ) } } diff --git a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModel.kt b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModel.kt index 4b41089db312..041de360344b 100644 --- a/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModel.kt +++ b/autoconsent/autoconsent-impl/src/main/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModel.kt @@ -22,10 +22,12 @@ import androidx.lifecycle.viewModelScope import com.duckduckgo.anvil.annotations.ContributesViewModel import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.autoconsent.api.Autoconsent +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.R import com.duckduckgo.autoconsent.impl.pixels.AutoConsentPixel.SETTINGS_AUTOCONSENT_OFF import com.duckduckgo.autoconsent.impl.pixels.AutoConsentPixel.SETTINGS_AUTOCONSENT_ON import com.duckduckgo.autoconsent.impl.pixels.AutoConsentPixel.SETTINGS_AUTOCONSENT_SHOWN +import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature import com.duckduckgo.di.scopes.ActivityScope import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.channels.Channel @@ -40,10 +42,18 @@ import javax.inject.Inject class AutoconsentSettingsViewModel @Inject constructor( private val autoconsent: Autoconsent, private val pixel: Pixel, + private val autoconsentFeature: AutoconsentFeature, ) : ViewModel() { data class ViewState( + val selectedPreference: CookiePopUpPreference, val autoconsentEnabled: Boolean, - ) + ) { + val autoManageEnabled: Boolean + get() = selectedPreference != CookiePopUpPreference.OFF + + val popUpsWithoutOptOutsEnabled: Boolean + get() = selectedPreference == CookiePopUpPreference.MAX + } sealed class Command { data class LaunchLearnMoreWebPage( @@ -54,8 +64,7 @@ class AutoconsentSettingsViewModel @Inject constructor( private val command = Channel(1, BufferOverflow.DROP_OLDEST) - private val viewStateFlow: MutableStateFlow = - MutableStateFlow(ViewState(autoconsent.isSettingEnabled())) + private val viewStateFlow: MutableStateFlow = MutableStateFlow(buildViewState()) val viewState: StateFlow = viewStateFlow init { @@ -66,7 +75,42 @@ class AutoconsentSettingsViewModel @Inject constructor( return command.receiveAsFlow() } + fun onAutoManageCookiePopUpsToggled(enabled: Boolean) { + if (!isCookiePopUpPreferenceSettingEnabled()) return + val preference = if (enabled) { + CookiePopUpPreference.DEFAULT + } else { + CookiePopUpPreference.OFF + } + updateCookiePopUpPreference(preference) + } + + fun onPopUpsWithoutOptOutsToggled(enabled: Boolean) { + if (!isCookiePopUpPreferenceSettingEnabled()) return + val preference = if (enabled) { + CookiePopUpPreference.MAX + } else { + CookiePopUpPreference.DEFAULT + } + updateCookiePopUpPreference(preference) + } + + private fun updateCookiePopUpPreference(preference: CookiePopUpPreference) { + viewModelScope.launch { + pixel.fire( + if (preference == CookiePopUpPreference.OFF) { + SETTINGS_AUTOCONSENT_OFF + } else { + SETTINGS_AUTOCONSENT_ON + }, + ) + autoconsent.changeCookiePopUpPreference(preference) + viewStateFlow.emit(buildViewState()) + } + } + fun onUserToggleAutoconsent(enabled: Boolean) { + if (isCookiePopUpPreferenceSettingEnabled()) return viewModelScope.launch { pixel.fire( if (enabled) { @@ -76,7 +120,7 @@ class AutoconsentSettingsViewModel @Inject constructor( }, ) autoconsent.changeSetting(enabled) - viewStateFlow.emit(ViewState(autoconsent.isSettingEnabled())) + viewStateFlow.emit(buildViewState()) } } @@ -87,4 +131,22 @@ class AutoconsentSettingsViewModel @Inject constructor( companion object { const val LEARN_MORE_URL = "https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/#cookie-pop-up-management" } + + private fun buildViewState(): ViewState { + if (!isCookiePopUpPreferenceSettingEnabled()) { + val enabled = autoconsent.isSettingEnabled() + return ViewState( + selectedPreference = if (enabled) CookiePopUpPreference.DEFAULT else CookiePopUpPreference.OFF, + autoconsentEnabled = enabled, + ) + } + return ViewState( + selectedPreference = autoconsent.getCookiePopUpPreference(), + autoconsentEnabled = autoconsent.isSettingEnabled(), + ) + } + + private fun isCookiePopUpPreferenceSettingEnabled(): Boolean { + return autoconsentFeature.cookiePopUpPreferenceSetting().isEnabled() + } } diff --git a/autoconsent/autoconsent-impl/src/main/res/layout/activity_autoconsent_settings.xml b/autoconsent/autoconsent-impl/src/main/res/layout/activity_autoconsent_settings.xml index 14cba548bc28..e099e2b7860e 100644 --- a/autoconsent/autoconsent-impl/src/main/res/layout/activity_autoconsent_settings.xml +++ b/autoconsent/autoconsent-impl/src/main/res/layout/activity_autoconsent_settings.xml @@ -90,6 +90,50 @@ app:primaryTextTruncated="false" app:showSwitch="true" /> + + + + + + + + + + + diff --git a/autoconsent/autoconsent-impl/src/main/res/values/strings-autoconsent.xml b/autoconsent/autoconsent-impl/src/main/res/values/strings-autoconsent.xml index cbe57b7fa74d..05313e69195a 100644 --- a/autoconsent/autoconsent-impl/src/main/res/values/strings-autoconsent.xml +++ b/autoconsent/autoconsent-impl/src/main/res/values/strings-autoconsent.xml @@ -20,4 +20,8 @@ Cookie Pop-Up Protection Learn More]]> Let DuckDuckGo handle cookie pop-ups + Auto-Manage Cookie Pop-Ups + We\'ll aim to only select the most private cookie options available for you, then close these pop-ups. + Pop-Ups Without Opt-Outs + Also let DuckDuckGo save you a click and accept cookies for you in pop-ups that don\'t let you opt out. \ No newline at end of file diff --git a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/Fakes.kt b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/Fakes.kt index 69f61d45d708..4d5cd48ff34c 100644 --- a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/Fakes.kt +++ b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/Fakes.kt @@ -21,6 +21,7 @@ import android.webkit.WebView import androidx.core.net.toUri import com.duckduckgo.app.privacy.db.UserAllowListRepository import com.duckduckgo.autoconsent.api.AutoconsentCallback +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.store.AutoconsentSettingsRepository import com.duckduckgo.common.utils.domain import com.duckduckgo.common.utils.plugins.PluginPoint @@ -52,7 +53,16 @@ class FakeMessageHandlerPlugin : MessageHandlerPlugin { } class FakeSettingsRepository : AutoconsentSettingsRepository { - override var userSetting: Boolean = false + override var cookiePopUpPreference: CookiePopUpPreference = CookiePopUpPreference.OFF + override var userSetting: Boolean + get() = cookiePopUpPreference != CookiePopUpPreference.OFF + set(value) { + cookiePopUpPreference = if (value) { + CookiePopUpPreference.DEFAULT + } else { + CookiePopUpPreference.OFF + } + } override var firstPopupHandled: Boolean = false override fun invalidateCache() {} } diff --git a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt index f27819f584f5..41bd09026e67 100644 --- a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt +++ b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/RealAutoconsentTest.kt @@ -19,6 +19,7 @@ package com.duckduckgo.autoconsent.impl import android.webkit.WebView import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.cache.RealAutoconsentSettingsCache import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentExceptionsRepository import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature @@ -118,6 +119,15 @@ class RealAutoconsentTest { assertTrue(settingsRepository.userSetting) } + @Test + fun whenChangeCookiePopUpPreferenceThenRepoSetValueChanged() { + autoconsent.changeCookiePopUpPreference(CookiePopUpPreference.MAX) + assertEquals(CookiePopUpPreference.MAX, settingsRepository.cookiePopUpPreference) + + autoconsent.changeCookiePopUpPreference(CookiePopUpPreference.OFF) + assertEquals(CookiePopUpPreference.OFF, autoconsent.getCookiePopUpPreference()) + } + @Test fun whenSettingEnabledCalledThenReturnValueFromRepo() { settingsRepository.userSetting = false diff --git a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPluginTest.kt b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPluginTest.kt index 4827ebb52cf8..2c170c237200 100644 --- a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPluginTest.kt +++ b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/handlers/InitMessageHandlerPluginTest.kt @@ -22,6 +22,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import com.duckduckgo.autoconsent.api.AutoconsentCallback import com.duckduckgo.autoconsent.api.AutoconsentResult +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.AutoconsentReloadLoopDetector import com.duckduckgo.autoconsent.impl.FakeSettingsRepository import com.duckduckgo.autoconsent.impl.adapters.JSONObjectAdapter @@ -60,6 +61,10 @@ class InitMessageHandlerPluginTest { private val feature = FakeFeatureToggleFactory.create(AutoconsentFeature::class.java) private val mockReloadLoopDetector: AutoconsentReloadLoopDetector = mock() + init { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) + } + @Suppress("ktlint:standard:max-line-length") private val mockRulesetJson = "{\"disabledCMPs\":[],\"compactRuleList\":{\"v\":1,\"s\":[\".cc-type-categories[aria-describedby=\\\"cookieconsent:desc\\\"]\",\".cc-type-categories[aria-describedby=\\\"cookieconsent:desc\\\"] .cc-dismiss\",\".cc-dismiss\",\".cc-type-categories input[type=checkbox]:not([disabled]):checked\",\".cc-save\",\"#gdpr-cookie-consent-bar\",\"#gdpr-cookie-consent-bar #cookie_action_reject\",\"wpl_viewed_cookie=no\",\".cookie-alert-extended\",\".cookie-alert-extended-modal\",\"a[data-controller='cookie-alert/extended/detail-link']\",\".cookie-alert-configuration-input:checked\",\"button[data-controller='cookie-alert/extended/button/configuration']\",\"body > div#root > div#ccpa-iframe-theme-provider[data-testid=\\\"ccpa-iframe-theme-provider\\\"] > div#ccpa-iframe[data-testid=\\\"ccpa-iframe\\\"] > div#ccpa_consent_banner[data-testid=\\\"ccpa_consent_banner\\\"] > div:not([id]) > div:nth-child(3):not([id]) > span:not([id]) > span:not([id]) > div:nth-child(2):not([id]) > span:nth-child(1):not([id]) > button#decline_cookies_button[data-testid=\\\"decline_cookies_button\\\"]\",\"body:not([id]) > div#didomi-host > div:not([id]) > div#didomi-popup > div:nth-child(2):not([id]) > div:not([id]) > div:nth-child(2):not([id]) > span:nth-child(1):not([id])\"],\"r\":[[1,\"Complianz categories\",2,\"\",22,[0],[{\"e\":0}],[{\"v\":0}],[{\"if\":{\"e\":1},\"then\":[{\"k\":2}],\"else\":[{\"all\":true,\"optional\":true,\"k\":3},{\"k\":4}]}],[],{}],[1,\"WP Cookie Notice for GDPR\",2,\"\",22,[5],[{\"e\":5}],[{\"v\":5}],[{\"c\":6}],[{\"cc\":7}],{}],[1,\"cookiealert\",2,\"\",11,[],[{\"e\":8}],[{\"v\":9}],[{\"k\":10},{\"all\":true,\"optional\":true,\"k\":11},{\"k\":12},{\"eval\":\"EVAL_COOKIEALERT_0\"}],[{\"eval\":\"EVAL_COOKIEALERT_2\"}],{\"intermediate\":false}],[1,\"auto_AU_help.dropbox.com_4ad\",0,\"^https?://(www\\\\.)?dropbox\\\\.com/\",1,[],[{\"e\":13}],[{\"v\":13}],[{\"wait\":500},{\"c\":13}],[{\"timeout\":1000,\"check\":\"none\",\"wv\":13}],{}],[1,\"auto_AU_24h-lemans.com_2ab\",0,\"^https?://(www\\\\.)?24h-lemans\\\\.com/\",10,[],[{\"e\":14}],[{\"v\":14}],[{\"c\":14}],[],{}]],\"index\":{\"genericRuleRange\":[0,3],\"frameRuleRange\":[2,4],\"specificRuleRange\":[3,5],\"genericStringEnd\":13,\"frameStringEnd\":14}}}" @@ -153,7 +158,7 @@ class InitMessageHandlerPluginTest { @Test fun whenProcessMessageIfNoSettingsThenDoNotCallEvaluate() { settingsCache = RealAutoconsentSettingsCache() - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) @@ -165,7 +170,7 @@ class InitMessageHandlerPluginTest { @Test fun whenProcessMessageIfCanNotParseSettingsThenDoNotCallEvaluate() { settingsCache.updateSettings("{\"random\": []}") - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) @@ -175,38 +180,38 @@ class InitMessageHandlerPluginTest { } @Test - fun whenProcessMessageWithEmptyObjectsInSettingsResponseSentIsCorrect() { - settingsRepository.userSetting = true + fun whenProcessMessageWithMaxPreferenceThenHeuristicModeIsTier2() { + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.MAX + feature.heuristicAction().setRawStoredState(Toggle.State(enable = true)) settingsCache.updateSettings("{\"disabledCMPs\": [], \"compactRuleList\": {}}") initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) - val shadow = shadowOf(webView) - val result = shadow.lastEvaluatedJavascript - val initResp = jsonToInitResp(result) + val initResp = jsonToInitResp(shadowOf(webView).lastEvaluatedJavascript) assertEquals("optOut", initResp!!.config.autoAction) assertTrue(initResp.config.enablePrehide) assertTrue(initResp.config.enabled) assertTrue(initResp.config.enableHeuristicDetection) + assertEquals("tier2", initResp.config.heuristicMode) assertNotNull(initResp.rules.compact) assertEquals(20, initResp.config.detectRetries) assertEquals("initResp", initResp.type) } @Test - fun whenProcessMessageResponseSentIsCorrect() { - settingsRepository.userSetting = true + fun whenProcessMessageWithDefaultPreferenceThenHeuristicModeIsTier1() { + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT + feature.heuristicAction().setRawStoredState(Toggle.State(enable = true)) settingsCache.updateSettings("{\"disabledCMPs\": [], \"compactRuleList\": {\"v\": 1, \"s\": [], \"r\": []}}") initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) - val shadow = shadowOf(webView) - val result = shadow.lastEvaluatedJavascript - val initResp = jsonToInitResp(result) + val initResp = jsonToInitResp(shadowOf(webView).lastEvaluatedJavascript) assertEquals("optOut", initResp!!.config.autoAction) assertTrue(initResp.config.enablePrehide) assertTrue(initResp.config.enabled) assertTrue(initResp.config.enableHeuristicDetection) + assertEquals("tier1", initResp.config.heuristicMode) assertNotNull(initResp.rules.compact) assertEquals(20, initResp.config.detectRetries) assertEquals("initResp", initResp.type) @@ -215,7 +220,7 @@ class InitMessageHandlerPluginTest { @Test @Ignore("Only valid when firstPopupHandled is being used") fun whenProcessMessageAndPopupHandledResponseSentIsCorrect() { - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.MAX settingsRepository.firstPopupHandled = true settingsCache.updateSettings("{\"disabledCMPs\": [], \"compactRuleList\": {\"v\": 1, \"s\": [], \"r\": []}}") @@ -235,7 +240,7 @@ class InitMessageHandlerPluginTest { @Test fun whenProcessMessageThenOnResultReceivedCalled() { - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) @@ -262,7 +267,7 @@ class InitMessageHandlerPluginTest { @Test fun whenProcessAndAutoconsentIsEnabledThenFireInitPixel() { - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) @@ -318,21 +323,21 @@ class InitMessageHandlerPluginTest { } @Test - fun whenHeuristicActionToggleDisabledThenEnableHeuristicActionIsFalse() { - settingsRepository.userSetting = true + fun whenHeuristicActionToggleDisabledThenHeuristicModeIsOff() { + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.MAX settingsCache.updateSettings("{\"disabledCMPs\": [], \"compactRuleList\": {\"v\": 1, \"s\": [], \"r\": []}}") initHandlerPlugin.process(initHandlerPlugin.supportedTypes.first(), message(), webView, mockCallback) val result = shadowOf(webView).lastEvaluatedJavascript val initResp = jsonToInitResp(result) - assertFalse(initResp!!.config.enableHeuristicAction) + assertEquals("off", initResp!!.config.heuristicMode) } @SuppressLint("DenyListedApi") @Test - fun whenHeuristicActionToggleEnabledThenEnableHeuristicActionIsTrue() { - settingsRepository.userSetting = true + fun whenHeuristicActionToggleEnabledThenHeuristicModeIsTier2() { + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.MAX settingsCache.updateSettings("{\"disabledCMPs\": [], \"compactRuleList\": {\"v\": 1, \"s\": [], \"r\": []}}") feature.heuristicAction().setRawStoredState(Toggle.State(enable = true)) @@ -340,7 +345,7 @@ class InitMessageHandlerPluginTest { val result = shadowOf(webView).lastEvaluatedJavascript val initResp = jsonToInitResp(result) - assertTrue(initResp!!.config.enableHeuristicAction) + assertEquals("tier2", initResp!!.config.heuristicMode) } @Test @@ -420,7 +425,7 @@ class InitMessageHandlerPluginTest { @Test fun whenRuleFilteringDisabledThenUseOriginalRuleset() { - settingsRepository.userSetting = true + settingsRepository.cookiePopUpPreference = CookiePopUpPreference.DEFAULT settingsCache.updateSettings(mockRulesetJson) feature.ruleFiltering().setRawStoredState(Toggle.State(enable = false)) diff --git a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/store/RealAutoconsentSettingsDataStoreTest.kt b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/store/RealAutoconsentSettingsDataStoreTest.kt new file mode 100644 index 000000000000..fa1826131131 --- /dev/null +++ b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/store/RealAutoconsentSettingsDataStoreTest.kt @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2026 DuckDuckGo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.duckduckgo.autoconsent.impl.store + +import android.annotation.SuppressLint +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.duckduckgo.autoconsent.api.CookiePopUpPreference +import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature +import com.duckduckgo.common.test.CoroutineTestRule +import com.duckduckgo.feature.toggles.api.FakeFeatureToggleFactory +import com.duckduckgo.feature.toggles.api.Toggle +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@SuppressLint("DenyListedApi") +class RealAutoconsentSettingsDataStoreTest { + + @get:Rule + val coroutineRule = CoroutineTestRule() + + private val context: Context = ApplicationProvider.getApplicationContext() + private val feature = FakeFeatureToggleFactory.create(AutoconsentFeature::class.java) + + @Before + fun setup() { + context.getSharedPreferences(PREFS_FILENAME, Context.MODE_PRIVATE).edit().clear().commit() + feature.onByDefault().setRawStoredState(Toggle.State(enable = true)) + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) + } + + @Test + fun whenLegacyUserSettingIsFalseThenMigratesToDoNotBlock() = runTest { + preferences().edit().putBoolean(LEGACY_USER_SETTING_KEY, false).commit() + + assertEquals(CookiePopUpPreference.OFF, createDataStore().cookiePopUpPreference) + } + + @Test + fun whenLegacyUserSettingIsTrueThenMigratesToBlockStandard() = runTest { + preferences().edit().putBoolean(LEGACY_USER_SETTING_KEY, true).commit() + + assertEquals(CookiePopUpPreference.DEFAULT, createDataStore().cookiePopUpPreference) + } + + @Test + fun whenNoLegacySettingAndOnByDefaultThenMigratesToBlockStandard() = runTest { + assertEquals(CookiePopUpPreference.DEFAULT, createDataStore().cookiePopUpPreference) + } + + @Test + fun whenNoLegacySettingAndOffByDefaultThenMigratesToDoNotBlock() = runTest { + feature.onByDefault().setRawStoredState(Toggle.State(enable = false)) + + assertEquals(CookiePopUpPreference.OFF, createDataStore().cookiePopUpPreference) + } + + @Test + fun whenReadBeforeRemoteConfigThenPreferenceUpdatesAfterCacheInvalidation() = runTest { + feature.onByDefault().setRawStoredState(Toggle.State(enable = false)) + val dataStore = createDataStore() + + assertEquals(CookiePopUpPreference.OFF, dataStore.cookiePopUpPreference) + assertFalse(preferences().contains(COOKIE_POP_UP_PREFERENCE_KEY)) + + feature.onByDefault().setRawStoredState(Toggle.State(enable = true)) + dataStore.invalidateCache() + + assertEquals(CookiePopUpPreference.DEFAULT, dataStore.cookiePopUpPreference) + assertFalse(preferences().contains(COOKIE_POP_UP_PREFERENCE_KEY)) + } + + @Test + fun whenPreferenceAlreadyStoredThenMigrationIsIdempotent() = runTest { + val dataStore = createDataStore() + dataStore.cookiePopUpPreference = CookiePopUpPreference.MAX + preferences().edit().putBoolean(LEGACY_USER_SETTING_KEY, false).commit() + + assertEquals(CookiePopUpPreference.MAX, createDataStore().cookiePopUpPreference) + } + + @Test + fun whenUserSettingSetToTrueThenLegacySettingIsTrue() { + val dataStore = createDataStore() + dataStore.userSetting = true + + assertTrue(dataStore.userSetting) + } + + @Test + fun whenUserSettingSetToFalseThenLegacySettingIsFalse() { + val dataStore = createDataStore() + dataStore.userSetting = false + + assertFalse(dataStore.userSetting) + } + + private fun preferences() = context.getSharedPreferences(PREFS_FILENAME, Context.MODE_PRIVATE) + + private fun createDataStore(): RealAutoconsentSettingsDataStore { + return RealAutoconsentSettingsDataStore( + context = context, + autoconsentFeature = feature, + appCoroutineScope = coroutineRule.testScope, + dispatcherProvider = coroutineRule.testDispatcherProvider, + ) + } + + companion object { + private const val PREFS_FILENAME = "com.duckduckgo.autoconsent.store.settings" + private const val LEGACY_USER_SETTING_KEY = "AutoconsentUserSetting" + private const val COOKIE_POP_UP_PREFERENCE_KEY = "AutoconsentCookiePopUpPreference" + } +} diff --git a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModelTest.kt b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModelTest.kt index 073f00e62ab1..5cf8fcda813e 100644 --- a/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModelTest.kt +++ b/autoconsent/autoconsent-impl/src/test/java/com/duckduckgo/autoconsent/impl/ui/AutoconsentSettingsViewModelTest.kt @@ -24,8 +24,12 @@ import com.duckduckgo.app.statistics.pixels.Pixel.PixelName import com.duckduckgo.app.statistics.pixels.Pixel.PixelType import com.duckduckgo.autoconsent.api.Autoconsent import com.duckduckgo.autoconsent.api.AutoconsentCallback +import com.duckduckgo.autoconsent.api.CookiePopUpPreference import com.duckduckgo.autoconsent.impl.pixels.AutoConsentPixel +import com.duckduckgo.autoconsent.impl.remoteconfig.AutoconsentFeature import com.duckduckgo.common.test.CoroutineTestRule +import com.duckduckgo.feature.toggles.api.FakeFeatureToggleFactory +import com.duckduckgo.feature.toggles.api.Toggle import kotlinx.coroutines.test.runTest import org.junit.Assert.* import org.junit.Before @@ -38,14 +42,18 @@ class AutoconsentSettingsViewModelTest { @get:Rule var coroutineRule = CoroutineTestRule() - private val autoconsent: Autoconsent = FakeAutoconsent() + private val fakeAutoconsent = FakeAutoconsent() + private val autoconsent: Autoconsent = fakeAutoconsent private val pixel: FakePixel = FakePixel() + private val feature = FakeFeatureToggleFactory.create(AutoconsentFeature::class.java) private lateinit var viewModel: AutoconsentSettingsViewModel @Before fun setup() { pixel.firedPixels.clear() + fakeAutoconsent.preference = CookiePopUpPreference.OFF + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = false)) } @Test @@ -61,7 +69,7 @@ class AutoconsentSettingsViewModelTest { initViewModel() viewModel.viewState.test { - assertFalse(awaitItem().autoconsentEnabled) + assertEquals(CookiePopUpPreference.OFF, awaitItem().selectedPreference) cancelAndIgnoreRemainingEvents() } } @@ -78,16 +86,12 @@ class AutoconsentSettingsViewModelTest { } @Test - fun whenOnUserToggleAutoconsentToTrueThenAutoconsentEnabledIsTrue() = runTest { + fun whenOnUserToggleAutoconsentToTrueThenLegacySettingUpdated() = runTest { initViewModel() - viewModel.viewState.test { - assertFalse(awaitItem().autoconsentEnabled) - viewModel.onUserToggleAutoconsent(true) - assertTrue(autoconsent.isSettingEnabled()) - assertTrue(awaitItem().autoconsentEnabled) - cancelAndIgnoreRemainingEvents() - } + viewModel.onUserToggleAutoconsent(true) + + assertTrue(autoconsent.isSettingEnabled()) } @Test @@ -101,32 +105,80 @@ class AutoconsentSettingsViewModelTest { } @Test - fun whenOnUserToggleAutoconsentToFalseThenAutoconsentEnabledIsFalse() = runTest { + fun whenOnUserToggleAutoconsentToFalseThenAutoconsentOffPixelIsFired() { + initViewModel() + viewModel.onUserToggleAutoconsent(false) + + assertEquals(2, pixel.firedPixels.size) + assertEquals(AutoConsentPixel.SETTINGS_AUTOCONSENT_OFF.pixelName, pixel.firedPixels[1]) + } + + @Test + fun whenOnAutoManageCookiePopUpsToggledOnThenPreferenceSetToDefault() = runTest { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) initViewModel() viewModel.viewState.test { - viewModel.onUserToggleAutoconsent(false) - assertFalse(awaitItem().autoconsentEnabled) + assertEquals(CookiePopUpPreference.OFF, awaitItem().selectedPreference) + viewModel.onAutoManageCookiePopUpsToggled(true) + assertEquals(CookiePopUpPreference.DEFAULT, autoconsent.getCookiePopUpPreference()) + assertEquals(CookiePopUpPreference.DEFAULT, awaitItem().selectedPreference) cancelAndIgnoreRemainingEvents() } } @Test - fun whenOnUserToggleAutoconsentToTrueThenAutoconsentOffPixelIsFired() { + fun whenOnAutoManageCookiePopUpsToggledOffThenPreferenceSetToOff() { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) initViewModel() + viewModel.onAutoManageCookiePopUpsToggled(true) + viewModel.onAutoManageCookiePopUpsToggled(false) - viewModel.onUserToggleAutoconsent(false) + assertEquals(CookiePopUpPreference.OFF, autoconsent.getCookiePopUpPreference()) + assertEquals(CookiePopUpPreference.OFF, viewModel.viewState.value.selectedPreference) + assertFalse(viewModel.viewState.value.popUpsWithoutOptOutsEnabled) + } + + @Test + fun whenOnPopUpsWithoutOptOutsToggledOnThenPreferenceSetToMax() { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) + initViewModel() + viewModel.onAutoManageCookiePopUpsToggled(true) + viewModel.onPopUpsWithoutOptOutsToggled(true) + + assertEquals(CookiePopUpPreference.MAX, autoconsent.getCookiePopUpPreference()) + assertEquals(CookiePopUpPreference.MAX, viewModel.viewState.value.selectedPreference) + } + + @Test + fun whenOnPopUpsWithoutOptOutsToggledOffThenPreferenceSetToDefault() { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) + initViewModel() + viewModel.onAutoManageCookiePopUpsToggled(true) + viewModel.onPopUpsWithoutOptOutsToggled(true) + viewModel.onPopUpsWithoutOptOutsToggled(false) + + assertEquals(CookiePopUpPreference.DEFAULT, autoconsent.getCookiePopUpPreference()) + assertEquals(CookiePopUpPreference.DEFAULT, viewModel.viewState.value.selectedPreference) + } + + @Test + fun whenOnAutoManageCookiePopUpsToggledOnThenAutoconsentOnPixelIsFired() { + feature.cookiePopUpPreferenceSetting().setRawStoredState(Toggle.State(enable = true)) + initViewModel() + + viewModel.onAutoManageCookiePopUpsToggled(true) assertEquals(2, pixel.firedPixels.size) - assertEquals(AutoConsentPixel.SETTINGS_AUTOCONSENT_OFF.pixelName, pixel.firedPixels[1]) + assertEquals(AutoConsentPixel.SETTINGS_AUTOCONSENT_ON.pixelName, pixel.firedPixels[1]) } private fun initViewModel() { - viewModel = AutoconsentSettingsViewModel(autoconsent, pixel) + viewModel = AutoconsentSettingsViewModel(autoconsent, pixel, feature) } internal class FakeAutoconsent : Autoconsent { - var test: Boolean = false + var preference: CookiePopUpPreference = CookiePopUpPreference.OFF override fun injectAutoconsent( webView: WebView, @@ -143,10 +195,16 @@ class AutoconsentSettingsViewModelTest { } override fun changeSetting(setting: Boolean) { - test = setting + preference = if (setting) CookiePopUpPreference.DEFAULT else CookiePopUpPreference.OFF + } + + override fun changeCookiePopUpPreference(preference: CookiePopUpPreference) { + this.preference = preference } - override fun isSettingEnabled(): Boolean = test + override fun getCookiePopUpPreference(): CookiePopUpPreference = preference + + override fun isSettingEnabled(): Boolean = preference != CookiePopUpPreference.OFF override fun isAutoconsentEnabled(): Boolean { return isSettingEnabled() diff --git a/package-lock.json b/package-lock.json index 6d9b5cea9db8..f834379eb1af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "ddg-android", "version": "1.0.0", "dependencies": { - "@duckduckgo/autoconsent": "^14.95.0", + "@duckduckgo/autoconsent": "^16.0.0", "@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#19.0.0", "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#15.9.0", "@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#9.0.0", @@ -47,14 +47,12 @@ } }, "node_modules/@duckduckgo/autoconsent": { - "version": "14.97.0", - "resolved": "https://registry.npmjs.org/@duckduckgo/autoconsent/-/autoconsent-14.97.0.tgz", - "integrity": "sha512-fNgWlM3RIhEMu+cVKgViei5eurenBoYORtRzinoY2aoH+wOKbCSTclCNJU0CXQvvLlt4T3ZjKDfN+XmpCCPwjQ==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@duckduckgo/autoconsent/-/autoconsent-16.0.0.tgz", + "integrity": "sha512-KhNs66HzfH0dfLwtQtE00ZQQfNn7wsxRoouf2W+8nSM0zl15DlPO+uiKMe8kmdHae/CK7OyEbc9FjXtrXQEEvQ==", "license": "MPL-2.0", "dependencies": { - "@ghostery/adblocker": "^2.0.4", - "@ghostery/adblocker-content": "^2.0.4", - "tldts-experimental": "^7.0.4" + "tldts-experimental": "^7.4.3" } }, "node_modules/@duckduckgo/autofill": { @@ -88,45 +86,6 @@ "resolved": "git+ssh://git@github.com/duckduckgo/privacy-reference-tests.git#c2b49fe7ce4a75404c6a79e4dd1053710a9869ee", "license": "Apache-2.0" }, - "node_modules/@ghostery/adblocker": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@ghostery/adblocker/-/adblocker-2.18.1.tgz", - "integrity": "sha512-pWMJqpXpuqIlcF3ZZQ2E7ixnC7xhtYn/bpOn3N69vFrAm4wrZCIbKzz1+xSxKWCmJvDT4fg7rN2R6jQwFXm5BA==", - "license": "MPL-2.0", - "dependencies": { - "@ghostery/adblocker-content": "^2.18.1", - "@ghostery/adblocker-extended-selectors": "^2.18.1", - "@ghostery/url-parser": "^1.3.1", - "@remusao/guess-url-type": "^2.1.0", - "@remusao/small": "^2.1.0", - "@remusao/smaz": "^2.2.0", - "tldts-experimental": "^7.4.3" - } - }, - "node_modules/@ghostery/adblocker-content": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@ghostery/adblocker-content/-/adblocker-content-2.18.1.tgz", - "integrity": "sha512-7OwXvqssrSqceXDMccq1SG2LEp0P899TWv0J52kA4PCjCgdsffdj7wMO98LbiVWEKJ9e00X4V2ZptC4VGYsX/w==", - "license": "MPL-2.0", - "dependencies": { - "@ghostery/adblocker-extended-selectors": "^2.18.1" - } - }, - "node_modules/@ghostery/adblocker-extended-selectors": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@ghostery/adblocker-extended-selectors/-/adblocker-extended-selectors-2.18.1.tgz", - "integrity": "sha512-FruZMMUhdi0KG8GTTS9hs4njeQu1FyrzVtm9p3JKY6GpCNspy3kioP48JU3ASNzSDYZb5Xu8xbwPoSHJ4RQBeg==", - "license": "MPL-2.0" - }, - "node_modules/@ghostery/url-parser": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@ghostery/url-parser/-/url-parser-1.3.1.tgz", - "integrity": "sha512-QKqGi+7aDQ4RcyHyCwgEk6B9vWnsBP4Q7htaN0zPJV3ATqTKEQDtSTb9c/AN586oJUDs24YXKcwFYwNweY/YjQ==", - "license": "MPL-2.0", - "dependencies": { - "tldts-experimental": "^7.0.8" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -177,49 +136,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@remusao/guess-url-type": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@remusao/guess-url-type/-/guess-url-type-2.1.0.tgz", - "integrity": "sha512-zI3dlTUxpjvx2GCxp9nLOSK5yEIqDCpxlAVGwb2Y49RKkS72oeNaxxo+VWS5+XQ5+Mf8Zfp9ZXIlk+G5eoEN8A==", - "license": "MPL-2.0" - }, - "node_modules/@remusao/small": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@remusao/small/-/small-2.1.0.tgz", - "integrity": "sha512-Y1kyjZp7JU7dXdyOdxHVNfoTr1XLZJTyQP36/esZUU/WRWq9XY0PV2HsE3CsIHuaTf4pvgWv2pvzvnZ//UHIJQ==", - "license": "MPL-2.0" - }, - "node_modules/@remusao/smaz": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@remusao/smaz/-/smaz-2.2.0.tgz", - "integrity": "sha512-eSd3Qs0ELP/e7tU1SI5RWXcCn9KjDgvBY+KtWbL4i2QvvHhJOfdIt4v0AA3S5BbLWAr5dCEC7C4LUfogDm6q/Q==", - "license": "MPL-2.0", - "dependencies": { - "@remusao/smaz-compress": "^2.2.0", - "@remusao/smaz-decompress": "^2.2.0" - } - }, - "node_modules/@remusao/smaz-compress": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@remusao/smaz-compress/-/smaz-compress-2.2.0.tgz", - "integrity": "sha512-TXpTPgILRUYOt2rEe0+9PC12xULPvBqeMpmipzB9A7oM4fa9Ztvy9lLYzPTd7tiQEeoNa1pmxihpKfJtsxnM/w==", - "license": "MPL-2.0", - "dependencies": { - "@remusao/trie": "^2.1.0" - } - }, - "node_modules/@remusao/smaz-decompress": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@remusao/smaz-decompress/-/smaz-decompress-2.2.0.tgz", - "integrity": "sha512-ERAPwxPaA0/yg4hkNU7T2S+lnp9jj1sApcQMtOyROvOQyo+Zuh6Hn/oRcXr8mmjlYzyRaC7E6r3mT1nrdHR6pg==", - "license": "MPL-2.0" - }, - "node_modules/@remusao/trie": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@remusao/trie/-/trie-2.1.0.tgz", - "integrity": "sha512-Er3Q8q0/2OcCJPQYJOPLmCuqO0wu7cav3SPtpjlxSbjFi1x+A1pZkkLD6c9q2rGEkGW/tkrRzfrhNMt8VQjzXg==", - "license": "MPL-2.0" - }, "node_modules/@rollup/plugin-json": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", diff --git a/package.json b/package.json index 971637a5276b..ad5315b5787e 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "rollup-plugin-terser": "^7.0.2" }, "dependencies": { - "@duckduckgo/autoconsent": "^14.95.0", + "@duckduckgo/autoconsent": "^16.0.0", "@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#19.0.0", "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#15.9.0", "@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#9.0.0",