file-viewer3 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +137 -0
  3. package/dist/ImageViewer-3aabb7c7.mjs +1898 -0
  4. package/dist/MarkdownViewer-11f6e7ed.mjs +1577 -0
  5. package/dist/PdfView-c5946833.mjs +21655 -0
  6. package/dist/PptxRender-f90c00c0.mjs +21163 -0
  7. package/dist/XlsxTable-22ea834f.mjs +69861 -0
  8. package/dist/_commonjs-dynamic-modules-bed80856.mjs +6 -0
  9. package/dist/_commonjsHelpers-92157f1b.mjs +36 -0
  10. package/dist/assets/pdf.worker-909112bf.js +66 -0
  11. package/dist/assets/pptx.worker-762bd091.js +21 -0
  12. package/dist/assets/xlsx.worker-b50adc35.js +65 -0
  13. package/dist/docx-preview.min-31358ab2.mjs +5287 -0
  14. package/dist/favicon.ico +0 -0
  15. package/dist/index-59c602ca.mjs +1711 -0
  16. package/dist/main.mjs +6 -0
  17. package/dist/main.umd.js +436 -0
  18. package/dist/src/package/common/type.d.ts +26 -0
  19. package/dist/src/package/common/util.d.ts +5 -0
  20. package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +25 -0
  21. package/dist/src/package/components/FileViewer/index.d.ts +2 -0
  22. package/dist/src/package/components/FileViewer/util.d.ts +2 -0
  23. package/dist/src/package/index.d.ts +12 -0
  24. package/dist/src/package/vendors/docx/index.d.ts +4 -0
  25. package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +13 -0
  26. package/dist/src/package/vendors/image/index.d.ts +4 -0
  27. package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +13 -0
  28. package/dist/src/package/vendors/md/index.d.ts +4 -0
  29. package/dist/src/package/vendors/mp4/index.d.ts +4 -0
  30. package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +13 -0
  31. package/dist/src/package/vendors/pdf/index.d.ts +1 -0
  32. package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +81 -0
  33. package/dist/src/package/vendors/pptx/index.d.ts +6 -0
  34. package/dist/src/package/vendors/pptx/options.d.ts +39 -0
  35. package/dist/src/package/vendors/pptx/support/chart.d.ts +4 -0
  36. package/dist/src/package/vendors/renders.d.ts +3 -0
  37. package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +13 -0
  38. package/dist/src/package/vendors/text/index.d.ts +6 -0
  39. package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +13 -0
  40. package/dist/src/package/vendors/xlsx/index.d.ts +5 -0
  41. package/dist/src/package/vendors/xlsx/render.d.ts +6 -0
  42. package/dist/src/package/vendors/xlsx/util.d.ts +8 -0
  43. package/dist/src/package/vendors/xlsx/worker/SheetData.d.ts +51 -0
  44. package/dist/src/package/vendors/xlsx/worker/color.d.ts +2 -0
  45. package/dist/src/package/vendors/xlsx/worker/context.d.ts +6 -0
  46. package/dist/src/package/vendors/xlsx/worker/util.d.ts +10 -0
  47. package/dist/style.css +57 -0
  48. package/package.json +84 -0
