article-content-renderer-vue2 0.1.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.
package/dist/index.js CHANGED
@@ -1,294 +1,43 @@
1
- var z = Object.defineProperty, F = Object.defineProperties;
2
- var Y = Object.getOwnPropertyDescriptors;
3
- var T = Object.getOwnPropertySymbols;
4
- var G = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
5
- var k = (i, e, t) => e in i ? z(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, m = (i, e) => {
6
- for (var t in e || (e = {}))
7
- G.call(e, t) && k(i, t, e[t]);
8
- if (T)
9
- for (var t of T(e))
10
- H.call(e, t) && k(i, t, e[t]);
1
+ var j = Object.defineProperty, z = Object.defineProperties;
2
+ var M = Object.getOwnPropertyDescriptors;
3
+ var S = Object.getOwnPropertySymbols;
4
+ var Y = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
5
+ var E = (i, r, t) => r in i ? j(i, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[r] = t, m = (i, r) => {
6
+ for (var t in r || (r = {}))
7
+ Y.call(r, t) && E(i, t, r[t]);
8
+ if (S)
9
+ for (var t of S(r))
10
+ F.call(r, t) && E(i, t, r[t]);
11
11
  return i;
12
- }, S = (i, e) => F(i, Y(e));
13
- var v = (i, e, t) => k(i, typeof e != "symbol" ? e + "" : e, t);
14
- import N from "vue";
15
- const W = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), Q = /* @__PURE__ */ new Set(["http:", "https:", "blob:"]), X = "https://article-content-renderer.invalid/", I = "https://www.doitme.link/";
16
- function J(i, e) {
12
+ }, A = (i, r) => z(i, M(r));
13
+ var B = (i, r, t) => E(i, typeof r != "symbol" ? r + "" : r, t);
14
+ import K from "vue";
15
+ const G = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), W = /* @__PURE__ */ new Set(["http:", "https:", "blob:"]), H = "https://article-content-renderer.invalid/", N = "https://www.doitme.link/";
16
+ function X(i, r) {
17
17
  if (typeof i != "string") return i;
18
18
  const t = i.trim();
19
- if (!t.startsWith(I)) return t;
20
- const n = (e.trim() || I).replace(/\/+$/u, ""), s = t.slice(I.length).replace(/^\/+/, "");
19
+ if (!t.startsWith(N)) return t;
20
+ const n = (r.trim() || N).replace(/\/+$/u, ""), s = t.slice(N.length).replace(/^\/+/, "");
21
21
  return `${n}/${s}`;
22
22
  }
23
- function E(i, e) {
23
+ function T(i, r) {
24
24
  if (typeof i != "string") return null;
25
25
  const t = i.trim();
26
26
  if (!t || /[\u0000-\u001F\u007F]/u.test(t)) return null;
27
27
  try {
28
- const r = new URL(t, X);
29
- return (e === "link" ? W : Q).has(r.protocol) ? t : null;
30
- } catch (r) {
28
+ const e = new URL(t, H);
29
+ return (r === "link" ? G : W).has(e.protocol) ? t : null;
30
+ } catch (e) {
31
31
  return null;
32
32
  }
33
33
  }
34
- function V(i, e) {
34
+ function U(i, r) {
35
35
  const t = new Set(
36
36
  typeof i == "string" ? i.trim().split(/\s+/u).filter(Boolean) : []
37
37
  );
38
- return e === "_blank" && (t.add("noopener"), t.add("noreferrer")), t.size > 0 ? [...t].join(" ") : void 0;
38
+ return r === "_blank" && (t.add("noopener"), t.add("noreferrer")), t.size > 0 ? [...t].join(" ") : void 0;
39
39
  }
40
- function Z(i) {
41
- const e = i.trim();
42
- return e ? e.startsWith("ca-pub-") ? e : `ca-pub-${e}` : "";
43
- }
44
- const U = N.extend({
45
- name: "ArticleAdSenseAd",
46
- props: {
47
- publisherId: {
48
- type: String,
49
- required: !0
50
- },
51
- slotId: {
52
- type: [String, Number],
53
- required: !0
54
- },
55
- title: {
56
- type: String,
57
- default: "Advertisement"
58
- }
59
- },
60
- data() {
61
- return {
62
- observer: null,
63
- requestedKey: null
64
- };
65
- },
66
- computed: {
67
- adClient() {
68
- return Z(this.publisherId);
69
- },
70
- adSlot() {
71
- return String(this.slotId).trim();
72
- },
73
- requestKey() {
74
- return `${this.adClient}:${this.adSlot}`;
75
- }
76
- },
77
- watch: {
78
- requestKey() {
79
- this.requestedKey = null, this.stopObserver(), this.$nextTick(() => this.startObserver());
80
- }
81
- },
82
- mounted() {
83
- this.startObserver();
84
- },
85
- beforeDestroy() {
86
- this.stopObserver();
87
- },
88
- methods: {
89
- requestAd() {
90
- var i;
91
- if (!(!this.adClient || !this.adSlot || this.requestedKey === this.requestKey))
92
- try {
93
- const e = window;
94
- ((i = e.adsbygoogle) != null ? i : e.adsbygoogle = []).push({}), this.requestedKey = this.requestKey;
95
- } catch (e) {
96
- console.error("[ArticleContentRenderer] Failed to request AdSense ad:", e);
97
- }
98
- },
99
- startObserver() {
100
- const i = this.$refs.root;
101
- if (!(!i || !this.adClient || !this.adSlot)) {
102
- if (typeof IntersectionObserver == "undefined") {
103
- this.requestAd();
104
- return;
105
- }
106
- this.observer = new IntersectionObserver(
107
- (e) => {
108
- e.some((t) => t.isIntersecting) && (this.requestAd(), this.stopObserver());
109
- },
110
- { rootMargin: "200px 0px" }
111
- ), this.observer.observe(i);
112
- }
113
- },
114
- stopObserver() {
115
- var i;
116
- (i = this.observer) == null || i.disconnect(), this.observer = null;
117
- }
118
- },
119
- render(i) {
120
- return !this.adClient || !this.adSlot ? i() : i(
121
- "div",
122
- {
123
- ref: "root",
124
- staticClass: "article-ad-wrapper",
125
- attrs: { "data-google-ad": "true" }
126
- },
127
- [
128
- i("div", { staticClass: "article-ad-title" }, this.title),
129
- i("ins", {
130
- key: this.requestKey,
131
- staticClass: "adsbygoogle article-ad-unit",
132
- style: { display: "block", width: "100%" },
133
- attrs: {
134
- "data-ad-client": this.adClient,
135
- "data-ad-slot": this.adSlot
136
- }
137
- })
138
- ]
139
- );
140
- }
141
- });
142
- function _() {
143
- var e;
144
- const i = window;
145
- return (e = i.googletag) != null || (i.googletag = { cmd: [] }), i.googletag;
146
- }
147
- function tt(i, e) {
148
- const t = i.trim().replace(/\/+$/u, ""), r = e.replace(/^\/+|\/+$/gu, "");
149
- return t && r ? `${t}/${r}` : "";
150
- }
151
- const et = N.extend({
152
- name: "ArticleAdManagerAd",
153
- props: {
154
- publisherId: {
155
- type: String,
156
- required: !0
157
- },
158
- slotId: {
159
- type: [String, Number],
160
- required: !0
161
- },
162
- title: {
163
- type: String,
164
- default: "Advertisement"
165
- },
166
- fallbackPublisherId: {
167
- type: String,
168
- default: ""
169
- },
170
- fallbackSlotId: {
171
- type: [String, Number],
172
- default: void 0
173
- }
174
- },
175
- data() {
176
- return {
177
- observer: null,
178
- definedSlot: null,
179
- pubAdsService: null,
180
- slotRenderEnded: null,
181
- emptyAdmKey: null,
182
- cancelled: !1
183
- };
184
- },
185
- computed: {
186
- admSlotId() {
187
- return String(this.slotId).trim();
188
- },
189
- adsSlotId() {
190
- return this.fallbackSlotId === void 0 ? "" : String(this.fallbackSlotId).trim();
191
- },
192
- adUnitPath() {
193
- return tt(this.publisherId, this.admSlotId);
194
- },
195
- fallbackKey() {
196
- return `${this.adUnitPath}:${this.admSlotId}:${this.fallbackPublisherId}:${this.adsSlotId}`;
197
- },
198
- hasAdSenseFallback() {
199
- return !!(this.fallbackPublisherId.trim() && this.adsSlotId);
200
- },
201
- shouldUseAdSense() {
202
- return this.hasAdSenseFallback && this.emptyAdmKey === this.fallbackKey;
203
- }
204
- },
205
- watch: {
206
- fallbackKey() {
207
- this.restartAdManager();
208
- }
209
- },
210
- mounted() {
211
- this.startObserver();
212
- },
213
- beforeDestroy() {
214
- this.cleanupAdManager();
215
- },
216
- methods: {
217
- restartAdManager() {
218
- this.cleanupAdManager(), this.emptyAdmKey = null, this.$nextTick(() => this.startObserver());
219
- },
220
- startObserver() {
221
- const i = this.$refs.root;
222
- if (!(!i || !this.adUnitPath || !this.admSlotId || this.shouldUseAdSense)) {
223
- if (this.cancelled = !1, typeof IntersectionObserver == "undefined") {
224
- this.requestAd();
225
- return;
226
- }
227
- this.observer = new IntersectionObserver(
228
- (e) => {
229
- var t;
230
- e.some((r) => r.isIntersecting) && (this.requestAd(), (t = this.observer) == null || t.disconnect(), this.observer = null);
231
- },
232
- { rootMargin: "200px 0px" }
233
- ), this.observer.observe(i);
234
- }
235
- },
236
- requestAd() {
237
- const i = this.$refs.unit;
238
- if (!i) return;
239
- const e = _();
240
- e.cmd.push(() => {
241
- if (this.cancelled) return;
242
- const t = i.clientWidth, r = i.clientHeight, n = t > 0 && r > 0 ? ["fluid", [t, r]] : "fluid", s = e.defineSlot(this.adUnitPath, n, this.admSlotId);
243
- if (!s) return;
244
- const a = e.pubads(), o = (c) => {
245
- if (this.cancelled || c.slot !== s || !c.isEmpty || !this.hasAdSenseFallback) return;
246
- const d = this.fallbackKey;
247
- this.cleanupAdManager(), this.emptyAdmKey = d;
248
- };
249
- this.definedSlot = s, this.pubAdsService = a, this.slotRenderEnded = o, a.addEventListener("slotRenderEnded", o), s.addService(a), e.enableServices(), e.display(this.admSlotId);
250
- });
251
- },
252
- cleanupAdManager() {
253
- var n;
254
- this.cancelled = !0, (n = this.observer) == null || n.disconnect(), this.observer = null;
255
- const i = this.definedSlot, e = this.pubAdsService, t = this.slotRenderEnded;
256
- if (this.definedSlot = null, this.pubAdsService = null, this.slotRenderEnded = null, !i && !t) return;
257
- const r = _();
258
- r.cmd.push(() => {
259
- var s, a;
260
- e && t && ((s = e.removeEventListener) == null || s.call(e, "slotRenderEnded", t)), i && ((a = r.destroySlots) == null || a.call(r, [i]));
261
- });
262
- }
263
- },
264
- render(i) {
265
- return this.shouldUseAdSense ? i(U, {
266
- props: {
267
- publisherId: this.fallbackPublisherId,
268
- slotId: this.adsSlotId,
269
- title: this.title
270
- }
271
- }) : !this.adUnitPath || !this.admSlotId ? i() : i(
272
- "div",
273
- {
274
- ref: "root",
275
- staticClass: "article-ad-wrapper article-adm-wrapper",
276
- attrs: {
277
- "data-google-ad-manager": "true",
278
- "data-ad-unit-path": this.adUnitPath
279
- }
280
- },
281
- [
282
- i("div", { staticClass: "article-ad-title" }, this.title),
283
- i("div", {
284
- ref: "unit",
285
- staticClass: "article-ad-unit article-adm-unit",
286
- attrs: { id: this.admSlotId }
287
- })
288
- ]
289
- );
290
- }
291
- }), rt = /* @__PURE__ */ new Set([
40
+ const J = /* @__PURE__ */ new Set([
292
41
  "paragraph",
293
42
  "heading",
294
43
  "blockquote",
@@ -300,207 +49,217 @@ const et = N.extend({
300
49
  "articleButton",
301
50
  "table"
302
51
  ]);
303
- function g(i) {
52
+ function p(i) {
304
53
  return typeof i == "object" && i !== null && !Array.isArray(i);
305
54
  }
306
- function R(i) {
307
- return g(i) ? i : {};
55
+ function _(i) {
56
+ return p(i) ? i : {};
308
57
  }
309
- function h(i, e, t, r) {
58
+ function f(i, r, t, e) {
310
59
  var c;
311
- const n = g(t) ? t : {}, s = g(t) ? r : t, a = {}, o = {};
312
- for (const [d, f] of Object.entries(n))
313
- if (d === "class")
314
- a.class = f;
315
- else if (d === "style")
316
- a.style = f;
317
- else if (d.startsWith("on") && typeof f == "function") {
318
- const j = d.slice(2).toLowerCase();
319
- a.on = S(m({}, (c = a.on) != null ? c : {}), { [j]: f });
320
- } else f !== void 0 && f !== !1 && (o[d] = f);
321
- return Object.keys(o).length > 0 && (a.attrs = o), i.createElement(e, a, s);
322
- }
323
- function y(i) {
60
+ const n = p(t) ? t : {}, s = p(t) ? e : t, o = {}, l = {};
61
+ for (const [u, h] of Object.entries(n))
62
+ if (u === "class")
63
+ o.class = h;
64
+ else if (u === "style")
65
+ o.style = h;
66
+ else if (u.startsWith("on") && typeof h == "function") {
67
+ const y = u.slice(2).toLowerCase();
68
+ o.on = A(m({}, (c = o.on) != null ? c : {}), { [y]: h });
69
+ } else h !== void 0 && h !== !1 && (l[u] = h);
70
+ return Object.keys(l).length > 0 && (o.attrs = l), i.createElement(r, o, s);
71
+ }
72
+ function k(i) {
324
73
  return Array.isArray(i) ? i : [];
325
74
  }
326
- function p(i, ...e) {
327
- return `${i}/${e.map(String).join("/")}`;
75
+ function g(i, ...r) {
76
+ return `${i}/${r.map(String).join("/")}`;
328
77
  }
329
- function C(i) {
78
+ function w(i) {
330
79
  return i === "left" || i === "center" || i === "right" || i === "justify";
331
80
  }
332
- function it(i) {
81
+ function Q(i) {
333
82
  return i === "left" || i === "center" || i === "right";
334
83
  }
335
- function L(i) {
84
+ function R(i) {
336
85
  return i === "_blank" || i === "_self";
337
86
  }
338
- function A(i, e) {
339
- i.reportIssue(e);
87
+ function b(i, r) {
88
+ i.reportIssue(r);
340
89
  }
341
- function nt(i, e, t) {
342
- if (!g(i) || i.type !== "text" || typeof i.text != "string" || !i.text)
90
+ function Z(i, r, t) {
91
+ if (!p(i) || i.type !== "text" || typeof i.text != "string" || !i.text)
343
92
  return null;
344
- let r = i.text;
345
- const n = y(i.marks);
93
+ let e = i.text;
94
+ const n = k(i.marks);
346
95
  for (let s = 0; s < n.length; s += 1) {
347
- const a = n[s];
348
- if (!g(a) || typeof a.type != "string") continue;
349
- const o = p(e, "marks", s);
350
- switch (a.type) {
96
+ const o = n[s];
97
+ if (!p(o) || typeof o.type != "string") continue;
98
+ const l = g(r, "marks", s);
99
+ switch (o.type) {
351
100
  case "bold":
352
- r = h(t, "strong", { class: "acp-mark acp-mark--bold" }, [r]);
101
+ e = f(t, "strong", { class: "acp-mark acp-mark--bold" }, [e]);
353
102
  break;
354
103
  case "italic":
355
- r = h(t, "em", { class: "acp-mark acp-mark--italic" }, [r]);
104
+ e = f(t, "em", { class: "acp-mark acp-mark--italic" }, [e]);
356
105
  break;
357
106
  case "strike":
358
- r = h(t, "s", { class: "acp-mark acp-mark--strike" }, [r]);
107
+ e = f(t, "s", { class: "acp-mark acp-mark--strike" }, [e]);
359
108
  break;
360
109
  case "underline":
361
- r = h(t, "u", { class: "acp-mark acp-mark--underline" }, [r]);
110
+ e = f(t, "u", { class: "acp-mark acp-mark--underline" }, [e]);
362
111
  break;
363
112
  case "code":
364
- r = h(t, "code", { class: "acp-mark acp-mark--code" }, [r]);
113
+ e = f(t, "code", { class: "acp-mark acp-mark--code" }, [e]);
365
114
  break;
366
115
  case "link": {
367
- const c = R(a.attrs), d = E(c.href, "link");
368
- if (!d) {
369
- A(t, {
116
+ const c = _(o.attrs), u = T(c.href, "link");
117
+ if (!u) {
118
+ b(t, {
370
119
  code: "UNSAFE_URL",
371
- path: p(o, "attrs", "href"),
120
+ path: g(l, "attrs", "href"),
372
121
  message: "The link URL is empty, malformed, or uses a disallowed protocol.",
373
122
  nodeType: "link"
374
123
  });
375
124
  break;
376
125
  }
377
- const f = L(c.target) ? c.target : "_blank";
378
- r = h(
126
+ const h = R(c.target) ? c.target : "_blank";
127
+ e = f(
379
128
  t,
380
129
  "a",
381
130
  {
382
131
  class: "acp-link",
383
- href: d,
384
- target: f,
385
- rel: V(void 0, f)
132
+ href: u,
133
+ target: h,
134
+ rel: U(void 0, h)
386
135
  },
387
- [r]
136
+ [e]
388
137
  );
389
138
  break;
390
139
  }
391
140
  }
392
141
  }
393
- return r;
142
+ return e;
394
143
  }
395
- function O(i, e, t) {
396
- return y(i).map((r, n) => nt(r, p(e, n), t)).filter((r) => r !== null);
144
+ function O(i, r, t) {
145
+ return k(i).map((e, n) => Z(e, g(r, n), t)).filter((e) => e !== null);
397
146
  }
398
- function q(i, e, t) {
399
- return !g(i) || i.type !== "listItem" ? null : h(
147
+ function V(i, r, t) {
148
+ return !p(i) || i.type !== "listItem" ? null : f(
400
149
  t,
401
150
  "li",
402
151
  { class: "acp-list-item", "data-node-type": "listItem" },
403
- P(i.content, p(e, "content"), t)
152
+ P(i.content, g(r, "content"), t)
404
153
  );
405
154
  }
406
- function st(i, e, t) {
407
- return !g(i) || i.type !== "tableCell" ? null : h(
155
+ function tt(i, r, t) {
156
+ return !p(i) || i.type !== "tableCell" ? null : f(
408
157
  t,
409
158
  "td",
410
159
  { class: "acp-table-cell", "data-node-type": "tableCell" },
411
- P(i.content, p(e, "content"), t)
160
+ P(i.content, g(r, "content"), t)
412
161
  );
413
162
  }
414
- function at(i, e, t) {
415
- if (!g(i) || i.type !== "tableRow") return null;
416
- const r = y(i.content).map((n, s) => st(n, p(e, "content", s), t)).filter((n) => n !== null);
417
- return h(t, "tr", { class: "acp-table-row", "data-node-type": "tableRow" }, r);
163
+ function et(i, r, t) {
164
+ if (!p(i) || i.type !== "tableRow") return null;
165
+ const e = k(i.content).map((n, s) => tt(n, g(r, "content", s), t)).filter((n) => n !== null);
166
+ return f(t, "tr", { class: "acp-table-row", "data-node-type": "tableRow" }, e);
418
167
  }
419
- function ot(i) {
168
+ function q(i) {
420
169
  var n;
421
- if (g(i) && i.target !== void 0 && !L(i.target) || g(i) && i.rel !== void 0 && typeof i.rel != "string") return null;
422
- const e = typeof i == "string" ? { href: i } : g(i) && typeof i.href == "string" ? m(m({
170
+ if (p(i) && i.target !== void 0 && !R(i.target) || p(i) && i.rel !== void 0 && typeof i.rel != "string") return null;
171
+ const r = typeof i == "string" ? { href: i } : p(i) && typeof i.href == "string" ? m(m({
423
172
  href: i.href
424
- }, L(i.target) ? { target: i.target } : {}), typeof i.rel == "string" ? { rel: i.rel } : {}) : null;
425
- if (!e) return null;
426
- const t = E(e.href, "link");
173
+ }, R(i.target) ? { target: i.target } : {}), typeof i.rel == "string" ? { rel: i.rel } : {}) : null;
174
+ if (!r) return null;
175
+ const t = T(r.href, "link");
427
176
  if (!t) return null;
428
- const r = (n = e.target) != null ? n : "_self";
177
+ const e = (n = r.target) != null ? n : "_self";
429
178
  return {
430
179
  href: t,
431
- target: r,
432
- rel: V(e.rel, r)
180
+ target: e,
181
+ rel: U(r.rel, e)
433
182
  };
434
183
  }
435
- function lt(i, e, t) {
436
- var c;
437
- const r = R(i.attrs);
438
- if (typeof r.id != "string" || !r.id || typeof r.text != "string" || !r.text || r.style !== "text" && r.style !== "button")
184
+ function rt(i, r, t) {
185
+ var h;
186
+ const e = _(i.attrs), n = e.style === "text" || e.style === "button", s = e.style === "link";
187
+ if (typeof e.text != "string" || !e.text || !n && !s || n && (typeof e.id != "string" || !e.id) || s && e.id !== void 0 && (typeof e.id != "string" || !e.id))
439
188
  return null;
440
- const n = Object.freeze(S(m({
441
- id: r.id
442
- }, typeof r.title == "string" ? { title: r.title } : {}), {
443
- text: r.text,
444
- style: r.style
445
- })), s = Object.freeze({ type: "articleButton", attrs: n });
446
- let a = null;
447
- if (!t.resolveArticleButtonLink)
448
- A(t, {
189
+ const o = Object.freeze(s ? m(A(m(m({}, typeof e.id == "string" ? { id: e.id } : {}), typeof e.title == "string" ? { title: e.title } : {}), {
190
+ text: e.text,
191
+ style: "link"
192
+ }), typeof e.href == "string" ? { href: e.href } : {}) : A(m({
193
+ id: e.id
194
+ }, typeof e.title == "string" ? { title: e.title } : {}), {
195
+ text: e.text,
196
+ style: e.style
197
+ })), l = Object.freeze({ type: "articleButton", attrs: o });
198
+ let c = null;
199
+ if (o.style === "link")
200
+ o.href !== void 0 && (c = q(o.href), c || b(t, {
201
+ code: "UNSAFE_URL",
202
+ path: `${r}/attrs/href`,
203
+ message: "The articleButton link href is not a usable safe URL.",
204
+ nodeType: "articleButton"
205
+ }));
206
+ else if (!t.resolveArticleButtonLink)
207
+ b(t, {
449
208
  code: "LINK_RESOLUTION_FAILED",
450
- path: e,
209
+ path: r,
451
210
  message: "No resolveArticleButtonLink callback was provided for an articleButton node.",
452
211
  nodeType: "articleButton"
453
212
  });
454
213
  else
455
214
  try {
456
- const d = t.resolveArticleButtonLink(n, s);
457
- a = ot(d), a || A(t, {
458
- code: typeof d == "string" || g(d) && typeof d.href == "string" ? "UNSAFE_URL" : "LINK_RESOLUTION_FAILED",
459
- path: e,
215
+ const y = Object.freeze({ type: "articleButton", attrs: o }), L = t.resolveArticleButtonLink(o, y);
216
+ c = q(L), c || b(t, {
217
+ code: typeof L == "string" || p(L) && typeof L.href == "string" ? "UNSAFE_URL" : "LINK_RESOLUTION_FAILED",
218
+ path: r,
460
219
  message: "The articleButton link resolver returned no usable safe URL.",
461
220
  nodeType: "articleButton"
462
221
  });
463
- } catch (d) {
464
- A(t, {
222
+ } catch (y) {
223
+ b(t, {
465
224
  code: "LINK_RESOLUTION_FAILED",
466
- path: e,
467
- message: `The articleButton link resolver threw an error: ${d instanceof Error ? d.message : String(d)}`,
225
+ path: r,
226
+ message: `The articleButton link resolver threw an error: ${y instanceof Error ? y.message : String(y)}`,
468
227
  nodeType: "articleButton"
469
228
  });
470
229
  }
471
- const o = (c = a == null ? void 0 : a.href) != null ? c : null;
472
- return h(
230
+ const u = (h = c == null ? void 0 : c.href) != null ? h : null;
231
+ return f(
473
232
  t,
474
233
  "a",
475
234
  {
476
235
  class: [
477
236
  "acp-article-button",
478
- `acp-article-button--${n.style}`,
479
- !o && "acp-article-button--disabled"
237
+ `acp-article-button--${o.style}`,
238
+ !u && "acp-article-button--disabled"
480
239
  ],
481
- href: o != null ? o : void 0,
482
- target: a == null ? void 0 : a.target,
483
- rel: a == null ? void 0 : a.rel,
484
- title: n.title,
240
+ href: u != null ? u : void 0,
241
+ target: c == null ? void 0 : c.target,
242
+ rel: c == null ? void 0 : c.rel,
243
+ title: o.title,
485
244
  "data-node-type": "articleButton",
486
- "data-article-button-id": n.id,
487
- "data-article-button-style": n.style,
488
- "aria-disabled": o ? void 0 : "true",
489
- onClick: (d) => {
490
- o || d.preventDefault(), t.emitArticleButtonClick({ attrs: n, node: s, href: o, event: d });
245
+ "data-article-button-id": o.id,
246
+ "data-article-button-style": o.style,
247
+ "aria-disabled": u ? void 0 : "true",
248
+ onClick: (y) => {
249
+ u || y.preventDefault(), t.emitArticleButtonClick({ attrs: o, node: l, href: u, event: y });
491
250
  }
492
251
  },
493
- n.text
252
+ o.text
494
253
  );
495
254
  }
496
- function D(i, e, t) {
497
- if (!g(i) || typeof i.type != "string" || !rt.has(i.type))
255
+ function D(i, r, t) {
256
+ if (!p(i) || typeof i.type != "string" || !J.has(i.type))
498
257
  return null;
499
- const r = R(i.attrs);
258
+ const e = _(i.attrs);
500
259
  switch (i.type) {
501
260
  case "paragraph": {
502
- const n = C(r.textAlign) ? r.textAlign : void 0;
503
- return h(
261
+ const n = w(e.textAlign) ? e.textAlign : void 0;
262
+ return f(
504
263
  t,
505
264
  "p",
506
265
  {
@@ -508,12 +267,12 @@ function D(i, e, t) {
508
267
  "data-node-type": "paragraph",
509
268
  style: n ? { textAlign: n } : void 0
510
269
  },
511
- O(i.content, p(e, "content"), t)
270
+ O(i.content, g(r, "content"), t)
512
271
  );
513
272
  }
514
273
  case "heading": {
515
- const n = Number.isInteger(r.level) && Number(r.level) >= 1 && Number(r.level) <= 6 ? Number(r.level) : 1, s = C(r.textAlign) ? r.textAlign : void 0;
516
- return h(
274
+ const n = Number.isInteger(e.level) && Number(e.level) >= 1 && Number(e.level) <= 6 ? Number(e.level) : 1, s = w(e.textAlign) ? e.textAlign : void 0;
275
+ return f(
517
276
  t,
518
277
  `h${n}`,
519
278
  {
@@ -521,23 +280,23 @@ function D(i, e, t) {
521
280
  "data-node-type": "heading",
522
281
  style: s ? { textAlign: s } : void 0
523
282
  },
524
- O(i.content, p(e, "content"), t)
283
+ O(i.content, g(r, "content"), t)
525
284
  );
526
285
  }
527
286
  case "blockquote":
528
- return h(
287
+ return f(
529
288
  t,
530
289
  "blockquote",
531
290
  { class: "acp-blockquote", "data-node-type": "blockquote" },
532
- P(i.content, p(e, "content"), t)
291
+ P(i.content, g(r, "content"), t)
533
292
  );
534
293
  case "bulletList": {
535
- const n = y(i.content).map((s, a) => q(s, p(e, "content", a), t)).filter((s) => s !== null);
536
- return h(t, "ul", { class: "acp-list acp-list--bullet", "data-node-type": "bulletList" }, n);
294
+ const n = k(i.content).map((s, o) => V(s, g(r, "content", o), t)).filter((s) => s !== null);
295
+ return f(t, "ul", { class: "acp-list acp-list--bullet", "data-node-type": "bulletList" }, n);
537
296
  }
538
297
  case "orderedList": {
539
- const n = Number.isInteger(r.start) && Number(r.start) >= 1 ? Number(r.start) : 1, s = y(i.content).map((a, o) => q(a, p(e, "content", o), t)).filter((a) => a !== null);
540
- return h(
298
+ const n = Number.isInteger(e.start) && Number(e.start) >= 1 ? Number(e.start) : 1, s = k(i.content).map((o, l) => V(o, g(r, "content", l), t)).filter((o) => o !== null);
299
+ return f(
541
300
  t,
542
301
  "ol",
543
302
  {
@@ -549,8 +308,8 @@ function D(i, e, t) {
549
308
  );
550
309
  }
551
310
  case "codeBlock": {
552
- const n = typeof r.language == "string" && r.language ? r.language : void 0, s = y(i.content).filter((a) => g(a) && a.type === "text" && typeof a.text == "string").map((a) => a.text).join("");
553
- return h(
311
+ const n = typeof e.language == "string" && e.language ? e.language : void 0, s = k(i.content).filter((o) => p(o) && o.type === "text" && typeof o.text == "string").map((o) => o.text).join("");
312
+ return f(
554
313
  t,
555
314
  "pre",
556
315
  {
@@ -558,22 +317,22 @@ function D(i, e, t) {
558
317
  "data-node-type": "codeBlock",
559
318
  "data-language": n
560
319
  },
561
- [h(t, "code", { class: n ? `language-${n}` : void 0 }, s)]
320
+ [f(t, "code", { class: n ? `language-${n}` : void 0 }, s)]
562
321
  );
563
322
  }
564
323
  case "horizontalRule":
565
- return h(t, "hr", { class: "acp-horizontal-rule", "data-node-type": "horizontalRule" });
324
+ return f(t, "hr", { class: "acp-horizontal-rule", "data-node-type": "horizontalRule" });
566
325
  case "image": {
567
- const n = E(J(r.src, t.imageBaseUrl), "image");
326
+ const n = T(X(e.src, t.imageBaseUrl), "image");
568
327
  if (!n)
569
- return A(t, {
328
+ return b(t, {
570
329
  code: "UNSAFE_URL",
571
- path: p(e, "attrs", "src"),
330
+ path: g(r, "attrs", "src"),
572
331
  message: "The image URL is empty, malformed, or uses a disallowed protocol.",
573
332
  nodeType: "image"
574
333
  }), null;
575
- const s = it(r.imageAlign) ? r.imageAlign : "center", a = Number.isInteger(r.width) && Number(r.width) >= 1 && Number(r.width) <= 1e4 ? Number(r.width) : void 0, o = Number.isInteger(r.height) && Number(r.height) >= 1 && Number(r.height) <= 1e4 ? Number(r.height) : void 0;
576
- return h(
334
+ const s = Q(e.imageAlign) ? e.imageAlign : "center", o = Number.isInteger(e.width) && Number(e.width) >= 1 && Number(e.width) <= 1e4 ? Number(e.width) : void 0, l = Number.isInteger(e.height) && Number(e.height) >= 1 && Number(e.height) <= 1e4 ? Number(e.height) : void 0;
335
+ return f(
577
336
  t,
578
337
  "div",
579
338
  {
@@ -582,94 +341,57 @@ function D(i, e, t) {
582
341
  "data-image-align": s
583
342
  },
584
343
  [
585
- h(t, "img", {
344
+ f(t, "img", {
586
345
  class: "acp-image__element",
587
346
  src: n,
588
- alt: typeof r.alt == "string" ? r.alt : "",
589
- title: typeof r.title == "string" ? r.title : void 0,
590
- width: a,
591
- height: o,
347
+ alt: typeof e.alt == "string" ? e.alt : "",
348
+ title: typeof e.title == "string" ? e.title : void 0,
349
+ width: o,
350
+ height: l,
592
351
  "data-image-align": s
593
352
  })
594
353
  ]
595
354
  );
596
355
  }
597
356
  case "articleButton":
598
- return lt(i, e, t);
357
+ return rt(i, r, t);
599
358
  case "table": {
600
- const n = y(i.content).map((s, a) => at(s, p(e, "content", a), t)).filter((s) => s !== null);
601
- return h(
359
+ const n = k(i.content).map((s, o) => et(s, g(r, "content", o), t)).filter((s) => s !== null);
360
+ return f(
602
361
  t,
603
362
  "div",
604
363
  { class: "acp-table-wrapper", "data-node-type": "table" },
605
- [h(t, "table", { class: "acp-table" }, [h(t, "tbody", n)])]
364
+ [f(t, "table", { class: "acp-table" }, [f(t, "tbody", n)])]
606
365
  );
607
366
  }
608
367
  }
609
368
  return null;
610
369
  }
611
- function P(i, e, t) {
612
- return y(i).map((r, n) => D(r, p(e, n), t)).filter((r) => r !== null);
613
- }
614
- function w(i) {
615
- return typeof i == "string" || typeof i == "number" ? i : void 0;
370
+ function P(i, r, t) {
371
+ return k(i).map((e, n) => D(e, g(r, n), t)).filter((e) => e !== null);
616
372
  }
617
- function dt(i, e) {
618
- const t = w(i.adm), r = w(i.ads), n = t !== void 0 && e.admPublisherId ? e.createElement(et, {
619
- key: `adm:${i.index}:${String(t)}`,
620
- props: {
621
- publisherId: e.admPublisherId,
622
- slotId: t,
623
- title: e.adTitle,
624
- fallbackPublisherId: r !== void 0 ? e.adsPublisherId : void 0,
625
- fallbackSlotId: r
626
- }
627
- }) : r !== void 0 && e.adsPublisherId ? e.createElement(U, {
628
- key: `ads:${i.index}:${String(r)}`,
629
- props: {
630
- publisherId: e.adsPublisherId,
631
- slotId: r,
632
- title: e.adTitle
633
- }
634
- }) : null;
635
- return e.createElement(
636
- "div",
637
- {
638
- key: `/adConf/${i.index}`,
639
- staticClass: "acp-ad-slot",
640
- attrs: {
641
- "data-node-type": "adSlot",
642
- "data-ad-slot": "true",
643
- "data-ad-index": i.index,
644
- "data-ad-location": i.location,
645
- "data-adm": t,
646
- "data-ads": r
647
- }
648
- },
649
- n ? [n] : []
650
- );
651
- }
652
- function ct(i, e) {
653
- const t = y(i.content), r = /* @__PURE__ */ new Map();
654
- e.adSlots.forEach((s) => {
655
- var o;
656
- if (s.location > t.length) return;
657
- const a = (o = r.get(s.location)) != null ? o : [];
658
- a.push(s), r.set(s.location, a);
373
+ function it(i, r) {
374
+ const t = k(i.content), e = /* @__PURE__ */ new Map();
375
+ r.customSlots.forEach((s) => {
376
+ var l;
377
+ if (!Number.isInteger(s.location) || s.location < 1 || s.location > t.length)
378
+ return;
379
+ const o = (l = e.get(s.location)) != null ? l : [];
380
+ o.push(s), e.set(s.location, o);
659
381
  });
660
382
  const n = [];
661
- return t.forEach((s, a) => {
662
- var d;
663
- const o = a + 1;
664
- (d = r.get(o)) == null || d.forEach((f) => n.push(dt(f, e)));
665
- const c = D(s, p("/content", a), e);
383
+ return t.forEach((s, o) => {
384
+ var u;
385
+ const l = o + 1;
386
+ (u = e.get(l)) == null || u.forEach((h) => n.push(...h.content));
387
+ const c = D(s, g("/content", o), r);
666
388
  c && typeof c != "string" && n.push(c);
667
389
  }), n;
668
390
  }
669
- function ut(i, e) {
670
- return !g(i) || i.type !== "doc" ? [] : ct(i, e);
391
+ function nt(i, r) {
392
+ return !p(i) || i.type !== "doc" ? [] : it(i, r);
671
393
  }
672
- const ht = /* @__PURE__ */ new Set([
394
+ const st = /* @__PURE__ */ new Set([
673
395
  "paragraph",
674
396
  "heading",
675
397
  "blockquote",
@@ -680,28 +402,28 @@ const ht = /* @__PURE__ */ new Set([
680
402
  "image",
681
403
  "articleButton",
682
404
  "table"
683
- ]), ft = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), pt = /* @__PURE__ */ new Set(["left", "center", "right"]), gt = /* @__PURE__ */ new Set(["bold", "italic", "strike", "underline", "code"]);
684
- function b(i) {
405
+ ]), ot = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), at = /* @__PURE__ */ new Set(["left", "center", "right"]), lt = /* @__PURE__ */ new Set(["bold", "italic", "strike", "underline", "code"]);
406
+ function I(i) {
685
407
  return typeof i == "object" && i !== null && !Array.isArray(i);
686
408
  }
687
- function l(i, e) {
688
- return `${i}/${String(e).replaceAll("~", "~0").replaceAll("/", "~1")}`;
409
+ function a(i, r) {
410
+ return `${i}/${String(r).replaceAll("~", "~0").replaceAll("/", "~1")}`;
689
411
  }
690
- function u(i, ...e) {
412
+ function d(i, ...r) {
691
413
  let t = i;
692
- for (const r of e) t = l(t, r);
414
+ for (const e of r) t = a(t, e);
693
415
  return t;
694
416
  }
695
- class yt {
417
+ class ct {
696
418
  constructor() {
697
- v(this, "issues", []);
419
+ B(this, "issues", []);
698
420
  }
699
- validate(e) {
700
- if (!b(e))
421
+ validate(r) {
422
+ if (!I(r))
701
423
  return this.add("INVALID_ROOT", "", "The document must be an object."), this.result();
702
- this.checkProperties(e, "", ["type", "content"], ["type", "content"]), e.type !== "doc" && this.add("INVALID_ROOT", "/type", 'The root node type must be "doc".');
703
- const t = this.requireArray(e.content, "/content");
704
- return t == null || t.forEach((r, n) => this.validateBlock(r, l("/content", n))), this.result();
424
+ this.checkProperties(r, "", ["type", "content"], ["type", "content"]), r.type !== "doc" && this.add("INVALID_ROOT", "/type", 'The root node type must be "doc".');
425
+ const t = this.requireArray(r.content, "/content");
426
+ return t == null || t.forEach((e, n) => this.validateBlock(e, a("/content", n))), this.result();
705
427
  }
706
428
  result() {
707
429
  return {
@@ -709,328 +431,314 @@ class yt {
709
431
  issues: this.issues
710
432
  };
711
433
  }
712
- add(e, t, r, n) {
713
- this.issues.push(m({ code: e, path: t, message: r }, n ? { nodeType: n } : {}));
434
+ add(r, t, e, n) {
435
+ this.issues.push(m({ code: r, path: t, message: e }, n ? { nodeType: n } : {}));
714
436
  }
715
- checkProperties(e, t, r, n = [], s) {
716
- const a = new Set(r);
717
- for (const o of Object.keys(e))
718
- a.has(o) || this.add(
437
+ checkProperties(r, t, e, n = [], s) {
438
+ const o = new Set(e);
439
+ for (const l of Object.keys(r))
440
+ o.has(l) || this.add(
719
441
  "UNKNOWN_PROPERTY",
720
- l(t, o),
721
- `Property "${o}" is not allowed.`,
442
+ a(t, l),
443
+ `Property "${l}" is not allowed.`,
722
444
  s
723
445
  );
724
- for (const o of n)
725
- o in e || this.add(
446
+ for (const l of n)
447
+ l in r || this.add(
726
448
  "MISSING_PROPERTY",
727
- l(t, o),
728
- `Required property "${o}" is missing.`,
449
+ a(t, l),
450
+ `Required property "${l}" is missing.`,
729
451
  s
730
452
  );
731
453
  }
732
- requireArray(e, t, r) {
733
- return Array.isArray(e) ? e : (this.add("INVALID_TYPE", t, "Expected an array.", r), null);
454
+ requireArray(r, t, e) {
455
+ return Array.isArray(r) ? r : (this.add("INVALID_TYPE", t, "Expected an array.", e), null);
734
456
  }
735
- optionalArray(e, t, r) {
736
- return e === void 0 ? [] : this.requireArray(e, t, r);
457
+ optionalArray(r, t, e) {
458
+ return r === void 0 ? [] : this.requireArray(r, t, e);
737
459
  }
738
- requireNonEmptyArray(e, t, r) {
739
- const n = this.requireArray(e, t, r);
460
+ requireNonEmptyArray(r, t, e) {
461
+ const n = this.requireArray(r, t, e);
740
462
  return n && n.length === 0 && this.add(
741
463
  "INVALID_CONTENT",
742
464
  t,
743
- `Node "${r}" must contain at least one child.`,
744
- r
465
+ `Node "${e}" must contain at least one child.`,
466
+ e
745
467
  ), n;
746
468
  }
747
- requireRecord(e, t, r) {
748
- return b(e) ? e : (this.add("INVALID_TYPE", t, "Expected an object.", r), null);
469
+ requireRecord(r, t, e) {
470
+ return I(r) ? r : (this.add("INVALID_TYPE", t, "Expected an object.", e), null);
749
471
  }
750
- optionalRecord(e, t, r) {
751
- return e === void 0 ? {} : this.requireRecord(e, t, r);
472
+ optionalRecord(r, t, e) {
473
+ return r === void 0 ? {} : this.requireRecord(r, t, e);
752
474
  }
753
- requireString(e, t, r, n = {}) {
754
- return typeof e != "string" ? (this.add("INVALID_TYPE", t, "Expected a string.", r), !1) : !n.allowEmpty && e.length === 0 ? (this.add("INVALID_VALUE", t, "The string must not be empty.", r), !1) : n.maxLength !== void 0 && e.length > n.maxLength ? (this.add(
475
+ requireString(r, t, e, n = {}) {
476
+ return typeof r != "string" ? (this.add("INVALID_TYPE", t, "Expected a string.", e), !1) : !n.allowEmpty && r.length === 0 ? (this.add("INVALID_VALUE", t, "The string must not be empty.", e), !1) : n.maxLength !== void 0 && r.length > n.maxLength ? (this.add(
755
477
  "INVALID_VALUE",
756
478
  t,
757
479
  `The string must contain at most ${n.maxLength} characters.`,
758
- r
480
+ e
759
481
  ), !1) : !0;
760
482
  }
761
- optionalString(e, t, r, n = {}) {
762
- e !== void 0 && this.requireString(e, t, r, n);
483
+ optionalString(r, t, e, n = {}) {
484
+ r !== void 0 && this.requireString(r, t, e, n);
763
485
  }
764
- requireInteger(e, t, r, n, s) {
765
- if (!Number.isInteger(e))
766
- return this.add("INVALID_TYPE", t, "Expected an integer.", r), !1;
767
- const a = e;
768
- return n !== void 0 && a < n ? (this.add("INVALID_VALUE", t, `Value must be at least ${n}.`, r), !1) : s !== void 0 && a > s ? (this.add("INVALID_VALUE", t, `Value must be at most ${s}.`, r), !1) : !0;
486
+ requireInteger(r, t, e, n, s) {
487
+ if (!Number.isInteger(r))
488
+ return this.add("INVALID_TYPE", t, "Expected an integer.", e), !1;
489
+ const o = r;
490
+ return n !== void 0 && o < n ? (this.add("INVALID_VALUE", t, `Value must be at least ${n}.`, e), !1) : s !== void 0 && o > s ? (this.add("INVALID_VALUE", t, `Value must be at most ${s}.`, e), !1) : !0;
769
491
  }
770
- validateBlock(e, t) {
771
- if (!b(e)) {
492
+ validateBlock(r, t) {
493
+ if (!I(r)) {
772
494
  this.add("INVALID_TYPE", t, "A block node must be an object.");
773
495
  return;
774
496
  }
775
- const r = e.type;
776
- if (typeof r != "string") {
777
- this.add("MISSING_PROPERTY", l(t, "type"), "A block node requires a type.");
497
+ const e = r.type;
498
+ if (typeof e != "string") {
499
+ this.add("MISSING_PROPERTY", a(t, "type"), "A block node requires a type.");
778
500
  return;
779
501
  }
780
- if (!ht.has(r)) {
781
- this.add("UNKNOWN_NODE", l(t, "type"), `Unknown block node "${r}".`, r);
502
+ if (!st.has(e)) {
503
+ this.add("UNKNOWN_NODE", a(t, "type"), `Unknown block node "${e}".`, e);
782
504
  return;
783
505
  }
784
- switch (r) {
506
+ switch (e) {
785
507
  case "paragraph":
786
- this.validateParagraph(e, t);
508
+ this.validateParagraph(r, t);
787
509
  break;
788
510
  case "heading":
789
- this.validateHeading(e, t);
511
+ this.validateHeading(r, t);
790
512
  break;
791
513
  case "blockquote":
792
- this.validateBlockquote(e, t);
514
+ this.validateBlockquote(r, t);
793
515
  break;
794
516
  case "bulletList":
795
- this.validateBulletList(e, t);
517
+ this.validateBulletList(r, t);
796
518
  break;
797
519
  case "orderedList":
798
- this.validateOrderedList(e, t);
520
+ this.validateOrderedList(r, t);
799
521
  break;
800
522
  case "codeBlock":
801
- this.validateCodeBlock(e, t);
523
+ this.validateCodeBlock(r, t);
802
524
  break;
803
525
  case "horizontalRule":
804
- this.checkProperties(e, t, ["type"], ["type"], r);
526
+ this.checkProperties(r, t, ["type"], ["type"], e);
805
527
  break;
806
528
  case "image":
807
- this.validateImage(e, t);
529
+ this.validateImage(r, t);
808
530
  break;
809
531
  case "articleButton":
810
- this.validateArticleButton(e, t);
532
+ this.validateArticleButton(r, t);
811
533
  break;
812
534
  case "table":
813
- this.validateTable(e, t);
535
+ this.validateTable(r, t);
814
536
  break;
815
537
  }
816
538
  }
817
- validateParagraph(e, t) {
818
- const r = "paragraph";
819
- this.checkProperties(e, t, ["type", "attrs", "content"], ["type"], r), this.validateTextAlignAttrs(e.attrs, l(t, "attrs"), r, !1), this.validateInlineContent(e.content, l(t, "content"), r);
539
+ validateParagraph(r, t) {
540
+ const e = "paragraph";
541
+ this.checkProperties(r, t, ["type", "attrs", "content"], ["type"], e), this.validateTextAlignAttrs(r.attrs, a(t, "attrs"), e, !1), this.validateInlineContent(r.content, a(t, "content"), e);
820
542
  }
821
- validateHeading(e, t) {
822
- const r = "heading";
823
- this.checkProperties(e, t, ["type", "attrs", "content"], ["type", "attrs"], r);
824
- const n = this.requireRecord(e.attrs, l(t, "attrs"), r);
825
- n && (this.checkProperties(n, l(t, "attrs"), ["level", "textAlign"], ["level"], r), this.requireInteger(n.level, u(t, "attrs", "level"), r, 1, 6), this.validateTextAlign(n.textAlign, u(t, "attrs", "textAlign"), r)), this.validateInlineContent(e.content, l(t, "content"), r);
543
+ validateHeading(r, t) {
544
+ const e = "heading";
545
+ this.checkProperties(r, t, ["type", "attrs", "content"], ["type", "attrs"], e);
546
+ const n = this.requireRecord(r.attrs, a(t, "attrs"), e);
547
+ n && (this.checkProperties(n, a(t, "attrs"), ["level", "textAlign"], ["level"], e), this.requireInteger(n.level, d(t, "attrs", "level"), e, 1, 6), this.validateTextAlign(n.textAlign, d(t, "attrs", "textAlign"), e)), this.validateInlineContent(r.content, a(t, "content"), e);
826
548
  }
827
- validateTextAlignAttrs(e, t, r, n) {
828
- const s = n ? this.requireRecord(e, t, r) : this.optionalRecord(e, t, r);
829
- s && (this.checkProperties(s, t, ["textAlign"], [], r), this.validateTextAlign(s.textAlign, l(t, "textAlign"), r));
549
+ validateTextAlignAttrs(r, t, e, n) {
550
+ const s = n ? this.requireRecord(r, t, e) : this.optionalRecord(r, t, e);
551
+ s && (this.checkProperties(s, t, ["textAlign"], [], e), this.validateTextAlign(s.textAlign, a(t, "textAlign"), e));
830
552
  }
831
- validateTextAlign(e, t, r) {
832
- e !== void 0 && (typeof e != "string" ? this.add("INVALID_TYPE", t, "Text alignment must be a string.", r) : ft.has(e) || this.add("INVALID_VALUE", t, `Unsupported text alignment "${e}".`, r));
553
+ validateTextAlign(r, t, e) {
554
+ r !== void 0 && (typeof r != "string" ? this.add("INVALID_TYPE", t, "Text alignment must be a string.", e) : ot.has(r) || this.add("INVALID_VALUE", t, `Unsupported text alignment "${r}".`, e));
833
555
  }
834
- validateInlineContent(e, t, r) {
835
- const n = this.optionalArray(e, t, r);
836
- n == null || n.forEach((s, a) => this.validateText(s, l(t, a), !0));
556
+ validateInlineContent(r, t, e) {
557
+ const n = this.optionalArray(r, t, e);
558
+ n == null || n.forEach((s, o) => this.validateText(s, a(t, o), !0));
837
559
  }
838
- validateText(e, t, r) {
839
- if (!b(e)) {
560
+ validateText(r, t, e) {
561
+ if (!I(r)) {
840
562
  this.add("INVALID_TYPE", t, "A text node must be an object.", "text");
841
563
  return;
842
564
  }
843
- const n = r ? ["type", "text", "marks"] : ["type", "text"];
844
- if (this.checkProperties(e, t, n, ["type", "text"], "text"), e.type !== "text" && this.add("INVALID_CONTENT", l(t, "type"), "Expected a text node.", "text"), this.requireString(e.text, l(t, "text"), "text"), r && e.marks !== void 0) {
845
- const s = this.requireArray(e.marks, l(t, "marks"), "text");
846
- s == null || s.forEach((a, o) => this.validateMark(a, u(t, "marks", o)));
565
+ const n = e ? ["type", "text", "marks"] : ["type", "text"];
566
+ if (this.checkProperties(r, t, n, ["type", "text"], "text"), r.type !== "text" && this.add("INVALID_CONTENT", a(t, "type"), "Expected a text node.", "text"), this.requireString(r.text, a(t, "text"), "text"), e && r.marks !== void 0) {
567
+ const s = this.requireArray(r.marks, a(t, "marks"), "text");
568
+ s == null || s.forEach((o, l) => this.validateMark(o, d(t, "marks", l)));
847
569
  }
848
570
  }
849
- validateMark(e, t) {
850
- if (!b(e)) {
571
+ validateMark(r, t) {
572
+ if (!I(r)) {
851
573
  this.add("INVALID_TYPE", t, "A mark must be an object.");
852
574
  return;
853
575
  }
854
- if (typeof e.type != "string") {
855
- this.add("MISSING_PROPERTY", l(t, "type"), "A mark requires a type.");
576
+ if (typeof r.type != "string") {
577
+ this.add("MISSING_PROPERTY", a(t, "type"), "A mark requires a type.");
856
578
  return;
857
579
  }
858
- if (gt.has(e.type)) {
859
- this.checkProperties(e, t, ["type"], ["type"], e.type);
580
+ if (lt.has(r.type)) {
581
+ this.checkProperties(r, t, ["type"], ["type"], r.type);
860
582
  return;
861
583
  }
862
- if (e.type !== "link") {
863
- this.add("UNKNOWN_MARK", l(t, "type"), `Unknown mark "${e.type}".`, e.type);
584
+ if (r.type !== "link") {
585
+ this.add("UNKNOWN_MARK", a(t, "type"), `Unknown mark "${r.type}".`, r.type);
864
586
  return;
865
587
  }
866
- this.checkProperties(e, t, ["type", "attrs"], ["type", "attrs"], "link");
867
- const r = this.requireRecord(e.attrs, l(t, "attrs"), "link");
868
- r && (this.checkProperties(r, l(t, "attrs"), ["href", "target"], ["href"], "link"), this.requireString(r.href, u(t, "attrs", "href"), "link"), r.target !== void 0 && r.target !== "_blank" && r.target !== "_self" && this.add(
588
+ this.checkProperties(r, t, ["type", "attrs"], ["type", "attrs"], "link");
589
+ const e = this.requireRecord(r.attrs, a(t, "attrs"), "link");
590
+ e && (this.checkProperties(e, a(t, "attrs"), ["href", "target"], ["href"], "link"), this.requireString(e.href, d(t, "attrs", "href"), "link"), e.target !== void 0 && e.target !== "_blank" && e.target !== "_self" && this.add(
869
591
  "INVALID_VALUE",
870
- u(t, "attrs", "target"),
592
+ d(t, "attrs", "target"),
871
593
  'Link target must be "_blank" or "_self".',
872
594
  "link"
873
595
  ));
874
596
  }
875
- validateBlockquote(e, t) {
876
- const r = "blockquote";
877
- this.checkProperties(e, t, ["type", "content"], ["type", "content"], r);
878
- const n = this.requireNonEmptyArray(e.content, l(t, "content"), r);
879
- n == null || n.forEach((s, a) => this.validateBlock(s, u(t, "content", a)));
880
- }
881
- validateBulletList(e, t) {
882
- const r = "bulletList";
883
- this.checkProperties(e, t, ["type", "content"], ["type", "content"], r);
884
- const n = this.requireNonEmptyArray(e.content, l(t, "content"), r);
885
- n == null || n.forEach((s, a) => this.validateListItem(s, u(t, "content", a)));
886
- }
887
- validateOrderedList(e, t) {
888
- const r = "orderedList";
889
- this.checkProperties(e, t, ["type", "attrs", "content"], ["type", "content"], r);
890
- const n = this.optionalRecord(e.attrs, l(t, "attrs"), r);
891
- n && (this.checkProperties(n, l(t, "attrs"), ["start"], [], r), n.start !== void 0 && this.requireInteger(n.start, u(t, "attrs", "start"), r, 1));
892
- const s = this.requireNonEmptyArray(e.content, l(t, "content"), r);
893
- s == null || s.forEach((a, o) => this.validateListItem(a, u(t, "content", o)));
894
- }
895
- validateListItem(e, t) {
896
- const r = "listItem", n = this.requireRecord(e, t, r);
597
+ validateBlockquote(r, t) {
598
+ const e = "blockquote";
599
+ this.checkProperties(r, t, ["type", "content"], ["type", "content"], e);
600
+ const n = this.requireNonEmptyArray(r.content, a(t, "content"), e);
601
+ n == null || n.forEach((s, o) => this.validateBlock(s, d(t, "content", o)));
602
+ }
603
+ validateBulletList(r, t) {
604
+ const e = "bulletList";
605
+ this.checkProperties(r, t, ["type", "content"], ["type", "content"], e);
606
+ const n = this.requireNonEmptyArray(r.content, a(t, "content"), e);
607
+ n == null || n.forEach((s, o) => this.validateListItem(s, d(t, "content", o)));
608
+ }
609
+ validateOrderedList(r, t) {
610
+ const e = "orderedList";
611
+ this.checkProperties(r, t, ["type", "attrs", "content"], ["type", "content"], e);
612
+ const n = this.optionalRecord(r.attrs, a(t, "attrs"), e);
613
+ n && (this.checkProperties(n, a(t, "attrs"), ["start"], [], e), n.start !== void 0 && this.requireInteger(n.start, d(t, "attrs", "start"), e, 1));
614
+ const s = this.requireNonEmptyArray(r.content, a(t, "content"), e);
615
+ s == null || s.forEach((o, l) => this.validateListItem(o, d(t, "content", l)));
616
+ }
617
+ validateListItem(r, t) {
618
+ const e = "listItem", n = this.requireRecord(r, t, e);
897
619
  if (!n) return;
898
- this.checkProperties(n, t, ["type", "content"], ["type", "content"], r), n.type !== r && this.add("INVALID_CONTENT", l(t, "type"), "Expected a listItem node.", r);
899
- const s = this.requireNonEmptyArray(n.content, l(t, "content"), r);
900
- s == null || s.forEach((a, o) => this.validateBlock(a, u(t, "content", o)));
901
- }
902
- validateCodeBlock(e, t) {
903
- const r = "codeBlock";
904
- this.checkProperties(e, t, ["type", "attrs", "content"], ["type"], r);
905
- const n = this.optionalRecord(e.attrs, l(t, "attrs"), r);
906
- n && (this.checkProperties(n, l(t, "attrs"), ["language"], [], r), this.optionalString(n.language, u(t, "attrs", "language"), r, { maxLength: 32 }));
907
- const s = this.optionalArray(e.content, l(t, "content"), r);
620
+ this.checkProperties(n, t, ["type", "content"], ["type", "content"], e), n.type !== e && this.add("INVALID_CONTENT", a(t, "type"), "Expected a listItem node.", e);
621
+ const s = this.requireNonEmptyArray(n.content, a(t, "content"), e);
622
+ s == null || s.forEach((o, l) => this.validateBlock(o, d(t, "content", l)));
623
+ }
624
+ validateCodeBlock(r, t) {
625
+ const e = "codeBlock";
626
+ this.checkProperties(r, t, ["type", "attrs", "content"], ["type"], e);
627
+ const n = this.optionalRecord(r.attrs, a(t, "attrs"), e);
628
+ n && (this.checkProperties(n, a(t, "attrs"), ["language"], [], e), this.optionalString(n.language, d(t, "attrs", "language"), e, { maxLength: 32 }));
629
+ const s = this.optionalArray(r.content, a(t, "content"), e);
908
630
  s && (s.length > 1 && this.add(
909
631
  "INVALID_CONTENT",
910
- l(t, "content"),
632
+ a(t, "content"),
911
633
  "A codeBlock may contain at most one text node.",
912
- r
634
+ e
913
635
  ), s.forEach(
914
- (a, o) => this.validateText(a, u(t, "content", o), !1)
636
+ (o, l) => this.validateText(o, d(t, "content", l), !1)
915
637
  ));
916
638
  }
917
- validateImage(e, t) {
918
- const r = "image";
919
- this.checkProperties(e, t, ["type", "attrs"], ["type", "attrs"], r);
920
- const n = this.requireRecord(e.attrs, l(t, "attrs"), r);
639
+ validateImage(r, t) {
640
+ const e = "image";
641
+ this.checkProperties(r, t, ["type", "attrs"], ["type", "attrs"], e);
642
+ const n = this.requireRecord(r.attrs, a(t, "attrs"), e);
921
643
  n && (this.checkProperties(
922
644
  n,
923
- l(t, "attrs"),
645
+ a(t, "attrs"),
924
646
  ["src", "alt", "title", "width", "height", "imageAlign"],
925
647
  ["src"],
926
- r
927
- ), this.requireString(n.src, u(t, "attrs", "src"), r), this.optionalString(n.alt, u(t, "attrs", "alt"), r, { allowEmpty: !0 }), this.optionalString(n.title, u(t, "attrs", "title"), r, { allowEmpty: !0 }), n.width !== void 0 && this.requireInteger(n.width, u(t, "attrs", "width"), r, 1, 1e4), n.height !== void 0 && this.requireInteger(n.height, u(t, "attrs", "height"), r, 1, 1e4), n.imageAlign !== void 0 && (typeof n.imageAlign != "string" ? this.add("INVALID_TYPE", u(t, "attrs", "imageAlign"), "Image alignment must be a string.", r) : pt.has(n.imageAlign) || this.add(
648
+ e
649
+ ), this.requireString(n.src, d(t, "attrs", "src"), e), this.optionalString(n.alt, d(t, "attrs", "alt"), e, { allowEmpty: !0 }), this.optionalString(n.title, d(t, "attrs", "title"), e, { allowEmpty: !0 }), n.width !== void 0 && this.requireInteger(n.width, d(t, "attrs", "width"), e, 1, 1e4), n.height !== void 0 && this.requireInteger(n.height, d(t, "attrs", "height"), e, 1, 1e4), n.imageAlign !== void 0 && (typeof n.imageAlign != "string" ? this.add("INVALID_TYPE", d(t, "attrs", "imageAlign"), "Image alignment must be a string.", e) : at.has(n.imageAlign) || this.add(
928
650
  "INVALID_VALUE",
929
- u(t, "attrs", "imageAlign"),
651
+ d(t, "attrs", "imageAlign"),
930
652
  `Unsupported image alignment "${n.imageAlign}".`,
931
- r
653
+ e
932
654
  )));
933
655
  }
934
- validateArticleButton(e, t) {
935
- const r = "articleButton";
936
- this.checkProperties(e, t, ["type", "attrs"], ["type", "attrs"], r);
937
- const n = this.requireRecord(e.attrs, l(t, "attrs"), r);
656
+ validateArticleButton(r, t) {
657
+ const e = "articleButton";
658
+ this.checkProperties(r, t, ["type", "attrs"], ["type", "attrs"], e);
659
+ const n = this.requireRecord(r.attrs, a(t, "attrs"), e);
938
660
  n && (this.checkProperties(
939
661
  n,
940
- l(t, "attrs"),
941
- ["id", "title", "text", "style"],
942
- ["id", "text", "style"],
943
- r
944
- ), this.requireString(n.id, u(t, "attrs", "id"), r), this.optionalString(n.title, u(t, "attrs", "title"), r), this.requireString(n.text, u(t, "attrs", "text"), r), n.style !== "text" && n.style !== "button" && this.add(
662
+ a(t, "attrs"),
663
+ ["id", "title", "text", "style", "href"],
664
+ ["text", "style"],
665
+ e
666
+ ), n.style === "text" || n.style === "button" ? "id" in n ? this.requireString(n.id, d(t, "attrs", "id"), e) : this.add(
667
+ "MISSING_PROPERTY",
668
+ d(t, "attrs", "id"),
669
+ 'Required property "id" is missing for an articleButton with text or button style.',
670
+ e
671
+ ) : this.optionalString(n.id, d(t, "attrs", "id"), e), this.optionalString(n.title, d(t, "attrs", "title"), e), this.requireString(n.text, d(t, "attrs", "text"), e), this.optionalString(n.href, d(t, "attrs", "href"), e), n.style !== "text" && n.style !== "button" && n.style !== "link" && this.add(
945
672
  "INVALID_VALUE",
946
- u(t, "attrs", "style"),
947
- 'Article button style must be "text" or "button".',
948
- r
673
+ d(t, "attrs", "style"),
674
+ 'Article button style must be "text", "button", or "link".',
675
+ e
676
+ ), n.href !== void 0 && n.style !== "link" && this.add(
677
+ "INVALID_VALUE",
678
+ d(t, "attrs", "href"),
679
+ 'Article button href may only be present when style is "link".',
680
+ e
949
681
  ));
950
682
  }
951
- validateTable(e, t) {
952
- const r = "table";
953
- this.checkProperties(e, t, ["type", "content"], ["type", "content"], r);
954
- const n = this.requireNonEmptyArray(e.content, l(t, "content"), r);
683
+ validateTable(r, t) {
684
+ const e = "table";
685
+ this.checkProperties(r, t, ["type", "content"], ["type", "content"], e);
686
+ const n = this.requireNonEmptyArray(r.content, a(t, "content"), e);
955
687
  if (!n) return;
956
688
  let s = null;
957
- n.forEach((a, o) => {
958
- const c = u(t, "content", o), d = this.validateTableRow(a, c);
959
- d !== null && (s === null ? s = d : d !== s && this.add(
689
+ n.forEach((o, l) => {
690
+ const c = d(t, "content", l), u = this.validateTableRow(o, c);
691
+ u !== null && (s === null ? s = u : u !== s && this.add(
960
692
  "TABLE_COLUMN_MISMATCH",
961
- l(c, "content"),
962
- `Expected ${s} table cells but received ${d}.`,
693
+ a(c, "content"),
694
+ `Expected ${s} table cells but received ${u}.`,
963
695
  "tableRow"
964
696
  ));
965
697
  });
966
698
  }
967
- validateTableRow(e, t) {
968
- var a;
969
- const r = "tableRow", n = this.requireRecord(e, t, r);
699
+ validateTableRow(r, t) {
700
+ var o;
701
+ const e = "tableRow", n = this.requireRecord(r, t, e);
970
702
  if (!n) return null;
971
- this.checkProperties(n, t, ["type", "content"], ["type", "content"], r), n.type !== r && this.add("INVALID_CONTENT", l(t, "type"), "Expected a tableRow node.", r);
972
- const s = this.requireNonEmptyArray(n.content, l(t, "content"), r);
973
- return s == null || s.forEach((o, c) => this.validateTableCell(o, u(t, "content", c))), (a = s == null ? void 0 : s.length) != null ? a : null;
703
+ this.checkProperties(n, t, ["type", "content"], ["type", "content"], e), n.type !== e && this.add("INVALID_CONTENT", a(t, "type"), "Expected a tableRow node.", e);
704
+ const s = this.requireNonEmptyArray(n.content, a(t, "content"), e);
705
+ return s == null || s.forEach((l, c) => this.validateTableCell(l, d(t, "content", c))), (o = s == null ? void 0 : s.length) != null ? o : null;
974
706
  }
975
- validateTableCell(e, t) {
976
- const r = "tableCell", n = this.requireRecord(e, t, r);
707
+ validateTableCell(r, t) {
708
+ const e = "tableCell", n = this.requireRecord(r, t, e);
977
709
  if (!n) return;
978
- this.checkProperties(n, t, ["type", "content"], ["type", "content"], r), n.type !== r && this.add("INVALID_CONTENT", l(t, "type"), "Expected a tableCell node.", r);
979
- const s = this.requireNonEmptyArray(n.content, l(t, "content"), r);
980
- s == null || s.forEach((a, o) => this.validateBlock(a, u(t, "content", o)));
710
+ this.checkProperties(n, t, ["type", "content"], ["type", "content"], e), n.type !== e && this.add("INVALID_CONTENT", a(t, "type"), "Expected a tableCell node.", e);
711
+ const s = this.requireNonEmptyArray(n.content, a(t, "content"), e);
712
+ s == null || s.forEach((o, l) => this.validateBlock(o, d(t, "content", l)));
981
713
  }
982
714
  }
983
- function mt(i) {
984
- return new yt().validate(i);
715
+ function dt(i) {
716
+ return new ct().validate(i);
985
717
  }
986
- const B = Object.freeze({
718
+ const C = Object.freeze({
987
719
  version: 1,
988
- validate: mt,
989
- render: ut
990
- }), x = /* @__PURE__ */ new Map([[B.version, B]]), _t = Object.freeze([...x.keys()]), M = 1;
991
- function K(i) {
992
- return x.get(i);
720
+ validate: dt,
721
+ render: nt
722
+ }), $ = /* @__PURE__ */ new Map([[C.version, C]]), At = Object.freeze([...$.keys()]), v = 1;
723
+ function x(i) {
724
+ return $.get(i);
993
725
  }
994
- function bt(i, e = {}) {
726
+ function ut(i, r = {}) {
995
727
  var s;
996
- const t = (s = e.protocolVersion) != null ? s : M, r = K(t);
997
- return r ? r.validate(i) : { valid: !1, issues: [{
728
+ const t = (s = r.protocolVersion) != null ? s : v, e = x(t);
729
+ return e ? e.validate(i) : { valid: !1, issues: [{
998
730
  code: "UNSUPPORTED_PROTOCOL",
999
731
  path: "",
1000
732
  message: `Article Content Protocol version ${t} is not supported.`
1001
733
  }] };
1002
734
  }
1003
- const At = "Advertisement";
1004
- function It() {
1005
- return { adm: [], ads: [], loc: [] };
735
+ function ft() {
736
+ return [];
1006
737
  }
1007
- function kt() {
1008
- return { adm: "", ads: "" };
1009
- }
1010
- function $(i) {
738
+ function ht(i) {
1011
739
  return `${i.code}:${i.path}:${i.message}`;
1012
740
  }
1013
- function St(i) {
1014
- var o, c, d, f;
1015
- const e = (c = (o = i.adm) == null ? void 0 : o.length) != null ? c : 0, t = (f = (d = i.ads) == null ? void 0 : d.length) != null ? f : 0, r = i.loc.length, n = e === 0 || e === r, s = t === 0 || t === r, a = e > 0 || t > 0;
1016
- return r === 0 && !a || a && n && s ? null : {
1017
- code: "AD_CONFIG_LENGTH_MISMATCH",
1018
- path: "/adConf",
1019
- message: `Each non-empty adConf.adm or adConf.ads array must have the same length as adConf.loc, and at least one ad array must contain values when loc is non-empty. Received adm length ${e}, ads length ${t}, and loc length ${r}.`
1020
- };
1021
- }
1022
- function Lt(i, e) {
1023
- return e ? [] : i.loc.map((t, r) => {
1024
- var n, s;
1025
- return {
1026
- index: r + 1,
1027
- location: t,
1028
- adm: (n = i.adm) == null ? void 0 : n[r],
1029
- ads: (s = i.ads) == null ? void 0 : s[r]
1030
- };
1031
- }).filter((t) => Number.isInteger(t.location) && t.location >= 1);
1032
- }
1033
- const Nt = N.extend({
741
+ const gt = K.extend({
1034
742
  name: "ArticleContentRenderer",
1035
743
  props: {
1036
744
  document: {
@@ -1039,27 +747,19 @@ const Nt = N.extend({
1039
747
  },
1040
748
  protocolVersion: {
1041
749
  type: Number,
1042
- default: M
750
+ default: v
1043
751
  },
1044
752
  strict: {
1045
753
  type: Boolean,
1046
754
  default: !1
1047
755
  },
1048
- adConf: {
1049
- type: Object,
1050
- default: It
1051
- },
1052
- pubid: {
1053
- type: Object,
1054
- default: kt
1055
- },
1056
- adTitle: {
1057
- type: String,
1058
- default: At
756
+ customSlots: {
757
+ type: Array,
758
+ default: ft
1059
759
  },
1060
760
  imageBaseUrl: {
1061
761
  type: String,
1062
- default: I
762
+ default: N
1063
763
  },
1064
764
  resolveArticleButtonLink: {
1065
765
  type: Function,
@@ -1068,19 +768,12 @@ const Nt = N.extend({
1068
768
  },
1069
769
  data() {
1070
770
  return {
1071
- reportedRuntimeIssues: /* @__PURE__ */ new Set(),
1072
- reportedAdConfigIssue: null
771
+ reportedRuntimeIssues: /* @__PURE__ */ new Set()
1073
772
  };
1074
773
  },
1075
774
  computed: {
1076
775
  validation() {
1077
- return bt(this.document, { protocolVersion: this.protocolVersion });
1078
- },
1079
- adConfigIssue() {
1080
- return St(this.adConf);
1081
- },
1082
- adSlots() {
1083
- return Lt(this.adConf, this.adConfigIssue);
776
+ return ut(this.document, { protocolVersion: this.protocolVersion });
1084
777
  }
1085
778
  },
1086
779
  watch: {
@@ -1088,7 +781,7 @@ const Nt = N.extend({
1088
781
  immediate: !0,
1089
782
  deep: !0,
1090
783
  handler(i) {
1091
- i.issues.forEach((e) => this.$emit("render-error", e));
784
+ i.issues.forEach((r) => this.$emit("render-error", r));
1092
785
  }
1093
786
  },
1094
787
  document: {
@@ -1105,28 +798,24 @@ const Nt = N.extend({
1105
798
  },
1106
799
  imageBaseUrl() {
1107
800
  this.reportedRuntimeIssues.clear();
1108
- },
1109
- adConfigIssue: {
1110
- immediate: !0,
1111
- handler(i) {
1112
- if (!i) {
1113
- this.reportedAdConfigIssue = null;
1114
- return;
1115
- }
1116
- const e = $(i);
1117
- this.reportedAdConfigIssue !== e && (this.reportedAdConfigIssue = e, console.error("[ArticleContentRenderer] Invalid adConf:", i), this.$emit("render-error", i));
1118
- }
1119
801
  }
1120
802
  },
1121
803
  methods: {
804
+ resolveCustomSlots() {
805
+ return this.customSlots.map((i) => {
806
+ var e, n, s, o;
807
+ const r = { id: i.id, location: i.location }, t = (o = (s = (n = (e = this.$scopedSlots)[i.id]) == null ? void 0 : n.call(e, r)) != null ? s : this.$slots[i.id]) != null ? o : [];
808
+ return A(m({}, i), { content: t });
809
+ });
810
+ },
1122
811
  reportRuntimeIssue(i) {
1123
- const e = $(i);
1124
- this.reportedRuntimeIssues.has(e) || (this.reportedRuntimeIssues.add(e), this.$nextTick(() => this.$emit("render-error", i)));
812
+ const r = ht(i);
813
+ this.reportedRuntimeIssues.has(r) || (this.reportedRuntimeIssues.add(r), this.$nextTick(() => this.$emit("render-error", i)));
1125
814
  }
1126
815
  },
1127
816
  render(i) {
1128
- const e = K(this.protocolVersion);
1129
- if (!e || this.strict && !this.validation.valid)
817
+ const r = x(this.protocolVersion);
818
+ if (!r || this.strict && !this.validation.valid)
1130
819
  return i(
1131
820
  "div",
1132
821
  {
@@ -1138,15 +827,12 @@ const Nt = N.extend({
1138
827
  },
1139
828
  "Invalid article content"
1140
829
  );
1141
- const t = e.render(this.document, {
830
+ const t = r.render(this.document, {
1142
831
  createElement: i,
1143
- adSlots: this.adSlots,
1144
- admPublisherId: this.pubid.adm,
1145
- adsPublisherId: this.pubid.ads,
1146
- adTitle: this.adTitle,
832
+ customSlots: this.resolveCustomSlots(),
1147
833
  imageBaseUrl: this.imageBaseUrl,
1148
834
  resolveArticleButtonLink: this.resolveArticleButtonLink,
1149
- emitArticleButtonClick: (r) => this.$emit("article-button-click", r),
835
+ emitArticleButtonClick: (e) => this.$emit("article-button-click", e),
1150
836
  reportIssue: this.reportRuntimeIssue
1151
837
  });
1152
838
  return i(
@@ -1162,17 +848,17 @@ const Nt = N.extend({
1162
848
  );
1163
849
  }
1164
850
  });
1165
- function Et(i, e, t, r, n, s, a, o) {
851
+ function pt(i, r, t, e, n, s, o, l) {
1166
852
  var c = typeof i == "function" ? i.options : i;
1167
853
  return {
1168
854
  exports: i,
1169
855
  options: c
1170
856
  };
1171
857
  }
1172
- var Rt = /* @__PURE__ */ Et(
1173
- Nt
858
+ var yt = /* @__PURE__ */ pt(
859
+ gt
1174
860
  );
1175
- const Pt = Rt.exports, Ct = Object.freeze({
861
+ const mt = yt.exports, It = Object.freeze({
1176
862
  fileFormat: "article-content-protocol",
1177
863
  fileFormatVersion: 1,
1178
864
  mediaType: "application/vnd.article-content-protocol+json",
@@ -1199,17 +885,17 @@ const Pt = Rt.exports, Ct = Object.freeze({
1199
885
  "text"
1200
886
  ]),
1201
887
  markTypes: Object.freeze(["bold", "italic", "strike", "underline", "code", "link"])
1202
- }), Ot = {
888
+ }), Lt = {
1203
889
  install(i) {
1204
- i.component("ArticleContentRenderer", Pt);
890
+ i.component("ArticleContentRenderer", mt);
1205
891
  }
1206
892
  };
1207
893
  export {
1208
- Ct as ARTICLE_CONTENT_PROTOCOL_V1,
1209
- Pt as ArticleContentRenderer,
1210
- Ot as ArticleContentRendererPlugin,
1211
- M as CURRENT_PROTOCOL_VERSION,
1212
- _t as SUPPORTED_PROTOCOL_VERSIONS,
1213
- Pt as default,
1214
- bt as validateArticleDocument
894
+ It as ARTICLE_CONTENT_PROTOCOL_V1,
895
+ mt as ArticleContentRenderer,
896
+ Lt as ArticleContentRendererPlugin,
897
+ v as CURRENT_PROTOCOL_VERSION,
898
+ At as SUPPORTED_PROTOCOL_VERSIONS,
899
+ mt as default,
900
+ ut as validateArticleDocument
1215
901
  };