@vectojs/markdown 0.16.1 → 0.18.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/Markdown.d.ts +26 -1
- package/dist/MarkdownWorkerSource.d.ts +1 -1
- package/dist/incrementalLex.d.ts +55 -17
- package/dist/index.js +1026 -75
- package/dist/index.mjs +1016 -74
- package/dist/markdown-abbr.d.ts +73 -0
- package/dist/markdown-code.d.ts +12 -8
- package/dist/markdown-container.d.ts +85 -0
- package/dist/markdown-emoji.d.ts +39 -0
- package/dist/markdown-entities.d.ts +18 -0
- package/dist/markdown-fenced-registry.d.ts +159 -0
- package/dist/markdown-footnote.d.ts +33 -3
- package/dist/markdown-inline.d.ts +40 -2
- package/dist/markdown-ins-mark.d.ts +33 -0
- package/dist/markdown-presets.d.ts +59 -0
- package/dist/markdown-superscript.d.ts +36 -0
- package/dist/markdown-typography.d.ts +72 -0
- package/dist/theme.d.ts +127 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -35,20 +35,29 @@ __export(index_exports, {
|
|
|
35
35
|
CodeBlock: () => CodeBlock,
|
|
36
36
|
Markdown: () => Markdown,
|
|
37
37
|
MathBlock: () => MathBlock,
|
|
38
|
+
PRESET_THEMES: () => PRESET_THEMES,
|
|
38
39
|
codeAtlas: () => codeAtlas,
|
|
39
40
|
codeAtlasStats: () => codeAtlasStats,
|
|
41
|
+
ensureFencedBlockRenderer: () => ensureFencedBlockRenderer,
|
|
40
42
|
escapeCsvField: () => escapeCsvField,
|
|
41
43
|
escapeMarkdownTableCell: () => escapeMarkdownTableCell,
|
|
42
44
|
extensionForLanguage: () => extensionForLanguage,
|
|
43
45
|
footnoteMarker: () => footnoteMarker,
|
|
46
|
+
hasFencedBlockRenderer: () => hasFencedBlockRenderer,
|
|
47
|
+
isFencedBlockRendererReady: () => isFencedBlockRendererReady,
|
|
44
48
|
isMathJaxReady: () => isMathJaxReady,
|
|
49
|
+
isPresetName: () => isPresetName,
|
|
45
50
|
mimeForLanguage: () => mimeForLanguage,
|
|
46
51
|
parseFrontMatterFields: () => parseFrontMatterFields,
|
|
47
52
|
preloadMathJax: () => preloadMathJax,
|
|
53
|
+
registerFencedBlockRenderer: () => registerFencedBlockRenderer,
|
|
54
|
+
renderFencedBlock: () => renderFencedBlock,
|
|
55
|
+
resolvePresetTheme: () => resolvePresetTheme,
|
|
48
56
|
scanFrontMatter: () => scanFrontMatter,
|
|
49
57
|
tableContentOf: () => tableContentOf,
|
|
50
58
|
tableToCsv: () => tableToCsv,
|
|
51
|
-
tableToMarkdown: () => tableToMarkdown
|
|
59
|
+
tableToMarkdown: () => tableToMarkdown,
|
|
60
|
+
unregisterFencedBlockRenderer: () => unregisterFencedBlockRenderer
|
|
52
61
|
});
|
|
53
62
|
module.exports = __toCommonJS(index_exports);
|
|
54
63
|
|
|
@@ -509,6 +518,59 @@ var MarkdownContainer = class extends import_core.Entity {
|
|
|
509
518
|
render(_r) {
|
|
510
519
|
}
|
|
511
520
|
};
|
|
521
|
+
var ContainerBackground = class extends import_core.Entity {
|
|
522
|
+
color;
|
|
523
|
+
radius;
|
|
524
|
+
constructor(w, h, color, radius) {
|
|
525
|
+
super();
|
|
526
|
+
this.width = w;
|
|
527
|
+
this.height = h;
|
|
528
|
+
this.color = color;
|
|
529
|
+
this.radius = radius;
|
|
530
|
+
}
|
|
531
|
+
isPointInside() {
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
render(r) {
|
|
535
|
+
r.beginPath();
|
|
536
|
+
r.roundRect(0, 0, this.width, this.height, this.radius);
|
|
537
|
+
r.fill(this.color);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
// src/markdown-abbr.ts
|
|
542
|
+
var DEF_RE = /^ {0,3}\*\[([^\]\n]+)\]:[ \t]*([^\n]*)(?:\n|$)/;
|
|
543
|
+
var ABBR_EXTENSIONS = [
|
|
544
|
+
{
|
|
545
|
+
name: "abbrDef",
|
|
546
|
+
level: "block",
|
|
547
|
+
tokenizer(src) {
|
|
548
|
+
const match = DEF_RE.exec(src);
|
|
549
|
+
if (match) {
|
|
550
|
+
return {
|
|
551
|
+
type: "abbrDef",
|
|
552
|
+
raw: match[0],
|
|
553
|
+
term: match[1],
|
|
554
|
+
definition: match[2]
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
return void 0;
|
|
558
|
+
},
|
|
559
|
+
renderer(token) {
|
|
560
|
+
return token.raw;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
];
|
|
564
|
+
function collectAbbreviations(tokens) {
|
|
565
|
+
const map = /* @__PURE__ */ new Map();
|
|
566
|
+
for (const token of tokens) {
|
|
567
|
+
if (token.type === "abbrDef") {
|
|
568
|
+
const t = token;
|
|
569
|
+
map.set(t.term, t.definition);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return map;
|
|
573
|
+
}
|
|
512
574
|
|
|
513
575
|
// src/markdown-code.ts
|
|
514
576
|
var import_core2 = require("@vectojs/core");
|
|
@@ -516,6 +578,7 @@ var import_ui = require("@vectojs/ui");
|
|
|
516
578
|
|
|
517
579
|
// src/theme.ts
|
|
518
580
|
var DEFAULT_THEME = {
|
|
581
|
+
typographer: false,
|
|
519
582
|
textColor: "#e2e8f0",
|
|
520
583
|
headingColor: "#f8fafc",
|
|
521
584
|
codeColor: "#a5f3fc",
|
|
@@ -528,6 +591,17 @@ var DEFAULT_THEME = {
|
|
|
528
591
|
linkColor: "#38bdf8",
|
|
529
592
|
footnoteColor: "#38bdf8",
|
|
530
593
|
mathFallbackColor: "#fcd34d",
|
|
594
|
+
markHighlightColor: "rgba(250, 204, 21, 0.35)",
|
|
595
|
+
containerColors: {
|
|
596
|
+
note: "#38bdf8",
|
|
597
|
+
info: "#38bdf8",
|
|
598
|
+
tip: "#4ade80",
|
|
599
|
+
warning: "#fbbf24",
|
|
600
|
+
danger: "#f87171",
|
|
601
|
+
caution: "#f87171"
|
|
602
|
+
},
|
|
603
|
+
containerDefaultColor: "#94a3b8",
|
|
604
|
+
containerBgColor: "rgba(148, 163, 184, 0.08)",
|
|
531
605
|
syntaxKeywordColor: "#c084fc",
|
|
532
606
|
syntaxStringColor: "#86efac",
|
|
533
607
|
syntaxCommentColor: "#64748b",
|
|
@@ -539,6 +613,10 @@ var DEFAULT_THEME = {
|
|
|
539
613
|
codeFontSize: 15,
|
|
540
614
|
tableFontSize: 14,
|
|
541
615
|
footnoteMarkerScale: 0.75,
|
|
616
|
+
subscriptScale: 0.75,
|
|
617
|
+
subscriptShift: -0.15,
|
|
618
|
+
superscriptScale: 0.75,
|
|
619
|
+
superscriptShift: 0.2,
|
|
542
620
|
codeLineHeight: 24,
|
|
543
621
|
bodyLineHeight: 24,
|
|
544
622
|
blockGap: 16,
|
|
@@ -549,6 +627,10 @@ var DEFAULT_THEME = {
|
|
|
549
627
|
quoteIndent: 16,
|
|
550
628
|
quoteBorderWidth: 4,
|
|
551
629
|
quoteInnerGap: 8,
|
|
630
|
+
containerIndent: 16,
|
|
631
|
+
containerBorderWidth: 4,
|
|
632
|
+
containerInnerGap: 8,
|
|
633
|
+
containerRadius: 8,
|
|
552
634
|
imageRadius: 8,
|
|
553
635
|
inlineImageScale: 1.15
|
|
554
636
|
};
|
|
@@ -571,6 +653,171 @@ function headingSize(theme, depth) {
|
|
|
571
653
|
const idx = Math.min(Math.max(depth, 1) - 1, sizes.length - 1);
|
|
572
654
|
return sizes[idx] ?? theme.fontSize;
|
|
573
655
|
}
|
|
656
|
+
function containerColor(theme, kind) {
|
|
657
|
+
if (kind === void 0) return theme.containerDefaultColor;
|
|
658
|
+
return theme.containerColors[kind.toLowerCase()] ?? theme.containerDefaultColor;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// src/markdown-presets.ts
|
|
662
|
+
var GITHUB_DARK = {
|
|
663
|
+
textColor: "#e6edf3",
|
|
664
|
+
headingColor: "#e6edf3",
|
|
665
|
+
codeColor: "#a5d6ff",
|
|
666
|
+
// Solid dark panel — not a translucent overlay since the canvas bg is dark.
|
|
667
|
+
codeBgColor: "#161b22",
|
|
668
|
+
quoteBorderColor: "#30363d",
|
|
669
|
+
hrColor: "#30363d",
|
|
670
|
+
tableBgColor: "#010409",
|
|
671
|
+
tableHeaderBgColor: "#161b22",
|
|
672
|
+
linkColor: "#58a6ff",
|
|
673
|
+
mathFallbackColor: "#e3b341",
|
|
674
|
+
markHighlightColor: "rgba(187, 128, 9, 0.4)",
|
|
675
|
+
containerColors: {
|
|
676
|
+
note: "#58a6ff",
|
|
677
|
+
info: "#58a6ff",
|
|
678
|
+
tip: "#3fb950",
|
|
679
|
+
warning: "#d29922",
|
|
680
|
+
danger: "#f85149",
|
|
681
|
+
caution: "#f85149"
|
|
682
|
+
},
|
|
683
|
+
containerDefaultColor: "#8b949e",
|
|
684
|
+
containerBgColor: "rgba(139, 148, 158, 0.08)",
|
|
685
|
+
// GitHub Dark Default syntax (Primer primitives / rouge github dark palette):
|
|
686
|
+
// keyword = P_RED_3 #ff7b72, string = P_BLUE_1 #a5d6ff,
|
|
687
|
+
// comment = P_GRAY_3 #8b949e, number = P_BLUE_2 #79c0ff.
|
|
688
|
+
syntaxKeywordColor: "#ff7b72",
|
|
689
|
+
syntaxStringColor: "#a5d6ff",
|
|
690
|
+
syntaxCommentColor: "#8b949e",
|
|
691
|
+
syntaxNumberColor: "#79c0ff"
|
|
692
|
+
};
|
|
693
|
+
var GITHUB_LIGHT = {
|
|
694
|
+
textColor: "#1f2328",
|
|
695
|
+
headingColor: "#1f2328",
|
|
696
|
+
codeColor: "#0550ae",
|
|
697
|
+
codeBgColor: "#f6f8fa",
|
|
698
|
+
quoteBorderColor: "#0969da",
|
|
699
|
+
hrColor: "#d0d7de",
|
|
700
|
+
tableBgColor: "#ffffff",
|
|
701
|
+
tableHeaderBgColor: "#eaeef2",
|
|
702
|
+
linkColor: "#0969da",
|
|
703
|
+
mathFallbackColor: "#9a6700",
|
|
704
|
+
markHighlightColor: "rgba(210, 153, 34, 0.25)",
|
|
705
|
+
containerColors: {
|
|
706
|
+
note: "#0969da",
|
|
707
|
+
info: "#0969da",
|
|
708
|
+
tip: "#1a7f37",
|
|
709
|
+
warning: "#9a6700",
|
|
710
|
+
danger: "#cf222e",
|
|
711
|
+
caution: "#cf222e"
|
|
712
|
+
},
|
|
713
|
+
containerDefaultColor: "#59636e",
|
|
714
|
+
containerBgColor: "rgba(208, 215, 222, 0.2)",
|
|
715
|
+
// GitHub Light Default syntax (Primer primitives / rouge github light palette):
|
|
716
|
+
// keyword = P_RED_5 #cf222e, string = P_BLUE_8 #0a3069,
|
|
717
|
+
// comment = P_GRAY_5 #6e7781, number = P_BLUE_6 #0550ae.
|
|
718
|
+
syntaxKeywordColor: "#cf222e",
|
|
719
|
+
syntaxStringColor: "#0a3069",
|
|
720
|
+
syntaxCommentColor: "#6e7781",
|
|
721
|
+
syntaxNumberColor: "#0550ae"
|
|
722
|
+
};
|
|
723
|
+
var DRACULA = {
|
|
724
|
+
textColor: "#f8f8f2",
|
|
725
|
+
headingColor: "#bd93f9",
|
|
726
|
+
codeColor: "#50fa7b",
|
|
727
|
+
codeBgColor: "#282a36",
|
|
728
|
+
quoteBorderColor: "#6272a4",
|
|
729
|
+
hrColor: "rgba(98, 114, 164, 0.4)",
|
|
730
|
+
tableBgColor: "rgba(40, 42, 54, 0.6)",
|
|
731
|
+
tableHeaderBgColor: "rgba(68, 71, 90, 0.5)",
|
|
732
|
+
linkColor: "#8be9fd",
|
|
733
|
+
mathFallbackColor: "#ffb86c",
|
|
734
|
+
markHighlightColor: "rgba(241, 250, 140, 0.3)",
|
|
735
|
+
containerColors: {
|
|
736
|
+
note: "#8be9fd",
|
|
737
|
+
info: "#8be9fd",
|
|
738
|
+
tip: "#50fa7b",
|
|
739
|
+
warning: "#ffb86c",
|
|
740
|
+
danger: "#ff5555",
|
|
741
|
+
caution: "#ff5555"
|
|
742
|
+
},
|
|
743
|
+
containerDefaultColor: "#6272a4",
|
|
744
|
+
containerBgColor: "rgba(98, 114, 164, 0.1)",
|
|
745
|
+
// Dracula syntax: keywords=Pink (#ff79c6), strings=Yellow (#f1fa8c),
|
|
746
|
+
// comments=Comment (#6272a4), numbers/constants=Orange (#ffb86c).
|
|
747
|
+
syntaxKeywordColor: "#ff79c6",
|
|
748
|
+
syntaxStringColor: "#f1fa8c",
|
|
749
|
+
syntaxCommentColor: "#6272a4",
|
|
750
|
+
syntaxNumberColor: "#ffb86c"
|
|
751
|
+
};
|
|
752
|
+
var SOLARIZED_DARK = {
|
|
753
|
+
textColor: "#839496",
|
|
754
|
+
headingColor: "#93a1a1",
|
|
755
|
+
codeColor: "#2aa198",
|
|
756
|
+
codeBgColor: "#073642",
|
|
757
|
+
quoteBorderColor: "#6c71c4",
|
|
758
|
+
hrColor: "rgba(88, 110, 117, 0.4)",
|
|
759
|
+
tableBgColor: "rgba(0, 43, 54, 0.6)",
|
|
760
|
+
tableHeaderBgColor: "rgba(7, 54, 66, 0.8)",
|
|
761
|
+
linkColor: "#268bd2",
|
|
762
|
+
mathFallbackColor: "#b58900",
|
|
763
|
+
markHighlightColor: "rgba(181, 137, 0, 0.3)",
|
|
764
|
+
containerColors: {
|
|
765
|
+
note: "#268bd2",
|
|
766
|
+
info: "#268bd2",
|
|
767
|
+
tip: "#859900",
|
|
768
|
+
warning: "#b58900",
|
|
769
|
+
danger: "#dc322f",
|
|
770
|
+
caution: "#dc322f"
|
|
771
|
+
},
|
|
772
|
+
containerDefaultColor: "#586e75",
|
|
773
|
+
containerBgColor: "rgba(88, 110, 117, 0.1)",
|
|
774
|
+
syntaxKeywordColor: "#859900",
|
|
775
|
+
syntaxStringColor: "#2aa198",
|
|
776
|
+
syntaxCommentColor: "#586e75",
|
|
777
|
+
syntaxNumberColor: "#b58900"
|
|
778
|
+
};
|
|
779
|
+
var SOLARIZED_LIGHT = {
|
|
780
|
+
textColor: "#657b83",
|
|
781
|
+
headingColor: "#586e75",
|
|
782
|
+
codeColor: "#2aa198",
|
|
783
|
+
codeBgColor: "#eee8d5",
|
|
784
|
+
quoteBorderColor: "#6c71c4",
|
|
785
|
+
hrColor: "rgba(147, 161, 161, 0.5)",
|
|
786
|
+
tableBgColor: "#fdf6e3",
|
|
787
|
+
tableHeaderBgColor: "#e0dac9",
|
|
788
|
+
linkColor: "#268bd2",
|
|
789
|
+
mathFallbackColor: "#cb4b16",
|
|
790
|
+
markHighlightColor: "rgba(181, 137, 0, 0.2)",
|
|
791
|
+
containerColors: {
|
|
792
|
+
note: "#268bd2",
|
|
793
|
+
info: "#268bd2",
|
|
794
|
+
tip: "#859900",
|
|
795
|
+
warning: "#b58900",
|
|
796
|
+
danger: "#dc322f",
|
|
797
|
+
caution: "#dc322f"
|
|
798
|
+
},
|
|
799
|
+
containerDefaultColor: "#93a1a1",
|
|
800
|
+
containerBgColor: "rgba(147, 161, 161, 0.15)",
|
|
801
|
+
// Syntax accent colors are identical in light and dark Solarized.
|
|
802
|
+
syntaxKeywordColor: "#859900",
|
|
803
|
+
syntaxStringColor: "#2aa198",
|
|
804
|
+
syntaxCommentColor: "#93a1a1",
|
|
805
|
+
syntaxNumberColor: "#b58900"
|
|
806
|
+
};
|
|
807
|
+
var PRESET_THEMES = {
|
|
808
|
+
githubDark: GITHUB_DARK,
|
|
809
|
+
githubLight: GITHUB_LIGHT,
|
|
810
|
+
dracula: DRACULA,
|
|
811
|
+
solarizedDark: SOLARIZED_DARK,
|
|
812
|
+
solarizedLight: SOLARIZED_LIGHT
|
|
813
|
+
};
|
|
814
|
+
function isPresetName(value) {
|
|
815
|
+
return typeof value === "string" && Object.prototype.hasOwnProperty.call(PRESET_THEMES, value);
|
|
816
|
+
}
|
|
817
|
+
function resolvePresetTheme(theme) {
|
|
818
|
+
if (isPresetName(theme)) return resolveTheme(PRESET_THEMES[theme]);
|
|
819
|
+
return resolveTheme(theme);
|
|
820
|
+
}
|
|
574
821
|
|
|
575
822
|
// src/markdown-code.ts
|
|
576
823
|
var KEYWORD_SETS = {
|
|
@@ -843,16 +1090,19 @@ var CodeBlock = class extends import_ui.UIComponent {
|
|
|
843
1090
|
codeFont;
|
|
844
1091
|
selectable;
|
|
845
1092
|
/**
|
|
846
|
-
* @param theme Any subset of {@link MarkdownTheme}
|
|
847
|
-
*
|
|
848
|
-
* written against an earlier, smaller
|
|
849
|
-
* is public API, and a hand-built
|
|
850
|
-
*
|
|
851
|
-
* size key
|
|
1093
|
+
* @param theme Any subset of {@link MarkdownTheme}, or the name of a built-in
|
|
1094
|
+
* preset (see {@link MarkdownThemePresetName}). Accepting a partial theme
|
|
1095
|
+
* keeps callers that were written against an earlier, smaller
|
|
1096
|
+
* `MarkdownTheme` working — this class is public API, and a hand-built
|
|
1097
|
+
* theme literal would otherwise start throwing
|
|
1098
|
+
* `lineHeight must be a positive finite number` the moment a new size key
|
|
1099
|
+
* was added. Resolved through {@link resolvePresetTheme} so `CodeBlock` can
|
|
1100
|
+
* be constructed directly with a preset name without going through
|
|
1101
|
+
* `Markdown`.
|
|
852
1102
|
*/
|
|
853
1103
|
constructor(code, lang, maxWidth, theme, selectable = true) {
|
|
854
1104
|
super();
|
|
855
|
-
const resolved =
|
|
1105
|
+
const resolved = resolvePresetTheme(theme);
|
|
856
1106
|
this.source = code;
|
|
857
1107
|
this.lang = lang;
|
|
858
1108
|
this.theme = resolved;
|
|
@@ -1069,10 +1319,295 @@ function codeAtlas() {
|
|
|
1069
1319
|
return lastCodeAtlas;
|
|
1070
1320
|
}
|
|
1071
1321
|
|
|
1322
|
+
// src/markdown-container.ts
|
|
1323
|
+
var OPEN_RE = /^ {0,3}:::([A-Za-z][\w-]*)?[ \t]*(?:\n|$)/;
|
|
1324
|
+
var FENCE_LINE_RE = /^ {0,3}:::([A-Za-z][\w-]*)?[ \t]*$/;
|
|
1325
|
+
function findBodyEnd(text) {
|
|
1326
|
+
let depth = 1;
|
|
1327
|
+
let offset = 0;
|
|
1328
|
+
while (offset < text.length) {
|
|
1329
|
+
const lineEnd = text.indexOf("\n", offset);
|
|
1330
|
+
const line = lineEnd === -1 ? text.slice(offset) : text.slice(offset, lineEnd);
|
|
1331
|
+
const match = FENCE_LINE_RE.exec(line);
|
|
1332
|
+
if (match) {
|
|
1333
|
+
if (match[1] !== void 0) {
|
|
1334
|
+
depth++;
|
|
1335
|
+
} else {
|
|
1336
|
+
depth--;
|
|
1337
|
+
if (depth === 0) return offset;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (lineEnd === -1) break;
|
|
1341
|
+
offset = lineEnd + 1;
|
|
1342
|
+
}
|
|
1343
|
+
return -1;
|
|
1344
|
+
}
|
|
1345
|
+
var CONTAINER_EXTENSIONS = [
|
|
1346
|
+
{
|
|
1347
|
+
name: "container",
|
|
1348
|
+
level: "block",
|
|
1349
|
+
tokenizer(src) {
|
|
1350
|
+
const open = OPEN_RE.exec(src);
|
|
1351
|
+
if (!open) return void 0;
|
|
1352
|
+
const afterOpen = src.slice(open[0].length);
|
|
1353
|
+
const bodyEnd = findBodyEnd(afterOpen);
|
|
1354
|
+
if (bodyEnd < 0) return void 0;
|
|
1355
|
+
const body = afterOpen.slice(0, bodyEnd);
|
|
1356
|
+
const closeLineEnd = afterOpen.indexOf("\n", bodyEnd);
|
|
1357
|
+
const closeEnd = closeLineEnd === -1 ? afterOpen.length : closeLineEnd + 1;
|
|
1358
|
+
const raw = open[0] + afterOpen.slice(0, closeEnd);
|
|
1359
|
+
const tokens = this.lexer.blockTokens(body, []);
|
|
1360
|
+
return {
|
|
1361
|
+
type: "container",
|
|
1362
|
+
raw,
|
|
1363
|
+
kind: open[1],
|
|
1364
|
+
tokens
|
|
1365
|
+
};
|
|
1366
|
+
},
|
|
1367
|
+
renderer(token) {
|
|
1368
|
+
return token.raw;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
];
|
|
1372
|
+
|
|
1373
|
+
// src/markdown-emoji.ts
|
|
1374
|
+
var EMOJI_MAP = Object.freeze({
|
|
1375
|
+
// Smileys
|
|
1376
|
+
grinning: "\u{1F600}",
|
|
1377
|
+
smiley: "\u{1F603}",
|
|
1378
|
+
smile: "\u{1F604}",
|
|
1379
|
+
grin: "\u{1F601}",
|
|
1380
|
+
laughing: "\u{1F606}",
|
|
1381
|
+
satisfied: "\u{1F606}",
|
|
1382
|
+
sweat_smile: "\u{1F605}",
|
|
1383
|
+
rofl: "\u{1F923}",
|
|
1384
|
+
joy: "\u{1F602}",
|
|
1385
|
+
slightly_smiling_face: "\u{1F642}",
|
|
1386
|
+
upside_down_face: "\u{1F643}",
|
|
1387
|
+
wink: "\u{1F609}",
|
|
1388
|
+
blush: "\u{1F60A}",
|
|
1389
|
+
innocent: "\u{1F607}",
|
|
1390
|
+
heart_eyes: "\u{1F60D}",
|
|
1391
|
+
star_struck: "\u{1F929}",
|
|
1392
|
+
kissing_heart: "\u{1F618}",
|
|
1393
|
+
yum: "\u{1F60B}",
|
|
1394
|
+
stuck_out_tongue: "\u{1F61B}",
|
|
1395
|
+
stuck_out_tongue_winking_eye: "\u{1F61C}",
|
|
1396
|
+
stuck_out_tongue_closed_eyes: "\u{1F61D}",
|
|
1397
|
+
hugs: "\u{1F917}",
|
|
1398
|
+
thinking: "\u{1F914}",
|
|
1399
|
+
neutral_face: "\u{1F610}",
|
|
1400
|
+
expressionless: "\u{1F611}",
|
|
1401
|
+
no_mouth: "\u{1F636}",
|
|
1402
|
+
smirk: "\u{1F60F}",
|
|
1403
|
+
unamused: "\u{1F612}",
|
|
1404
|
+
roll_eyes: "\u{1F644}",
|
|
1405
|
+
grimacing: "\u{1F62C}",
|
|
1406
|
+
relieved: "\u{1F60C}",
|
|
1407
|
+
pensive: "\u{1F614}",
|
|
1408
|
+
sleepy: "\u{1F62A}",
|
|
1409
|
+
sleeping: "\u{1F634}",
|
|
1410
|
+
mask: "\u{1F637}",
|
|
1411
|
+
dizzy_face: "\u{1F635}",
|
|
1412
|
+
sunglasses: "\u{1F60E}",
|
|
1413
|
+
nerd_face: "\u{1F913}",
|
|
1414
|
+
confused: "\u{1F615}",
|
|
1415
|
+
worried: "\u{1F61F}",
|
|
1416
|
+
open_mouth: "\u{1F62E}",
|
|
1417
|
+
hushed: "\u{1F62F}",
|
|
1418
|
+
astonished: "\u{1F632}",
|
|
1419
|
+
flushed: "\u{1F633}",
|
|
1420
|
+
pleading_face: "\u{1F97A}",
|
|
1421
|
+
fearful: "\u{1F628}",
|
|
1422
|
+
cold_sweat: "\u{1F630}",
|
|
1423
|
+
cry: "\u{1F622}",
|
|
1424
|
+
sob: "\u{1F62D}",
|
|
1425
|
+
scream: "\u{1F631}",
|
|
1426
|
+
disappointed: "\u{1F61E}",
|
|
1427
|
+
sweat: "\u{1F613}",
|
|
1428
|
+
weary: "\u{1F629}",
|
|
1429
|
+
tired_face: "\u{1F62B}",
|
|
1430
|
+
triumph: "\u{1F624}",
|
|
1431
|
+
rage: "\u{1F621}",
|
|
1432
|
+
angry: "\u{1F620}",
|
|
1433
|
+
smiling_imp: "\u{1F608}",
|
|
1434
|
+
imp: "\u{1F47F}",
|
|
1435
|
+
skull: "\u{1F480}",
|
|
1436
|
+
clown_face: "\u{1F921}",
|
|
1437
|
+
poop: "\u{1F4A9}",
|
|
1438
|
+
ghost: "\u{1F47B}",
|
|
1439
|
+
alien: "\u{1F47D}",
|
|
1440
|
+
robot: "\u{1F916}",
|
|
1441
|
+
// Gestures / body
|
|
1442
|
+
thumbsup: "\u{1F44D}",
|
|
1443
|
+
"+1": "\u{1F44D}",
|
|
1444
|
+
thumbsdown: "\u{1F44E}",
|
|
1445
|
+
"-1": "\u{1F44E}",
|
|
1446
|
+
punch: "\u{1F44A}",
|
|
1447
|
+
fist: "\u270A",
|
|
1448
|
+
clap: "\u{1F44F}",
|
|
1449
|
+
raised_hands: "\u{1F64C}",
|
|
1450
|
+
open_hands: "\u{1F450}",
|
|
1451
|
+
handshake: "\u{1F91D}",
|
|
1452
|
+
pray: "\u{1F64F}",
|
|
1453
|
+
muscle: "\u{1F4AA}",
|
|
1454
|
+
eyes: "\u{1F440}",
|
|
1455
|
+
wave: "\u{1F44B}",
|
|
1456
|
+
point_up: "\u261D\uFE0F",
|
|
1457
|
+
point_down: "\u{1F447}",
|
|
1458
|
+
point_left: "\u{1F448}",
|
|
1459
|
+
point_right: "\u{1F449}",
|
|
1460
|
+
ok_hand: "\u{1F44C}",
|
|
1461
|
+
v: "\u270C\uFE0F",
|
|
1462
|
+
crossed_fingers: "\u{1F91E}",
|
|
1463
|
+
// Hearts / symbols
|
|
1464
|
+
heart: "\u2764\uFE0F",
|
|
1465
|
+
broken_heart: "\u{1F494}",
|
|
1466
|
+
two_hearts: "\u{1F495}",
|
|
1467
|
+
sparkling_heart: "\u{1F496}",
|
|
1468
|
+
heartpulse: "\u{1F497}",
|
|
1469
|
+
blue_heart: "\u{1F499}",
|
|
1470
|
+
green_heart: "\u{1F49A}",
|
|
1471
|
+
yellow_heart: "\u{1F49B}",
|
|
1472
|
+
orange_heart: "\u{1F9E1}",
|
|
1473
|
+
purple_heart: "\u{1F49C}",
|
|
1474
|
+
black_heart: "\u{1F5A4}",
|
|
1475
|
+
white_heart: "\u{1F90D}",
|
|
1476
|
+
100: "\u{1F4AF}",
|
|
1477
|
+
boom: "\u{1F4A5}",
|
|
1478
|
+
collision: "\u{1F4A5}",
|
|
1479
|
+
dizzy: "\u{1F4AB}",
|
|
1480
|
+
sweat_drops: "\u{1F4A6}",
|
|
1481
|
+
dash: "\u{1F4A8}",
|
|
1482
|
+
zzz: "\u{1F4A4}",
|
|
1483
|
+
fire: "\u{1F525}",
|
|
1484
|
+
sparkles: "\u2728",
|
|
1485
|
+
star: "\u2B50",
|
|
1486
|
+
star2: "\u{1F31F}",
|
|
1487
|
+
tada: "\u{1F389}",
|
|
1488
|
+
confetti_ball: "\u{1F38A}",
|
|
1489
|
+
balloon: "\u{1F388}",
|
|
1490
|
+
gift: "\u{1F381}",
|
|
1491
|
+
rocket: "\u{1F680}",
|
|
1492
|
+
dart: "\u{1F3AF}",
|
|
1493
|
+
trophy: "\u{1F3C6}",
|
|
1494
|
+
warning: "\u26A0\uFE0F",
|
|
1495
|
+
no_entry_sign: "\u{1F6AB}",
|
|
1496
|
+
white_check_mark: "\u2705",
|
|
1497
|
+
x: "\u274C",
|
|
1498
|
+
heavy_check_mark: "\u2714\uFE0F",
|
|
1499
|
+
question: "\u2753",
|
|
1500
|
+
exclamation: "\u2757",
|
|
1501
|
+
bulb: "\u{1F4A1}",
|
|
1502
|
+
bell: "\u{1F514}",
|
|
1503
|
+
// Tech / objects
|
|
1504
|
+
computer: "\u{1F4BB}",
|
|
1505
|
+
iphone: "\u{1F4F1}",
|
|
1506
|
+
link: "\u{1F517}",
|
|
1507
|
+
lock: "\u{1F512}",
|
|
1508
|
+
unlock: "\u{1F513}",
|
|
1509
|
+
key: "\u{1F511}",
|
|
1510
|
+
mag: "\u{1F50D}",
|
|
1511
|
+
bug: "\u{1F41B}",
|
|
1512
|
+
package: "\u{1F4E6}",
|
|
1513
|
+
memo: "\u{1F4DD}",
|
|
1514
|
+
pencil2: "\u270F\uFE0F",
|
|
1515
|
+
book: "\u{1F4D6}",
|
|
1516
|
+
books: "\u{1F4DA}",
|
|
1517
|
+
pushpin: "\u{1F4CC}",
|
|
1518
|
+
paperclip: "\u{1F4CE}",
|
|
1519
|
+
calendar: "\u{1F4C5}",
|
|
1520
|
+
file_folder: "\u{1F4C1}",
|
|
1521
|
+
hammer: "\u{1F528}",
|
|
1522
|
+
wrench: "\u{1F527}",
|
|
1523
|
+
gear: "\u2699\uFE0F",
|
|
1524
|
+
chart_with_upwards_trend: "\u{1F4C8}",
|
|
1525
|
+
chart_with_downwards_trend: "\u{1F4C9}",
|
|
1526
|
+
bar_chart: "\u{1F4CA}",
|
|
1527
|
+
construction: "\u{1F6A7}",
|
|
1528
|
+
hourglass: "\u23F3",
|
|
1529
|
+
stopwatch: "\u23F1\uFE0F",
|
|
1530
|
+
// Food / nature / misc
|
|
1531
|
+
pizza: "\u{1F355}",
|
|
1532
|
+
coffee: "\u2615",
|
|
1533
|
+
beer: "\u{1F37A}",
|
|
1534
|
+
cake: "\u{1F382}",
|
|
1535
|
+
birthday: "\u{1F382}",
|
|
1536
|
+
apple: "\u{1F34E}",
|
|
1537
|
+
rainbow: "\u{1F308}",
|
|
1538
|
+
sun_with_face: "\u{1F31E}",
|
|
1539
|
+
crescent_moon: "\u{1F319}",
|
|
1540
|
+
earth_americas: "\u{1F30E}",
|
|
1541
|
+
dog: "\u{1F436}",
|
|
1542
|
+
cat: "\u{1F431}",
|
|
1543
|
+
fox_face: "\u{1F98A}",
|
|
1544
|
+
bear: "\u{1F43B}",
|
|
1545
|
+
panda_face: "\u{1F43C}",
|
|
1546
|
+
monkey_face: "\u{1F435}",
|
|
1547
|
+
see_no_evil: "\u{1F648}",
|
|
1548
|
+
hear_no_evil: "\u{1F649}",
|
|
1549
|
+
speak_no_evil: "\u{1F64A}"
|
|
1550
|
+
});
|
|
1551
|
+
var EMOJI_RE = /^:([A-Za-z0-9_+-]+):/;
|
|
1552
|
+
var EMOJI_EXTENSIONS = [
|
|
1553
|
+
{
|
|
1554
|
+
name: "emoji",
|
|
1555
|
+
level: "inline",
|
|
1556
|
+
// Without `start()`, marked's plain-text fallback tokenizer (`inlineText`)
|
|
1557
|
+
// never stops at `:` — see `markdown-superscript.ts`'s identical note for
|
|
1558
|
+
// `^`, which applies here verbatim.
|
|
1559
|
+
start(src) {
|
|
1560
|
+
return src.match(/:/)?.index;
|
|
1561
|
+
},
|
|
1562
|
+
tokenizer(src) {
|
|
1563
|
+
const match = EMOJI_RE.exec(src);
|
|
1564
|
+
if (!match) return void 0;
|
|
1565
|
+
const resolved = EMOJI_MAP[match[1]];
|
|
1566
|
+
if (resolved === void 0) return void 0;
|
|
1567
|
+
return {
|
|
1568
|
+
type: "emoji",
|
|
1569
|
+
raw: match[0],
|
|
1570
|
+
text: resolved
|
|
1571
|
+
};
|
|
1572
|
+
},
|
|
1573
|
+
renderer(token) {
|
|
1574
|
+
return token.raw;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
];
|
|
1578
|
+
|
|
1072
1579
|
// src/markdown-footnote.ts
|
|
1073
1580
|
var LABEL = "([^\\]\\s]+)";
|
|
1074
1581
|
var REF_RE = new RegExp(`^\\[\\^${LABEL}\\]`);
|
|
1075
|
-
var
|
|
1582
|
+
var HEADER_RE = new RegExp(`^ {0,3}\\[\\^${LABEL}\\]:[ \\t]*([^\\n]*)\\n?`);
|
|
1583
|
+
function isBlankLine(line) {
|
|
1584
|
+
return /^[ \t]*$/.test(line);
|
|
1585
|
+
}
|
|
1586
|
+
var CONT_LINE_RE = /^(?: {4}| {0,3}\t)/;
|
|
1587
|
+
function consumeContinuation(rest) {
|
|
1588
|
+
let offset = 0;
|
|
1589
|
+
for (; ; ) {
|
|
1590
|
+
let probe = offset;
|
|
1591
|
+
for (; ; ) {
|
|
1592
|
+
const lineEnd2 = rest.indexOf("\n", probe);
|
|
1593
|
+
if (lineEnd2 === -1) return finalize(offset, true);
|
|
1594
|
+
const line2 = rest.slice(probe, lineEnd2);
|
|
1595
|
+
if (!isBlankLine(line2)) break;
|
|
1596
|
+
probe = lineEnd2 + 1;
|
|
1597
|
+
}
|
|
1598
|
+
const lineEnd = rest.indexOf("\n", probe);
|
|
1599
|
+
const lineWithNl = lineEnd === -1 ? rest.slice(probe) : rest.slice(probe, lineEnd + 1);
|
|
1600
|
+
const line = lineEnd === -1 ? rest.slice(probe) : rest.slice(probe, lineEnd);
|
|
1601
|
+
if (!CONT_LINE_RE.test(line)) return finalize(offset, false);
|
|
1602
|
+
offset = probe + lineWithNl.length;
|
|
1603
|
+
if (lineEnd === -1) return finalize(offset, true);
|
|
1604
|
+
}
|
|
1605
|
+
function finalize(end, open) {
|
|
1606
|
+
const committedRaw = rest.slice(0, end);
|
|
1607
|
+
const body = committedRaw.split("\n").map((line) => isBlankLine(line) ? "" : line.replace(CONT_LINE_RE, "")).join("\n");
|
|
1608
|
+
return { raw: committedRaw, body, open };
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1076
1611
|
var FOOTNOTE_EXTENSIONS = [
|
|
1077
1612
|
{
|
|
1078
1613
|
name: "footnoteRef",
|
|
@@ -1096,13 +1631,112 @@ var FOOTNOTE_EXTENSIONS = [
|
|
|
1096
1631
|
name: "footnoteDef",
|
|
1097
1632
|
level: "block",
|
|
1098
1633
|
tokenizer(src) {
|
|
1099
|
-
const
|
|
1634
|
+
const header = HEADER_RE.exec(src);
|
|
1635
|
+
if (!header) return void 0;
|
|
1636
|
+
const rest = src.slice(header[0].length);
|
|
1637
|
+
const cont = consumeContinuation(rest);
|
|
1638
|
+
const tokens = cont.body.trim() ? this.lexer.blockTokens(cont.body, []) : [];
|
|
1639
|
+
return {
|
|
1640
|
+
type: "footnoteDef",
|
|
1641
|
+
raw: header[0] + cont.raw,
|
|
1642
|
+
label: header[1],
|
|
1643
|
+
body: header[2],
|
|
1644
|
+
tokens
|
|
1645
|
+
};
|
|
1646
|
+
},
|
|
1647
|
+
renderer(token) {
|
|
1648
|
+
return token.raw;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
];
|
|
1652
|
+
function footnoteMarker(label) {
|
|
1653
|
+
return `[${label}]`;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// src/markdown-ins-mark.ts
|
|
1657
|
+
var INS_RE = /^\+\+(?!\s)((?:\\[\s\S]|(?!\+\+)[\s\S])+?)(?<!\s)\+\+/;
|
|
1658
|
+
var MARK_RE = /^==(?!\s)((?:\\[\s\S]|(?!==)[\s\S])+?)(?<!\s)==/;
|
|
1659
|
+
var INS_MARK_EXTENSIONS = [
|
|
1660
|
+
{
|
|
1661
|
+
name: "ins",
|
|
1662
|
+
level: "inline",
|
|
1663
|
+
// Without `start()`, marked's plain-text fallback tokenizer (`inlineText`)
|
|
1664
|
+
// never stops at `+` — see `markdown-superscript.ts`'s identical note for
|
|
1665
|
+
// `^`, which applies here verbatim.
|
|
1666
|
+
start(src) {
|
|
1667
|
+
return src.match(/(?<!\\)\+\+(?!\s)/)?.index;
|
|
1668
|
+
},
|
|
1669
|
+
tokenizer(src) {
|
|
1670
|
+
const match = INS_RE.exec(src);
|
|
1100
1671
|
if (match) {
|
|
1101
1672
|
return {
|
|
1102
|
-
type: "
|
|
1673
|
+
type: "ins",
|
|
1103
1674
|
raw: match[0],
|
|
1104
|
-
|
|
1105
|
-
|
|
1675
|
+
// Unescape `\x` -> `x`, the same reason `SUP_RE`'s tokenizer does:
|
|
1676
|
+
// `collectSpans`' `decodeEntities` only resolves HTML entities, not
|
|
1677
|
+
// backslash escapes.
|
|
1678
|
+
text: match[1].replace(/\\(.)/g, "$1")
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
return void 0;
|
|
1682
|
+
},
|
|
1683
|
+
renderer(token) {
|
|
1684
|
+
return token.raw;
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
name: "mark",
|
|
1689
|
+
level: "inline",
|
|
1690
|
+
start(src) {
|
|
1691
|
+
return src.match(/(?<!\\)==(?!\s)/)?.index;
|
|
1692
|
+
},
|
|
1693
|
+
tokenizer(src) {
|
|
1694
|
+
const match = MARK_RE.exec(src);
|
|
1695
|
+
if (match) {
|
|
1696
|
+
return {
|
|
1697
|
+
type: "mark",
|
|
1698
|
+
raw: match[0],
|
|
1699
|
+
text: match[1].replace(/\\(.)/g, "$1")
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
return void 0;
|
|
1703
|
+
},
|
|
1704
|
+
renderer(token) {
|
|
1705
|
+
return token.raw;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
];
|
|
1709
|
+
|
|
1710
|
+
// src/markdown-superscript.ts
|
|
1711
|
+
var SUP_RE = /^\^((?:\\[\s\S]|[^\s^\\])+)\^/;
|
|
1712
|
+
var SUPERSCRIPT_EXTENSIONS = [
|
|
1713
|
+
{
|
|
1714
|
+
name: "sup",
|
|
1715
|
+
level: "inline",
|
|
1716
|
+
// Without `start()`, marked's plain-text fallback tokenizer (`inlineText`)
|
|
1717
|
+
// never stops at `^` — it is not one of the characters its own regex treats
|
|
1718
|
+
// as a boundary, unlike `[` (link) or `` ` `` (codespan) — so it swallows an
|
|
1719
|
+
// entire `19^th^ century` as one `text` token before this extension is ever
|
|
1720
|
+
// tried at the right offset. `inlineMath` hits the identical problem for `$`
|
|
1721
|
+
// and solves it the same way; verified against marked@18.0.7 that inline
|
|
1722
|
+
// `start()` only clips the span handed to `inlineText`, not paragraph
|
|
1723
|
+
// grouping — the hazard `DEC-01KZDGCP` documents is specific to a *block*
|
|
1724
|
+
// `start()` retroactively re-grouping paragraphs, which does not apply here.
|
|
1725
|
+
start(src) {
|
|
1726
|
+
return src.match(/(?<!\\)\^(?!\s)/)?.index;
|
|
1727
|
+
},
|
|
1728
|
+
tokenizer(src) {
|
|
1729
|
+
const match = SUP_RE.exec(src);
|
|
1730
|
+
if (match) {
|
|
1731
|
+
return {
|
|
1732
|
+
type: "sup",
|
|
1733
|
+
raw: match[0],
|
|
1734
|
+
// Unescape `\x` -> `x` for any character (the content regex admits
|
|
1735
|
+
// `\` followed by anything) so `x^a\^b^` carries a literal caret
|
|
1736
|
+
// rather than a visible backslash. `collectSpans`' `decodeEntities`
|
|
1737
|
+
// only handles HTML entities, not backslash escapes, so this token
|
|
1738
|
+
// resolves its own before `text` is set.
|
|
1739
|
+
text: match[1].replace(/\\(.)/g, "$1")
|
|
1106
1740
|
};
|
|
1107
1741
|
}
|
|
1108
1742
|
return void 0;
|
|
@@ -1112,9 +1746,6 @@ var FOOTNOTE_EXTENSIONS = [
|
|
|
1112
1746
|
}
|
|
1113
1747
|
}
|
|
1114
1748
|
];
|
|
1115
|
-
function footnoteMarker(label) {
|
|
1116
|
-
return `[${label}]`;
|
|
1117
|
-
}
|
|
1118
1749
|
|
|
1119
1750
|
// src/markdown-math.ts
|
|
1120
1751
|
var mathConverter = null;
|
|
@@ -1414,30 +2045,59 @@ function expectedImageParagraphChildren(tokens) {
|
|
|
1414
2045
|
function decodeEntities(text) {
|
|
1415
2046
|
return text.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
1416
2047
|
}
|
|
1417
|
-
function
|
|
2048
|
+
function applyTypography(text) {
|
|
2049
|
+
let out = text;
|
|
2050
|
+
out = out.replace(/\(tm\)/gi, "\u2122");
|
|
2051
|
+
out = out.replace(/\(c\)/gi, "\xA9");
|
|
2052
|
+
out = out.replace(/\(r\)/gi, "\xAE");
|
|
2053
|
+
out = out.replace(/---/g, "\u2014");
|
|
2054
|
+
out = out.replace(/--/g, "\u2013");
|
|
2055
|
+
out = out.replace(/\.{3}/g, "\u2026");
|
|
2056
|
+
out = out.replace(/([A-Za-z])'([A-Za-z])/g, "$1\u2019$2");
|
|
2057
|
+
out = out.replace(/"([^"\n]*)"/g, "\u201C$1\u201D");
|
|
2058
|
+
out = out.replace(/'([^'\n]*)'/g, "\u2018$1\u2019");
|
|
2059
|
+
return out;
|
|
2060
|
+
}
|
|
2061
|
+
function decodeProse(text, theme) {
|
|
2062
|
+
const decoded = decodeEntities(text);
|
|
2063
|
+
return theme.typographer ? applyTypography(decoded) : decoded;
|
|
2064
|
+
}
|
|
2065
|
+
var NO_ABBREVIATIONS = /* @__PURE__ */ new Map();
|
|
2066
|
+
function emitProse(text, style, abbr, out) {
|
|
2067
|
+
if (!text) return;
|
|
2068
|
+
if (abbr.size === 0) {
|
|
2069
|
+
out.push({ text, style });
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
const terms = [...abbr.keys()].sort((a, b) => b.length - a.length);
|
|
2073
|
+
const pattern = terms.map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
2074
|
+
const re = new RegExp(`\\b(?:${pattern})\\b`, "g");
|
|
2075
|
+
let last = 0;
|
|
2076
|
+
for (let match = re.exec(text); match !== null; match = re.exec(text)) {
|
|
2077
|
+
if (match.index > last) out.push({ text: text.slice(last, match.index), style });
|
|
2078
|
+
out.push({ text: match[0], style: { ...style, abbrTitle: abbr.get(match[0]) } });
|
|
2079
|
+
last = match.index + match[0].length;
|
|
2080
|
+
}
|
|
2081
|
+
if (last < text.length) out.push({ text: text.slice(last), style });
|
|
2082
|
+
}
|
|
2083
|
+
function collectSpans(tokens, inherited, theme, out, blockFontSize, abbr = NO_ABBREVIATIONS) {
|
|
1418
2084
|
for (const token of tokens) {
|
|
1419
2085
|
switch (token.type) {
|
|
1420
2086
|
case "strong": {
|
|
1421
2087
|
const t = token;
|
|
1422
2088
|
if (t.tokens) {
|
|
1423
|
-
collectSpans(t.tokens, { ...inherited, bold: true }, theme, out, blockFontSize);
|
|
2089
|
+
collectSpans(t.tokens, { ...inherited, bold: true }, theme, out, blockFontSize, abbr);
|
|
1424
2090
|
} else {
|
|
1425
|
-
|
|
1426
|
-
text: decodeEntities(t.text),
|
|
1427
|
-
style: { ...inherited, bold: true }
|
|
1428
|
-
});
|
|
2091
|
+
emitProse(decodeProse(t.text, theme), { ...inherited, bold: true }, abbr, out);
|
|
1429
2092
|
}
|
|
1430
2093
|
break;
|
|
1431
2094
|
}
|
|
1432
2095
|
case "em": {
|
|
1433
2096
|
const t = token;
|
|
1434
2097
|
if (t.tokens) {
|
|
1435
|
-
collectSpans(t.tokens, { ...inherited, italic: true }, theme, out, blockFontSize);
|
|
2098
|
+
collectSpans(t.tokens, { ...inherited, italic: true }, theme, out, blockFontSize, abbr);
|
|
1436
2099
|
} else {
|
|
1437
|
-
|
|
1438
|
-
text: decodeEntities(t.text),
|
|
1439
|
-
style: { ...inherited, italic: true }
|
|
1440
|
-
});
|
|
2100
|
+
emitProse(decodeProse(t.text, theme), { ...inherited, italic: true }, abbr, out);
|
|
1441
2101
|
}
|
|
1442
2102
|
break;
|
|
1443
2103
|
}
|
|
@@ -1445,23 +2105,30 @@ function collectSpans(tokens, inherited, theme, out, blockFontSize) {
|
|
|
1445
2105
|
const t = token;
|
|
1446
2106
|
const isStrikethrough = t.raw?.startsWith("~~") ?? true;
|
|
1447
2107
|
if (!isStrikethrough) {
|
|
1448
|
-
const
|
|
1449
|
-
|
|
2108
|
+
const runSize = inherited.fontSize ?? blockFontSize ?? theme.fontSize;
|
|
2109
|
+
const subStyle = {
|
|
2110
|
+
...inherited,
|
|
2111
|
+
fontSize: runSize * theme.subscriptScale,
|
|
2112
|
+
baselineShift: runSize * theme.subscriptShift
|
|
2113
|
+
};
|
|
1450
2114
|
if (t.tokens) {
|
|
1451
|
-
collectSpans(t.tokens,
|
|
2115
|
+
collectSpans(t.tokens, subStyle, theme, out, blockFontSize, abbr);
|
|
1452
2116
|
} else {
|
|
1453
|
-
|
|
2117
|
+
emitProse(decodeProse(t.text, theme), subStyle, abbr, out);
|
|
1454
2118
|
}
|
|
1455
|
-
out.push({ text: "~", style: plain });
|
|
1456
2119
|
break;
|
|
1457
2120
|
}
|
|
1458
2121
|
if (t.tokens) {
|
|
1459
|
-
collectSpans(
|
|
2122
|
+
collectSpans(
|
|
2123
|
+
t.tokens,
|
|
2124
|
+
{ ...inherited, lineThrough: true },
|
|
2125
|
+
theme,
|
|
2126
|
+
out,
|
|
2127
|
+
blockFontSize,
|
|
2128
|
+
abbr
|
|
2129
|
+
);
|
|
1460
2130
|
} else {
|
|
1461
|
-
|
|
1462
|
-
text: decodeEntities(t.text),
|
|
1463
|
-
style: { ...inherited, lineThrough: true }
|
|
1464
|
-
});
|
|
2131
|
+
emitProse(decodeProse(t.text, theme), { ...inherited, lineThrough: true }, abbr, out);
|
|
1465
2132
|
}
|
|
1466
2133
|
break;
|
|
1467
2134
|
}
|
|
@@ -1561,11 +2228,48 @@ function collectSpans(tokens, inherited, theme, out, blockFontSize) {
|
|
|
1561
2228
|
style: {
|
|
1562
2229
|
...inherited,
|
|
1563
2230
|
fontSize: runSize * theme.footnoteMarkerScale,
|
|
2231
|
+
baselineShift: runSize * theme.superscriptShift,
|
|
1564
2232
|
color: theme.footnoteColor
|
|
1565
2233
|
}
|
|
1566
2234
|
});
|
|
1567
2235
|
break;
|
|
1568
2236
|
}
|
|
2237
|
+
case "sup": {
|
|
2238
|
+
const t = token;
|
|
2239
|
+
const runSize = inherited.fontSize ?? blockFontSize ?? theme.fontSize;
|
|
2240
|
+
emitProse(
|
|
2241
|
+
decodeProse(t.text, theme),
|
|
2242
|
+
{
|
|
2243
|
+
...inherited,
|
|
2244
|
+
fontSize: runSize * theme.superscriptScale,
|
|
2245
|
+
baselineShift: runSize * theme.superscriptShift
|
|
2246
|
+
},
|
|
2247
|
+
abbr,
|
|
2248
|
+
out
|
|
2249
|
+
);
|
|
2250
|
+
break;
|
|
2251
|
+
}
|
|
2252
|
+
case "ins": {
|
|
2253
|
+
const t = token;
|
|
2254
|
+
emitProse(decodeProse(t.text, theme), { ...inherited, underline: true }, abbr, out);
|
|
2255
|
+
break;
|
|
2256
|
+
}
|
|
2257
|
+
case "mark": {
|
|
2258
|
+
const t = token;
|
|
2259
|
+
emitProse(
|
|
2260
|
+
decodeProse(t.text, theme),
|
|
2261
|
+
{ ...inherited, highlightColor: theme.markHighlightColor },
|
|
2262
|
+
abbr,
|
|
2263
|
+
out
|
|
2264
|
+
);
|
|
2265
|
+
break;
|
|
2266
|
+
}
|
|
2267
|
+
case "emoji": {
|
|
2268
|
+
const t = token;
|
|
2269
|
+
const style = Object.keys(inherited).length > 0 ? inherited : void 0;
|
|
2270
|
+
out.push({ text: t.text, style });
|
|
2271
|
+
break;
|
|
2272
|
+
}
|
|
1569
2273
|
case "link": {
|
|
1570
2274
|
const t = token;
|
|
1571
2275
|
const linkStyle = {
|
|
@@ -1573,33 +2277,32 @@ function collectSpans(tokens, inherited, theme, out, blockFontSize) {
|
|
|
1573
2277
|
href: t.href,
|
|
1574
2278
|
color: theme.linkColor
|
|
1575
2279
|
};
|
|
1576
|
-
|
|
1577
|
-
|
|
2280
|
+
const isAutolink = !("title" in t);
|
|
2281
|
+
if (isAutolink) {
|
|
2282
|
+
out.push({ text: t.text, style: linkStyle });
|
|
2283
|
+
} else if (t.tokens && t.tokens.length > 0) {
|
|
2284
|
+
collectSpans(t.tokens, linkStyle, theme, out, blockFontSize, abbr);
|
|
1578
2285
|
} else {
|
|
1579
|
-
|
|
2286
|
+
emitProse(decodeProse(t.text, theme), linkStyle, abbr, out);
|
|
1580
2287
|
}
|
|
1581
2288
|
break;
|
|
1582
2289
|
}
|
|
1583
2290
|
case "text": {
|
|
1584
2291
|
const t = token;
|
|
1585
2292
|
if ("tokens" in t && t.tokens?.length) {
|
|
1586
|
-
collectSpans(t.tokens, inherited, theme, out, blockFontSize);
|
|
2293
|
+
collectSpans(t.tokens, inherited, theme, out, blockFontSize, abbr);
|
|
1587
2294
|
} else {
|
|
1588
|
-
const decoded =
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
out.push({ text: decoded, style });
|
|
1592
|
-
}
|
|
2295
|
+
const decoded = decodeProse(t.text, theme);
|
|
2296
|
+
const style = Object.keys(inherited).length > 0 ? inherited : void 0;
|
|
2297
|
+
emitProse(decoded, style, abbr, out);
|
|
1593
2298
|
}
|
|
1594
2299
|
break;
|
|
1595
2300
|
}
|
|
1596
2301
|
default: {
|
|
1597
2302
|
if ("text" in token) {
|
|
1598
|
-
const decoded =
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
out.push({ text: decoded, style });
|
|
1602
|
-
}
|
|
2303
|
+
const decoded = decodeProse(token.text, theme);
|
|
2304
|
+
const style = Object.keys(inherited).length > 0 ? inherited : void 0;
|
|
2305
|
+
emitProse(decoded, style, abbr, out);
|
|
1603
2306
|
}
|
|
1604
2307
|
break;
|
|
1605
2308
|
}
|
|
@@ -1633,10 +2336,10 @@ function findUnclosedInline(text) {
|
|
|
1633
2336
|
}
|
|
1634
2337
|
return best;
|
|
1635
2338
|
}
|
|
1636
|
-
function renderInlineToRichText(tokens, fallbackText, font, color, maxWidth, theme, selectable, onLinkClick) {
|
|
2339
|
+
function renderInlineToRichText(tokens, fallbackText, font, color, maxWidth, theme, selectable, onLinkClick, abbr = NO_ABBREVIATIONS) {
|
|
1637
2340
|
const spans = [];
|
|
1638
2341
|
if (tokens && tokens.length > 0) {
|
|
1639
|
-
collectSpans(tokens, {}, theme, spans, fontSizeFromFont(font));
|
|
2342
|
+
collectSpans(tokens, {}, theme, spans, fontSizeFromFont(font), abbr);
|
|
1640
2343
|
}
|
|
1641
2344
|
if (spans.length === 0) {
|
|
1642
2345
|
spans.push({ text: decodeEntities(fallbackText) });
|
|
@@ -1651,6 +2354,53 @@ function renderInlineToRichText(tokens, fallbackText, font, color, maxWidth, the
|
|
|
1651
2354
|
});
|
|
1652
2355
|
}
|
|
1653
2356
|
|
|
2357
|
+
// src/markdown-fenced-registry.ts
|
|
2358
|
+
var renderers = /* @__PURE__ */ new Map();
|
|
2359
|
+
function registerFencedBlockRenderer(lang, spec) {
|
|
2360
|
+
const key = lang.toLowerCase();
|
|
2361
|
+
renderers.set(key, {
|
|
2362
|
+
spec,
|
|
2363
|
+
renderer: null,
|
|
2364
|
+
loadPromise: null
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
function unregisterFencedBlockRenderer(lang) {
|
|
2368
|
+
const key = lang.toLowerCase();
|
|
2369
|
+
renderers.delete(key);
|
|
2370
|
+
}
|
|
2371
|
+
function hasFencedBlockRenderer(lang) {
|
|
2372
|
+
const key = lang.toLowerCase();
|
|
2373
|
+
return renderers.has(key);
|
|
2374
|
+
}
|
|
2375
|
+
function isFencedBlockRendererReady(lang) {
|
|
2376
|
+
const key = lang.toLowerCase();
|
|
2377
|
+
const state = renderers.get(key);
|
|
2378
|
+
return state?.renderer !== null && state?.renderer !== void 0;
|
|
2379
|
+
}
|
|
2380
|
+
function ensureFencedBlockRenderer(lang) {
|
|
2381
|
+
const key = lang.toLowerCase();
|
|
2382
|
+
const state = renderers.get(key);
|
|
2383
|
+
if (!state) return Promise.resolve();
|
|
2384
|
+
if (state.renderer !== null) return Promise.resolve();
|
|
2385
|
+
if (state.loadPromise) return state.loadPromise;
|
|
2386
|
+
state.loadPromise = (async () => {
|
|
2387
|
+
try {
|
|
2388
|
+
const loaded = await state.spec.load();
|
|
2389
|
+
state.renderer = loaded;
|
|
2390
|
+
} catch (e) {
|
|
2391
|
+
console.error(`Fenced block renderer for "${lang}" failed to load`, e);
|
|
2392
|
+
state.renderer = null;
|
|
2393
|
+
}
|
|
2394
|
+
})();
|
|
2395
|
+
return state.loadPromise;
|
|
2396
|
+
}
|
|
2397
|
+
function renderFencedBlock(source, lang, options) {
|
|
2398
|
+
const key = lang.toLowerCase();
|
|
2399
|
+
const state = renderers.get(key);
|
|
2400
|
+
if (!state || !state.renderer) return null;
|
|
2401
|
+
return state.renderer(source, lang, options);
|
|
2402
|
+
}
|
|
2403
|
+
|
|
1654
2404
|
// src/Markdown.ts
|
|
1655
2405
|
var import_ui4 = require("@vectojs/ui");
|
|
1656
2406
|
|
|
@@ -1899,7 +2649,7 @@ function tableContentOf(token) {
|
|
|
1899
2649
|
}
|
|
1900
2650
|
|
|
1901
2651
|
// src/frontMatter.ts
|
|
1902
|
-
var
|
|
2652
|
+
var OPEN_RE2 = /^---[ \t]*\r?\n/;
|
|
1903
2653
|
var OPENER_PREFIX_RE = /^(?:-|--|---[ \t]*\r?)$/;
|
|
1904
2654
|
var KEY_RE = /^[^\s:#][^:]*:(?:[ \t].*)?$/;
|
|
1905
2655
|
var CLOSE_RE = /^(?:---|\.\.\.)[ \t]*$/;
|
|
@@ -1908,7 +2658,7 @@ var NONE = { kind: "none" };
|
|
|
1908
2658
|
var PENDING = { kind: "pending" };
|
|
1909
2659
|
function scanFrontMatter(text, complete) {
|
|
1910
2660
|
if (text.length === 0) return PENDING;
|
|
1911
|
-
const open =
|
|
2661
|
+
const open = OPEN_RE2.exec(text);
|
|
1912
2662
|
if (!open) {
|
|
1913
2663
|
return !complete && OPENER_PREFIX_RE.test(text) ? PENDING : NONE;
|
|
1914
2664
|
}
|
|
@@ -1960,10 +2710,17 @@ function unquote(value) {
|
|
|
1960
2710
|
}
|
|
1961
2711
|
|
|
1962
2712
|
// src/MarkdownWorkerSource.ts
|
|
1963
|
-
var WORKER_SOURCE_STRING = '"use strict";(()=>{function V(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _=V();function ke(t){_=t}var C={exec:()=>null};function E(t){let e=[];return n=>{let s=Math.max(0,Math.min(3,n-1)),r=e[s];return r||(r=t(s),e[s]=r),r}}function k(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(x.caret,"$1"),n=n.replace(r,a),s},getRegex:()=>new RegExp(n,e)};return s}var Pe=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {1,4}| {0,3}\\t)/gm,outputLinkReplace:/\\\\([\\[\\]])/g,indentCodeCompensation:/^(\\s+)(?:```)/,beginningSpace:/^\\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\\n/g,tabCharGlobal:/\\t/g,multipleSpaceGlobal:/\\s+/g,blankLine:/^[ \\t]*$/,doubleBlankLine:/\\n[ \\t]*\\n[ \\t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^\'"]*[^\\s])\\s+([\'"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,escapeTest:/[&<>"\']/,escapeReplace:/[&<>"\']/g,escapeTestNoEncode:/[<>"\']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>"\']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\\\n]*)?(?:\\\\n|$))`),nextBulletRegex:E(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))`)),hrRegex:E(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)`)),fencesBeginRegex:E(t=>new RegExp(`^ {0,${t}}(?:\\`\\`\\`|~~~)`)),headingBeginRegex:E(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:E(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:E(t=>new RegExp(`^ {0,${t}}>`))},Me=/^(?:[ \\t]*(?:\\n|$))+/,Be=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/,qe=/^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/,v=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/,ve=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/,K=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/,fe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,de=k(fe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,"").getRegex(),De=k(fe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex(),J=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \\t]+\\n)[^\\n]+)*)/,Oe=/^[^\\n]+/,Y=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/,Ze=k(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace("label",Y).replace("title",/(?:"(?:\\\\"?|[^"\\\\])*"|\'[^\'\\n]*(?:\\n[^\'\\n]+)*\\n?\'|\\([^()]*\\))/).getRegex(),Ne=k(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,K).getRegex(),Q="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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\\s\\S]*?(?:-->|$))/,Qe=k("^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n*|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>[^\\\\n]*\\\\n*|$)|<![A-Z][\\\\s\\\\S]*?(?:>[^\\\\n]*\\\\n*|$)|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>[^\\\\n]*\\\\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|$))","i").replace("comment",ee).replace("tag",Q).replace("attribute",/ +[a-zA-Z:_][\\w.:-]*(?: *= *"[^"\\n]*"| *= *\'[^\'\\n]*\'| *= *[^\\s"\'=<>`]+)?/).getRegex(),xe=t=>k(J).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list",t).replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),Fe=xe(/ {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]/),He=xe(/ {0,3}(?:[*+-]|\\d{1,9}[.)])(?:[ \\t]|\\n|$)/),je=k(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/).replace("paragraph",He).getRegex(),te={blockquote:je,code:Be,def:Ze,fences:qe,heading:ve,hr:v,html:Qe,lheading:de,list:Ne,newline:Me,paragraph:Fe,table:C,text:Oe},ae=k("^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)").replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]").replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex(),Ge={...te,lheading:De,table:ae,paragraph:k(J).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("table",ae).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Q).getRegex()},We={...te,html:k(`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)|<tag(?:"[^"]*"|\'[^\']*\'|\\\\s[^\'"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))`).replace("comment",ee).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(),def:/^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +(["(][^\\n]+[")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:C,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:k(J).replace("hr",v).replace("heading",` *#{1,6} *[^\n]`).replace("lheading",de).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xe=/^\\\\([!"#$%&\'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/,Ue=/^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/,be=/^( {2,}|\\\\)\\n(?!\\s*$)/,Ve=/^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/,P=/[\\p{P}\\p{S}]/u,F=/[\\s\\p{P}\\p{S}]/u,ne=/[^\\s\\p{P}\\p{S}]/u,Ke=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,F).getRegex(),me=/(?!~)[\\p{P}\\p{S}]/u,Je=/(?!~)[\\s\\p{P}\\p{S}]/u,Ye=/(?:[^\\s\\p{P}\\p{S}]|~)/u,et=k(/link|precode-code|html/,"g").replace("link",/\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",Pe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),we=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/,tt=k(we,"u").replace(/punct/g,P).getRegex(),nt=k(we,"u").replace(/punct/g,me).getRegex(),ye="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)",rt=k(ye,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),st=k(ye,"gu").replace(/notPunctSpace/g,Ye).replace(/punctSpace/g,Je).replace(/punct/g,me).getRegex(),it=k("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),lt=k(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,P).getRegex(),at="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ot=k(at,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,F).replace(/punct/g,P).getRegex(),ct=k(/\\\\(punct)/,"gu").replace(/punct/g,P).getRegex(),ht=k(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),ut=k(ee).replace("(?:-->|$)","-->").getRegex(),pt=k("^comment|^</[a-zA-Z][\\\\w:-]*\\\\s*>|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>").replace("comment",ut).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*\'[^\']*\'|\\s*=\\s*[^\\s"\'=<>`]+)?/).getRegex(),O=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\])|[^\\[\\]\\\\`])*?/,gt=k(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",O).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]+|(?=\\))/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|\'(?:\\\\\'?|[^\'\\\\])*\'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex(),Re=k(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",O).replace("ref",Y).getRegex(),$e=k(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",Y).getRegex(),kt=k("reflink|nolink(?!\\\\()","g").replace("reflink",Re).replace("nolink",$e).getRegex(),oe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,re={_backpedal:C,anyPunctuation:ct,autolink:ht,blockSkip:et,br:be,code:Ue,del:C,delLDelim:C,delRDelim:C,emStrongLDelim:tt,emStrongRDelimAst:rt,emStrongRDelimUnd:it,escape:Xe,link:gt,nolink:$e,punctuation:Ke,reflink:Re,reflinkSearch:kt,tag:pt,text:Ve,url:C},ft={...re,link:k(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",O).getRegex(),reflink:k(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",O).getRegex()},W={...re,emStrongRDelimAst:st,emStrongLDelim:nt,delLDelim:lt,delRDelim:ot,url:k(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",oe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_\'"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_\'"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-]+@)))/).replace("protocol",oe).getRegex()},dt={...W,br:k(be).replace("{2,}","*").getRegex(),text:k(W.text).replace("\\\\b_","\\\\b_| {2,}\\\\n").replace(/\\{2,\\}/g,"*").getRegex()},D={normal:te,gfm:Ge,pedantic:We},B={normal:re,gfm:W,breaks:dt,pedantic:ft},xt={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},ce=t=>xt[t];function S(t,e){if(e){if(x.escapeTest.test(t))return t.replace(x.escapeReplace,ce)}else if(x.escapeTestNoEncode.test(t))return t.replace(x.escapeReplaceNoEncode,ce);return t}function he(t){try{t=encodeURI(t).replace(x.percentDecode,"%")}catch{return null}return t}function ue(t,e){let n=t.replace(x.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\\\";)o=!o;return o?"|":" |"}),s=n.split(x.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(x.slashPipe,"|");return s}function z(t,e,n){let s=t.length;if(s===0)return"";let r=0;for(;r<s;){let i=t.charAt(s-r-1);if(i===e&&!n)r++;else if(i!==e&&n)r++;else break}return t.slice(0,s-r)}function pe(t){let e=t.split(`\n`),n=e.length-1;for(;n>=0&&x.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`\n`)}function bt(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}function mt(t,e=0){let n=e,s="";for(let r of t)if(r===" "){let i=4-n%4;s+=" ".repeat(i),n+=i}else s+=r,n++;return s}function ge(t,e,n,s,r){let i=e.href,a=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}function wt(t,e,n){let s=t.match(n.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`\n`).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=r.length?i.slice(r.length):i}).join(`\n`)}var Z=class{options;rules;lexer;constructor(t){this.options=t||_}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=this.options.pedantic?e[0]:pe(e[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],s=wt(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let s=z(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:z(e[0],`\n`),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:z(e[0],`\n`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=z(e[0],`\n`).split(`\n`),s="",r="",i=[];for(;n.length>0;){let a=!1,l=[],o;for(o=0;o<n.length;o++)if(this.rules.other.blockquoteStart.test(n[o]))l.push(n[o]),a=!0;else if(!a)l.push(n[o]);else break;n=n.slice(o);let c=l.join(`\n`),u=c.replace(this.rules.other.blockquoteSetextReplace,`\n $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}\n${c}`:c,r=r?`${r}\n${u}`:u;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,n.length===0)break;let p=i.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let d=p,f=d.raw+`\n`+n.join(`\n`),m=this.blockquote(f);i[i.length-1]=m,s=s.substring(0,s.length-d.raw.length)+m.raw,r=r.substring(0,r.length-d.text.length)+m.text;break}else if(p?.type==="list"){let d=p,f=d.raw+`\n`+n.join(`\n`),m=this.list(f);i[i.length-1]=m,s=s.substring(0,s.length-p.raw.length)+m.raw,r=r.substring(0,r.length-d.raw.length)+m.raw,n=f.substring(i.at(-1).raw.length).split(`\n`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\\\d{1,9}\\\\${n.slice(-1)}`:`\\\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;t;){let o=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=mt(e[2].split(`\n`,1)[0],e[1].length),p=t.split(`\n`,1)[0],d=!h.trim(),f=0;if(this.options.pedantic?(f=2,u=h.trimStart()):d?f=e[1].length+1:(f=h.search(this.rules.other.nonSpaceChar),f=f>4?1:f,u=h.slice(f),f+=e[1].length),d&&this.rules.other.blankLine.test(p)&&(c+=p+`\n`,t=t.substring(p.length+1),o=!0),!o){let m=this.rules.other.nextBulletRegex(f),w=this.rules.other.hrRegex(f),y=this.rules.other.fencesBeginRegex(f),L=this.rules.other.headingBeginRegex(f),G=this.rules.other.htmlBeginRegex(f),A=this.rules.other.blockquoteBeginRegex(f);for(;t;){let b=t.split(`\n`,1)[0],T;if(p=b,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),T=p):T=p.replace(this.rules.other.tabCharGlobal," "),y.test(p)||L.test(p)||G.test(p)||A.test(p)||m.test(p)||w.test(p))break;if(T.search(this.rules.other.nonSpaceChar)>=f||!p.trim())u+=`\n`+T.slice(f);else{if(d||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(h)||L.test(h)||w.test(h))break;u+=`\n`+p}d=!p.trim(),c+=b+`\n`,t=t.substring(b.length+1),h=T.slice(f)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),r.raw+=c}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let o of r.items){this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]);let c=o.tokens[0];if(o.task&&(c?.type==="text"||c?.type==="paragraph")){o.text=o.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(o.raw);if(u){let h={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};o.checked=h.checked,r.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=h.raw+o.tokens[0].raw,o.tokens[0].text=h.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(h)):o.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):o.tokens.unshift(h)}}else o.task&&(o.task=!1);if(!r.loose){let u=o.tokens.filter(p=>p.type==="space"),h=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));r.loose=h}}if(r.loose)for(let o of r.items){o.loose=!0;for(let c of o.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=pe(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:z(e[0],`\n`),href:s,title:r}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=ue(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`\n`):[],i={type:"table",raw:z(e[0],`\n`),header:[],align:[],rows:[]};if(n.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(ue(a,i.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[o]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:z(e[0],`\n`),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`\n`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=z(n.slice(0,-1),"\\\\");if((n.length-i.length)%2===0)return}else{let i=bt(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),ge(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return ge(n,r,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,a,l=r,o=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+r);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){o+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+o);let u=[...s[0]][0].length,h=t.slice(0,r+s.index+u+a);if(Math.min(r,a)%2){let d=h.slice(1,-1);return{type:"em",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}let p=h.slice(2,-2);return{type:"strong",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let s=this.rules.inline.delLDelim.exec(t);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,a,l=r,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*t.length+r);(s=o.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==r))continue;if(s[3]||s[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let c=[...s[0]][0].length,u=t.slice(0,r+s.index+c+a),h=u.slice(r,-r);return{type:"del",raw:u,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,s;return e[2]==="@"?(n=e[1],s="mailto:"+n):(n=e[1],s=n),{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},R=class X{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_,this.options.tokenizer=this.options.tokenizer||new Z,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:x,block:D.normal,inline:B.normal};this.options.pedantic?(n.block=D.pedantic,n.inline=B.pedantic):this.options.gfm&&(n.block=D.gfm,this.options.breaks?n.inline=B.breaks:n.inline=B.gfm),this.tokenizer.rules=n}static get rules(){return{block:D,inline:B}}static lex(e,n){return new X(n).lex(e)}static lexInline(e,n){return new X(n).inlineTokens(e)}lex(e){e=e.replace(x.carriageReturn,`\n`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(l=>(i=l.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let l=n.at(-1);i.raw.length===1&&l!==void 0?l.raw+=`\n`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,o=e.slice(1),c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},o),typeof c=="number"&&c>=0&&(l=Math.min(l,c))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let l=n.at(-1);s&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i),s=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let l=Object.keys(this.tokens.links);l.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,o=>l.includes(o.slice(o.lastIndexOf("[")+1,-1))?"["+"a".repeat(o.length-2)+"]":o))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),s=s.replace(this.tokenizer.rules.inline.blockSkip,(l,o,c)=>{let u=c?c.length:0;return l.slice(0,u)+"["+"a".repeat(l.length-u-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,i="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=""),r=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=n.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,s,i)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e,s,i)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let o=e;if(this.options.extensions?.startInline){let c=1/0,u=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(o)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(i=l.raw.slice(-1)),r=!0;let c=n.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},N=class{options;parser;constructor(t){this.options=t||_}space(t){return""}code({text:t,lang:e,escaped:n}){let s=(e||"").match(x.notSpaceStart)?.[0],r=t.replace(x.endingNewline,"")+`\n`;return s?\'<pre><code class="language-\'+S(s)+\'">\'+(n?r:S(r,!0))+`</code></pre>\n`:"<pre><code>"+(n?r:S(r,!0))+`</code></pre>\n`}blockquote({tokens:t}){return`<blockquote>\n${this.parser.parse(t)}</blockquote>\n`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>\n`}hr(t){return`<hr>\n`}list(t){let e=t.ordered,n=t.start,s="";for(let a=0;a<t.items.length;a++){let l=t.items[a];s+=this.listitem(l)}let r=e?"ol":"ul",i=e&&n!==1?\' start="\'+n+\'"\':"";return"<"+r+i+`>\n`+s+"</"+r+`>\n`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>\n`}checkbox({checked:t}){return"<input "+(t?\'checked="" \':"")+\'disabled="" type="checkbox"> \'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>\n`}table(t){let e="",n="";for(let r=0;r<t.header.length;r++)n+=this.tablecell(t.header[r]);e+=this.tablerow({text:n});let s="";for(let r=0;r<t.rows.length;r++){let i=t.rows[r];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>\n<thead>\n`+e+`</thead>\n`+s+`</table>\n`}tablerow({text:t}){return`<tr>\n${t}</tr>\n`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${S(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),r=he(t);if(r===null)return s;t=r;let i=\'<a href="\'+t+\'"\';return e&&(i+=\' title="\'+S(e)+\'"\'),i+=">"+s+"</a>",i}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=he(t);if(r===null)return S(n);t=r;let i=`<img src="${t}" alt="${S(n)}"`;return e&&(i+=` title="${S(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:S(t.text)}},se=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},$=class U{options;renderer;textRenderer;constructor(e){this.options=e||_,this.options.renderer=this.options.renderer||new N,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new se}static parse(e,n){return new U(n).parse(e)}static parseInline(e,n){return new U(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let a=r,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=l||"";continue}}let i=r;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let a=\'Token with "\'+i.type+\'" type was not found.\';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=l||"";continue}}let a=i;switch(a.type){case"escape":{s+=n.text(a);break}case"html":{s+=n.html(a);break}case"link":{s+=n.link(a);break}case"image":{s+=n.image(a);break}case"checkbox":{s+=n.checkbox(a);break}case"strong":{s+=n.strong(a);break}case"em":{s+=n.em(a);break}case"codespan":{s+=n.codespan(a);break}case"br":{s+=n.br(a);break}case"del":{s+=n.del(a);break}case"text":{s+=n.text(a);break}default:{let l=\'Token with "\'+a.type+\'" type was not found.\';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},q=class{options;block;constructor(t){this.options=t||_}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?R.lex:R.lexInline}provideParser(t=this.block){return t?$.parse:$.parseInline}},yt=class{defaults=V();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$;Renderer=N;TextRenderer=se;Lexer=R;Tokenizer=Z;Hooks=q;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let a of i)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let a=r[i].flat(1/0);n=n.concat(this.walkTokens(a,e))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...a){let l=r.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be \'block\' or \'inline\'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),n.renderer){let r=this.defaults.renderer||new N(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer \'${i}\' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=n.renderer[a],o=r[a];r[a]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=o.apply(r,c)),u||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Z(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer \'${i}\' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=n.tokenizer[a],o=r[a];r[a]=(...c)=>{let u=l.apply(r,c);return u===!1&&(u=o.apply(r,c)),u}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new q;for(let i in n.hooks){if(!(i in r))throw new Error(`hook \'${i}\' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=n.hooks[a],o=r[a];q.passThroughHooks.has(i)?r[a]=c=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await l.call(r,c);return o.call(r,h)})();let u=l.call(r,c);return o.call(r,u)}:r[a]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(r,c);return h===!1&&(h=await o.apply(r,c)),h})();let u=l.apply(r,c);return u===!1&&(u=o.apply(r,c)),u}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),r&&(l=l.concat(r.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return R.lex(t,e??this.defaults)}parser(t,e){return $.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(e):e,l=await(r.hooks?await r.hooks.provideLexer(t):t?R.lex:R.lexInline)(a,r),o=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(o,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(t):t?$.parse:$.parseInline)(o,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer(t):t?R.lex:R.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let l=(r.hooks?r.hooks.provideParser(t):t?$.parse:$.parseInline)(a,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(t,e){return n=>{if(n.message+=`\nPlease report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+S(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},I=new yt;function g(t,e){return I.parse(t,e)}g.options=g.setOptions=function(t){return I.setOptions(t),g.defaults=I.defaults,ke(g.defaults),g};g.getDefaults=V;g.defaults=_;g.use=function(...t){return I.use(...t),g.defaults=I.defaults,ke(g.defaults),g};g.walkTokens=function(t,e){return I.walkTokens(t,e)};g.parseInline=I.parseInline;g.Parser=$;g.parser=$.parse;g.Renderer=N;g.TextRenderer=se;g.Lexer=R;g.lexer=R.lex;g.Tokenizer=Z;g.Hooks=q;g.parse=g;var _t=g.options,Et=g.setOptions,Pt=g.use,Mt=g.walkTokens,Bt=g.parseInline;var qt=$.parse,vt=R.lex;function Se(t,e,n){let s=0;for(let r=e;r<n;r++)s+=t[r].raw.length;return s}function Rt(t,e){let n=t;return n.links=e,n}var $t=/^ {0,3}\\$\\$/m;function Le(t){return t.includes("$$")===!1?!1:$t.test(t)}function Tt(t,e){return t[e-2]?.type!=="list"?!0:e+1<t.length}function ze(t,e){for(let n=t.length-2;n>=e;n--)if(t[n].type==="space"&&Tt(t,n+1)!==!1)return n+1;return-1}function Ae(t){let e=t.links;if(!e)return!1;for(let n in e)return!0;return!1}function Ce(t,e,n,s,r){let i=r;for(let a=e;a<n;a++){let l=t[a].raw;if(s.startsWith(l,i)===!1)return!1;i+=l.length}return!0}function j(t,e,n){return{source:t,tail:t,tokens:e,stableCount:0,stableOffset:0,degraded:!0,degradedReason:n}}function Te(t,e){return{source:t,tail:t,tokens:e,stableCount:0,stableOffset:0,degraded:!1,degradedReason:null}}function St(t,e){if(Ae(e))return j(t,e,"link-definition");if(t.includes("\\r"))return j(t,e,"carriage-return");if(Le(t))return j(t,e,"block-math");let n=ze(e,1);if(n<0||Ce(e,0,n,t,0)===!1)return Te(t,e);let s=Se(e,0,n);return{source:t,tail:t.slice(s),tokens:e,stableCount:n,stableOffset:s,degraded:!1,degradedReason:null}}function ie(t){let e=g.lexer(t);return{tokens:e,cache:St(t,e),charsLexed:t.length,reusedTokens:0}}function H(t,e){let n=g.lexer(t);return{tokens:n,cache:j(t,n,e),charsLexed:t.length,reusedTokens:0}}function Ie(t,e){let n=t.source+e;if(t.degraded)return H(n,t.degradedReason??"link-definition");if(e.includes("\\r"))return H(n,"carriage-return");if(t.stableCount===0)return ie(n);let s=t.tail+e;if(Le(s))return H(n,"block-math");let r=g.lexer(s);if(Ae(r))return H(n,"link-definition");let i=t.tokens.slice(0,t.stableCount),a=Rt([...i,...r],r.links),l=t.stableCount,o=t.stableOffset,c=s,u=ze(a,t.stableCount+1);if(u>t.stableCount&&Ce(a,t.stableCount,u,s,0)){let h=Se(a,t.stableCount,u);l=u,o=t.stableOffset+h,c=s.slice(h)}return{tokens:a,cache:{source:n,tail:c,tokens:a,stableCount:l,stableOffset:o,degraded:!1,degradedReason:null},charsLexed:s.length,reusedTokens:t.stableCount}}var _e="([^\\\\]\\\\s]+)",Lt=new RegExp(`^\\\\[\\\\^${_e}\\\\]`),zt=new RegExp(`^ {0,3}\\\\[\\\\^${_e}\\\\]:[ \\\\t]*([^\\\\n]*)(?:\\\\n|$)`),Ee=[{name:"footnoteRef",level:"inline",tokenizer(t){let e=Lt.exec(t);if(e)return{type:"footnoteRef",raw:e[0],label:e[1]}},renderer(t){return t.raw}},{name:"footnoteDef",level:"block",tokenizer(t){let e=zt.exec(t);if(e)return{type:"footnoteDef",raw:e[0],label:e[1],body:e[2]}},renderer(t){return t.raw}}];var At=0;function Ct(t){if(typeof t!="string"||typeof performance.mark!="function"||typeof performance.measure!="function")return null;let e=At++,n={name:t,startMark:`${t}:start:${e}`,endMark:`${t}:end:${e}`};try{return performance.mark(n.startMark),n}catch{return null}}function It(t){if(t)try{performance.mark(t.endMark),performance.measure(t.name,t.startMark,t.endMark)}catch{}finally{try{performance.clearMarks?.(t.startMark),performance.clearMarks?.(t.endMark)}catch{}}}g.use({extensions:[...Ee,{name:"blockMath",level:"block",start(t){return t.match(/^ {0,3}\\$\\$/m)?.index},tokenizer(t){let e=/^ {0,3}\\$\\$([\\s\\S]+?)\\$\\$[ \\t]*(?:\\n|$)/.exec(t);if(e)return{type:"blockMath",raw:e[0],text:e[1].trim()}},renderer(t){return t.raw}},{name:"inlineMath",level:"inline",start(t){return t.match(/(?<![\\\\$])\\$(?![$\\s])/)?.index},tokenizer(t){let e=/^\\$(?![$\\s\\d])((?:\\\\\\$|[^$\\n])*?)(?<!\\s)\\$(?!\\d)/.exec(t);if(e)return{type:"inlineMath",raw:e[0],text:e[1].trim()}},renderer(t){return t.raw}}]});var M=new Map;self.onmessage=t=>{let e=t.data;if(typeof e!="object"||e===null)return;let{id:n,text:s,append:r,expectedLength:i,oldRaws:a,instance:l,baseVersion:o,dispose:c,userTimingName:u}=e;if(c===!0){typeof l=="string"&&M.delete(l);return}let h=typeof l=="string"?l:null,p=typeof o=="number"?o:null,d,f=null,m=null;if(typeof r=="string"){if(h===null||p===null){self.postMessage({id:n,needResync:!0});return}let w=M.get(h);if(!w||w.version!==p){self.postMessage({id:n,needResync:!0});return}if(typeof i=="number"&&w.lex.source.length+r.length!==i){M.delete(h),self.postMessage({id:n,needResync:!0});return}let y=w.lex;d=()=>Ie(y,r),m=y.tokens}else if(typeof s=="string"){let w=s;if(d=()=>ie(w),Array.isArray(a))f=a;else if(h!==null&&p!==null){let y=M.get(h);if(y&&y.version===p)m=y.lex.tokens;else{self.postMessage({id:n,needResync:!0});return}}}else return;try{let w=typeof u=="string"?Ct(u):null,y=performance.now(),L;try{L=d()}finally{w&&It(w)}let G=performance.now()-y,A=L.tokens,b=0;if(f!==null){let T=Math.min(f.length,A.length);for(;b<T&&f[b]===A[b].raw;b++);}else if(m!==null){let T=m,le=Math.min(T.length,A.length);for(b=Math.min(L.reusedTokens,le);b<le&&T[b].raw===A[b].raw;b++);}h!==null&&p!==null&&M.set(h,{version:p+1,lex:L.cache}),self.postMessage({id:n,matchLen:b,tail:A.slice(b),lexerMs:G,sourceCharsLexed:L.charsLexed})}catch(w){h!==null&&M.delete(h),self.postMessage({id:n,error:String(w)})}};})();\n';
|
|
2713
|
+
var WORKER_SOURCE_STRING = '"use strict";(()=>{function J(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=J();function ke(t){I=t}var A={exec:()=>null};function C(t){let e=[];return n=>{let s=Math.max(0,Math.min(3,n-1)),r=e[s];return r||(r=t(s),e[s]=r),r}}function g(t,e=""){let n=typeof t=="string"?t:t.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(x.caret,"$1"),n=n.replace(r,a),s},getRegex:()=>new RegExp(n,e)};return s}var Xe=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {1,4}| {0,3}\\t)/gm,outputLinkReplace:/\\\\([\\[\\]])/g,indentCodeCompensation:/^(\\s+)(?:```)/,beginningSpace:/^\\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\\n/g,tabCharGlobal:/\\t/g,multipleSpaceGlobal:/\\s+/g,blankLine:/^[ \\t]*$/,doubleBlankLine:/\\n[ \\t]*\\n[ \\t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \\t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\\[[ xX]\\] +\\S/,listReplaceTask:/^\\[[ xX]\\] +/,listTaskCheckbox:/\\[[ xX]\\]/,anyLine:/\\n.*\\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\\||\\| *$/g,tableRowBlankLine:/\\n[ \\t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\\s|>)/i,endPreScriptTag:/^<\\/(pre|code|kbd|script)(\\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^\'"]*[^\\s])\\s+([\'"])(.*)\\2/,unicodeAlphaNumeric:/[\\p{L}\\p{N}]/u,escapeTest:/[&<>"\']/,escapeReplace:/[&<>"\']/g,escapeTestNoEncode:/[<>"\']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/,escapeReplaceNoEncode:/[<>"\']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/g,caret:/(^|[^\\[])\\^/g,percentDecode:/%25/g,findPipe:/\\|/g,splitPipe:/ \\|/,slashPipe:/\\\\\\|/g,carriageReturn:/\\r\\n|\\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\\S*/,endingNewline:/\\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\\\n]*)?(?:\\\\n|$))`),nextBulletRegex:C(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ ][^\\\\n]*)?(?:\\\\n|$))`)),hrRegex:C(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)`)),fencesBeginRegex:C(t=>new RegExp(`^ {0,${t}}(?:\\`\\`\\`|~~~)`)),headingBeginRegex:C(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:C(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:C(t=>new RegExp(`^ {0,${t}}>`))},Qe=/^(?:[ \\t]*(?:\\n|$))+/,He=/^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/,We=/^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/,v=/^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/,Ge=/^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/,K=/ {0,3}(?:[*+-]|\\d{1,9}[.)])/,xe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,be=g(xe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/\\|table/g,"").getRegex(),Ue=g(xe).replace(/bull/g,K).replace(/blockCode/g,/(?: {4}| {0,3}\\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\\s|$)/).replace(/html/g,/ {0,3}<[^\\n>]+>\\n/).replace(/table/g,/ {0,3}\\|?(?:[:\\- ]*\\|)+[\\:\\- ]*\\n/).getRegex(),V=/^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \\t]+\\n)[^\\n]+)*)/,Je=/^[^\\n]+/,Y=/(?!\\s*\\])(?:\\\\[\\s\\S]|[^\\[\\]\\\\])+/,Ke=g(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/).replace("label",Y).replace("title",/(?:"(?:\\\\"?|[^"\\\\])*"|\'[^\'\\n]*(?:\\n[^\'\\n]+)*\\n?\'|\\([^()]*\\))/).getRegex(),Ve=g(/^(bull)([ \\t][^\\n]*?)?(?:\\n|$)/).replace(/bull/g,K).getRegex(),X="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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ee=/<!--(?:-?>|[\\s\\S]*?(?:-->|$))/,Ye=g("^ {0,3}(?:<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n*|$)|comment[^\\\\n]*(\\\\n+|$)|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>[^\\\\n]*\\\\n*|$)|<![A-Z][\\\\s\\\\S]*?(?:>[^\\\\n]*\\\\n*|$)|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>[^\\\\n]*\\\\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|$))","i").replace("comment",ee).replace("tag",X).replace("attribute",/ +[a-zA-Z:_][\\w.:-]*(?: *= *"[^"\\n]*"| *= *\'[^\'\\n]*\'| *= *[^\\s"\'=<>`]+)?/).getRegex(),me=t=>g(V).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list",t).replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X).getRegex(),et=me(/ {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]/),tt=me(/ {0,3}(?:[*+-]|\\d{1,9}[.)])(?:[ \\t]|\\n|$)/),nt=g(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/).replace("paragraph",tt).getRegex(),te={blockquote:nt,code:He,def:Ke,fences:We,heading:Ge,hr:v,html:Ye,lheading:be,list:Ve,newline:Qe,paragraph:et,table:A,text:Je},ce=g("^ *([^\\\\n ].*)\\\\n {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)").replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]").replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X).getRegex(),rt={...te,lheading:Ue,table:ce,paragraph:g(V).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\\\s|$)").replace("|lheading","").replace("table",ce).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~~~)[^\\\\n]*\\\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\\\t]+[^ \\\\t\\\\n]").replace("html","</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",X).getRegex()},st={...te,html:g(`^ *(?:comment *(?:\\\\n|\\\\s*$)|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)|<tag(?:"[^"]*"|\'[^\']*\'|\\\\s[^\'"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))`).replace("comment",ee).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(),def:/^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +(["(][^\\n]+[")]))? *(?:\\n+|$)/,heading:/^(#{1,6})(.*)(?:\\n+|$)/,fences:A,lheading:/^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,paragraph:g(V).replace("hr",v).replace("heading",` *#{1,6} *[^\n]`).replace("lheading",be).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},it=/^\\\\([!"#$%&\'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/,lt=/^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/,we=/^( {2,}|\\\\)\\n(?!\\s*$)/,at=/^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/,P=/[\\p{P}\\p{S}]/u,Q=/[\\s\\p{P}\\p{S}]/u,ne=/[^\\s\\p{P}\\p{S}]/u,ot=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Q).getRegex(),ye=/(?!~)[\\p{P}\\p{S}]/u,ct=/(?!~)[\\s\\p{P}\\p{S}]/u,ut=/(?:[^\\s\\p{P}\\p{S}]|~)/u,ht=g(/link|precode-code|html/,"g").replace("link",/\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)/).replace("precode-",Xe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Re=/^(?:\\*+(?:((?!\\*)punct)|([^\\s*]))?)|^_+(?:((?!_)punct)|([^\\s_]))?/,pt=g(Re,"u").replace(/punct/g,P).getRegex(),ft=g(Re,"u").replace(/punct/g,ye).getRegex(),Te="^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\\\*)punct(\\\\*+)(?=[\\\\s]|$)|notPunctSpace(\\\\*+)(?!\\\\*)(?=punctSpace|$)|(?!\\\\*)punctSpace(\\\\*+)(?=notPunctSpace)|[\\\\s](\\\\*+)(?!\\\\*)(?=punct)|(?!\\\\*)punct(\\\\*+)(?!\\\\*)(?=punct)|notPunctSpace(\\\\*+)(?=notPunctSpace)",gt=g(Te,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,P).getRegex(),dt=g(Te,"gu").replace(/notPunctSpace/g,ut).replace(/punctSpace/g,ct).replace(/punct/g,ye).getRegex(),kt=g("^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,P).getRegex(),xt=g(/^~~?(?:((?!~)punct)|[^\\s~])/,"u").replace(/punct/g,P).getRegex(),bt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",mt=g(bt,"gu").replace(/notPunctSpace/g,ne).replace(/punctSpace/g,Q).replace(/punct/g,P).getRegex(),wt=g(/\\\\(punct)/,"gu").replace(/punct/g,P).getRegex(),yt=g(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(),Rt=g(ee).replace("(?:-->|$)","-->").getRegex(),Tt=g("^comment|^</[a-zA-Z][\\\\w:-]*\\\\s*>|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>|^<\\\\?[\\\\s\\\\S]*?\\\\?>|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>").replace("comment",Rt).replace("attribute",/\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*"[^"]*"|\\s*=\\s*\'[^\']*\'|\\s*=\\s*[^\\s"\'=<>`]+)?/).getRegex(),Z=/(?:\\[(?:\\\\[\\s\\S]|[^\\[\\]\\\\])*\\]|\\\\[\\s\\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\\])|[^\\[\\]\\\\`])*?/,St=g(/^!?\\[(label)\\]\\(\\s*(href)(?:(?:[ \\t]+(?:\\n[ \\t]*)?|\\n[ \\t]*)(title))?\\s*\\)/).replace("label",Z).replace("href",/<(?:\\\\.|[^\\n<>\\\\])+>|[^ \\t\\n\\x00-\\x1f]+|(?=\\))/).replace("title",/"(?:\\\\"?|[^"\\\\])*"|\'(?:\\\\\'?|[^\'\\\\])*\'|\\((?:\\\\\\)?|[^)\\\\])*\\)/).getRegex(),Se=g(/^!?\\[(label)\\]\\[(ref)\\]/).replace("label",Z).replace("ref",Y).getRegex(),_e=g(/^!?\\[(ref)\\](?:\\[\\])?/).replace("ref",Y).getRegex(),_t=g("reflink|nolink(?!\\\\()","g").replace("reflink",Se).replace("nolink",_e).getRegex(),ue=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,re={_backpedal:A,anyPunctuation:wt,autolink:yt,blockSkip:ht,br:we,code:lt,del:A,delLDelim:A,delRDelim:A,emStrongLDelim:pt,emStrongRDelimAst:gt,emStrongRDelimUnd:kt,escape:it,link:St,nolink:_e,punctuation:ot,reflink:Se,reflinkSearch:_t,tag:Tt,text:at,url:A},$t={...re,link:g(/^!?\\[(label)\\]\\((.*?)\\)/).replace("label",Z).getRegex(),reflink:g(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/).replace("label",Z).getRegex()},W={...re,emStrongRDelimAst:dt,emStrongLDelim:ft,delLDelim:xt,delRDelim:mt,url:g(/^((?:protocol):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/).replace("protocol",ue).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_\'"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_\'"~)]+(?!$))+/,del:/^(~~?)(?=[^\\s~])((?:\\\\[\\s\\S]|[^\\\\])*?(?:\\\\[\\s\\S]|[^\\s~\\\\]))\\1(?=[^~]|$)/,text:g(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|protocol:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&\'*+\\/=?_`{\\|}~-]+@)))/).replace("protocol",ue).getRegex()},Et={...W,br:g(we).replace("{2,}","*").getRegex(),text:g(W.text).replace("\\\\b_","\\\\b_| {2,}\\\\n").replace(/\\{2,\\}/g,"*").getRegex()},q={normal:te,gfm:rt,pedantic:st},O={normal:re,gfm:W,breaks:Et,pedantic:$t},zt={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},he=t=>zt[t];function _(t,e){if(e){if(x.escapeTest.test(t))return t.replace(x.escapeReplace,he)}else if(x.escapeTestNoEncode.test(t))return t.replace(x.escapeReplaceNoEncode,he);return t}function pe(t){try{t=encodeURI(t).replace(x.percentDecode,"%")}catch{return null}return t}function fe(t,e){let n=t.replace(x.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\\\";)o=!o;return o?"|":" |"}),s=n.split(x.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(x.slashPipe,"|");return s}function E(t,e,n){let s=t.length;if(s===0)return"";let r=0;for(;r<s;){let i=t.charAt(s-r-1);if(i===e&&!n)r++;else if(i!==e&&n)r++;else break}return t.slice(0,s-r)}function ge(t){let e=t.split(`\n`),n=e.length-1;for(;n>=0&&x.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`\n`)}function At(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let s=0;s<t.length;s++)if(t[s]==="\\\\")s++;else if(t[s]===e[0])n++;else if(t[s]===e[1]&&(n--,n<0))return s;return n>0?-2:-1}function Lt(t,e=0){let n=e,s="";for(let r of t)if(r===" "){let i=4-n%4;s+=" ".repeat(i),n+=i}else s+=r,n++;return s}function de(t,e,n,s,r){let i=e.href,a=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}function It(t,e,n){let s=t.match(n.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`\n`).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=r.length?i.slice(r.length):i}).join(`\n`)}var j=class{options;rules;lexer;constructor(t){this.options=t||I}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=this.options.pedantic?e[0]:ge(e[0]),s=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:s}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],s=It(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let s=E(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:E(e[0],`\n`),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:E(e[0],`\n`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=E(e[0],`\n`).split(`\n`),s="",r="",i=[];for(;n.length>0;){let a=!1,l=[],o;for(o=0;o<n.length;o++)if(this.rules.other.blockquoteStart.test(n[o]))l.push(n[o]),a=!0;else if(!a)l.push(n[o]);else break;n=n.slice(o);let c=l.join(`\n`),h=c.replace(this.rules.other.blockquoteSetextReplace,`\n $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}\n${c}`:c,r=r?`${r}\n${h}`:h;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=u,n.length===0)break;let p=i.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let k=p,d=k.raw+`\n`+n.join(`\n`),m=this.blockquote(d);i[i.length-1]=m,s=s.substring(0,s.length-k.raw.length)+m.raw,r=r.substring(0,r.length-k.text.length)+m.text;break}else if(p?.type==="list"){let k=p,d=k.raw+`\n`+n.join(`\n`),m=this.list(d);i[i.length-1]=m,s=s.substring(0,s.length-p.raw.length)+m.raw,r=r.substring(0,r.length-k.raw.length)+m.raw,n=d.substring(i.at(-1).raw.length).split(`\n`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\\\d{1,9}\\\\${n.slice(-1)}`:`\\\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;t;){let o=!1,c="",h="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let u=Lt(e[2].split(`\n`,1)[0],e[1].length),p=t.split(`\n`,1)[0],k=!u.trim(),d=0;if(this.options.pedantic?(d=2,h=u.trimStart()):k?d=e[1].length+1:(d=u.search(this.rules.other.nonSpaceChar),d=d>4?1:d,h=u.slice(d),d+=e[1].length),k&&this.rules.other.blankLine.test(p)&&(c+=p+`\n`,t=t.substring(p.length+1),o=!0),!o){let m=this.rules.other.nextBulletRegex(d),w=this.rules.other.hrRegex(d),y=this.rules.other.fencesBeginRegex(d),$=this.rules.other.headingBeginRegex(d),H=this.rules.other.htmlBeginRegex(d),z=this.rules.other.blockquoteBeginRegex(d);for(;t;){let b=t.split(`\n`,1)[0],S;if(p=b,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),S=p):S=p.replace(this.rules.other.tabCharGlobal," "),y.test(p)||$.test(p)||H.test(p)||z.test(p)||m.test(p)||w.test(p))break;if(S.search(this.rules.other.nonSpaceChar)>=d||!p.trim())h+=`\n`+S.slice(d);else{if(k||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(u)||$.test(u)||w.test(u))break;h+=`\n`+p}k=!p.trim(),c+=b+`\n`,t=t.substring(b.length+1),u=S.slice(d)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),r.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),r.raw+=c}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let o of r.items){this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]);let c=o.tokens[0];if(o.task&&(c?.type==="text"||c?.type==="paragraph")){o.text=o.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(o.raw);if(h){let u={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};o.checked=u.checked,r.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=u.raw+o.tokens[0].raw,o.tokens[0].text=u.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(u)):o.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):o.tokens.unshift(u)}}else o.task&&(o.task=!1);if(!r.loose){let h=o.tokens.filter(p=>p.type==="space"),u=h.length>0&&h.some(p=>this.rules.other.anyLine.test(p.raw));r.loose=u}}if(r.loose)for(let o of r.items){o.loose=!0;for(let c of o.tokens)c.type==="text"&&(c.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=ge(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:E(e[0],`\n`),href:s,title:r}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=fe(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`\n`):[],i={type:"table",raw:E(e[0],`\n`),header:[],align:[],rows:[]};if(n.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of r)i.rows.push(fe(a,i.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[o]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:E(e[0],`\n`),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`\n`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=E(n.slice(0,-1),"\\\\");if((n.length-i.length)%2===0)return}else{let i=At(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),de(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return de(n,r,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,a,l=r,o=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+r);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){o+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+o);let h=[...s[0]][0].length,u=t.slice(0,r+s.index+h+a);if(Math.min(r,a)%2){let k=u.slice(1,-1);return{type:"em",raw:u,text:k,tokens:this.lexer.inlineTokens(k)}}let p=u.slice(2,-2);return{type:"strong",raw:u,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let s=this.rules.inline.delLDelim.exec(t);if(s&&(!s[1]||!n||this.rules.inline.punctuation.exec(n))){let r=[...s[0]].length-1,i,a,l=r,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*t.length+r);(s=o.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==r))continue;if(s[3]||s[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let c=[...s[0]][0].length,h=t.slice(0,r+s.index+c+a),u=h.slice(r,-r);return{type:"del",raw:h,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,s;return e[2]==="@"?(n=e[1],s="mailto:"+n):(n=e[1],s=n),{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},R=class G{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:x,block:q.normal,inline:O.normal};this.options.pedantic?(n.block=q.pedantic,n.inline=O.pedantic):this.options.gfm&&(n.block=q.gfm,this.options.breaks?n.inline=O.breaks:n.inline=O.gfm),this.tokenizer.rules=n}static get rules(){return{block:q,inline:O}}static lex(e,n){return new G(n).lex(e)}static lexInline(e,n){return new G(n).inlineTokens(e)}lex(e){e=e.replace(x.carriageReturn,`\n`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(l=>(i=l.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let l=n.at(-1);i.raw.length===1&&l!==void 0?l.raw+=`\n`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,o=e.slice(1),c;this.options.extensions.startBlock.forEach(h=>{c=h.call({lexer:this},o),typeof c=="number"&&c>=0&&(l=Math.min(l,c))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let l=n.at(-1);s&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i),s=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let l=n.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`\n`)?"":`\n`)+i.raw,l.text+=`\n`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let l=Object.keys(this.tokens.links);l.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,o=>l.includes(o.slice(o.lastIndexOf("[")+1,-1))?"["+"a".repeat(o.length-2)+"]":o))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),s=s.replace(this.tokenizer.rules.inline.blockSkip,(l,o,c)=>{let h=c?c.length:0;return l.slice(0,h)+"["+"a".repeat(l.length-h-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,i="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=""),r=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=n.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,s,i)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e,s,i)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let o=e;if(this.options.extensions?.startInline){let c=1/0,h=e.slice(1),u;this.options.extensions.startInline.forEach(p=>{u=p.call({lexer:this},h),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(o)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(i=l.raw.slice(-1)),r=!0;let c=n.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},F=class{options;parser;constructor(t){this.options=t||I}space(t){return""}code({text:t,lang:e,escaped:n}){let s=(e||"").match(x.notSpaceStart)?.[0],r=t.replace(x.endingNewline,"")+`\n`;return s?\'<pre><code class="language-\'+_(s)+\'">\'+(n?r:_(r,!0))+`</code></pre>\n`:"<pre><code>"+(n?r:_(r,!0))+`</code></pre>\n`}blockquote({tokens:t}){return`<blockquote>\n${this.parser.parse(t)}</blockquote>\n`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>\n`}hr(t){return`<hr>\n`}list(t){let e=t.ordered,n=t.start,s="";for(let a=0;a<t.items.length;a++){let l=t.items[a];s+=this.listitem(l)}let r=e?"ol":"ul",i=e&&n!==1?\' start="\'+n+\'"\':"";return"<"+r+i+`>\n`+s+"</"+r+`>\n`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>\n`}checkbox({checked:t}){return"<input "+(t?\'checked="" \':"")+\'disabled="" type="checkbox"> \'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>\n`}table(t){let e="",n="";for(let r=0;r<t.header.length;r++)n+=this.tablecell(t.header[r]);e+=this.tablerow({text:n});let s="";for(let r=0;r<t.rows.length;r++){let i=t.rows[r];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>\n<thead>\n`+e+`</thead>\n`+s+`</table>\n`}tablerow({text:t}){return`<tr>\n${t}</tr>\n`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${_(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let s=this.parser.parseInline(n),r=pe(t);if(r===null)return s;t=r;let i=\'<a href="\'+t+\'"\';return e&&(i+=\' title="\'+_(e)+\'"\'),i+=">"+s+"</a>",i}image({href:t,title:e,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));let r=pe(t);if(r===null)return _(n);t=r;let i=`<img src="${t}" alt="${_(n)}"`;return e&&(i+=` title="${_(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:_(t.text)}},se=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},T=class U{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new se}static parse(e,n){return new U(n).parse(e)}static parseInline(e,n){return new U(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let a=r,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=l||"";continue}}let i=r;switch(i.type){case"space":{n+=this.renderer.space(i);break}case"hr":{n+=this.renderer.hr(i);break}case"heading":{n+=this.renderer.heading(i);break}case"code":{n+=this.renderer.code(i);break}case"table":{n+=this.renderer.table(i);break}case"blockquote":{n+=this.renderer.blockquote(i);break}case"list":{n+=this.renderer.list(i);break}case"checkbox":{n+=this.renderer.checkbox(i);break}case"html":{n+=this.renderer.html(i);break}case"def":{n+=this.renderer.def(i);break}case"paragraph":{n+=this.renderer.paragraph(i);break}case"text":{n+=this.renderer.text(i);break}default:{let a=\'Token with "\'+i.type+\'" type was not found.\';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=l||"";continue}}let a=i;switch(a.type){case"escape":{s+=n.text(a);break}case"html":{s+=n.html(a);break}case"link":{s+=n.link(a);break}case"image":{s+=n.image(a);break}case"checkbox":{s+=n.checkbox(a);break}case"strong":{s+=n.strong(a);break}case"em":{s+=n.em(a);break}case"codespan":{s+=n.codespan(a);break}case"br":{s+=n.br(a);break}case"del":{s+=n.del(a);break}case"text":{s+=n.text(a);break}default:{let l=\'Token with "\'+a.type+\'" type was not found.\';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},N=class{options;block;constructor(t){this.options=t||I}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?R.lex:R.lexInline}provideParser(t=this.block){return t?T.parse:T.parseInline}},Ct=class{defaults=J();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=T;Renderer=F;TextRenderer=se;Lexer=R;Tokenizer=j;Hooks=N;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)n=n.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let a of i)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=s;n=n.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let a=r[i].flat(1/0);n=n.concat(this.walkTokens(a,e))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...a){let l=r.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be \'block\' or \'inline\'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),n.renderer){let r=this.defaults.renderer||new F(this.defaults);for(let i in n.renderer){if(!(i in r))throw new Error(`renderer \'${i}\' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=n.renderer[a],o=r[a];r[a]=(...c)=>{let h=l.apply(r,c);return h===!1&&(h=o.apply(r,c)),h||""}}s.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new j(this.defaults);for(let i in n.tokenizer){if(!(i in r))throw new Error(`tokenizer \'${i}\' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=n.tokenizer[a],o=r[a];r[a]=(...c)=>{let h=l.apply(r,c);return h===!1&&(h=o.apply(r,c)),h}}s.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new N;for(let i in n.hooks){if(!(i in r))throw new Error(`hook \'${i}\' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=n.hooks[a],o=r[a];N.passThroughHooks.has(i)?r[a]=c=>{if(this.defaults.async&&N.passThroughHooksRespectAsync.has(i))return(async()=>{let u=await l.call(r,c);return o.call(r,u)})();let h=l.call(r,c);return o.call(r,h)}:r[a]=(...c)=>{if(this.defaults.async)return(async()=>{let u=await l.apply(r,c);return u===!1&&(u=await o.apply(r,c)),u})();let h=l.apply(r,c);return h===!1&&(h=o.apply(r,c)),h}}s.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),r&&(l=l.concat(r.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return R.lex(t,e??this.defaults)}parser(t,e){return T.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let s={...n},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=t),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(e):e,l=await(r.hooks?await r.hooks.provideLexer(t):t?R.lex:R.lexInline)(a,r),o=r.hooks?await r.hooks.processAllTokens(l):l;r.walkTokens&&await Promise.all(this.walkTokens(o,r.walkTokens));let c=await(r.hooks?await r.hooks.provideParser(t):t?T.parse:T.parseInline)(o,r);return r.hooks?await r.hooks.postprocess(c):c})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer(t):t?R.lex:R.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let l=(r.hooks?r.hooks.provideParser(t):t?T.parse:T.parseInline)(a,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(t,e){return n=>{if(n.message+=`\nPlease report this to https://github.com/markedjs/marked.`,t){let s="<p>An error occurred:</p><pre>"+_(n.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(n);throw n}}},L=new Ct;function f(t,e){return L.parse(t,e)}f.options=f.setOptions=function(t){return L.setOptions(t),f.defaults=L.defaults,ke(f.defaults),f};f.getDefaults=J;f.defaults=I;f.use=function(...t){return L.use(...t),f.defaults=L.defaults,ke(f.defaults),f};f.walkTokens=function(t,e){return L.walkTokens(t,e)};f.parseInline=L.parseInline;f.Parser=T;f.parser=T.parse;f.Renderer=F;f.TextRenderer=se;f.Lexer=R;f.lexer=R.lex;f.Tokenizer=j;f.Hooks=N;f.parse=f;var Ut=f.options,Jt=f.setOptions,Kt=f.use,Vt=f.walkTokens,Yt=f.parseInline;var en=T.parse,tn=R.lex;var $e=/^ {0,3}:::([A-Za-z][\\w-]*)?[ \\t]*(?:\\n|$)/,Pt=/^ {0,3}:::([A-Za-z][\\w-]*)?[ \\t]*$/;function Mt(t){let e=1,n=0;for(;n<t.length;){let s=t.indexOf(`\n`,n),r=s===-1?t.slice(n):t.slice(n,s),i=Pt.exec(r);if(i){if(i[1]!==void 0)e++;else if(e--,e===0)return n}if(s===-1)break;n=s+1}return-1}var Ee=[{name:"container",level:"block",tokenizer(t){let e=$e.exec(t);if(!e)return;let n=t.slice(e[0].length),s=Mt(n);if(s<0)return;let r=n.slice(0,s),i=n.indexOf(`\n`,s),a=i===-1?n.length:i+1,l=e[0]+n.slice(0,a),o=this.lexer.blockTokens(r,[]);return{type:"container",raw:l,kind:e[1],tokens:o}},renderer(t){return t.raw}}];function ie(t){return t.includes(":::")===!1?!1:new RegExp($e.source,"m").test(t)}var Le="([^\\\\]\\\\s]+)",Ot=new RegExp(`^\\\\[\\\\^${Le}\\\\]`),Ie=new RegExp(`^ {0,3}\\\\[\\\\^${Le}\\\\]:[ \\\\t]*([^\\\\n]*)\\\\n?`);function ze(t){return/^[ \\t]*$/.test(t)}var Ae=/^(?: {4}| {0,3}\\t)/;function Nt(t){let e=0;for(;;){let s=e;for(;;){let l=t.indexOf(`\n`,s);if(l===-1)return n(e,!0);let o=t.slice(s,l);if(!ze(o))break;s=l+1}let r=t.indexOf(`\n`,s),i=r===-1?t.slice(s):t.slice(s,r+1),a=r===-1?t.slice(s):t.slice(s,r);if(!Ae.test(a))return n(e,!1);if(e=s+i.length,r===-1)return n(e,!0)}function n(s,r){let i=t.slice(0,s),a=i.split(`\n`).map(l=>ze(l)?"":l.replace(Ae,"")).join(`\n`);return{raw:i,body:a,open:r}}}function le(t){return t.includes("[^")===!1?!1:new RegExp(Ie.source,"m").test(t)}var Ce=[{name:"footnoteRef",level:"inline",tokenizer(t){let e=Ot.exec(t);if(e)return{type:"footnoteRef",raw:e[0],label:e[1]}},renderer(t){return t.raw}},{name:"footnoteDef",level:"block",tokenizer(t){let e=Ie.exec(t);if(!e)return;let n=t.slice(e[0].length),s=Nt(n),r=s.body.trim()?this.lexer.blockTokens(s.body,[]):[];return{type:"footnoteDef",raw:e[0]+s.raw,label:e[1],body:e[2],tokens:r}},renderer(t){return t.raw}}];function Me(t,e,n){let s=0;for(let r=e;r<n;r++)s+=t[r].raw.length;return s}function vt(t,e){let n=t;return n.links=e,n}function Oe(t,e){for(let n=e;n+1<t.length;n++)if(t[n].type==="paragraph"&&t[n+1].type==="paragraph")return n;return t.length}function Dt(t,e){return t[e-2]?.type!=="list"?!0:e+1<t.length}function Ne(t,e,n){let s=Math.min(t.length-2,n-1);for(let r=s;r>=e;r--)if(t[r].type==="space"&&Dt(t,r+1)!==!1)return r+1;return-1}function ve(t){let e=t.links;if(!e)return!1;for(let n in e)return!0;return!1}function De(t,e,n,s,r){let i=r;for(let a=e;a<n;a++){let l=t[a].raw;if(s.startsWith(l,i)===!1)return!1;i+=l.length}return!0}function B(t,e,n){return{source:t,tail:t,tokens:e,stableCount:0,stableOffset:0,degraded:!0,degradedReason:n}}function Pe(t,e){return{source:t,tail:t,tokens:e,stableCount:0,stableOffset:0,degraded:!1,degradedReason:null}}function Bt(t,e){if(ve(e))return B(t,e,"link-definition");if(t.includes("\\r"))return B(t,e,"carriage-return");if(ie(t))return B(t,e,"container");if(le(t))return B(t,e,"footnote-def");let n=Oe(e,0),s=Ne(e,1,n);if(s<0||De(e,0,s,t,0)===!1)return Pe(t,e);let r=Me(e,0,s);return{source:t,tail:t.slice(r),tokens:e,stableCount:s,stableOffset:r,degraded:!1,degradedReason:null}}function ae(t){let e=f.lexer(t);return{tokens:e,cache:Bt(t,e),charsLexed:t.length,reusedTokens:0}}function D(t,e){let n=f.lexer(t);return{tokens:n,cache:B(t,n,e),charsLexed:t.length,reusedTokens:0}}function Be(t,e){let n=t.source+e;if(t.degraded)return D(n,t.degradedReason??"link-definition");if(e.includes("\\r"))return D(n,"carriage-return");if(t.stableCount===0)return ae(n);let s=t.tail+e;if(ie(s))return D(n,"container");if(le(s))return D(n,"footnote-def");let r=f.lexer(s);if(ve(r))return D(n,"link-definition");let i=t.tokens.slice(0,t.stableCount),a=vt([...i,...r],r.links),l=t.stableCount,o=t.stableOffset,c=s,h=Ne(a,t.stableCount+1,Oe(a,t.stableCount));if(h>t.stableCount&&De(a,t.stableCount,h,s,0)){let u=Me(a,t.stableCount,h);l=h,o=t.stableOffset+u,c=s.slice(u)}return{tokens:a,cache:{source:n,tail:c,tokens:a,stableCount:l,stableOffset:o,degraded:!1,degradedReason:null},charsLexed:s.length,reusedTokens:t.stableCount}}var qt=/^ {0,3}\\*\\[([^\\]\\n]+)\\]:[ \\t]*([^\\n]*)(?:\\n|$)/,qe=[{name:"abbrDef",level:"block",tokenizer(t){let e=qt.exec(t);if(e)return{type:"abbrDef",raw:e[0],term:e[1],definition:e[2]}},renderer(t){return t.raw}}];var Zt=Object.freeze({grinning:"\\u{1F600}",smiley:"\\u{1F603}",smile:"\\u{1F604}",grin:"\\u{1F601}",laughing:"\\u{1F606}",satisfied:"\\u{1F606}",sweat_smile:"\\u{1F605}",rofl:"\\u{1F923}",joy:"\\u{1F602}",slightly_smiling_face:"\\u{1F642}",upside_down_face:"\\u{1F643}",wink:"\\u{1F609}",blush:"\\u{1F60A}",innocent:"\\u{1F607}",heart_eyes:"\\u{1F60D}",star_struck:"\\u{1F929}",kissing_heart:"\\u{1F618}",yum:"\\u{1F60B}",stuck_out_tongue:"\\u{1F61B}",stuck_out_tongue_winking_eye:"\\u{1F61C}",stuck_out_tongue_closed_eyes:"\\u{1F61D}",hugs:"\\u{1F917}",thinking:"\\u{1F914}",neutral_face:"\\u{1F610}",expressionless:"\\u{1F611}",no_mouth:"\\u{1F636}",smirk:"\\u{1F60F}",unamused:"\\u{1F612}",roll_eyes:"\\u{1F644}",grimacing:"\\u{1F62C}",relieved:"\\u{1F60C}",pensive:"\\u{1F614}",sleepy:"\\u{1F62A}",sleeping:"\\u{1F634}",mask:"\\u{1F637}",dizzy_face:"\\u{1F635}",sunglasses:"\\u{1F60E}",nerd_face:"\\u{1F913}",confused:"\\u{1F615}",worried:"\\u{1F61F}",open_mouth:"\\u{1F62E}",hushed:"\\u{1F62F}",astonished:"\\u{1F632}",flushed:"\\u{1F633}",pleading_face:"\\u{1F97A}",fearful:"\\u{1F628}",cold_sweat:"\\u{1F630}",cry:"\\u{1F622}",sob:"\\u{1F62D}",scream:"\\u{1F631}",disappointed:"\\u{1F61E}",sweat:"\\u{1F613}",weary:"\\u{1F629}",tired_face:"\\u{1F62B}",triumph:"\\u{1F624}",rage:"\\u{1F621}",angry:"\\u{1F620}",smiling_imp:"\\u{1F608}",imp:"\\u{1F47F}",skull:"\\u{1F480}",clown_face:"\\u{1F921}",poop:"\\u{1F4A9}",ghost:"\\u{1F47B}",alien:"\\u{1F47D}",robot:"\\u{1F916}",thumbsup:"\\u{1F44D}","+1":"\\u{1F44D}",thumbsdown:"\\u{1F44E}","-1":"\\u{1F44E}",punch:"\\u{1F44A}",fist:"\\u270A",clap:"\\u{1F44F}",raised_hands:"\\u{1F64C}",open_hands:"\\u{1F450}",handshake:"\\u{1F91D}",pray:"\\u{1F64F}",muscle:"\\u{1F4AA}",eyes:"\\u{1F440}",wave:"\\u{1F44B}",point_up:"\\u261D\\uFE0F",point_down:"\\u{1F447}",point_left:"\\u{1F448}",point_right:"\\u{1F449}",ok_hand:"\\u{1F44C}",v:"\\u270C\\uFE0F",crossed_fingers:"\\u{1F91E}",heart:"\\u2764\\uFE0F",broken_heart:"\\u{1F494}",two_hearts:"\\u{1F495}",sparkling_heart:"\\u{1F496}",heartpulse:"\\u{1F497}",blue_heart:"\\u{1F499}",green_heart:"\\u{1F49A}",yellow_heart:"\\u{1F49B}",orange_heart:"\\u{1F9E1}",purple_heart:"\\u{1F49C}",black_heart:"\\u{1F5A4}",white_heart:"\\u{1F90D}",100:"\\u{1F4AF}",boom:"\\u{1F4A5}",collision:"\\u{1F4A5}",dizzy:"\\u{1F4AB}",sweat_drops:"\\u{1F4A6}",dash:"\\u{1F4A8}",zzz:"\\u{1F4A4}",fire:"\\u{1F525}",sparkles:"\\u2728",star:"\\u2B50",star2:"\\u{1F31F}",tada:"\\u{1F389}",confetti_ball:"\\u{1F38A}",balloon:"\\u{1F388}",gift:"\\u{1F381}",rocket:"\\u{1F680}",dart:"\\u{1F3AF}",trophy:"\\u{1F3C6}",warning:"\\u26A0\\uFE0F",no_entry_sign:"\\u{1F6AB}",white_check_mark:"\\u2705",x:"\\u274C",heavy_check_mark:"\\u2714\\uFE0F",question:"\\u2753",exclamation:"\\u2757",bulb:"\\u{1F4A1}",bell:"\\u{1F514}",computer:"\\u{1F4BB}",iphone:"\\u{1F4F1}",link:"\\u{1F517}",lock:"\\u{1F512}",unlock:"\\u{1F513}",key:"\\u{1F511}",mag:"\\u{1F50D}",bug:"\\u{1F41B}",package:"\\u{1F4E6}",memo:"\\u{1F4DD}",pencil2:"\\u270F\\uFE0F",book:"\\u{1F4D6}",books:"\\u{1F4DA}",pushpin:"\\u{1F4CC}",paperclip:"\\u{1F4CE}",calendar:"\\u{1F4C5}",file_folder:"\\u{1F4C1}",hammer:"\\u{1F528}",wrench:"\\u{1F527}",gear:"\\u2699\\uFE0F",chart_with_upwards_trend:"\\u{1F4C8}",chart_with_downwards_trend:"\\u{1F4C9}",bar_chart:"\\u{1F4CA}",construction:"\\u{1F6A7}",hourglass:"\\u23F3",stopwatch:"\\u23F1\\uFE0F",pizza:"\\u{1F355}",coffee:"\\u2615",beer:"\\u{1F37A}",cake:"\\u{1F382}",birthday:"\\u{1F382}",apple:"\\u{1F34E}",rainbow:"\\u{1F308}",sun_with_face:"\\u{1F31E}",crescent_moon:"\\u{1F319}",earth_americas:"\\u{1F30E}",dog:"\\u{1F436}",cat:"\\u{1F431}",fox_face:"\\u{1F98A}",bear:"\\u{1F43B}",panda_face:"\\u{1F43C}",monkey_face:"\\u{1F435}",see_no_evil:"\\u{1F648}",hear_no_evil:"\\u{1F649}",speak_no_evil:"\\u{1F64A}"}),jt=/^:([A-Za-z0-9_+-]+):/,Ze=[{name:"emoji",level:"inline",start(t){return t.match(/:/)?.index},tokenizer(t){let e=jt.exec(t);if(!e)return;let n=Zt[e[1]];if(n!==void 0)return{type:"emoji",raw:e[0],text:n}},renderer(t){return t.raw}}];var Ft=/^\\+\\+(?!\\s)((?:\\\\[\\s\\S]|(?!\\+\\+)[\\s\\S])+?)(?<!\\s)\\+\\+/,Xt=/^==(?!\\s)((?:\\\\[\\s\\S]|(?!==)[\\s\\S])+?)(?<!\\s)==/,je=[{name:"ins",level:"inline",start(t){return t.match(/(?<!\\\\)\\+\\+(?!\\s)/)?.index},tokenizer(t){let e=Ft.exec(t);if(e)return{type:"ins",raw:e[0],text:e[1].replace(/\\\\(.)/g,"$1")}},renderer(t){return t.raw}},{name:"mark",level:"inline",start(t){return t.match(/(?<!\\\\)==(?!\\s)/)?.index},tokenizer(t){let e=Xt.exec(t);if(e)return{type:"mark",raw:e[0],text:e[1].replace(/\\\\(.)/g,"$1")}},renderer(t){return t.raw}}];var Qt=/^\\^((?:\\\\[\\s\\S]|[^\\s^\\\\])+)\\^/,Fe=[{name:"sup",level:"inline",start(t){return t.match(/(?<!\\\\)\\^(?!\\s)/)?.index},tokenizer(t){let e=Qt.exec(t);if(e)return{type:"sup",raw:e[0],text:e[1].replace(/\\\\(.)/g,"$1")}},renderer(t){return t.raw}}];var Ht=0;function Wt(t){if(typeof t!="string"||typeof performance.mark!="function"||typeof performance.measure!="function")return null;let e=Ht++,n={name:t,startMark:`${t}:start:${e}`,endMark:`${t}:end:${e}`};try{return performance.mark(n.startMark),n}catch{return null}}function Gt(t){if(t)try{performance.mark(t.endMark),performance.measure(t.name,t.startMark,t.endMark)}catch{}finally{try{performance.clearMarks?.(t.startMark),performance.clearMarks?.(t.endMark)}catch{}}}f.use({extensions:[...Ce,...Fe,...je,...Ze,...Ee,...qe,{name:"blockMath",level:"block",start(t){return t.match(/^ {0,3}\\$\\$/m)?.index},tokenizer(t){let e=/^ {0,3}\\$\\$((?:(?!\\n[ \\t]*\\n)[\\s\\S])+?)\\$\\$[ \\t]*(?:\\n|$)/.exec(t);if(e)return{type:"blockMath",raw:e[0],text:e[1].trim()}},renderer(t){return t.raw}},{name:"inlineMath",level:"inline",start(t){return t.match(/(?<![\\\\$])\\$(?![$\\s])/)?.index},tokenizer(t){let e=/^\\$(?![$\\s\\d])((?:\\\\\\$|[^$\\n])*?)(?<!\\s)\\$(?!\\d)/.exec(t);if(e)return{type:"inlineMath",raw:e[0],text:e[1].trim()}},renderer(t){return t.raw}}]});var M=new Map;self.onmessage=t=>{let e=t.data;if(typeof e!="object"||e===null)return;let{id:n,text:s,append:r,expectedLength:i,oldRaws:a,instance:l,baseVersion:o,dispose:c,userTimingName:h}=e;if(c===!0){typeof l=="string"&&M.delete(l);return}let u=typeof l=="string"?l:null,p=typeof o=="number"?o:null,k,d=null,m=null;if(typeof r=="string"){if(u===null||p===null){self.postMessage({id:n,needResync:!0});return}let w=M.get(u);if(!w||w.version!==p){self.postMessage({id:n,needResync:!0});return}if(typeof i=="number"&&w.lex.source.length+r.length!==i){M.delete(u),self.postMessage({id:n,needResync:!0});return}let y=w.lex;k=()=>Be(y,r),m=y.tokens}else if(typeof s=="string"){let w=s;if(k=()=>ae(w),Array.isArray(a))d=a;else if(u!==null&&p!==null){let y=M.get(u);if(y&&y.version===p)m=y.lex.tokens;else{self.postMessage({id:n,needResync:!0});return}}}else return;try{let w=typeof h=="string"?Wt(h):null,y=performance.now(),$;try{$=k()}finally{w&&Gt(w)}let H=performance.now()-y,z=$.tokens,b=0;if(d!==null){let S=Math.min(d.length,z.length);for(;b<S&&d[b]===z[b].raw;b++);}else if(m!==null){let S=m,oe=Math.min(S.length,z.length);for(b=Math.min($.reusedTokens,oe);b<oe&&S[b].raw===z[b].raw;b++);}u!==null&&p!==null&&M.set(u,{version:p+1,lex:$.cache}),self.postMessage({id:n,matchLen:b,tail:z.slice(b),lexerMs:H,sourceCharsLexed:$.charsLexed})}catch(w){u!==null&&M.delete(u),self.postMessage({id:n,error:String(w)})}};})();\n';
|
|
1964
2714
|
|
|
1965
2715
|
// src/Markdown.ts
|
|
1966
2716
|
var now = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
2717
|
+
function mapsEqual(a, b) {
|
|
2718
|
+
if (a.size !== b.size) return false;
|
|
2719
|
+
for (const [key, value] of a) {
|
|
2720
|
+
if (b.get(key) !== value) return false;
|
|
2721
|
+
}
|
|
2722
|
+
return true;
|
|
2723
|
+
}
|
|
1967
2724
|
function lexMarkdown(text, userTiming) {
|
|
1968
2725
|
if (!userTiming) return import_marked.marked.lexer(text);
|
|
1969
2726
|
const timing = (0, import_core4.beginVectoUserTiming)(import_core4.VECTO_USER_TIMING.markdown.parse);
|
|
@@ -1974,11 +2731,18 @@ function lexMarkdown(text, userTiming) {
|
|
|
1974
2731
|
}
|
|
1975
2732
|
}
|
|
1976
2733
|
import_marked.marked.use({
|
|
1977
|
-
// `FOOTNOTE_EXTENSIONS`
|
|
1978
|
-
//
|
|
1979
|
-
//
|
|
2734
|
+
// `FOOTNOTE_EXTENSIONS`, `SUPERSCRIPT_EXTENSIONS`, `INS_MARK_EXTENSIONS`,
|
|
2735
|
+
// `EMOJI_EXTENSIONS`, `CONTAINER_EXTENSIONS`, and `ABBR_EXTENSIONS` are
|
|
2736
|
+
// shared with `MarkdownWorker.ts` rather than spelled out twice: the two
|
|
2737
|
+
// registration sites must agree exactly, or the worker returns tokens this
|
|
2738
|
+
// renderer has no arm for.
|
|
1980
2739
|
extensions: [
|
|
1981
2740
|
...FOOTNOTE_EXTENSIONS,
|
|
2741
|
+
...SUPERSCRIPT_EXTENSIONS,
|
|
2742
|
+
...INS_MARK_EXTENSIONS,
|
|
2743
|
+
...EMOJI_EXTENSIONS,
|
|
2744
|
+
...CONTAINER_EXTENSIONS,
|
|
2745
|
+
...ABBR_EXTENSIONS,
|
|
1982
2746
|
{
|
|
1983
2747
|
name: "blockMath",
|
|
1984
2748
|
level: "block",
|
|
@@ -1986,7 +2750,7 @@ import_marked.marked.use({
|
|
|
1986
2750
|
return src.match(/^ {0,3}\$\$/m)?.index;
|
|
1987
2751
|
},
|
|
1988
2752
|
tokenizer(src) {
|
|
1989
|
-
const match = /^ {0,3}\$\$([\s\S]+?)\$\$[ \t]*(?:\n|$)/.exec(src);
|
|
2753
|
+
const match = /^ {0,3}\$\$((?:(?!\n[ \t]*\n)[\s\S])+?)\$\$[ \t]*(?:\n|$)/.exec(src);
|
|
1990
2754
|
if (match) {
|
|
1991
2755
|
return {
|
|
1992
2756
|
type: "blockMath",
|
|
@@ -2188,6 +2952,19 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
2188
2952
|
mathLoadPending = false;
|
|
2189
2953
|
_userTiming;
|
|
2190
2954
|
tokens = [];
|
|
2955
|
+
/**
|
|
2956
|
+
* The document's `*[TERM]: definition` dictionary, collected from
|
|
2957
|
+
* {@link tokens}'s top-level `abbrDef` entries.
|
|
2958
|
+
*
|
|
2959
|
+
* Recomputed whenever {@link setTokens} runs. Its own identity — not its
|
|
2960
|
+
* CONTENTS — is what {@link updateTokens} compares against the previous
|
|
2961
|
+
* render to decide whether prose rendered before this definition existed
|
|
2962
|
+
* needs a full rebuild rather than the usual prefix-reuse: see
|
|
2963
|
+
* `markdown-abbr.ts`'s module doc for why a late-arriving definition can
|
|
2964
|
+
* retroactively change already-rendered inline tokens, the same hazard
|
|
2965
|
+
* `hasLinkDefinitions` names for reference definitions.
|
|
2966
|
+
*/
|
|
2967
|
+
abbreviations = /* @__PURE__ */ new Map();
|
|
2191
2968
|
// At most one worker lex request in flight at a time. Required for the
|
|
2192
2969
|
// delta-transfer protocol below to be safe: the request captures a
|
|
2193
2970
|
// snapshot of `this.tokens` to reconstruct the full array from the
|
|
@@ -2322,7 +3099,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
2322
3099
|
constructor(markdownText, opts = {}) {
|
|
2323
3100
|
super();
|
|
2324
3101
|
this.maxWidth = opts.maxWidth ?? 800;
|
|
2325
|
-
this.theme =
|
|
3102
|
+
this.theme = resolvePresetTheme(opts.theme);
|
|
2326
3103
|
this.onLinkClick = opts.onLinkClick;
|
|
2327
3104
|
this.selectable = opts.selectable ?? true;
|
|
2328
3105
|
this._userTiming = opts.userTiming ?? false;
|
|
@@ -2440,6 +3217,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
2440
3217
|
renderMarkdown(text) {
|
|
2441
3218
|
const tokens = lexMarkdown(text, this._userTiming);
|
|
2442
3219
|
this.setTokens(tokens);
|
|
3220
|
+
this.abbreviations = collectAbbreviations(tokens);
|
|
2443
3221
|
for (const token of tokens) {
|
|
2444
3222
|
const el = this.renderToken(token);
|
|
2445
3223
|
if (el) {
|
|
@@ -2598,6 +3376,38 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
2598
3376
|
entity.height = Math.max(border?.height ?? 0, innerStack?.height ?? 0);
|
|
2599
3377
|
return;
|
|
2600
3378
|
}
|
|
3379
|
+
case "container": {
|
|
3380
|
+
const ctToken = token;
|
|
3381
|
+
const innerStack = entity.children.find((c) => c instanceof import_ui4.Stack);
|
|
3382
|
+
const border = entity.children.find((c) => c instanceof QuoteBorder);
|
|
3383
|
+
const background = entity.children.find((c) => c instanceof ContainerBackground);
|
|
3384
|
+
const indentStart = Math.min(this.theme.containerIndent, availableWidth);
|
|
3385
|
+
const childWidth = Math.max(0, availableWidth - indentStart);
|
|
3386
|
+
if (innerStack instanceof import_ui4.Stack) {
|
|
3387
|
+
let index = 0;
|
|
3388
|
+
for (const inner of ctToken.tokens) {
|
|
3389
|
+
if (!this.producesEntity(inner)) continue;
|
|
3390
|
+
const wrapper = innerStack.children[index++];
|
|
3391
|
+
if (!wrapper) break;
|
|
3392
|
+
const block = wrapper.children[0];
|
|
3393
|
+
if (!block) continue;
|
|
3394
|
+
this.reflowToken(inner, block, childWidth);
|
|
3395
|
+
block.x = indentStart;
|
|
3396
|
+
wrapper.width = block.width + indentStart;
|
|
3397
|
+
wrapper.height = block.height;
|
|
3398
|
+
}
|
|
3399
|
+
innerStack.layout();
|
|
3400
|
+
}
|
|
3401
|
+
const contentHeight = innerStack?.height || 20;
|
|
3402
|
+
if (border instanceof QuoteBorder) border.height = contentHeight;
|
|
3403
|
+
if (background instanceof ContainerBackground) {
|
|
3404
|
+
background.width = availableWidth;
|
|
3405
|
+
background.height = contentHeight;
|
|
3406
|
+
}
|
|
3407
|
+
entity.width = availableWidth;
|
|
3408
|
+
entity.height = Math.max(background?.height ?? 0, border?.height ?? 0, contentHeight);
|
|
3409
|
+
return;
|
|
3410
|
+
}
|
|
2601
3411
|
case "list": {
|
|
2602
3412
|
if (!(entity instanceof import_ui4.Stack)) return;
|
|
2603
3413
|
for (const item of entity.children) {
|
|
@@ -2615,7 +3425,31 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
2615
3425
|
return;
|
|
2616
3426
|
}
|
|
2617
3427
|
case "footnoteDef": {
|
|
2618
|
-
if (entity instanceof import_ui4.RichText)
|
|
3428
|
+
if (entity instanceof import_ui4.RichText) {
|
|
3429
|
+
entity.setMaxWidth(availableWidth);
|
|
3430
|
+
return;
|
|
3431
|
+
}
|
|
3432
|
+
if (entity instanceof import_ui4.Stack) {
|
|
3433
|
+
const fnToken = token;
|
|
3434
|
+
entity.maxWidth = availableWidth;
|
|
3435
|
+
const header = entity.children[0];
|
|
3436
|
+
if (header instanceof import_ui4.RichText) header.setMaxWidth(availableWidth);
|
|
3437
|
+
const indent = Math.round(this.theme.fontSize);
|
|
3438
|
+
const childWidth = Math.max(1, availableWidth - indent);
|
|
3439
|
+
let index = 1;
|
|
3440
|
+
for (const inner of fnToken.tokens) {
|
|
3441
|
+
if (!this.producesEntity(inner)) continue;
|
|
3442
|
+
const wrapper = entity.children[index++];
|
|
3443
|
+
if (!wrapper) break;
|
|
3444
|
+
const block = wrapper.children[0];
|
|
3445
|
+
if (!block) continue;
|
|
3446
|
+
this.reflowToken(inner, block, childWidth);
|
|
3447
|
+
block.x = indent;
|
|
3448
|
+
wrapper.width = block.width + indent;
|
|
3449
|
+
wrapper.height = block.height;
|
|
3450
|
+
}
|
|
3451
|
+
entity.layout();
|
|
3452
|
+
}
|
|
2619
3453
|
return;
|
|
2620
3454
|
}
|
|
2621
3455
|
default: {
|
|
@@ -3116,7 +3950,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3116
3950
|
literalParagraphSpans(token) {
|
|
3117
3951
|
const spans = [];
|
|
3118
3952
|
if (token.tokens && token.tokens.length > 0) {
|
|
3119
|
-
collectSpans(token.tokens, {}, this.theme, spans);
|
|
3953
|
+
collectSpans(token.tokens, {}, this.theme, spans, void 0, this.abbreviations);
|
|
3120
3954
|
}
|
|
3121
3955
|
if (spans.length === 0) spans.push({ text: token.text });
|
|
3122
3956
|
return spans;
|
|
@@ -3161,7 +3995,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3161
3995
|
*/
|
|
3162
3996
|
tableCellSpans(cell, t) {
|
|
3163
3997
|
const spans = [];
|
|
3164
|
-
collectSpans(cell.tokens, {}, t, spans);
|
|
3998
|
+
collectSpans(cell.tokens, {}, t, spans, void 0, this.abbreviations);
|
|
3165
3999
|
if (spans.length === 0) spans.push({ text: decodeEntities(cell.text) });
|
|
3166
4000
|
return spans;
|
|
3167
4001
|
}
|
|
@@ -3179,7 +4013,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3179
4013
|
*/
|
|
3180
4014
|
inlineRunSpans(tokens, t) {
|
|
3181
4015
|
const spans = [];
|
|
3182
|
-
if (tokens.length > 0) collectSpans(tokens, {}, t, spans);
|
|
4016
|
+
if (tokens.length > 0) collectSpans(tokens, {}, t, spans, void 0, this.abbreviations);
|
|
3183
4017
|
if (spans.length === 0) spans.push({ text: "" });
|
|
3184
4018
|
return spans;
|
|
3185
4019
|
}
|
|
@@ -3442,14 +4276,18 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3442
4276
|
inner.tokens,
|
|
3443
4277
|
{},
|
|
3444
4278
|
this.theme,
|
|
3445
|
-
contentSpans
|
|
4279
|
+
contentSpans,
|
|
4280
|
+
void 0,
|
|
4281
|
+
this.abbreviations
|
|
3446
4282
|
);
|
|
3447
4283
|
} else if ("tokens" in inner && inner.tokens?.length) {
|
|
3448
4284
|
collectSpans(
|
|
3449
4285
|
inner.tokens,
|
|
3450
4286
|
{},
|
|
3451
4287
|
this.theme,
|
|
3452
|
-
contentSpans
|
|
4288
|
+
contentSpans,
|
|
4289
|
+
void 0,
|
|
4290
|
+
this.abbreviations
|
|
3453
4291
|
);
|
|
3454
4292
|
} else if ("text" in inner) {
|
|
3455
4293
|
contentSpans.push({ text: decodeEntities(inner.text) });
|
|
@@ -3723,7 +4561,7 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3723
4561
|
headingSpans(token) {
|
|
3724
4562
|
const spans = [];
|
|
3725
4563
|
if (token.tokens && token.tokens.length > 0) {
|
|
3726
|
-
collectSpans(token.tokens, {}, this.theme, spans);
|
|
4564
|
+
collectSpans(token.tokens, {}, this.theme, spans, void 0, this.abbreviations);
|
|
3727
4565
|
}
|
|
3728
4566
|
if (spans.length === 0) spans.push({ text: decodeEntities(token.text) });
|
|
3729
4567
|
return spans;
|
|
@@ -3764,7 +4602,14 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3764
4602
|
if (!found) return null;
|
|
3765
4603
|
const spans = [];
|
|
3766
4604
|
if (inline.length > runLength) {
|
|
3767
|
-
collectSpans(
|
|
4605
|
+
collectSpans(
|
|
4606
|
+
inline.slice(0, -runLength),
|
|
4607
|
+
{},
|
|
4608
|
+
this.theme,
|
|
4609
|
+
spans,
|
|
4610
|
+
void 0,
|
|
4611
|
+
this.abbreviations
|
|
4612
|
+
);
|
|
3768
4613
|
}
|
|
3769
4614
|
const head = runText.slice(0, found.at);
|
|
3770
4615
|
if (head) spans.push({ text: decodeEntities(head) });
|
|
@@ -3957,6 +4802,10 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
3957
4802
|
}
|
|
3958
4803
|
}
|
|
3959
4804
|
}
|
|
4805
|
+
const newAbbreviations = collectAbbreviations(newTokens);
|
|
4806
|
+
const abbreviationsChanged = !mapsEqual(this.abbreviations, newAbbreviations);
|
|
4807
|
+
if (abbreviationsChanged) matchLen = 0;
|
|
4808
|
+
this.abbreviations = newAbbreviations;
|
|
3960
4809
|
const oldTokenToChild = this.tokenChildPrefix;
|
|
3961
4810
|
const rawMatchLen = matchLen;
|
|
3962
4811
|
let pendingTail = null;
|
|
@@ -4124,6 +4973,10 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4124
4973
|
// It renders its own block, so it produces an entity — see `renderToken`'s
|
|
4125
4974
|
// arm for why in place rather than collected into a document footer.
|
|
4126
4975
|
case "footnoteDef":
|
|
4976
|
+
// A `ContainerToken` carries `tokens`, not `text`, so it would otherwise
|
|
4977
|
+
// fail the `default:` arm's `'text' in token` fallback check entirely —
|
|
4978
|
+
// the same trap `footnoteDef` above already documents.
|
|
4979
|
+
case "container":
|
|
4127
4980
|
return true;
|
|
4128
4981
|
default:
|
|
4129
4982
|
return "text" in token;
|
|
@@ -4212,7 +5065,8 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4212
5065
|
availableWidth,
|
|
4213
5066
|
t,
|
|
4214
5067
|
this.selectable,
|
|
4215
|
-
this.onLinkClick
|
|
5068
|
+
this.onLinkClick,
|
|
5069
|
+
this.abbreviations
|
|
4216
5070
|
);
|
|
4217
5071
|
}
|
|
4218
5072
|
// ── Paragraphs ───────────────────────────────────────────────────
|
|
@@ -4227,7 +5081,8 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4227
5081
|
availableWidth,
|
|
4228
5082
|
t,
|
|
4229
5083
|
this.selectable,
|
|
4230
|
-
this.onLinkClick
|
|
5084
|
+
this.onLinkClick,
|
|
5085
|
+
this.abbreviations
|
|
4231
5086
|
);
|
|
4232
5087
|
}
|
|
4233
5088
|
const stack = new import_ui4.Stack({
|
|
@@ -4270,6 +5125,22 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4270
5125
|
const mathBlock = this.renderDisplayMath(codeToken.text, availableWidth);
|
|
4271
5126
|
if (mathBlock) return mathBlock;
|
|
4272
5127
|
}
|
|
5128
|
+
if (hasFencedBlockRenderer(lang)) {
|
|
5129
|
+
ensureFencedBlockRenderer(lang);
|
|
5130
|
+
if (isFenceClosed(codeToken.raw)) {
|
|
5131
|
+
const rendered = renderFencedBlock(codeToken.text, lang, {
|
|
5132
|
+
theme: t,
|
|
5133
|
+
availableWidth,
|
|
5134
|
+
selectable: this.selectable
|
|
5135
|
+
});
|
|
5136
|
+
if (rendered) {
|
|
5137
|
+
return this.withBlockAffordances(
|
|
5138
|
+
rendered,
|
|
5139
|
+
() => this.codeBlockAffordances(codeToken.text, lang)
|
|
5140
|
+
);
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
4273
5144
|
return this.withBlockAffordances(
|
|
4274
5145
|
new CodeBlock(codeToken.text, lang, availableWidth, t, this.selectable),
|
|
4275
5146
|
() => this.codeBlockAffordances(codeToken.text, lang)
|
|
@@ -4326,6 +5197,54 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4326
5197
|
container.height = Math.max(border.height, innerStack.height);
|
|
4327
5198
|
return container;
|
|
4328
5199
|
}
|
|
5200
|
+
// ── `:::` fenced containers ─────────────────────────────────────
|
|
5201
|
+
case "container": {
|
|
5202
|
+
const ctToken = token;
|
|
5203
|
+
const accent = containerColor(t, ctToken.kind);
|
|
5204
|
+
const innerStack = new import_ui4.Stack({
|
|
5205
|
+
direction: "vertical",
|
|
5206
|
+
gap: t.containerInnerGap
|
|
5207
|
+
});
|
|
5208
|
+
const indentStart = Math.min(t.containerIndent, availableWidth);
|
|
5209
|
+
const childMetrics = {
|
|
5210
|
+
marginBefore: 0,
|
|
5211
|
+
marginAfter: 0,
|
|
5212
|
+
indentStart,
|
|
5213
|
+
availableWidth: Math.max(0, availableWidth - indentStart)
|
|
5214
|
+
};
|
|
5215
|
+
for (const inner of ctToken.tokens) {
|
|
5216
|
+
const el = this.renderTokenWithMetrics(inner, childMetrics);
|
|
5217
|
+
if (el) {
|
|
5218
|
+
const wrapper2 = new MarkdownContainer();
|
|
5219
|
+
el.x = childMetrics.indentStart;
|
|
5220
|
+
wrapper2.add(el);
|
|
5221
|
+
wrapper2.width = el.width + childMetrics.indentStart;
|
|
5222
|
+
wrapper2.height = el.height;
|
|
5223
|
+
innerStack.add(wrapper2);
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
const contentHeight = innerStack.height || 20;
|
|
5227
|
+
const background = new ContainerBackground(
|
|
5228
|
+
availableWidth,
|
|
5229
|
+
contentHeight,
|
|
5230
|
+
t.containerBgColor,
|
|
5231
|
+
t.containerRadius
|
|
5232
|
+
);
|
|
5233
|
+
const border = new QuoteBorder(contentHeight, accent, t.containerBorderWidth);
|
|
5234
|
+
const wrapper = new MarkdownContainer();
|
|
5235
|
+
background.x = 0;
|
|
5236
|
+
background.y = 0;
|
|
5237
|
+
wrapper.add(background);
|
|
5238
|
+
border.x = 0;
|
|
5239
|
+
border.y = 0;
|
|
5240
|
+
wrapper.add(border);
|
|
5241
|
+
innerStack.x = 0;
|
|
5242
|
+
innerStack.y = 0;
|
|
5243
|
+
wrapper.add(innerStack);
|
|
5244
|
+
wrapper.width = availableWidth;
|
|
5245
|
+
wrapper.height = Math.max(background.height, border.height, innerStack.height);
|
|
5246
|
+
return wrapper;
|
|
5247
|
+
}
|
|
4329
5248
|
// ── Lists ────────────────────────────────────────────────
|
|
4330
5249
|
case "list": {
|
|
4331
5250
|
const listToken = token;
|
|
@@ -4369,20 +5288,43 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4369
5288
|
// ── Footnote definition (`[^1]: note`) ───────────────────────────
|
|
4370
5289
|
case "footnoteDef": {
|
|
4371
5290
|
const fnToken = token;
|
|
4372
|
-
const
|
|
5291
|
+
const headerSpans = [
|
|
4373
5292
|
{
|
|
4374
5293
|
text: footnoteMarker(fnToken.label),
|
|
4375
5294
|
style: { color: t.footnoteColor }
|
|
4376
5295
|
},
|
|
4377
5296
|
{ text: " " }
|
|
4378
5297
|
];
|
|
4379
|
-
if (fnToken.body)
|
|
4380
|
-
|
|
5298
|
+
if (fnToken.body) headerSpans.push({ text: decodeEntities(fnToken.body) });
|
|
5299
|
+
const headerRichText = new import_ui4.RichText(headerSpans, {
|
|
4381
5300
|
font: bodyFont,
|
|
4382
5301
|
color: t.textColor,
|
|
4383
5302
|
maxWidth: availableWidth,
|
|
4384
5303
|
selectable: this.selectable
|
|
4385
5304
|
});
|
|
5305
|
+
if (!fnToken.tokens || fnToken.tokens.length === 0) {
|
|
5306
|
+
return headerRichText;
|
|
5307
|
+
}
|
|
5308
|
+
const indent = Math.round(t.fontSize);
|
|
5309
|
+
const childMetrics = {
|
|
5310
|
+
marginBefore: 0,
|
|
5311
|
+
marginAfter: 0,
|
|
5312
|
+
indentStart: indent,
|
|
5313
|
+
availableWidth: Math.max(1, availableWidth - indent)
|
|
5314
|
+
};
|
|
5315
|
+
const stack = new import_ui4.Stack({ direction: "vertical", gap: t.listItemGap });
|
|
5316
|
+
stack.add(headerRichText);
|
|
5317
|
+
for (const inner of fnToken.tokens) {
|
|
5318
|
+
const el = this.renderTokenWithMetrics(inner, childMetrics);
|
|
5319
|
+
if (!el) continue;
|
|
5320
|
+
const wrapper = new MarkdownContainer();
|
|
5321
|
+
el.x = indent;
|
|
5322
|
+
wrapper.add(el);
|
|
5323
|
+
wrapper.width = el.width + indent;
|
|
5324
|
+
wrapper.height = el.height;
|
|
5325
|
+
stack.add(wrapper);
|
|
5326
|
+
}
|
|
5327
|
+
return stack;
|
|
4386
5328
|
}
|
|
4387
5329
|
// ── Horizontal rule ──────────────────────────────────────────────
|
|
4388
5330
|
case "hr":
|
|
@@ -4423,18 +5365,27 @@ var Markdown = class _Markdown extends import_ui4.UIComponent {
|
|
|
4423
5365
|
CodeBlock,
|
|
4424
5366
|
Markdown,
|
|
4425
5367
|
MathBlock,
|
|
5368
|
+
PRESET_THEMES,
|
|
4426
5369
|
codeAtlas,
|
|
4427
5370
|
codeAtlasStats,
|
|
5371
|
+
ensureFencedBlockRenderer,
|
|
4428
5372
|
escapeCsvField,
|
|
4429
5373
|
escapeMarkdownTableCell,
|
|
4430
5374
|
extensionForLanguage,
|
|
4431
5375
|
footnoteMarker,
|
|
5376
|
+
hasFencedBlockRenderer,
|
|
5377
|
+
isFencedBlockRendererReady,
|
|
4432
5378
|
isMathJaxReady,
|
|
5379
|
+
isPresetName,
|
|
4433
5380
|
mimeForLanguage,
|
|
4434
5381
|
parseFrontMatterFields,
|
|
4435
5382
|
preloadMathJax,
|
|
5383
|
+
registerFencedBlockRenderer,
|
|
5384
|
+
renderFencedBlock,
|
|
5385
|
+
resolvePresetTheme,
|
|
4436
5386
|
scanFrontMatter,
|
|
4437
5387
|
tableContentOf,
|
|
4438
5388
|
tableToCsv,
|
|
4439
|
-
tableToMarkdown
|
|
5389
|
+
tableToMarkdown,
|
|
5390
|
+
unregisterFencedBlockRenderer
|
|
4440
5391
|
});
|