@dreamsengine/dreams-ad-engine 0.2.0 → 0.3.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.
@@ -3,18 +3,18 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const j = globalThis, Z = j.ShadowRoot && (j.ShadyCSS === void 0 || j.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ut = Symbol(), tt = /* @__PURE__ */ new WeakMap();
7
- let zt = class {
6
+ const W = globalThis, nt = W.ShadowRoot && (W.ShadyCSS === void 0 || W.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ot = Symbol(), ct = /* @__PURE__ */ new WeakMap();
7
+ let It = class {
8
8
  constructor(t, e, i) {
9
- if (this._$cssResult$ = !0, i !== ut) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
9
+ if (this._$cssResult$ = !0, i !== ot) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
10
10
  this.cssText = t, this.t = e;
11
11
  }
12
12
  get styleSheet() {
13
13
  let t = this.o;
14
14
  const e = this.t;
15
- if (Z && t === void 0) {
15
+ if (nt && t === void 0) {
16
16
  const i = e !== void 0 && e.length === 1;
17
- i && (t = tt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && tt.set(e, t));
17
+ i && (t = ct.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && ct.set(e, t));
18
18
  }
19
19
  return t;
20
20
  }
@@ -22,26 +22,33 @@ let zt = class {
22
22
  return this.cssText;
23
23
  }
24
24
  };
25
- const ft = (n) => new zt(typeof n == "string" ? n : n + "", void 0, ut), Et = (n, t) => {
26
- if (Z) n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
25
+ const Ut = (n) => new It(typeof n == "string" ? n : n + "", void 0, ot), qt = (n, ...t) => {
26
+ const e = n.length === 1 ? n[0] : t.reduce((i, s, r) => i + ((o) => {
27
+ if (o._$cssResult$ === !0) return o.cssText;
28
+ if (typeof o == "number") return o;
29
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
30
+ })(s) + n[r + 1], n[0]);
31
+ return new It(e, n, ot);
32
+ }, Wt = (n, t) => {
33
+ if (nt) n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
27
34
  else for (const e of t) {
28
- const i = document.createElement("style"), s = j.litNonce;
35
+ const i = document.createElement("style"), s = W.litNonce;
29
36
  s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, n.appendChild(i);
30
37
  }
31
- }, et = Z ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
38
+ }, ht = nt ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
32
39
  let e = "";
33
40
  for (const i of t.cssRules) e += i.cssText;
34
- return ft(e);
41
+ return Ut(e);
35
42
  })(n) : n;
36
43
  /**
37
44
  * @license
38
45
  * Copyright 2017 Google LLC
39
46
  * SPDX-License-Identifier: BSD-3-Clause
40
47
  */
41
- const { is: xt, defineProperty: It, getOwnPropertyDescriptor: Pt, getOwnPropertyNames: Ct, getOwnPropertySymbols: Ut, getPrototypeOf: Tt } = Object, m = globalThis, it = m.trustedTypes, kt = it ? it.emptyScript : "", q = m.reactiveElementPolyfillSupport, U = (n, t) => n, B = { toAttribute(n, t) {
48
+ const { is: Gt, defineProperty: Jt, getOwnPropertyDescriptor: Kt, getOwnPropertyNames: Zt, getOwnPropertySymbols: Xt, getPrototypeOf: Yt } = Object, b = globalThis, pt = b.trustedTypes, Qt = pt ? pt.emptyScript : "", Q = b.reactiveElementPolyfillSupport, I = (n, t) => n, G = { toAttribute(n, t) {
42
49
  switch (t) {
43
50
  case Boolean:
44
- n = n ? kt : null;
51
+ n = n ? Qt : null;
45
52
  break;
46
53
  case Object:
47
54
  case Array:
@@ -66,44 +73,44 @@ const { is: xt, defineProperty: It, getOwnPropertyDescriptor: Pt, getOwnProperty
66
73
  }
67
74
  }
68
75
  return e;
69
- } }, Y = (n, t) => !xt(n, t), st = { attribute: !0, type: String, converter: B, reflect: !1, useDefault: !1, hasChanged: Y };
70
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), m.litPropertyMetadata ?? (m.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
71
- let z = class extends HTMLElement {
76
+ } }, rt = (n, t) => !Gt(n, t), ut = { attribute: !0, type: String, converter: G, reflect: !1, useDefault: !1, hasChanged: rt };
77
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), b.litPropertyMetadata ?? (b.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
+ let T = class extends HTMLElement {
72
79
  static addInitializer(t) {
73
80
  this._$Ei(), (this.l ?? (this.l = [])).push(t);
74
81
  }
75
82
  static get observedAttributes() {
76
83
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
77
84
  }
78
- static createProperty(t, e = st) {
85
+ static createProperty(t, e = ut) {
79
86
  if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
80
87
  const i = Symbol(), s = this.getPropertyDescriptor(t, i, e);
81
- s !== void 0 && It(this.prototype, t, s);
88
+ s !== void 0 && Jt(this.prototype, t, s);
82
89
  }
83
90
  }
84
91
  static getPropertyDescriptor(t, e, i) {
85
- const { get: s, set: o } = Pt(this.prototype, t) ?? { get() {
92
+ const { get: s, set: r } = Kt(this.prototype, t) ?? { get() {
86
93
  return this[e];
87
- }, set(r) {
88
- this[e] = r;
94
+ }, set(o) {
95
+ this[e] = o;
89
96
  } };
90
- return { get: s, set(r) {
91
- const a = s == null ? void 0 : s.call(this);
92
- o == null || o.call(this, r), this.requestUpdate(t, a, i);
97
+ return { get: s, set(o) {
98
+ const l = s == null ? void 0 : s.call(this);
99
+ r == null || r.call(this, o), this.requestUpdate(t, l, i);
93
100
  }, configurable: !0, enumerable: !0 };
94
101
  }
95
102
  static getPropertyOptions(t) {
96
- return this.elementProperties.get(t) ?? st;
103
+ return this.elementProperties.get(t) ?? ut;
97
104
  }
98
105
  static _$Ei() {
99
- if (this.hasOwnProperty(U("elementProperties"))) return;
100
- const t = Tt(this);
106
+ if (this.hasOwnProperty(I("elementProperties"))) return;
107
+ const t = Yt(this);
101
108
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
102
109
  }
103
110
  static finalize() {
104
- if (this.hasOwnProperty(U("finalized"))) return;
105
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
106
- const e = this.properties, i = [...Ct(e), ...Ut(e)];
111
+ if (this.hasOwnProperty(I("finalized"))) return;
112
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(I("properties"))) {
113
+ const e = this.properties, i = [...Zt(e), ...Xt(e)];
107
114
  for (const s of i) this.createProperty(s, e[s]);
108
115
  }
109
116
  const t = this[Symbol.metadata];
@@ -122,8 +129,8 @@ let z = class extends HTMLElement {
122
129
  const e = [];
123
130
  if (Array.isArray(t)) {
124
131
  const i = new Set(t.flat(1 / 0).reverse());
125
- for (const s of i) e.unshift(et(s));
126
- } else t !== void 0 && e.push(et(t));
132
+ for (const s of i) e.unshift(ht(s));
133
+ } else t !== void 0 && e.push(ht(t));
127
134
  return e;
128
135
  }
129
136
  static _$Eu(t, e) {
@@ -152,7 +159,7 @@ let z = class extends HTMLElement {
152
159
  }
153
160
  createRenderRoot() {
154
161
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
155
- return Et(t, this.constructor.elementStyles), t;
162
+ return Wt(t, this.constructor.elementStyles), t;
156
163
  }
157
164
  connectedCallback() {
158
165
  var t;
@@ -174,34 +181,34 @@ let z = class extends HTMLElement {
174
181
  this._$AK(t, i);
175
182
  }
176
183
  _$ET(t, e) {
177
- var o;
184
+ var r;
178
185
  const i = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, i);
179
186
  if (s !== void 0 && i.reflect === !0) {
180
- const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : B).toAttribute(e, i.type);
181
- this._$Em = t, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
187
+ const o = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter : G).toAttribute(e, i.type);
188
+ this._$Em = t, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
182
189
  }
183
190
  }
184
191
  _$AK(t, e) {
185
- var o, r;
192
+ var r, o;
186
193
  const i = this.constructor, s = i._$Eh.get(t);
187
194
  if (s !== void 0 && this._$Em !== s) {
188
- const a = i.getPropertyOptions(s), d = typeof a.converter == "function" ? { fromAttribute: a.converter } : ((o = a.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? a.converter : B;
195
+ const l = i.getPropertyOptions(s), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((r = l.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? l.converter : G;
189
196
  this._$Em = s;
190
- const h = d.fromAttribute(e, a.type);
191
- this[s] = h ?? ((r = this._$Ej) == null ? void 0 : r.get(s)) ?? h, this._$Em = null;
197
+ const c = a.fromAttribute(e, l.type);
198
+ this[s] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(s)) ?? c, this._$Em = null;
192
199
  }
193
200
  }
194
- requestUpdate(t, e, i, s = !1, o) {
195
- var r;
201
+ requestUpdate(t, e, i, s = !1, r) {
202
+ var o;
196
203
  if (t !== void 0) {
197
- const a = this.constructor;
198
- if (s === !1 && (o = this[t]), i ?? (i = a.getPropertyOptions(t)), !((i.hasChanged ?? Y)(o, e) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(t)) && !this.hasAttribute(a._$Eu(t, i)))) return;
204
+ const l = this.constructor;
205
+ if (s === !1 && (r = this[t]), i ?? (i = l.getPropertyOptions(t)), !((i.hasChanged ?? rt)(r, e) || i.useDefault && i.reflect && r === ((o = this._$Ej) == null ? void 0 : o.get(t)) && !this.hasAttribute(l._$Eu(t, i)))) return;
199
206
  this.C(t, e, i);
200
207
  }
201
208
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
202
209
  }
203
- C(t, e, { useDefault: i, reflect: s, wrapped: o }, r) {
204
- i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, r ?? e ?? this[t]), o !== !0 || r !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), s === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
210
+ C(t, e, { useDefault: i, reflect: s, wrapped: r }, o) {
211
+ i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), s === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
205
212
  }
206
213
  async _$EP() {
207
214
  this.isUpdatePending = !0;
@@ -221,21 +228,21 @@ let z = class extends HTMLElement {
221
228
  if (!this.isUpdatePending) return;
222
229
  if (!this.hasUpdated) {
223
230
  if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
224
- for (const [o, r] of this._$Ep) this[o] = r;
231
+ for (const [r, o] of this._$Ep) this[r] = o;
225
232
  this._$Ep = void 0;
226
233
  }
227
234
  const s = this.constructor.elementProperties;
228
- if (s.size > 0) for (const [o, r] of s) {
229
- const { wrapped: a } = r, d = this[o];
230
- a !== !0 || this._$AL.has(o) || d === void 0 || this.C(o, void 0, r, d);
235
+ if (s.size > 0) for (const [r, o] of s) {
236
+ const { wrapped: l } = o, a = this[r];
237
+ l !== !0 || this._$AL.has(r) || a === void 0 || this.C(r, void 0, o, a);
231
238
  }
232
239
  }
233
240
  let t = !1;
234
241
  const e = this._$AL;
235
242
  try {
236
243
  t = this.shouldUpdate(e), t ? (this.willUpdate(e), (i = this._$EO) == null || i.forEach((s) => {
237
- var o;
238
- return (o = s.hostUpdate) == null ? void 0 : o.call(s);
244
+ var r;
245
+ return (r = s.hostUpdate) == null ? void 0 : r.call(s);
239
246
  }), this.update(e)) : this._$EM();
240
247
  } catch (s) {
241
248
  throw t = !1, this._$EM(), s;
@@ -271,76 +278,76 @@ let z = class extends HTMLElement {
271
278
  firstUpdated(t) {
272
279
  }
273
280
  };
274
- z.elementStyles = [], z.shadowRootOptions = { mode: "open" }, z[U("elementProperties")] = /* @__PURE__ */ new Map(), z[U("finalized")] = /* @__PURE__ */ new Map(), q == null || q({ ReactiveElement: z }), (m.reactiveElementVersions ?? (m.reactiveElementVersions = [])).push("2.1.2");
281
+ T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[I("elementProperties")] = /* @__PURE__ */ new Map(), T[I("finalized")] = /* @__PURE__ */ new Map(), Q == null || Q({ ReactiveElement: T }), (b.reactiveElementVersions ?? (b.reactiveElementVersions = [])).push("2.1.2");
275
282
  /**
276
283
  * @license
277
284
  * Copyright 2017 Google LLC
278
285
  * SPDX-License-Identifier: BSD-3-Clause
279
286
  */
280
- const T = globalThis, nt = (n) => n, F = T.trustedTypes, ot = F ? F.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, vt = "$lit$", y = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + y, Lt = `<${$t}>`, S = document, O = () => S.createComment(""), M = (n) => n === null || typeof n != "object" && typeof n != "function", Q = Array.isArray, Ot = (n) => Q(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", V = `[
281
- \f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, rt = /-->/g, at = />/g, _ = RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
282
- \f\r"'\`<>=]|("|')|))|$)`, "g"), dt = /'/g, lt = /"/g, yt = /^(?:script|style|textarea|title)$/i, Mt = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), C = Mt(1), x = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), ht = /* @__PURE__ */ new WeakMap(), b = S.createTreeWalker(S, 129);
283
- function mt(n, t) {
284
- if (!Q(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
285
- return ot !== void 0 ? ot.createHTML(t) : t;
287
+ const U = globalThis, gt = (n) => n, J = U.trustedTypes, ft = J ? J.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Ot = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, Dt = "?" + v, te = `<${Dt}>`, k = document, M = () => k.createComment(""), H = (n) => n === null || typeof n != "object" && typeof n != "function", at = Array.isArray, ee = (n) => at(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", tt = `[
288
+ \f\r]`, L = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, mt = /-->/g, wt = />/g, $ = RegExp(`>|${tt}(?:([^\\s"'>=/]+)(${tt}*=${tt}*(?:[^
289
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), yt = /'/g, vt = /"/g, Nt = /^(?:script|style|textarea|title)$/i, ie = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), y = ie(1), C = Symbol.for("lit-noChange"), f = Symbol.for("lit-nothing"), bt = /* @__PURE__ */ new WeakMap(), A = k.createTreeWalker(k, 129);
290
+ function Rt(n, t) {
291
+ if (!at(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
292
+ return ft !== void 0 ? ft.createHTML(t) : t;
286
293
  }
287
- const Nt = (n, t) => {
294
+ const se = (n, t) => {
288
295
  const e = n.length - 1, i = [];
289
- let s, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", r = P;
290
- for (let a = 0; a < e; a++) {
291
- const d = n[a];
292
- let h, f, p = -1, v = 0;
293
- for (; v < d.length && (r.lastIndex = v, f = r.exec(d), f !== null); ) v = r.lastIndex, r === P ? f[1] === "!--" ? r = rt : f[1] !== void 0 ? r = at : f[2] !== void 0 ? (yt.test(f[2]) && (s = RegExp("</" + f[2], "g")), r = _) : f[3] !== void 0 && (r = _) : r === _ ? f[0] === ">" ? (r = s ?? P, p = -1) : f[1] === void 0 ? p = -2 : (p = r.lastIndex - f[2].length, h = f[1], r = f[3] === void 0 ? _ : f[3] === '"' ? lt : dt) : r === lt || r === dt ? r = _ : r === rt || r === at ? r = P : (r = _, s = void 0);
294
- const $ = r === _ && n[a + 1].startsWith("/>") ? " " : "";
295
- o += r === P ? d + Lt : p >= 0 ? (i.push(h), d.slice(0, p) + vt + d.slice(p) + y + $) : d + y + (p === -2 ? a : $);
296
- }
297
- return [mt(n, o + (n[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
296
+ let s, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = L;
297
+ for (let l = 0; l < e; l++) {
298
+ const a = n[l];
299
+ let c, p, h = -1, m = 0;
300
+ for (; m < a.length && (o.lastIndex = m, p = o.exec(a), p !== null); ) m = o.lastIndex, o === L ? p[1] === "!--" ? o = mt : p[1] !== void 0 ? o = wt : p[2] !== void 0 ? (Nt.test(p[2]) && (s = RegExp("</" + p[2], "g")), o = $) : p[3] !== void 0 && (o = $) : o === $ ? p[0] === ">" ? (o = s ?? L, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? $ : p[3] === '"' ? vt : yt) : o === vt || o === yt ? o = $ : o === mt || o === wt ? o = L : (o = $, s = void 0);
301
+ const w = o === $ && n[l + 1].startsWith("/>") ? " " : "";
302
+ r += o === L ? a + te : h >= 0 ? (i.push(c), a.slice(0, h) + Ot + a.slice(h) + v + w) : a + v + (h === -2 ? l : w);
303
+ }
304
+ return [Rt(n, r + (n[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
298
305
  };
299
- class N {
306
+ class V {
300
307
  constructor({ strings: t, _$litType$: e }, i) {
301
308
  let s;
302
309
  this.parts = [];
303
- let o = 0, r = 0;
304
- const a = t.length - 1, d = this.parts, [h, f] = Nt(t, e);
305
- if (this.el = N.createElement(h, i), b.currentNode = this.el.content, e === 2 || e === 3) {
306
- const p = this.el.content.firstChild;
307
- p.replaceWith(...p.childNodes);
310
+ let r = 0, o = 0;
311
+ const l = t.length - 1, a = this.parts, [c, p] = se(t, e);
312
+ if (this.el = V.createElement(c, i), A.currentNode = this.el.content, e === 2 || e === 3) {
313
+ const h = this.el.content.firstChild;
314
+ h.replaceWith(...h.childNodes);
308
315
  }
309
- for (; (s = b.nextNode()) !== null && d.length < a; ) {
316
+ for (; (s = A.nextNode()) !== null && a.length < l; ) {
310
317
  if (s.nodeType === 1) {
311
- if (s.hasAttributes()) for (const p of s.getAttributeNames()) if (p.endsWith(vt)) {
312
- const v = f[r++], $ = s.getAttribute(p).split(y), R = /([.?@])?(.*)/.exec(v);
313
- d.push({ type: 1, index: o, name: R[2], strings: $, ctor: R[1] === "." ? Rt : R[1] === "?" ? Dt : R[1] === "@" ? jt : W }), s.removeAttribute(p);
314
- } else p.startsWith(y) && (d.push({ type: 6, index: o }), s.removeAttribute(p));
315
- if (yt.test(s.tagName)) {
316
- const p = s.textContent.split(y), v = p.length - 1;
317
- if (v > 0) {
318
- s.textContent = F ? F.emptyScript : "";
319
- for (let $ = 0; $ < v; $++) s.append(p[$], O()), b.nextNode(), d.push({ type: 2, index: ++o });
320
- s.append(p[v], O());
318
+ if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(Ot)) {
319
+ const m = p[o++], w = s.getAttribute(h).split(v), j = /([.?@])?(.*)/.exec(m);
320
+ a.push({ type: 1, index: r, name: j[2], strings: w, ctor: j[1] === "." ? oe : j[1] === "?" ? re : j[1] === "@" ? ae : Y }), s.removeAttribute(h);
321
+ } else h.startsWith(v) && (a.push({ type: 6, index: r }), s.removeAttribute(h));
322
+ if (Nt.test(s.tagName)) {
323
+ const h = s.textContent.split(v), m = h.length - 1;
324
+ if (m > 0) {
325
+ s.textContent = J ? J.emptyScript : "";
326
+ for (let w = 0; w < m; w++) s.append(h[w], M()), A.nextNode(), a.push({ type: 2, index: ++r });
327
+ s.append(h[m], M());
321
328
  }
322
329
  }
323
- } else if (s.nodeType === 8) if (s.data === $t) d.push({ type: 2, index: o });
330
+ } else if (s.nodeType === 8) if (s.data === Dt) a.push({ type: 2, index: r });
324
331
  else {
325
- let p = -1;
326
- for (; (p = s.data.indexOf(y, p + 1)) !== -1; ) d.push({ type: 7, index: o }), p += y.length - 1;
332
+ let h = -1;
333
+ for (; (h = s.data.indexOf(v, h + 1)) !== -1; ) a.push({ type: 7, index: r }), h += v.length - 1;
327
334
  }
328
- o++;
335
+ r++;
329
336
  }
330
337
  }
331
338
  static createElement(t, e) {
332
- const i = S.createElement("template");
339
+ const i = k.createElement("template");
333
340
  return i.innerHTML = t, i;
334
341
  }
335
342
  }
336
- function I(n, t, e = n, i) {
337
- var r, a;
338
- if (t === x) return t;
339
- let s = i !== void 0 ? (r = e._$Co) == null ? void 0 : r[i] : e._$Cl;
340
- const o = M(t) ? void 0 : t._$litDirective$;
341
- return (s == null ? void 0 : s.constructor) !== o && ((a = s == null ? void 0 : s._$AO) == null || a.call(s, !1), o === void 0 ? s = void 0 : (s = new o(n), s._$AT(n, e, i)), i !== void 0 ? (e._$Co ?? (e._$Co = []))[i] = s : e._$Cl = s), s !== void 0 && (t = I(n, s._$AS(n, t.values), s, i)), t;
343
+ function P(n, t, e = n, i) {
344
+ var o, l;
345
+ if (t === C) return t;
346
+ let s = i !== void 0 ? (o = e._$Co) == null ? void 0 : o[i] : e._$Cl;
347
+ const r = H(t) ? void 0 : t._$litDirective$;
348
+ return (s == null ? void 0 : s.constructor) !== r && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), r === void 0 ? s = void 0 : (s = new r(n), s._$AT(n, e, i)), i !== void 0 ? (e._$Co ?? (e._$Co = []))[i] = s : e._$Cl = s), s !== void 0 && (t = P(n, s._$AS(n, t.values), s, i)), t;
342
349
  }
343
- class Ht {
350
+ class ne {
344
351
  constructor(t, e) {
345
352
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
346
353
  }
@@ -351,30 +358,30 @@ class Ht {
351
358
  return this._$AM._$AU;
352
359
  }
353
360
  u(t) {
354
- const { el: { content: e }, parts: i } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? S).importNode(e, !0);
355
- b.currentNode = s;
356
- let o = b.nextNode(), r = 0, a = 0, d = i[0];
357
- for (; d !== void 0; ) {
358
- if (r === d.index) {
359
- let h;
360
- d.type === 2 ? h = new H(o, o.nextSibling, this, t) : d.type === 1 ? h = new d.ctor(o, d.name, d.strings, this, t) : d.type === 6 && (h = new Bt(o, this, t)), this._$AV.push(h), d = i[++a];
361
+ const { el: { content: e }, parts: i } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? k).importNode(e, !0);
362
+ A.currentNode = s;
363
+ let r = A.nextNode(), o = 0, l = 0, a = i[0];
364
+ for (; a !== void 0; ) {
365
+ if (o === a.index) {
366
+ let c;
367
+ a.type === 2 ? c = new B(r, r.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(r, a.name, a.strings, this, t) : a.type === 6 && (c = new le(r, this, t)), this._$AV.push(c), a = i[++l];
361
368
  }
362
- r !== (d == null ? void 0 : d.index) && (o = b.nextNode(), r++);
369
+ o !== (a == null ? void 0 : a.index) && (r = A.nextNode(), o++);
363
370
  }
364
- return b.currentNode = S, s;
371
+ return A.currentNode = k, s;
365
372
  }
366
373
  p(t) {
367
374
  let e = 0;
368
375
  for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
369
376
  }
370
377
  }
371
- class H {
378
+ class B {
372
379
  get _$AU() {
373
380
  var t;
374
381
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
375
382
  }
376
383
  constructor(t, e, i, s) {
377
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
384
+ this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
378
385
  }
379
386
  get parentNode() {
380
387
  let t = this._$AA.parentNode;
@@ -388,7 +395,7 @@ class H {
388
395
  return this._$AB;
389
396
  }
390
397
  _$AI(t, e = this) {
391
- t = I(this, t, e), M(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== x && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ot(t) ? this.k(t) : this._(t);
398
+ t = P(this, t, e), H(t) ? t === f || t == null || t === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : t !== this._$AH && t !== C && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : ee(t) ? this.k(t) : this._(t);
392
399
  }
393
400
  O(t) {
394
401
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -397,33 +404,33 @@ class H {
397
404
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
398
405
  }
399
406
  _(t) {
400
- this._$AH !== u && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t;
407
+ this._$AH !== f && H(this._$AH) ? this._$AA.nextSibling.data = t : this.T(k.createTextNode(t)), this._$AH = t;
401
408
  }
402
409
  $(t) {
403
- var o;
404
- const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = N.createElement(mt(i.h, i.h[0]), this.options)), i);
405
- if (((o = this._$AH) == null ? void 0 : o._$AD) === s) this._$AH.p(e);
410
+ var r;
411
+ const { values: e, _$litType$: i } = t, s = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = V.createElement(Rt(i.h, i.h[0]), this.options)), i);
412
+ if (((r = this._$AH) == null ? void 0 : r._$AD) === s) this._$AH.p(e);
406
413
  else {
407
- const r = new Ht(s, this), a = r.u(this.options);
408
- r.p(e), this.T(a), this._$AH = r;
414
+ const o = new ne(s, this), l = o.u(this.options);
415
+ o.p(e), this.T(l), this._$AH = o;
409
416
  }
410
417
  }
411
418
  _$AC(t) {
412
- let e = ht.get(t.strings);
413
- return e === void 0 && ht.set(t.strings, e = new N(t)), e;
419
+ let e = bt.get(t.strings);
420
+ return e === void 0 && bt.set(t.strings, e = new V(t)), e;
414
421
  }
415
422
  k(t) {
416
- Q(this._$AH) || (this._$AH = [], this._$AR());
423
+ at(this._$AH) || (this._$AH = [], this._$AR());
417
424
  const e = this._$AH;
418
425
  let i, s = 0;
419
- for (const o of t) s === e.length ? e.push(i = new H(this.O(O()), this.O(O()), this, this.options)) : i = e[s], i._$AI(o), s++;
426
+ for (const r of t) s === e.length ? e.push(i = new B(this.O(M()), this.O(M()), this, this.options)) : i = e[s], i._$AI(r), s++;
420
427
  s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
421
428
  }
422
429
  _$AR(t = this._$AA.nextSibling, e) {
423
430
  var i;
424
431
  for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, e); t !== this._$AB; ) {
425
- const s = nt(t).nextSibling;
426
- nt(t).remove(), t = s;
432
+ const s = gt(t).nextSibling;
433
+ gt(t).remove(), t = s;
427
434
  }
428
435
  }
429
436
  setConnected(t) {
@@ -431,62 +438,62 @@ class H {
431
438
  this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
432
439
  }
433
440
  }
434
- class W {
441
+ class Y {
435
442
  get tagName() {
436
443
  return this.element.tagName;
437
444
  }
438
445
  get _$AU() {
439
446
  return this._$AM._$AU;
440
447
  }
441
- constructor(t, e, i, s, o) {
442
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
448
+ constructor(t, e, i, s, r) {
449
+ this.type = 1, this._$AH = f, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = f;
443
450
  }
444
451
  _$AI(t, e = this, i, s) {
445
- const o = this.strings;
446
- let r = !1;
447
- if (o === void 0) t = I(this, t, e, 0), r = !M(t) || t !== this._$AH && t !== x, r && (this._$AH = t);
452
+ const r = this.strings;
453
+ let o = !1;
454
+ if (r === void 0) t = P(this, t, e, 0), o = !H(t) || t !== this._$AH && t !== C, o && (this._$AH = t);
448
455
  else {
449
- const a = t;
450
- let d, h;
451
- for (t = o[0], d = 0; d < o.length - 1; d++) h = I(this, a[i + d], e, d), h === x && (h = this._$AH[d]), r || (r = !M(h) || h !== this._$AH[d]), h === u ? t = u : t !== u && (t += (h ?? "") + o[d + 1]), this._$AH[d] = h;
456
+ const l = t;
457
+ let a, c;
458
+ for (t = r[0], a = 0; a < r.length - 1; a++) c = P(this, l[i + a], e, a), c === C && (c = this._$AH[a]), o || (o = !H(c) || c !== this._$AH[a]), c === f ? t = f : t !== f && (t += (c ?? "") + r[a + 1]), this._$AH[a] = c;
452
459
  }
453
- r && !s && this.j(t);
460
+ o && !s && this.j(t);
454
461
  }
455
462
  j(t) {
456
- t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
463
+ t === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
457
464
  }
458
465
  }
459
- class Rt extends W {
466
+ class oe extends Y {
460
467
  constructor() {
461
468
  super(...arguments), this.type = 3;
462
469
  }
463
470
  j(t) {
464
- this.element[this.name] = t === u ? void 0 : t;
471
+ this.element[this.name] = t === f ? void 0 : t;
465
472
  }
466
473
  }
467
- class Dt extends W {
474
+ class re extends Y {
468
475
  constructor() {
469
476
  super(...arguments), this.type = 4;
470
477
  }
471
478
  j(t) {
472
- this.element.toggleAttribute(this.name, !!t && t !== u);
479
+ this.element.toggleAttribute(this.name, !!t && t !== f);
473
480
  }
474
481
  }
475
- class jt extends W {
476
- constructor(t, e, i, s, o) {
477
- super(t, e, i, s, o), this.type = 5;
482
+ class ae extends Y {
483
+ constructor(t, e, i, s, r) {
484
+ super(t, e, i, s, r), this.type = 5;
478
485
  }
479
486
  _$AI(t, e = this) {
480
- if ((t = I(this, t, e, 0) ?? u) === x) return;
481
- const i = this._$AH, s = t === u && i !== u || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== u && (i === u || s);
482
- s && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
487
+ if ((t = P(this, t, e, 0) ?? f) === C) return;
488
+ const i = this._$AH, s = t === f && i !== f || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== f && (i === f || s);
489
+ s && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
483
490
  }
484
491
  handleEvent(t) {
485
492
  var e;
486
493
  typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
487
494
  }
488
495
  }
489
- class Bt {
496
+ class le {
490
497
  constructor(t, e, i) {
491
498
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
492
499
  }
@@ -494,17 +501,17 @@ class Bt {
494
501
  return this._$AM._$AU;
495
502
  }
496
503
  _$AI(t) {
497
- I(this, t);
504
+ P(this, t);
498
505
  }
499
506
  }
500
- const J = T.litHtmlPolyfillSupport;
501
- J == null || J(N, H), (T.litHtmlVersions ?? (T.litHtmlVersions = [])).push("3.3.2");
502
- const Ft = (n, t, e) => {
507
+ const et = U.litHtmlPolyfillSupport;
508
+ et == null || et(V, B), (U.litHtmlVersions ?? (U.litHtmlVersions = [])).push("3.3.2");
509
+ const de = (n, t, e) => {
503
510
  const i = (e == null ? void 0 : e.renderBefore) ?? t;
504
511
  let s = i._$litPart$;
505
512
  if (s === void 0) {
506
- const o = (e == null ? void 0 : e.renderBefore) ?? null;
507
- i._$litPart$ = s = new H(t.insertBefore(O(), o), o, void 0, e ?? {});
513
+ const r = (e == null ? void 0 : e.renderBefore) ?? null;
514
+ i._$litPart$ = s = new B(t.insertBefore(M(), r), r, void 0, e ?? {});
508
515
  }
509
516
  return s._$AI(n), s;
510
517
  };
@@ -513,8 +520,8 @@ const Ft = (n, t, e) => {
513
520
  * Copyright 2017 Google LLC
514
521
  * SPDX-License-Identifier: BSD-3-Clause
515
522
  */
516
- const A = globalThis;
517
- class k extends z {
523
+ const S = globalThis;
524
+ class z extends T {
518
525
  constructor() {
519
526
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
520
527
  }
@@ -525,7 +532,7 @@ class k extends z {
525
532
  }
526
533
  update(t) {
527
534
  const e = this.render();
528
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ft(e, this.renderRoot, this.renderOptions);
535
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = de(e, this.renderRoot, this.renderOptions);
529
536
  }
530
537
  connectedCallback() {
531
538
  var t;
@@ -536,20 +543,20 @@ class k extends z {
536
543
  super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
537
544
  }
538
545
  render() {
539
- return x;
546
+ return C;
540
547
  }
541
548
  }
542
- var gt;
543
- k._$litElement$ = !0, k.finalized = !0, (gt = A.litElementHydrateSupport) == null || gt.call(A, { LitElement: k });
544
- const K = A.litElementPolyfillSupport;
545
- K == null || K({ LitElement: k });
546
- (A.litElementVersions ?? (A.litElementVersions = [])).push("4.2.2");
549
+ var Lt;
550
+ z._$litElement$ = !0, z.finalized = !0, (Lt = S.litElementHydrateSupport) == null || Lt.call(S, { LitElement: z });
551
+ const it = S.litElementPolyfillSupport;
552
+ it == null || it({ LitElement: z });
553
+ (S.litElementVersions ?? (S.litElementVersions = [])).push("4.2.2");
547
554
  /**
548
555
  * @license
549
556
  * Copyright 2017 Google LLC
550
557
  * SPDX-License-Identifier: BSD-3-Clause
551
558
  */
552
- const Wt = (n) => (t, e) => {
559
+ const Mt = (n) => (t, e) => {
553
560
  e !== void 0 ? e.addInitializer(() => {
554
561
  customElements.define(n, t);
555
562
  }) : customElements.define(n, t);
@@ -559,31 +566,31 @@ const Wt = (n) => (t, e) => {
559
566
  * Copyright 2017 Google LLC
560
567
  * SPDX-License-Identifier: BSD-3-Clause
561
568
  */
562
- const qt = { attribute: !0, type: String, converter: B, reflect: !1, hasChanged: Y }, Vt = (n = qt, t, e) => {
569
+ const ce = { attribute: !0, type: String, converter: G, reflect: !1, hasChanged: rt }, he = (n = ce, t, e) => {
563
570
  const { kind: i, metadata: s } = e;
564
- let o = globalThis.litPropertyMetadata.get(s);
565
- if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), i === "setter" && ((n = Object.create(n)).wrapped = !0), o.set(e.name, n), i === "accessor") {
566
- const { name: r } = e;
567
- return { set(a) {
568
- const d = t.get.call(this);
569
- t.set.call(this, a), this.requestUpdate(r, d, n, !0, a);
570
- }, init(a) {
571
- return a !== void 0 && this.C(r, void 0, n, a), a;
571
+ let r = globalThis.litPropertyMetadata.get(s);
572
+ if (r === void 0 && globalThis.litPropertyMetadata.set(s, r = /* @__PURE__ */ new Map()), i === "setter" && ((n = Object.create(n)).wrapped = !0), r.set(e.name, n), i === "accessor") {
573
+ const { name: o } = e;
574
+ return { set(l) {
575
+ const a = t.get.call(this);
576
+ t.set.call(this, l), this.requestUpdate(o, a, n, !0, l);
577
+ }, init(l) {
578
+ return l !== void 0 && this.C(o, void 0, n, l), l;
572
579
  } };
573
580
  }
574
581
  if (i === "setter") {
575
- const { name: r } = e;
576
- return function(a) {
577
- const d = this[r];
578
- t.call(this, a), this.requestUpdate(r, d, n, !0, a);
582
+ const { name: o } = e;
583
+ return function(l) {
584
+ const a = this[o];
585
+ t.call(this, l), this.requestUpdate(o, a, n, !0, l);
579
586
  };
580
587
  }
581
588
  throw Error("Unsupported decorator location: " + i);
582
589
  };
583
- function g(n) {
584
- return (t, e) => typeof e == "object" ? Vt(n, t, e) : ((i, s, o) => {
585
- const r = s.hasOwnProperty(o);
586
- return s.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(s, o) : void 0;
590
+ function u(n) {
591
+ return (t, e) => typeof e == "object" ? he(n, t, e) : ((i, s, r) => {
592
+ const o = s.hasOwnProperty(r);
593
+ return s.constructor.createProperty(r, i), o ? Object.getOwnPropertyDescriptor(s, r) : void 0;
587
594
  })(n, t, e);
588
595
  }
589
596
  /**
@@ -591,145 +598,224 @@ function g(n) {
591
598
  * Copyright 2017 Google LLC
592
599
  * SPDX-License-Identifier: BSD-3-Clause
593
600
  */
594
- function Jt(n) {
595
- return g({ ...n, state: !0, attribute: !1 });
601
+ function pe(n) {
602
+ return u({ ...n, state: !0, attribute: !1 });
596
603
  }
597
604
  /**
598
605
  * @license
599
606
  * Copyright 2021 Google LLC
600
607
  * SPDX-License-Identifier: BSD-3-Clause
601
608
  */
602
- function pt(n, t, e) {
609
+ function $t(n, t, e) {
603
610
  return n ? t(n) : e == null ? void 0 : e(n);
604
611
  }
605
- const Kt = `:host {
606
- display: var(--dae-display, block);
607
- contain: var(--dae-contain, content);
608
- min-height: var(--dae-min-heigh, 100px);
612
+ const ue = `:host {
613
+ display: var(--dae-display, block);
614
+ contain: var(--dae-contain, content);
615
+ min-height: var(--dae-min-heigh, 100px);
609
616
  }
610
617
  ::slotted(*) {
611
- display: var(--dae-slotted-display, block);
612
- z-index: var(--dae-slotted-z-index, 9);
618
+ display: var(--dae-slotted-display, block);
619
+ z-index: var(--dae-slotted-z-index, 9);
613
620
  }
614
621
 
615
622
  .ad-serving-rendered {
616
- position: var(--dae-ad-serving-rendered-position, sticky);
617
- z-index: var(--dae-ad-serving-rendered-z-index, 2);
618
- top: var(--dae-ad-serving-rendered-top, 1rem);
623
+ position: var(--dae-ad-serving-rendered-position, sticky);
624
+ z-index: var(--dae-ad-serving-rendered-z-index, 2);
625
+ top: var(--dae-ad-serving-rendered-top, 1rem);
619
626
  }
620
627
 
621
628
  .ad-container {
622
- position: var(--dae-ad-container-position, relative);
629
+ position: var(--dae-ad-container-position, relative);
623
630
  }
624
631
  .pinno-ad-container {
625
- position: var(--dae-pinno-ad-container-position, relative);
632
+ position: var(--dae-pinno-ad-container-position, relative);
626
633
  }
627
634
  .ad-label {
628
- display: var(--dae-ad-label-display, block);
629
- font-size: var(--dae-ad-label-font-size, 9px);
630
- font-weight: var(--dae-ad-label-font-weight, 400);
631
- letter-spacing: var(--dae-ad-label-letter-spacing, 0.2em);
632
- margin-bottom: var(--dae-ad-label-margin-bottom, 4px);
633
- line-height: var(--dae-ad-label-line-height, 1);
634
- position: var(--dae-ad-label-position, relative);
635
- text-align: var(--dae-ad-label-text-align, center);
636
- text-transform: var(--dae-ad-label-text-transform, uppercase);
637
- color: var(--dae-ad-label-color, #999999);
635
+ display: var(--dae-ad-label-display, block);
636
+ font-size: var(--dae-ad-label-font-size, 9px);
637
+ font-weight: var(--dae-ad-label-font-weight, 400);
638
+ letter-spacing: var(--dae-ad-label-letter-spacing, 0.2em);
639
+ margin-bottom: var(--dae-ad-label-margin-bottom, 4px);
640
+ line-height: var(--dae-ad-label-line-height, 1);
641
+ position: var(--dae-ad-label-position, relative);
642
+ text-align: var(--dae-ad-label-text-align, center);
643
+ text-transform: var(--dae-ad-label-text-transform, uppercase);
644
+ color: var(--dae-ad-label-color, #999999);
638
645
  }
639
646
  .ad-label + .ad-loader {
640
- top: var(--dae-ad-loader-top, 13px);
641
- height: var(--dae-ad-loader-height, calc(100% - 13px));
647
+ top: var(--dae-ad-loader-top, 13px);
648
+ height: var(--dae-ad-loader-height, calc(100% - 13px));
642
649
  }
643
650
  .ad-loader {
644
- position: var(--dae-ad-loader-position, absolute);
645
- top: var(--dae-ad-loader-top, 0);
646
- left: var(--dae-ad-loader-left, 0);
647
- width: var(--dae-ad-loader-width, 100%);
648
- height: var(--dae-ad-loader-height, 100%);
649
- background-color: var(--dae-ad-loader-background-color, #eee);
650
- background-image: var(
651
- --dae-ad-loader-background-image,
652
- linear-gradient(
653
- 90deg,
654
- rgba(255, 255, 255, 0),
655
- rgba(255, 255, 255, 0.5),
656
- rgba(255, 255, 255, 0)
657
- )
658
- );
659
- background-size: var(--dae-ad-loader-background-size, 40px 100%);
660
- background-repeat: var(--dae-ad-loader-background-repeat, no-repeat);
661
- background-position: var(
662
- --dae-ad-loader-background-position,
663
- left -40px top 0
664
- );
665
- animation: var(--dae-ad-loader-animation, ad-skeleton 2s ease infinite);
666
- z-index: var(--dae-ad-loader-z-index, 2);
651
+ position: var(--dae-ad-loader-position, absolute);
652
+ top: var(--dae-ad-loader-top, 0);
653
+ left: var(--dae-ad-loader-left, 0);
654
+ width: var(--dae-ad-loader-width, 100%);
655
+ height: var(--dae-ad-loader-height, 100%);
656
+ background-color: var(--dae-ad-loader-background-color, #eee);
657
+ background-image: var(
658
+ --dae-ad-loader-background-image,
659
+ linear-gradient(
660
+ 90deg,
661
+ rgba(255, 255, 255, 0),
662
+ rgba(255, 255, 255, 0.5),
663
+ rgba(255, 255, 255, 0)
664
+ )
665
+ );
666
+ background-size: var(--dae-ad-loader-background-size, 40px 100%);
667
+ background-repeat: var(--dae-ad-loader-background-repeat, no-repeat);
668
+ background-position: var(
669
+ --dae-ad-loader-background-position,
670
+ left -40px top 0
671
+ );
672
+ animation: var(--dae-ad-loader-animation, ad-skeleton 2s ease infinite);
673
+ z-index: var(--dae-ad-loader-z-index, 2);
667
674
  }
668
675
  .ad-serving {
669
- position: var(--dae-ad-serving-position, relative);
670
- display: var(--dae-ad-serving-display, flex);
671
- flex-wrap: var(--dae-ad-serving-flex-wrap, wrap);
672
- align-items: var(--dae-ad-serving-align-items, flex-start);
673
- justify-content: var(--dae-ad-serving-justify-content, center);
674
- padding-block: var(--dae-ad-serving-padding-block, 1rem);
675
- margin-block: var(--dae-ad-serving-margin-block, 1rem);
676
- min-height: var(--dae-ad-serving-min-height, 100px);
676
+ position: var(--dae-ad-serving-position, relative);
677
+ display: var(--dae-ad-serving-display, flex);
678
+ flex-wrap: var(--dae-ad-serving-flex-wrap, wrap);
679
+ align-items: var(--dae-ad-serving-align-items, flex-start);
680
+ justify-content: var(--dae-ad-serving-justify-content, center);
681
+ padding-block: var(--dae-ad-serving-padding-block, 1rem);
682
+ margin-block: var(--dae-ad-serving-margin-block, 1rem);
683
+ min-height: var(--dae-ad-serving-min-height, 100px);
677
684
  }
678
685
  .ad-serving::before {
679
- content: var(--dae-ad-serving-before-content, "[AD]");
680
- position: var(--dae-ad-serving-before-position, absolute);
681
- top: var(--dae-ad-serving-before-top, 0);
682
- left: var(--dae-ad-serving-before-left, 0);
683
- width: var(--dae-ad-serving-before-width, 100%);
684
- height: var(--dae-ad-serving-before-height, 100%);
685
- display: var(--dae-ad-serving-before-display, flex);
686
- align-items: var(--dae-ad-serving-before-align-items, center);
687
- justify-content: var(--dae-ad-serving-before-justify-content, center);
688
- color: var(--dae-ad-serving-before-color, #ccc);
689
- z-index: var(--dae-ad-serving-before-z-index, 1);
686
+ content: var(--dae-ad-serving-before-content, "[AD]");
687
+ position: var(--dae-ad-serving-before-position, absolute);
688
+ top: var(--dae-ad-serving-before-top, 0);
689
+ left: var(--dae-ad-serving-before-left, 0);
690
+ width: var(--dae-ad-serving-before-width, 100%);
691
+ height: var(--dae-ad-serving-before-height, 100%);
692
+ display: var(--dae-ad-serving-before-display, flex);
693
+ align-items: var(--dae-ad-serving-before-align-items, center);
694
+ justify-content: var(--dae-ad-serving-before-justify-content, center);
695
+ color: var(--dae-ad-serving-before-color, #ccc);
696
+ z-index: var(--dae-ad-serving-before-z-index, 1);
690
697
  }
691
698
 
692
699
  @keyframes ad-skeleton {
693
- to {
694
- background-position: right -40px top 0;
695
- }
700
+ to {
701
+ background-position: right -40px top 0;
702
+ }
696
703
  }
697
- `, Gt = {
704
+ `, ge = {
698
705
  "top-1": {
699
706
  mapping: [
700
- { viewport: [320, 0], sizing: [[320, 50], [320, 100]] },
707
+ {
708
+ viewport: [320, 0],
709
+ sizing: [
710
+ [320, 50],
711
+ [320, 100]
712
+ ]
713
+ },
701
714
  { viewport: [720, 0], sizing: [[728, 90]] },
702
- { viewport: [970, 0], sizing: [[920, 250], [970, 90], [728, 90]] },
703
- { viewport: [1280, 0], sizing: [[920, 250], [970, 250], [970, 90], [728, 90]] }
715
+ {
716
+ viewport: [970, 0],
717
+ sizing: [
718
+ [920, 250],
719
+ [970, 90],
720
+ [728, 90]
721
+ ]
722
+ },
723
+ {
724
+ viewport: [1280, 0],
725
+ sizing: [
726
+ [920, 250],
727
+ [970, 250],
728
+ [970, 90],
729
+ [728, 90]
730
+ ]
731
+ }
732
+ ],
733
+ sizing: [
734
+ [320, 50],
735
+ [320, 100],
736
+ [728, 90],
737
+ [970, 90],
738
+ [920, 250],
739
+ [970, 250]
704
740
  ],
705
- sizing: [[320, 50], [320, 100], [728, 90], [970, 90], [920, 250], [970, 250]],
706
741
  position: "top"
707
742
  },
708
743
  "top-2": {
709
744
  mapping: [
710
- { viewport: [320, 0], sizing: [[300, 250], [320, 50]] },
745
+ {
746
+ viewport: [320, 0],
747
+ sizing: [
748
+ [300, 250],
749
+ [320, 50]
750
+ ]
751
+ },
711
752
  { viewport: [760, 0], sizing: [[728, 90]] },
712
- { viewport: [970, 90], sizing: [[970, 90], [728, 90]] }
753
+ {
754
+ viewport: [970, 90],
755
+ sizing: [
756
+ [970, 90],
757
+ [728, 90]
758
+ ]
759
+ }
760
+ ],
761
+ sizing: [
762
+ [300, 250],
763
+ [320, 50],
764
+ [728, 90],
765
+ [970, 90]
713
766
  ],
714
- sizing: [[300, 250], [320, 50], [728, 90], [970, 90]],
715
767
  position: "top"
716
768
  },
717
769
  "top-3": {
718
770
  mapping: [
719
- { viewport: [320, 0], sizing: [[300, 250], [320, 50]] },
771
+ {
772
+ viewport: [320, 0],
773
+ sizing: [
774
+ [300, 250],
775
+ [320, 50]
776
+ ]
777
+ },
720
778
  { viewport: [760, 0], sizing: [[728, 90]] },
721
- { viewport: [970, 90], sizing: [[970, 90], [728, 90]] }
779
+ {
780
+ viewport: [970, 90],
781
+ sizing: [
782
+ [970, 90],
783
+ [728, 90]
784
+ ]
785
+ }
786
+ ],
787
+ sizing: [
788
+ [300, 250],
789
+ [320, 50],
790
+ [728, 90],
791
+ [970, 90]
722
792
  ],
723
- sizing: [[300, 250], [320, 50], [728, 90], [970, 90]],
724
793
  position: "top"
725
794
  },
726
795
  "top-4": {
727
796
  mapping: [
728
- { viewport: [320, 0], sizing: [[300, 250], [320, 50]] },
797
+ {
798
+ viewport: [320, 0],
799
+ sizing: [
800
+ [300, 250],
801
+ [320, 50]
802
+ ]
803
+ },
729
804
  { viewport: [760, 0], sizing: [[728, 90]] },
730
- { viewport: [970, 90], sizing: [[970, 90], [728, 90]] }
805
+ {
806
+ viewport: [970, 90],
807
+ sizing: [
808
+ [970, 90],
809
+ [728, 90]
810
+ ]
811
+ }
812
+ ],
813
+ sizing: [
814
+ [300, 250],
815
+ [320, 50],
816
+ [728, 90],
817
+ [970, 90]
731
818
  ],
732
- sizing: [[300, 250], [320, 50], [728, 90], [970, 90]],
733
819
  position: "top"
734
820
  },
735
821
  "top-5": {
@@ -737,37 +823,107 @@ const Kt = `:host {
737
823
  { viewport: [320, 0], sizing: [[300, 250]] },
738
824
  { viewport: [760, 0], sizing: [[728, 90]] }
739
825
  ],
740
- sizing: [[300, 250], [320, 50], [728, 90]],
826
+ sizing: [
827
+ [300, 250],
828
+ [320, 50],
829
+ [728, 90]
830
+ ],
741
831
  position: "top"
742
832
  },
743
833
  "box-1": {
744
834
  mapping: [{ viewport: [320, 0], sizing: [[300, 250]] }],
745
- sizing: [[300, 250], [300, 600]],
835
+ sizing: [
836
+ [300, 250],
837
+ [300, 600]
838
+ ],
746
839
  position: "box"
747
840
  },
748
841
  "box-2": {
749
- mapping: [{ viewport: [320, 0], sizing: [[1, 1], [300, 250], [300, 600]] }],
750
- sizing: [[300, 250], [300, 600], [1, 1]],
842
+ mapping: [
843
+ {
844
+ viewport: [320, 0],
845
+ sizing: [
846
+ [1, 1],
847
+ [300, 250],
848
+ [300, 600]
849
+ ]
850
+ }
851
+ ],
852
+ sizing: [
853
+ [300, 250],
854
+ [300, 600],
855
+ [1, 1]
856
+ ],
751
857
  position: "box"
752
858
  },
753
859
  "box-3": {
754
- mapping: [{ viewport: [320, 0], sizing: [[1, 1], [300, 250], [300, 600]] }],
755
- sizing: [[300, 250], [300, 600], [1, 1]],
860
+ mapping: [
861
+ {
862
+ viewport: [320, 0],
863
+ sizing: [
864
+ [1, 1],
865
+ [300, 250],
866
+ [300, 600]
867
+ ]
868
+ }
869
+ ],
870
+ sizing: [
871
+ [300, 250],
872
+ [300, 600],
873
+ [1, 1]
874
+ ],
756
875
  position: "box"
757
876
  },
758
877
  "box-4": {
759
- mapping: [{ viewport: [320, 0], sizing: [[1, 1], [300, 250], [300, 600]] }],
760
- sizing: [[300, 250], [300, 600], [1, 1]],
878
+ mapping: [
879
+ {
880
+ viewport: [320, 0],
881
+ sizing: [
882
+ [1, 1],
883
+ [300, 250],
884
+ [300, 600]
885
+ ]
886
+ }
887
+ ],
888
+ sizing: [
889
+ [300, 250],
890
+ [300, 600],
891
+ [1, 1]
892
+ ],
761
893
  position: "box"
762
894
  },
763
895
  "box-5": {
764
- mapping: [{ viewport: [320, 0], sizing: [[1, 1], [300, 250], [300, 600]] }],
765
- sizing: [[1, 1], [300, 250], [300, 600]],
896
+ mapping: [
897
+ {
898
+ viewport: [320, 0],
899
+ sizing: [
900
+ [1, 1],
901
+ [300, 250],
902
+ [300, 600]
903
+ ]
904
+ }
905
+ ],
906
+ sizing: [
907
+ [1, 1],
908
+ [300, 250],
909
+ [300, 600]
910
+ ],
766
911
  position: "box"
767
912
  },
768
913
  footer: {
769
- mapping: [{ viewport: [0, 0], sizing: [[320, 50], [320, 100]] }],
770
- sizing: [[320, 50], [320, 100]],
914
+ mapping: [
915
+ {
916
+ viewport: [0, 0],
917
+ sizing: [
918
+ [320, 50],
919
+ [320, 100]
920
+ ]
921
+ }
922
+ ],
923
+ sizing: [
924
+ [320, 50],
925
+ [320, 100]
926
+ ],
771
927
  position: "footer"
772
928
  },
773
929
  interstitial: {
@@ -775,20 +931,26 @@ const Kt = `:host {
775
931
  sizing: [[1, 1]],
776
932
  position: "interstitial"
777
933
  }
778
- }, Zt = {
934
+ }, fe = {
779
935
  fetchMarginPercent: 500,
780
936
  renderMarginPercent: 200,
781
937
  mobileScaling: 2
782
- }, X = class X {
938
+ }, lt = class lt {
783
939
  static init(t) {
940
+ if (this.instance && !t.force) {
941
+ console.warn(
942
+ "[DreamsAdConfig] Already initialized. Use { force: true } to override."
943
+ );
944
+ return;
945
+ }
784
946
  this.instance = {
785
947
  networkId: t.networkId,
786
948
  sitePrefix: t.sitePrefix,
787
949
  pubId: t.pubId || "",
788
950
  bidTimeout: t.bidTimeout || 2e3,
789
- defaultLazyLoad: t.defaultLazyLoad || Zt,
951
+ defaultLazyLoad: t.defaultLazyLoad || fe,
790
952
  slots: {
791
- ...Gt,
953
+ ...ge,
792
954
  ...t.slots
793
955
  }
794
956
  };
@@ -861,53 +1023,64 @@ const Kt = `:host {
861
1023
  );
862
1024
  }
863
1025
  };
864
- X.instance = null;
865
- let w = X;
866
- const ct = {
1026
+ lt.instance = null;
1027
+ let _ = lt;
1028
+ const _t = {
867
1029
  contextKey: "@context",
868
1030
  maxRetries: 20,
869
1031
  retryInterval: 100,
870
1032
  includeUrl: !0,
871
1033
  customSegmentFn: "_rl_gen_sg"
872
- }, L = class L {
1034
+ }, O = class O {
873
1035
  static async getTargeting(t) {
874
- const e = { ...ct, ...t }, i = typeof window < "u" ? window.location.href : "";
1036
+ const e = { ..._t, ...t }, i = typeof window < "u" ? window.location.href : "";
875
1037
  if (this.cache && this.cacheUrl === i)
876
1038
  return { targeting: this.cache, source: "cache" };
877
1039
  if (this.pendingPromise)
878
1040
  return this.pendingPromise;
879
- this.pendingPromise = this.pollForContext(e, i);
880
- const s = await this.pendingPromise;
881
- return this.pendingPromise = null, s;
1041
+ try {
1042
+ return this.pendingPromise = this.pollForContext(e, i), await this.pendingPromise;
1043
+ } finally {
1044
+ this.pendingPromise = null;
1045
+ }
882
1046
  }
883
1047
  static pollForContext(t, e) {
884
- return new Promise((i) => {
885
- let s = 0;
886
- const o = () => {
887
- if (typeof window > "u") return !1;
888
- const a = window.dfp;
889
- if (!(a != null && a[t.contextKey])) return !1;
890
- const d = a[t.contextKey], h = this.buildFromContext(d, t);
891
- return this.cache = h, this.cacheUrl = e, i({ targeting: h, source: "context" }), !0;
892
- };
893
- if (o()) return;
894
- const r = setInterval(() => {
895
- if (s++, o()) {
896
- clearInterval(r);
1048
+ return new Promise((i, s) => {
1049
+ let r = 0, o = null;
1050
+ const l = () => {
1051
+ if (typeof window > "u") return null;
1052
+ const c = window.dfp;
1053
+ if (!(c != null && c[t.contextKey])) return null;
1054
+ try {
1055
+ const p = c[t.contextKey], h = this.buildFromContext(p, t);
1056
+ return this.cache = h, this.cacheUrl = e, { targeting: h, source: "context" };
1057
+ } catch (p) {
1058
+ return s(p), null;
1059
+ }
1060
+ }, a = l();
1061
+ if (a) {
1062
+ i(a);
1063
+ return;
1064
+ }
1065
+ o = setInterval(() => {
1066
+ r++;
1067
+ const c = l();
1068
+ if (c) {
1069
+ o && clearInterval(o), i(c);
897
1070
  return;
898
1071
  }
899
- s >= t.maxRetries && (clearInterval(r), i({ targeting: [], source: "timeout" }));
1072
+ r >= t.maxRetries && (o && clearInterval(o), i({ targeting: [], source: "timeout" }));
900
1073
  }, t.retryInterval);
901
1074
  });
902
1075
  }
903
1076
  static buildFromContext(t, e) {
904
- var o, r;
905
- const i = { ...ct, ...e }, s = [];
906
- if (i.includeUrl && typeof window < "u" && s.push({ key: "url", value: window.location.pathname }), (o = t.dataSection) != null && o.catName && s.push({ key: "catName", value: t.dataSection.catName }), t.postId && s.push({ key: "postId", value: t.postId }), t.catId && s.push({ key: "catId", value: t.catId }), t.tagId && s.push({ key: "tag", value: t.tagId }), t.typeId && s.push({ key: "type", value: t.typeId }), t.taxId && s.push({ key: "taxId", value: t.taxId }), (r = t.dataSection) != null && r.author && s.push({ key: "author", value: t.dataSection.author }), typeof window < "u" && i.customSegmentFn) {
907
- const a = window[i.customSegmentFn];
908
- if (typeof a == "function") {
909
- const d = a();
910
- d && s.push({ key: "_rl", value: d });
1077
+ var r, o;
1078
+ const i = { ..._t, ...e }, s = [];
1079
+ if (i.includeUrl && typeof window < "u" && s.push({ key: "url", value: window.location.pathname }), (r = t.dataSection) != null && r.catName && s.push({ key: "catName", value: t.dataSection.catName }), t.postId && s.push({ key: "postId", value: t.postId }), t.catId && s.push({ key: "catId", value: t.catId }), t.tagId && s.push({ key: "tag", value: t.tagId }), t.typeId && s.push({ key: "type", value: t.typeId }), t.taxId && s.push({ key: "taxId", value: t.taxId }), (o = t.dataSection) != null && o.author && s.push({ key: "author", value: t.dataSection.author }), typeof window < "u" && i.customSegmentFn) {
1080
+ const l = window[i.customSegmentFn];
1081
+ if (typeof l == "function") {
1082
+ const a = l();
1083
+ a && s.push({ key: "_rl", value: a });
911
1084
  }
912
1085
  }
913
1086
  return s;
@@ -920,59 +1093,332 @@ const ct = {
920
1093
  return this.cache && this.cacheUrl === t ? this.cache : null;
921
1094
  }
922
1095
  };
923
- L.cache = null, L.cacheUrl = "", L.pendingPromise = null;
924
- let G = L;
925
- var Yt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, _t = (n) => {
1096
+ O.cache = null, O.cacheUrl = "", O.pendingPromise = null;
1097
+ let K = O;
1098
+ const At = {
1099
+ threshold: 0.5,
1100
+ // IAB: 50% visible
1101
+ duration: 2e3,
1102
+ // IAB: 2 seconds
1103
+ debug: !1
1104
+ }, X = class X {
1105
+ /**
1106
+ * Configure the viewability service
1107
+ */
1108
+ static configure(t) {
1109
+ this.config = { ...At, ...t };
1110
+ }
1111
+ /**
1112
+ * Start tracking an ad element for viewability
1113
+ */
1114
+ static track(t, e, i) {
1115
+ if (this.trackedAds.has(e))
1116
+ return;
1117
+ const s = {
1118
+ adId: e,
1119
+ position: i,
1120
+ isViewable: !1,
1121
+ viewableTime: 0,
1122
+ totalTime: 0,
1123
+ viewabilityRate: 0
1124
+ }, r = new IntersectionObserver(
1125
+ (l) => this.handleIntersection(l, e),
1126
+ {
1127
+ threshold: [0, 0.25, 0.5, 0.75, 1],
1128
+ rootMargin: "0px"
1129
+ }
1130
+ ), o = {
1131
+ element: t,
1132
+ metrics: s,
1133
+ observer: r,
1134
+ viewabilityTimer: null,
1135
+ trackingInterval: null,
1136
+ startTime: Date.now(),
1137
+ isCurrentlyVisible: !1
1138
+ };
1139
+ this.trackedAds.set(e, o), r.observe(t), this.dispatchEvent("impression", e, s), this.config.debug && console.log(`[Viewability] Tracking started: ${e}`);
1140
+ }
1141
+ /**
1142
+ * Stop tracking an ad element
1143
+ */
1144
+ static untrack(t) {
1145
+ const e = this.trackedAds.get(t);
1146
+ e && (e.observer.disconnect(), e.viewabilityTimer && clearTimeout(e.viewabilityTimer), e.trackingInterval && clearInterval(e.trackingInterval), this.trackedAds.delete(t), this.config.debug && console.log(`[Viewability] Tracking stopped: ${t}`));
1147
+ }
1148
+ /**
1149
+ * Get metrics for a specific ad
1150
+ */
1151
+ static getMetrics(t) {
1152
+ const e = this.trackedAds.get(t);
1153
+ return e ? { ...e.metrics } : null;
1154
+ }
1155
+ /**
1156
+ * Get all tracked metrics
1157
+ */
1158
+ static getAllMetrics() {
1159
+ return Array.from(this.trackedAds.values()).map((t) => ({ ...t.metrics }));
1160
+ }
1161
+ /**
1162
+ * Show metrics summary in console
1163
+ */
1164
+ static showMetrics() {
1165
+ const t = this.getAllMetrics();
1166
+ if (t.length === 0) {
1167
+ console.log("[Viewability] No ads being tracked");
1168
+ return;
1169
+ }
1170
+ console.table(
1171
+ t.map((e) => ({
1172
+ "Ad ID": e.adId,
1173
+ Position: e.position,
1174
+ Viewable: e.isViewable ? "✓" : "✗",
1175
+ "Viewable Time": `${(e.viewableTime / 1e3).toFixed(1)}s`,
1176
+ "Total Time": `${(e.totalTime / 1e3).toFixed(1)}s`,
1177
+ "Viewability %": `${e.viewabilityRate.toFixed(1)}%`
1178
+ }))
1179
+ );
1180
+ }
1181
+ /**
1182
+ * Clear all tracking
1183
+ */
1184
+ static reset() {
1185
+ for (const t of this.trackedAds.keys())
1186
+ this.untrack(t);
1187
+ }
1188
+ static handleIntersection(t, e) {
1189
+ const i = this.trackedAds.get(e);
1190
+ if (i)
1191
+ for (const s of t) {
1192
+ const r = s.intersectionRatio >= this.config.threshold;
1193
+ r && !i.isCurrentlyVisible ? (i.isCurrentlyVisible = !0, this.startViewabilityTimer(e)) : !r && i.isCurrentlyVisible && (i.isCurrentlyVisible = !1, this.stopViewabilityTimer(e), this.dispatchEvent("hidden", e, i.metrics));
1194
+ }
1195
+ }
1196
+ static startViewabilityTimer(t) {
1197
+ const e = this.trackedAds.get(t);
1198
+ e && (e.viewabilityTimer = setTimeout(() => {
1199
+ e.metrics.isViewable || (e.metrics.isViewable = !0, this.dispatchEvent("viewable", t, e.metrics), this.config.debug && console.log(`[Viewability] Ad viewable: ${t}`));
1200
+ }, this.config.duration), e.trackingInterval = setInterval(() => {
1201
+ this.updateMetrics(t);
1202
+ }, 500));
1203
+ }
1204
+ static stopViewabilityTimer(t) {
1205
+ const e = this.trackedAds.get(t);
1206
+ e && (e.viewabilityTimer && (clearTimeout(e.viewabilityTimer), e.viewabilityTimer = null), e.trackingInterval && (clearInterval(e.trackingInterval), e.trackingInterval = null));
1207
+ }
1208
+ static updateMetrics(t) {
1209
+ const e = this.trackedAds.get(t);
1210
+ if (!e) return;
1211
+ const i = Date.now();
1212
+ e.metrics.totalTime = i - e.startTime, e.isCurrentlyVisible && (e.metrics.viewableTime += 500), e.metrics.totalTime > 0 && (e.metrics.viewabilityRate = e.metrics.viewableTime / e.metrics.totalTime * 100);
1213
+ }
1214
+ static dispatchEvent(t, e, i) {
1215
+ const s = new CustomEvent("ad:viewability", {
1216
+ detail: {
1217
+ type: t,
1218
+ adId: e,
1219
+ metrics: { ...i },
1220
+ timestamp: Date.now()
1221
+ }
1222
+ });
1223
+ window.dispatchEvent(s);
1224
+ }
1225
+ };
1226
+ X.config = At, X.trackedAds = /* @__PURE__ */ new Map();
1227
+ let Z = X;
1228
+ var me = Object.defineProperty, we = Object.getOwnPropertyDescriptor, F = (n, t, e, i) => {
1229
+ for (var s = i > 1 ? void 0 : i ? we(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1230
+ (o = n[r]) && (s = (i ? o(t, e, s) : o(s)) || s);
1231
+ return i && s && me(t, e, s), s;
1232
+ };
1233
+ let E = class extends z {
1234
+ constructor() {
1235
+ super(...arguments), this.width = 300, this.height = 250, this.showLabel = !1, this.label = "Ad";
1236
+ }
1237
+ render() {
1238
+ return y`
1239
+ <div
1240
+ class="skeleton"
1241
+ style="width: ${this.width}px; height: ${this.height}px;"
1242
+ >
1243
+ ${this.showLabel ? y`<span class="skeleton-label">${this.label}</span>` : ""}
1244
+ </div>
1245
+ `;
1246
+ }
1247
+ };
1248
+ E.styles = qt`
1249
+ :host {
1250
+ display: block;
1251
+ }
1252
+
1253
+ .skeleton {
1254
+ position: relative;
1255
+ overflow: hidden;
1256
+ background: var(--dreams-skeleton-bg, #f0f0f0);
1257
+ border-radius: var(--dreams-skeleton-radius, 4px);
1258
+ }
1259
+
1260
+ .skeleton::after {
1261
+ content: "";
1262
+ position: absolute;
1263
+ top: 0;
1264
+ left: 0;
1265
+ right: 0;
1266
+ bottom: 0;
1267
+ background: linear-gradient(
1268
+ 90deg,
1269
+ transparent 0%,
1270
+ var(--dreams-skeleton-shine, rgba(255, 255, 255, 0.6)) 50%,
1271
+ transparent 100%
1272
+ );
1273
+ animation: shimmer 1.5s infinite;
1274
+ }
1275
+
1276
+ @keyframes shimmer {
1277
+ 0% {
1278
+ transform: translateX(-100%);
1279
+ }
1280
+ 100% {
1281
+ transform: translateX(100%);
1282
+ }
1283
+ }
1284
+
1285
+ .skeleton-label {
1286
+ position: absolute;
1287
+ bottom: 8px;
1288
+ left: 50%;
1289
+ transform: translateX(-50%);
1290
+ font-size: 10px;
1291
+ color: var(--dreams-skeleton-label-color, #999);
1292
+ font-family: system-ui, -apple-system, sans-serif;
1293
+ }
1294
+ `;
1295
+ F([
1296
+ u({ type: Number })
1297
+ ], E.prototype, "width", 2);
1298
+ F([
1299
+ u({ type: Number })
1300
+ ], E.prototype, "height", 2);
1301
+ F([
1302
+ u({ type: Boolean })
1303
+ ], E.prototype, "showLabel", 2);
1304
+ F([
1305
+ u({ type: String })
1306
+ ], E.prototype, "label", 2);
1307
+ E = F([
1308
+ Mt("dreams-ad-skeleton")
1309
+ ], E);
1310
+ function ye(n, t) {
1311
+ const e = t >= 1280, i = t >= 728;
1312
+ switch (n) {
1313
+ case "top-1":
1314
+ return e ? { width: 970, height: 250 } : i ? { width: 728, height: 90 } : { width: 320, height: 100 };
1315
+ case "top-2":
1316
+ case "top-3":
1317
+ case "top-4":
1318
+ case "top-5":
1319
+ return e ? { width: 970, height: 90 } : i ? { width: 728, height: 90 } : { width: 320, height: 50 };
1320
+ case "box-1":
1321
+ case "box-2":
1322
+ case "box-3":
1323
+ case "box-4":
1324
+ case "box-5":
1325
+ return { width: 300, height: 250 };
1326
+ case "footer":
1327
+ return { width: 320, height: 50 };
1328
+ case "interstitial":
1329
+ return { width: 1, height: 1 };
1330
+ default:
1331
+ return { width: 300, height: 250 };
1332
+ }
1333
+ }
1334
+ var ve = Object.defineProperty, be = Object.getOwnPropertyDescriptor, Ht = (n) => {
926
1335
  throw TypeError(n);
927
- }, c = (n, t, e, i) => {
928
- for (var s = i > 1 ? void 0 : i ? Qt(t, e) : t, o = n.length - 1, r; o >= 0; o--)
929
- (r = n[o]) && (s = (i ? r(t, e, s) : r(s)) || s);
930
- return i && s && Yt(t, e, s), s;
931
- }, Xt = (n, t, e) => t.has(n) || _t("Cannot " + e), te = (n, t, e) => t.has(n) ? _t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), D = (n, t, e) => (Xt(n, t, "access private method"), e), E, wt, bt, At, St;
932
- let l = class extends k {
1336
+ }, g = (n, t, e, i) => {
1337
+ for (var s = i > 1 ? void 0 : i ? be(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1338
+ (o = n[r]) && (s = (i ? o(t, e, s) : o(s)) || s);
1339
+ return i && s && ve(t, e, s), s;
1340
+ }, $e = (n, t, e) => t.has(n) || Ht("Cannot " + e), _e = (n, t, e) => t.has(n) ? Ht("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), q = (n, t, e) => ($e(n, t, "access private method"), e), x, Vt, Bt, Ft, jt;
1341
+ let d = class extends z {
933
1342
  constructor() {
934
- super(...arguments), te(this, E), this.networkId = "", this.adUnit = "", this.divId = "", this.slot = "", this.mapping = [], this.sizing = [], this.targeting = [], this.autoTargeting = !1, this.resolvedTargeting = [], this.setCentering = !1, this.enableLazyLoad = !1, this.configLazyLoad = {
1343
+ super(...arguments), _e(this, x), this.adSlot = null, this.slotRenderHandler = null, this.networkId = "", this.adUnit = "", this.divId = "", this.slot = "", this.mapping = [], this.sizing = [], this.targeting = [], this.autoTargeting = !1, this.resolvedTargeting = [], this.setCentering = !1, this.enableLazyLoad = !1, this.configLazyLoad = {
935
1344
  fetchMarginPercent: 500,
936
1345
  renderMarginPercent: 200,
937
1346
  mobileScaling: 2
938
- }, this.refresh = !1, this.enableTitle = !1, this.apstag = !1, this.pubId = "", this.bidTimeout = 2e3, this.title = "Publicidad", this.adLoaded = !1;
1347
+ }, this.refresh = !1, this.enableTitle = !1, this.apstag = !1, this.pubId = "", this.bidTimeout = 2e3, this.title = "Publicidad", this.adLoaded = !1, this.trackViewability = !1, this.showSkeleton = !1;
1348
+ }
1349
+ /**
1350
+ * Set up global navigation listeners for SPA support
1351
+ */
1352
+ static _setupNavigationListeners() {
1353
+ if (d.navigationListenersAttached || typeof window > "u") return;
1354
+ window.addEventListener("popstate", d._handleNavigation), window.addEventListener("hashchange", d._handleNavigation);
1355
+ const n = history.pushState.bind(history), t = history.replaceState.bind(history);
1356
+ history.pushState = (...e) => {
1357
+ n(...e), d._handleNavigation();
1358
+ }, history.replaceState = (...e) => {
1359
+ t(...e), d._handleNavigation();
1360
+ }, d.navigationListenersAttached = !0;
939
1361
  }
940
1362
  connectedCallback() {
941
- if (super.connectedCallback(), !l.initialized)
942
- D(this, E, wt).call(this), l.initialized = !0, l.old_url = location.href;
943
- else {
944
- const n = location.href;
945
- l.old_url !== n && (window.googletag.destroySlots(window.dreamsAllSlots), l.old_url = n, window.dreamsAllSlots = [], window.dreamsSlotsToUpdate = []);
1363
+ super.connectedCallback(), d.initialized ? d._handleNavigation() : (q(this, x, Vt).call(this), d.initialized = !0, d.old_url = location.href);
1364
+ }
1365
+ disconnectedCallback() {
1366
+ var n, t;
1367
+ if (super.disconnectedCallback(), this.trackViewability && this.divId && Z.untrack(this.divId), this.slotRenderHandler && ((n = window.googletag) != null && n.pubads) && (window.googletag.pubads().removeEventListener("slotRenderEnded", this.slotRenderHandler), this.slotRenderHandler = null), this.adSlot) {
1368
+ if (window.dreamsAllSlots) {
1369
+ const e = window.dreamsAllSlots.indexOf(this.adSlot);
1370
+ e > -1 && window.dreamsAllSlots.splice(e, 1);
1371
+ }
1372
+ if (window.dreamsSlotsToUpdate) {
1373
+ const e = window.dreamsSlotsToUpdate.indexOf(this.adSlot);
1374
+ e > -1 && window.dreamsSlotsToUpdate.splice(e, 1);
1375
+ }
1376
+ (t = window.googletag) != null && t.destroySlots && window.googletag.destroySlots([this.adSlot]), this.adSlot = null;
946
1377
  }
947
1378
  }
948
1379
  async firstUpdated() {
949
- await D(this, E, bt).call(this), await D(this, E, At).call(this), this.divId = `div-gpt-ad-${this.adUnit}-${crypto.randomUUID()}`, this.apstag && this.pubId && !l.initialized_aps && (window.apstag.init({
950
- pubID: this.pubId,
951
- adServer: "googletag",
952
- bidTimeout: this.bidTimeout
953
- }), l.initialized_aps = !0), D(this, E, St).call(this);
1380
+ var n;
1381
+ if (await q(this, x, Bt).call(this), await q(this, x, Ft).call(this), this.divId = `div-gpt-ad-${this.adUnit}-${crypto.randomUUID()}`, this.apstag && this.pubId && !d.initialized_aps)
1382
+ if (typeof ((n = window.apstag) == null ? void 0 : n.init) == "function")
1383
+ try {
1384
+ window.apstag.init({
1385
+ pubID: this.pubId,
1386
+ adServer: "googletag",
1387
+ bidTimeout: this.bidTimeout
1388
+ }), d.initialized_aps = !0;
1389
+ } catch {
1390
+ this.apstag = !1;
1391
+ }
1392
+ else
1393
+ this.apstag = !1;
1394
+ q(this, x, jt).call(this);
954
1395
  }
955
1396
  render() {
956
- return C`
1397
+ const n = this.showSkeleton ? ye(this.slot || "box-1", window.innerWidth) : { width: 0, height: 0 };
1398
+ return y`
957
1399
  <div class="ad-container">
958
- ${pt(
1400
+ ${$t(
959
1401
  this.enableTitle,
960
- () => C`<span class="ad-label">${this.title}</span>`,
961
- () => C``
1402
+ () => y`<span class="ad-label">${this.title}</span>`,
1403
+ () => y``
962
1404
  )}
963
- ${pt(
1405
+ ${$t(
964
1406
  !this.adLoaded,
965
- () => C`<div
966
- class="ad-loader"
967
- data-ad-loader="${this.divId}"
968
- ></div>`,
969
- () => C``
1407
+ () => this.showSkeleton ? y`<dreams-ad-skeleton
1408
+ width="${n.width}"
1409
+ height="${n.height}"
1410
+ ></dreams-ad-skeleton>` : y`<div
1411
+ class="ad-loader"
1412
+ data-ad-loader="${this.divId}"
1413
+ ></div>`,
1414
+ () => y``
970
1415
  )}
971
1416
  <div
972
1417
  class="ad-serving"
973
1418
  data-post-id="${this.divId}"
974
1419
  data-tag="${this.adUnit}"
975
1420
  data-refresh="${this.refresh ? "true" : "false"}"
1421
+ style="${!this.adLoaded && this.showSkeleton ? "opacity: 0;" : ""}"
976
1422
  >
977
1423
  <slot name="ad-slot"></slot>
978
1424
  </div>
@@ -980,122 +1426,601 @@ let l = class extends k {
980
1426
  `;
981
1427
  }
982
1428
  };
983
- E = /* @__PURE__ */ new WeakSet();
984
- wt = function() {
1429
+ x = /* @__PURE__ */ new WeakSet();
1430
+ Vt = function() {
985
1431
  window.googletag = window.googletag || { cmd: [] }, window.googletag.cmd.push(() => {
986
- window.dreamsAllSlots = window.dreamsAllSlots || [], window.dreamsSlotsToUpdate = window.dreamsSlotsToUpdate || [], window.googletag.pubads().enableSingleRequest(), window.googletag.enableServices();
987
- });
1432
+ window.dreamsAllSlots = window.dreamsAllSlots || [], window.dreamsSlotsToUpdate = window.dreamsSlotsToUpdate || [];
1433
+ const n = window.googletag.pubadsReady === !0;
1434
+ d.servicesWereAlreadyEnabled = n, n || window.googletag.enableServices();
1435
+ }), d._setupNavigationListeners();
988
1436
  };
989
- bt = async function() {
990
- if (this.slot && w.isInitialized()) {
991
- const n = w.getSlot(this.slot);
992
- n && (this.networkId || (this.networkId = w.getNetworkId()), this.adUnit || (this.adUnit = w.buildAdUnit(this.slot)), (!this.mapping || this.mapping.length === 0) && (this.mapping = n.mapping), (!this.sizing || this.sizing.length === 0) && (this.sizing = n.sizing), this.pubId || (this.pubId = w.getPubId() || ""), this.pubId && (this.apstag = !0));
1437
+ Bt = async function() {
1438
+ if (this.slot && _.isInitialized()) {
1439
+ const n = _.getSlot(this.slot);
1440
+ n && (this.networkId || (this.networkId = _.getNetworkId()), this.adUnit || (this.adUnit = _.buildAdUnit(this.slot)), (!this.mapping || this.mapping.length === 0) && (this.mapping = n.mapping), (!this.sizing || this.sizing.length === 0) && (this.sizing = n.sizing), this.pubId || (this.pubId = _.getPubId() || ""), this.pubId && (this.apstag = !0));
993
1441
  }
994
- typeof this.mapping == "string" && (this.mapping = JSON.parse(this.mapping)), typeof this.sizing == "string" && (this.sizing = JSON.parse(this.sizing)), this.targeting && typeof this.targeting == "string" && (this.targeting = JSON.parse(this.targeting)), this.configLazyLoad && typeof this.configLazyLoad == "string" && (this.configLazyLoad = JSON.parse(this.configLazyLoad));
1442
+ if (typeof this.mapping == "string")
1443
+ try {
1444
+ this.mapping = JSON.parse(this.mapping);
1445
+ } catch {
1446
+ this.mapping = [];
1447
+ }
1448
+ if (typeof this.sizing == "string")
1449
+ try {
1450
+ this.sizing = JSON.parse(this.sizing);
1451
+ } catch {
1452
+ this.sizing = [];
1453
+ }
1454
+ if (this.targeting && typeof this.targeting == "string")
1455
+ try {
1456
+ this.targeting = JSON.parse(this.targeting);
1457
+ } catch {
1458
+ this.targeting = [];
1459
+ }
1460
+ if (this.configLazyLoad && typeof this.configLazyLoad == "string")
1461
+ try {
1462
+ this.configLazyLoad = JSON.parse(this.configLazyLoad);
1463
+ } catch {
1464
+ this.configLazyLoad = {
1465
+ fetchMarginPercent: 500,
1466
+ renderMarginPercent: 200,
1467
+ mobileScaling: 2
1468
+ };
1469
+ }
995
1470
  };
996
- At = async function() {
1471
+ Ft = async function() {
997
1472
  if (this.autoTargeting) {
998
- const n = await G.getTargeting();
1473
+ const n = await K.getTargeting();
999
1474
  this.resolvedTargeting = n.targeting;
1000
1475
  } else this.targeting && this.targeting.length > 0 && (this.resolvedTargeting = this.targeting);
1001
1476
  };
1002
- St = function() {
1477
+ jt = function() {
1003
1478
  const n = `/${this.networkId}/${this.adUnit}`, t = this.divId, e = document.createElement("div");
1004
1479
  e.id = t, e.setAttribute("data-ad", this.divId), e.setAttribute("slot", "ad-slot"), e.classList.add("ad-serving-rendered"), e.parentElement || this.appendChild(e), window.googletag.cmd.push(() => {
1005
- window.googletag.pubads().setCentering(this.setCentering), this.enableLazyLoad && window.googletag.pubads().enableLazyLoad(this.configLazyLoad);
1480
+ var a;
1481
+ window.googletag.pubads().setCentering(this.setCentering), this.enableLazyLoad && !d.lazyLoadConfigured && (window.googletag.pubads().enableLazyLoad(this.configLazyLoad), d.lazyLoadConfigured = !0);
1006
1482
  const i = window.googletag.defineSlot(n, this.sizing, t).addService(window.googletag.pubads());
1007
- this.resolvedTargeting.forEach((a) => {
1008
- i.setTargeting(a.key, a.value);
1009
- }), window.googletag.pubads().addEventListener("slotRenderEnded", (a) => {
1010
- a.slot.getSlotElementId() === t && (this.adLoaded = !0);
1011
- });
1483
+ this.resolvedTargeting.forEach((c) => {
1484
+ i.setTargeting(c.key, c.value);
1485
+ }), this.slotRenderHandler = (c) => {
1486
+ if (c.slot.getSlotElementId() === t && (this.adLoaded = !0, this.trackViewability)) {
1487
+ const p = this.querySelector(`#${t}`);
1488
+ p instanceof HTMLElement && Z.track(
1489
+ p,
1490
+ t,
1491
+ this.slot || this.adUnit
1492
+ );
1493
+ }
1494
+ }, window.googletag.pubads().addEventListener("slotRenderEnded", this.slotRenderHandler);
1012
1495
  const s = window.googletag.sizeMapping();
1013
- this.mapping.forEach((a) => {
1014
- s.addSize(a.viewport, a.sizing);
1496
+ this.mapping.forEach((c) => {
1497
+ s.addSize(c.viewport, c.sizing);
1015
1498
  });
1016
- const o = s.build(), r = i.defineSizeMapping(o).addService(window.googletag.pubads());
1017
- this.refresh && window.dreamsSlotsToUpdate.push(i), window.dreamsAllSlots.push(r), !this.apstag && !this.pubId && window.googletag.display(t), this.apstag && this.pubId && window.apstag.fetchBids({
1018
- slots: [
1499
+ const r = s.build(), o = i.defineSizeMapping(r).addService(window.googletag.pubads());
1500
+ if (this.adSlot = o, this.refresh && window.dreamsSlotsToUpdate.push(o), window.dreamsAllSlots.push(o), !(this.apstag && this.pubId))
1501
+ window.googletag.display(t), d.servicesWereAlreadyEnabled && window.googletag.pubads().refresh([o]);
1502
+ else {
1503
+ if (typeof ((a = window.apstag) == null ? void 0 : a.fetchBids) != "function") {
1504
+ window.googletag.display(t), d.servicesWereAlreadyEnabled && window.googletag.pubads().refresh([o]);
1505
+ return;
1506
+ }
1507
+ let c = !1;
1508
+ const p = this.bidTimeout || 2e3, h = setTimeout(() => {
1509
+ c || (c = !0, window.googletag.cmd.push(() => {
1510
+ window.googletag.pubads().refresh([o]);
1511
+ }));
1512
+ }, p + 500);
1513
+ window.apstag.fetchBids(
1019
1514
  {
1020
- slotID: t,
1021
- slotName: n,
1022
- sizes: this.sizing
1515
+ slots: [
1516
+ {
1517
+ slotID: t,
1518
+ slotName: n,
1519
+ sizes: this.sizing
1520
+ }
1521
+ ]
1522
+ },
1523
+ () => {
1524
+ c || (c = !0, clearTimeout(h), window.googletag.cmd.push(() => {
1525
+ window.apstag.setDisplayBids(), window.googletag.pubads().refresh([o]);
1526
+ }));
1023
1527
  }
1024
- ]
1025
- }, () => {
1026
- window.googletag.cmd.push(() => {
1027
- window.apstag.setDisplayBids(), window.googletag.pubads().refresh([r]);
1528
+ );
1529
+ }
1530
+ });
1531
+ };
1532
+ d.styles = Ut(ue);
1533
+ d.initialized = !1;
1534
+ d.old_url = "";
1535
+ d.initialized_aps = !1;
1536
+ d.navigationListenersAttached = !1;
1537
+ d.servicesWereAlreadyEnabled = !1;
1538
+ d.lazyLoadConfigured = !1;
1539
+ d._handleNavigation = () => {
1540
+ var t, e;
1541
+ const n = location.href;
1542
+ d.old_url !== n && ((t = window.googletag) != null && t.destroySlots && ((e = window.dreamsAllSlots) == null ? void 0 : e.length) > 0 && window.googletag.destroySlots(window.dreamsAllSlots), d.old_url = n, window.dreamsAllSlots = [], window.dreamsSlotsToUpdate = [], K.clearCache());
1543
+ };
1544
+ g([
1545
+ u({ type: String })
1546
+ ], d.prototype, "networkId", 2);
1547
+ g([
1548
+ u({ type: String })
1549
+ ], d.prototype, "adUnit", 2);
1550
+ g([
1551
+ u({ type: String })
1552
+ ], d.prototype, "divId", 2);
1553
+ g([
1554
+ u({ type: String })
1555
+ ], d.prototype, "slot", 2);
1556
+ g([
1557
+ u({ type: Array })
1558
+ ], d.prototype, "mapping", 2);
1559
+ g([
1560
+ u({ type: Array })
1561
+ ], d.prototype, "sizing", 2);
1562
+ g([
1563
+ u({ type: Array })
1564
+ ], d.prototype, "targeting", 2);
1565
+ g([
1566
+ u({ type: Boolean, reflect: !0 })
1567
+ ], d.prototype, "autoTargeting", 2);
1568
+ g([
1569
+ pe()
1570
+ ], d.prototype, "resolvedTargeting", 2);
1571
+ g([
1572
+ u({ type: Boolean, reflect: !0 })
1573
+ ], d.prototype, "setCentering", 2);
1574
+ g([
1575
+ u({ type: Boolean, reflect: !0 })
1576
+ ], d.prototype, "enableLazyLoad", 2);
1577
+ g([
1578
+ u({ type: Object })
1579
+ ], d.prototype, "configLazyLoad", 2);
1580
+ g([
1581
+ u({ type: Boolean, reflect: !0 })
1582
+ ], d.prototype, "refresh", 2);
1583
+ g([
1584
+ u({ type: Boolean, reflect: !0 })
1585
+ ], d.prototype, "enableTitle", 2);
1586
+ g([
1587
+ u({ type: Boolean, reflect: !0 })
1588
+ ], d.prototype, "apstag", 2);
1589
+ g([
1590
+ u({ type: String })
1591
+ ], d.prototype, "pubId", 2);
1592
+ g([
1593
+ u({ type: Number })
1594
+ ], d.prototype, "bidTimeout", 2);
1595
+ g([
1596
+ u({ type: String })
1597
+ ], d.prototype, "title", 2);
1598
+ g([
1599
+ u({ type: Boolean })
1600
+ ], d.prototype, "adLoaded", 2);
1601
+ g([
1602
+ u({ type: Boolean, reflect: !0 })
1603
+ ], d.prototype, "trackViewability", 2);
1604
+ g([
1605
+ u({ type: Boolean, reflect: !0 })
1606
+ ], d.prototype, "showSkeleton", 2);
1607
+ d = g([
1608
+ Mt("dreams-ad-engine")
1609
+ ], d);
1610
+ const St = {
1611
+ enabled: !0,
1612
+ addBodyClass: !0,
1613
+ bodyClass: "ad-blocker-detected",
1614
+ timeout: 1e3
1615
+ }, D = class D {
1616
+ /**
1617
+ * Configure the ad block detector
1618
+ */
1619
+ static configure(t) {
1620
+ this.config = { ...St, ...t };
1621
+ }
1622
+ /**
1623
+ * Check if ad blocker is detected (cached result)
1624
+ */
1625
+ static isBlocked() {
1626
+ return this.detected === !0;
1627
+ }
1628
+ /**
1629
+ * Run ad blocker detection
1630
+ */
1631
+ static async detect() {
1632
+ if (this.detected !== null)
1633
+ return {
1634
+ blocked: this.detected,
1635
+ method: this.detected ? "googletag" : "none"
1636
+ };
1637
+ if (this.detecting)
1638
+ return this.detecting;
1639
+ this.detecting = this.runDetection();
1640
+ const t = await this.detecting;
1641
+ return this.detecting = null, t;
1642
+ }
1643
+ /**
1644
+ * Initialize detection and apply body class if blocked
1645
+ */
1646
+ static async init() {
1647
+ if (!this.config.enabled)
1648
+ return !1;
1649
+ const t = await this.detect();
1650
+ return t.blocked && this.config.addBodyClass && document.body.classList.add(this.config.bodyClass), window.dispatchEvent(
1651
+ new CustomEvent("adblock:detected", {
1652
+ detail: t
1653
+ })
1654
+ ), t.blocked;
1655
+ }
1656
+ /**
1657
+ * Reset detection state
1658
+ */
1659
+ static reset() {
1660
+ this.detected = null, this.detecting = null, window.adBlockDetected = void 0, this.config.addBodyClass && document.body.classList.remove(this.config.bodyClass);
1661
+ }
1662
+ static async runDetection() {
1663
+ const t = [
1664
+ () => this.testGoogleTag(),
1665
+ () => this.testBaitElement(),
1666
+ () => this.testFetch()
1667
+ ];
1668
+ for (const e of t)
1669
+ try {
1670
+ const i = await e();
1671
+ if (i != null && i.blocked)
1672
+ return this.detected = !0, window.adBlockDetected = !0, i;
1673
+ } catch {
1674
+ }
1675
+ return this.detected = !1, window.adBlockDetected = !1, { blocked: !1, method: "none" };
1676
+ }
1677
+ /**
1678
+ * Method 1: Check if googletag loaded properly
1679
+ */
1680
+ static testGoogleTag() {
1681
+ return new Promise((t) => {
1682
+ setTimeout(() => {
1683
+ const e = typeof window.googletag > "u" || typeof window.googletag.pubads != "function";
1684
+ t(e ? { blocked: !0, method: "googletag" } : null);
1685
+ }, 100);
1686
+ });
1687
+ }
1688
+ /**
1689
+ * Method 2: Bait element detection
1690
+ * Ad blockers often hide elements with common ad class names
1691
+ */
1692
+ static testBaitElement() {
1693
+ return new Promise((t) => {
1694
+ const e = document.createElement("div");
1695
+ e.className = "adsbox ad-placement pub_300x250 pub_728x90 text-ad textAd text_ad", e.style.cssText = "position: absolute; top: -10px; left: -10px; width: 1px; height: 1px;", e.innerHTML = "&nbsp;", document.body.appendChild(e), requestAnimationFrame(() => {
1696
+ const i = e.offsetHeight === 0 || e.offsetParent === null || window.getComputedStyle(e).display === "none" || window.getComputedStyle(e).visibility === "hidden";
1697
+ e.remove(), t(i ? { blocked: !0, method: "bait" } : null);
1028
1698
  });
1029
1699
  });
1030
- });
1700
+ }
1701
+ /**
1702
+ * Method 3: Fetch a known ad resource
1703
+ */
1704
+ static testFetch() {
1705
+ return new Promise((t) => {
1706
+ const e = new AbortController(), i = setTimeout(
1707
+ () => e.abort(),
1708
+ this.config.timeout
1709
+ );
1710
+ fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js", {
1711
+ method: "HEAD",
1712
+ mode: "no-cors",
1713
+ signal: e.signal
1714
+ }).then(() => {
1715
+ clearTimeout(i), t(null);
1716
+ }).catch(() => {
1717
+ clearTimeout(i), t({ blocked: !0, method: "fetch" });
1718
+ });
1719
+ });
1720
+ }
1721
+ };
1722
+ D.config = St, D.detected = null, D.detecting = null;
1723
+ let kt = D;
1724
+ const st = 3e4, Et = {
1725
+ enabled: !1,
1726
+ interval: 6e4,
1727
+ checkVisibility: !0,
1728
+ disableOnSinglePost: !0,
1729
+ singlePostSelector: "body.single"
1730
+ }, N = class N {
1731
+ /**
1732
+ * Configure the refresh manager
1733
+ */
1734
+ static configure(t) {
1735
+ this.config = { ...Et, ...t }, this.config.interval < st && (this.config.interval = st);
1736
+ }
1737
+ /**
1738
+ * Start auto-refresh loop
1739
+ */
1740
+ static start() {
1741
+ !this.config.enabled || this.running || this.config.disableOnSinglePost && document.querySelector(this.config.singlePostSelector) || (this.running = !0, this.setupVisibilityTracking(), this.scheduleRefresh());
1742
+ }
1743
+ /**
1744
+ * Stop auto-refresh loop
1745
+ */
1746
+ static stop() {
1747
+ this.running = !1, this.refreshTimer && (clearTimeout(this.refreshTimer), this.refreshTimer = null);
1748
+ }
1749
+ /**
1750
+ * Manually trigger a refresh (respects safeguards)
1751
+ */
1752
+ static refresh(t) {
1753
+ return this.safeRefresh(t);
1754
+ }
1755
+ /**
1756
+ * Block refresh (e.g., during user interaction)
1757
+ */
1758
+ static block() {
1759
+ window.DreamsBlockedRefresh = !0;
1760
+ }
1761
+ /**
1762
+ * Unblock refresh
1763
+ */
1764
+ static unblock() {
1765
+ window.DreamsBlockedRefresh = !1;
1766
+ }
1767
+ /**
1768
+ * Check if refresh is currently blocked
1769
+ */
1770
+ static isBlocked() {
1771
+ return window.DreamsBlockedRefresh === !0;
1772
+ }
1773
+ static setupVisibilityTracking() {
1774
+ typeof window > "u" || (window.isTabVisible = !document.hidden, document.addEventListener("visibilitychange", () => {
1775
+ window.isTabVisible = !document.hidden;
1776
+ }));
1777
+ }
1778
+ static scheduleRefresh() {
1779
+ this.running && (this.refreshTimer = setTimeout(() => {
1780
+ this.executeRefresh(), this.scheduleRefresh();
1781
+ }, this.config.interval));
1782
+ }
1783
+ static executeRefresh() {
1784
+ if (this.config.checkVisibility && !window.isTabVisible) {
1785
+ this.dispatchEvent("skipped", "hidden");
1786
+ return;
1787
+ }
1788
+ if (window.DreamsBlockedRefresh) {
1789
+ this.dispatchEvent("skipped", "blocked");
1790
+ return;
1791
+ }
1792
+ this.safeRefresh() || this.dispatchEvent("skipped", "throttled");
1793
+ }
1794
+ static safeRefresh(t) {
1795
+ var l;
1796
+ if (!((l = window.googletag) != null && l.pubads))
1797
+ return !1;
1798
+ const e = Date.now(), i = window.lastAdRefresh || 0;
1799
+ if (e - i < st)
1800
+ return !1;
1801
+ window.lastAdRefresh = e;
1802
+ const r = t || window.dreamsSlotsToUpdate || [], o = r.length;
1803
+ if (o === 0)
1804
+ return !1;
1805
+ try {
1806
+ return window.googletag.pubads().refresh(r, {
1807
+ changeCorrelator: !1
1808
+ }), this.dispatchEvent("refresh", void 0, o), !0;
1809
+ } catch {
1810
+ return !1;
1811
+ }
1812
+ }
1813
+ static dispatchEvent(t, e, i = 0) {
1814
+ window.dispatchEvent(
1815
+ new CustomEvent("ad:refresh", {
1816
+ detail: {
1817
+ type: t,
1818
+ reason: e,
1819
+ slots: i,
1820
+ timestamp: Date.now()
1821
+ }
1822
+ })
1823
+ );
1824
+ }
1825
+ };
1826
+ N.config = Et, N.refreshTimer = null, N.running = !1;
1827
+ let Tt = N;
1828
+ const xt = {
1829
+ enabled: "auto",
1830
+ prefix: "[DreamsAdEngine]",
1831
+ verbose: !1
1832
+ }, dt = class dt {
1833
+ /**
1834
+ * Configure the logger
1835
+ */
1836
+ static configure(t) {
1837
+ this.config = { ...xt, ...t };
1838
+ }
1839
+ /**
1840
+ * Log info message
1841
+ */
1842
+ static log(t, ...e) {
1843
+ this.shouldLog() && console.log(`${this.config.prefix} ${t}`, ...e);
1844
+ }
1845
+ /**
1846
+ * Log warning message
1847
+ */
1848
+ static warn(t, ...e) {
1849
+ this.shouldLog() && console.warn(`${this.config.prefix} ${t}`, ...e);
1850
+ }
1851
+ /**
1852
+ * Log error message (always logs in production, but less verbose)
1853
+ */
1854
+ static error(t, ...e) {
1855
+ this.isProduction() ? console.error(`${this.config.prefix} Error: ${t}`) : console.error(`${this.config.prefix} ${t}`, ...e);
1856
+ }
1857
+ /**
1858
+ * Log verbose/debug message (only when verbose is enabled)
1859
+ */
1860
+ static debug(t, ...e) {
1861
+ !this.shouldLog() || !this.config.verbose || console.debug(`${this.config.prefix} ${t}`, ...e);
1862
+ }
1863
+ /**
1864
+ * Log a table (useful for metrics)
1865
+ */
1866
+ static table(t) {
1867
+ this.shouldLog() && console.table(t);
1868
+ }
1869
+ /**
1870
+ * Group logs together
1871
+ */
1872
+ static group(t) {
1873
+ this.shouldLog() && console.group(`${this.config.prefix} ${t}`);
1874
+ }
1875
+ /**
1876
+ * End log group
1877
+ */
1878
+ static groupEnd() {
1879
+ this.shouldLog() && console.groupEnd();
1880
+ }
1881
+ /**
1882
+ * Time a operation
1883
+ */
1884
+ static time(t) {
1885
+ this.shouldLog() && console.time(`${this.config.prefix} ${t}`);
1886
+ }
1887
+ /**
1888
+ * End timing
1889
+ */
1890
+ static timeEnd(t) {
1891
+ this.shouldLog() && console.timeEnd(`${this.config.prefix} ${t}`);
1892
+ }
1893
+ static shouldLog() {
1894
+ return this.config.enabled === !0 ? !0 : this.config.enabled === !1 ? !1 : !this.isProduction();
1895
+ }
1896
+ static isProduction() {
1897
+ if (typeof window > "u") return !0;
1898
+ const t = window.location.hostname;
1899
+ return t !== "localhost" && !t.includes(".local") && !t.includes("127.0.0.1") && !t.includes("192.168.") && !t.includes("0.0.0.0");
1900
+ }
1901
+ };
1902
+ dt.config = xt;
1903
+ let zt = dt;
1904
+ const Ct = {
1905
+ enabled: !1,
1906
+ positions: [],
1907
+ minViewportHeight: 768,
1908
+ topOffset: 80,
1909
+ headerSelector: null,
1910
+ smoothTransition: !0,
1911
+ transitionDuration: 150
1912
+ }, R = class R {
1913
+ /**
1914
+ * Configure the sticky manager
1915
+ */
1916
+ static configure(t) {
1917
+ this.config = { ...Ct, ...t };
1918
+ }
1919
+ /**
1920
+ * Check if a position supports sticky
1921
+ */
1922
+ static isStickyPosition(t) {
1923
+ return this.config.positions.includes(t);
1924
+ }
1925
+ /**
1926
+ * Enable sticky behavior for an ad element
1927
+ */
1928
+ static enable(t, e, i) {
1929
+ if (!this.config.enabled || !this.isStickyPosition(i) || this.stickyAds.has(e) || window.innerHeight < this.config.minViewportHeight)
1930
+ return !1;
1931
+ const s = t.querySelector(
1932
+ '[class*="ad-serving"]'
1933
+ );
1934
+ if (!s) return !1;
1935
+ const r = this.getTopOffset();
1936
+ this.config.smoothTransition && (s.style.transition = `top ${this.config.transitionDuration}ms ease-out`), s.style.position = "sticky", s.style.top = `${r}px`, s.style.alignSelf = "flex-start", s.style.zIndex = "10";
1937
+ const o = {
1938
+ adId: e,
1939
+ position: i,
1940
+ stickyTime: 0,
1941
+ totalTime: 0,
1942
+ isCurrentlySticky: !1
1943
+ }, l = () => this.handleScroll(e, r), a = {
1944
+ element: s,
1945
+ container: t,
1946
+ metrics: o,
1947
+ startTime: Date.now(),
1948
+ stickyStartTime: null,
1949
+ scrollHandler: l
1950
+ };
1951
+ return this.stickyAds.set(e, a), window.addEventListener("scroll", l, { passive: !0 }), !0;
1952
+ }
1953
+ /**
1954
+ * Disable sticky behavior for an ad
1955
+ */
1956
+ static disable(t) {
1957
+ const e = this.stickyAds.get(t);
1958
+ e && (e.element.style.position = "", e.element.style.top = "", e.element.style.alignSelf = "", e.element.style.zIndex = "", e.element.style.transition = "", window.removeEventListener("scroll", e.scrollHandler), this.stickyAds.delete(t));
1959
+ }
1960
+ /**
1961
+ * Get metrics for a sticky ad
1962
+ */
1963
+ static getMetrics(t) {
1964
+ const e = this.stickyAds.get(t);
1965
+ return e ? (e.metrics.totalTime = Date.now() - e.startTime, { ...e.metrics }) : null;
1966
+ }
1967
+ /**
1968
+ * Get all sticky metrics
1969
+ */
1970
+ static getAllMetrics() {
1971
+ return Array.from(this.stickyAds.values()).map((t) => (t.metrics.totalTime = Date.now() - t.startTime, { ...t.metrics }));
1972
+ }
1973
+ /**
1974
+ * Reset all sticky ads
1975
+ */
1976
+ static reset() {
1977
+ for (const t of this.stickyAds.keys())
1978
+ this.disable(t);
1979
+ }
1980
+ static getTopOffset() {
1981
+ if (this.config.headerSelector) {
1982
+ const t = document.querySelector(
1983
+ this.config.headerSelector
1984
+ );
1985
+ if (t)
1986
+ return t.offsetHeight + 10;
1987
+ }
1988
+ return this.config.topOffset;
1989
+ }
1990
+ static handleScroll(t, e) {
1991
+ const i = Date.now();
1992
+ i - this.lastScrollTime < 100 || (this.lastScrollTime = i, requestAnimationFrame(() => this.checkSticky(t, e)));
1993
+ }
1994
+ static checkSticky(t, e) {
1995
+ const i = this.stickyAds.get(t);
1996
+ if (!i) return;
1997
+ const r = i.element.getBoundingClientRect().top <= e + 5;
1998
+ r && !i.stickyStartTime ? (i.stickyStartTime = Date.now(), i.metrics.isCurrentlySticky = !0, this.dispatchEvent("sticky:start", t, i.metrics)) : !r && i.stickyStartTime && (i.metrics.stickyTime += Date.now() - i.stickyStartTime, i.stickyStartTime = null, i.metrics.isCurrentlySticky = !1, this.dispatchEvent("sticky:end", t, i.metrics));
1999
+ }
2000
+ static dispatchEvent(t, e, i) {
2001
+ window.dispatchEvent(
2002
+ new CustomEvent(t, {
2003
+ detail: {
2004
+ adId: e,
2005
+ metrics: { ...i },
2006
+ timestamp: Date.now()
2007
+ }
2008
+ })
2009
+ );
2010
+ }
1031
2011
  };
1032
- l.styles = ft(Kt);
1033
- l.initialized = !1;
1034
- l.old_url = "";
1035
- l.initialized_aps = !1;
1036
- c([
1037
- g({ type: String })
1038
- ], l.prototype, "networkId", 2);
1039
- c([
1040
- g({ type: String })
1041
- ], l.prototype, "adUnit", 2);
1042
- c([
1043
- g({ type: String })
1044
- ], l.prototype, "divId", 2);
1045
- c([
1046
- g({ type: String })
1047
- ], l.prototype, "slot", 2);
1048
- c([
1049
- g({ type: Array })
1050
- ], l.prototype, "mapping", 2);
1051
- c([
1052
- g({ type: Array })
1053
- ], l.prototype, "sizing", 2);
1054
- c([
1055
- g({ type: Array })
1056
- ], l.prototype, "targeting", 2);
1057
- c([
1058
- g({ type: Boolean, reflect: !0 })
1059
- ], l.prototype, "autoTargeting", 2);
1060
- c([
1061
- Jt()
1062
- ], l.prototype, "resolvedTargeting", 2);
1063
- c([
1064
- g({ type: Boolean, reflect: !0 })
1065
- ], l.prototype, "setCentering", 2);
1066
- c([
1067
- g({ type: Boolean, reflect: !0 })
1068
- ], l.prototype, "enableLazyLoad", 2);
1069
- c([
1070
- g({ type: Object })
1071
- ], l.prototype, "configLazyLoad", 2);
1072
- c([
1073
- g({ type: Boolean, reflect: !0 })
1074
- ], l.prototype, "refresh", 2);
1075
- c([
1076
- g({ type: Boolean, reflect: !0 })
1077
- ], l.prototype, "enableTitle", 2);
1078
- c([
1079
- g({ type: Boolean, reflect: !0 })
1080
- ], l.prototype, "apstag", 2);
1081
- c([
1082
- g({ type: String })
1083
- ], l.prototype, "pubId", 2);
1084
- c([
1085
- g({ type: Number })
1086
- ], l.prototype, "bidTimeout", 2);
1087
- c([
1088
- g({ type: String })
1089
- ], l.prototype, "title", 2);
1090
- c([
1091
- g({ type: Boolean })
1092
- ], l.prototype, "adLoaded", 2);
1093
- l = c([
1094
- Wt("dreams-ad-engine")
1095
- ], l);
2012
+ R.config = Ct, R.stickyAds = /* @__PURE__ */ new Map(), R.lastScrollTime = 0;
2013
+ let Pt = R;
1096
2014
  export {
1097
- Gt as DEFAULT_SLOTS,
1098
- l as DreamsAdComponent,
1099
- w as DreamsAdConfig,
1100
- G as DreamsTargetingService
2015
+ kt as AdBlockDetector,
2016
+ ge as DEFAULT_SLOTS,
2017
+ d as DreamsAdComponent,
2018
+ _ as DreamsAdConfig,
2019
+ E as DreamsAdSkeleton,
2020
+ K as DreamsTargetingService,
2021
+ zt as Logger,
2022
+ Tt as RefreshManager,
2023
+ Pt as StickyManager,
2024
+ Z as ViewabilityService,
2025
+ ye as getSkeletonDimensions
1101
2026
  };