@duckduckgo/autoconsent 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.vscode/.idea/.vscode.iml +9 -0
  2. package/.vscode/.idea/modules.xml +8 -0
  3. package/.vscode/.idea/workspace.xml +28 -0
  4. package/.vscode/settings.json +7 -0
  5. package/dist/addon-firefox/background.bundle.js +1 -1
  6. package/dist/addon-firefox/content.bundle.js +1 -1
  7. package/dist/addon-firefox/manifest.json +1 -1
  8. package/dist/addon-firefox/rules.json +821 -48
  9. package/dist/addon-mv3/background.bundle.js +1 -1
  10. package/dist/addon-mv3/content.bundle.js +1 -1
  11. package/dist/addon-mv3/manifest.json +1 -1
  12. package/dist/addon-mv3/rules.json +821 -48
  13. package/dist/autoconsent.cjs.js +1 -1
  14. package/dist/autoconsent.esm.js +1 -1
  15. package/dist/autoconsent.playwright.js +1 -1
  16. package/lib/cmps/all.ts +7 -0
  17. package/lib/cmps/base.ts +37 -24
  18. package/lib/cmps/consentmanager.ts +27 -4
  19. package/lib/cmps/conversant.ts +60 -0
  20. package/lib/cmps/klaro.ts +66 -0
  21. package/lib/cmps/sourcepoint-frame.ts +9 -8
  22. package/lib/cmps/sourcepoint-top.ts +5 -0
  23. package/lib/cmps/uniconsent.ts +70 -0
  24. package/lib/rules.ts +8 -1
  25. package/lib/web.ts +35 -25
  26. package/package.json +1 -1
  27. package/readme.md +29 -0
  28. package/rules/autoconsent/adroll.json +11 -0
  29. package/rules/autoconsent/aws-amazon.json +6 -1
  30. package/rules/autoconsent/axeptio.json +41 -0
  31. package/rules/autoconsent/clickio.json +18 -0
  32. package/rules/autoconsent/complianz-banner.json +13 -0
  33. package/rules/autoconsent/complianz-categories.json +17 -0
  34. package/rules/autoconsent/complianz-notice.json +14 -0
  35. package/rules/autoconsent/complianz-optin.json +20 -0
  36. package/rules/autoconsent/cookie-notice.json +3 -1
  37. package/rules/autoconsent/cookieinformation.json +14 -0
  38. package/rules/autoconsent/dsgvo.json +16 -0
  39. package/rules/autoconsent/eu-cookie-law.json +20 -0
  40. package/rules/autoconsent/ezoic.json +19 -0
  41. package/rules/autoconsent/iubenda.json +23 -0
  42. package/rules/autoconsent/jquery-cookiebar.json +25 -0
  43. package/rules/autoconsent/mediavine.json +20 -0
  44. package/rules/autoconsent/moove.json +28 -0
  45. package/rules/autoconsent/paypal.json +4 -1
  46. package/rules/autoconsent/primebox.json +19 -0
  47. package/rules/autoconsent/sirdata.json +11 -0
  48. package/rules/autoconsent/tarteaucitron.json +18 -0
  49. package/rules/autoconsent/tealium.json +0 -1
  50. package/rules/autoconsent/termly.json +31 -0
  51. package/rules/autoconsent/testcmp.json +4 -1
  52. package/rules/autoconsent/uk-cookie-consent.json +15 -0
  53. package/rules/autoconsent/{usercentrics-1.json → usercentrics-api.json} +2 -2
  54. package/rules/autoconsent/usercentrics-button.json +14 -0
  55. package/rules/autoconsent/vodafone-de.json +5 -5
  56. package/rules/autoconsent/wp-cookie-notice.json +12 -0
  57. package/rules/rules.json +821 -48
  58. package/tests/adroll.spec.ts +15 -0
  59. package/tests/axeptio.spec.ts +9 -0
  60. package/tests/clickio.spec.ts +10 -0
  61. package/tests/complianz-banner.spec.ts +9 -0
  62. package/tests/complianz-categories.spec.ts +14 -0
  63. package/tests/{cookieconsent.spec.ts → complianz-notice.spec.ts} +1 -2
  64. package/tests/complianz-optin.spec.ts +6 -0
  65. package/tests/consentmanager.spec.ts +2 -1
  66. package/tests/conversant.spec.ts +10 -0
  67. package/tests/{cookienotice.spec.ts → cookie-notice.spec.ts} +0 -0
  68. package/tests/cookieinformation.spec.ts +10 -0
  69. package/tests/dsgvo.spec.ts +6 -0
  70. package/tests/eu-cookie-law.spec.ts +6 -0
  71. package/tests/ezoic.spec.ts +8 -0
  72. package/tests/iubenda.spec.ts +8 -0
  73. package/tests/jquery-cookiebar.spec.ts +6 -0
  74. package/tests/klaro.spec.ts +6 -2
  75. package/tests/mediavine.spec.ts +8 -0
  76. package/tests/moove.spec.ts +13 -0
  77. package/tests/onetrust.spec.ts +2 -2
  78. package/tests/primebox.spec.ts +7 -0
  79. package/tests/sirdata.spec.ts +8 -0
  80. package/tests/tarteaucitron.spec.ts +9 -0
  81. package/tests/tealium.spec.ts +1 -1
  82. package/tests/termly.spec.ts +12 -0
  83. package/tests/trustarc.spec.ts +1 -9
  84. package/tests/uk-cookie-consent.spec.ts +7 -0
  85. package/tests/uniconsent.spec.ts +12 -0
  86. package/tests/{usercentrics-1.spec.ts → usercentrics-api.spec.ts} +3 -2
  87. package/tests/usercentrics-button.spec.ts +8 -0
  88. package/tests/wp-cookie-notice.spec.ts +8 -0
  89. package/dist/autoconsent.standalone.js +0 -1
  90. package/rules/autoconsent/cookieconsent.json +0 -8
  91. package/rules/autoconsent/destatis-de.json +0 -8
  92. package/rules/autoconsent/klaro.json +0 -10
  93. package/tests/destatis.spec.ts +0 -7
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{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)}}const t={pending:new Map,sendContentMessage:null};function n(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 o(e,t,n="display"){const o="opacity"===n?"opacity: 0":"display: none",s=`${t.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return e instanceof HTMLStyleElement&&(e.innerText+=s,t.length>0)}async function s(e,t,n){const o=await e();return!o&&t>0?new Promise((o=>{setTimeout((async()=>{o(s(e,t-1,n))}),n)})):Promise.resolve(o)}function i(n){return function(n){let o;o=crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString(),t.sendContentMessage({type:"eval",id:o,code:n});const s=new e(o);return t.pending.set(s.id,s),s.promise}(n).catch((e=>!1))}function r(e,t=!1){const n=document.querySelectorAll(e);return n.length>0&&(t?n.forEach((e=>e.click())):n[0].click()),n.length>0}function a(e){return null!==document.querySelector(e)}function c(e,t){const n=document.querySelectorAll(e),o=new Array(n.length);return n.forEach(((e,t)=>{o[t]=function(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}(e)})),0!==o.length&&("any"===t?o.some((e=>e)):"none"===t?o.every((e=>!e)):o.every((e=>e)))}function u(e,t=1e4){return s((()=>null!==document.querySelector(e)),Math.ceil(t/200),200)}function l(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}function d(){const e=n("autoconsent-prehide");return e&&e.remove(),!!e}const p={main:!0,frame:!1,url:""};class h{constructor(e){this.runContext=p,this.name=e}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}checkRunContext(){const e={...p,...this.runContext},t=window.top===window;return!(t&&!e.main)&&(!(!t&&!e.frame)&&!(e.url&&!window.location.href.startsWith(e.url)))}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 function m(e){const t=[];if(e.exists&&t.push(a(e.exists)),e.visible&&t.push(c(e.visible,e.check)),e.eval){const n=i(e.eval);t.push(n)}var d,p;if(e.waitFor&&t.push(u(e.waitFor,e.timeout)),e.waitForVisible&&t.push(function(e,t=1e4,n="any"){return s((()=>c(e,n)),Math.ceil(t/200),200)}(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(r(e.click,e.all)),e.waitForThenClick&&t.push(async function(e,t=1e4,n=!1){return await u(e,t),r(e,n)}(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(l(e.wait)),e.hide&&t.push((d=e.hide,p=e.method,o(n(),d,p))),0===t.length)return!1;return(await Promise.all(t)).reduce(((e,t)=>e&&t),!0)}class f extends h{constructor(e){super(e.name),this.config=e,this.runContext=e.runContext||p}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get prehideSelectors(){return this.config.prehideSelectors}async _runRulesParallel(e){const t=e.map((e=>m(e)));return(await Promise.all(t)).every((e=>!!e))}async _runRulesSequentially(e){for(const t of e){if(!await m(t)&&!t.optional)return!1}return!0}async detectCmp(){return!!this.config.detectCmp&&this._runRulesParallel(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&this._runRulesParallel(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&this._runRulesSequentially(this.config.optOut)}async optIn(){return!!this.config.optIn&&this._runRulesSequentially(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&this._runRulesSequentially(this.config.openCmp)}async test(){return this.hasSelfTest?this._runRulesSequentially(this.config.test):super.test()}}function w(e){return new f(e)}const y=[new class extends h{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}async detectCmp(){const e=a("#truste-show-consent,#truste-consent-track");return e&&(this._shortcutButton=document.querySelector("#truste-consent-required")),e}async detectPopup(){return c("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){r("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(o(n(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),r("#truste-show-consent"),setTimeout((()=>{n().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,r("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends h{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,url:"https://consent-pref.trustarc.com/?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return!0}async detectPopup(){return c("#defaultpreferencemanager","any")&&c(".mainContent","any")}async navigateToSettings(){return await s((async()=>a(".shp")||c(".advance","any")||a(".switch span:first-child")),10,500),a(".shp")&&r(".shp"),await u(".prefPanel",5e3),c(".advance","any")&&r(".advance"),await s((()=>c(".switch span:first-child","any")),5,1e3)}async optOut(){return await s((()=>"complete"===document.readyState),20,100),await u(".mainContent[aria-hidden=false]",5e3),!!r(".rejectAll")||(a(".prefPanel")&&await u('.prefPanel[style="visibility: visible;"]',3e3),r("#catDetails0")?(r(".submit"),!0):(r(".required")||(await this.navigateToSettings(),r(".switch span:nth-child(1):not(.active)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")}))),!0))}async optIn(){return await this.navigateToSettings(),r(".switch span:nth-child(2)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")})),!0}},new class extends h{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return a("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return r(".cookie-alert-extended-detail-link")?(await u(".cookie-alert-configuration",2e3),r(".cookie-alert-configuration-input:checked",!0),r(".cookie-alert-extended-button-secondary"),!0):a("#dtcookie-container")?r(".h-dtcookie-decline"):(r(".cookiebot__button--settings")||r("#CybotCookiebotDialogBodyButtonDecline")||(r(".cookiebanner__link--details"),r('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),r("#CybotCookiebotDialogBodyButtonDecline"),r("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),a("#CybotCookiebotDialogBodyButtonAcceptSelected")?r("#CybotCookiebotDialogBodyButtonAcceptSelected"):r("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await i("window.CookieConsent.hasResponse !== true")&&(await i("window.Cookiebot.dialog.submitConsent()"),await l(500)),a("#cb-confirmedSettings")&&await i("endCookieProcess()")),!0)}async optIn(){return a("#dtcookie-container")?r(".h-dtcookie-accept"):(r(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),r("#CybotCookiebotDialogBodyLevelButtonAccept"),r("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return i("window.CookieConsent.declined === true")}},new class extends h{constructor(){super("Sourcepoint-top"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay"],this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!0}async detectCmp(){return a("div[id^='sp_message_container_']")}async detectPopup(){return c("div[id^='sp_message_container_']","all")}async optIn(){return!0}async optOut(){return!0}async test(){return await i("__tcfapi('getTCData', 2, r => window.__rcsResult = r)"),await i("Object.values(window.__rcsResult.purpose.consents).every(c => !c)")}},new class extends h{constructor(){super("Sourcepoint-frame"),this.ccpaMode=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaMode=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname)&&e.searchParams.has("message_id")&&e.searchParams.has("requestUUID")}async detectPopup(){return!0}async optIn(){return await u(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!r(".sp_choice_type_11")||!!r(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===new URL(location.href).pathname}async optOut(){if(!this.isManagerOpen()){if(!await u("button.sp_choice_type_12,button.sp_choice_type_13"))return!1;if(!a("button.sp_choice_type_12"))return r("button.sp_choice_type_13");r("button.sp_choice_type_12"),await s((()=>"/privacy-manager/index.html"===location.pathname),200,100)}await u(".type-modal",2e4);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",n=await Promise.race([u(e,2e3).then((e=>e?0:-1)),u(t,2e3).then((e=>e?1:-1)),u(".pm-features",2e3).then((e=>e?2:-1))]);if(0===n)return await l(1e3),r(e);if(1===n)return r(t);2===n&&(await u(".pm-features",1e4),r(".checked > span",!0),r(".chevron"))}catch(e){}return r(".sp_choice_type_SAVE_AND_EXIT")}},new class extends h{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"]}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#cmpbox")}async detectPopup(){return c("#cmpbox .cmpmore","any")}async optOut(){return!!r(".cmpboxbtnno")||(a(".cmpwelcomeprpsbtn")?(r(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),r(".cmpboxbtnsave"),!0):(r(".cmpboxbtncustom"),await u(".cmptblbox",2e3),r(".cmptdchoice > a[aria-checked=true]",!0),r(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return r(".cmpboxbtnyes")}},new class extends h{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#_evidon_banner")}async detectPopup(){return c("#_evidon_banner","any")}async optOut(){return r("#_evidon-decline-button")||(o(n(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),r("#_evidon-option-button"),await u("#evidon-prefdiag-overlay",5e3),r("#evidon-prefdiag-decline")),!0}async optIn(){return r("#_evidon-accept-button")}},new class extends h{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#onetrust-banner-sdk,.optanon-alert-box-wrapper")}async detectPopup(){return c("#onetrust-banner-sdk,.optanon-alert-box-wrapper","all")}async optOut(){return a("#onetrust-pc-btn-handler")?r("#onetrust-pc-btn-handler"):r(".ot-sdk-show-settings,button.js-cookie-settings"),await u("#onetrust-consent-sdk",2e3),await l(1e3),r("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await u(".save-preference-btn-handler,.js-consent-save",2e3),r(".save-preference-btn-handler,.js-consent-save"),await s((()=>c("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return r("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await i("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}}];class g{static setBase(e){g.base=e}static findElement(e,t=null,n=!1){let o=null;return o=null!=t?Array.from(t.querySelectorAll(e.selector)):null!=g.base?Array.from(g.base.querySelectorAll(e.selector)):Array.from(document.querySelectorAll(e.selector)),null!=e.textFilter&&(o=o.filter((t=>{let n=t.textContent.toLowerCase();if(Array.isArray(e.textFilter)){let t=!1;for(let o of e.textFilter)if(-1!==n.indexOf(o.toLowerCase())){t=!0;break}return t}if(null!=e.textFilter)return-1!==n.indexOf(e.textFilter.toLowerCase())}))),null!=e.styleFilters&&(o=o.filter((t=>{let n=window.getComputedStyle(t),o=!0;for(let t of e.styleFilters){let e=n[t.option];o=t.negated?o&&e!==t.value:o&&e===t.value}return o}))),null!=e.displayFilter&&(o=o.filter((t=>e.displayFilter?0!==t.offsetHeight:0===t.offsetHeight))),null!=e.iframeFilter&&(o=o.filter((t=>e.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=e.childFilter&&(o=o.filter((t=>{let n=g.base;g.setBase(t);let o=g.find(e.childFilter);return g.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,e,t),o[0])}static find(e,t=!1){let n=[];if(null!=e.parent){let o=g.findElement(e.parent,null,t);if(null!=o){if(o instanceof Array)return o.forEach((o=>{let s=g.findElement(e.target,o,t);s instanceof Array?s.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:s})})),n;{let s=g.findElement(e.target,o,t);s instanceof Array?s.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:s})}}}else{let o=g.findElement(e.target,null,t);o instanceof Array?o.forEach((e=>{n.push({parent:null,target:e})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),t?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function C(e){const t=g.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function b(e,t){switch(e.type){case"click":return async function(e){const t=g.find(e);null!=t.target&&t.target.click();return _(0)}(e);case"list":return async function(e,t){for(let n of e.actions)await b(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){C(n.matcher)!==e&&await b(n.toggleAction)}else e?await b(n.trueAction):await b(n.falseAction)}}(e,t);case"ifcss":return async function(e,t){g.find(e).target?e.falseAction&&await b(e.falseAction,t):e.trueAction&&await b(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 i=g.find(e);(e.negated&&i.target||!e.negated&&!i.target)&&n>0?(n-=1,setTimeout(s,o)):t()};s()}))}(e);case"foreach":return async function(e,t){const n=g.find(e,!0),o=g.base;for(const o of n)o.target&&(g.setBase(o.target),await b(e.action,t));g.setBase(o)}(e,t);case"hide":return async function(e){const t=g.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=g.find(e),n=g.find(e.dragTarget);if(t.target){let e=t.target.getBoundingClientRect(),o=n.target.getBoundingClientRect(),s=o.top-e.top,i=o.left-e.left;"y"===this.config.axis.toLowerCase()&&(i=0),"x"===this.config.axis.toLowerCase()&&(s=0);let r=window.screenX+e.left+e.width/2,a=window.screenY+e.top+e.height/2,c=e.left+e.width/2,u=e.top+e.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,a,c,u,!1,!1,!1,!1,0,t.target);let d=document.createEvent("MouseEvents");d.initMouseEvent("mousemove",!0,!0,window,0,r+i,a+s,c+i,u+s,!1,!1,!1,!1,0,t.target);let p=document.createEvent("MouseEvents");p.initMouseEvent("mouseup",!0,!0,window,0,r+i,a+s,c+i,u+s,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(l),await this.waitTimeout(10),t.target.dispatchEvent(d),await this.waitTimeout(10),t.target.dispatchEvent(p)}}(e);case"close":return async function(e){window.close()}();case"wait":return async function(e){await _(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"Unknown action type: "+e.type}}g.base=null;function _(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}class v{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=p,t.methods.forEach((e=>{e.action&&this.methods.set(e.name,e.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((e=>C(e.presentMatcher))).some((e=>!!e))}async detectPopup(){return this.config.detectors.map((e=>C(e.showingMatcher))).some((e=>!!e))}async executeAction(e,t){return!this.methods.has(e)||b(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}}exports.createAutoCMP=w,exports.default=class{constructor(e,n=null,o=null){if(this.rules=[],this.foundCmp=null,t.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...y],n)this.initialize(n,o);else{o&&this.parseRules(o);e({type:"init",url:window.location.href})}}initialize(e,t){if(this.config=e,e.enabled){if(t&&this.parseRules(t),e.disabledCmps?.length>0&&this.disableCMPs(e.disabledCmps),e.enablePrehide)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()}}parseRules(e){Object.keys(e.consentomatic).forEach((t=>{this.addConsentomaticCMP(t,e.consentomatic[t])})),e.autoconsent.forEach((e=>{this.addCMP(e)}))}addCMP(e){this.rules.push(w(e))}disableCMPs(e){this.rules=this.rules.filter((t=>!e.includes(t.name)))}addConsentomaticCMP(e,t){this.rules.push(new v(`com_${e}`,t))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){const e=await this.findCmp(this.config.detectRetries);if(e){this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:e.name});return await this.waitForPopup(e)?(this.foundCmp=e,this.sendContentMessage({type:"popupFound",cmp:e.name,url:location.href}),"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn()):(this.config.enablePrehide&&d(),!1)}return this.config.enablePrehide&&d(),!1}async findCmp(e){let t=null;const n=[];for(const e of this.rules)try{if(!e.checkRunContext())continue;await e.detectCmp()&&(n.push(e),t||(t=e))}catch(e){}if(n.length>1){const e={msg:"Found multiple CMPs, check the detection rules.",cmps:n.map((e=>e.name))};this.sendContentMessage({type:"autoconsentError",details:e})}return!t&&e>0?new Promise((t=>{setTimeout((async()=>{const n=this.findCmp(e-1);t(n)}),500)})):t}async doOptOut(){let e;return e=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doOptIn(){let e;return e=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:!1,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doSelfTest(){let e;return e=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,url:location.href}),e}async waitForPopup(e,t=5,n=500){const o=await e.detectPopup();return!o&&t>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(e,t-1,n))),n))):o}prehideElements(){return function(e){return o(n("autoconsent-prehide"),e,"opacity")}(this.rules.reduce(((e,t)=>t.prehideSelectors?[...e,...t.prehideSelectors]:e),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]))}async receiveMessageCallback(e){switch(e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,n){const o=t.pending.get(e);o?(t.pending.delete(e),o.timer&&window.clearTimeout(o.timer),o.resolve(n)):console.warn("no eval #",e)}(e.id,e.result)}}},exports.rules=y;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{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)}}const t={pending:new Map,sendContentMessage:null};function n(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 o(e,t,n="display"){const o="opacity"===n?"opacity: 0":"display: none",i=`${t.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return e instanceof HTMLStyleElement&&(e.innerText+=i,t.length>0)}async function i(e,t,n){const o=await e();return!o&&t>0?new Promise((o=>{setTimeout((async()=>{o(i(e,t-1,n))}),n)})):Promise.resolve(o)}function s(n){return function(n){let o;o=crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString(),t.sendContentMessage({type:"eval",id:o,code:n});const i=new e(o);return t.pending.set(i.id,i),i.promise}(n).catch((e=>!1))}function r(e,t=!1){const n=document.querySelectorAll(e);return n.length>0&&(t?n.forEach((e=>e.click())):n[0].click()),n.length>0}function a(e){return null!==document.querySelector(e)}function c(e,t){const n=document.querySelectorAll(e),o=new Array(n.length);return n.forEach(((e,t)=>{o[t]=function(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}(e)})),0!==o.length&&("any"===t?o.some((e=>e)):"none"===t?o.every((e=>!e)):o.every((e=>e)))}function u(e,t=1e4){return i((()=>null!==document.querySelector(e)),Math.ceil(t/200),200)}async function l(e,t=1e4,n=!1){return await u(e,t),r(e,n)}function p(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}function d(){const e=n("autoconsent-prehide");return e&&e.remove(),!!e}const h={main:!0,frame:!1,url:""};class m{constructor(e){this.runContext=h,this.name=e}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}checkRunContext(){const e={...h,...this.runContext},t=window.top===window;return!(t&&!e.main)&&(!(!t&&!e.frame)&&!(e.url&&!window.location.href.startsWith(e.url)))}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 function f(e){const t=[];if(e.exists&&t.push(a(e.exists)),e.visible&&t.push(c(e.visible,e.check)),e.eval){const n=s(e.eval);t.push(n)}var d,h;if(e.waitFor&&t.push(u(e.waitFor,e.timeout)),e.waitForVisible&&t.push(function(e,t=1e4,n="any"){return i((()=>c(e,n)),Math.ceil(t/200),200)}(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(r(e.click,e.all)),e.waitForThenClick&&t.push(l(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(p(e.wait)),e.hide&&t.push((d=e.hide,h=e.method,o(n(),d,h))),e.if){if(!e.if.exists&&!e.if.visible)return console.error("invalid conditional rule",e.if),!1;await f(e.if)?t.push(y(e.then)):e.else&&t.push(y(e.else))}if(0===t.length)return!1;return(await Promise.all(t)).reduce(((e,t)=>e&&t),!0)}async function y(e){for(const t of e){if(!await f(t)&&!t.optional)return!1}return!0}class w extends m{constructor(e){super(e.name),this.config=e,this.runContext=e.runContext||h}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get prehideSelectors(){return this.config.prehideSelectors}async detectCmp(){return!!this.config.detectCmp&&async function(e){const t=e.map((e=>f(e)));return(await Promise.all(t)).every((e=>!!e))}(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&y(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&y(this.config.optOut)}async optIn(){return!!this.config.optIn&&y(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&y(this.config.openCmp)}async test(){return this.hasSelfTest?y(this.config.test):super.test()}}function g(e){return new w(e)}const b=[new class extends m{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}async detectCmp(){const e=a("#truste-show-consent,#truste-consent-track");return e&&(this._shortcutButton=document.querySelector("#truste-consent-required")),e}async detectPopup(){return c("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){r("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(o(n(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),r("#truste-show-consent"),setTimeout((()=>{n().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,r("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends m{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,url:"https://consent-pref.trustarc.com/?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return!0}async detectPopup(){return c("#defaultpreferencemanager","any")&&c(".mainContent","any")}async navigateToSettings(){return await i((async()=>a(".shp")||c(".advance","any")||a(".switch span:first-child")),10,500),a(".shp")&&r(".shp"),await u(".prefPanel",5e3),c(".advance","any")&&r(".advance"),await i((()=>c(".switch span:first-child","any")),5,1e3)}async optOut(){return await i((()=>"complete"===document.readyState),20,100),await u(".mainContent[aria-hidden=false]",5e3),!!r(".rejectAll")||(a(".prefPanel")&&await u('.prefPanel[style="visibility: visible;"]',3e3),r("#catDetails0")?(r(".submit"),!0):(r(".required")||(await this.navigateToSettings(),r(".switch span:nth-child(1):not(.active)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")}))),!0))}async optIn(){return await this.navigateToSettings(),r(".switch span:nth-child(2)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")})),!0}},new class extends m{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return a("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return r(".cookie-alert-extended-detail-link")?(await u(".cookie-alert-configuration",2e3),r(".cookie-alert-configuration-input:checked",!0),r(".cookie-alert-extended-button-secondary"),!0):a("#dtcookie-container")?r(".h-dtcookie-decline"):(r(".cookiebot__button--settings")||r("#CybotCookiebotDialogBodyButtonDecline")||(r(".cookiebanner__link--details"),r('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),r("#CybotCookiebotDialogBodyButtonDecline"),r("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),a("#CybotCookiebotDialogBodyButtonAcceptSelected")?r("#CybotCookiebotDialogBodyButtonAcceptSelected"):r("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await s("window.CookieConsent.hasResponse !== true")&&(await s("window.Cookiebot.dialog.submitConsent()"),await p(500)),a("#cb-confirmedSettings")&&await s("endCookieProcess()")),!0)}async optIn(){return a("#dtcookie-container")?r(".h-dtcookie-accept"):(r(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),r("#CybotCookiebotDialogBodyLevelButtonAccept"),r("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return s("window.CookieConsent.declined === true")}},new class extends m{constructor(){super("Sourcepoint-top"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay"],this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!0}async detectCmp(){return a("div[id^='sp_message_container_']")}async detectPopup(){return c("div[id^='sp_message_container_']","all")}async optIn(){return!0}async optOut(){const e=document.querySelector(".sp-message-open");return e&&e.classList.remove("sp-message-open"),!0}async test(){return await s("__tcfapi('getTCData', 2, r => window.__rcsResult = r)"),await s("Object.values(window.__rcsResult.purpose.consents).every(c => !c)")}},new class extends m{constructor(){super("Sourcepoint-frame"),this.ccpaMode=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaMode=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname)&&(e.searchParams.has("message_id")||e.searchParams.has("requestUUID")||e.searchParams.has("consentUUID"))}async detectPopup(){return!0}async optIn(){return await u(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!r(".sp_choice_type_11")||!!r(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===new URL(location.href).pathname}async optOut(){if(!this.isManagerOpen()){if(!await u(".sp_choice_type_12,.sp_choice_type_13"))return!1;if(!a(".sp_choice_type_12"))return r(".sp_choice_type_13");r(".sp_choice_type_12"),await i((()=>"/privacy-manager/index.html"===location.pathname),200,100)}await u(".type-modal",2e4);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",n=await Promise.race([u(e,2e3).then((e=>e?0:-1)),u(t,2e3).then((e=>e?1:-1)),u(".pm-features",2e3).then((e=>e?2:-1))]);if(0===n)return await p(1e3),r(e);1===n?r(t):2===n&&(await u(".pm-features",1e4),r(".checked > span",!0),r(".chevron"))}catch(e){}return r(".sp_choice_type_SAVE_AND_EXIT"),!0}},new class extends m{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}async detectCmp(){return this.apiAvailable=await s('window.__cmp && typeof __cmp("getCMPData") === "object"'),!!this.apiAvailable||a("#cmpbox")}async detectPopup(){return this.apiAvailable?await s("!__cmp('consentStatus').userChoiceExists"):c("#cmpbox .cmpmore","any")}async optOut(){return await p(500),this.apiAvailable?await s("__cmp('setConsent', 0)"):!!r(".cmpboxbtnno")||(a(".cmpwelcomeprpsbtn")?(r(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),r(".cmpboxbtnsave"),!0):(r(".cmpboxbtncustom"),await u(".cmptblbox",2e3),r(".cmptdchoice > a[aria-checked=true]",!0),r(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return this.apiAvailable?await s("__cmp('setConsent', 1)"):r(".cmpboxbtnyes")}async test(){if(this.apiAvailable)return await s("__cmp('consentStatus').userChoiceExists")}},new class extends m{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#_evidon_banner")}async detectPopup(){return c("#_evidon_banner","any")}async optOut(){return r("#_evidon-decline-button")||(o(n(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),r("#_evidon-option-button"),await u("#evidon-prefdiag-overlay",5e3),r("#evidon-prefdiag-decline")),!0}async optIn(){return r("#_evidon-accept-button")}},new class extends m{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#onetrust-banner-sdk,.optanon-alert-box-wrapper")}async detectPopup(){return c("#onetrust-banner-sdk,.optanon-alert-box-wrapper","all")}async optOut(){return a("#onetrust-pc-btn-handler")?r("#onetrust-pc-btn-handler"):r(".ot-sdk-show-settings,button.js-cookie-settings"),await u("#onetrust-consent-sdk",2e3),await p(1e3),r("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await u(".save-preference-btn-handler,.js-consent-save",2e3),r(".save-preference-btn-handler,.js-consent-save"),await i((()=>c("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return r("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await s("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}},new class extends m{constructor(){super("Klaro"),this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):a(".klaro > .cookie-notice")}async detectPopup(){return c(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!r(".klaro .cn-decline")||(this.settingsOpen||(r(".klaro .cn-learn-more"),await u(".klaro > .cookie-modal",2e3),this.settingsOpen=!0),!!r(".klaro .cn-decline")||(r(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)",!0),r(".cm-btn-accept")))}async optIn(){return!!r(".klaro .cm-btn-accept-all")||(this.settingsOpen?(r(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),r(".cm-btn-accept")):r(".klaro .cookie-notice .cm-btn-success"))}async test(){return await s("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])")}},new class extends m{constructor(){super("Uniconsent")}get prehideSelectors(){return[".unic"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".unic .unic-box,.unic .unic-bar")}async detectPopup(){return c(".unic .unic-box,.unic .unic-bar","any")}async optOut(){if(await u(".unic button",1e3),document.querySelectorAll(".unic button").forEach((e=>{const t=e.textContent;(t.includes("Manage Options")||t.includes("Optionen verwalten"))&&e.click()})),await u(".unic input[type=checkbox]",1e3)){await u(".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(),!0}}return!1}async optIn(){return l(".unic #unic-agree")}async test(){await p(1e3);return!a(".unic .unic-box,.unic .unic-bar")}},new class extends m{constructor(){super("Conversant"),this.prehideSelectors=[".cmp-root"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".cmp-root .cmp-receptacle")}async detectPopup(){return c(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await l(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await u(".cmp-view-tab-tabs"))return!1;await l(".cmp-view-tab-tabs > :first-child"),await l(".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 i((()=>!!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 r(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return l(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}}];class C{static setBase(e){C.base=e}static findElement(e,t=null,n=!1){let o=null;return o=null!=t?Array.from(t.querySelectorAll(e.selector)):null!=C.base?Array.from(C.base.querySelectorAll(e.selector)):Array.from(document.querySelectorAll(e.selector)),null!=e.textFilter&&(o=o.filter((t=>{let n=t.textContent.toLowerCase();if(Array.isArray(e.textFilter)){let t=!1;for(let o of e.textFilter)if(-1!==n.indexOf(o.toLowerCase())){t=!0;break}return t}if(null!=e.textFilter)return-1!==n.indexOf(e.textFilter.toLowerCase())}))),null!=e.styleFilters&&(o=o.filter((t=>{let n=window.getComputedStyle(t),o=!0;for(let t of e.styleFilters){let e=n[t.option];o=t.negated?o&&e!==t.value:o&&e===t.value}return o}))),null!=e.displayFilter&&(o=o.filter((t=>e.displayFilter?0!==t.offsetHeight:0===t.offsetHeight))),null!=e.iframeFilter&&(o=o.filter((t=>e.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=e.childFilter&&(o=o.filter((t=>{let n=C.base;C.setBase(t);let o=C.find(e.childFilter);return C.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,e,t),o[0])}static find(e,t=!1){let n=[];if(null!=e.parent){let o=C.findElement(e.parent,null,t);if(null!=o){if(o instanceof Array)return o.forEach((o=>{let i=C.findElement(e.target,o,t);i instanceof Array?i.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:i})})),n;{let i=C.findElement(e.target,o,t);i instanceof Array?i.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:i})}}}else{let o=C.findElement(e.target,null,t);o instanceof Array?o.forEach((e=>{n.push({parent:null,target:e})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),t?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function v(e){const t=C.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function k(e,t){switch(e.type){case"click":return async function(e){const t=C.find(e);null!=t.target&&t.target.click();return _(0)}(e);case"list":return async function(e,t){for(let n of e.actions)await k(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){v(n.matcher)!==e&&await k(n.toggleAction)}else e?await k(n.trueAction):await k(n.falseAction)}}(e,t);case"ifcss":return async function(e,t){C.find(e).target?e.falseAction&&await k(e.falseAction,t):e.trueAction&&await k(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,i=()=>{const s=C.find(e);(e.negated&&s.target||!e.negated&&!s.target)&&n>0?(n-=1,setTimeout(i,o)):t()};i()}))}(e);case"foreach":return async function(e,t){const n=C.find(e,!0),o=C.base;for(const o of n)o.target&&(C.setBase(o.target),await k(e.action,t));C.setBase(o)}(e,t);case"hide":return async function(e){const t=C.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=C.find(e),n=C.find(e.dragTarget);if(t.target){let e=t.target.getBoundingClientRect(),o=n.target.getBoundingClientRect(),i=o.top-e.top,s=o.left-e.left;"y"===this.config.axis.toLowerCase()&&(s=0),"x"===this.config.axis.toLowerCase()&&(i=0);let r=window.screenX+e.left+e.width/2,a=window.screenY+e.top+e.height/2,c=e.left+e.width/2,u=e.top+e.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,a,c,u,!1,!1,!1,!1,0,t.target);let p=document.createEvent("MouseEvents");p.initMouseEvent("mousemove",!0,!0,window,0,r+s,a+i,c+s,u+i,!1,!1,!1,!1,0,t.target);let d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,r+s,a+i,c+s,u+i,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(l),await this.waitTimeout(10),t.target.dispatchEvent(p),await this.waitTimeout(10),t.target.dispatchEvent(d)}}(e);case"close":return async function(e){window.close()}();case"wait":return async function(e){await _(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"Unknown action type: "+e.type}}C.base=null;function _(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}class x{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=h,t.methods.forEach((e=>{e.action&&this.methods.set(e.name,e.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((e=>v(e.presentMatcher))).some((e=>!!e))}async detectPopup(){return this.config.detectors.map((e=>v(e.showingMatcher))).some((e=>!!e))}async executeAction(e,t){return!this.methods.has(e)||k(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}}exports.createAutoCMP=g,exports.default=class{constructor(e,n=null,o=null){if(this.rules=[],this.foundCmp=null,t.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...b],n)this.initialize(n,o);else{o&&this.parseRules(o);e({type:"init",url:window.location.href})}}initialize(e,t){if(this.config=e,e.enabled){if(t&&this.parseRules(t),e.disabledCmps?.length>0&&this.disableCMPs(e.disabledCmps),e.enablePrehide)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()}}parseRules(e){Object.keys(e.consentomatic).forEach((t=>{this.addConsentomaticCMP(t,e.consentomatic[t])})),e.autoconsent.forEach((e=>{this.addCMP(e)}))}addCMP(e){this.rules.push(g(e))}disableCMPs(e){this.rules=this.rules.filter((t=>!e.includes(t.name)))}addConsentomaticCMP(e,t){this.rules.push(new x(`com_${e}`,t))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){const e=await this.findCmp(this.config.detectRetries);if(e.length>0){const t=[];for(const n of e)this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:n.name}),t.push(this.waitForPopup(n).then((e=>e?(this.foundCmp||(this.foundCmp=n),this.sendContentMessage({type:"popupFound",cmp:n.name,url:location.href}),!0):Promise.reject(`${n.name} popup not found`))));return await Promise.any(t).catch((()=>!1))?"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn():(this.config.enablePrehide&&d(),!1)}return this.config.enablePrehide&&d(),!1}async findCmp(e){const t=[];for(const e of this.rules)try{if(!e.checkRunContext())continue;await e.detectCmp()&&t.push(e)}catch(e){}if(t.length>1){const e={msg:"Found multiple CMPs, check the detection rules.",cmps:t.map((e=>e.name))};this.sendContentMessage({type:"autoconsentError",details:e})}return 0===t.length&&e>0?new Promise((t=>{setTimeout((async()=>{const n=this.findCmp(e-1);t(n)}),500)})):t}async doOptOut(){let e;return e=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doOptIn(){let e;return e=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:!1,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doSelfTest(){let e;return e=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,url:location.href}),e}async waitForPopup(e,t=5,n=500){const o=await e.detectPopup();return!o&&t>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(e,t-1,n))),n))):o}prehideElements(){return function(e){return o(n("autoconsent-prehide"),e,"opacity")}(this.rules.reduce(((e,t)=>t.prehideSelectors?[...e,...t.prehideSelectors]:e),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]))}async receiveMessageCallback(e){switch(e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,n){const o=t.pending.get(e);o?(t.pending.delete(e),o.timer&&window.clearTimeout(o.timer),o.resolve(n)):console.warn("no eval #",e)}(e.id,e.result)}}},exports.rules=b;
@@ -1 +1 @@
1
- class e{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)}}const t={pending:new Map,sendContentMessage:null};function n(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 o(e,t,n="display"){const o="opacity"===n?"opacity: 0":"display: none",s=`${t.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return e instanceof HTMLStyleElement&&(e.innerText+=s,t.length>0)}async function s(e,t,n){const o=await e();return!o&&t>0?new Promise((o=>{setTimeout((async()=>{o(s(e,t-1,n))}),n)})):Promise.resolve(o)}function i(n){return function(n){let o;o=crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString(),t.sendContentMessage({type:"eval",id:o,code:n});const s=new e(o);return t.pending.set(s.id,s),s.promise}(n).catch((e=>!1))}function r(e,t=!1){const n=document.querySelectorAll(e);return n.length>0&&(t?n.forEach((e=>e.click())):n[0].click()),n.length>0}function a(e){return null!==document.querySelector(e)}function c(e,t){const n=document.querySelectorAll(e),o=new Array(n.length);return n.forEach(((e,t)=>{o[t]=function(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}(e)})),0!==o.length&&("any"===t?o.some((e=>e)):"none"===t?o.every((e=>!e)):o.every((e=>e)))}function u(e,t=1e4){return s((()=>null!==document.querySelector(e)),Math.ceil(t/200),200)}function l(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}function d(){const e=n("autoconsent-prehide");return e&&e.remove(),!!e}const p={main:!0,frame:!1,url:""};class h{constructor(e){this.runContext=p,this.name=e}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}checkRunContext(){const e={...p,...this.runContext},t=window.top===window;return!(t&&!e.main)&&(!(!t&&!e.frame)&&!(e.url&&!window.location.href.startsWith(e.url)))}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 function m(e){const t=[];if(e.exists&&t.push(a(e.exists)),e.visible&&t.push(c(e.visible,e.check)),e.eval){const n=i(e.eval);t.push(n)}var d,p;if(e.waitFor&&t.push(u(e.waitFor,e.timeout)),e.waitForVisible&&t.push(function(e,t=1e4,n="any"){return s((()=>c(e,n)),Math.ceil(t/200),200)}(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(r(e.click,e.all)),e.waitForThenClick&&t.push(async function(e,t=1e4,n=!1){return await u(e,t),r(e,n)}(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(l(e.wait)),e.hide&&t.push((d=e.hide,p=e.method,o(n(),d,p))),0===t.length)return!1;return(await Promise.all(t)).reduce(((e,t)=>e&&t),!0)}class f extends h{constructor(e){super(e.name),this.config=e,this.runContext=e.runContext||p}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get prehideSelectors(){return this.config.prehideSelectors}async _runRulesParallel(e){const t=e.map((e=>m(e)));return(await Promise.all(t)).every((e=>!!e))}async _runRulesSequentially(e){for(const t of e){if(!await m(t)&&!t.optional)return!1}return!0}async detectCmp(){return!!this.config.detectCmp&&this._runRulesParallel(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&this._runRulesParallel(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&this._runRulesSequentially(this.config.optOut)}async optIn(){return!!this.config.optIn&&this._runRulesSequentially(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&this._runRulesSequentially(this.config.openCmp)}async test(){return this.hasSelfTest?this._runRulesSequentially(this.config.test):super.test()}}function w(e){return new f(e)}const y=[new class extends h{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}async detectCmp(){const e=a("#truste-show-consent,#truste-consent-track");return e&&(this._shortcutButton=document.querySelector("#truste-consent-required")),e}async detectPopup(){return c("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){r("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(o(n(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),r("#truste-show-consent"),setTimeout((()=>{n().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,r("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends h{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,url:"https://consent-pref.trustarc.com/?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return!0}async detectPopup(){return c("#defaultpreferencemanager","any")&&c(".mainContent","any")}async navigateToSettings(){return await s((async()=>a(".shp")||c(".advance","any")||a(".switch span:first-child")),10,500),a(".shp")&&r(".shp"),await u(".prefPanel",5e3),c(".advance","any")&&r(".advance"),await s((()=>c(".switch span:first-child","any")),5,1e3)}async optOut(){return await s((()=>"complete"===document.readyState),20,100),await u(".mainContent[aria-hidden=false]",5e3),!!r(".rejectAll")||(a(".prefPanel")&&await u('.prefPanel[style="visibility: visible;"]',3e3),r("#catDetails0")?(r(".submit"),!0):(r(".required")||(await this.navigateToSettings(),r(".switch span:nth-child(1):not(.active)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")}))),!0))}async optIn(){return await this.navigateToSettings(),r(".switch span:nth-child(2)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")})),!0}},new class extends h{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return a("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return r(".cookie-alert-extended-detail-link")?(await u(".cookie-alert-configuration",2e3),r(".cookie-alert-configuration-input:checked",!0),r(".cookie-alert-extended-button-secondary"),!0):a("#dtcookie-container")?r(".h-dtcookie-decline"):(r(".cookiebot__button--settings")||r("#CybotCookiebotDialogBodyButtonDecline")||(r(".cookiebanner__link--details"),r('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),r("#CybotCookiebotDialogBodyButtonDecline"),r("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),a("#CybotCookiebotDialogBodyButtonAcceptSelected")?r("#CybotCookiebotDialogBodyButtonAcceptSelected"):r("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await i("window.CookieConsent.hasResponse !== true")&&(await i("window.Cookiebot.dialog.submitConsent()"),await l(500)),a("#cb-confirmedSettings")&&await i("endCookieProcess()")),!0)}async optIn(){return a("#dtcookie-container")?r(".h-dtcookie-accept"):(r(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),r("#CybotCookiebotDialogBodyLevelButtonAccept"),r("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return i("window.CookieConsent.declined === true")}},new class extends h{constructor(){super("Sourcepoint-top"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay"],this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!0}async detectCmp(){return a("div[id^='sp_message_container_']")}async detectPopup(){return c("div[id^='sp_message_container_']","all")}async optIn(){return!0}async optOut(){return!0}async test(){return await i("__tcfapi('getTCData', 2, r => window.__rcsResult = r)"),await i("Object.values(window.__rcsResult.purpose.consents).every(c => !c)")}},new class extends h{constructor(){super("Sourcepoint-frame"),this.ccpaMode=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaMode=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname)&&e.searchParams.has("message_id")&&e.searchParams.has("requestUUID")}async detectPopup(){return!0}async optIn(){return await u(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!r(".sp_choice_type_11")||!!r(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===new URL(location.href).pathname}async optOut(){if(!this.isManagerOpen()){if(!await u("button.sp_choice_type_12,button.sp_choice_type_13"))return!1;if(!a("button.sp_choice_type_12"))return r("button.sp_choice_type_13");r("button.sp_choice_type_12"),await s((()=>"/privacy-manager/index.html"===location.pathname),200,100)}await u(".type-modal",2e4);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",n=await Promise.race([u(e,2e3).then((e=>e?0:-1)),u(t,2e3).then((e=>e?1:-1)),u(".pm-features",2e3).then((e=>e?2:-1))]);if(0===n)return await l(1e3),r(e);if(1===n)return r(t);2===n&&(await u(".pm-features",1e4),r(".checked > span",!0),r(".chevron"))}catch(e){}return r(".sp_choice_type_SAVE_AND_EXIT")}},new class extends h{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"]}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#cmpbox")}async detectPopup(){return c("#cmpbox .cmpmore","any")}async optOut(){return!!r(".cmpboxbtnno")||(a(".cmpwelcomeprpsbtn")?(r(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),r(".cmpboxbtnsave"),!0):(r(".cmpboxbtncustom"),await u(".cmptblbox",2e3),r(".cmptdchoice > a[aria-checked=true]",!0),r(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return r(".cmpboxbtnyes")}},new class extends h{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#_evidon_banner")}async detectPopup(){return c("#_evidon_banner","any")}async optOut(){return r("#_evidon-decline-button")||(o(n(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),r("#_evidon-option-button"),await u("#evidon-prefdiag-overlay",5e3),r("#evidon-prefdiag-decline")),!0}async optIn(){return r("#_evidon-accept-button")}},new class extends h{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#onetrust-banner-sdk,.optanon-alert-box-wrapper")}async detectPopup(){return c("#onetrust-banner-sdk,.optanon-alert-box-wrapper","all")}async optOut(){return a("#onetrust-pc-btn-handler")?r("#onetrust-pc-btn-handler"):r(".ot-sdk-show-settings,button.js-cookie-settings"),await u("#onetrust-consent-sdk",2e3),await l(1e3),r("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await u(".save-preference-btn-handler,.js-consent-save",2e3),r(".save-preference-btn-handler,.js-consent-save"),await s((()=>c("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return r("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await i("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}}];class g{static setBase(e){g.base=e}static findElement(e,t=null,n=!1){let o=null;return o=null!=t?Array.from(t.querySelectorAll(e.selector)):null!=g.base?Array.from(g.base.querySelectorAll(e.selector)):Array.from(document.querySelectorAll(e.selector)),null!=e.textFilter&&(o=o.filter((t=>{let n=t.textContent.toLowerCase();if(Array.isArray(e.textFilter)){let t=!1;for(let o of e.textFilter)if(-1!==n.indexOf(o.toLowerCase())){t=!0;break}return t}if(null!=e.textFilter)return-1!==n.indexOf(e.textFilter.toLowerCase())}))),null!=e.styleFilters&&(o=o.filter((t=>{let n=window.getComputedStyle(t),o=!0;for(let t of e.styleFilters){let e=n[t.option];o=t.negated?o&&e!==t.value:o&&e===t.value}return o}))),null!=e.displayFilter&&(o=o.filter((t=>e.displayFilter?0!==t.offsetHeight:0===t.offsetHeight))),null!=e.iframeFilter&&(o=o.filter((t=>e.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=e.childFilter&&(o=o.filter((t=>{let n=g.base;g.setBase(t);let o=g.find(e.childFilter);return g.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,e,t),o[0])}static find(e,t=!1){let n=[];if(null!=e.parent){let o=g.findElement(e.parent,null,t);if(null!=o){if(o instanceof Array)return o.forEach((o=>{let s=g.findElement(e.target,o,t);s instanceof Array?s.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:s})})),n;{let s=g.findElement(e.target,o,t);s instanceof Array?s.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:s})}}}else{let o=g.findElement(e.target,null,t);o instanceof Array?o.forEach((e=>{n.push({parent:null,target:e})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),t?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function C(e){const t=g.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function b(e,t){switch(e.type){case"click":return async function(e){const t=g.find(e);null!=t.target&&t.target.click();return _(0)}(e);case"list":return async function(e,t){for(let n of e.actions)await b(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){C(n.matcher)!==e&&await b(n.toggleAction)}else e?await b(n.trueAction):await b(n.falseAction)}}(e,t);case"ifcss":return async function(e,t){g.find(e).target?e.falseAction&&await b(e.falseAction,t):e.trueAction&&await b(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 i=g.find(e);(e.negated&&i.target||!e.negated&&!i.target)&&n>0?(n-=1,setTimeout(s,o)):t()};s()}))}(e);case"foreach":return async function(e,t){const n=g.find(e,!0),o=g.base;for(const o of n)o.target&&(g.setBase(o.target),await b(e.action,t));g.setBase(o)}(e,t);case"hide":return async function(e){const t=g.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=g.find(e),n=g.find(e.dragTarget);if(t.target){let e=t.target.getBoundingClientRect(),o=n.target.getBoundingClientRect(),s=o.top-e.top,i=o.left-e.left;"y"===this.config.axis.toLowerCase()&&(i=0),"x"===this.config.axis.toLowerCase()&&(s=0);let r=window.screenX+e.left+e.width/2,a=window.screenY+e.top+e.height/2,c=e.left+e.width/2,u=e.top+e.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,a,c,u,!1,!1,!1,!1,0,t.target);let d=document.createEvent("MouseEvents");d.initMouseEvent("mousemove",!0,!0,window,0,r+i,a+s,c+i,u+s,!1,!1,!1,!1,0,t.target);let p=document.createEvent("MouseEvents");p.initMouseEvent("mouseup",!0,!0,window,0,r+i,a+s,c+i,u+s,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(l),await this.waitTimeout(10),t.target.dispatchEvent(d),await this.waitTimeout(10),t.target.dispatchEvent(p)}}(e);case"close":return async function(e){window.close()}();case"wait":return async function(e){await _(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"Unknown action type: "+e.type}}g.base=null;function _(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}class v{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=p,t.methods.forEach((e=>{e.action&&this.methods.set(e.name,e.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((e=>C(e.presentMatcher))).some((e=>!!e))}async detectPopup(){return this.config.detectors.map((e=>C(e.showingMatcher))).some((e=>!!e))}async executeAction(e,t){return!this.methods.has(e)||b(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}}class k{constructor(e,n=null,o=null){if(this.rules=[],this.foundCmp=null,t.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...y],n)this.initialize(n,o);else{o&&this.parseRules(o);e({type:"init",url:window.location.href})}}initialize(e,t){if(this.config=e,e.enabled){if(t&&this.parseRules(t),e.disabledCmps?.length>0&&this.disableCMPs(e.disabledCmps),e.enablePrehide)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()}}parseRules(e){Object.keys(e.consentomatic).forEach((t=>{this.addConsentomaticCMP(t,e.consentomatic[t])})),e.autoconsent.forEach((e=>{this.addCMP(e)}))}addCMP(e){this.rules.push(w(e))}disableCMPs(e){this.rules=this.rules.filter((t=>!e.includes(t.name)))}addConsentomaticCMP(e,t){this.rules.push(new v(`com_${e}`,t))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){const e=await this.findCmp(this.config.detectRetries);if(e){this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:e.name});return await this.waitForPopup(e)?(this.foundCmp=e,this.sendContentMessage({type:"popupFound",cmp:e.name,url:location.href}),"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn()):(this.config.enablePrehide&&d(),!1)}return this.config.enablePrehide&&d(),!1}async findCmp(e){let t=null;const n=[];for(const e of this.rules)try{if(!e.checkRunContext())continue;await e.detectCmp()&&(n.push(e),t||(t=e))}catch(e){}if(n.length>1){const e={msg:"Found multiple CMPs, check the detection rules.",cmps:n.map((e=>e.name))};this.sendContentMessage({type:"autoconsentError",details:e})}return!t&&e>0?new Promise((t=>{setTimeout((async()=>{const n=this.findCmp(e-1);t(n)}),500)})):t}async doOptOut(){let e;return e=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doOptIn(){let e;return e=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:!1,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doSelfTest(){let e;return e=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,url:location.href}),e}async waitForPopup(e,t=5,n=500){const o=await e.detectPopup();return!o&&t>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(e,t-1,n))),n))):o}prehideElements(){return function(e){return o(n("autoconsent-prehide"),e,"opacity")}(this.rules.reduce(((e,t)=>t.prehideSelectors?[...e,...t.prehideSelectors]:e),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]))}async receiveMessageCallback(e){switch(e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,n){const o=t.pending.get(e);o?(t.pending.delete(e),o.timer&&window.clearTimeout(o.timer),o.resolve(n)):console.warn("no eval #",e)}(e.id,e.result)}}}export{w as createAutoCMP,k as default,y as rules};
1
+ class e{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)}}const t={pending:new Map,sendContentMessage:null};function n(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 o(e,t,n="display"){const o="opacity"===n?"opacity: 0":"display: none",i=`${t.join(",")} { ${o} !important; z-index: -1 !important; pointer-events: none !important; } `;return e instanceof HTMLStyleElement&&(e.innerText+=i,t.length>0)}async function i(e,t,n){const o=await e();return!o&&t>0?new Promise((o=>{setTimeout((async()=>{o(i(e,t-1,n))}),n)})):Promise.resolve(o)}function s(n){return function(n){let o;o=crypto&&void 0!==crypto.randomUUID?crypto.randomUUID():Math.random().toString(),t.sendContentMessage({type:"eval",id:o,code:n});const i=new e(o);return t.pending.set(i.id,i),i.promise}(n).catch((e=>!1))}function r(e,t=!1){const n=document.querySelectorAll(e);return n.length>0&&(t?n.forEach((e=>e.click())):n[0].click()),n.length>0}function a(e){return null!==document.querySelector(e)}function c(e,t){const n=document.querySelectorAll(e),o=new Array(n.length);return n.forEach(((e,t)=>{o[t]=function(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}(e)})),0!==o.length&&("any"===t?o.some((e=>e)):"none"===t?o.every((e=>!e)):o.every((e=>e)))}function u(e,t=1e4){return i((()=>null!==document.querySelector(e)),Math.ceil(t/200),200)}async function l(e,t=1e4,n=!1){return await u(e,t),r(e,n)}function p(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}function d(){const e=n("autoconsent-prehide");return e&&e.remove(),!!e}const h={main:!0,frame:!1,url:""};class m{constructor(e){this.runContext=h,this.name=e}get hasSelfTest(){throw new Error("Not Implemented")}get isIntermediate(){throw new Error("Not Implemented")}checkRunContext(){const e={...h,...this.runContext},t=window.top===window;return!(t&&!e.main)&&(!(!t&&!e.frame)&&!(e.url&&!window.location.href.startsWith(e.url)))}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 function f(e){const t=[];if(e.exists&&t.push(a(e.exists)),e.visible&&t.push(c(e.visible,e.check)),e.eval){const n=s(e.eval);t.push(n)}var d,h;if(e.waitFor&&t.push(u(e.waitFor,e.timeout)),e.waitForVisible&&t.push(function(e,t=1e4,n="any"){return i((()=>c(e,n)),Math.ceil(t/200),200)}(e.waitForVisible,e.timeout,e.check)),e.click&&t.push(r(e.click,e.all)),e.waitForThenClick&&t.push(l(e.waitForThenClick,e.timeout,e.all)),e.wait&&t.push(p(e.wait)),e.hide&&t.push((d=e.hide,h=e.method,o(n(),d,h))),e.if){if(!e.if.exists&&!e.if.visible)return console.error("invalid conditional rule",e.if),!1;await f(e.if)?t.push(y(e.then)):e.else&&t.push(y(e.else))}if(0===t.length)return!1;return(await Promise.all(t)).reduce(((e,t)=>e&&t),!0)}async function y(e){for(const t of e){if(!await f(t)&&!t.optional)return!1}return!0}class w extends m{constructor(e){super(e.name),this.config=e,this.runContext=e.runContext||h}get hasSelfTest(){return!!this.config.test}get isIntermediate(){return!!this.config.intermediate}get prehideSelectors(){return this.config.prehideSelectors}async detectCmp(){return!!this.config.detectCmp&&async function(e){const t=e.map((e=>f(e)));return(await Promise.all(t)).every((e=>!!e))}(this.config.detectCmp)}async detectPopup(){return!!this.config.detectPopup&&y(this.config.detectPopup)}async optOut(){return!!this.config.optOut&&y(this.config.optOut)}async optIn(){return!!this.config.optIn&&y(this.config.optIn)}async openCmp(){return!!this.config.openCmp&&y(this.config.openCmp)}async test(){return this.hasSelfTest?y(this.config.test):super.test()}}function g(e){return new w(e)}const b=[new class extends m{constructor(){super("TrustArc-top"),this.prehideSelectors=[".trustarc-banner-container",".truste_popframe,.truste_overlay,.truste_box_overlay,#truste-consent-track"],this.runContext={main:!0,frame:!1},this._shortcutButton=null,this._optInDone=!1}get hasSelfTest(){return!1}get isIntermediate(){return!this._optInDone&&!this._shortcutButton}async detectCmp(){const e=a("#truste-show-consent,#truste-consent-track");return e&&(this._shortcutButton=document.querySelector("#truste-consent-required")),e}async detectPopup(){return c("#truste-consent-content,#trustarc-banner-overlay,#truste-consent-track","all")}openFrame(){r("#truste-show-consent")}async optOut(){return this._shortcutButton?(this._shortcutButton.click(),!0):(o(n(),[".truste_popframe",".truste_overlay",".truste_box_overlay","#truste-consent-track"]),r("#truste-show-consent"),setTimeout((()=>{n().remove()}),1e4),!0)}async optIn(){return this._optInDone=!0,r("#truste-consent-button")}async openCmp(){return!0}async test(){return!0}},new class extends m{constructor(){super("TrustArc-frame"),this.runContext={main:!1,frame:!0,url:"https://consent-pref.trustarc.com/?"}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return!0}async detectPopup(){return c("#defaultpreferencemanager","any")&&c(".mainContent","any")}async navigateToSettings(){return await i((async()=>a(".shp")||c(".advance","any")||a(".switch span:first-child")),10,500),a(".shp")&&r(".shp"),await u(".prefPanel",5e3),c(".advance","any")&&r(".advance"),await i((()=>c(".switch span:first-child","any")),5,1e3)}async optOut(){return await i((()=>"complete"===document.readyState),20,100),await u(".mainContent[aria-hidden=false]",5e3),!!r(".rejectAll")||(a(".prefPanel")&&await u('.prefPanel[style="visibility: visible;"]',3e3),r("#catDetails0")?(r(".submit"),!0):(r(".required")||(await this.navigateToSettings(),r(".switch span:nth-child(1):not(.active)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")}))),!0))}async optIn(){return await this.navigateToSettings(),r(".switch span:nth-child(2)",!0),r(".submit"),u("#gwt-debug-close_id",3e5).then((()=>{r("#gwt-debug-close_id")})),!0}},new class extends m{constructor(){super("Cybotcookiebot"),this.prehideSelectors=["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#CybotCookiebotDialogBodyLevelButtonPreferences")}async detectPopup(){return a("#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookiebanner")}async optOut(){return r(".cookie-alert-extended-detail-link")?(await u(".cookie-alert-configuration",2e3),r(".cookie-alert-configuration-input:checked",!0),r(".cookie-alert-extended-button-secondary"),!0):a("#dtcookie-container")?r(".h-dtcookie-decline"):(r(".cookiebot__button--settings")||r("#CybotCookiebotDialogBodyButtonDecline")||(r(".cookiebanner__link--details"),r('.CybotCookiebotDialogBodyLevelButton:checked:enabled,input[id*="CybotCookiebotDialogBodyLevelButton"]:checked:enabled',!0),r("#CybotCookiebotDialogBodyButtonDecline"),r("input[id^=CybotCookiebotDialogBodyLevelButton]:checked",!0),a("#CybotCookiebotDialogBodyButtonAcceptSelected")?r("#CybotCookiebotDialogBodyButtonAcceptSelected"):r("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection",!0),await s("window.CookieConsent.hasResponse !== true")&&(await s("window.Cookiebot.dialog.submitConsent()"),await p(500)),a("#cb-confirmedSettings")&&await s("endCookieProcess()")),!0)}async optIn(){return a("#dtcookie-container")?r(".h-dtcookie-accept"):(r(".CybotCookiebotDialogBodyLevelButton:not(:checked):enabled",!0),r("#CybotCookiebotDialogBodyLevelButtonAccept"),r("#CybotCookiebotDialogBodyButtonAccept"),!0)}async test(){return s("window.CookieConsent.declined === true")}},new class extends m{constructor(){super("Sourcepoint-top"),this.prehideSelectors=["div[id^='sp_message_container_'],.message-overlay"],this.runContext={main:!0,frame:!1}}get hasSelfTest(){return!0}get isIntermediate(){return!0}async detectCmp(){return a("div[id^='sp_message_container_']")}async detectPopup(){return c("div[id^='sp_message_container_']","all")}async optIn(){return!0}async optOut(){const e=document.querySelector(".sp-message-open");return e&&e.classList.remove("sp-message-open"),!0}async test(){return await s("__tcfapi('getTCData', 2, r => window.__rcsResult = r)"),await s("Object.values(window.__rcsResult.purpose.consents).every(c => !c)")}},new class extends m{constructor(){super("Sourcepoint-frame"),this.ccpaMode=!1,this.runContext={main:!1,frame:!0}}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){const e=new URL(location.href);return e.searchParams.has("message_id")&&"ccpa-notice.sp-prod.net"===e.hostname?(this.ccpaMode=!0,!0):("/index.html"===e.pathname||"/privacy-manager/index.html"===e.pathname)&&(e.searchParams.has("message_id")||e.searchParams.has("requestUUID")||e.searchParams.has("consentUUID"))}async detectPopup(){return!0}async optIn(){return await u(".sp_choice_type_11,.sp_choice_type_ACCEPT_ALL",2e3),!!r(".sp_choice_type_11")||!!r(".sp_choice_type_ACCEPT_ALL")}isManagerOpen(){return"/privacy-manager/index.html"===new URL(location.href).pathname}async optOut(){if(!this.isManagerOpen()){if(!await u(".sp_choice_type_12,.sp_choice_type_13"))return!1;if(!a(".sp_choice_type_12"))return r(".sp_choice_type_13");r(".sp_choice_type_12"),await i((()=>"/privacy-manager/index.html"===location.pathname),200,100)}await u(".type-modal",2e4);try{const e=".sp_choice_type_REJECT_ALL",t=".reject-toggle",n=await Promise.race([u(e,2e3).then((e=>e?0:-1)),u(t,2e3).then((e=>e?1:-1)),u(".pm-features",2e3).then((e=>e?2:-1))]);if(0===n)return await p(1e3),r(e);1===n?r(t):2===n&&(await u(".pm-features",1e4),r(".checked > span",!0),r(".chevron"))}catch(e){}return r(".sp_choice_type_SAVE_AND_EXIT"),!0}},new class extends m{constructor(){super("consentmanager.net"),this.prehideSelectors=["#cmpbox,#cmpbox2"],this.apiAvailable=!1}get hasSelfTest(){return this.apiAvailable}get isIntermediate(){return!1}async detectCmp(){return this.apiAvailable=await s('window.__cmp && typeof __cmp("getCMPData") === "object"'),!!this.apiAvailable||a("#cmpbox")}async detectPopup(){return this.apiAvailable?await s("!__cmp('consentStatus').userChoiceExists"):c("#cmpbox .cmpmore","any")}async optOut(){return await p(500),this.apiAvailable?await s("__cmp('setConsent', 0)"):!!r(".cmpboxbtnno")||(a(".cmpwelcomeprpsbtn")?(r(".cmpwelcomeprpsbtn > a[aria-checked=true]",!0),r(".cmpboxbtnsave"),!0):(r(".cmpboxbtncustom"),await u(".cmptblbox",2e3),r(".cmptdchoice > a[aria-checked=true]",!0),r(".cmpboxbtnyescustomchoices"),!0))}async optIn(){return this.apiAvailable?await s("__cmp('setConsent', 1)"):r(".cmpboxbtnyes")}async test(){if(this.apiAvailable)return await s("__cmp('consentStatus').userChoiceExists")}},new class extends m{constructor(){super("Evidon")}get hasSelfTest(){return!1}get isIntermediate(){return!1}async detectCmp(){return a("#_evidon_banner")}async detectPopup(){return c("#_evidon_banner","any")}async optOut(){return r("#_evidon-decline-button")||(o(n(),["#evidon-prefdiag-overlay","#evidon-prefdiag-background"]),r("#_evidon-option-button"),await u("#evidon-prefdiag-overlay",5e3),r("#evidon-prefdiag-decline")),!0}async optIn(){return r("#_evidon-accept-button")}},new class extends m{constructor(){super("Onetrust"),this.prehideSelectors=["#onetrust-banner-sdk,#onetrust-consent-sdk,.optanon-alert-box-wrapper,.onetrust-pc-dark-filter,.js-consent-banner"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a("#onetrust-banner-sdk,.optanon-alert-box-wrapper")}async detectPopup(){return c("#onetrust-banner-sdk,.optanon-alert-box-wrapper","all")}async optOut(){return a("#onetrust-pc-btn-handler")?r("#onetrust-pc-btn-handler"):r(".ot-sdk-show-settings,button.js-cookie-settings"),await u("#onetrust-consent-sdk",2e3),await p(1e3),r("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked",!0),await u(".save-preference-btn-handler,.js-consent-save",2e3),r(".save-preference-btn-handler,.js-consent-save"),await i((()=>c("#onetrust-banner-sdk","none")),10,500),!0}async optIn(){return r("#onetrust-accept-btn-handler,.js-accept-cookies")}async test(){return await s("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1")}},new class extends m{constructor(){super("Klaro"),this.prehideSelectors=[".klaro"],this.settingsOpen=!1}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".klaro > .cookie-modal")?(this.settingsOpen=!0,!0):a(".klaro > .cookie-notice")}async detectPopup(){return c(".klaro > .cookie-notice,.klaro > .cookie-modal","any")}async optOut(){return!!r(".klaro .cn-decline")||(this.settingsOpen||(r(".klaro .cn-learn-more"),await u(".klaro > .cookie-modal",2e3),this.settingsOpen=!0),!!r(".klaro .cn-decline")||(r(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)",!0),r(".cm-btn-accept")))}async optIn(){return!!r(".klaro .cm-btn-accept-all")||(this.settingsOpen?(r(".cm-purpose:not(.cm-toggle-all) > input.half-checked",!0),r(".cm-btn-accept")):r(".klaro .cookie-notice .cm-btn-success"))}async test(){return await s("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])")}},new class extends m{constructor(){super("Uniconsent")}get prehideSelectors(){return[".unic"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".unic .unic-box,.unic .unic-bar")}async detectPopup(){return c(".unic .unic-box,.unic .unic-bar","any")}async optOut(){if(await u(".unic button",1e3),document.querySelectorAll(".unic button").forEach((e=>{const t=e.textContent;(t.includes("Manage Options")||t.includes("Optionen verwalten"))&&e.click()})),await u(".unic input[type=checkbox]",1e3)){await u(".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(),!0}}return!1}async optIn(){return l(".unic #unic-agree")}async test(){await p(1e3);return!a(".unic .unic-box,.unic .unic-bar")}},new class extends m{constructor(){super("Conversant"),this.prehideSelectors=[".cmp-root"]}get hasSelfTest(){return!0}get isIntermediate(){return!1}async detectCmp(){return a(".cmp-root .cmp-receptacle")}async detectPopup(){return c(".cmp-root .cmp-receptacle","any")}async optOut(){if(!await l(".cmp-main-button:not(.cmp-main-button--primary)"))return!1;if(!await u(".cmp-view-tab-tabs"))return!1;await l(".cmp-view-tab-tabs > :first-child"),await l(".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 i((()=>!!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 r(".cmp-main-button:not(.cmp-main-button--primary)"),!0}async optIn(){return l(".cmp-main-button.cmp-main-button--primary")}async test(){return document.cookie.includes("cmp-data=0")}}];class C{static setBase(e){C.base=e}static findElement(e,t=null,n=!1){let o=null;return o=null!=t?Array.from(t.querySelectorAll(e.selector)):null!=C.base?Array.from(C.base.querySelectorAll(e.selector)):Array.from(document.querySelectorAll(e.selector)),null!=e.textFilter&&(o=o.filter((t=>{let n=t.textContent.toLowerCase();if(Array.isArray(e.textFilter)){let t=!1;for(let o of e.textFilter)if(-1!==n.indexOf(o.toLowerCase())){t=!0;break}return t}if(null!=e.textFilter)return-1!==n.indexOf(e.textFilter.toLowerCase())}))),null!=e.styleFilters&&(o=o.filter((t=>{let n=window.getComputedStyle(t),o=!0;for(let t of e.styleFilters){let e=n[t.option];o=t.negated?o&&e!==t.value:o&&e===t.value}return o}))),null!=e.displayFilter&&(o=o.filter((t=>e.displayFilter?0!==t.offsetHeight:0===t.offsetHeight))),null!=e.iframeFilter&&(o=o.filter((t=>e.iframeFilter?window.location!==window.parent.location:window.location===window.parent.location))),null!=e.childFilter&&(o=o.filter((t=>{let n=C.base;C.setBase(t);let o=C.find(e.childFilter);return C.setBase(n),null!=o.target}))),n?o:(o.length>1&&console.warn("Multiple possible targets: ",o,e,t),o[0])}static find(e,t=!1){let n=[];if(null!=e.parent){let o=C.findElement(e.parent,null,t);if(null!=o){if(o instanceof Array)return o.forEach((o=>{let i=C.findElement(e.target,o,t);i instanceof Array?i.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:i})})),n;{let i=C.findElement(e.target,o,t);i instanceof Array?i.forEach((e=>{n.push({parent:o,target:e})})):n.push({parent:o,target:i})}}}else{let o=C.findElement(e.target,null,t);o instanceof Array?o.forEach((e=>{n.push({parent:null,target:e})})):n.push({parent:null,target:o})}return 0===n.length&&n.push({parent:null,target:null}),t?n:(1!==n.length&&console.warn("Multiple results found, even though multiple false",n),n[0])}}function k(e){const t=C.find(e);return"css"===e.type?!!t.target:"checkbox"===e.type?!!t.target&&t.target.checked:void 0}async function v(e,t){switch(e.type){case"click":return async function(e){const t=C.find(e);null!=t.target&&t.target.click();return _(0)}(e);case"list":return async function(e,t){for(let n of e.actions)await v(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){k(n.matcher)!==e&&await v(n.toggleAction)}else e?await v(n.trueAction):await v(n.falseAction)}}(e,t);case"ifcss":return async function(e,t){C.find(e).target?e.falseAction&&await v(e.falseAction,t):e.trueAction&&await v(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,i=()=>{const s=C.find(e);(e.negated&&s.target||!e.negated&&!s.target)&&n>0?(n-=1,setTimeout(i,o)):t()};i()}))}(e);case"foreach":return async function(e,t){const n=C.find(e,!0),o=C.base;for(const o of n)o.target&&(C.setBase(o.target),await v(e.action,t));C.setBase(o)}(e,t);case"hide":return async function(e){const t=C.find(e);t.target&&t.target.classList.add("Autoconsent-Hidden")}(e);case"slide":return async function(e){const t=C.find(e),n=C.find(e.dragTarget);if(t.target){let e=t.target.getBoundingClientRect(),o=n.target.getBoundingClientRect(),i=o.top-e.top,s=o.left-e.left;"y"===this.config.axis.toLowerCase()&&(s=0),"x"===this.config.axis.toLowerCase()&&(i=0);let r=window.screenX+e.left+e.width/2,a=window.screenY+e.top+e.height/2,c=e.left+e.width/2,u=e.top+e.height/2,l=document.createEvent("MouseEvents");l.initMouseEvent("mousedown",!0,!0,window,0,r,a,c,u,!1,!1,!1,!1,0,t.target);let p=document.createEvent("MouseEvents");p.initMouseEvent("mousemove",!0,!0,window,0,r+s,a+i,c+s,u+i,!1,!1,!1,!1,0,t.target);let d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,r+s,a+i,c+s,u+i,!1,!1,!1,!1,0,t.target),t.target.dispatchEvent(l),await this.waitTimeout(10),t.target.dispatchEvent(p),await this.waitTimeout(10),t.target.dispatchEvent(d)}}(e);case"close":return async function(e){window.close()}();case"wait":return async function(e){await _(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"Unknown action type: "+e.type}}C.base=null;function _(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}class x{constructor(e,t){this.name=e,this.config=t,this.methods=new Map,this.runContext=h,t.methods.forEach((e=>{e.action&&this.methods.set(e.name,e.action)})),this.hasSelfTest=!1}get isIntermediate(){return!1}checkRunContext(){return!0}async detectCmp(){return this.config.detectors.map((e=>k(e.presentMatcher))).some((e=>!!e))}async detectPopup(){return this.config.detectors.map((e=>k(e.showingMatcher))).some((e=>!!e))}async executeAction(e,t){return!this.methods.has(e)||v(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}}class S{constructor(e,n=null,o=null){if(this.rules=[],this.foundCmp=null,t.sendContentMessage=e,this.sendContentMessage=e,this.rules=[...b],n)this.initialize(n,o);else{o&&this.parseRules(o);e({type:"init",url:window.location.href})}}initialize(e,t){if(this.config=e,e.enabled){if(t&&this.parseRules(t),e.disabledCmps?.length>0&&this.disableCMPs(e.disabledCmps),e.enablePrehide)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()}}parseRules(e){Object.keys(e.consentomatic).forEach((t=>{this.addConsentomaticCMP(t,e.consentomatic[t])})),e.autoconsent.forEach((e=>{this.addCMP(e)}))}addCMP(e){this.rules.push(g(e))}disableCMPs(e){this.rules=this.rules.filter((t=>!e.includes(t.name)))}addConsentomaticCMP(e,t){this.rules.push(new x(`com_${e}`,t))}start(){window.requestIdleCallback?window.requestIdleCallback((()=>this._start()),{timeout:500}):this._start()}async _start(){const e=await this.findCmp(this.config.detectRetries);if(e.length>0){const t=[];for(const n of e)this.sendContentMessage({type:"cmpDetected",url:location.href,cmp:n.name}),t.push(this.waitForPopup(n).then((e=>e?(this.foundCmp||(this.foundCmp=n),this.sendContentMessage({type:"popupFound",cmp:n.name,url:location.href}),!0):Promise.reject(`${n.name} popup not found`))));return await Promise.any(t).catch((()=>!1))?"optOut"===this.config.autoAction?await this.doOptOut():"optIn"!==this.config.autoAction||await this.doOptIn():(this.config.enablePrehide&&d(),!1)}return this.config.enablePrehide&&d(),!1}async findCmp(e){const t=[];for(const e of this.rules)try{if(!e.checkRunContext())continue;await e.detectCmp()&&t.push(e)}catch(e){}if(t.length>1){const e={msg:"Found multiple CMPs, check the detection rules.",cmps:t.map((e=>e.name))};this.sendContentMessage({type:"autoconsentError",details:e})}return 0===t.length&&e>0?new Promise((t=>{setTimeout((async()=>{const n=this.findCmp(e-1);t(n)}),500)})):t}async doOptOut(){let e;return e=!!this.foundCmp&&await this.foundCmp.optOut(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optOutResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:this.foundCmp&&this.foundCmp.hasSelfTest,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doOptIn(){let e;return e=!!this.foundCmp&&await this.foundCmp.optIn(),this.config.enablePrehide&&d(),this.sendContentMessage({type:"optInResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,scheduleSelfTest:!1,url:location.href}),e&&!this.foundCmp.isIntermediate&&this.sendContentMessage({type:"autoconsentDone",cmp:this.foundCmp.name,url:location.href}),e}async doSelfTest(){let e;return e=!!this.foundCmp&&await this.foundCmp.test(),this.sendContentMessage({type:"selfTestResult",cmp:this.foundCmp?this.foundCmp.name:"none",result:e,url:location.href}),e}async waitForPopup(e,t=5,n=500){const o=await e.detectPopup();return!o&&t>0?new Promise((o=>setTimeout((()=>o(this.waitForPopup(e,t-1,n))),n))):o}prehideElements(){return function(e){return o(n("autoconsent-prehide"),e,"opacity")}(this.rules.reduce(((e,t)=>t.prehideSelectors?[...e,...t.prehideSelectors]:e),["#didomi-popup,.didomi-popup-container,.didomi-popup-notice,.didomi-consent-popup-preferences,#didomi-notice,.didomi-popup-backdrop,.didomi-screen-medium"]))}async receiveMessageCallback(e){switch(e.type){case"initResp":this.initialize(e.config,e.rules);break;case"optOut":await this.doOptOut();break;case"selfTest":await this.doSelfTest();break;case"evalResp":!function(e,n){const o=t.pending.get(e);o?(t.pending.delete(e),o.timer&&window.clearTimeout(o.timer),o.resolve(n)):console.warn("no eval #",e)}(e.id,e.result)}}}export{g as createAutoCMP,S as default,b as rules};