@@ -0,0 +1,1577 @@
1
+ var Y = Object.defineProperty;
2
+ var ee = (o, n, t) => n in o ? Y(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
+ var O = (o, n, t) => (ee(o, typeof n != "symbol" ? n + "" : n, t), t);
4
+ import { defineComponent as te, computed as ne, openBlock as ie, createElementBlock as se, unref as re } from "vue";
5
+ import { _ as le } from "./index-59c602ca.mjs";
6
+ function F() {
7
+ return {
8
+ async: !1,
9
+ baseUrl: null,
10
+ breaks: !1,
11
+ extensions: null,
12
+ gfm: !0,
13
+ headerIds: !0,
14
+ headerPrefix: "",
15
+ highlight: null,
16
+ hooks: null,
17
+ langPrefix: "language-",
18
+ mangle: !0,
19
+ pedantic: !1,
20
+ renderer: null,
21
+ sanitize: !1,
22
+ sanitizer: null,
23
+ silent: !1,
24
+ smartypants: !1,
25
+ tokenizer: null,
26
+ walkTokens: null,
27
+ xhtml: !1
28
+ };
29
+ }
30
+ let I = F();
31
+ function oe(o) {
32
+ I = o;
33
+ }
34
+ const V = /[&<>"']/, ae = new RegExp(V.source, "g"), X = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, ce = new RegExp(X.source, "g"), he = {
35
+ "&": "&amp;",
36
+ "<": "&lt;",
37
+ ">": "&gt;",
38
+ '"': "&quot;",
39
+ "'": "&#39;"
40
+ }, U = (o) => he[o];
41
+ function b(o, n) {
42
+ if (n) {
43
+ if (V.test(o))
44
+ return o.replace(ae, U);
45
+ } else if (X.test(o))
46
+ return o.replace(ce, U);
47
+ return o;
48
+ }
49
+ const ue = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
50
+ function W(o) {
51
+ return o.replace(ue, (n, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
52
+ }
53
+ const pe = /(^|[^\[])\^/g;
54
+ function m(o, n) {
55
+ o = typeof o == "string" ? o : o.source, n = n || "";
56
+ const t = {
57
+ replace: (e, i) => (i = i.source || i, i = i.replace(pe, "$1"), o = o.replace(e, i), t),
58
+ getRegex: () => new RegExp(o, n)
59
+ };
60
+ return t;
61
+ }
62
+ const fe = /[^\w:]/g, ge = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
63
+ function P(o, n, t) {
64
+ if (o) {
65
+ let e;
66
+ try {
67
+ e = decodeURIComponent(W(t)).replace(fe, "").toLowerCase();
68
+ } catch {
69
+ return null;
70
+ }
71
+ if (e.indexOf("javascript:") === 0 || e.indexOf("vbscript:") === 0 || e.indexOf("data:") === 0)
72
+ return null;
73
+ }
74
+ n && !ge.test(t) && (t = xe(n, t));
75
+ try {
76
+ t = encodeURI(t).replace(/%25/g, "%");
77
+ } catch {
78
+ return null;
79
+ }
80
+ return t;
81
+ }
82
+ const L = {}, de = /^[^:]+:\/*[^/]*$/, ke = /^([^:]+:)[\s\S]*$/, me = /^([^:]+:\/*[^/]*)[\s\S]*$/;
83
+ function xe(o, n) {
84
+ L[" " + o] || (de.test(o) ? L[" " + o] = o + "/" : L[" " + o] = B(o, "/", !0)), o = L[" " + o];
85
+ const t = o.indexOf(":") === -1;
86
+ return n.substring(0, 2) === "//" ? t ? n : o.replace(ke, "$1") + n : n.charAt(0) === "/" ? t ? n : o.replace(me, "$1") + n : o + n;
87
+ }
88
+ const Z = { exec: function() {
89
+ } };
90
+ function Q(o, n) {
91
+ const t = o.replace(/\|/g, (s, r, l) => {
92
+ let c = !1, d = r;
93
+ for (; --d >= 0 && l[d] === "\\"; )
94
+ c = !c;
95
+ return c ? "|" : " |";
96
+ }), e = t.split(/ \|/);
97
+ let i = 0;
98
+ if (e[0].trim() || e.shift(), e.length > 0 && !e[e.length - 1].trim() && e.pop(), e.length > n)
99
+ e.splice(n);
100
+ else
101
+ for (; e.length < n; )
102
+ e.push("");
103
+ for (; i < e.length; i++)
104
+ e[i] = e[i].trim().replace(/\\\|/g, "|");
105
+ return e;
106
+ }
107
+ function B(o, n, t) {
108
+ const e = o.length;
109
+ if (e === 0)
110
+ return "";
111
+ let i = 0;
112
+ for (; i < e; ) {
113
+ const s = o.charAt(e - i - 1);
114
+ if (s === n && !t)
115
+ i++;
116
+ else if (s !== n && t)
117
+ i++;
118
+ else
119
+ break;
120
+ }
121
+ return o.slice(0, e - i);
122
+ }
123
+ function we(o, n) {
124
+ if (o.indexOf(n[1]) === -1)
125
+ return -1;
126
+ const t = o.length;
127
+ let e = 0, i = 0;
128
+ for (; i < t; i++)
129
+ if (o[i] === "\\")
130
+ i++;
131
+ else if (o[i] === n[0])
132
+ e++;
133
+ else if (o[i] === n[1] && (e--, e < 0))
134
+ return i;
135
+ return -1;
136
+ }
137
+ function be(o) {
138
+ o && o.sanitize && !o.silent && console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
139
+ }
140
+ function j(o, n) {
141
+ if (n < 1)
142
+ return "";
143
+ let t = "";
144
+ for (; n > 1; )
145
+ n & 1 && (t += o), n >>= 1, o += o;
146
+ return t + o;
147
+ }
148
+ function N(o, n, t, e) {
149
+ const i = n.href, s = n.title ? b(n.title) : null, r = o[1].replace(/\\([\[\]])/g, "$1");
150
+ if (o[0].charAt(0) !== "!") {
151
+ e.state.inLink = !0;
152
+ const l = {
153
+ type: "link",
154
+ raw: t,
155
+ href: i,
156
+ title: s,
157
+ text: r,
158
+ tokens: e.inlineTokens(r)
159
+ };
160
+ return e.state.inLink = !1, l;
161
+ }
162
+ return {
163
+ type: "image",
164
+ raw: t,
165
+ href: i,
166
+ title: s,
167
+ text: b(r)
168
+ };
169
+ }
170
+ function _e(o, n) {
171
+ const t = o.match(/^(\s+)(?:```)/);
172
+ if (t === null)
173
+ return n;
174
+ const e = t[1];
175
+ return n.split(`
176
+ `).map((i) => {
177
+ const s = i.match(/^\s+/);
178
+ if (s === null)
179
+ return i;
180
+ const [r] = s;
181
+ return r.length >= e.length ? i.slice(e.length) : i;
182
+ }).join(`
183
+ `);
184
+ }
185
+ class q {
186
+ constructor(n) {
187
+ this.options = n || I;
188
+ }
189
+ space(n) {
190
+ const t = this.rules.block.newline.exec(n);
191
+ if (t && t[0].length > 0)
192
+ return {
193
+ type: "space",
194
+ raw: t[0]
195
+ };
196
+ }
197
+ code(n) {
198
+ const t = this.rules.block.code.exec(n);
199
+ if (t) {
200
+ const e = t[0].replace(/^ {1,4}/gm, "");
201
+ return {
202
+ type: "code",
203
+ raw: t[0],
204
+ codeBlockStyle: "indented",
205
+ text: this.options.pedantic ? e : B(e, `
206
+ `)
207
+ };
208
+ }
209
+ }
210
+ fences(n) {
211
+ const t = this.rules.block.fences.exec(n);
212
+ if (t) {
213
+ const e = t[0], i = _e(e, t[3] || "");
214
+ return {
215
+ type: "code",
216
+ raw: e,
217
+ lang: t[2] ? t[2].trim().replace(this.rules.inline._escapes, "$1") : t[2],
218
+ text: i
219
+ };
220
+ }
221
+ }
222
+ heading(n) {
223
+ const t = this.rules.block.heading.exec(n);
224
+ if (t) {
225
+ let e = t[2].trim();
226
+ if (/#$/.test(e)) {
227
+ const i = B(e, "#");
228
+ (this.options.pedantic || !i || / $/.test(i)) && (e = i.trim());
229
+ }
230
+ return {
231
+ type: "heading",
232
+ raw: t[0],
233
+ depth: t[1].length,
234
+ text: e,
235
+ tokens: this.lexer.inline(e)
236
+ };
237
+ }
238
+ }
239
+ hr(n) {
240
+ const t = this.rules.block.hr.exec(n);
241
+ if (t)
242
+ return {
243
+ type: "hr",
244
+ raw: t[0]
245
+ };
246
+ }
247
+ blockquote(n) {
248
+ const t = this.rules.block.blockquote.exec(n);
249
+ if (t) {
250
+ const e = t[0].replace(/^ *>[ \t]?/gm, ""), i = this.lexer.state.top;
251
+ this.lexer.state.top = !0;
252
+ const s = this.lexer.blockTokens(e);
253
+ return this.lexer.state.top = i, {
254
+ type: "blockquote",
255
+ raw: t[0],
256
+ tokens: s,
257
+ text: e
258
+ };
259
+ }
260
+ }
261
+ list(n) {
262
+ let t = this.rules.block.list.exec(n);
263
+ if (t) {
264
+ let e, i, s, r, l, c, d, f, g, k, h, z, _ = t[1].trim();
265
+ const T = _.length > 1, x = {
266
+ type: "list",
267
+ raw: "",
268
+ ordered: T,
269
+ start: T ? +_.slice(0, -1) : "",
270
+ loose: !1,
271
+ items: []
272
+ };
273
+ _ = T ? `\\d{1,9}\\${_.slice(-1)}` : `\\${_}`, this.options.pedantic && (_ = T ? _ : "[*+-]");
274
+ const w = new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`);
275
+ for (; n && (z = !1, !(!(t = w.exec(n)) || this.rules.block.hr.test(n))); ) {
276
+ if (e = t[0], n = n.substring(e.length), f = t[2].split(`
277
+ `, 1)[0].replace(/^\t+/, (S) => " ".repeat(3 * S.length)), g = n.split(`
278
+ `, 1)[0], this.options.pedantic ? (r = 2, h = f.trimLeft()) : (r = t[2].search(/[^ ]/), r = r > 4 ? 1 : r, h = f.slice(r), r += t[1].length), c = !1, !f && /^ *$/.test(g) && (e += g + `
279
+ `, n = n.substring(g.length + 1), z = !0), !z) {
280
+ const S = new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), y = new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), $ = new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), C = new RegExp(`^ {0,${Math.min(3, r - 1)}}#`);
281
+ for (; n && (k = n.split(`
282
+ `, 1)[0], g = k, this.options.pedantic && (g = g.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), !($.test(g) || C.test(g) || S.test(g) || y.test(n))); ) {
283
+ if (g.search(/[^ ]/) >= r || !g.trim())
284
+ h += `
285
+ ` + g.slice(r);
286
+ else {
287
+ if (c || f.search(/[^ ]/) >= 4 || $.test(f) || C.test(f) || y.test(f))
288
+ break;
289
+ h += `
290
+ ` + g;
291
+ }
292
+ !c && !g.trim() && (c = !0), e += k + `
293
+ `, n = n.substring(k.length + 1), f = g.slice(r);
294
+ }
295
+ }
296
+ x.loose || (d ? x.loose = !0 : /\n *\n *$/.test(e) && (d = !0)), this.options.gfm && (i = /^\[[ xX]\] /.exec(h), i && (s = i[0] !== "[ ] ", h = h.replace(/^\[[ xX]\] +/, ""))), x.items.push({
297
+ type: "list_item",
298
+ raw: e,
299
+ task: !!i,
300
+ checked: s,
301
+ loose: !1,
302
+ text: h
303
+ }), x.raw += e;
304
+ }
305
+ x.items[x.items.length - 1].raw = e.trimRight(), x.items[x.items.length - 1].text = h.trimRight(), x.raw = x.raw.trimRight();
306
+ const E = x.items.length;
307
+ for (l = 0; l < E; l++)
308
+ if (this.lexer.state.top = !1, x.items[l].tokens = this.lexer.blockTokens(x.items[l].text, []), !x.loose) {
309
+ const S = x.items[l].tokens.filter(($) => $.type === "space"), y = S.length > 0 && S.some(($) => /\n.*\n/.test($.raw));
310
+ x.loose = y;
311
+ }
312
+ if (x.loose)
313
+ for (l = 0; l < E; l++)
314
+ x.items[l].loose = !0;
315
+ return x;
316
+ }
317
+ }
318
+ html(n) {
319
+ const t = this.rules.block.html.exec(n);
320
+ if (t) {
321
+ const e = {
322
+ type: "html",
323
+ raw: t[0],
324
+ pre: !this.options.sanitizer && (t[1] === "pre" || t[1] === "script" || t[1] === "style"),
325
+ text: t[0]
326
+ };
327
+ if (this.options.sanitize) {
328
+ const i = this.options.sanitizer ? this.options.sanitizer(t[0]) : b(t[0]);
329
+ e.type = "paragraph", e.text = i, e.tokens = this.lexer.inline(i);
330
+ }
331
+ return e;
332
+ }
333
+ }
334
+ def(n) {
335
+ const t = this.rules.block.def.exec(n);
336
+ if (t) {
337
+ const e = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "", s = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline._escapes, "$1") : t[3];
338
+ return {
339
+ type: "def",
340
+ tag: e,
341
+ raw: t[0],
342
+ href: i,
343
+ title: s
344
+ };
345
+ }
346
+ }
347
+ table(n) {
348
+ const t = this.rules.block.table.exec(n);
349
+ if (t) {
350
+ const e = {
351
+ type: "table",
352
+ header: Q(t[1]).map((i) => ({ text: i })),
353
+ align: t[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
354
+ rows: t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
355
+ `) : []
356
+ };
357
+ if (e.header.length === e.align.length) {
358
+ e.raw = t[0];
359
+ let i = e.align.length, s, r, l, c;
360
+ for (s = 0; s < i; s++)
361
+ /^ *-+: *$/.test(e.align[s]) ? e.align[s] = "right" : /^ *:-+: *$/.test(e.align[s]) ? e.align[s] = "center" : /^ *:-+ *$/.test(e.align[s]) ? e.align[s] = "left" : e.align[s] = null;
362
+ for (i = e.rows.length, s = 0; s < i; s++)
363
+ e.rows[s] = Q(e.rows[s], e.header.length).map((d) => ({ text: d }));
364
+ for (i = e.header.length, r = 0; r < i; r++)
365
+ e.header[r].tokens = this.lexer.inline(e.header[r].text);
366
+ for (i = e.rows.length, r = 0; r < i; r++)
367
+ for (c = e.rows[r], l = 0; l < c.length; l++)
368
+ c[l].tokens = this.lexer.inline(c[l].text);
369
+ return e;
370
+ }
371
+ }
372
+ }
373
+ lheading(n) {
374
+ const t = this.rules.block.lheading.exec(n);
375
+ if (t)
376
+ return {
377
+ type: "heading",
378
+ raw: t[0],
379
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
380
+ text: t[1],
381
+ tokens: this.lexer.inline(t[1])
382
+ };
383
+ }
384
+ paragraph(n) {
385
+ const t = this.rules.block.paragraph.exec(n);
386
+ if (t) {
387
+ const e = t[1].charAt(t[1].length - 1) === `
388
+ ` ? t[1].slice(0, -1) : t[1];
389
+ return {
390
+ type: "paragraph",
391
+ raw: t[0],
392
+ text: e,
393
+ tokens: this.lexer.inline(e)
394
+ };
395
+ }
396
+ }
397
+ text(n) {
398
+ const t = this.rules.block.text.exec(n);
399
+ if (t)
400
+ return {
401
+ type: "text",
402
+ raw: t[0],
403
+ text: t[0],
404
+ tokens: this.lexer.inline(t[0])
405
+ };
406
+ }
407
+ escape(n) {
408
+ const t = this.rules.inline.escape.exec(n);
409
+ if (t)
410
+ return {
411
+ type: "escape",
412
+ raw: t[0],
413
+ text: b(t[1])
414
+ };
415
+ }
416
+ tag(n) {
417
+ const t = this.rules.inline.tag.exec(n);
418
+ if (t)
419
+ return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
420
+ type: this.options.sanitize ? "text" : "html",
421
+ raw: t[0],
422
+ inLink: this.lexer.state.inLink,
423
+ inRawBlock: this.lexer.state.inRawBlock,
424
+ text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(t[0]) : b(t[0]) : t[0]
425
+ };
426
+ }
427
+ link(n) {
428
+ const t = this.rules.inline.link.exec(n);
429
+ if (t) {
430
+ const e = t[2].trim();
431
+ if (!this.options.pedantic && /^</.test(e)) {
432
+ if (!/>$/.test(e))
433
+ return;
434
+ const r = B(e.slice(0, -1), "\\");
435
+ if ((e.length - r.length) % 2 === 0)
436
+ return;
437
+ } else {
438
+ const r = we(t[2], "()");
439
+ if (r > -1) {
440
+ const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r;
441
+ t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, c).trim(), t[3] = "";
442
+ }
443
+ }
444
+ let i = t[2], s = "";
445
+ if (this.options.pedantic) {
446
+ const r = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
447
+ r && (i = r[1], s = r[3]);
448
+ } else
449
+ s = t[3] ? t[3].slice(1, -1) : "";
450
+ return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(e) ? i = i.slice(1) : i = i.slice(1, -1)), N(t, {
451
+ href: i && i.replace(this.rules.inline._escapes, "$1"),
452
+ title: s && s.replace(this.rules.inline._escapes, "$1")
453
+ }, t[0], this.lexer);
454
+ }
455
+ }
456
+ reflink(n, t) {
457
+ let e;
458
+ if ((e = this.rules.inline.reflink.exec(n)) || (e = this.rules.inline.nolink.exec(n))) {
459
+ let i = (e[2] || e[1]).replace(/\s+/g, " ");
460
+ if (i = t[i.toLowerCase()], !i) {
461
+ const s = e[0].charAt(0);
462
+ return {
463
+ type: "text",
464
+ raw: s,
465
+ text: s
466
+ };
467
+ }
468
+ return N(e, i, e[0], this.lexer);
469
+ }
470
+ }
471
+ emStrong(n, t, e = "") {
472
+ let i = this.rules.inline.emStrong.lDelim.exec(n);
473
+ if (!i || i[3] && e.match(/[\p{L}\p{N}]/u))
474
+ return;
475
+ const s = i[1] || i[2] || "";
476
+ if (!s || s && (e === "" || this.rules.inline.punctuation.exec(e))) {
477
+ const r = i[0].length - 1;
478
+ let l, c, d = r, f = 0;
479
+ const g = i[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
480
+ for (g.lastIndex = 0, t = t.slice(-1 * n.length + r); (i = g.exec(t)) != null; ) {
481
+ if (l = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !l)
482
+ continue;
483
+ if (c = l.length, i[3] || i[4]) {
484
+ d += c;
485
+ continue;
486
+ } else if ((i[5] || i[6]) && r % 3 && !((r + c) % 3)) {
487
+ f += c;
488
+ continue;
489
+ }
490
+ if (d -= c, d > 0)
491
+ continue;
492
+ c = Math.min(c, c + d + f);
493
+ const k = n.slice(0, r + i.index + (i[0].length - l.length) + c);
494
+ if (Math.min(r, c) % 2) {
495
+ const z = k.slice(1, -1);
496
+ return {
497
+ type: "em",
498
+ raw: k,
499
+ text: z,
500
+ tokens: this.lexer.inlineTokens(z)
501
+ };
502
+ }
503
+ const h = k.slice(2, -2);
504
+ return {
505
+ type: "strong",
506
+ raw: k,
507
+ text: h,
508
+ tokens: this.lexer.inlineTokens(h)
509
+ };
510
+ }
511
+ }
512
+ }
513
+ codespan(n) {
514
+ const t = this.rules.inline.code.exec(n);
515
+ if (t) {
516
+ let e = t[2].replace(/\n/g, " ");
517
+ const i = /[^ ]/.test(e), s = /^ /.test(e) && / $/.test(e);
518
+ return i && s && (e = e.substring(1, e.length - 1)), e = b(e, !0), {
519
+ type: "codespan",
520
+ raw: t[0],
521
+ text: e
522
+ };
523
+ }
524
+ }
525
+ br(n) {
526
+ const t = this.rules.inline.br.exec(n);
527
+ if (t)
528
+ return {
529
+ type: "br",
530
+ raw: t[0]
531
+ };
532
+ }
533
+ del(n) {
534
+ const t = this.rules.inline.del.exec(n);
535
+ if (t)
536
+ return {
537
+ type: "del",
538
+ raw: t[0],
539
+ text: t[2],
540
+ tokens: this.lexer.inlineTokens(t[2])
541
+ };
542
+ }
543
+ autolink(n, t) {
544
+ const e = this.rules.inline.autolink.exec(n);
545
+ if (e) {
546
+ let i, s;
547
+ return e[2] === "@" ? (i = b(this.options.mangle ? t(e[1]) : e[1]), s = "mailto:" + i) : (i = b(e[1]), s = i), {
548
+ type: "link",
549
+ raw: e[0],
550
+ text: i,
551
+ href: s,
552
+ tokens: [
553
+ {
554
+ type: "text",
555
+ raw: i,
556
+ text: i
557
+ }
558
+ ]
559
+ };
560
+ }
561
+ }
562
+ url(n, t) {
563
+ let e;
564
+ if (e = this.rules.inline.url.exec(n)) {
565
+ let i, s;
566
+ if (e[2] === "@")
567
+ i = b(this.options.mangle ? t(e[0]) : e[0]), s = "mailto:" + i;
568
+ else {
569
+ let r;
570
+ do
571
+ r = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])[0];
572
+ while (r !== e[0]);
573
+ i = b(e[0]), e[1] === "www." ? s = "http://" + e[0] : s = e[0];
574
+ }
575
+ return {
576
+ type: "link",
577
+ raw: e[0],
578
+ text: i,
579
+ href: s,
580
+ tokens: [
581
+ {
582
+ type: "text",
583
+ raw: i,
584
+ text: i
585
+ }
586
+ ]
587
+ };
588
+ }
589
+ }
590
+ inlineText(n, t) {
591
+ const e = this.rules.inline.text.exec(n);
592
+ if (e) {
593
+ let i;
594
+ return this.lexer.state.inRawBlock ? i = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(e[0]) : b(e[0]) : e[0] : i = b(this.options.smartypants ? t(e[0]) : e[0]), {
595
+ type: "text",
596
+ raw: e[0],
597
+ text: i
598
+ };
599
+ }
600
+ }
601
+ }
602
+ const u = {
603
+ newline: /^(?: *(?:\n|$))+/,
604
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
605
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
606
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
607
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
608
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
609
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
610
+ html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
611
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
612
+ table: Z,
613
+ lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
614
+ // regex template, placeholders will be replaced according to different paragraph
615
+ // interruption rules of commonmark and the original markdown spec:
616
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
617
+ text: /^[^\n]+/
618
+ };
619
+ u._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
620
+ u._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
621
+ u.def = m(u.def).replace("label", u._label).replace("title", u._title).getRegex();
622
+ u.bullet = /(?:[*+-]|\d{1,9}[.)])/;
623
+ u.listItemStart = m(/^( *)(bull) */).replace("bull", u.bullet).getRegex();
624
+ u.list = m(u.list).replace(/bull/g, u.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + u.def.source + ")").getRegex();
625
+ u._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
626
+ u._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
627
+ u.html = m(u.html, "i").replace("comment", u._comment).replace("tag", u._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
628
+ u.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
629
+ u.blockquote = m(u.blockquote).replace("paragraph", u.paragraph).getRegex();
630
+ u.normal = { ...u };
631
+ u.gfm = {
632
+ ...u.normal,
633
+ table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
634
+ // Cells
635
+ };
636
+ u.gfm.table = m(u.gfm.table).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
637
+ u.gfm.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", u.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
638
+ u.pedantic = {
639
+ ...u.normal,
640
+ html: m(
641
+ `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
642
+ ).replace("comment", u._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
643
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
644
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
645
+ fences: Z,
646
+ // fences not supported
647
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
648
+ paragraph: m(u.normal._paragraph).replace("hr", u.hr).replace("heading", ` *#{1,6} *[^
649
+ ]`).replace("lheading", u.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
650
+ };
651
+ const a = {
652
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
653
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
654
+ url: Z,
655
+ tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
656
+ // CDATA section
657
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
658
+ reflink: /^!?\[(label)\]\[(ref)\]/,
659
+ nolink: /^!?\[(ref)\](?:\[\])?/,
660
+ reflinkSearch: "reflink|nolink(?!\\()",
661
+ emStrong: {
662
+ lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
663
+ // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
664
+ // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
665
+ rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
666
+ rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
667
+ // ^- Not allowed for _
668
+ },
669
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
670
+ br: /^( {2,}|\\)\n(?!\s*$)/,
671
+ del: Z,
672
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
673
+ punctuation: /^([\spunctuation])/
674
+ };
675
+ a._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
676
+ a.punctuation = m(a.punctuation).replace(/punctuation/g, a._punctuation).getRegex();
677
+ a.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
678
+ a.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
679
+ a._comment = m(u._comment).replace("(?:-->|$)", "-->").getRegex();
680
+ a.emStrong.lDelim = m(a.emStrong.lDelim).replace(/punct/g, a._punctuation).getRegex();
681
+ a.emStrong.rDelimAst = m(a.emStrong.rDelimAst, "g").replace(/punct/g, a._punctuation).getRegex();
682
+ a.emStrong.rDelimUnd = m(a.emStrong.rDelimUnd, "g").replace(/punct/g, a._punctuation).getRegex();
683
+ a._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
684
+ a._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
685
+ a._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
686
+ a.autolink = m(a.autolink).replace("scheme", a._scheme).replace("email", a._email).getRegex();
687
+ a._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
688
+ a.tag = m(a.tag).replace("comment", a._comment).replace("attribute", a._attribute).getRegex();
689
+ a._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
690
+ a._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
691
+ a._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
692
+ a.link = m(a.link).replace("label", a._label).replace("href", a._href).replace("title", a._title).getRegex();
693
+ a.reflink = m(a.reflink).replace("label", a._label).replace("ref", u._label).getRegex();
694
+ a.nolink = m(a.nolink).replace("ref", u._label).getRegex();
695
+ a.reflinkSearch = m(a.reflinkSearch, "g").replace("reflink", a.reflink).replace("nolink", a.nolink).getRegex();
696
+ a.normal = { ...a };
697
+ a.pedantic = {
698
+ ...a.normal,
699
+ strong: {
700
+ start: /^__|\*\*/,
701
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
702
+ endAst: /\*\*(?!\*)/g,
703
+ endUnd: /__(?!_)/g
704
+ },
705
+ em: {
706
+ start: /^_|\*/,
707
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
708
+ endAst: /\*(?!\*)/g,
709
+ endUnd: /_(?!_)/g
710
+ },
711
+ link: m(/^!?\[(label)\]\((.*?)\)/).replace("label", a._label).getRegex(),
712
+ reflink: m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", a._label).getRegex()
713
+ };
714
+ a.gfm = {
715
+ ...a.normal,
716
+ escape: m(a.escape).replace("])", "~|])").getRegex(),
717
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
718
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
719
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
720
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
721
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
722
+ };
723
+ a.gfm.url = m(a.gfm.url, "i").replace("email", a.gfm._extended_email).getRegex();
724
+ a.breaks = {
725
+ ...a.gfm,
726
+ br: m(a.br).replace("{2,}", "*").getRegex(),
727
+ text: m(a.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
728
+ };
729
+ function ye(o) {
730
+ return o.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
731
+ }
732
+ function H(o) {
733
+ let n = "", t, e;
734
+ const i = o.length;
735
+ for (t = 0; t < i; t++)
736
+ e = o.charCodeAt(t), Math.random() > 0.5 && (e = "x" + e.toString(16)), n += "&#" + e + ";";
737
+ return n;
738
+ }
739
+ class R {
740
+ constructor(n) {
741
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = n || I, this.options.tokenizer = this.options.tokenizer || new q(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
742
+ inLink: !1,
743
+ inRawBlock: !1,
744
+ top: !0
745
+ };
746
+ const t = {
747
+ block: u.normal,
748
+ inline: a.normal
749
+ };
750
+ this.options.pedantic ? (t.block = u.pedantic, t.inline = a.pedantic) : this.options.gfm && (t.block = u.gfm, this.options.breaks ? t.inline = a.breaks : t.inline = a.gfm), this.tokenizer.rules = t;
751
+ }
752
+ /**
753
+ * Expose Rules
754
+ */
755
+ static get rules() {
756
+ return {
757
+ block: u,
758
+ inline: a
759
+ };
760
+ }
761
+ /**
762
+ * Static Lex Method
763
+ */
764
+ static lex(n, t) {
765
+ return new R(t).lex(n);
766
+ }
767
+ /**
768
+ * Static Lex Inline Method
769
+ */
770
+ static lexInline(n, t) {
771
+ return new R(t).inlineTokens(n);
772
+ }
773
+ /**
774
+ * Preprocessing
775
+ */
776
+ lex(n) {
777
+ n = n.replace(/\r\n|\r/g, `
778
+ `), this.blockTokens(n, this.tokens);
779
+ let t;
780
+ for (; t = this.inlineQueue.shift(); )
781
+ this.inlineTokens(t.src, t.tokens);
782
+ return this.tokens;
783
+ }
784
+ /**
785
+ * Lexing
786
+ */
787
+ blockTokens(n, t = []) {
788
+ this.options.pedantic ? n = n.replace(/\t/g, " ").replace(/^ +$/gm, "") : n = n.replace(/^( *)(\t+)/gm, (l, c, d) => c + " ".repeat(d.length));
789
+ let e, i, s, r;
790
+ for (; n; )
791
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((l) => (e = l.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
792
+ if (e = this.tokenizer.space(n)) {
793
+ n = n.substring(e.raw.length), e.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
794
+ ` : t.push(e);
795
+ continue;
796
+ }
797
+ if (e = this.tokenizer.code(n)) {
798
+ n = n.substring(e.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
799
+ ` + e.raw, i.text += `
800
+ ` + e.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e);
801
+ continue;
802
+ }
803
+ if (e = this.tokenizer.fences(n)) {
804
+ n = n.substring(e.raw.length), t.push(e);
805
+ continue;
806
+ }
807
+ if (e = this.tokenizer.heading(n)) {
808
+ n = n.substring(e.raw.length), t.push(e);
809
+ continue;
810
+ }
811
+ if (e = this.tokenizer.hr(n)) {
812
+ n = n.substring(e.raw.length), t.push(e);
813
+ continue;
814
+ }
815
+ if (e = this.tokenizer.blockquote(n)) {
816
+ n = n.substring(e.raw.length), t.push(e);
817
+ continue;
818
+ }
819
+ if (e = this.tokenizer.list(n)) {
820
+ n = n.substring(e.raw.length), t.push(e);
821
+ continue;
822
+ }
823
+ if (e = this.tokenizer.html(n)) {
824
+ n = n.substring(e.raw.length), t.push(e);
825
+ continue;
826
+ }
827
+ if (e = this.tokenizer.def(n)) {
828
+ n = n.substring(e.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
829
+ ` + e.raw, i.text += `
830
+ ` + e.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[e.tag] || (this.tokens.links[e.tag] = {
831
+ href: e.href,
832
+ title: e.title
833
+ });
834
+ continue;
835
+ }
836
+ if (e = this.tokenizer.table(n)) {
837
+ n = n.substring(e.raw.length), t.push(e);
838
+ continue;
839
+ }
840
+ if (e = this.tokenizer.lheading(n)) {
841
+ n = n.substring(e.raw.length), t.push(e);
842
+ continue;
843
+ }
844
+ if (s = n, this.options.extensions && this.options.extensions.startBlock) {
845
+ let l = 1 / 0;
846
+ const c = n.slice(1);
847
+ let d;
848
+ this.options.extensions.startBlock.forEach(function(f) {
849
+ d = f.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (l = Math.min(l, d));
850
+ }), l < 1 / 0 && l >= 0 && (s = n.substring(0, l + 1));
851
+ }
852
+ if (this.state.top && (e = this.tokenizer.paragraph(s))) {
853
+ i = t[t.length - 1], r && i.type === "paragraph" ? (i.raw += `
854
+ ` + e.raw, i.text += `
855
+ ` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e), r = s.length !== n.length, n = n.substring(e.raw.length);
856
+ continue;
857
+ }
858
+ if (e = this.tokenizer.text(n)) {
859
+ n = n.substring(e.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
860
+ ` + e.raw, i.text += `
861
+ ` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e);
862
+ continue;
863
+ }
864
+ if (n) {
865
+ const l = "Infinite loop on byte: " + n.charCodeAt(0);
866
+ if (this.options.silent) {
867
+ console.error(l);
868
+ break;
869
+ } else
870
+ throw new Error(l);
871
+ }
872
+ }
873
+ return this.state.top = !0, t;
874
+ }
875
+ inline(n, t = []) {
876
+ return this.inlineQueue.push({ src: n, tokens: t }), t;
877
+ }
878
+ /**
879
+ * Lexing/Compiling
880
+ */
881
+ inlineTokens(n, t = []) {
882
+ let e, i, s, r = n, l, c, d;
883
+ if (this.tokens.links) {
884
+ const f = Object.keys(this.tokens.links);
885
+ if (f.length > 0)
886
+ for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
887
+ f.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, l.index) + "[" + j("a", l[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
888
+ }
889
+ for (; (l = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
890
+ r = r.slice(0, l.index) + "[" + j("a", l[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
891
+ for (; (l = this.tokenizer.rules.inline.escapedEmSt.exec(r)) != null; )
892
+ r = r.slice(0, l.index + l[0].length - 2) + "++" + r.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex), this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
893
+ for (; n; )
894
+ if (c || (d = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((f) => (e = f.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
895
+ if (e = this.tokenizer.escape(n)) {
896
+ n = n.substring(e.raw.length), t.push(e);
897
+ continue;
898
+ }
899
+ if (e = this.tokenizer.tag(n)) {
900
+ n = n.substring(e.raw.length), i = t[t.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
901
+ continue;
902
+ }
903
+ if (e = this.tokenizer.link(n)) {
904
+ n = n.substring(e.raw.length), t.push(e);
905
+ continue;
906
+ }
907
+ if (e = this.tokenizer.reflink(n, this.tokens.links)) {
908
+ n = n.substring(e.raw.length), i = t[t.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
909
+ continue;
910
+ }
911
+ if (e = this.tokenizer.emStrong(n, r, d)) {
912
+ n = n.substring(e.raw.length), t.push(e);
913
+ continue;
914
+ }
915
+ if (e = this.tokenizer.codespan(n)) {
916
+ n = n.substring(e.raw.length), t.push(e);
917
+ continue;
918
+ }
919
+ if (e = this.tokenizer.br(n)) {
920
+ n = n.substring(e.raw.length), t.push(e);
921
+ continue;
922
+ }
923
+ if (e = this.tokenizer.del(n)) {
924
+ n = n.substring(e.raw.length), t.push(e);
925
+ continue;
926
+ }
927
+ if (e = this.tokenizer.autolink(n, H)) {
928
+ n = n.substring(e.raw.length), t.push(e);
929
+ continue;
930
+ }
931
+ if (!this.state.inLink && (e = this.tokenizer.url(n, H))) {
932
+ n = n.substring(e.raw.length), t.push(e);
933
+ continue;
934
+ }
935
+ if (s = n, this.options.extensions && this.options.extensions.startInline) {
936
+ let f = 1 / 0;
937
+ const g = n.slice(1);
938
+ let k;
939
+ this.options.extensions.startInline.forEach(function(h) {
940
+ k = h.call({ lexer: this }, g), typeof k == "number" && k >= 0 && (f = Math.min(f, k));
941
+ }), f < 1 / 0 && f >= 0 && (s = n.substring(0, f + 1));
942
+ }
943
+ if (e = this.tokenizer.inlineText(s, ye)) {
944
+ n = n.substring(e.raw.length), e.raw.slice(-1) !== "_" && (d = e.raw.slice(-1)), c = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
945
+ continue;
946
+ }
947
+ if (n) {
948
+ const f = "Infinite loop on byte: " + n.charCodeAt(0);
949
+ if (this.options.silent) {
950
+ console.error(f);
951
+ break;
952
+ } else
953
+ throw new Error(f);
954
+ }
955
+ }
956
+ return t;
957
+ }
958
+ }
959
+ class D {
960
+ constructor(n) {
961
+ this.options = n || I;
962
+ }
963
+ code(n, t, e) {
964
+ const i = (t || "").match(/\S*/)[0];
965
+ if (this.options.highlight) {
966
+ const s = this.options.highlight(n, i);
967
+ s != null && s !== n && (e = !0, n = s);
968
+ }
969
+ return n = n.replace(/\n$/, "") + `
970
+ `, i ? '<pre><code class="' + this.options.langPrefix + b(i) + '">' + (e ? n : b(n, !0)) + `</code></pre>
971
+ ` : "<pre><code>" + (e ? n : b(n, !0)) + `</code></pre>
972
+ `;
973
+ }
974
+ /**
975
+ * @param {string} quote
976
+ */
977
+ blockquote(n) {
978
+ return `<blockquote>
979
+ ${n}</blockquote>
980
+ `;
981
+ }
982
+ html(n) {
983
+ return n;
984
+ }
985
+ /**
986
+ * @param {string} text
987
+ * @param {string} level
988
+ * @param {string} raw
989
+ * @param {any} slugger
990
+ */
991
+ heading(n, t, e, i) {
992
+ if (this.options.headerIds) {
993
+ const s = this.options.headerPrefix + i.slug(e);
994
+ return `<h${t} id="${s}">${n}</h${t}>
995
+ `;
996
+ }
997
+ return `<h${t}>${n}</h${t}>
998
+ `;
999
+ }
1000
+ hr() {
1001
+ return this.options.xhtml ? `<hr/>
1002
+ ` : `<hr>
1003
+ `;
1004
+ }
1005
+ list(n, t, e) {
1006
+ const i = t ? "ol" : "ul", s = t && e !== 1 ? ' start="' + e + '"' : "";
1007
+ return "<" + i + s + `>
1008
+ ` + n + "</" + i + `>
1009
+ `;
1010
+ }
1011
+ /**
1012
+ * @param {string} text
1013
+ */
1014
+ listitem(n) {
1015
+ return `<li>${n}</li>
1016
+ `;
1017
+ }
1018
+ checkbox(n) {
1019
+ return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
1020
+ }
1021
+ /**
1022
+ * @param {string} text
1023
+ */
1024
+ paragraph(n) {
1025
+ return `<p>${n}</p>
1026
+ `;
1027
+ }
1028
+ /**
1029
+ * @param {string} header
1030
+ * @param {string} body
1031
+ */
1032
+ table(n, t) {
1033
+ return t && (t = `<tbody>${t}</tbody>`), `<table>
1034
+ <thead>
1035
+ ` + n + `</thead>
1036
+ ` + t + `</table>
1037
+ `;
1038
+ }
1039
+ /**
1040
+ * @param {string} content
1041
+ */
1042
+ tablerow(n) {
1043
+ return `<tr>
1044
+ ${n}</tr>
1045
+ `;
1046
+ }
1047
+ tablecell(n, t) {
1048
+ const e = t.header ? "th" : "td";
1049
+ return (t.align ? `<${e} align="${t.align}">` : `<${e}>`) + n + `</${e}>
1050
+ `;
1051
+ }
1052
+ /**
1053
+ * span level renderer
1054
+ * @param {string} text
1055
+ */
1056
+ strong(n) {
1057
+ return `<strong>${n}</strong>`;
1058
+ }
1059
+ /**
1060
+ * @param {string} text
1061
+ */
1062
+ em(n) {
1063
+ return `<em>${n}</em>`;
1064
+ }
1065
+ /**
1066
+ * @param {string} text
1067
+ */
1068
+ codespan(n) {
1069
+ return `<code>${n}</code>`;
1070
+ }
1071
+ br() {
1072
+ return this.options.xhtml ? "<br/>" : "<br>";
1073
+ }
1074
+ /**
1075
+ * @param {string} text
1076
+ */
1077
+ del(n) {
1078
+ return `<del>${n}</del>`;
1079
+ }
1080
+ /**
1081
+ * @param {string} href
1082
+ * @param {string} title
1083
+ * @param {string} text
1084
+ */
1085
+ link(n, t, e) {
1086
+ if (n = P(this.options.sanitize, this.options.baseUrl, n), n === null)
1087
+ return e;
1088
+ let i = '<a href="' + n + '"';
1089
+ return t && (i += ' title="' + t + '"'), i += ">" + e + "</a>", i;
1090
+ }
1091
+ /**
1092
+ * @param {string} href
1093
+ * @param {string} title
1094
+ * @param {string} text
1095
+ */
1096
+ image(n, t, e) {
1097
+ if (n = P(this.options.sanitize, this.options.baseUrl, n), n === null)
1098
+ return e;
1099
+ let i = `<img src="${n}" alt="${e}"`;
1100
+ return t && (i += ` title="${t}"`), i += this.options.xhtml ? "/>" : ">", i;
1101
+ }
1102
+ text(n) {
1103
+ return n;
1104
+ }
1105
+ }
1106
+ class G {
1107
+ // no need for block level renderers
1108
+ strong(n) {
1109
+ return n;
1110
+ }
1111
+ em(n) {
1112
+ return n;
1113
+ }
1114
+ codespan(n) {
1115
+ return n;
1116
+ }
1117
+ del(n) {
1118
+ return n;
1119
+ }
1120
+ html(n) {
1121
+ return n;
1122
+ }
1123
+ text(n) {
1124
+ return n;
1125
+ }
1126
+ link(n, t, e) {
1127
+ return "" + e;
1128
+ }
1129
+ image(n, t, e) {
1130
+ return "" + e;
1131
+ }
1132
+ br() {
1133
+ return "";
1134
+ }
1135
+ }
1136
+ class J {
1137
+ constructor() {
1138
+ this.seen = {};
1139
+ }
1140
+ /**
1141
+ * @param {string} value
1142
+ */
1143
+ serialize(n) {
1144
+ return n.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
1145
+ }
1146
+ /**
1147
+ * Finds the next safe (unique) slug to use
1148
+ * @param {string} originalSlug
1149
+ * @param {boolean} isDryRun
1150
+ */
1151
+ getNextSafeSlug(n, t) {
1152
+ let e = n, i = 0;
1153
+ if (this.seen.hasOwnProperty(e)) {
1154
+ i = this.seen[n];
1155
+ do
1156
+ i++, e = n + "-" + i;
1157
+ while (this.seen.hasOwnProperty(e));
1158
+ }
1159
+ return t || (this.seen[n] = i, this.seen[e] = 0), e;
1160
+ }
1161
+ /**
1162
+ * Convert string to unique id
1163
+ * @param {object} [options]
1164
+ * @param {boolean} [options.dryrun] Generates the next unique slug without
1165
+ * updating the internal accumulator.
1166
+ */
1167
+ slug(n, t = {}) {
1168
+ const e = this.serialize(n);
1169
+ return this.getNextSafeSlug(e, t.dryrun);
1170
+ }
1171
+ }
1172
+ class A {
1173
+ constructor(n) {
1174
+ this.options = n || I, this.options.renderer = this.options.renderer || new D(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new G(), this.slugger = new J();
1175
+ }
1176
+ /**
1177
+ * Static Parse Method
1178
+ */
1179
+ static parse(n, t) {
1180
+ return new A(t).parse(n);
1181
+ }
1182
+ /**
1183
+ * Static Parse Inline Method
1184
+ */
1185
+ static parseInline(n, t) {
1186
+ return new A(t).parseInline(n);
1187
+ }
1188
+ /**
1189
+ * Parse Loop
1190
+ */
1191
+ parse(n, t = !0) {
1192
+ let e = "", i, s, r, l, c, d, f, g, k, h, z, _, T, x, w, E, S, y, $;
1193
+ const C = n.length;
1194
+ for (i = 0; i < C; i++) {
1195
+ if (h = n[i], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[h.type] && ($ = this.options.extensions.renderers[h.type].call({ parser: this }, h), $ !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(h.type))) {
1196
+ e += $ || "";
1197
+ continue;
1198
+ }
1199
+ switch (h.type) {
1200
+ case "space":
1201
+ continue;
1202
+ case "hr": {
1203
+ e += this.renderer.hr();
1204
+ continue;
1205
+ }
1206
+ case "heading": {
1207
+ e += this.renderer.heading(
1208
+ this.parseInline(h.tokens),
1209
+ h.depth,
1210
+ W(this.parseInline(h.tokens, this.textRenderer)),
1211
+ this.slugger
1212
+ );
1213
+ continue;
1214
+ }
1215
+ case "code": {
1216
+ e += this.renderer.code(
1217
+ h.text,
1218
+ h.lang,
1219
+ h.escaped
1220
+ );
1221
+ continue;
1222
+ }
1223
+ case "table": {
1224
+ for (g = "", f = "", l = h.header.length, s = 0; s < l; s++)
1225
+ f += this.renderer.tablecell(
1226
+ this.parseInline(h.header[s].tokens),
1227
+ { header: !0, align: h.align[s] }
1228
+ );
1229
+ for (g += this.renderer.tablerow(f), k = "", l = h.rows.length, s = 0; s < l; s++) {
1230
+ for (d = h.rows[s], f = "", c = d.length, r = 0; r < c; r++)
1231
+ f += this.renderer.tablecell(
1232
+ this.parseInline(d[r].tokens),
1233
+ { header: !1, align: h.align[r] }
1234
+ );
1235
+ k += this.renderer.tablerow(f);
1236
+ }
1237
+ e += this.renderer.table(g, k);
1238
+ continue;
1239
+ }
1240
+ case "blockquote": {
1241
+ k = this.parse(h.tokens), e += this.renderer.blockquote(k);
1242
+ continue;
1243
+ }
1244
+ case "list": {
1245
+ for (z = h.ordered, _ = h.start, T = h.loose, l = h.items.length, k = "", s = 0; s < l; s++)
1246
+ w = h.items[s], E = w.checked, S = w.task, x = "", w.task && (y = this.renderer.checkbox(E), T ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = y + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = y + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
1247
+ type: "text",
1248
+ text: y
1249
+ }) : x += y), x += this.parse(w.tokens, T), k += this.renderer.listitem(x, S, E);
1250
+ e += this.renderer.list(k, z, _);
1251
+ continue;
1252
+ }
1253
+ case "html": {
1254
+ e += this.renderer.html(h.text);
1255
+ continue;
1256
+ }
1257
+ case "paragraph": {
1258
+ e += this.renderer.paragraph(this.parseInline(h.tokens));
1259
+ continue;
1260
+ }
1261
+ case "text": {
1262
+ for (k = h.tokens ? this.parseInline(h.tokens) : h.text; i + 1 < C && n[i + 1].type === "text"; )
1263
+ h = n[++i], k += `
1264
+ ` + (h.tokens ? this.parseInline(h.tokens) : h.text);
1265
+ e += t ? this.renderer.paragraph(k) : k;
1266
+ continue;
1267
+ }
1268
+ default: {
1269
+ const M = 'Token with "' + h.type + '" type was not found.';
1270
+ if (this.options.silent) {
1271
+ console.error(M);
1272
+ return;
1273
+ } else
1274
+ throw new Error(M);
1275
+ }
1276
+ }
1277
+ }
1278
+ return e;
1279
+ }
1280
+ /**
1281
+ * Parse Inline Tokens
1282
+ */
1283
+ parseInline(n, t) {
1284
+ t = t || this.renderer;
1285
+ let e = "", i, s, r;
1286
+ const l = n.length;
1287
+ for (i = 0; i < l; i++) {
1288
+ if (s = n[i], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[s.type] && (r = this.options.extensions.renderers[s.type].call({ parser: this }, s), r !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s.type))) {
1289
+ e += r || "";
1290
+ continue;
1291
+ }
1292
+ switch (s.type) {
1293
+ case "escape": {
1294
+ e += t.text(s.text);
1295
+ break;
1296
+ }
1297
+ case "html": {
1298
+ e += t.html(s.text);
1299
+ break;
1300
+ }
1301
+ case "link": {
1302
+ e += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1303
+ break;
1304
+ }
1305
+ case "image": {
1306
+ e += t.image(s.href, s.title, s.text);
1307
+ break;
1308
+ }
1309
+ case "strong": {
1310
+ e += t.strong(this.parseInline(s.tokens, t));
1311
+ break;
1312
+ }
1313
+ case "em": {
1314
+ e += t.em(this.parseInline(s.tokens, t));
1315
+ break;
1316
+ }
1317
+ case "codespan": {
1318
+ e += t.codespan(s.text);
1319
+ break;
1320
+ }
1321
+ case "br": {
1322
+ e += t.br();
1323
+ break;
1324
+ }
1325
+ case "del": {
1326
+ e += t.del(this.parseInline(s.tokens, t));
1327
+ break;
1328
+ }
1329
+ case "text": {
1330
+ e += t.text(s.text);
1331
+ break;
1332
+ }
1333
+ default: {
1334
+ const c = 'Token with "' + s.type + '" type was not found.';
1335
+ if (this.options.silent) {
1336
+ console.error(c);
1337
+ return;
1338
+ } else
1339
+ throw new Error(c);
1340
+ }
1341
+ }
1342
+ }
1343
+ return e;
1344
+ }
1345
+ }
1346
+ class v {
1347
+ constructor(n) {
1348
+ this.options = n || I;
1349
+ }
1350
+ /**
1351
+ * Process markdown before marked
1352
+ */
1353
+ preprocess(n) {
1354
+ return n;
1355
+ }
1356
+ /**
1357
+ * Process HTML after marked is finished
1358
+ */
1359
+ postprocess(n) {
1360
+ return n;
1361
+ }
1362
+ }
1363
+ O(v, "passThroughHooks", /* @__PURE__ */ new Set([
1364
+ "preprocess",
1365
+ "postprocess"
1366
+ ]));
1367
+ function $e(o, n, t) {
1368
+ return (e) => {
1369
+ if (e.message += `
1370
+ Please report this to https://github.com/markedjs/marked.`, o) {
1371
+ const i = "<p>An error occurred:</p><pre>" + b(e.message + "", !0) + "</pre>";
1372
+ if (n)
1373
+ return Promise.resolve(i);
1374
+ if (t) {
1375
+ t(null, i);
1376
+ return;
1377
+ }
1378
+ return i;
1379
+ }
1380
+ if (n)
1381
+ return Promise.reject(e);
1382
+ if (t) {
1383
+ t(e);
1384
+ return;
1385
+ }
1386
+ throw e;
1387
+ };
1388
+ }
1389
+ function K(o, n) {
1390
+ return (t, e, i) => {
1391
+ typeof e == "function" && (i = e, e = null);
1392
+ const s = { ...e };
1393
+ e = { ...p.defaults, ...s };
1394
+ const r = $e(e.silent, e.async, i);
1395
+ if (typeof t > "u" || t === null)
1396
+ return r(new Error("marked(): input parameter is undefined or null"));
1397
+ if (typeof t != "string")
1398
+ return r(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1399
+ if (be(e), e.hooks && (e.hooks.options = e), i) {
1400
+ const l = e.highlight;
1401
+ let c;
1402
+ try {
1403
+ e.hooks && (t = e.hooks.preprocess(t)), c = o(t, e);
1404
+ } catch (g) {
1405
+ return r(g);
1406
+ }
1407
+ const d = function(g) {
1408
+ let k;
1409
+ if (!g)
1410
+ try {
1411
+ e.walkTokens && p.walkTokens(c, e.walkTokens), k = n(c, e), e.hooks && (k = e.hooks.postprocess(k));
1412
+ } catch (h) {
1413
+ g = h;
1414
+ }
1415
+ return e.highlight = l, g ? r(g) : i(null, k);
1416
+ };
1417
+ if (!l || l.length < 3 || (delete e.highlight, !c.length))
1418
+ return d();
1419
+ let f = 0;
1420
+ p.walkTokens(c, function(g) {
1421
+ g.type === "code" && (f++, setTimeout(() => {
1422
+ l(g.text, g.lang, function(k, h) {
1423
+ if (k)
1424
+ return d(k);
1425
+ h != null && h !== g.text && (g.text = h, g.escaped = !0), f--, f === 0 && d();
1426
+ });
1427
+ }, 0));
1428
+ }), f === 0 && d();
1429
+ return;
1430
+ }
1431
+ if (e.async)
1432
+ return Promise.resolve(e.hooks ? e.hooks.preprocess(t) : t).then((l) => o(l, e)).then((l) => e.walkTokens ? Promise.all(p.walkTokens(l, e.walkTokens)).then(() => l) : l).then((l) => n(l, e)).then((l) => e.hooks ? e.hooks.postprocess(l) : l).catch(r);
1433
+ try {
1434
+ e.hooks && (t = e.hooks.preprocess(t));
1435
+ const l = o(t, e);
1436
+ e.walkTokens && p.walkTokens(l, e.walkTokens);
1437
+ let c = n(l, e);
1438
+ return e.hooks && (c = e.hooks.postprocess(c)), c;
1439
+ } catch (l) {
1440
+ return r(l);
1441
+ }
1442
+ };
1443
+ }
1444
+ function p(o, n, t) {
1445
+ return K(R.lex, A.parse)(o, n, t);
1446
+ }
1447
+ p.options = p.setOptions = function(o) {
1448
+ return p.defaults = { ...p.defaults, ...o }, oe(p.defaults), p;
1449
+ };
1450
+ p.getDefaults = F;
1451
+ p.defaults = I;
1452
+ p.use = function(...o) {
1453
+ const n = p.defaults.extensions || { renderers: {}, childTokens: {} };
1454
+ o.forEach((t) => {
1455
+ const e = { ...t };
1456
+ if (e.async = p.defaults.async || e.async || !1, t.extensions && (t.extensions.forEach((i) => {
1457
+ if (!i.name)
1458
+ throw new Error("extension name required");
1459
+ if (i.renderer) {
1460
+ const s = n.renderers[i.name];
1461
+ s ? n.renderers[i.name] = function(...r) {
1462
+ let l = i.renderer.apply(this, r);
1463
+ return l === !1 && (l = s.apply(this, r)), l;
1464
+ } : n.renderers[i.name] = i.renderer;
1465
+ }
1466
+ if (i.tokenizer) {
1467
+ if (!i.level || i.level !== "block" && i.level !== "inline")
1468
+ throw new Error("extension level must be 'block' or 'inline'");
1469
+ n[i.level] ? n[i.level].unshift(i.tokenizer) : n[i.level] = [i.tokenizer], i.start && (i.level === "block" ? n.startBlock ? n.startBlock.push(i.start) : n.startBlock = [i.start] : i.level === "inline" && (n.startInline ? n.startInline.push(i.start) : n.startInline = [i.start]));
1470
+ }
1471
+ i.childTokens && (n.childTokens[i.name] = i.childTokens);
1472
+ }), e.extensions = n), t.renderer) {
1473
+ const i = p.defaults.renderer || new D();
1474
+ for (const s in t.renderer) {
1475
+ const r = i[s];
1476
+ i[s] = (...l) => {
1477
+ let c = t.renderer[s].apply(i, l);
1478
+ return c === !1 && (c = r.apply(i, l)), c;
1479
+ };
1480
+ }
1481
+ e.renderer = i;
1482
+ }
1483
+ if (t.tokenizer) {
1484
+ const i = p.defaults.tokenizer || new q();
1485
+ for (const s in t.tokenizer) {
1486
+ const r = i[s];
1487
+ i[s] = (...l) => {
1488
+ let c = t.tokenizer[s].apply(i, l);
1489
+ return c === !1 && (c = r.apply(i, l)), c;
1490
+ };
1491
+ }
1492
+ e.tokenizer = i;
1493
+ }
1494
+ if (t.hooks) {
1495
+ const i = p.defaults.hooks || new v();
1496
+ for (const s in t.hooks) {
1497
+ const r = i[s];
1498
+ v.passThroughHooks.has(s) ? i[s] = (l) => {
1499
+ if (p.defaults.async)
1500
+ return Promise.resolve(t.hooks[s].call(i, l)).then((d) => r.call(i, d));
1501
+ const c = t.hooks[s].call(i, l);
1502
+ return r.call(i, c);
1503
+ } : i[s] = (...l) => {
1504
+ let c = t.hooks[s].apply(i, l);
1505
+ return c === !1 && (c = r.apply(i, l)), c;
1506
+ };
1507
+ }
1508
+ e.hooks = i;
1509
+ }
1510
+ if (t.walkTokens) {
1511
+ const i = p.defaults.walkTokens;
1512
+ e.walkTokens = function(s) {
1513
+ let r = [];
1514
+ return r.push(t.walkTokens.call(this, s)), i && (r = r.concat(i.call(this, s))), r;
1515
+ };
1516
+ }
1517
+ p.setOptions(e);
1518
+ });
1519
+ };
1520
+ p.walkTokens = function(o, n) {
1521
+ let t = [];
1522
+ for (const e of o)
1523
+ switch (t = t.concat(n.call(p, e)), e.type) {
1524
+ case "table": {
1525
+ for (const i of e.header)
1526
+ t = t.concat(p.walkTokens(i.tokens, n));
1527
+ for (const i of e.rows)
1528
+ for (const s of i)
1529
+ t = t.concat(p.walkTokens(s.tokens, n));
1530
+ break;
1531
+ }
1532
+ case "list": {
1533
+ t = t.concat(p.walkTokens(e.items, n));
1534
+ break;
1535
+ }
1536
+ default:
1537
+ p.defaults.extensions && p.defaults.extensions.childTokens && p.defaults.extensions.childTokens[e.type] ? p.defaults.extensions.childTokens[e.type].forEach(function(i) {
1538
+ t = t.concat(p.walkTokens(e[i], n));
1539
+ }) : e.tokens && (t = t.concat(p.walkTokens(e.tokens, n)));
1540
+ }
1541
+ return t;
1542
+ };
1543
+ p.parseInline = K(R.lexInline, A.parseInline);
1544
+ p.Parser = A;
1545
+ p.parser = A.parse;
1546
+ p.Renderer = D;
1547
+ p.TextRenderer = G;
1548
+ p.Lexer = R;
1549
+ p.lexer = R.lex;
1550
+ p.Tokenizer = q;
1551
+ p.Slugger = J;
1552
+ p.Hooks = v;
1553
+ p.parse = p;
1554
+ p.options;
1555
+ p.setOptions;
1556
+ p.use;
1557
+ p.walkTokens;
1558
+ p.parseInline;
1559
+ A.parse;
1560
+ R.lex;
1561
+ const ze = ["innerHTML"], Se = /* @__PURE__ */ te({
1562
+ __name: "MarkdownViewer",
1563
+ props: {
1564
+ data: null
1565
+ },
1566
+ setup(o) {
1567
+ const n = o, t = ne(() => p(n.data));
1568
+ return (e, i) => (ie(), se("div", {
1569
+ class: "markdown-body",
1570
+ innerHTML: re(t)
1571
+ }, null, 8, ze));
1572
+ }
1573
+ });
1574
+ const Ie = /* @__PURE__ */ le(Se, [["__scopeId", "data-v-e0bd8a5a"]]);
1575
+ export {
1576
+ Ie as default
1577
+ };