@burdenoff/microfe-support 2026.510.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +290 -0
  2. package/dist/generated/global-operations.js +1118 -0
  3. package/dist/generated/global-operations.js.map +1 -0
  4. package/dist/generated/global-types.js +20 -0
  5. package/dist/generated/global-types.js.map +1 -0
  6. package/dist/index.js +11 -0
  7. package/dist/microfe-support.css +2 -0
  8. package/dist/node_modules/clsx/dist/clsx.js +18 -0
  9. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  10. package/dist/node_modules/dompurify/dist/purify.es.js +555 -0
  11. package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
  12. package/dist/node_modules/marked/lib/marked.esm.js +1430 -0
  13. package/dist/node_modules/marked/lib/marked.esm.js.map +1 -0
  14. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +1674 -0
  15. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  16. package/dist/support/SupportAdminRoot.js +69 -0
  17. package/dist/support/SupportAdminRoot.js.map +1 -0
  18. package/dist/support/SupportAdminRoutes.js +73 -0
  19. package/dist/support/SupportAdminRoutes.js.map +1 -0
  20. package/dist/support/SupportUserRoot.js +42 -0
  21. package/dist/support/SupportUserRoot.js.map +1 -0
  22. package/dist/support/SupportUserRoutes.js +49 -0
  23. package/dist/support/SupportUserRoutes.js.map +1 -0
  24. package/dist/support/components/NotificationToast.js +34 -0
  25. package/dist/support/components/NotificationToast.js.map +1 -0
  26. package/dist/support/components/PageLayout.js +87 -0
  27. package/dist/support/components/PageLayout.js.map +1 -0
  28. package/dist/support/components/RouteHelpers.js +22 -0
  29. package/dist/support/components/RouteHelpers.js.map +1 -0
  30. package/dist/support/components/analytics/CategoryBreakdown.js +63 -0
  31. package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -0
  32. package/dist/support/components/analytics/MetricCard.js +31 -0
  33. package/dist/support/components/analytics/MetricCard.js.map +1 -0
  34. package/dist/support/components/analytics/PriorityBreakdown.js +59 -0
  35. package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -0
  36. package/dist/support/components/analytics/SLAReport.js +110 -0
  37. package/dist/support/components/analytics/SLAReport.js.map +1 -0
  38. package/dist/support/components/analytics/SatisfactionDistribution.js +150 -0
  39. package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -0
  40. package/dist/support/components/analytics/TopAgents.js +70 -0
  41. package/dist/support/components/analytics/TopAgents.js.map +1 -0
  42. package/dist/support/components/analytics/TrendChart.js +48 -0
  43. package/dist/support/components/analytics/TrendChart.js.map +1 -0
  44. package/dist/support/components/kb/ArticleForm.js +244 -0
  45. package/dist/support/components/kb/ArticleForm.js.map +1 -0
  46. package/dist/support/components/kb/index.js +1 -0
  47. package/dist/support/components/settings/CannedResponsesSettings.js +84 -0
  48. package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -0
  49. package/dist/support/components/settings/SLAPoliciesSettings.js +249 -0
  50. package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -0
  51. package/dist/support/components/settings/TicketCategoriesSettings.js +360 -0
  52. package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -0
  53. package/dist/support/components/tickets/AttachmentList.js +54 -0
  54. package/dist/support/components/tickets/AttachmentList.js.map +1 -0
  55. package/dist/support/components/tickets/MarkdownContent.js +11 -0
  56. package/dist/support/components/tickets/MarkdownContent.js.map +1 -0
  57. package/dist/support/components/tickets/MessageComposer.js +137 -0
  58. package/dist/support/components/tickets/MessageComposer.js.map +1 -0
  59. package/dist/support/components/tickets/MessageThread.js +88 -0
  60. package/dist/support/components/tickets/MessageThread.js.map +1 -0
  61. package/dist/support/components/tickets/TicketDetailHeader.js +123 -0
  62. package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -0
  63. package/dist/support/components/tickets/TicketHeader.js +191 -0
  64. package/dist/support/components/tickets/TicketHeader.js.map +1 -0
  65. package/dist/support/components/tickets/TicketSidebar.js +271 -0
  66. package/dist/support/components/tickets/TicketSidebar.js.map +1 -0
  67. package/dist/support/components/ui.js +2 -0
  68. package/dist/support/constants.js +6 -0
  69. package/dist/support/constants.js.map +1 -0
  70. package/dist/support/hooks/index.js +5 -0
  71. package/dist/support/hooks/useAnalyticsOperations.js +61 -0
  72. package/dist/support/hooks/useAnalyticsOperations.js.map +1 -0
  73. package/dist/support/hooks/useAttachmentsFailedToast.js +22 -0
  74. package/dist/support/hooks/useAttachmentsFailedToast.js.map +1 -0
  75. package/dist/support/hooks/useChatOperations.js +146 -0
  76. package/dist/support/hooks/useChatOperations.js.map +1 -0
  77. package/dist/support/hooks/useKnowledgeBaseOperations.js +194 -0
  78. package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -0
  79. package/dist/support/hooks/useNotification.js +26 -0
  80. package/dist/support/hooks/useNotification.js.map +1 -0
  81. package/dist/support/hooks/useRegisterFooter.js +17 -0
  82. package/dist/support/hooks/useRegisterFooter.js.map +1 -0
  83. package/dist/support/hooks/useSettingsOperations.js +145 -0
  84. package/dist/support/hooks/useSettingsOperations.js.map +1 -0
  85. package/dist/support/hooks/useSupportAttachments.js +37 -0
  86. package/dist/support/hooks/useSupportAttachments.js.map +1 -0
  87. package/dist/support/hooks/useTicketOperations.js +222 -0
  88. package/dist/support/hooks/useTicketOperations.js.map +1 -0
  89. package/dist/support/index.js +10 -0
  90. package/dist/support/pages/AnalyticsPage.js +206 -0
  91. package/dist/support/pages/AnalyticsPage.js.map +1 -0
  92. package/dist/support/pages/ArticleDetailAdminPage.js +350 -0
  93. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -0
  94. package/dist/support/pages/ArticleDetailUserPage.js +150 -0
  95. package/dist/support/pages/ArticleDetailUserPage.js.map +1 -0
  96. package/dist/support/pages/ContactInquiriesPage.js +314 -0
  97. package/dist/support/pages/ContactInquiriesPage.js.map +1 -0
  98. package/dist/support/pages/ContactInquiryDetailPage.js +481 -0
  99. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -0
  100. package/dist/support/pages/CreateArticlePage.js +120 -0
  101. package/dist/support/pages/CreateArticlePage.js.map +1 -0
  102. package/dist/support/pages/CreateTicketPage.js +281 -0
  103. package/dist/support/pages/CreateTicketPage.js.map +1 -0
  104. package/dist/support/pages/EditArticlePage.js +151 -0
  105. package/dist/support/pages/EditArticlePage.js.map +1 -0
  106. package/dist/support/pages/KnowledgeBaseAdminPage.js +208 -0
  107. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -0
  108. package/dist/support/pages/KnowledgeBaseUserPage.js +188 -0
  109. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -0
  110. package/dist/support/pages/SettingsPage.js +215 -0
  111. package/dist/support/pages/SettingsPage.js.map +1 -0
  112. package/dist/support/pages/TicketDetailAdminPage.js +157 -0
  113. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -0
  114. package/dist/support/pages/TicketDetailUserPage.js +292 -0
  115. package/dist/support/pages/TicketDetailUserPage.js.map +1 -0
  116. package/dist/support/pages/TicketListPage.js +337 -0
  117. package/dist/support/pages/TicketListPage.js.map +1 -0
  118. package/dist/support/providers/SupportProvider.js +40 -0
  119. package/dist/support/providers/SupportProvider.js.map +1 -0
  120. package/dist/support/store/supportStore.js +102 -0
  121. package/dist/support/store/supportStore.js.map +1 -0
  122. package/dist/support/utils/cn.js +10 -0
  123. package/dist/support/utils/cn.js.map +1 -0
  124. package/dist/support/utils/context.js +32 -0
  125. package/dist/support/utils/context.js.map +1 -0
  126. package/dist/support/utils/errors.js +13 -0
  127. package/dist/support/utils/errors.js.map +1 -0
  128. package/dist/support/utils/i18n.js +9 -0
  129. package/dist/support/utils/i18n.js.map +1 -0
  130. package/dist/support/utils/index.js +105 -0
  131. package/dist/support/utils/index.js.map +1 -0
  132. package/dist/support/utils/markdown.js +47 -0
  133. package/dist/support/utils/markdown.js.map +1 -0
  134. package/dist/support/utils/supportFiles.js +116 -0
  135. package/dist/support/utils/supportFiles.js.map +1 -0
  136. package/dist/utils/nativeBridge.js +2 -0
  137. package/package.json +145 -0
