@duckduckgo/autoconsent 5.3.0 → 6.0.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 (95) hide show
  1. package/.eslintrc +1 -1
  2. package/CHANGELOG.md +17 -0
  3. package/data/coverage.json +958 -1010
  4. package/dist/addon-firefox/background.bundle.js +13 -12
  5. package/dist/addon-firefox/content.bundle.js +1074 -930
  6. package/dist/addon-firefox/manifest.json +1 -1
  7. package/dist/addon-firefox/rules.json +83 -83
  8. package/dist/addon-mv3/background.bundle.js +13 -12
  9. package/dist/addon-mv3/content.bundle.js +1074 -930
  10. package/dist/addon-mv3/manifest.json +1 -1
  11. package/dist/addon-mv3/popup.bundle.js +38 -0
  12. package/dist/addon-mv3/popup.html +2 -1
  13. package/dist/addon-mv3/rules.json +83 -83
  14. package/dist/autoconsent.cjs.js +1074 -937
  15. package/dist/autoconsent.esm.js +1074 -932
  16. package/dist/autoconsent.playwright.js +1 -1
  17. package/lib/cmps/airbnb.ts +1 -3
  18. package/lib/cmps/all.ts +13 -22
  19. package/lib/cmps/base.ts +123 -92
  20. package/lib/cmps/consentmanager.ts +7 -10
  21. package/lib/cmps/conversant.ts +1 -4
  22. package/lib/cmps/cookiebot.ts +6 -10
  23. package/lib/cmps/evidon.ts +1 -3
  24. package/lib/cmps/klaro.ts +3 -7
  25. package/lib/cmps/onetrust.ts +3 -7
  26. package/lib/cmps/sourcepoint-frame.ts +1 -4
  27. package/lib/cmps/tiktok.ts +1 -3
  28. package/lib/cmps/trustarc-frame.ts +1 -3
  29. package/lib/cmps/trustarc-top.ts +6 -5
  30. package/lib/cmps/uniconsent.ts +1 -3
  31. package/lib/eval-snippets.ts +105 -0
  32. package/lib/rule-executors.ts +0 -8
  33. package/lib/rules.ts +3 -1
  34. package/lib/types.ts +1 -1
  35. package/lib/web.ts +26 -13
  36. package/package.json +1 -1
  37. package/readme.md +3 -3
  38. package/rules/autoconsent/192.json +1 -1
  39. package/rules/autoconsent/adroll.json +1 -1
  40. package/rules/autoconsent/affinity-serif-com.json +1 -1
  41. package/rules/autoconsent/axeptio.json +1 -1
  42. package/rules/autoconsent/bing.json +1 -1
  43. package/rules/autoconsent/borlabs.json +1 -1
  44. package/rules/autoconsent/bundesregierung-de.json +1 -1
  45. package/rules/autoconsent/canva.json +1 -1
  46. package/rules/autoconsent/clickio.json +1 -1
  47. package/rules/autoconsent/clinch.json +1 -1
  48. package/rules/autoconsent/coinbase.json +1 -1
  49. package/rules/autoconsent/complianz-banner.json +1 -1
  50. package/rules/autoconsent/complianz-categories.json +1 -1
  51. package/rules/autoconsent/complianz-optin.json +1 -1
  52. package/rules/autoconsent/cookie-law-info.json +2 -2
  53. package/rules/autoconsent/cookie-manager-popup.json +1 -1
  54. package/rules/autoconsent/cookiealert.json +3 -3
  55. package/rules/autoconsent/cookiefirst.json +7 -8
  56. package/rules/autoconsent/cookieinformation.json +3 -3
  57. package/rules/autoconsent/dailymotion.json +1 -1
  58. package/rules/autoconsent/dsgvo.json +1 -1
  59. package/rules/autoconsent/dunelm.json +1 -1
  60. package/rules/autoconsent/etsy.json +2 -2
  61. package/rules/autoconsent/eu-cookie-compliance.json +1 -1
  62. package/rules/autoconsent/eu-cookie-law.json +1 -1
  63. package/rules/autoconsent/ezoic.json +2 -2
  64. package/rules/autoconsent/google.json +1 -1
  65. package/rules/autoconsent/iubenda.json +2 -2
  66. package/rules/autoconsent/jquery-cookiebar.json +1 -1
  67. package/rules/autoconsent/mediavine.json +1 -1
  68. package/rules/autoconsent/microsoft.json +3 -3
  69. package/rules/autoconsent/moove.json +1 -1
  70. package/rules/autoconsent/paypal.json +1 -1
  71. package/rules/autoconsent/primebox.json +1 -1
  72. package/rules/autoconsent/pubtech.json +1 -1
  73. package/rules/autoconsent/reddit.json +1 -1
  74. package/rules/autoconsent/sibbo.json +1 -1
  75. package/rules/autoconsent/sirdata.json +1 -1
  76. package/rules/autoconsent/snigel.json +1 -1
  77. package/rules/autoconsent/steampowered.json +1 -1
  78. package/rules/autoconsent/tarteaucitron.json +3 -3
  79. package/rules/autoconsent/tealium.json +4 -4
  80. package/rules/autoconsent/testcmp-cosmetic.json +1 -1
  81. package/rules/autoconsent/testcmp.json +1 -1
  82. package/rules/autoconsent/thefreedictionary.json +2 -2
  83. package/rules/autoconsent/theverge.json +1 -1
  84. package/rules/autoconsent/twitter.json +1 -1
  85. package/rules/autoconsent/ubuntu.com.json +1 -1
  86. package/rules/autoconsent/uk-cookie-consent.json +1 -1
  87. package/rules/autoconsent/usercentrics-api.json +7 -7
  88. package/rules/autoconsent/usercentrics-button.json +1 -1
  89. package/rules/autoconsent/waitrose.json +2 -2
  90. package/rules/autoconsent/wp-cookie-notice.json +1 -1
  91. package/rules/autoconsent/xing.json +1 -1
  92. package/rules/autoconsent/youtube-desktop.json +1 -1
  93. package/rules/autoconsent/youtube-mobile.json +1 -1
  94. package/rules/rules.json +83 -83
  95. package/lib/index.ts +0 -4
@@ -19,62 +19,411 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // lib/web.ts
20
20
  var web_exports = {};
21
21
  __export(web_exports, {
22
- createAutoCMP: () => createAutoCMP,
23
- default: () => AutoConsent,
24
- rules: () => rules2
22
+ default: () => AutoConsent
25
23
  });
26
24
  module.exports = __toCommonJS(web_exports);
27
25
 
28
- // lib/config.ts
29
- var enableLogs = false;
26
+ // lib/consentomatic/tools.ts
27
+ var _Tools = class _Tools {
28
+ static setBase(base) {
29
+ _Tools.base = base;
30
+ }
31
+ static findElement(options, parent = null, multiple = false) {
32
+ let possibleTargets = null;
33
+ if (parent != null) {
34
+ possibleTargets = Array.from(parent.querySelectorAll(options.selector));
35
+ } else {
36
+ if (_Tools.base != null) {
37
+ possibleTargets = Array.from(
38
+ _Tools.base.querySelectorAll(options.selector)
39
+ );
40
+ } else {
41
+ possibleTargets = Array.from(
42
+ document.querySelectorAll(options.selector)
43
+ );
44
+ }
45
+ }
46
+ if (options.textFilter != null) {
47
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
48
+ const textContent = possibleTarget.textContent.toLowerCase();
49
+ if (Array.isArray(options.textFilter)) {
50
+ let foundText = false;
51
+ for (const text of options.textFilter) {
52
+ if (textContent.indexOf(text.toLowerCase()) !== -1) {
53
+ foundText = true;
54
+ break;
55
+ }
56
+ }
57
+ return foundText;
58
+ } else if (options.textFilter != null) {
59
+ return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
60
+ }
61
+ });
62
+ }
63
+ if (options.styleFilters != null) {
64
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
65
+ const styles = window.getComputedStyle(possibleTarget);
66
+ let keep = true;
67
+ for (const styleFilter of options.styleFilters) {
68
+ const option = styles[styleFilter.option];
69
+ if (styleFilter.negated) {
70
+ keep = keep && option !== styleFilter.value;
71
+ } else {
72
+ keep = keep && option === styleFilter.value;
73
+ }
74
+ }
75
+ return keep;
76
+ });
77
+ }
78
+ if (options.displayFilter != null) {
79
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
80
+ if (options.displayFilter) {
81
+ return possibleTarget.offsetHeight !== 0;
82
+ } else {
83
+ return possibleTarget.offsetHeight === 0;
84
+ }
85
+ });
86
+ }
87
+ if (options.iframeFilter != null) {
88
+ possibleTargets = possibleTargets.filter(() => {
89
+ if (options.iframeFilter) {
90
+ return window.location !== window.parent.location;
91
+ } else {
92
+ return window.location === window.parent.location;
93
+ }
94
+ });
95
+ }
96
+ if (options.childFilter != null) {
97
+ possibleTargets = possibleTargets.filter((possibleTarget) => {
98
+ const oldBase = _Tools.base;
99
+ _Tools.setBase(possibleTarget);
100
+ const childResults = _Tools.find(options.childFilter);
101
+ _Tools.setBase(oldBase);
102
+ return childResults.target != null;
103
+ });
104
+ }
105
+ if (multiple) {
106
+ return possibleTargets;
107
+ } else {
108
+ if (possibleTargets.length > 1) {
109
+ console.warn(
110
+ "Multiple possible targets: ",
111
+ possibleTargets,
112
+ options,
113
+ parent
114
+ );
115
+ }
116
+ return possibleTargets[0];
117
+ }
118
+ }
119
+ static find(options, multiple = false) {
120
+ const results = [];
121
+ if (options.parent != null) {
122
+ const parent = _Tools.findElement(options.parent, null, multiple);
123
+ if (parent != null) {
124
+ if (parent instanceof Array) {
125
+ parent.forEach((p) => {
126
+ const targets = _Tools.findElement(options.target, p, multiple);
127
+ if (targets instanceof Array) {
128
+ targets.forEach((target) => {
129
+ results.push({
130
+ parent: p,
131
+ target
132
+ });
133
+ });
134
+ } else {
135
+ results.push({
136
+ parent: p,
137
+ target: targets
138
+ });
139
+ }
140
+ });
141
+ return results;
142
+ } else {
143
+ const targets = _Tools.findElement(options.target, parent, multiple);
144
+ if (targets instanceof Array) {
145
+ targets.forEach((target) => {
146
+ results.push({
147
+ parent,
148
+ target
149
+ });
150
+ });
151
+ } else {
152
+ results.push({
153
+ parent,
154
+ target: targets
155
+ });
156
+ }
157
+ }
158
+ }
159
+ } else {
160
+ const targets = _Tools.findElement(options.target, null, multiple);
161
+ if (targets instanceof Array) {
162
+ targets.forEach((target) => {
163
+ results.push({
164
+ parent: null,
165
+ target
166
+ });
167
+ });
168
+ } else {
169
+ results.push({
170
+ parent: null,
171
+ target: targets
172
+ });
173
+ }
174
+ }
175
+ if (results.length === 0) {
176
+ results.push({
177
+ parent: null,
178
+ target: null
179
+ });
180
+ }
181
+ if (multiple) {
182
+ return results;
183
+ } else {
184
+ if (results.length !== 1) {
185
+ console.warn(
186
+ "Multiple results found, even though multiple false",
187
+ results
188
+ );
189
+ }
190
+ return results[0];
191
+ }
192
+ }
193
+ };
194
+ _Tools.base = null;
195
+ var Tools = _Tools;
30
196
 
