article-content-renderer-vue2 0.1.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 ADDED
@@ -0,0 +1,1215 @@
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();
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}`;
22
+ }
23
+ function E(i, e) {
24
+ if (typeof i != "string") return null;
25
+ const t = i.trim();
26
+ if (!t || /[\u0000-\u001F\u007F]/u.test(t)) return null;
27
+ try {
28
+ const r = new URL(t, X);
29
+ return (e === "link" ? W : Q).has(r.protocol) ? t : null;
30
+ } catch (r) {
31
+ return null;
32
+ }
33
+ }
34
+ function V(i, e) {
35
+ const t = new Set(
36
+ typeof i == "string" ? i.trim().split(/\s+/u).filter(Boolean) : []
37
+ );
38
+ return e === "_blank" && (t.add("noopener"), t.add("noreferrer")), t.size > 0 ? [...t].join(" ") : void 0;
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([
292
+ "paragraph",
293
+ "heading",
294
+ "blockquote",
295
+ "bulletList",
296
+ "orderedList",
297
+ "codeBlock",
298
+ "horizontalRule",
299
+ "image",
300
+ "articleButton",
301
+ "table"
302
+ ]);
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)
343
+ 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) {
351
+ case "bold":
352
+ r = h(t, "strong", { class: "acp-mark acp-mark--bold" }, [r]);
353
+ break;
354
+ case "italic":
355
+ r = h(t, "em", { class: "acp-mark acp-mark--italic" }, [r]);
356
+ break;
357
+ case "strike":
358
+ r = h(t, "s", { class: "acp-mark acp-mark--strike" }, [r]);
359
+ break;
360
+ case "underline":
361
+ r = h(t, "u", { class: "acp-mark acp-mark--underline" }, [r]);
362
+ break;
363
+ case "code":
364
+ r = h(t, "code", { class: "acp-mark acp-mark--code" }, [r]);
365
+ break;
366
+ case "link": {
367
+ const c = R(a.attrs), d = E(c.href, "link");
368
+ if (!d) {
369
+ A(t, {
370
+ code: "UNSAFE_URL",
371
+ path: p(o, "attrs", "href"),
372
+ message: "The link URL is empty, malformed, or uses a disallowed protocol.",
373
+ nodeType: "link"
374
+ });
375
+ break;
376
+ }
377
+ const f = L(c.target) ? c.target : "_blank";
378
+ r = h(
379
+ t,
380
+ "a",
381
+ {
382
+ class: "acp-link",
383
+ href: d,
384
+ target: f,
385
+ rel: V(void 0, f)
386
+ },
387
+ [r]
388
+ );
389
+ break;
390
+ }
391
+ }
392
+ }
393
+ return r;
394
+ }
395
+ function O(i, e, t) {
396
+ return y(i).map((r, n) => nt(r, p(e, n), t)).filter((r) => r !== null);
397
+ }
398
+ function q(i, e, t) {
399
+ return !g(i) || i.type !== "listItem" ? null : h(
400
+ t,
401
+ "li",
402
+ { class: "acp-list-item", "data-node-type": "listItem" },
403
+ P(i.content, p(e, "content"), t)
404
+ );
405
+ }
406
+ function st(i, e, t) {
407
+ return !g(i) || i.type !== "tableCell" ? null : h(
408
+ t,
409
+ "td",
410
+ { class: "acp-table-cell", "data-node-type": "tableCell" },
411
+ P(i.content, p(e, "content"), t)
412
+ );
413
+ }
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");
427
+ if (!t) return null;
428
+ const r = (n = e.target) != null ? n : "_self";
429
+ return {
430
+ href: t,
431
+ target: r,
432
+ rel: V(e.rel, r)
433
+ };
434
+ }
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")
439
+ 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, {
449
+ code: "LINK_RESOLUTION_FAILED",
450
+ path: e,
451
+ message: "No resolveArticleButtonLink callback was provided for an articleButton node.",
452
+ nodeType: "articleButton"
453
+ });
454
+ else
455
+ 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,
460
+ message: "The articleButton link resolver returned no usable safe URL.",
461
+ nodeType: "articleButton"
462
+ });
463
+ } catch (d) {
464
+ A(t, {
465
+ code: "LINK_RESOLUTION_FAILED",
466
+ path: e,
467
+ message: `The articleButton link resolver threw an error: ${d instanceof Error ? d.message : String(d)}`,
468
+ nodeType: "articleButton"
469
+ });
470
+ }
471
+ const o = (c = a == null ? void 0 : a.href) != null ? c : null;
472
+ return h(
473
+ t,
474
+ "a",
475
+ {
476
+ class: [
477
+ "acp-article-button",
478
+ `acp-article-button--${n.style}`,
479
+ !o && "acp-article-button--disabled"
480
+ ],
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,
485
+ "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 });
491
+ }
492
+ },
493
+ n.text
494
+ );
495
+ }
496
+ function D(i, e, t) {
497
+ if (!g(i) || typeof i.type != "string" || !rt.has(i.type))
498
+ return null;
499
+ const r = R(i.attrs);
500
+ switch (i.type) {
501
+ case "paragraph": {
502
+ const n = C(r.textAlign) ? r.textAlign : void 0;
503
+ return h(
504
+ t,
505
+ "p",
506
+ {
507
+ class: "acp-paragraph",
508
+ "data-node-type": "paragraph",
509
+ style: n ? { textAlign: n } : void 0
510
+ },
511
+ O(i.content, p(e, "content"), t)
512
+ );
513
+ }
514
+ 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(
517
+ t,
518
+ `h${n}`,
519
+ {
520
+ class: ["acp-heading", `acp-heading--${n}`],
521
+ "data-node-type": "heading",
522
+ style: s ? { textAlign: s } : void 0
523
+ },
524
+ O(i.content, p(e, "content"), t)
525
+ );
526
+ }
527
+ case "blockquote":
528
+ return h(
529
+ t,
530
+ "blockquote",
531
+ { class: "acp-blockquote", "data-node-type": "blockquote" },
532
+ P(i.content, p(e, "content"), t)
533
+ );
534
+ 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);
537
+ }
538
+ 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(
541
+ t,
542
+ "ol",
543
+ {
544
+ class: "acp-list acp-list--ordered",
545
+ "data-node-type": "orderedList",
546
+ start: n
547
+ },
548
+ s
549
+ );
550
+ }
551
+ 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(
554
+ t,
555
+ "pre",
556
+ {
557
+ class: "acp-code-block",
558
+ "data-node-type": "codeBlock",
559
+ "data-language": n
560
+ },
561
+ [h(t, "code", { class: n ? `language-${n}` : void 0 }, s)]
562
+ );
563
+ }
564
+ case "horizontalRule":
565
+ return h(t, "hr", { class: "acp-horizontal-rule", "data-node-type": "horizontalRule" });
566
+ case "image": {
567
+ const n = E(J(r.src, t.imageBaseUrl), "image");
568
+ if (!n)
569
+ return A(t, {
570
+ code: "UNSAFE_URL",
571
+ path: p(e, "attrs", "src"),
572
+ message: "The image URL is empty, malformed, or uses a disallowed protocol.",
573
+ nodeType: "image"
574
+ }), 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(
577
+ t,
578
+ "div",
579
+ {
580
+ class: ["acp-image", `acp-image--${s}`],
581
+ "data-node-type": "image",
582
+ "data-image-align": s
583
+ },
584
+ [
585
+ h(t, "img", {
586
+ 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,
592
+ "data-image-align": s
593
+ })
594
+ ]
595
+ );
596
+ }
597
+ case "articleButton":
598
+ return lt(i, e, t);
599
+ 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(
602
+ t,
603
+ "div",
604
+ { class: "acp-table-wrapper", "data-node-type": "table" },
605
+ [h(t, "table", { class: "acp-table" }, [h(t, "tbody", n)])]
606
+ );
607
+ }
608
+ }
609
+ return null;
610
+ }
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;
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);
659
+ });
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([
673
+ "paragraph",
674
+ "heading",
675
+ "blockquote",
676
+ "bulletList",
677
+ "orderedList",
678
+ "codeBlock",
679
+ "horizontalRule",
680
+ "image",
681
+ "articleButton",
682
+ "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);
686
+ }
687
+ function l(i, e) {
688
+ return `${i}/${String(e).replaceAll("~", "~0").replaceAll("/", "~1")}`;
689
+ }
690
+ function u(i, ...e) {
691
+ let t = i;
692
+ for (const r of e) t = l(t, r);
693
+ return t;
694
+ }
695
+ class yt {
696
+ constructor() {
697
+ v(this, "issues", []);
698
+ }
699
+ validate(e) {
700
+ if (!b(e))
701
+ 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();
705
+ }
706
+ result() {
707
+ return {
708
+ valid: this.issues.length === 0,
709
+ issues: this.issues
710
+ };
711
+ }
712
+ add(e, t, r, n) {
713
+ this.issues.push(m({ code: e, path: t, message: r }, n ? { nodeType: n } : {}));
714
+ }
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(
719
+ "UNKNOWN_PROPERTY",
720
+ l(t, o),
721
+ `Property "${o}" is not allowed.`,
722
+ s
723
+ );
724
+ for (const o of n)
725
+ o in e || this.add(
726
+ "MISSING_PROPERTY",
727
+ l(t, o),
728
+ `Required property "${o}" is missing.`,
729
+ s
730
+ );
731
+ }
732
+ requireArray(e, t, r) {
733
+ return Array.isArray(e) ? e : (this.add("INVALID_TYPE", t, "Expected an array.", r), null);
734
+ }
735
+ optionalArray(e, t, r) {
736
+ return e === void 0 ? [] : this.requireArray(e, t, r);
737
+ }
738
+ requireNonEmptyArray(e, t, r) {
739
+ const n = this.requireArray(e, t, r);
740
+ return n && n.length === 0 && this.add(
741
+ "INVALID_CONTENT",
742
+ t,
743
+ `Node "${r}" must contain at least one child.`,
744
+ r
745
+ ), n;
746
+ }
747
+ requireRecord(e, t, r) {
748
+ return b(e) ? e : (this.add("INVALID_TYPE", t, "Expected an object.", r), null);
749
+ }
750
+ optionalRecord(e, t, r) {
751
+ return e === void 0 ? {} : this.requireRecord(e, t, r);
752
+ }
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(
755
+ "INVALID_VALUE",
756
+ t,
757
+ `The string must contain at most ${n.maxLength} characters.`,
758
+ r
759
+ ), !1) : !0;
760
+ }
761
+ optionalString(e, t, r, n = {}) {
762
+ e !== void 0 && this.requireString(e, t, r, n);
763
+ }
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;
769
+ }
770
+ validateBlock(e, t) {
771
+ if (!b(e)) {
772
+ this.add("INVALID_TYPE", t, "A block node must be an object.");
773
+ return;
774
+ }
775
+ const r = e.type;
776
+ if (typeof r != "string") {
777
+ this.add("MISSING_PROPERTY", l(t, "type"), "A block node requires a type.");
778
+ return;
779
+ }
780
+ if (!ht.has(r)) {
781
+ this.add("UNKNOWN_NODE", l(t, "type"), `Unknown block node "${r}".`, r);
782
+ return;
783
+ }
784
+ switch (r) {
785
+ case "paragraph":
786
+ this.validateParagraph(e, t);
787
+ break;
788
+ case "heading":
789
+ this.validateHeading(e, t);
790
+ break;
791
+ case "blockquote":
792
+ this.validateBlockquote(e, t);
793
+ break;
794
+ case "bulletList":
795
+ this.validateBulletList(e, t);
796
+ break;
797
+ case "orderedList":
798
+ this.validateOrderedList(e, t);
799
+ break;
800
+ case "codeBlock":
801
+ this.validateCodeBlock(e, t);
802
+ break;
803
+ case "horizontalRule":
804
+ this.checkProperties(e, t, ["type"], ["type"], r);
805
+ break;
806
+ case "image":
807
+ this.validateImage(e, t);
808
+ break;
809
+ case "articleButton":
810
+ this.validateArticleButton(e, t);
811
+ break;
812
+ case "table":
813
+ this.validateTable(e, t);
814
+ break;
815
+ }
816
+ }
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);
820
+ }
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);
826
+ }
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));
830
+ }
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));
833
+ }
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));
837
+ }
838
+ validateText(e, t, r) {
839
+ if (!b(e)) {
840
+ this.add("INVALID_TYPE", t, "A text node must be an object.", "text");
841
+ return;
842
+ }
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)));
847
+ }
848
+ }
849
+ validateMark(e, t) {
850
+ if (!b(e)) {
851
+ this.add("INVALID_TYPE", t, "A mark must be an object.");
852
+ return;
853
+ }
854
+ if (typeof e.type != "string") {
855
+ this.add("MISSING_PROPERTY", l(t, "type"), "A mark requires a type.");
856
+ return;
857
+ }
858
+ if (gt.has(e.type)) {
859
+ this.checkProperties(e, t, ["type"], ["type"], e.type);
860
+ return;
861
+ }
862
+ if (e.type !== "link") {
863
+ this.add("UNKNOWN_MARK", l(t, "type"), `Unknown mark "${e.type}".`, e.type);
864
+ return;
865
+ }
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(
869
+ "INVALID_VALUE",
870
+ u(t, "attrs", "target"),
871
+ 'Link target must be "_blank" or "_self".',
872
+ "link"
873
+ ));
874
+ }
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);
908
+ s && (s.length > 1 && this.add(
909
+ "INVALID_CONTENT",
910
+ l(t, "content"),
911
+ "A codeBlock may contain at most one text node.",
912
+ r
913
+ ), s.forEach(
914
+ (a, o) => this.validateText(a, u(t, "content", o), !1)
915
+ ));
916
+ }
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"),
924
+ ["src", "alt", "title", "width", "height", "imageAlign"],
925
+ ["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(
928
+ "INVALID_VALUE",
929
+ u(t, "attrs", "imageAlign"),
930
+ `Unsupported image alignment "${n.imageAlign}".`,
931
+ r
932
+ )));
933
+ }
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"),
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(
945
+ "INVALID_VALUE",
946
+ u(t, "attrs", "style"),
947
+ 'Article button style must be "text" or "button".',
948
+ r
949
+ ));
950
+ }
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;
956
+ 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(
960
+ "TABLE_COLUMN_MISMATCH",
961
+ l(c, "content"),
962
+ `Expected ${s} table cells but received ${d}.`,
963
+ "tableRow"
964
+ ));
965
+ });
966
+ }
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;
974
+ }
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)));
981
+ }
982
+ }
983
+ function mt(i) {
984
+ return new yt().validate(i);
985
+ }
986
+ const B = Object.freeze({
987
+ 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);
993
+ }
994
+ function bt(i, e = {}) {
995
+ var s;
996
+ const t = (s = e.protocolVersion) != null ? s : M, r = K(t);
997
+ return r ? r.validate(i) : { valid: !1, issues: [{
998
+ code: "UNSUPPORTED_PROTOCOL",
999
+ path: "",
1000
+ message: `Article Content Protocol version ${t} is not supported.`
1001
+ }] };
1002
+ }
1003
+ const At = "Advertisement";
1004
+ function It() {
1005
+ return { adm: [], ads: [], loc: [] };
1006
+ }
1007
+ function kt() {
1008
+ return { adm: "", ads: "" };
1009
+ }
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({
1034
+ name: "ArticleContentRenderer",
1035
+ props: {
1036
+ document: {
1037
+ type: null,
1038
+ required: !0
1039
+ },
1040
+ protocolVersion: {
1041
+ type: Number,
1042
+ default: M
1043
+ },
1044
+ strict: {
1045
+ type: Boolean,
1046
+ default: !1
1047
+ },
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
1059
+ },
1060
+ imageBaseUrl: {
1061
+ type: String,
1062
+ default: I
1063
+ },
1064
+ resolveArticleButtonLink: {
1065
+ type: Function,
1066
+ default: void 0
1067
+ }
1068
+ },
1069
+ data() {
1070
+ return {
1071
+ reportedRuntimeIssues: /* @__PURE__ */ new Set(),
1072
+ reportedAdConfigIssue: null
1073
+ };
1074
+ },
1075
+ computed: {
1076
+ 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);
1084
+ }
1085
+ },
1086
+ watch: {
1087
+ validation: {
1088
+ immediate: !0,
1089
+ deep: !0,
1090
+ handler(i) {
1091
+ i.issues.forEach((e) => this.$emit("render-error", e));
1092
+ }
1093
+ },
1094
+ document: {
1095
+ deep: !0,
1096
+ handler() {
1097
+ this.reportedRuntimeIssues.clear();
1098
+ }
1099
+ },
1100
+ protocolVersion() {
1101
+ this.reportedRuntimeIssues.clear();
1102
+ },
1103
+ resolveArticleButtonLink() {
1104
+ this.reportedRuntimeIssues.clear();
1105
+ },
1106
+ imageBaseUrl() {
1107
+ 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
+ }
1120
+ },
1121
+ methods: {
1122
+ reportRuntimeIssue(i) {
1123
+ const e = $(i);
1124
+ this.reportedRuntimeIssues.has(e) || (this.reportedRuntimeIssues.add(e), this.$nextTick(() => this.$emit("render-error", i)));
1125
+ }
1126
+ },
1127
+ render(i) {
1128
+ const e = K(this.protocolVersion);
1129
+ if (!e || this.strict && !this.validation.valid)
1130
+ return i(
1131
+ "div",
1132
+ {
1133
+ class: "acp-render-error",
1134
+ attrs: {
1135
+ role: "alert",
1136
+ "data-render-error": "true"
1137
+ }
1138
+ },
1139
+ "Invalid article content"
1140
+ );
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,
1147
+ imageBaseUrl: this.imageBaseUrl,
1148
+ resolveArticleButtonLink: this.resolveArticleButtonLink,
1149
+ emitArticleButtonClick: (r) => this.$emit("article-button-click", r),
1150
+ reportIssue: this.reportRuntimeIssue
1151
+ });
1152
+ return i(
1153
+ "div",
1154
+ {
1155
+ class: "acp-document",
1156
+ attrs: {
1157
+ "data-node-type": "doc",
1158
+ "data-protocol-version": this.protocolVersion
1159
+ }
1160
+ },
1161
+ t
1162
+ );
1163
+ }
1164
+ });
1165
+ function Et(i, e, t, r, n, s, a, o) {
1166
+ var c = typeof i == "function" ? i.options : i;
1167
+ return {
1168
+ exports: i,
1169
+ options: c
1170
+ };
1171
+ }
1172
+ var Rt = /* @__PURE__ */ Et(
1173
+ Nt
1174
+ );
1175
+ const Pt = Rt.exports, Ct = Object.freeze({
1176
+ fileFormat: "article-content-protocol",
1177
+ fileFormatVersion: 1,
1178
+ mediaType: "application/vnd.article-content-protocol+json",
1179
+ id: "article-content-v1",
1180
+ version: 1,
1181
+ name: "Article Content Protocol v1",
1182
+ status: "draft",
1183
+ rootNode: "doc",
1184
+ nodeTypes: Object.freeze([
1185
+ "doc",
1186
+ "paragraph",
1187
+ "heading",
1188
+ "blockquote",
1189
+ "bulletList",
1190
+ "orderedList",
1191
+ "listItem",
1192
+ "codeBlock",
1193
+ "horizontalRule",
1194
+ "image",
1195
+ "articleButton",
1196
+ "table",
1197
+ "tableRow",
1198
+ "tableCell",
1199
+ "text"
1200
+ ]),
1201
+ markTypes: Object.freeze(["bold", "italic", "strike", "underline", "code", "link"])
1202
+ }), Ot = {
1203
+ install(i) {
1204
+ i.component("ArticleContentRenderer", Pt);
1205
+ }
1206
+ };
1207
+ 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
1215
+ };