@@ -0,0 +1,1430 @@
1
+ //#region node_modules/marked/lib/marked.esm.js
2
+ function e() {
3
+ return {
4
+ async: !1,
5
+ breaks: !1,
6
+ extensions: null,
7
+ gfm: !0,
8
+ hooks: null,
9
+ pedantic: !1,
10
+ renderer: null,
11
+ silent: !1,
12
+ tokenizer: null,
13
+ walkTokens: null
14
+ };
15
+ }
16
+ var t = e();
17
+ function n(e) {
18
+ t = e;
19
+ }
20
+ var r = { exec: () => null };
21
+ function i(e, t = "") {
22
+ let n = typeof e == "string" ? e : e.source, r = {
23
+ replace: (e, t) => {
24
+ let i = typeof t == "string" ? t : t.source;
25
+ return i = i.replace(o.caret, "$1"), n = n.replace(e, i), r;
26
+ },
27
+ getRegex: () => new RegExp(n, t)
28
+ };
29
+ return r;
30
+ }
31
+ var a = (() => {
32
+ try {
33
+ return !0;
34
+ } catch {
35
+ return !1;
36
+ }
37
+ })(), o = {
38
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
39
+ outputLinkReplace: /\\([\[\]])/g,
40
+ indentCodeCompensation: /^(\s+)(?:```)/,
41
+ beginningSpace: /^\s+/,
42
+ endingHash: /#$/,
43
+ startingSpaceChar: /^ /,
44
+ endingSpaceChar: / $/,
45
+ nonSpaceChar: /[^ ]/,
46
+ newLineCharGlobal: /\n/g,
47
+ tabCharGlobal: /\t/g,
48
+ multipleSpaceGlobal: /\s+/g,
49
+ blankLine: /^[ \t]*$/,
50
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
51
+ blockquoteStart: /^ {0,3}>/,
52
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
53
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
54
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
55
+ listIsTask: /^\[[ xX]\] +\S/,
56
+ listReplaceTask: /^\[[ xX]\] +/,
57
+ listTaskCheckbox: /\[[ xX]\]/,
58
+ anyLine: /\n.*\n/,
59
+ hrefBrackets: /^<(.*)>$/,
60
+ tableDelimiter: /[:|]/,
61
+ tableAlignChars: /^\||\| *$/g,
62
+ tableRowBlankLine: /\n[ \t]*$/,
63
+ tableAlignRight: /^ *-+: *$/,
64
+ tableAlignCenter: /^ *:-+: *$/,
65
+ tableAlignLeft: /^ *:-+ *$/,
66
+ startATag: /^<a /i,
67
+ endATag: /^<\/a>/i,
68
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
69
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
70
+ startAngleBracket: /^</,
71
+ endAngleBracket: />$/,
72
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
73
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
74
+ escapeTest: /[&<>"']/,
75
+ escapeReplace: /[&<>"']/g,
76
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
77
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
78
+ caret: /(^|[^\[])\^/g,
79
+ percentDecode: /%25/g,
80
+ findPipe: /\|/g,
81
+ splitPipe: / \|/,
82
+ slashPipe: /\\\|/g,
83
+ carriageReturn: /\r\n|\r/g,
84
+ spaceLine: /^ +$/gm,
85
+ notSpaceStart: /^\S*/,
86
+ endingNewline: /\n$/,
87
+ listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
88
+ nextBulletRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
89
+ hrRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
90
+ fencesBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}(?:\`\`\`|~~~)`),
91
+ headingBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}#`),
92
+ htmlBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}<(?:[a-z].*>|!--)`, "i"),
93
+ blockquoteBeginRegex: (e) => RegExp(`^ {0,${Math.min(3, e - 1)}}>`)
94
+ }, s = /^(?:[ \t]*(?:\n|$))+/, c = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, l = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, u = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, d = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, f = / {0,3}(?:[*+-]|\d{1,9}[.)])/, p = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, m = i(p).replace(/bull/g, f).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}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ee = i(p).replace(/bull/g, f).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}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), h = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, te = /^[^\n]+/, g = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ne = i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", g).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), re = i(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, f).getRegex(), _ = "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", v = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ie = i("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", v).replace("tag", _).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), y = i(h).replace("hr", u).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), b = {
95
+ blockquote: i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", y).getRegex(),
96
+ code: c,
97
+ def: ne,
98
+ fences: l,
99
+ heading: d,
100
+ hr: u,
101
+ html: ie,
102
+ lheading: m,
103
+ list: re,
104
+ newline: s,
105
+ paragraph: y,
106
+ table: r,
107
+ text: te
108
+ }, x = i("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", u).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex(), ae = {
109
+ ...b,
110
+ lheading: ee,
111
+ table: x,
112
+ paragraph: i(h).replace("hr", u).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", x).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _).getRegex()
113
+ }, oe = {
114
+ ...b,
115
+ html: i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", v).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(),
116
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
117
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
118
+ fences: r,
119
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
120
+ paragraph: i(h).replace("hr", u).replace("heading", " *#{1,6} *[^\n]").replace("lheading", m).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
121
+ }, se = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, S = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, C = /^( {2,}|\\)\n(?!\s*$)/, ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, w = /[\p{P}\p{S}]/u, T = /[\s\p{P}\p{S}]/u, E = /[^\s\p{P}\p{S}]/u, le = i(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, T).getRegex(), D = /(?!~)[\p{P}\p{S}]/u, ue = /(?!~)[\s\p{P}\p{S}]/u, de = /(?:[^\s\p{P}\p{S}]|~)/u, O = i(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", a ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), k = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, fe = i(k, "u").replace(/punct/g, w).getRegex(), pe = i(k, "u").replace(/punct/g, D).getRegex(), A = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", me = i(A, "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), he = i(A, "gu").replace(/notPunctSpace/g, de).replace(/punctSpace/g, ue).replace(/punct/g, D).getRegex(), ge = i("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), _e = i(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, w).getRegex(), ve = i("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), ye = i(/\\(punct)/, "gu").replace(/punct/g, w).getRegex(), be = i(/^<(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(), xe = i(v).replace("(?:-->|$)", "-->").getRegex(), Se = i("^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", xe).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), j = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ce = i(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", j).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), M = i(/^!?\[(label)\]\[(ref)\]/).replace("label", j).replace("ref", g).getRegex(), N = i(/^!?\[(ref)\](?:\[\])?/).replace("ref", g).getRegex(), we = i("reflink|nolink(?!\\()", "g").replace("reflink", M).replace("nolink", N).getRegex(), P = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, F = {
122
+ _backpedal: r,
123
+ anyPunctuation: ye,
124
+ autolink: be,
125
+ blockSkip: O,
126
+ br: C,
127
+ code: S,
128
+ del: r,
129
+ delLDelim: r,
130
+ delRDelim: r,
131
+ emStrongLDelim: fe,
132
+ emStrongRDelimAst: me,
133
+ emStrongRDelimUnd: ge,
134
+ escape: se,
135
+ link: Ce,
136
+ nolink: N,
137
+ punctuation: le,
138
+ reflink: M,
139
+ reflinkSearch: we,
140
+ tag: Se,
141
+ text: ce,
142
+ url: r
143
+ }, Te = {
144
+ ...F,
145
+ link: i(/^!?\[(label)\]\((.*?)\)/).replace("label", j).getRegex(),
146
+ reflink: i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", j).getRegex()
147
+ }, I = {
148
+ ...F,
149
+ emStrongRDelimAst: he,
150
+ emStrongLDelim: pe,
151
+ delLDelim: _e,
152
+ delRDelim: ve,
153
+ url: i(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", P).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
154
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
155
+ del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
156
+ text: i(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", P).getRegex()
157
+ }, Ee = {
158
+ ...I,
159
+ br: i(C).replace("{2,}", "*").getRegex(),
160
+ text: i(I.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
161
+ }, L = {
162
+ normal: b,
163
+ gfm: ae,
164
+ pedantic: oe
165
+ }, R = {
166
+ normal: F,
167
+ gfm: I,
168
+ breaks: Ee,
169
+ pedantic: Te
170
+ }, De = {
171
+ "&": "&amp;",
172
+ "<": "&lt;",
173
+ ">": "&gt;",
174
+ "\"": "&quot;",
175
+ "'": "&#39;"
176
+ }, z = (e) => De[e];
177
+ function B(e, t) {
178
+ if (t) {
179
+ if (o.escapeTest.test(e)) return e.replace(o.escapeReplace, z);
180
+ } else if (o.escapeTestNoEncode.test(e)) return e.replace(o.escapeReplaceNoEncode, z);
181
+ return e;
182
+ }
183
+ function V(e) {
184
+ try {
185
+ e = encodeURI(e).replace(o.percentDecode, "%");
186
+ } catch {
187
+ return null;
188
+ }
189
+ return e;
190
+ }
191
+ function H(e, t) {
192
+ let n = e.replace(o.findPipe, (e, t, n) => {
193
+ let r = !1, i = t;
194
+ for (; --i >= 0 && n[i] === "\\";) r = !r;
195
+ return r ? "|" : " |";
196
+ }).split(o.splitPipe), r = 0;
197
+ if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
198
+ else for (; n.length < t;) n.push("");
199
+ for (; r < n.length; r++) n[r] = n[r].trim().replace(o.slashPipe, "|");
200
+ return n;
201
+ }
202
+ function U(e, t, n) {
203
+ let r = e.length;
204
+ if (r === 0) return "";
205
+ let i = 0;
206
+ for (; i < r;) {
207
+ let a = e.charAt(r - i - 1);
208
+ if (a === t && !n) i++;
209
+ else if (a !== t && n) i++;
210
+ else break;
211
+ }
212
+ return e.slice(0, r - i);
213
+ }
214
+ function Oe(e, t) {
215
+ if (e.indexOf(t[1]) === -1) return -1;
216
+ let n = 0;
217
+ for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
218
+ else if (e[r] === t[0]) n++;
219
+ else if (e[r] === t[1] && (n--, n < 0)) return r;
220
+ return n > 0 ? -2 : -1;
221
+ }
222
+ function ke(e, t = 0) {
223
+ let n = t, r = "";
224
+ for (let t of e) if (t === " ") {
225
+ let e = 4 - n % 4;
226
+ r += " ".repeat(e), n += e;
227
+ } else r += t, n++;
228
+ return r;
229
+ }
230
+ function W(e, t, n, r, i) {
231
+ let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
232
+ r.state.inLink = !0;
233
+ let c = {
234
+ type: e[0].charAt(0) === "!" ? "image" : "link",
235
+ raw: n,
236
+ href: a,
237
+ title: o,
238
+ text: s,
239
+ tokens: r.inlineTokens(s)
240
+ };
241
+ return r.state.inLink = !1, c;
242
+ }
243
+ function Ae(e, t, n) {
244
+ let r = e.match(n.other.indentCodeCompensation);
245
+ if (r === null) return t;
246
+ let i = r[1];
247
+ return t.split("\n").map((e) => {
248
+ let t = e.match(n.other.beginningSpace);
249
+ if (t === null) return e;
250
+ let [r] = t;
251
+ return r.length >= i.length ? e.slice(i.length) : e;
252
+ }).join("\n");
253
+ }
254
+ var G = class {
255
+ options;
256
+ rules;
257
+ lexer;
258
+ constructor(e) {
259
+ this.options = e || t;
260
+ }
261
+ space(e) {
262
+ let t = this.rules.block.newline.exec(e);
263
+ if (t && t[0].length > 0) return {
264
+ type: "space",
265
+ raw: t[0]
266
+ };
267
+ }
268
+ code(e) {
269
+ let t = this.rules.block.code.exec(e);
270
+ if (t) {
271
+ let e = t[0].replace(this.rules.other.codeRemoveIndent, "");
272
+ return {
273
+ type: "code",
274
+ raw: t[0],
275
+ codeBlockStyle: "indented",
276
+ text: this.options.pedantic ? e : U(e, "\n")
277
+ };
278
+ }
279
+ }
280
+ fences(e) {
281
+ let t = this.rules.block.fences.exec(e);
282
+ if (t) {
283
+ let e = t[0], n = Ae(e, t[3] || "", this.rules);
284
+ return {
285
+ type: "code",
286
+ raw: e,
287
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
288
+ text: n
289
+ };
290
+ }
291
+ }
292
+ heading(e) {
293
+ let t = this.rules.block.heading.exec(e);
294
+ if (t) {
295
+ let e = t[2].trim();
296
+ if (this.rules.other.endingHash.test(e)) {
297
+ let t = U(e, "#");
298
+ (this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
299
+ }
300
+ return {
301
+ type: "heading",
302
+ raw: t[0],
303
+ depth: t[1].length,
304
+ text: e,
305
+ tokens: this.lexer.inline(e)
306
+ };
307
+ }
308
+ }
309
+ hr(e) {
310
+ let t = this.rules.block.hr.exec(e);
311
+ if (t) return {
312
+ type: "hr",
313
+ raw: U(t[0], "\n")
314
+ };
315
+ }
316
+ blockquote(e) {
317
+ let t = this.rules.block.blockquote.exec(e);
318
+ if (t) {
319
+ let e = U(t[0], "\n").split("\n"), n = "", r = "", i = [];
320
+ for (; e.length > 0;) {
321
+ let t = !1, a = [], o;
322
+ for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
323
+ else if (!t) a.push(e[o]);
324
+ else break;
325
+ e = e.slice(o);
326
+ let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
327
+ n = n ? `${n}
328
+ ${s}` : s, r = r ? `${r}
329
+ ${c}` : c;
330
+ let l = this.lexer.state.top;
331
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
332
+ let u = i.at(-1);
333
+ if (u?.type === "code") break;
334
+ if (u?.type === "blockquote") {
335
+ let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
336
+ i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
337
+ break;
338
+ } else if (u?.type === "list") {
339
+ let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
340
+ i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
341
+ continue;
342
+ }
343
+ }
344
+ return {
345
+ type: "blockquote",
346
+ raw: n,
347
+ tokens: i,
348
+ text: r
349
+ };
350
+ }
351
+ }
352
+ list(e) {
353
+ let t = this.rules.block.list.exec(e);
354
+ if (t) {
355
+ let n = t[1].trim(), r = n.length > 1, i = {
356
+ type: "list",
357
+ raw: "",
358
+ ordered: r,
359
+ start: r ? +n.slice(0, -1) : "",
360
+ loose: !1,
361
+ items: []
362
+ };
363
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
364
+ let a = this.rules.other.listItemRegex(n), o = !1;
365
+ for (; e;) {
366
+ let n = !1, r = "", s = "";
367
+ if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
368
+ r = t[0], e = e.substring(r.length);
369
+ let c = ke(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
370
+ if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
371
+ let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
372
+ for (; e;) {
373
+ let p = e.split("\n", 1)[0], m;
374
+ if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
375
+ if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
376
+ else {
377
+ if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
378
+ s += "\n" + l;
379
+ }
380
+ u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
381
+ }
382
+ }
383
+ i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
384
+ type: "list_item",
385
+ raw: r,
386
+ task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
387
+ loose: !1,
388
+ text: s,
389
+ tokens: []
390
+ }), i.raw += r;
391
+ }
392
+ let s = i.items.at(-1);
393
+ if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
394
+ else return;
395
+ i.raw = i.raw.trimEnd();
396
+ for (let e of i.items) {
397
+ if (this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []), e.task) {
398
+ if (e.text = e.text.replace(this.rules.other.listReplaceTask, ""), e.tokens[0]?.type === "text" || e.tokens[0]?.type === "paragraph") {
399
+ e.tokens[0].raw = e.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), e.tokens[0].text = e.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
400
+ for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
401
+ this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
402
+ break;
403
+ }
404
+ }
405
+ let t = this.rules.other.listTaskCheckbox.exec(e.raw);
406
+ if (t) {
407
+ let n = {
408
+ type: "checkbox",
409
+ raw: t[0] + " ",
410
+ checked: t[0] !== "[ ]"
411
+ };
412
+ e.checked = n.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = n.raw + e.tokens[0].raw, e.tokens[0].text = n.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(n)) : e.tokens.unshift({
413
+ type: "paragraph",
414
+ raw: n.raw,
415
+ text: n.raw,
416
+ tokens: [n]
417
+ }) : e.tokens.unshift(n);
418
+ }
419
+ }
420
+ if (!i.loose) {
421
+ let t = e.tokens.filter((e) => e.type === "space");
422
+ i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
423
+ }
424
+ }
425
+ if (i.loose) for (let e of i.items) {
426
+ e.loose = !0;
427
+ for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
428
+ }
429
+ return i;
430
+ }
431
+ }
432
+ html(e) {
433
+ let t = this.rules.block.html.exec(e);
434
+ if (t) return {
435
+ type: "html",
436
+ block: !0,
437
+ raw: t[0],
438
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
439
+ text: t[0]
440
+ };
441
+ }
442
+ def(e) {
443
+ let t = this.rules.block.def.exec(e);
444
+ if (t) {
445
+ let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
446
+ return {
447
+ type: "def",
448
+ tag: e,
449
+ raw: t[0],
450
+ href: n,
451
+ title: r
452
+ };
453
+ }
454
+ }
455
+ table(e) {
456
+ let t = this.rules.block.table.exec(e);
457
+ if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
458
+ let n = H(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
459
+ type: "table",
460
+ raw: t[0],
461
+ header: [],
462
+ align: [],
463
+ rows: []
464
+ };
465
+ if (n.length === r.length) {
466
+ for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
467
+ for (let e = 0; e < n.length; e++) a.header.push({
468
+ text: n[e],
469
+ tokens: this.lexer.inline(n[e]),
470
+ header: !0,
471
+ align: a.align[e]
472
+ });
473
+ for (let e of i) a.rows.push(H(e, a.header.length).map((e, t) => ({
474
+ text: e,
475
+ tokens: this.lexer.inline(e),
476
+ header: !1,
477
+ align: a.align[t]
478
+ })));
479
+ return a;
480
+ }
481
+ }
482
+ lheading(e) {
483
+ let t = this.rules.block.lheading.exec(e);
484
+ if (t) {
485
+ let e = t[1].trim();
486
+ return {
487
+ type: "heading",
488
+ raw: t[0],
489
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
490
+ text: e,
491
+ tokens: this.lexer.inline(e)
492
+ };
493
+ }
494
+ }
495
+ paragraph(e) {
496
+ let t = this.rules.block.paragraph.exec(e);
497
+ if (t) {
498
+ let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
499
+ return {
500
+ type: "paragraph",
501
+ raw: t[0],
502
+ text: e,
503
+ tokens: this.lexer.inline(e)
504
+ };
505
+ }
506
+ }
507
+ text(e) {
508
+ let t = this.rules.block.text.exec(e);
509
+ if (t) return {
510
+ type: "text",
511
+ raw: t[0],
512
+ text: t[0],
513
+ tokens: this.lexer.inline(t[0])
514
+ };
515
+ }
516
+ escape(e) {
517
+ let t = this.rules.inline.escape.exec(e);
518
+ if (t) return {
519
+ type: "escape",
520
+ raw: t[0],
521
+ text: t[1]
522
+ };
523
+ }
524
+ tag(e) {
525
+ let t = this.rules.inline.tag.exec(e);
526
+ if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
527
+ type: "html",
528
+ raw: t[0],
529
+ inLink: this.lexer.state.inLink,
530
+ inRawBlock: this.lexer.state.inRawBlock,
531
+ block: !1,
532
+ text: t[0]
533
+ };
534
+ }
535
+ link(e) {
536
+ let t = this.rules.inline.link.exec(e);
537
+ if (t) {
538
+ let e = t[2].trim();
539
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
540
+ if (!this.rules.other.endAngleBracket.test(e)) return;
541
+ let t = U(e.slice(0, -1), "\\");
542
+ if ((e.length - t.length) % 2 == 0) return;
543
+ } else {
544
+ let e = Oe(t[2], "()");
545
+ if (e === -2) return;
546
+ if (e > -1) {
547
+ let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
548
+ t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
549
+ }
550
+ }
551
+ let n = t[2], r = "";
552
+ if (this.options.pedantic) {
553
+ let e = this.rules.other.pedanticHrefTitle.exec(n);
554
+ e && (n = e[1], r = e[3]);
555
+ } else r = t[3] ? t[3].slice(1, -1) : "";
556
+ return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), W(t, {
557
+ href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
558
+ title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
559
+ }, t[0], this.lexer, this.rules);
560
+ }
561
+ }
562
+ reflink(e, t) {
563
+ let n;
564
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
565
+ let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
566
+ if (!e) {
567
+ let e = n[0].charAt(0);
568
+ return {
569
+ type: "text",
570
+ raw: e,
571
+ text: e
572
+ };
573
+ }
574
+ return W(n, e, n[0], this.lexer, this.rules);
575
+ }
576
+ }
577
+ emStrong(e, t, n = "") {
578
+ let r = this.rules.inline.emStrongLDelim.exec(e);
579
+ if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
580
+ let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
581
+ for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) !== null;) {
582
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
583
+ if (a = [...i].length, r[3] || r[4]) {
584
+ o += a;
585
+ continue;
586
+ } else if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
587
+ s += a;
588
+ continue;
589
+ }
590
+ if (o -= a, o > 0) continue;
591
+ a = Math.min(a, a + o + s);
592
+ let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
593
+ if (Math.min(n, a) % 2) {
594
+ let e = c.slice(1, -1);
595
+ return {
596
+ type: "em",
597
+ raw: c,
598
+ text: e,
599
+ tokens: this.lexer.inlineTokens(e)
600
+ };
601
+ }
602
+ let l = c.slice(2, -2);
603
+ return {
604
+ type: "strong",
605
+ raw: c,
606
+ text: l,
607
+ tokens: this.lexer.inlineTokens(l)
608
+ };
609
+ }
610
+ }
611
+ }
612
+ codespan(e) {
613
+ let t = this.rules.inline.code.exec(e);
614
+ if (t) {
615
+ let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
616
+ return n && r && (e = e.substring(1, e.length - 1)), {
617
+ type: "codespan",
618
+ raw: t[0],
619
+ text: e
620
+ };
621
+ }
622
+ }
623
+ br(e) {
624
+ let t = this.rules.inline.br.exec(e);
625
+ if (t) return {
626
+ type: "br",
627
+ raw: t[0]
628
+ };
629
+ }
630
+ del(e, t, n = "") {
631
+ let r = this.rules.inline.delLDelim.exec(e);
632
+ if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
633
+ let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
634
+ for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
635
+ if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
636
+ if (r[3] || r[4]) {
637
+ o += a;
638
+ continue;
639
+ }
640
+ if (o -= a, o > 0) continue;
641
+ a = Math.min(a, a + o);
642
+ let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
643
+ return {
644
+ type: "del",
645
+ raw: s,
646
+ text: c,
647
+ tokens: this.lexer.inlineTokens(c)
648
+ };
649
+ }
650
+ }
651
+ }
652
+ autolink(e) {
653
+ let t = this.rules.inline.autolink.exec(e);
654
+ if (t) {
655
+ let e, n;
656
+ return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
657
+ type: "link",
658
+ raw: t[0],
659
+ text: e,
660
+ href: n,
661
+ tokens: [{
662
+ type: "text",
663
+ raw: e,
664
+ text: e
665
+ }]
666
+ };
667
+ }
668
+ }
669
+ url(e) {
670
+ let t;
671
+ if (t = this.rules.inline.url.exec(e)) {
672
+ let e, n;
673
+ if (t[2] === "@") e = t[0], n = "mailto:" + e;
674
+ else {
675
+ let r;
676
+ do
677
+ r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
678
+ while (r !== t[0]);
679
+ e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
680
+ }
681
+ return {
682
+ type: "link",
683
+ raw: t[0],
684
+ text: e,
685
+ href: n,
686
+ tokens: [{
687
+ type: "text",
688
+ raw: e,
689
+ text: e
690
+ }]
691
+ };
692
+ }
693
+ }
694
+ inlineText(e) {
695
+ let t = this.rules.inline.text.exec(e);
696
+ if (t) {
697
+ let e = this.lexer.state.inRawBlock;
698
+ return {
699
+ type: "text",
700
+ raw: t[0],
701
+ text: t[0],
702
+ escaped: e
703
+ };
704
+ }
705
+ }
706
+ }, K = class e {
707
+ tokens;
708
+ options;
709
+ state;
710
+ inlineQueue;
711
+ tokenizer;
712
+ constructor(e) {
713
+ this.tokens = [], this.tokens.links = Object.create(null), this.options = e || t, this.options.tokenizer = this.options.tokenizer || new G(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
714
+ inLink: !1,
715
+ inRawBlock: !1,
716
+ top: !0
717
+ };
718
+ let n = {
719
+ other: o,
720
+ block: L.normal,
721
+ inline: R.normal
722
+ };
723
+ this.options.pedantic ? (n.block = L.pedantic, n.inline = R.pedantic) : this.options.gfm && (n.block = L.gfm, this.options.breaks ? n.inline = R.breaks : n.inline = R.gfm), this.tokenizer.rules = n;
724
+ }
725
+ static get rules() {
726
+ return {
727
+ block: L,
728
+ inline: R
729
+ };
730
+ }
731
+ static lex(t, n) {
732
+ return new e(n).lex(t);
733
+ }
734
+ static lexInline(t, n) {
735
+ return new e(n).inlineTokens(t);
736
+ }
737
+ lex(e) {
738
+ e = e.replace(o.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
739
+ for (let e = 0; e < this.inlineQueue.length; e++) {
740
+ let t = this.inlineQueue[e];
741
+ this.inlineTokens(t.src, t.tokens);
742
+ }
743
+ return this.inlineQueue = [], this.tokens;
744
+ }
745
+ blockTokens(e, t = [], n = !1) {
746
+ for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(o.tabCharGlobal, " ").replace(o.spaceLine, "")); e;) {
747
+ let r;
748
+ if (this.options.extensions?.block?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
749
+ if (r = this.tokenizer.space(e)) {
750
+ e = e.substring(r.raw.length);
751
+ let n = t.at(-1);
752
+ r.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(r);
753
+ continue;
754
+ }
755
+ if (r = this.tokenizer.code(e)) {
756
+ e = e.substring(r.raw.length);
757
+ let n = t.at(-1);
758
+ n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.text, this.inlineQueue.at(-1).src = n.text) : t.push(r);
759
+ continue;
760
+ }
761
+ if (r = this.tokenizer.fences(e)) {
762
+ e = e.substring(r.raw.length), t.push(r);
763
+ continue;
764
+ }
765
+ if (r = this.tokenizer.heading(e)) {
766
+ e = e.substring(r.raw.length), t.push(r);
767
+ continue;
768
+ }
769
+ if (r = this.tokenizer.hr(e)) {
770
+ e = e.substring(r.raw.length), t.push(r);
771
+ continue;
772
+ }
773
+ if (r = this.tokenizer.blockquote(e)) {
774
+ e = e.substring(r.raw.length), t.push(r);
775
+ continue;
776
+ }
777
+ if (r = this.tokenizer.list(e)) {
778
+ e = e.substring(r.raw.length), t.push(r);
779
+ continue;
780
+ }
781
+ if (r = this.tokenizer.html(e)) {
782
+ e = e.substring(r.raw.length), t.push(r);
783
+ continue;
784
+ }
785
+ if (r = this.tokenizer.def(e)) {
786
+ e = e.substring(r.raw.length);
787
+ let n = t.at(-1);
788
+ n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
789
+ href: r.href,
790
+ title: r.title
791
+ }, t.push(r));
792
+ continue;
793
+ }
794
+ if (r = this.tokenizer.table(e)) {
795
+ e = e.substring(r.raw.length), t.push(r);
796
+ continue;
797
+ }
798
+ if (r = this.tokenizer.lheading(e)) {
799
+ e = e.substring(r.raw.length), t.push(r);
800
+ continue;
801
+ }
802
+ let i = e;
803
+ if (this.options.extensions?.startBlock) {
804
+ let t = Infinity, n = e.slice(1), r;
805
+ this.options.extensions.startBlock.forEach((e) => {
806
+ r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
807
+ }), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
808
+ }
809
+ if (this.state.top && (r = this.tokenizer.paragraph(i))) {
810
+ let a = t.at(-1);
811
+ n && a?.type === "paragraph" ? (a.raw += (a.raw.endsWith("\n") ? "" : "\n") + r.raw, a.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
812
+ continue;
813
+ }
814
+ if (r = this.tokenizer.text(e)) {
815
+ e = e.substring(r.raw.length);
816
+ let n = t.at(-1);
817
+ n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + r.raw, n.text += "\n" + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(r);
818
+ continue;
819
+ }
820
+ if (e) {
821
+ let t = "Infinite loop on byte: " + e.charCodeAt(0);
822
+ if (this.options.silent) {
823
+ console.error(t);
824
+ break;
825
+ } else throw Error(t);
826
+ }
827
+ }
828
+ return this.state.top = !0, t;
829
+ }
830
+ inline(e, t = []) {
831
+ return this.inlineQueue.push({
832
+ src: e,
833
+ tokens: t
834
+ }), t;
835
+ }
836
+ inlineTokens(e, t = []) {
837
+ this.tokenizer.lexer = this;
838
+ let n = e, r = null;
839
+ if (this.tokens.links) {
840
+ let e = Object.keys(this.tokens.links);
841
+ if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
842
+ }
843
+ for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
844
+ let i;
845
+ for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
846
+ n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
847
+ let a = !1, o = "";
848
+ for (; e;) {
849
+ a || (o = ""), a = !1;
850
+ let r;
851
+ if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
852
+ if (r = this.tokenizer.escape(e)) {
853
+ e = e.substring(r.raw.length), t.push(r);
854
+ continue;
855
+ }
856
+ if (r = this.tokenizer.tag(e)) {
857
+ e = e.substring(r.raw.length), t.push(r);
858
+ continue;
859
+ }
860
+ if (r = this.tokenizer.link(e)) {
861
+ e = e.substring(r.raw.length), t.push(r);
862
+ continue;
863
+ }
864
+ if (r = this.tokenizer.reflink(e, this.tokens.links)) {
865
+ e = e.substring(r.raw.length);
866
+ let n = t.at(-1);
867
+ r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
868
+ continue;
869
+ }
870
+ if (r = this.tokenizer.emStrong(e, n, o)) {
871
+ e = e.substring(r.raw.length), t.push(r);
872
+ continue;
873
+ }
874
+ if (r = this.tokenizer.codespan(e)) {
875
+ e = e.substring(r.raw.length), t.push(r);
876
+ continue;
877
+ }
878
+ if (r = this.tokenizer.br(e)) {
879
+ e = e.substring(r.raw.length), t.push(r);
880
+ continue;
881
+ }
882
+ if (r = this.tokenizer.del(e, n, o)) {
883
+ e = e.substring(r.raw.length), t.push(r);
884
+ continue;
885
+ }
886
+ if (r = this.tokenizer.autolink(e)) {
887
+ e = e.substring(r.raw.length), t.push(r);
888
+ continue;
889
+ }
890
+ if (!this.state.inLink && (r = this.tokenizer.url(e))) {
891
+ e = e.substring(r.raw.length), t.push(r);
892
+ continue;
893
+ }
894
+ let i = e;
895
+ if (this.options.extensions?.startInline) {
896
+ let t = Infinity, n = e.slice(1), r;
897
+ this.options.extensions.startInline.forEach((e) => {
898
+ r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
899
+ }), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
900
+ }
901
+ if (r = this.tokenizer.inlineText(i)) {
902
+ e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (o = r.raw.slice(-1)), a = !0;
903
+ let n = t.at(-1);
904
+ n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
905
+ continue;
906
+ }
907
+ if (e) {
908
+ let t = "Infinite loop on byte: " + e.charCodeAt(0);
909
+ if (this.options.silent) {
910
+ console.error(t);
911
+ break;
912
+ } else throw Error(t);
913
+ }
914
+ }
915
+ return t;
916
+ }
917
+ }, q = class {
918
+ options;
919
+ parser;
920
+ constructor(e) {
921
+ this.options = e || t;
922
+ }
923
+ space(e) {
924
+ return "";
925
+ }
926
+ code({ text: e, lang: t, escaped: n }) {
927
+ let r = (t || "").match(o.notSpaceStart)?.[0], i = e.replace(o.endingNewline, "") + "\n";
928
+ return r ? "<pre><code class=\"language-" + B(r) + "\">" + (n ? i : B(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : B(i, !0)) + "</code></pre>\n";
929
+ }
930
+ blockquote({ tokens: e }) {
931
+ return `<blockquote>
932
+ ${this.parser.parse(e)}</blockquote>
933
+ `;
934
+ }
935
+ html({ text: e }) {
936
+ return e;
937
+ }
938
+ def(e) {
939
+ return "";
940
+ }
941
+ heading({ tokens: e, depth: t }) {
942
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
943
+ `;
944
+ }
945
+ hr(e) {
946
+ return "<hr>\n";
947
+ }
948
+ list(e) {
949
+ let t = e.ordered, n = e.start, r = "";
950
+ for (let t = 0; t < e.items.length; t++) {
951
+ let n = e.items[t];
952
+ r += this.listitem(n);
953
+ }
954
+ let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
955
+ return "<" + i + a + ">\n" + r + "</" + i + ">\n";
956
+ }
957
+ listitem(e) {
958
+ return `<li>${this.parser.parse(e.tokens)}</li>
959
+ `;
960
+ }
961
+ checkbox({ checked: e }) {
962
+ return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
963
+ }
964
+ paragraph({ tokens: e }) {
965
+ return `<p>${this.parser.parseInline(e)}</p>
966
+ `;
967
+ }
968
+ table(e) {
969
+ let t = "", n = "";
970
+ for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
971
+ t += this.tablerow({ text: n });
972
+ let r = "";
973
+ for (let t = 0; t < e.rows.length; t++) {
974
+ let i = e.rows[t];
975
+ n = "";
976
+ for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
977
+ r += this.tablerow({ text: n });
978
+ }
979
+ return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
980
+ }
981
+ tablerow({ text: e }) {
982
+ return `<tr>
983
+ ${e}</tr>
984
+ `;
985
+ }
986
+ tablecell(e) {
987
+ let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
988
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
989
+ `;
990
+ }
991
+ strong({ tokens: e }) {
992
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
993
+ }
994
+ em({ tokens: e }) {
995
+ return `<em>${this.parser.parseInline(e)}</em>`;
996
+ }
997
+ codespan({ text: e }) {
998
+ return `<code>${B(e, !0)}</code>`;
999
+ }
1000
+ br(e) {
1001
+ return "<br>";
1002
+ }
1003
+ del({ tokens: e }) {
1004
+ return `<del>${this.parser.parseInline(e)}</del>`;
1005
+ }
1006
+ link({ href: e, title: t, tokens: n }) {
1007
+ let r = this.parser.parseInline(n), i = V(e);
1008
+ if (i === null) return r;
1009
+ e = i;
1010
+ let a = "<a href=\"" + e + "\"";
1011
+ return t && (a += " title=\"" + B(t) + "\""), a += ">" + r + "</a>", a;
1012
+ }
1013
+ image({ href: e, title: t, text: n, tokens: r }) {
1014
+ r && (n = this.parser.parseInline(r, this.parser.textRenderer));
1015
+ let i = V(e);
1016
+ if (i === null) return B(n);
1017
+ e = i;
1018
+ let a = `<img src="${e}" alt="${B(n)}"`;
1019
+ return t && (a += ` title="${B(t)}"`), a += ">", a;
1020
+ }
1021
+ text(e) {
1022
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : B(e.text);
1023
+ }
1024
+ }, J = class {
1025
+ strong({ text: e }) {
1026
+ return e;
1027
+ }
1028
+ em({ text: e }) {
1029
+ return e;
1030
+ }
1031
+ codespan({ text: e }) {
1032
+ return e;
1033
+ }
1034
+ del({ text: e }) {
1035
+ return e;
1036
+ }
1037
+ html({ text: e }) {
1038
+ return e;
1039
+ }
1040
+ text({ text: e }) {
1041
+ return e;
1042
+ }
1043
+ link({ text: e }) {
1044
+ return "" + e;
1045
+ }
1046
+ image({ text: e }) {
1047
+ return "" + e;
1048
+ }
1049
+ br() {
1050
+ return "";
1051
+ }
1052
+ checkbox({ raw: e }) {
1053
+ return e;
1054
+ }
1055
+ }, Y = class e {
1056
+ options;
1057
+ renderer;
1058
+ textRenderer;
1059
+ constructor(e) {
1060
+ this.options = e || t, this.options.renderer = this.options.renderer || new q(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
1061
+ }
1062
+ static parse(t, n) {
1063
+ return new e(n).parse(t);
1064
+ }
1065
+ static parseInline(t, n) {
1066
+ return new e(n).parseInline(t);
1067
+ }
1068
+ parse(e) {
1069
+ this.renderer.parser = this;
1070
+ let t = "";
1071
+ for (let n = 0; n < e.length; n++) {
1072
+ let r = e[n];
1073
+ if (this.options.extensions?.renderers?.[r.type]) {
1074
+ let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
1075
+ if (n !== !1 || ![
1076
+ "space",
1077
+ "hr",
1078
+ "heading",
1079
+ "code",
1080
+ "table",
1081
+ "blockquote",
1082
+ "list",
1083
+ "html",
1084
+ "def",
1085
+ "paragraph",
1086
+ "text"
1087
+ ].includes(e.type)) {
1088
+ t += n || "";
1089
+ continue;
1090
+ }
1091
+ }
1092
+ let i = r;
1093
+ switch (i.type) {
1094
+ case "space":
1095
+ t += this.renderer.space(i);
1096
+ break;
1097
+ case "hr":
1098
+ t += this.renderer.hr(i);
1099
+ break;
1100
+ case "heading":
1101
+ t += this.renderer.heading(i);
1102
+ break;
1103
+ case "code":
1104
+ t += this.renderer.code(i);
1105
+ break;
1106
+ case "table":
1107
+ t += this.renderer.table(i);
1108
+ break;
1109
+ case "blockquote":
1110
+ t += this.renderer.blockquote(i);
1111
+ break;
1112
+ case "list":
1113
+ t += this.renderer.list(i);
1114
+ break;
1115
+ case "checkbox":
1116
+ t += this.renderer.checkbox(i);
1117
+ break;
1118
+ case "html":
1119
+ t += this.renderer.html(i);
1120
+ break;
1121
+ case "def":
1122
+ t += this.renderer.def(i);
1123
+ break;
1124
+ case "paragraph":
1125
+ t += this.renderer.paragraph(i);
1126
+ break;
1127
+ case "text":
1128
+ t += this.renderer.text(i);
1129
+ break;
1130
+ default: {
1131
+ let e = "Token with \"" + i.type + "\" type was not found.";
1132
+ if (this.options.silent) return console.error(e), "";
1133
+ throw Error(e);
1134
+ }
1135
+ }
1136
+ }
1137
+ return t;
1138
+ }
1139
+ parseInline(e, t = this.renderer) {
1140
+ this.renderer.parser = this;
1141
+ let n = "";
1142
+ for (let r = 0; r < e.length; r++) {
1143
+ let i = e[r];
1144
+ if (this.options.extensions?.renderers?.[i.type]) {
1145
+ let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1146
+ if (e !== !1 || ![
1147
+ "escape",
1148
+ "html",
1149
+ "link",
1150
+ "image",
1151
+ "strong",
1152
+ "em",
1153
+ "codespan",
1154
+ "br",
1155
+ "del",
1156
+ "text"
1157
+ ].includes(i.type)) {
1158
+ n += e || "";
1159
+ continue;
1160
+ }
1161
+ }
1162
+ let a = i;
1163
+ switch (a.type) {
1164
+ case "escape":
1165
+ n += t.text(a);
1166
+ break;
1167
+ case "html":
1168
+ n += t.html(a);
1169
+ break;
1170
+ case "link":
1171
+ n += t.link(a);
1172
+ break;
1173
+ case "image":
1174
+ n += t.image(a);
1175
+ break;
1176
+ case "checkbox":
1177
+ n += t.checkbox(a);
1178
+ break;
1179
+ case "strong":
1180
+ n += t.strong(a);
1181
+ break;
1182
+ case "em":
1183
+ n += t.em(a);
1184
+ break;
1185
+ case "codespan":
1186
+ n += t.codespan(a);
1187
+ break;
1188
+ case "br":
1189
+ n += t.br(a);
1190
+ break;
1191
+ case "del":
1192
+ n += t.del(a);
1193
+ break;
1194
+ case "text":
1195
+ n += t.text(a);
1196
+ break;
1197
+ default: {
1198
+ let e = "Token with \"" + a.type + "\" type was not found.";
1199
+ if (this.options.silent) return console.error(e), "";
1200
+ throw Error(e);
1201
+ }
1202
+ }
1203
+ }
1204
+ return n;
1205
+ }
1206
+ }, X = class {
1207
+ options;
1208
+ block;
1209
+ constructor(e) {
1210
+ this.options = e || t;
1211
+ }
1212
+ static passThroughHooks = new Set([
1213
+ "preprocess",
1214
+ "postprocess",
1215
+ "processAllTokens",
1216
+ "emStrongMask"
1217
+ ]);
1218
+ static passThroughHooksRespectAsync = new Set([
1219
+ "preprocess",
1220
+ "postprocess",
1221
+ "processAllTokens"
1222
+ ]);
1223
+ preprocess(e) {
1224
+ return e;
1225
+ }
1226
+ postprocess(e) {
1227
+ return e;
1228
+ }
1229
+ processAllTokens(e) {
1230
+ return e;
1231
+ }
1232
+ emStrongMask(e) {
1233
+ return e;
1234
+ }
1235
+ provideLexer(e = this.block) {
1236
+ return e ? K.lex : K.lexInline;
1237
+ }
1238
+ provideParser(e = this.block) {
1239
+ return e ? Y.parse : Y.parseInline;
1240
+ }
1241
+ }, Z = class {
1242
+ defaults = e();
1243
+ options = this.setOptions;
1244
+ parse = this.parseMarkdown(!0);
1245
+ parseInline = this.parseMarkdown(!1);
1246
+ Parser = Y;
1247
+ Renderer = q;
1248
+ TextRenderer = J;
1249
+ Lexer = K;
1250
+ Tokenizer = G;
1251
+ Hooks = X;
1252
+ constructor(...e) {
1253
+ this.use(...e);
1254
+ }
1255
+ walkTokens(e, t) {
1256
+ let n = [];
1257
+ for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
1258
+ case "table": {
1259
+ let e = r;
1260
+ for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
1261
+ for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
1262
+ break;
1263
+ }
1264
+ case "list": {
1265
+ let e = r;
1266
+ n = n.concat(this.walkTokens(e.items, t));
1267
+ break;
1268
+ }
1269
+ default: {
1270
+ let e = r;
1271
+ this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
1272
+ let i = e[r].flat(Infinity);
1273
+ n = n.concat(this.walkTokens(i, t));
1274
+ }) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
1275
+ }
1276
+ }
1277
+ return n;
1278
+ }
1279
+ use(...e) {
1280
+ let t = this.defaults.extensions || {
1281
+ renderers: {},
1282
+ childTokens: {}
1283
+ };
1284
+ return e.forEach((e) => {
1285
+ let n = { ...e };
1286
+ if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
1287
+ if (!e.name) throw Error("extension name required");
1288
+ if ("renderer" in e) {
1289
+ let n = t.renderers[e.name];
1290
+ n ? t.renderers[e.name] = function(...t) {
1291
+ let r = e.renderer.apply(this, t);
1292
+ return r === !1 && (r = n.apply(this, t)), r;
1293
+ } : t.renderers[e.name] = e.renderer;
1294
+ }
1295
+ if ("tokenizer" in e) {
1296
+ if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
1297
+ let n = t[e.level];
1298
+ n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
1299
+ }
1300
+ "childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
1301
+ }), n.extensions = t), e.renderer) {
1302
+ let t = this.defaults.renderer || new q(this.defaults);
1303
+ for (let n in e.renderer) {
1304
+ if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
1305
+ if (["options", "parser"].includes(n)) continue;
1306
+ let r = n, i = e.renderer[r], a = t[r];
1307
+ t[r] = (...e) => {
1308
+ let n = i.apply(t, e);
1309
+ return n === !1 && (n = a.apply(t, e)), n || "";
1310
+ };
1311
+ }
1312
+ n.renderer = t;
1313
+ }
1314
+ if (e.tokenizer) {
1315
+ let t = this.defaults.tokenizer || new G(this.defaults);
1316
+ for (let n in e.tokenizer) {
1317
+ if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
1318
+ if ([
1319
+ "options",
1320
+ "rules",
1321
+ "lexer"
1322
+ ].includes(n)) continue;
1323
+ let r = n, i = e.tokenizer[r], a = t[r];
1324
+ t[r] = (...e) => {
1325
+ let n = i.apply(t, e);
1326
+ return n === !1 && (n = a.apply(t, e)), n;
1327
+ };
1328
+ }
1329
+ n.tokenizer = t;
1330
+ }
1331
+ if (e.hooks) {
1332
+ let t = this.defaults.hooks || new X();
1333
+ for (let n in e.hooks) {
1334
+ if (!(n in t)) throw Error(`hook '${n}' does not exist`);
1335
+ if (["options", "block"].includes(n)) continue;
1336
+ let r = n, i = e.hooks[r], a = t[r];
1337
+ X.passThroughHooks.has(n) ? t[r] = (e) => {
1338
+ if (this.defaults.async && X.passThroughHooksRespectAsync.has(n)) return (async () => {
1339
+ let n = await i.call(t, e);
1340
+ return a.call(t, n);
1341
+ })();
1342
+ let r = i.call(t, e);
1343
+ return a.call(t, r);
1344
+ } : t[r] = (...e) => {
1345
+ if (this.defaults.async) return (async () => {
1346
+ let n = await i.apply(t, e);
1347
+ return n === !1 && (n = await a.apply(t, e)), n;
1348
+ })();
1349
+ let n = i.apply(t, e);
1350
+ return n === !1 && (n = a.apply(t, e)), n;
1351
+ };
1352
+ }
1353
+ n.hooks = t;
1354
+ }
1355
+ if (e.walkTokens) {
1356
+ let t = this.defaults.walkTokens, r = e.walkTokens;
1357
+ n.walkTokens = function(e) {
1358
+ let n = [];
1359
+ return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
1360
+ };
1361
+ }
1362
+ this.defaults = {
1363
+ ...this.defaults,
1364
+ ...n
1365
+ };
1366
+ }), this;
1367
+ }
1368
+ setOptions(e) {
1369
+ return this.defaults = {
1370
+ ...this.defaults,
1371
+ ...e
1372
+ }, this;
1373
+ }
1374
+ lexer(e, t) {
1375
+ return K.lex(e, t ?? this.defaults);
1376
+ }
1377
+ parser(e, t) {
1378
+ return Y.parse(e, t ?? this.defaults);
1379
+ }
1380
+ parseMarkdown(e) {
1381
+ return (t, n) => {
1382
+ let r = { ...n }, i = {
1383
+ ...this.defaults,
1384
+ ...r
1385
+ }, a = this.onError(!!i.silent, !!i.async);
1386
+ if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1387
+ if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
1388
+ if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1389
+ if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
1390
+ let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
1391
+ i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
1392
+ let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(a, i);
1393
+ return i.hooks ? await i.hooks.postprocess(o) : o;
1394
+ })().catch(a);
1395
+ try {
1396
+ i.hooks && (t = i.hooks.preprocess(t));
1397
+ let n = (i.hooks ? i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(t, i);
1398
+ i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
1399
+ let r = (i.hooks ? i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(n, i);
1400
+ return i.hooks && (r = i.hooks.postprocess(r)), r;
1401
+ } catch (e) {
1402
+ return a(e);
1403
+ }
1404
+ };
1405
+ }
1406
+ onError(e, t) {
1407
+ return (n) => {
1408
+ if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
1409
+ let e = "<p>An error occurred:</p><pre>" + B(n.message + "", !0) + "</pre>";
1410
+ return t ? Promise.resolve(e) : e;
1411
+ }
1412
+ if (t) return Promise.reject(n);
1413
+ throw n;
1414
+ };
1415
+ }
1416
+ }, Q = new Z();
1417
+ function $(e, t) {
1418
+ return Q.parse(e, t);
1419
+ }
1420
+ $.options = $.setOptions = function(e) {
1421
+ return Q.setOptions(e), $.defaults = Q.defaults, n($.defaults), $;
1422
+ }, $.getDefaults = e, $.defaults = t, $.use = function(...e) {
1423
+ return Q.use(...e), $.defaults = Q.defaults, n($.defaults), $;
1424
+ }, $.walkTokens = function(e, t) {
1425
+ return Q.walkTokens(e, t);
1426
+ }, $.parseInline = Q.parseInline, $.Parser = Y, $.parser = Y.parse, $.Renderer = q, $.TextRenderer = J, $.Lexer = K, $.lexer = K.lex, $.Tokenizer = G, $.Hooks = X, $.parse = $, $.options, $.setOptions, $.use, $.walkTokens, $.parseInline, Y.parse, K.lex;
1427
+ //#endregion
1428
+ export { Z as D, $ as g, q as y };
1429
+
1430
+ //# sourceMappingURL=marked.esm.js.map