article-content-renderer-vue2 0.1.0 → 0.2.0

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