31
- // lib/random.ts
32
- function getRandomID() {
33
- if (crypto && typeof crypto.randomUUID !== "undefined") {
34
- return crypto.randomUUID();
197
+ // lib/consentomatic/index.ts
198
+ function matches(config) {
199
+ const result = Tools.find(config);
200
+ if (config.type === "css") {
201
+ return !!result.target;
202
+ } else if (config.type === "checkbox") {
203
+ return !!result.target && result.target.checked;
204
+ }
205
+ }
206
+ async function executeAction(config, param) {
207
+ switch (config.type) {
208
+ case "click":
209
+ return clickAction(config);
210
+ case "list":
211
+ return listAction(config, param);
212
+ case "consent":
213
+ return consentAction(config, param);
214
+ case "ifcss":
215
+ return ifCssAction(config, param);
216
+ case "waitcss":
217
+ return waitCssAction(config);
218
+ case "foreach":
219
+ return forEachAction(config, param);
220
+ case "hide":
221
+ return hideAction(config);
222
+ case "slide":
223
+ return slideAction(config);
224
+ case "close":
225
+ return closeAction();
226
+ case "wait":
227
+ return waitAction(config);
228
+ case "eval":
229
+ return evalAction(config);
230
+ default:
231
+ throw "Unknown action type: " + config.type;
232
+ }
233
+ }
234
+ var STEP_TIMEOUT = 0;
235
+ function waitTimeout(timeout) {
236
+ return new Promise((resolve) => {
237
+ setTimeout(() => {
238
+ resolve();
239
+ }, timeout);
240
+ });
241
+ }
242
+ async function clickAction(config) {
243
+ const result = Tools.find(config);
244
+ if (result.target != null) {
245
+ result.target.click();
246
+ }
247
+ return waitTimeout(STEP_TIMEOUT);
248
+ }
249
+ async function listAction(config, param) {
250
+ for (const action of config.actions) {
251
+ await executeAction(action, param);
252
+ }
253
+ }
254
+ async function consentAction(config, consentTypes) {
255
+ for (const consentConfig of config.consents) {
256
+ const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
257
+ if (consentConfig.matcher && consentConfig.toggleAction) {
258
+ const isEnabled = matches(consentConfig.matcher);
259
+ if (isEnabled !== shouldEnable) {
260
+ await executeAction(consentConfig.toggleAction);
261
+ }
262
+ } else {
263
+ if (shouldEnable) {
264
+ await executeAction(consentConfig.trueAction);
265
+ } else {
266
+ await executeAction(consentConfig.falseAction);
267
+ }
268
+ }
269
+ }
270
+ }
271
+ async function ifCssAction(config, param) {
272
+ const result = Tools.find(config);
273
+ if (!result.target) {
274
+ if (config.trueAction) {
275
+ await executeAction(config.trueAction, param);
276
+ }
277
+ } else {
278
+ if (config.falseAction) {
279
+ await executeAction(config.falseAction, param);
280
+ }
281
+ }
282
+ }
283
+ async function waitCssAction(config) {
284
+ await new Promise((resolve) => {
285
+ let numRetries = config.retries || 10;
286
+ const waitTime = config.waitTime || 250;
287
+ const checkCss = () => {
288
+ const result = Tools.find(config);
289
+ if (config.negated && result.target || !config.negated && !result.target) {
290
+ if (numRetries > 0) {
291
+ numRetries -= 1;
292
+ setTimeout(checkCss, waitTime);
293
+ } else {
294
+ resolve();
295
+ }
296
+ } else {
297
+ resolve();
298
+ }
299
+ };
300
+ checkCss();
301
+ });
302
+ }
303
+ async function forEachAction(config, param) {
304
+ const results = Tools.find(config, true);
305
+ const oldBase = Tools.base;
306
+ for (const result of results) {
307
+ if (result.target) {
308
+ Tools.setBase(result.target);
309
+ await executeAction(config.action, param);
310
+ }
311
+ }
312
+ Tools.setBase(oldBase);
313
+ }
314
+ async function hideAction(config) {
315
+ const result = Tools.find(config);
316
+ if (result.target) {
317
+ result.target.classList.add("Autoconsent-Hidden");
318
+ }
319
+ }
320
+ async function slideAction(config) {
321
+ const result = Tools.find(config);
322
+ const dragResult = Tools.find(config.dragTarget);
323
+ if (result.target) {
324
+ const targetBounds = result.target.getBoundingClientRect();
325
+ const dragTargetBounds = dragResult.target.getBoundingClientRect();
326
+ let yDiff = dragTargetBounds.top - targetBounds.top;
327
+ let xDiff = dragTargetBounds.left - targetBounds.left;
328
+ if (this.config.axis.toLowerCase() === "y") {
329
+ xDiff = 0;
330
+ }
331
+ if (this.config.axis.toLowerCase() === "x") {
332
+ yDiff = 0;
333
+ }
334
+ const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
335
+ const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
336
+ const clientX = targetBounds.left + targetBounds.width / 2;
337
+ const clientY = targetBounds.top + targetBounds.height / 2;
338
+ const mouseDown = document.createEvent("MouseEvents");
339
+ mouseDown.initMouseEvent(
340
+ "mousedown",
341
+ true,
342
+ true,
343
+ window,
344
+ 0,
345
+ screenX,
346
+ screenY,
347
+ clientX,
348
+ clientY,
349
+ false,
350
+ false,
351
+ false,
352
+ false,
353
+ 0,
354
+ result.target
355
+ );
356
+ const mouseMove = document.createEvent("MouseEvents");
357
+ mouseMove.initMouseEvent(
358
+ "mousemove",
359
+ true,
360
+ true,
361
+ window,
362
+ 0,
363
+ screenX + xDiff,
364
+ screenY + yDiff,
365
+ clientX + xDiff,
366
+ clientY + yDiff,
367
+ false,
368
+ false,
369
+ false,
370
+ false,
371
+ 0,
372
+ result.target
373
+ );
374
+ const mouseUp = document.createEvent("MouseEvents");
375
+ mouseUp.initMouseEvent(
376
+ "mouseup",
377
+ true,
378
+ true,
379
+ window,
380
+ 0,
381
+ screenX + xDiff,
382
+ screenY + yDiff,
383
+ clientX + xDiff,
384
+ clientY + yDiff,
385
+ false,
386
+ false,
387
+ false,
388
+ false,
389
+ 0,
390
+ result.target
391
+ );
392
+ result.target.dispatchEvent(mouseDown);
393
+ await this.waitTimeout(10);
394
+ result.target.dispatchEvent(mouseMove);
395
+ await this.waitTimeout(10);
396
+ result.target.dispatchEvent(mouseUp);
35
397
  }
36
- return Math.random().toString();
37
398
  }
38
-
39
- // lib/eval-handler.ts
40
- var Deferred = class {
41
- constructor(id, timeout = 1e3) {
42
- this.id = id;
43
- this.promise = new Promise((resolve, reject) => {
44
- this.resolve = resolve;
45
- this.reject = reject;
46
- });
47
- this.timer = window.setTimeout(() => {
48
- this.reject(new Error("timeout"));
49
- }, timeout);
50
- }
51
- };
52
- var evalState = {
53
- pending: /* @__PURE__ */ new Map(),
54
- sendContentMessage: null
55
- };
56
- function requestEval(code) {
57
- const id = getRandomID();
58
- evalState.sendContentMessage({
59
- type: "eval",
60
- id,
61
- code
62
- });
63
- const deferred = new Deferred(id);
64
- evalState.pending.set(deferred.id, deferred);
65
- return deferred.promise;
399
+ async function waitAction(config) {
400
+ await waitTimeout(config.waitTime);
66
401
  }
67
- function resolveEval(id, value) {
68
- const deferred = evalState.pending.get(id);
69
- if (deferred) {
70
- evalState.pending.delete(id);
71
- deferred.timer && window.clearTimeout(deferred.timer);
72
- deferred.resolve(value);
73
- } else {
74
- console.warn("no eval #", id);
75
- }
402
+ async function closeAction() {
403
+ window.close();
404
+ }
405
+ async function evalAction(config) {
406
+ console.log("eval!", config.code);
407
+ return new Promise((resolve) => {
408
+ try {
409
+ if (config.async) {
410
+ window.eval(config.code);
411
+ setTimeout(() => {
412
+ resolve(window.eval("window.__consentCheckResult"));
413
+ }, config.timeout || 250);
414
+ } else {
415
+ resolve(window.eval(config.code));
416
+ }
417
+ } catch (e) {
418
+ console.warn("eval error", e, config.code);
419
+ resolve(false);
420
+ }
421
+ });
76
422
  }
77
423
 
424
+ // lib/config.ts
425
+ var enableLogs = false;
426
+
78
427
  // lib/utils.ts
79
428
  function getStyleElement(styleOverrideElementId = "autoconsent-css-rules") {
80
429
  const styleSelector = `style#${styleOverrideElementId}`;
@@ -127,12 +476,6 @@ function isElementVisible(elem) {
127
476
  }
128
477
 
129
478
  // lib/rule-executors.ts
130
- function doEval(expr) {
131
- return requestEval(expr).catch((e) => {
132
- enableLogs && console.error("error evaluating rule", expr, e);
133
- return false;
134
- });
135
- }
136
479
  function click(selector, all = false) {
137
480
  const elem = elementSelector(selector);
138
481
  enableLogs && console.log("[click]", selector, all, elem);
@@ -254,6 +597,163 @@ function elementSelector(selector) {
254
597
  return querySelectorChain(selector);
255
598
  }
256
599
 
600
+ // lib/random.ts
601
+ function getRandomID() {
602
+ if (crypto && typeof crypto.randomUUID !== "undefined") {
603
+ return crypto.randomUUID();
604
+ }
605
+ return Math.random().toString();
606
+ }
607
+
608
+ // lib/eval-handler.ts
609
+ var Deferred = class {
610
+ constructor(id, timeout = 1e3) {
611
+ this.id = id;
612
+ this.promise = new Promise((resolve, reject) => {
613
+ this.resolve = resolve;
614
+ this.reject = reject;
615
+ });
616
+ this.timer = window.setTimeout(() => {
617
+ this.reject(new Error("timeout"));
618
+ }, timeout);
619
+ }
620
+ };
621
+ var evalState = {
622
+ pending: /* @__PURE__ */ new Map(),
623
+ sendContentMessage: null
624
+ };
625
+ function requestEval(code) {
626
+ const id = getRandomID();
627
+ evalState.sendContentMessage({
628
+ type: "eval",
629
+ id,
630
+ code
631
+ });
632
+ const deferred = new Deferred(id);
633
+ evalState.pending.set(deferred.id, deferred);
634
+ return deferred.promise;
635
+ }
636
+ function resolveEval(id, value) {
637
+ const deferred = evalState.pending.get(id);
638
+ if (deferred) {
639
+ evalState.pending.delete(id);
640
+ deferred.timer && window.clearTimeout(deferred.timer);
641
+ deferred.resolve(value);
642
+ } else {
643
+ console.warn("no eval #", id);
644
+ }
645
+ }
646
+
647
+ // lib/eval-snippets.ts
648
+ var snippets = {
649
+ // code-based rules
650
+ EVAL_0: () => console.log(1),
651
+ EVAL_CONSENTMANAGER_1: () => window.__cmp && typeof __cmp("getCMPData") === "object",
652
+ EVAL_CONSENTMANAGER_2: () => !__cmp("consentStatus").userChoiceExists,
653
+ EVAL_CONSENTMANAGER_3: () => __cmp("setConsent", 0),
654
+ EVAL_CONSENTMANAGER_4: () => __cmp("setConsent", 1),
655
+ EVAL_CONSENTMANAGER_5: () => __cmp("consentStatus").userChoiceExists,
656
+ EVAL_COOKIEBOT_1: () => window.CookieConsent.hasResponse !== true,
657
+ EVAL_COOKIEBOT_2: () => window.Cookiebot.dialog.submitConsent(),
658
+ EVAL_COOKIEBOT_3: () => endCookieProcess(),
659
+ EVAL_COOKIEBOT_4: () => window.CookieConsent.declined === true,
660
+ EVAL_KLARO_1: () => klaro.getManager().config.services.every((c) => c.required || !klaro.getManager().consents[c.name]),
661
+ EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
662
+ EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
663
+ // declarative rules
664
+ EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
665
+ EVAL_AFFINITY_SERIF_COM_0: () => document.cookie.includes("serif_manage_cookies_viewed") && !document.cookie.includes("serif_allow_analytics"),
666
+ EVAL_AXEPTIO_0: () => document.cookie.includes("axeptio_authorized_vendors=%2C%2C"),
667
+ EVAL_BING_0: () => document.cookie.includes("AL=0") && document.cookie.includes("AD=0") && document.cookie.includes("SM=0"),
668
+ EVAL_BORLABS_0: () => !JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("borlabs-cookie") !== -1).split("=", 2)[1])).consents.statistics,
669
+ EVAL_BUNDESREGIERUNG_DE_0: () => document.cookie.match("cookie-allow-tracking=0"),
670
+ EVAL_CANVA_0: () => !document.cookie.includes("gtm_fpc_engagement_event"),
671
+ EVAL_CLICKIO_0: () => document.cookie.includes("__lxG__consent__v2_daisybit="),
672
+ EVAL_CLINCH_0: () => document.cookie.includes("ctc_rejected=1"),
673
+ EVAL_COINBASE_0: () => JSON.parse(decodeURIComponent(document.cookie.match(/cm_(eu|default)_preferences=([0-9a-zA-Z\\{\\}\\[\\]%:]*);?/)[2])).consent.length <= 1,
674
+ EVAL_COMPLIANZ_BANNER_0: () => document.cookie.includes("cmplz_banner-status=dismissed"),
675
+ EVAL_COMPLIANZ_CATEGORIES_0: () => !!document.cookie.match(/cmplz_[^=]+=deny/),
676
+ EVAL_COMPLIANZ_OPTIN_0: () => !!document.cookie.match(/cookieconsent_preferences_disabled=[^;]+/),
677
+ EVAL_COOKIE_LAW_INFO_0: () => CLI.disableAllCookies() || CLI.reject_close() || true,
678
+ EVAL_COOKIE_LAW_INFO_1: () => document.cookie.indexOf("cookielawinfo-checkbox-non-necessary=yes") === -1,
679
+ EVAL_COOKIE_MANAGER_POPUP_0: () => JSON.parse(document.cookie.split(";").find((c) => c.trim().startsWith("CookieLevel")).split("=")[1]).social === false,
680
+ EVAL_COOKIEALERT_0: () => document.querySelector("body").removeAttribute("style") || true,
681
+ EVAL_COOKIEALERT_1: () => document.querySelector("body").removeAttribute("style") || true,
682
+ EVAL_COOKIEALERT_2: () => window.CookieConsent.declined === true,
683
+ EVAL_COOKIEFIRST_0: () => ((o) => o.performance === false && o.functional === false && o.advertising === false)(JSON.parse(decodeURIComponent(document.cookie.split(";").find((c) => c.indexOf("cookiefirst") !== -1).trim()).split("=")[1])),
684
+ EVAL_COOKIEFIRST_1: () => document.querySelectorAll("button[data-cookiefirst-accent-color=true][role=checkbox]:not([disabled])").forEach((i) => i.getAttribute("aria-checked") == "true" && i.click()) || true,
685
+ EVAL_COOKIEINFORMATION_0: () => CookieInformation.declineAllCategories() || true,
686
+ EVAL_COOKIEINFORMATION_1: () => CookieInformation.submitAllCategories() || true,
687
+ EVAL_COOKIEINFORMATION_2: () => document.cookie.includes("CookieInformationConsent="),
688
+ EVAL_DAILYMOTION_0: () => !!document.cookie.match("dm-euconsent-v2"),
689
+ EVAL_DSGVO_0: () => !document.cookie.includes("sp_dsgvo_cookie_settings"),
690
+ EVAL_DUNELM_0: () => document.cookie.includes("cc_functional=0") && document.cookie.includes("cc_targeting=0"),
691
+ EVAL_ETSY_0: () => document.querySelectorAll(".gdpr-overlay-body input").forEach((toggle) => {
692
+ toggle.checked = false;
693
+ }) || true,
694
+ EVAL_ETSY_1: () => document.querySelector(".gdpr-overlay-view button[data-wt-overlay-close]").click() || true,
695
+ EVAL_EU_COOKIE_COMPLIANCE_0: () => document.cookie.indexOf("cookie-agreed=2") === -1,
696
+ EVAL_EU_COOKIE_LAW_0: () => !document.cookie.includes("euCookie"),
697
+ EVAL_EZOIC_0: () => ezCMP.handleAcceptAllClick(),
698
+ EVAL_EZOIC_1: () => !!document.cookie.match(/ezCMPCookieConsent=[^;]+\|2=0\|3=0\|4=0/),
699
+ EVAL_GOOGLE_0: () => !!document.cookie.match(/SOCS=CAE/),
700
+ EVAL_IUBENDA_0: () => document.querySelectorAll(".purposes-item input[type=checkbox]:not([disabled])").forEach((x) => {
701
+ if (x.checked)
702
+ x.click();
703
+ }) || true,
704
+ EVAL_IUBENDA_1: () => !!document.cookie.match(/_iub_cs-\d+=/),
705
+ EVAL_JQUERY_COOKIEBAR_0: () => !document.cookie.includes("cookies-state=accepted"),
706
+ EVAL_MEDIAVINE_0: () => document.querySelectorAll('[data-name="mediavine-gdpr-cmp"] input[type=checkbox]').forEach((x) => x.checked && x.click()) || true,
707
+ EVAL_MICROSOFT_0: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Reject|Ablehnen"))[0].click() || true,
708
+ EVAL_MICROSOFT_1: () => Array.from(document.querySelectorAll("div > button")).filter((el) => el.innerText.match("Accept|Annehmen"))[0].click() || true,
709
+ EVAL_MICROSOFT_2: () => !!document.cookie.match("MSCC"),
710
+ EVAL_MOOVE_0: () => document.querySelectorAll("#moove_gdpr_cookie_modal input").forEach((i) => {
711
+ if (!i.disabled && i.name !== "moove_gdpr_strict_cookies")
712
+ i.checked = false;
713
+ }) || true,
714
+ EVAL_ONENINETWO_0: () => document.cookie.includes("CC_ADVERTISING=NO") && document.cookie.includes("CC_ANALYTICS=NO"),
715
+ EVAL_PAYPAL_0: () => document.cookie.includes("cookie_prefs") === true,
716
+ EVAL_PRIMEBOX_0: () => !document.cookie.includes("cb-enabled=accepted"),
717
+ EVAL_PUBTECH_0: () => document.cookie.includes("euconsent-v2") && (document.cookie.match(/.YAAAAAAAAAAA/) || document.cookie.match(/.aAAAAAAAAAAA/) || document.cookie.match(/.YAAACFgAAAAA/)),
718
+ EVAL_REDDIT_0: () => document.cookie.includes("eu_cookie={%22opted%22:true%2C%22nonessential%22:false}"),
719
+ EVAL_SIBBO_0: () => !!window.localStorage.getItem("euconsent-v2"),
720
+ EVAL_SIRDATA_0: () => document.cookie.includes("euconsent-v2"),
721
+ EVAL_SNIGEL_0: () => !!document.cookie.match("snconsent"),
722
+ EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(";").find((s) => s.trim().startsWith("cookieSettings")).split("=")[1])).preference_state === 2,
723
+ EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true,
724
+ EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true,
725
+ EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes("false"),
726
+ EVAL_TEALIUM_0: () => typeof window.utag !== "undefined" && typeof utag.gdpr === "object",
727
+ EVAL_TEALIUM_1: () => utag.gdpr.setConsentValue(false) || true,
728
+ EVAL_TEALIUM_2: () => utag.gdpr.setConsentValue(true) || true,
729
+ EVAL_TEALIUM_3: () => utag.gdpr.getConsentState() !== 1,
730
+ EVAL_TESTCMP_0: () => window.results.results[0] === "button_clicked",
731
+ EVAL_TESTCMP_COSMETIC_0: () => window.results.results[0] === "banner_hidden",
732
+ EVAL_THEFREEDICTIONARY_0: () => cmpUi.showPurposes() || cmpUi.rejectAll() || true,
733
+ EVAL_THEFREEDICTIONARY_1: () => cmpUi.allowAll() || true,
734
+ EVAL_THEVERGE_0: () => document.cookie.includes("_duet_gdpr_acknowledged=1"),
735
+ EVAL_UBUNTU_COM_0: () => document.cookie === "_cookies_accepted=essential",
736
+ EVAL_UK_COOKIE_CONSENT_0: () => !document.cookie.includes("catAccCookies"),
737
+ EVAL_USERCENTRICS_API_0: () => typeof UC_UI === "object",
738
+ EVAL_USERCENTRICS_API_1: () => !!UC_UI.closeCMP(),
739
+ EVAL_USERCENTRICS_API_2: () => !!UC_UI.denyAllConsents(),
740
+ EVAL_USERCENTRICS_API_3: () => !!UC_UI.acceptAllConsents(),
741
+ EVAL_USERCENTRICS_API_4: () => !!UC_UI.closeCMP(),
742
+ EVAL_USERCENTRICS_API_5: () => UC_UI.areAllConsentsAccepted() === true,
743
+ EVAL_USERCENTRICS_API_6: () => UC_UI.areAllConsentsAccepted() === false,
744
+ EVAL_USERCENTRICS_BUTTON_0: () => JSON.parse(localStorage.getItem("usercentrics")).consents.every((c) => c.isEssential || !c.consentStatus),
745
+ EVAL_WAITROSE_0: () => Array.from(document.querySelectorAll("label[id$=cookies-deny-label]")).forEach((e) => e.click()) || true,
746
+ EVAL_WAITROSE_1: () => document.cookie.includes("wtr_cookies_advertising=0") && document.cookie.includes("wtr_cookies_analytics=0"),
747
+ EVAL_WP_COOKIE_NOTICE_0: () => document.cookie.includes("wpl_viewed_cookie=no"),
748
+ EVAL_XING_0: () => document.cookie.includes("userConsent=%7B%22marketing%22%3Afalse"),
749
+ EVAL_YOUTUBE_DESKTOP_0: () => !!document.cookie.match(/SOCS=CAE/),
750
+ EVAL_YOUTUBE_MOBILE_0: () => !!document.cookie.match(/SOCS=CAE/)
751
+ };
752
+ function getFunctionBody(snippetFunc) {
753
+ const snippetStr = snippetFunc.toString();
754
+ return snippetStr.substring(snippetStr.indexOf("=>") + 2);
755
+ }
756
+
257
757
  // lib/cmps/base.ts
258
758
  var defaultRunContext = {
259
759
  main: true,
@@ -261,9 +761,9 @@ var defaultRunContext = {
261
761
  urlPattern: ""
262
762
  };
263
763
  var AutoConsentCMPBase = class {
264
- constructor(name) {
764
+ constructor(autoconsentInstance) {
265
765
  this.runContext = defaultRunContext;
266
- this.name = name;
766
+ this.autoconsent = autoconsentInstance;
267
767
  }
268
768
  get hasSelfTest() {
269
769
  throw new Error("Not Implemented");
@@ -274,6 +774,29 @@ var AutoConsentCMPBase = class {
274
774
  get isCosmetic() {
275
775
  throw new Error("Not Implemented");
276
776
  }
777
+ mainWorldEval(snippetId) {
778
+ const snippet = snippets[snippetId];
779
+ if (!snippet) {
780
+ console.warn("Snippet not found", snippetId);
781
+ return Promise.resolve(false);
782
+ }
783
+ if (this.autoconsent.config.isMainWorld) {
784
+ enableLogs && console.log("inline eval:", snippetId, snippet);
785
+ let result = false;
786
+ try {
787
+ result = !!snippet.call(globalThis);
788
+ } catch (e) {
789
+ enableLogs && console.error("error evaluating rule", snippetId, e);
790
+ }
791
+ return Promise.resolve(result);
792
+ }
793
+ const snippetSrc = getFunctionBody(snippet);
794
+ enableLogs && console.log("async eval:", snippetId, snippetSrc);
795
+ return requestEval(snippetSrc).catch((e) => {
796
+ enableLogs && console.error("error evaluating rule", snippetId, e);
797
+ return false;
798
+ });
799
+ }
277
800
  checkRunContext() {
278
801
  const runCtx = {
279
802
  ...defaultRunContext,
@@ -310,84 +833,11 @@ var AutoConsentCMPBase = class {
310
833
  return Promise.resolve(true);
311
834
  }
312
835
  };
313
- async function evaluateRuleStep(rule) {
314
- const results = [];
315
- if (rule.exists) {
316
- results.push(elementExists(rule.exists));
317
- }
318
- if (rule.visible) {
319
- results.push(elementVisible(rule.visible, rule.check));
320
- }
321
- if (rule.eval) {
322
- const res = doEval(rule.eval);
323
- results.push(res);
324
- }
325
- if (rule.waitFor) {
326
- results.push(waitForElement(rule.waitFor, rule.timeout));
327
- }
328
- if (rule.waitForVisible) {
329
- results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
330
- }
331
- if (rule.click) {
332
- results.push(click(rule.click, rule.all));
333
- }
334
- if (rule.waitForThenClick) {
335
- results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
336
- }
337
- if (rule.wait) {
338
- results.push(wait(rule.wait));
339
- }
340
- if (rule.hide) {
341
- results.push(hide(rule.hide, rule.method));
342
- }
343
- if (rule.if) {
344
- if (!rule.if.exists && !rule.if.visible) {
345
- console.error("invalid conditional rule", rule.if);
346
- return false;
347
- }
348
- const condition = await evaluateRuleStep(rule.if);
349
- enableLogs && console.log("Condition is", condition);
350
- if (condition) {
351
- results.push(_runRulesSequentially(rule.then));
352
- } else if (rule.else) {
353
- results.push(_runRulesSequentially(rule.else));
354
- }
355
- }
356
- if (rule.any) {
357
- for (const step of rule.any) {
358
- if (await evaluateRuleStep(step)) {
359
- return true;
360
- }
361
- }
362
- return false;
363
- }
364
- if (results.length === 0) {
365
- enableLogs && console.warn("Unrecognized rule", rule);
366
- return false;
367
- }
368
- const all = await Promise.all(results);
369
- return all.reduce((a, b) => a && b, true);
370
- }
371
- async function _runRulesParallel(rules3) {
372
- const results = rules3.map((rule) => evaluateRuleStep(rule));
373
- const detections = await Promise.all(results);
374
- return detections.every((r) => !!r);
375
- }
376
- async function _runRulesSequentially(rules3) {
377
- for (const rule of rules3) {
378
- enableLogs && console.log("Running rule...", rule);
379
- const result = await evaluateRuleStep(rule);
380
- enableLogs && console.log("...rule result", result);
381
- if (!result && !rule.optional) {
382
- return false;
383
- }
384
- }
385
- return true;
386
- }
387
836
  var AutoConsentCMP = class extends AutoConsentCMPBase {
388
- constructor(config) {
389
- super(config.name);
837
+ constructor(config, autoconsentInstance) {
838
+ super(autoconsentInstance);
390
839
  this.config = config;
840
+ this.name = config.name;
391
841
  this.runContext = config.runContext || defaultRunContext;
392
842
  }
393
843
  get hasSelfTest() {
@@ -404,41 +854,180 @@ var AutoConsentCMP = class extends AutoConsentCMPBase {
404
854
  }
405
855
  async detectCmp() {
406
856
  if (this.config.detectCmp) {
407
- return _runRulesParallel(this.config.detectCmp);
857
+ return this._runRulesParallel(this.config.detectCmp);
408
858
  }
409
859
  return false;
410
860
  }
411
861
  async detectPopup() {
412
862
  if (this.config.detectPopup) {
413
- return _runRulesSequentially(this.config.detectPopup);
863
+ return this._runRulesSequentially(this.config.detectPopup);
414
864
  }
415
865
  return false;
416
866
  }
417
867
  async optOut() {
418
868
  if (this.config.optOut) {
419
869
  enableLogs && console.log("Initiated optOut()", this.config.optOut);
420
- return _runRulesSequentially(this.config.optOut);
870
+ return this._runRulesSequentially(this.config.optOut);
421
871
  }
422
872
  return false;
423
873
  }
424
874
  async optIn() {
425
875
  if (this.config.optIn) {
426
876
  enableLogs && console.log("Initiated optIn()", this.config.optIn);
427
- return _runRulesSequentially(this.config.optIn);
877
+ return this._runRulesSequentially(this.config.optIn);
428
878
  }
429
879
  return false;
430
880
  }
431
881
  async openCmp() {
432
882
  if (this.config.openCmp) {
433
- return _runRulesSequentially(this.config.openCmp);
883
+ return this._runRulesSequentially(this.config.openCmp);
884
+ }
885
+ return false;
886
+ }
887
+ async test() {
888
+ if (this.hasSelfTest) {
889
+ return this._runRulesSequentially(this.config.test);
890
+ }
891
+ return super.test();
892
+ }
893
+ async evaluateRuleStep(rule) {
894
+ const results = [];
895
+ if (rule.exists) {
896
+ results.push(elementExists(rule.exists));
897
+ }
898
+ if (rule.visible) {
899
+ results.push(elementVisible(rule.visible, rule.check));
900
+ }
901
+ if (rule.eval) {
902
+ const res = this.mainWorldEval(rule.eval);
903
+ results.push(res);
904
+ }
905
+ if (rule.waitFor) {
906
+ results.push(waitForElement(rule.waitFor, rule.timeout));
907
+ }
908
+ if (rule.waitForVisible) {
909
+ results.push(waitForVisible(rule.waitForVisible, rule.timeout, rule.check));
910
+ }
911
+ if (rule.click) {
912
+ results.push(click(rule.click, rule.all));
913
+ }
914
+ if (rule.waitForThenClick) {
915
+ results.push(waitForThenClick(rule.waitForThenClick, rule.timeout, rule.all));
916
+ }
917
+ if (rule.wait) {
918
+ results.push(wait(rule.wait));
919
+ }
920
+ if (rule.hide) {
921
+ results.push(hide(rule.hide, rule.method));
922
+ }
923
+ if (rule.if) {
924
+ if (!rule.if.exists && !rule.if.visible) {
925
+ console.error("invalid conditional rule", rule.if);
926
+ return false;
927
+ }
928
+ const condition = await this.evaluateRuleStep(rule.if);
929
+ enableLogs && console.log("Condition is", condition);
930
+ if (condition) {
931
+ results.push(this._runRulesSequentially(rule.then));
932
+ } else if (rule.else) {
933
+ results.push(this._runRulesSequentially(rule.else));
934
+ }
935
+ }
936
+ if (rule.any) {
937
+ for (const step of rule.any) {
938
+ if (await this.evaluateRuleStep(step)) {
939
+ return true;
940
+ }
941
+ }
942
+ return false;
943
+ }
944
+ if (results.length === 0) {
945
+ enableLogs && console.warn("Unrecognized rule", rule);
946
+ return false;
434
947
  }
948
+ const all = await Promise.all(results);
949
+ return all.reduce((a, b) => a && b, true);
950
+ }
951
+ async _runRulesParallel(rules) {
952
+ const results = rules.map((rule) => this.evaluateRuleStep(rule));
953
+ const detections = await Promise.all(results);
954
+ return detections.every((r) => !!r);
955
+ }
956
+ async _runRulesSequentially(rules) {
957
+ for (const rule of rules) {
958
+ enableLogs && console.log("Running rule...", rule);
959
+ const result = await this.evaluateRuleStep(rule);
960
+ enableLogs && console.log("...rule result", result);
961
+ if (!result && !rule.optional) {
962
+ return false;
963
+ }
964
+ }
965
+ return true;
966
+ }
967
+ };
968
+
969
+ // lib/cmps/consentomatic.ts
970
+ var ConsentOMaticCMP = class {
971
+ constructor(name, config) {
972
+ this.name = name;
973
+ this.config = config;
974
+ this.methods = /* @__PURE__ */ new Map();
975
+ this.runContext = defaultRunContext;
976
+ this.isCosmetic = false;
977
+ config.methods.forEach((methodConfig) => {
978
+ if (methodConfig.action) {
979
+ this.methods.set(methodConfig.name, methodConfig.action);
980
+ }
981
+ });
982
+ this.hasSelfTest = false;
983
+ }
984
+ get isIntermediate() {
435
985
  return false;
436
986
  }
987
+ checkRunContext() {
988
+ return true;
989
+ }
990
+ async detectCmp() {
991
+ const matchResults = this.config.detectors.map(
992
+ (detectorConfig) => matches(detectorConfig.presentMatcher)
993
+ );
994
+ return matchResults.some((r) => !!r);
995
+ }
996
+ async detectPopup() {
997
+ const matchResults = this.config.detectors.map(
998
+ (detectorConfig) => matches(detectorConfig.showingMatcher)
999
+ );
1000
+ return matchResults.some((r) => !!r);
1001
+ }
1002
+ async executeAction(method, param) {
1003
+ if (this.methods.has(method)) {
1004
+ return executeAction(this.methods.get(method), param);
1005
+ }
1006
+ return true;
1007
+ }
1008
+ async optOut() {
1009
+ await this.executeAction("HIDE_CMP");
1010
+ await this.executeAction("OPEN_OPTIONS");
1011
+ await this.executeAction("HIDE_CMP");
1012
+ await this.executeAction("DO_CONSENT", []);
1013
+ await this.executeAction("SAVE_CONSENT");
1014
+ return true;
1015
+ }
1016
+ async optIn() {
1017
+ await this.executeAction("HIDE_CMP");
1018
+ await this.executeAction("OPEN_OPTIONS");
1019
+ await this.executeAction("HIDE_CMP");
1020
+ await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
1021
+ await this.executeAction("SAVE_CONSENT");
1022
+ return true;
1023
+ }
1024
+ async openCmp() {
1025
+ await this.executeAction("HIDE_CMP");
1026
+ await this.executeAction("OPEN_OPTIONS");
1027
+ return true;
1028
+ }
437
1029
  async test() {
438
- if (this.hasSelfTest) {
439
- return _runRulesSequentially(this.config.test);
440
- }
441
- return super.test();
1030
+ return true;
442
1031
  }
443
1032
  };
444
1033
 
@@ -450,8 +1039,9 @@ var popupContent = "#truste-consent-content";
450
1039
  var bannerOverlay = "#trustarc-banner-overlay";
451
1040
  var bannerContainer = "#truste-consent-track";
452
1041
  var TrustArcTop = class extends AutoConsentCMPBase {
453
- constructor() {
454
- super("TrustArc-top");
1042
+ constructor(autoconsentInstance) {
1043
+ super(autoconsentInstance);
1044
+ this.name = "TrustArc-top";
455
1045
  this.prehideSelectors = [
456
1046
  ".trustarc-banner-container",
457
1047
  `.truste_popframe,.truste_overlay,.truste_box_overlay,${bannerContainer}`
@@ -511,14 +1101,15 @@ var TrustArcTop = class extends AutoConsentCMPBase {
511
1101
  return true;
512
1102
  }
513
1103
  async test() {
514
- return await doEval("window && window.truste && window.truste.eu.bindMap.prefCookie === '0'");
1104
+ return await this.mainWorldEval("EVAL_TRUSTARC_TOP");
515
1105
  }
516
1106
  };
517
1107
 
518
1108
  // lib/cmps/trustarc-frame.ts
519
1109
  var TrustArcFrame = class extends AutoConsentCMPBase {
520
1110
  constructor() {
521
- super("TrustArc-frame");
1111
+ super(...arguments);
1112
+ this.name = "TrustArc-frame";
522
1113
  this.runContext = {
523
1114
  main: false,
524
1115
  frame: true,
@@ -602,7 +1193,8 @@ var TrustArcFrame = class extends AutoConsentCMPBase {
602
1193
  // lib/cmps/cookiebot.ts
603
1194
  var Cookiebot = class extends AutoConsentCMPBase {
604
1195
  constructor() {
605
- super("Cybotcookiebot");
1196
+ super(...arguments);
1197
+ this.name = "Cybotcookiebot";
606
1198
  this.prehideSelectors = ["#CybotCookiebotDialog,#dtcookie-container,#cookiebanner,#cb-cookieoverlay"];
607
1199
  }
608
1200
  get hasSelfTest() {
@@ -645,12 +1237,12 @@ var Cookiebot = class extends AutoConsentCMPBase {
645
1237
  } else {
646
1238
  click("#CybotCookiebotDialogBodyLevelButtonAccept,#CybotCookiebotDialogBodyButtonAccept,#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection", true);
647
1239
  }
648
- if (await doEval("window.CookieConsent.hasResponse !== true")) {
649
- await doEval("window.Cookiebot.dialog.submitConsent()");
1240
+ if (await this.mainWorldEval("EVAL_COOKIEBOT_1")) {
1241
+ await this.mainWorldEval("EVAL_COOKIEBOT_2");
650
1242
  await wait(500);
651
1243
  }
652
1244
  if (elementExists("#cb-confirmedSettings")) {
653
- await doEval("endCookieProcess()");
1245
+ await this.mainWorldEval("EVAL_COOKIEBOT_3");
654
1246
  }
655
1247
  return true;
656
1248
  }
@@ -664,14 +1256,15 @@ var Cookiebot = class extends AutoConsentCMPBase {
664
1256
  return true;
665
1257
  }
666
1258
  async test() {
667
- return doEval("window.CookieConsent.declined === true");
1259
+ return this.mainWorldEval("EVAL_COOKIEBOT_4");
668
1260
  }
669
1261
  };
670
1262
 
671
1263
  // lib/cmps/sourcepoint-frame.ts
672
1264
  var SourcePoint = class extends AutoConsentCMPBase {
673
1265
  constructor() {
674
- super("Sourcepoint-frame");
1266
+ super(...arguments);
1267
+ this.name = "Sourcepoint-frame";
675
1268
  this.prehideSelectors = ["div[id^='sp_message_container_'],.message-overlay", "#sp_privacy_manager_container"];
676
1269
  this.ccpaNotice = false;
677
1270
  this.ccpaPopup = false;
@@ -780,7 +1373,8 @@ var SourcePoint = class extends AutoConsentCMPBase {
780
1373
  // lib/cmps/consentmanager.ts
781
1374
  var ConsentManager = class extends AutoConsentCMPBase {
782
1375
  constructor() {
783
- super("consentmanager.net");
1376
+ super(...arguments);
1377
+ this.name = "consentmanager.net";
784
1378
  this.prehideSelectors = ["#cmpbox,#cmpbox2"];
785
1379
  this.apiAvailable = false;
786
1380
  }
@@ -794,7 +1388,7 @@ var ConsentManager = class extends AutoConsentCMPBase {
794
1388
  return false;
795
1389
  }
796
1390
  async detectCmp() {
797
- this.apiAvailable = await doEval('window.__cmp && typeof __cmp("getCMPData") === "object"');
1391
+ this.apiAvailable = await this.mainWorldEval("EVAL_CONSENTMANAGER_1");
798
1392
  if (!this.apiAvailable) {
799
1393
  return elementExists("#cmpbox");
800
1394
  } else {
@@ -804,14 +1398,14 @@ var ConsentManager = class extends AutoConsentCMPBase {
804
1398
  async detectPopup() {
805
1399
  if (this.apiAvailable) {
806
1400
  await wait(500);
807
- return await doEval("!__cmp('consentStatus').userChoiceExists");
1401
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_2");
808
1402
  }
809
1403
  return elementVisible("#cmpbox .cmpmore", "any");
810
1404
  }
811
1405
  async optOut() {
812
1406
  await wait(500);
813
1407
  if (this.apiAvailable) {
814
- return await doEval("__cmp('setConsent', 0)");
1408
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_3");
815
1409
  }
816
1410
  if (click(".cmpboxbtnno")) {
817
1411
  return true;
@@ -829,278 +1423,25 @@ var ConsentManager = class extends AutoConsentCMPBase {
829
1423
  }
830
1424
  async optIn() {
831
1425
  if (this.apiAvailable) {
832
- return await doEval("__cmp('setConsent', 1)");
1426
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_4");
833
1427
  }
834
1428
  return click(".cmpboxbtnyes");
835
1429
  }
836
1430
  async test() {
837
1431
  if (this.apiAvailable) {
838
- return await doEval("__cmp('consentStatus').userChoiceExists");
1432
+ return await this.mainWorldEval("EVAL_CONSENTMANAGER_5");
839
1433
  }
840
1434
  }
841
1435
  };
842
1436
 
843
1437
  // lib/cmps/evidon.ts
844
1438
  var Evidon = class extends AutoConsentCMPBase {
845
- constructor() {
846
- super("Evidon");
847
- }
848
- get hasSelfTest() {
849
- return false;
850
- }
851
- get isIntermediate() {
852
- return false;
853
- }
854
- get isCosmetic() {
855
- return false;
856
- }
857
- async detectCmp() {
858
- return elementExists("#_evidon_banner");
859
- }
860
- async detectPopup() {
861
- return elementVisible("#_evidon_banner", "any");
862
- }
863
- async optOut() {
864
- if (click("#_evidon-decline-button")) {
865
- return true;
866
- }
867
- hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
868
- click("#_evidon-option-button");
869
- await waitForElement("#evidon-prefdiag-overlay", 5e3);
870
- click("#evidon-prefdiag-decline");
871
- return true;
872
- }
873
- async optIn() {
874
- return click("#_evidon-accept-button");
875
- }
876
- };
877
-
878
- // lib/cmps/onetrust.ts
879
- var Onetrust = class extends AutoConsentCMPBase {
880
- constructor() {
881
- super("Onetrust");
882
- this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
883
- this.runContext = {
884
- urlPattern: "^(?!.*https://www\\.nba\\.com/)"
885
- };
886
- }
887
- get hasSelfTest() {
888
- return true;
889
- }
890
- get isIntermediate() {
891
- return false;
892
- }
893
- get isCosmetic() {
894
- return false;
895
- }
896
- async detectCmp() {
897
- return elementExists("#onetrust-banner-sdk");
898
- }
899
- async detectPopup() {
900
- return elementVisible("#onetrust-banner-sdk", "all");
901
- }
902
- async optOut() {
903
- if (elementExists("#onetrust-pc-btn-handler")) {
904
- click("#onetrust-pc-btn-handler");
905
- } else {
906
- click(".ot-sdk-show-settings,button.js-cookie-settings");
907
- }
908
- await waitForElement("#onetrust-consent-sdk", 2e3);
909
- await wait(1e3);
910
- click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
911
- await wait(1e3);
912
- await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
913
- click(".save-preference-btn-handler,.js-consent-save");
914
- await waitFor(
915
- () => elementVisible("#onetrust-banner-sdk", "none"),
916
- 10,
917
- 500
918
- );
919
- return true;
920
- }
921
- async optIn() {
922
- return click("#onetrust-accept-btn-handler,.js-accept-cookies");
923
- }
924
- async test() {
925
- return await doEval("window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1");
926
- }
927
- };
928
-
929
- // lib/cmps/klaro.ts
930
- var Klaro = class extends AutoConsentCMPBase {
931
- constructor() {
932
- super("Klaro");
933
- this.prehideSelectors = [".klaro"];
934
- this.settingsOpen = false;
935
- }
936
- get hasSelfTest() {
937
- return true;
938
- }
939
- get isIntermediate() {
940
- return false;
941
- }
942
- get isCosmetic() {
943
- return false;
944
- }
945
- async detectCmp() {
946
- if (elementExists(".klaro > .cookie-modal")) {
947
- this.settingsOpen = true;
948
- return true;
949
- }
950
- return elementExists(".klaro > .cookie-notice");
951
- }
952
- async detectPopup() {
953
- return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
954
- }
955
- async optOut() {
956
- if (click(".klaro .cn-decline")) {
957
- return true;
958
- }
959
- if (!this.settingsOpen) {
960
- click(".klaro .cn-learn-more");
961
- await waitForElement(".klaro > .cookie-modal", 2e3);
962
- this.settingsOpen = true;
963
- }
964
- if (click(".klaro .cn-decline")) {
965
- return true;
966
- }
967
- click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
968
- return click(".cm-btn-accept");
969
- }
970
- async optIn() {
971
- if (click(".klaro .cm-btn-accept-all")) {
972
- return true;
973
- }
974
- if (this.settingsOpen) {
975
- click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
976
- return click(".cm-btn-accept");
977
- }
978
- return click(".klaro .cookie-notice .cm-btn-success");
979
- }
980
- async test() {
981
- return await doEval("klaro.getManager().config.services.every(c => c.required || !klaro.getManager().consents[c.name])");
982
- }
983
- };
984
-
985
- // lib/cmps/uniconsent.ts
986
- var Uniconsent = class extends AutoConsentCMPBase {
987
- constructor() {
988
- super("Uniconsent");
989
- }
990
- get prehideSelectors() {
991
- return [".unic", ".modal:has(.unic)"];
992
- }
993
- get hasSelfTest() {
994
- return true;
995
- }
996
- get isIntermediate() {
997
- return false;
998
- }
999
- get isCosmetic() {
1000
- return false;
1001
- }
1002
- async detectCmp() {
1003
- return elementExists(".unic .unic-box,.unic .unic-bar");
1004
- }
1005
- async detectPopup() {
1006
- return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
1007
- }
1008
- async optOut() {
1009
- await waitForElement(".unic button", 1e3);
1010
- document.querySelectorAll(".unic button").forEach((button) => {
1011
- const text = button.textContent;
1012
- if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
1013
- button.click();
1014
- }
1015
- });
1016
- if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
1017
- await waitForElement(".unic button", 1e3);
1018
- document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
1019
- if (c.checked) {
1020
- c.click();
1021
- }
1022
- });
1023
- for (const b of document.querySelectorAll(".unic button")) {
1024
- const text = b.textContent;
1025
- for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
1026
- if (text.includes(pattern)) {
1027
- b.click();
1028
- await wait(500);
1029
- return true;
1030
- }
1031
- }
1032
- }
1033
- }
1034
- return false;
1035
- }
1036
- async optIn() {
1037
- return waitForThenClick(".unic #unic-agree");
1038
- }
1039
- async test() {
1040
- await wait(1e3);
1041
- const res = elementExists(".unic .unic-box,.unic .unic-bar");
1042
- return !res;
1043
- }
1044
- };
1045
-
1046
- // lib/cmps/conversant.ts
1047
- var Conversant = class extends AutoConsentCMPBase {
1048
- constructor() {
1049
- super("Conversant");
1050
- this.prehideSelectors = [".cmp-root"];
1051
- }
1052
- get hasSelfTest() {
1053
- return true;
1054
- }
1055
- get isIntermediate() {
1056
- return false;
1057
- }
1058
- get isCosmetic() {
1059
- return false;
1060
- }
1061
- async detectCmp() {
1062
- return elementExists(".cmp-root .cmp-receptacle");
1063
- }
1064
- async detectPopup() {
1065
- return elementVisible(".cmp-root .cmp-receptacle", "any");
1066
- }
1067
- async optOut() {
1068
- if (!await waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)")) {
1069
- return false;
1070
- }
1071
- if (!await waitForElement(".cmp-view-tab-tabs")) {
1072
- return false;
1073
- }
1074
- await waitForThenClick(".cmp-view-tab-tabs > :first-child");
1075
- await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
1076
- for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
1077
- item.querySelector(".cmp-accordion-item-title").click();
1078
- await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
1079
- const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
1080
- content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
1081
- content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
1082
- }
1083
- await click(".cmp-main-button:not(.cmp-main-button--primary)");
1084
- return true;
1085
- }
1086
- async optIn() {
1087
- return waitForThenClick(".cmp-main-button.cmp-main-button--primary");
1088
- }
1089
- async test() {
1090
- return document.cookie.includes("cmp-data=0");
1091
- }
1092
- };
1093
-
1094
- // lib/cmps/tiktok.ts
1095
- var Tiktok = class extends AutoConsentCMPBase {
1096
- constructor() {
1097
- super("tiktok.com");
1098
- this.runContext = {
1099
- urlPattern: "tiktok"
1100
- };
1439
+ constructor() {
1440
+ super(...arguments);
1441
+ this.name = "Evidon";
1101
1442
  }
1102
1443
  get hasSelfTest() {
1103
- return true;
1444
+ return false;
1104
1445
  }
1105
1446
  get isIntermediate() {
1106
1447
  return false;
@@ -1108,63 +1449,36 @@ var Tiktok = class extends AutoConsentCMPBase {
1108
1449
  get isCosmetic() {
1109
1450
  return false;
1110
1451
  }
1111
- getShadowRoot() {
1112
- const container = document.querySelector("tiktok-cookie-banner");
1113
- if (!container) {
1114
- return null;
1115
- }
1116
- return container.shadowRoot;
1117
- }
1118
1452
  async detectCmp() {
1119
- return elementExists("tiktok-cookie-banner");
1453
+ return elementExists("#_evidon_banner");
1120
1454
  }
1121
1455
  async detectPopup() {
1122
- const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
1123
- return isElementVisible(banner);
1456
+ return elementVisible("#_evidon_banner", "any");
1124
1457
  }
1125
1458
  async optOut() {
1126
- const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
1127
- if (declineButton) {
1128
- enableLogs && console.log("[clicking]", declineButton);
1129
- declineButton.click();
1459
+ if (click("#_evidon-decline-button")) {
1130
1460
  return true;
1131
- } else {
1132
- enableLogs && console.log("no decline button found");
1133
- return false;
1134
1461
  }
1462
+ hideElements(getStyleElement(), ["#evidon-prefdiag-overlay", "#evidon-prefdiag-background"]);
1463
+ click("#_evidon-option-button");
1464
+ await waitForElement("#evidon-prefdiag-overlay", 5e3);
1465
+ click("#evidon-prefdiag-decline");
1466
+ return true;
1135
1467
  }
1136
1468
  async optIn() {
1137
- const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
1138
- if (acceptButton) {
1139
- enableLogs && console.log("[clicking]", acceptButton);
1140
- acceptButton.click();
1141
- return true;
1142
- } else {
1143
- enableLogs && console.log("no accept button found");
1144
- return false;
1145
- }
1146
- }
1147
- async test() {
1148
- const match = document.cookie.match(/cookie-consent=([^;]+)/);
1149
- if (!match) {
1150
- return false;
1151
- }
1152
- const value = JSON.parse(decodeURIComponent(match[1]));
1153
- return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
1469
+ return click("#_evidon-accept-button");
1154
1470
  }
1155
1471
  };
1156
1472
 
1157
- // lib/cmps/airbnb.ts
1158
- var Airbnb = class extends AutoConsentCMPBase {
1473
+ // lib/cmps/onetrust.ts
1474
+ var Onetrust = class extends AutoConsentCMPBase {
1159
1475
  constructor() {
1160
- super("airbnb");
1476
+ super(...arguments);
1477
+ this.name = "Onetrust";
1478
+ this.prehideSelectors = ["#onetrust-banner-sdk,#onetrust-consent-sdk,.onetrust-pc-dark-filter,.js-consent-banner"];
1161
1479
  this.runContext = {
1162
- urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
1480
+ urlPattern: "^(?!.*https://www\\.nba\\.com/)"
1163
1481
  };
1164
- this.prehideSelectors = [
1165
- "div[data-testid=main-cookies-banner-container]",
1166
- 'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
1167
- ];
1168
1482
  }
1169
1483
  get hasSelfTest() {
1170
1484
  return true;
@@ -1176,520 +1490,336 @@ var Airbnb = class extends AutoConsentCMPBase {
1176
1490
  return false;
1177
1491
  }
1178
1492
  async detectCmp() {
1179
- return elementExists("div[data-testid=main-cookies-banner-container]");
1493
+ return elementExists("#onetrust-banner-sdk");
1180
1494
  }
1181
1495
  async detectPopup() {
1182
- return elementVisible("div[data-testid=main-cookies-banner-container", "any");
1496
+ return elementVisible("#onetrust-banner-sdk", "all");
1183
1497
  }
1184
1498
  async optOut() {
1185
- await waitForThenClick("div[data-testid=main-cookies-banner-container] button._snbhip0");
1186
- let check;
1187
- while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
1188
- check.click();
1189
- }
1190
- return waitForThenClick("button[data-testid=save-btn]");
1191
- }
1192
- async optIn() {
1193
- return waitForThenClick("div[data-testid=main-cookies-banner-container] button._148dgdpk");
1194
- }
1195
- async test() {
1196
- return await waitFor(
1197
- () => !!document.cookie.match("OptanonAlertBoxClosed"),
1198
- 20,
1199
- 200
1200
- );
1201
- }
1202
- };
1203
-
1204
- // lib/cmps/all.ts
1205
- var rules = [
1206
- new TrustArcTop(),
1207
- new TrustArcFrame(),
1208
- new Cookiebot(),
1209
- new SourcePoint(),
1210
- new ConsentManager(),
1211
- new Evidon(),
1212
- new Onetrust(),
1213
- new Klaro(),
1214
- new Uniconsent(),
1215
- new Conversant(),
1216
- new Tiktok(),
1217
- new Airbnb()
1218
- ];
1219
- function createAutoCMP(config) {
1220
- return new AutoConsentCMP(config);
1221
- }
1222
- var all_default = rules;
1223
-
1224
- // lib/index.ts
1225
- var rules2 = all_default;
1226
-
1227
- // lib/consentomatic/tools.ts
1228
- var _Tools = class _Tools {
1229
- static setBase(base) {
1230
- _Tools.base = base;
1231
- }
1232
- static findElement(options, parent = null, multiple = false) {
1233
- let possibleTargets = null;
1234
- if (parent != null) {
1235
- possibleTargets = Array.from(parent.querySelectorAll(options.selector));
1236
- } else {
1237
- if (_Tools.base != null) {
1238
- possibleTargets = Array.from(
1239
- _Tools.base.querySelectorAll(options.selector)
1240
- );
1241
- } else {
1242
- possibleTargets = Array.from(
1243
- document.querySelectorAll(options.selector)
1244
- );
1245
- }
1246
- }
1247
- if (options.textFilter != null) {
1248
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1249
- const textContent = possibleTarget.textContent.toLowerCase();
1250
- if (Array.isArray(options.textFilter)) {
1251
- let foundText = false;
1252
- for (const text of options.textFilter) {
1253
- if (textContent.indexOf(text.toLowerCase()) !== -1) {
1254
- foundText = true;
1255
- break;
1256
- }
1257
- }
1258
- return foundText;
1259
- } else if (options.textFilter != null) {
1260
- return textContent.indexOf(options.textFilter.toLowerCase()) !== -1;
1261
- }
1262
- });
1263
- }
1264
- if (options.styleFilters != null) {
1265
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1266
- const styles = window.getComputedStyle(possibleTarget);
1267
- let keep = true;
1268
- for (const styleFilter of options.styleFilters) {
1269
- const option = styles[styleFilter.option];
1270
- if (styleFilter.negated) {
1271
- keep = keep && option !== styleFilter.value;
1272
- } else {
1273
- keep = keep && option === styleFilter.value;
1274
- }
1275
- }
1276
- return keep;
1277
- });
1278
- }
1279
- if (options.displayFilter != null) {
1280
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1281
- if (options.displayFilter) {
1282
- return possibleTarget.offsetHeight !== 0;
1283
- } else {
1284
- return possibleTarget.offsetHeight === 0;
1285
- }
1286
- });
1287
- }
1288
- if (options.iframeFilter != null) {
1289
- possibleTargets = possibleTargets.filter(() => {
1290
- if (options.iframeFilter) {
1291
- return window.location !== window.parent.location;
1292
- } else {
1293
- return window.location === window.parent.location;
1294
- }
1295
- });
1296
- }
1297
- if (options.childFilter != null) {
1298
- possibleTargets = possibleTargets.filter((possibleTarget) => {
1299
- const oldBase = _Tools.base;
1300
- _Tools.setBase(possibleTarget);
1301
- const childResults = _Tools.find(options.childFilter);
1302
- _Tools.setBase(oldBase);
1303
- return childResults.target != null;
1304
- });
1305
- }
1306
- if (multiple) {
1307
- return possibleTargets;
1308
- } else {
1309
- if (possibleTargets.length > 1) {
1310
- console.warn(
1311
- "Multiple possible targets: ",
1312
- possibleTargets,
1313
- options,
1314
- parent
1315
- );
1316
- }
1317
- return possibleTargets[0];
1318
- }
1319
- }
1320
- static find(options, multiple = false) {
1321
- const results = [];
1322
- if (options.parent != null) {
1323
- const parent = _Tools.findElement(options.parent, null, multiple);
1324
- if (parent != null) {
1325
- if (parent instanceof Array) {
1326
- parent.forEach((p) => {
1327
- const targets = _Tools.findElement(options.target, p, multiple);
1328
- if (targets instanceof Array) {
1329
- targets.forEach((target) => {
1330
- results.push({
1331
- parent: p,
1332
- target
1333
- });
1334
- });
1335
- } else {
1336
- results.push({
1337
- parent: p,
1338
- target: targets
1339
- });
1340
- }
1341
- });
1342
- return results;
1343
- } else {
1344
- const targets = _Tools.findElement(options.target, parent, multiple);
1345
- if (targets instanceof Array) {
1346
- targets.forEach((target) => {
1347
- results.push({
1348
- parent,
1349
- target
1350
- });
1351
- });
1352
- } else {
1353
- results.push({
1354
- parent,
1355
- target: targets
1356
- });
1357
- }
1358
- }
1359
- }
1360
- } else {
1361
- const targets = _Tools.findElement(options.target, null, multiple);
1362
- if (targets instanceof Array) {
1363
- targets.forEach((target) => {
1364
- results.push({
1365
- parent: null,
1366
- target
1367
- });
1368
- });
1369
- } else {
1370
- results.push({
1371
- parent: null,
1372
- target: targets
1373
- });
1374
- }
1375
- }
1376
- if (results.length === 0) {
1377
- results.push({
1378
- parent: null,
1379
- target: null
1380
- });
1381
- }
1382
- if (multiple) {
1383
- return results;
1499
+ if (elementExists("#onetrust-pc-btn-handler")) {
1500
+ click("#onetrust-pc-btn-handler");
1384
1501
  } else {
1385
- if (results.length !== 1) {
1386
- console.warn(
1387
- "Multiple results found, even though multiple false",
1388
- results
1389
- );
1390
- }
1391
- return results[0];
1502
+ click(".ot-sdk-show-settings,button.js-cookie-settings");
1392
1503
  }
1504
+ await waitForElement("#onetrust-consent-sdk", 2e3);
1505
+ await wait(1e3);
1506
+ click("#onetrust-consent-sdk input.category-switch-handler:checked,.js-editor-toggle-state:checked", true);
1507
+ await wait(1e3);
1508
+ await waitForElement(".save-preference-btn-handler,.js-consent-save", 2e3);
1509
+ click(".save-preference-btn-handler,.js-consent-save");
1510
+ await waitFor(
1511
+ () => elementVisible("#onetrust-banner-sdk", "none"),
1512
+ 10,
1513
+ 500
1514
+ );
1515
+ return true;
1516
+ }
1517
+ async optIn() {
1518
+ return click("#onetrust-accept-btn-handler,.js-accept-cookies");
1519
+ }
1520
+ async test() {
1521
+ return await this.mainWorldEval("EVAL_ONETRUST_1");
1393
1522
  }
1394
1523
  };
1395
- _Tools.base = null;
1396
- var Tools = _Tools;
1397
1524
 
1398
- // lib/consentomatic/index.ts
1399
- function matches(config) {
1400
- const result = Tools.find(config);
1401
- if (config.type === "css") {
1402
- return !!result.target;
1403
- } else if (config.type === "checkbox") {
1404
- return !!result.target && result.target.checked;
1525
+ // lib/cmps/klaro.ts
1526
+ var Klaro = class extends AutoConsentCMPBase {
1527
+ constructor() {
1528
+ super(...arguments);
1529
+ this.name = "Klaro";
1530
+ this.prehideSelectors = [".klaro"];
1531
+ this.settingsOpen = false;
1405
1532
  }
1406
- }
1407
- async function executeAction(config, param) {
1408
- switch (config.type) {
1409
- case "click":
1410
- return clickAction(config);
1411
- case "list":
1412
- return listAction(config, param);
1413
- case "consent":
1414
- return consentAction(config, param);
1415
- case "ifcss":
1416
- return ifCssAction(config, param);
1417
- case "waitcss":
1418
- return waitCssAction(config);
1419
- case "foreach":
1420
- return forEachAction(config, param);
1421
- case "hide":
1422
- return hideAction(config);
1423
- case "slide":
1424
- return slideAction(config);
1425
- case "close":
1426
- return closeAction();
1427
- case "wait":
1428
- return waitAction(config);
1429
- case "eval":
1430
- return evalAction(config);
1431
- default:
1432
- throw "Unknown action type: " + config.type;
1533
+ get hasSelfTest() {
1534
+ return true;
1433
1535
  }
1434
- }
1435
- var STEP_TIMEOUT = 0;
1436
- function waitTimeout(timeout) {
1437
- return new Promise((resolve) => {
1438
- setTimeout(() => {
1439
- resolve();
1440
- }, timeout);
1441
- });
1442
- }
1443
- async function clickAction(config) {
1444
- const result = Tools.find(config);
1445
- if (result.target != null) {
1446
- result.target.click();
1536
+ get isIntermediate() {
1537
+ return false;
1447
1538
  }
1448
- return waitTimeout(STEP_TIMEOUT);
1449
- }
1450
- async function listAction(config, param) {
1451
- for (const action of config.actions) {
1452
- await executeAction(action, param);
1539
+ get isCosmetic() {
1540
+ return false;
1453
1541
  }
1454
- }
1455
- async function consentAction(config, consentTypes) {
1456
- for (const consentConfig of config.consents) {
1457
- const shouldEnable = consentTypes.indexOf(consentConfig.type) !== -1;
1458
- if (consentConfig.matcher && consentConfig.toggleAction) {
1459
- const isEnabled = matches(consentConfig.matcher);
1460
- if (isEnabled !== shouldEnable) {
1461
- await executeAction(consentConfig.toggleAction);
1462
- }
1463
- } else {
1464
- if (shouldEnable) {
1465
- await executeAction(consentConfig.trueAction);
1466
- } else {
1467
- await executeAction(consentConfig.falseAction);
1468
- }
1542
+ async detectCmp() {
1543
+ if (elementExists(".klaro > .cookie-modal")) {
1544
+ this.settingsOpen = true;
1545
+ return true;
1469
1546
  }
1547
+ return elementExists(".klaro > .cookie-notice");
1470
1548
  }
1471
- }
1472
- async function ifCssAction(config, param) {
1473
- const result = Tools.find(config);
1474
- if (!result.target) {
1475
- if (config.trueAction) {
1476
- await executeAction(config.trueAction, param);
1477
- }
1478
- } else {
1479
- if (config.falseAction) {
1480
- await executeAction(config.falseAction, param);
1481
- }
1549
+ async detectPopup() {
1550
+ return elementVisible(".klaro > .cookie-notice,.klaro > .cookie-modal", "any");
1482
1551
  }
1483
- }
1484
- async function waitCssAction(config) {
1485
- await new Promise((resolve) => {
1486
- let numRetries = config.retries || 10;
1487
- const waitTime = config.waitTime || 250;
1488
- const checkCss = () => {
1489
- const result = Tools.find(config);
1490
- if (config.negated && result.target || !config.negated && !result.target) {
1491
- if (numRetries > 0) {
1492
- numRetries -= 1;
1493
- setTimeout(checkCss, waitTime);
1494
- } else {
1495
- resolve();
1496
- }
1497
- } else {
1498
- resolve();
1499
- }
1500
- };
1501
- checkCss();
1502
- });
1503
- }
1504
- async function forEachAction(config, param) {
1505
- const results = Tools.find(config, true);
1506
- const oldBase = Tools.base;
1507
- for (const result of results) {
1508
- if (result.target) {
1509
- Tools.setBase(result.target);
1510
- await executeAction(config.action, param);
1552
+ async optOut() {
1553
+ if (click(".klaro .cn-decline")) {
1554
+ return true;
1511
1555
  }
1512
- }
1513
- Tools.setBase(oldBase);
1514
- }
1515
- async function hideAction(config) {
1516
- const result = Tools.find(config);
1517
- if (result.target) {
1518
- result.target.classList.add("Autoconsent-Hidden");
1519
- }
1520
- }
1521
- async function slideAction(config) {
1522
- const result = Tools.find(config);
1523
- const dragResult = Tools.find(config.dragTarget);
1524
- if (result.target) {
1525
- const targetBounds = result.target.getBoundingClientRect();
1526
- const dragTargetBounds = dragResult.target.getBoundingClientRect();
1527
- let yDiff = dragTargetBounds.top - targetBounds.top;
1528
- let xDiff = dragTargetBounds.left - targetBounds.left;
1529
- if (this.config.axis.toLowerCase() === "y") {
1530
- xDiff = 0;
1556
+ if (!this.settingsOpen) {
1557
+ click(".klaro .cn-learn-more");
1558
+ await waitForElement(".klaro > .cookie-modal", 2e3);
1559
+ this.settingsOpen = true;
1531
1560
  }
1532
- if (this.config.axis.toLowerCase() === "x") {
1533
- yDiff = 0;
1561
+ if (click(".klaro .cn-decline")) {
1562
+ return true;
1534
1563
  }
1535
- const screenX = window.screenX + targetBounds.left + targetBounds.width / 2;
1536
- const screenY = window.screenY + targetBounds.top + targetBounds.height / 2;
1537
- const clientX = targetBounds.left + targetBounds.width / 2;
1538
- const clientY = targetBounds.top + targetBounds.height / 2;
1539
- const mouseDown = document.createEvent("MouseEvents");
1540
- mouseDown.initMouseEvent(
1541
- "mousedown",
1542
- true,
1543
- true,
1544
- window,
1545
- 0,
1546
- screenX,
1547
- screenY,
1548
- clientX,
1549
- clientY,
1550
- false,
1551
- false,
1552
- false,
1553
- false,
1554
- 0,
1555
- result.target
1556
- );
1557
- const mouseMove = document.createEvent("MouseEvents");
1558
- mouseMove.initMouseEvent(
1559
- "mousemove",
1560
- true,
1561
- true,
1562
- window,
1563
- 0,
1564
- screenX + xDiff,
1565
- screenY + yDiff,
1566
- clientX + xDiff,
1567
- clientY + yDiff,
1568
- false,
1569
- false,
1570
- false,
1571
- false,
1572
- 0,
1573
- result.target
1574
- );
1575
- const mouseUp = document.createEvent("MouseEvents");
1576
- mouseUp.initMouseEvent(
1577
- "mouseup",
1578
- true,
1579
- true,
1580
- window,
1581
- 0,
1582
- screenX + xDiff,
1583
- screenY + yDiff,
1584
- clientX + xDiff,
1585
- clientY + yDiff,
1586
- false,
1587
- false,
1588
- false,
1589
- false,
1590
- 0,
1591
- result.target
1592
- );
1593
- result.target.dispatchEvent(mouseDown);
1594
- await this.waitTimeout(10);
1595
- result.target.dispatchEvent(mouseMove);
1596
- await this.waitTimeout(10);
1597
- result.target.dispatchEvent(mouseUp);
1564
+ click(".cm-purpose:not(.cm-toggle-all) > input:not(.half-checked)", true);
1565
+ return click(".cm-btn-accept");
1598
1566
  }
1599
- }
1600
- async function waitAction(config) {
1601
- await waitTimeout(config.waitTime);
1602
- }
1603
- async function closeAction() {
1604
- window.close();
1605
- }
1606
- async function evalAction(config) {
1607
- console.log("eval!", config.code);
1608
- return new Promise((resolve) => {
1609
- try {
1610
- if (config.async) {
1611
- window.eval(config.code);
1612
- setTimeout(() => {
1613
- resolve(window.eval("window.__consentCheckResult"));
1614
- }, config.timeout || 250);
1615
- } else {
1616
- resolve(window.eval(config.code));
1617
- }
1618
- } catch (e) {
1619
- console.warn("eval error", e, config.code);
1620
- resolve(false);
1567
+ async optIn() {
1568
+ if (click(".klaro .cm-btn-accept-all")) {
1569
+ return true;
1621
1570
  }
1622
- });
1623
- }
1571
+ if (this.settingsOpen) {
1572
+ click(".cm-purpose:not(.cm-toggle-all) > input.half-checked", true);
1573
+ return click(".cm-btn-accept");
1574
+ }
1575
+ return click(".klaro .cookie-notice .cm-btn-success");
1576
+ }
1577
+ async test() {
1578
+ return await this.mainWorldEval("EVAL_KLARO_1");
1579
+ }
1580
+ };
1624
1581
 
1625
- // lib/cmps/consentomatic.ts
1626
- var ConsentOMaticCMP = class {
1627
- constructor(name, config) {
1628
- this.name = name;
1629
- this.config = config;
1630
- this.methods = /* @__PURE__ */ new Map();
1631
- this.runContext = defaultRunContext;
1632
- this.isCosmetic = false;
1633
- config.methods.forEach((methodConfig) => {
1634
- if (methodConfig.action) {
1635
- this.methods.set(methodConfig.name, methodConfig.action);
1636
- }
1637
- });
1638
- this.hasSelfTest = false;
1582
+ // lib/cmps/uniconsent.ts
1583
+ var Uniconsent = class extends AutoConsentCMPBase {
1584
+ constructor() {
1585
+ super(...arguments);
1586
+ this.name = "Uniconsent";
1587
+ }
1588
+ get prehideSelectors() {
1589
+ return [".unic", ".modal:has(.unic)"];
1590
+ }
1591
+ get hasSelfTest() {
1592
+ return true;
1639
1593
  }
1640
1594
  get isIntermediate() {
1641
1595
  return false;
1642
1596
  }
1643
- checkRunContext() {
1644
- return true;
1597
+ get isCosmetic() {
1598
+ return false;
1645
1599
  }
1646
1600
  async detectCmp() {
1647
- const matchResults = this.config.detectors.map(
1648
- (detectorConfig) => matches(detectorConfig.presentMatcher)
1649
- );
1650
- return matchResults.some((r) => !!r);
1601
+ return elementExists(".unic .unic-box,.unic .unic-bar");
1651
1602
  }
1652
1603
  async detectPopup() {
1653
- const matchResults = this.config.detectors.map(
1654
- (detectorConfig) => matches(detectorConfig.showingMatcher)
1655
- );
1656
- return matchResults.some((r) => !!r);
1604
+ return elementVisible(".unic .unic-box,.unic .unic-bar", "any");
1657
1605
  }
1658
- async executeAction(method, param) {
1659
- if (this.methods.has(method)) {
1660
- return executeAction(this.methods.get(method), param);
1606
+ async optOut() {
1607
+ await waitForElement(".unic button", 1e3);
1608
+ document.querySelectorAll(".unic button").forEach((button) => {
1609
+ const text = button.textContent;
1610
+ if (text.includes("Manage Options") || text.includes("Optionen verwalten")) {
1611
+ button.click();
1612
+ }
1613
+ });
1614
+ if (await waitForElement(".unic input[type=checkbox]", 1e3)) {
1615
+ await waitForElement(".unic button", 1e3);
1616
+ document.querySelectorAll(".unic input[type=checkbox]").forEach((c) => {
1617
+ if (c.checked) {
1618
+ c.click();
1619
+ }
1620
+ });
1621
+ for (const b of document.querySelectorAll(".unic button")) {
1622
+ const text = b.textContent;
1623
+ for (const pattern of ["Confirm Choices", "Save Choices", "Auswahl speichern"]) {
1624
+ if (text.includes(pattern)) {
1625
+ b.click();
1626
+ await wait(500);
1627
+ return true;
1628
+ }
1629
+ }
1630
+ }
1661
1631
  }
1632
+ return false;
1633
+ }
1634
+ async optIn() {
1635
+ return waitForThenClick(".unic #unic-agree");
1636
+ }
1637
+ async test() {
1638
+ await wait(1e3);
1639
+ const res = elementExists(".unic .unic-box,.unic .unic-bar");
1640
+ return !res;
1641
+ }
1642
+ };
1643
+
1644
+ // lib/cmps/conversant.ts
1645
+ var Conversant = class extends AutoConsentCMPBase {
1646
+ constructor() {
1647
+ super(...arguments);
1648
+ this.prehideSelectors = [".cmp-root"];
1649
+ this.name = "Conversant";
1650
+ }
1651
+ get hasSelfTest() {
1662
1652
  return true;
1663
1653
  }
1654
+ get isIntermediate() {
1655
+ return false;
1656
+ }
1657
+ get isCosmetic() {
1658
+ return false;
1659
+ }
1660
+ async detectCmp() {
1661
+ return elementExists(".cmp-root .cmp-receptacle");
1662
+ }
1663
+ async detectPopup() {
1664
+ return elementVisible(".cmp-root .cmp-receptacle", "any");
1665
+ }
1664
1666
  async optOut() {
1665
- await this.executeAction("HIDE_CMP");
1666
- await this.executeAction("OPEN_OPTIONS");
1667
- await this.executeAction("HIDE_CMP");
1668
- await this.executeAction("DO_CONSENT", []);
1669
- await this.executeAction("SAVE_CONSENT");
1667
+ if (!await waitForThenClick(".cmp-main-button:not(.cmp-main-button--primary)")) {
1668
+ return false;
1669
+ }
1670
+ if (!await waitForElement(".cmp-view-tab-tabs")) {
1671
+ return false;
1672
+ }
1673
+ await waitForThenClick(".cmp-view-tab-tabs > :first-child");
1674
+ await waitForThenClick(".cmp-view-tab-tabs > .cmp-view-tab--active:first-child");
1675
+ for (const item of Array.from(document.querySelectorAll(".cmp-accordion-item"))) {
1676
+ item.querySelector(".cmp-accordion-item-title").click();
1677
+ await waitFor(() => !!item.querySelector(".cmp-accordion-item-content.cmp-active"), 10, 50);
1678
+ const content = item.querySelector(".cmp-accordion-item-content.cmp-active");
1679
+ content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-deny:not(.cmp-toggle-deny--active)").forEach((e) => e.click());
1680
+ content.querySelectorAll(".cmp-toggle-actions .cmp-toggle-checkbox:not(.cmp-toggle-checkbox--active)").forEach((e) => e.click());
1681
+ }
1682
+ await click(".cmp-main-button:not(.cmp-main-button--primary)");
1670
1683
  return true;
1671
1684
  }
1672
1685
  async optIn() {
1673
- await this.executeAction("HIDE_CMP");
1674
- await this.executeAction("OPEN_OPTIONS");
1675
- await this.executeAction("HIDE_CMP");
1676
- await this.executeAction("DO_CONSENT", ["D", "A", "B", "E", "F", "X"]);
1677
- await this.executeAction("SAVE_CONSENT");
1678
- return true;
1686
+ return waitForThenClick(".cmp-main-button.cmp-main-button--primary");
1679
1687
  }
1680
- async openCmp() {
1681
- await this.executeAction("HIDE_CMP");
1682
- await this.executeAction("OPEN_OPTIONS");
1688
+ async test() {
1689
+ return document.cookie.includes("cmp-data=0");
1690
+ }
1691
+ };
1692
+
1693
+ // lib/cmps/tiktok.ts
1694
+ var Tiktok = class extends AutoConsentCMPBase {
1695
+ constructor() {
1696
+ super(...arguments);
1697
+ this.name = "tiktok.com";
1698
+ this.runContext = {
1699
+ urlPattern: "tiktok"
1700
+ };
1701
+ }
1702
+ get hasSelfTest() {
1683
1703
  return true;
1684
1704
  }
1705
+ get isIntermediate() {
1706
+ return false;
1707
+ }
1708
+ get isCosmetic() {
1709
+ return false;
1710
+ }
1711
+ getShadowRoot() {
1712
+ const container = document.querySelector("tiktok-cookie-banner");
1713
+ if (!container) {
1714
+ return null;
1715
+ }
1716
+ return container.shadowRoot;
1717
+ }
1718
+ async detectCmp() {
1719
+ return elementExists("tiktok-cookie-banner");
1720
+ }
1721
+ async detectPopup() {
1722
+ const banner = this.getShadowRoot().querySelector(".tiktok-cookie-banner");
1723
+ return isElementVisible(banner);
1724
+ }
1725
+ async optOut() {
1726
+ const declineButton = this.getShadowRoot().querySelector(".button-wrapper button:first-child");
1727
+ if (declineButton) {
1728
+ enableLogs && console.log("[clicking]", declineButton);
1729
+ declineButton.click();
1730
+ return true;
1731
+ } else {
1732
+ enableLogs && console.log("no decline button found");
1733
+ return false;
1734
+ }
1735
+ }
1736
+ async optIn() {
1737
+ const acceptButton = this.getShadowRoot().querySelector(".button-wrapper button:last-child");
1738
+ if (acceptButton) {
1739
+ enableLogs && console.log("[clicking]", acceptButton);
1740
+ acceptButton.click();
1741
+ return true;
1742
+ } else {
1743
+ enableLogs && console.log("no accept button found");
1744
+ return false;
1745
+ }
1746
+ }
1685
1747
  async test() {
1748
+ const match = document.cookie.match(/cookie-consent=([^;]+)/);
1749
+ if (!match) {
1750
+ return false;
1751
+ }
1752
+ const value = JSON.parse(decodeURIComponent(match[1]));
1753
+ return Object.values(value).every((x) => typeof x !== "boolean" || x === false);
1754
+ }
1755
+ };
1756
+
1757
+ // lib/cmps/airbnb.ts
1758
+ var Airbnb = class extends AutoConsentCMPBase {
1759
+ constructor() {
1760
+ super(...arguments);
1761
+ this.runContext = {
1762
+ urlPattern: "^https://(www\\.)?airbnb\\.[^/]+/"
1763
+ };
1764
+ this.prehideSelectors = [
1765
+ "div[data-testid=main-cookies-banner-container]",
1766
+ 'div:has(> div:first-child):has(> div:last-child):has(> section [data-testid="strictly-necessary-cookies"])'
1767
+ ];
1768
+ }
1769
+ get hasSelfTest() {
1686
1770
  return true;
1687
1771
  }
1772
+ get isIntermediate() {
1773
+ return false;
1774
+ }
1775
+ get isCosmetic() {
1776
+ return false;
1777
+ }
1778
+ async detectCmp() {
1779
+ return elementExists("div[data-testid=main-cookies-banner-container]");
1780
+ }
1781
+ async detectPopup() {
1782
+ return elementVisible("div[data-testid=main-cookies-banner-container", "any");
1783
+ }
1784
+ async optOut() {
1785
+ await waitForThenClick("div[data-testid=main-cookies-banner-container] button._snbhip0");
1786
+ let check;
1787
+ while (check = document.querySelector("[data-testid=modal-container] button[aria-checked=true]:not([disabled])")) {
1788
+ check.click();
1789
+ }
1790
+ return waitForThenClick("button[data-testid=save-btn]");
1791
+ }
1792
+ async optIn() {
1793
+ return waitForThenClick("div[data-testid=main-cookies-banner-container] button._148dgdpk");
1794
+ }
1795
+ async test() {
1796
+ return await waitFor(
1797
+ () => !!document.cookie.match("OptanonAlertBoxClosed"),
1798
+ 20,
1799
+ 200
1800
+ );
1801
+ }
1688
1802
  };
1689
1803
 
1804
+ // lib/cmps/all.ts
1805
+ var dynamicCMPs = [
1806
+ TrustArcTop,
1807
+ TrustArcFrame,
1808
+ Cookiebot,
1809
+ SourcePoint,
1810
+ ConsentManager,
1811
+ Evidon,
1812
+ Onetrust,
1813
+ Klaro,
1814
+ Uniconsent,
1815
+ Conversant,
1816
+ Tiktok,
1817
+ Airbnb
1818
+ ];
1819
+
1690
1820
  // lib/web.ts
1691
- function filterCMPs(rules3, config) {
1692
- return rules3.filter((cmp) => {
1821
+ function filterCMPs(rules, config) {
1822
+ return rules.filter((cmp) => {
1693
1823
  return (!config.disabledCmps || !config.disabledCmps.includes(cmp.name)) && (config.enableCosmeticRules || !cmp.isCosmetic);
1694
1824
  });
1695
1825
  }
@@ -1708,14 +1838,15 @@ var AutoConsent = class {
1708
1838
  };
1709
1839
  evalState.sendContentMessage = sendContentMessage;
1710
1840
  this.sendContentMessage = sendContentMessage;
1711
- this.rules = [...rules2];
1841
+ this.rules = [];
1712
1842
  enableLogs && console.log("autoconsent init", window.location.href);
1713
1843
  this.updateState({ lifecycle: "loading" });
1844
+ this.addDynamicRules();
1714
1845
  if (config) {
1715
1846
  this.initialize(config, declarativeRules);
1716
1847
  } else {
1717
1848
  if (declarativeRules) {
1718
- this.parseRules(declarativeRules);
1849
+ this.parseDeclarativeRules(declarativeRules);
1719
1850
  }
1720
1851
  const initMsg = {
1721
1852
  type: "init",
@@ -1732,7 +1863,7 @@ var AutoConsent = class {
1732
1863
  return;
1733
1864
  }
1734
1865
  if (declarativeRules) {
1735
- this.parseRules(declarativeRules);
1866
+ this.parseDeclarativeRules(declarativeRules);
1736
1867
  }
1737
1868
  this.rules = filterCMPs(this.rules, config);
1738
1869
  if (config.enablePrehide) {
@@ -1757,17 +1888,22 @@ var AutoConsent = class {
1757
1888
  }
1758
1889
  this.updateState({ lifecycle: "initialized" });
1759
1890
  }
1760
- parseRules(declarativeRules) {
1891
+ addDynamicRules() {
1892
+ dynamicCMPs.forEach((cmp) => {
1893
+ this.rules.push(new cmp(this));
1894
+ });
1895
+ }
1896
+ parseDeclarativeRules(declarativeRules) {
1761
1897
  Object.keys(declarativeRules.consentomatic).forEach((name) => {
1762
1898
  this.addConsentomaticCMP(name, declarativeRules.consentomatic[name]);
1763
1899
  });
1764
- declarativeRules.autoconsent.forEach((rule) => {
1765
- this.addCMP(rule);
1900
+ declarativeRules.autoconsent.forEach((ruleset) => {
1901
+ this.addDeclarativeCMP(ruleset);
1766
1902
  });
1767
1903
  enableLogs && console.log("added rules", this.rules);
1768
1904
  }
1769
- addCMP(config) {
1770
- this.rules.push(createAutoCMP(config));
1905
+ addDeclarativeCMP(ruleset) {
1906
+ this.rules.push(new AutoConsentCMP(ruleset, this));
1771
1907
  }
1772
1908
  addConsentomaticCMP(name, config) {
1773
1909
  this.rules.push(new ConsentOMaticCMP(`com_${name}`, config));
@@ -1867,7 +2003,10 @@ var AutoConsent = class {
1867
2003
  });
1868
2004
  result.push(cmp);
1869
2005
  }
1870
- }).catch(() => null));
2006
+ }).catch((e) => {
2007
+ enableLogs && console.warn(`error waiting for a popup for ${cmp.name}`, e);
2008
+ return null;
2009
+ }));
1871
2010
  await Promise.all(popupLookups);
1872
2011
  return result;
1873
2012
  }
@@ -1960,7 +2099,10 @@ var AutoConsent = class {
1960
2099
  }
1961
2100
  async waitForPopup(cmp, retries = 5, interval = 500) {
1962
2101
  enableLogs && console.log("checking if popup is open...", cmp.name);
1963
- const isOpen = await cmp.detectPopup();
2102
+ const isOpen = await cmp.detectPopup().catch((e) => {
2103
+ enableLogs && console.warn(`error detecting popup for ${cmp.name}`, e);
2104
+ return false;
2105
+ });
1964
2106
  if (!isOpen && retries > 0) {
1965
2107
  await wait(interval);
1966
2108
  return this.waitForPopup(cmp, retries - 1, interval);
@@ -2024,8 +2166,3 @@ var AutoConsent = class {
2024
2166
  }
2025
2167
  }
2026
2168
  };
2027
- // Annotate the CommonJS export names for ESM import in node:
2028
- 0 && (module.exports = {
2029
- createAutoCMP,
2030
- rules
2031
- });