@coderminer/vue-markdown 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/LICENSE +21 -0
  3. package/README.md +584 -3
  4. package/README.zh-CN.md +550 -0
  5. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
  6. package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
  7. package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
  8. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
  9. package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
  10. package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
  11. package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
  12. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
  13. package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
  14. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
  15. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
  16. package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
  17. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
  18. package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
  19. package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
  20. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
  21. package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
  22. package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
  23. package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
  24. package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
  25. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
  26. package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
  27. package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
  28. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
  29. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
  30. package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
  31. package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
  32. package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
  33. package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
  34. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
  35. package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
  36. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
  37. package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
  38. package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
  39. package/dist/chunks/adapters-CMwX_NEI.js +26 -0
  40. package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
  41. package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
  42. package/dist/chunks/codemirror-DyphMAEg.js +82 -0
  43. package/dist/chunks/config-aRYo2R8_.js +10 -0
  44. package/dist/chunks/context-8NfW6fxI.js +30 -0
  45. package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
  46. package/dist/chunks/default-ZQ5aHh-N.js +3 -0
  47. package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
  48. package/dist/chunks/export-BrgMLgUp.js +1574 -0
  49. package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
  50. package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
  51. package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
  52. package/dist/chunks/identity-Bi27FKyx.js +6243 -0
  53. package/dist/chunks/labels-BtHiUTQI.js +47 -0
  54. package/dist/chunks/lib-CCnkLL6S.js +252 -0
  55. package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
  56. package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
  57. package/dist/chunks/normalize-VKfQXZiK.js +226 -0
  58. package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
  59. package/dist/chunks/plugin-YWo5uqTh.js +27 -0
  60. package/dist/chunks/preset-BjaOuJUL.js +44 -0
  61. package/dist/chunks/registry-B7BfEkuy.js +6150 -0
  62. package/dist/chunks/render-DAqK0w5J.js +1754 -0
  63. package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
  64. package/dist/chunks/runtime-D95F41zG.js +574 -0
  65. package/dist/chunks/security-y4EwUyAs.js +212 -0
  66. package/dist/chunks/shared-NjFDPmkb.js +67 -0
  67. package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
  68. package/dist/chunks/url-D2BoivaE.js +24 -0
  69. package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
  70. package/dist/components/CodeBlock.d.ts +73 -0
  71. package/dist/components/CodeBlock.js +1 -0
  72. package/dist/components/Icon.d.ts +6 -0
  73. package/dist/components/MarkdownBlockquote.d.ts +18 -0
  74. package/dist/components/MarkdownBlockquote.js +1 -0
  75. package/dist/components/MarkdownBreak.d.ts +8 -0
  76. package/dist/components/MarkdownBreak.js +1 -0
  77. package/dist/components/MarkdownChildren.d.ts +17 -0
  78. package/dist/components/MarkdownCode.d.ts +29 -0
  79. package/dist/components/MarkdownCode.js +1 -0
  80. package/dist/components/MarkdownConfigProvider.d.ts +33 -0
  81. package/dist/components/MarkdownConfigProvider.js +1 -0
  82. package/dist/components/MarkdownContent.d.ts +16 -0
  83. package/dist/components/MarkdownContent.js +1 -0
  84. package/dist/components/MarkdownCustomTag.d.ts +20 -0
  85. package/dist/components/MarkdownCustomTag.js +1 -0
  86. package/dist/components/MarkdownEmphasis.d.ts +18 -0
  87. package/dist/components/MarkdownEmphasis.js +1 -0
  88. package/dist/components/MarkdownEmpty.d.ts +8 -0
  89. package/dist/components/MarkdownEmpty.js +1 -0
  90. package/dist/components/MarkdownError.d.ts +11 -0
  91. package/dist/components/MarkdownError.js +1 -0
  92. package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
  93. package/dist/components/MarkdownFootnoteReference.js +1 -0
  94. package/dist/components/MarkdownFootnotes.d.ts +17 -0
  95. package/dist/components/MarkdownFootnotes.js +1 -0
  96. package/dist/components/MarkdownHeading.d.ts +18 -0
  97. package/dist/components/MarkdownHeading.js +1 -0
  98. package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
  99. package/dist/components/MarkdownHorizontalRule.js +1 -0
  100. package/dist/components/MarkdownHtml.d.ts +8 -0
  101. package/dist/components/MarkdownHtml.js +1 -0
  102. package/dist/components/MarkdownImage.d.ts +15 -0
  103. package/dist/components/MarkdownImage.js +1 -0
  104. package/dist/components/MarkdownInlineCode.d.ts +18 -0
  105. package/dist/components/MarkdownInlineCode.js +1 -0
  106. package/dist/components/MarkdownLink.d.ts +22 -0
  107. package/dist/components/MarkdownLink.js +1 -0
  108. package/dist/components/MarkdownList.d.ts +18 -0
  109. package/dist/components/MarkdownList.js +1 -0
  110. package/dist/components/MarkdownListItem.d.ts +18 -0
  111. package/dist/components/MarkdownListItem.js +1 -0
  112. package/dist/components/MarkdownLoading.d.ts +8 -0
  113. package/dist/components/MarkdownLoading.js +1 -0
  114. package/dist/components/MarkdownMath.d.ts +12 -0
  115. package/dist/components/MarkdownMath.js +1 -0
  116. package/dist/components/MarkdownMermaid.d.ts +78 -0
  117. package/dist/components/MarkdownMermaid.js +1 -0
  118. package/dist/components/MarkdownParagraph.d.ts +18 -0
  119. package/dist/components/MarkdownParagraph.js +1 -0
  120. package/dist/components/MarkdownRenderer.d.ts +167 -0
  121. package/dist/components/MarkdownRenderer.js +1 -0
  122. package/dist/components/MarkdownRoot.d.ts +24 -0
  123. package/dist/components/MarkdownRoot.js +1 -0
  124. package/dist/components/MarkdownStrikethrough.d.ts +18 -0
  125. package/dist/components/MarkdownStrikethrough.js +1 -0
  126. package/dist/components/MarkdownStrong.d.ts +18 -0
  127. package/dist/components/MarkdownStrong.js +1 -0
  128. package/dist/components/MarkdownTable.d.ts +18 -0
  129. package/dist/components/MarkdownTable.js +1 -0
  130. package/dist/components/MarkdownTableCell.d.ts +20 -0
  131. package/dist/components/MarkdownTableCell.js +1 -0
  132. package/dist/components/MarkdownTableRow.d.ts +18 -0
  133. package/dist/components/MarkdownTableRow.js +1 -0
  134. package/dist/components/MarkdownTableSection.d.ts +18 -0
  135. package/dist/components/MarkdownTableSection.js +1 -0
  136. package/dist/components/MarkdownTaskItem.d.ts +20 -0
  137. package/dist/components/MarkdownTaskItem.js +1 -0
  138. package/dist/components/MarkdownToc.d.ts +36 -0
  139. package/dist/components/MarkdownToc.js +1 -0
  140. package/dist/components/MarkdownTocItem.d.ts +14 -0
  141. package/dist/components/MarkdownTocItem.js +1 -0
  142. package/dist/components/MermaidBlock.d.ts +50 -0
  143. package/dist/components/MermaidBlock.js +1 -0
  144. package/dist/components/MermaidLiveEditor.d.ts +44 -0
  145. package/dist/components/MermaidLiveEditor.js +1 -0
  146. package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
  147. package/dist/components/VueSyntaxHighlighter.js +1 -0
  148. package/dist/components/codeRegion.d.ts +14 -0
  149. package/dist/components/config.d.ts +7 -0
  150. package/dist/components/context.d.ts +45 -0
  151. package/dist/components/index.d.ts +42 -0
  152. package/dist/components/index.js +38 -0
  153. package/dist/components/render.d.ts +9 -0
  154. package/dist/components/scroll-lock.d.ts +7 -0
  155. package/dist/components/types.d.ts +61 -0
  156. package/dist/composables/useActiveHeading.d.ts +12 -0
  157. package/dist/composables/useCodeHighlighter.d.ts +30 -0
  158. package/dist/composables/useLineWindow.d.ts +38 -0
  159. package/dist/composables/useMarkdownDocument.d.ts +25 -0
  160. package/dist/core/adapters.d.ts +7 -0
  161. package/dist/core/config.d.ts +5 -0
  162. package/dist/core/diagnostics.d.ts +9 -0
  163. package/dist/core/finalize.d.ts +18 -0
  164. package/dist/core/hast-nodes.d.ts +3 -0
  165. package/dist/core/hast-to-nodes.d.ts +9 -0
  166. package/dist/core/highlight-lines.d.ts +8 -0
  167. package/dist/core/identity.d.ts +4 -0
  168. package/dist/core/labels.d.ts +4 -0
  169. package/dist/core/manifest.d.ts +38 -0
  170. package/dist/core/memo.d.ts +5 -0
  171. package/dist/core/model-hast.d.ts +8 -0
  172. package/dist/core/model.d.ts +10 -0
  173. package/dist/core/normalize.d.ts +37 -0
  174. package/dist/core/parts.d.ts +136 -0
  175. package/dist/core/preset.d.ts +10 -0
  176. package/dist/core/run.d.ts +16 -0
  177. package/dist/core/search.d.ts +5 -0
  178. package/dist/core/security.d.ts +21 -0
  179. package/dist/core/slugger.d.ts +13 -0
  180. package/dist/core/types.d.ts +392 -0
  181. package/dist/core/url.d.ts +10 -0
  182. package/dist/editor/codemirror.d.ts +14 -0
  183. package/dist/editor/index.d.ts +2 -0
  184. package/dist/editor/index.js +1 -0
  185. package/dist/export/index.d.ts +6 -0
  186. package/dist/headless.d.ts +21 -0
  187. package/dist/headless.js +12 -0
  188. package/dist/highlight/convert-hast.d.ts +8 -0
  189. package/dist/highlight/highlightjs.d.ts +7 -0
  190. package/dist/highlight/index.d.ts +4 -0
  191. package/dist/highlight/index.js +4 -0
  192. package/dist/highlight/shared.d.ts +11 -0
  193. package/dist/highlight/shiki.d.ts +7 -0
  194. package/dist/highlight/shiki.js +75 -0
  195. package/dist/html/index.d.ts +17 -0
  196. package/dist/html/index.js +11 -0
  197. package/dist/index.d.ts +24 -0
  198. package/dist/index.js +53 -0
  199. package/dist/math/index.d.ts +4 -0
  200. package/dist/math/index.js +585 -0
  201. package/dist/math/katex.d.ts +4 -0
  202. package/dist/math/plugin.d.ts +20 -0
  203. package/dist/mermaid/index.d.ts +6 -0
  204. package/dist/mermaid/index.js +8 -0
  205. package/dist/mermaid/plugin.d.ts +17 -0
  206. package/dist/mermaid/runtime.d.ts +14 -0
  207. package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
  208. package/dist/mermaid/sanitize-svg.d.ts +3 -0
  209. package/dist/mermaid/sanitize.d.ts +16 -0
  210. package/dist/node-components.d.ts +1 -0
  211. package/dist/node-components.js +39 -0
  212. package/dist/pipeline/custom.d.ts +8 -0
  213. package/dist/pipeline/identity.d.ts +12 -0
  214. package/dist/pipeline/index.d.ts +5 -0
  215. package/dist/pipeline/official.d.ts +6 -0
  216. package/dist/pipeline.d.ts +1 -0
  217. package/dist/pipeline.js +1 -0
  218. package/dist/plugins/builtin.d.ts +15 -0
  219. package/dist/plugins/define.d.ts +7 -0
  220. package/dist/plugins/registry.d.ts +16 -0
  221. package/dist/plugins/source.d.ts +7 -0
  222. package/dist/plugins.d.ts +3 -0
  223. package/dist/plugins.js +1 -0
  224. package/dist/presets.d.ts +3 -0
  225. package/dist/presets.js +1 -0
  226. package/dist/style.css +2 -0
  227. package/dist/styles/components.css +737 -0
  228. package/dist/styles/index.d.ts +1 -0
  229. package/dist/styles/math-full.css +3 -0
  230. package/dist/styles/math.css +18 -0
  231. package/dist/styles/tokens.css +96 -0
  232. package/package.json +214 -6
@@ -0,0 +1,1754 @@
1
+ import { n as e } from "./labels-BtHiUTQI.js";
2
+ import { n as t, t as n } from "./diagnostics-CtHoJyiX.js";
3
+ import { t as r } from "./objectSpread2-CtBNx0TF.js";
4
+ import { i } from "./adapters-CMwX_NEI.js";
5
+ import { t as a } from "./asyncToGenerator-ChigusFD.js";
6
+ import { r as o } from "./config-aRYo2R8_.js";
7
+ import { n as s, r as c } from "./context-8NfW6fxI.js";
8
+ import { i as l, n as u, r as d } from "./shared-NjFDPmkb.js";
9
+ import { n as f, t as p } from "./MarkdownCode-B1k9tmW5.js";
10
+ import { t as m } from "./MarkdownBlockquote-DVXziX2t.js";
11
+ import { t as h } from "./MarkdownBreak-BwCi2Itt.js";
12
+ import { t as g } from "./MarkdownCustomTag-lZJHsD6f.js";
13
+ import { t as _ } from "./MarkdownEmphasis-CppivOEu.js";
14
+ import { t as v } from "./MarkdownHeading-DaNcP0_6.js";
15
+ import { t as y } from "./MarkdownHorizontalRule-QNe_cuUI.js";
16
+ import { t as b } from "./MarkdownImage-BRy76svs.js";
17
+ import { t as x } from "./MarkdownInlineCode-MXZYFwex.js";
18
+ import { t as S } from "./MarkdownLink-Dbx3NwgV.js";
19
+ import { t as C } from "./MarkdownList-BJ-_C71k.js";
20
+ import { i as ee, n as te, s as ne, t as re } from "./runtime-D95F41zG.js";
21
+ import { t as w } from "./MarkdownListItem-Z1EHIY26.js";
22
+ import { t as T } from "./MarkdownFootnoteReference-Dy3Khwyj.js";
23
+ import { t as E } from "./MarkdownFootnotes-BRPzkbXv.js";
24
+ import { t as D } from "./MarkdownParagraph-BxLSmSaG.js";
25
+ import { t as O } from "./MarkdownStrikethrough-CblvbqDk.js";
26
+ import { t as k } from "./MarkdownTaskItem-BcmKo1lk.js";
27
+ import { t as ie } from "./MarkdownStrong-uU5MzAoJ.js";
28
+ import { t as ae } from "./MarkdownTable-DmBTg_CR.js";
29
+ import { t as A } from "./MarkdownTableCell-eiCJe847.js";
30
+ import { t as oe } from "./MarkdownTableRow-DuJaPntg.js";
31
+ import { t as j } from "./MarkdownTableSection-PFHz-R33.js";
32
+ import { computed as M, createBlock as N, createCommentVNode as se, createElementBlock as P, createElementVNode as ce, createSlots as le, createVNode as F, defineComponent as I, guardReactiveProps as L, h as R, normalizeClass as ue, normalizeProps as z, normalizeStyle as de, onMounted as B, onScopeDispose as V, onUnmounted as fe, openBlock as H, ref as U, renderSlot as W, resolveDynamicComponent as pe, shallowRef as G, toDisplayString as me, toValue as K, unref as q, useSlots as he, watch as ge, withCtx as J } from "vue";
33
+ // src/composables/useCodeHighlighter.ts
34
+ var Y;
35
+ function _e() {
36
+ return Y || (Y = import("./highlightjs-BxJFpKS1.js").then((e) => e.n).then((e) => e.highlightjs).catch((e) => {
37
+ throw Y = void 0, e;
38
+ })), Y;
39
+ }
40
+ function ve(e) {
41
+ let r = M(() => {
42
+ var t, n;
43
+ return (t = (n = K(e.theme)) == null ? K(e.contextTheme) : n) == null ? "light" : t;
44
+ }), i = G(u(K(e.source), K(e.language))), o = G(K(e.highlighter)), s = /* @__PURE__ */ new Set();
45
+ function c(t) {
46
+ var n;
47
+ let r = `${t.code}\u001f${t.message}`;
48
+ s.has(r) || (s.add(r), (n = e.onDiagnostic) == null || n.call(e, t));
49
+ }
50
+ function l() {
51
+ return r.value === "dark" || r.value === "auto" && typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
52
+ }
53
+ let f = 0, p;
54
+ function m() {
55
+ return h.apply(this, arguments);
56
+ }
57
+ function h() {
58
+ return h = a(function* () {
59
+ var a;
60
+ let s = ++f;
61
+ if (!((a = K(e.enabled)) == null || a)) return;
62
+ let p = K(e.highlighter);
63
+ if (p && typeof p.highlight != "function" && (c(n("highlighter-invalid", "The supplied highlighter does not implement `highlight()`. Falling back to plain text.", {
64
+ severity: "warning",
65
+ phase: "render"
66
+ })), p = void 0), !p) try {
67
+ p = yield _e();
68
+ } catch (e) {
69
+ c(n("highlighter-unavailable", "The default highlight.js adapter could not be loaded. Install the optional `highlight.js` peer dependency to enable syntax highlighting.", {
70
+ severity: "warning",
71
+ phase: "render"
72
+ })), p = void 0;
73
+ }
74
+ if (s !== f) return;
75
+ if (!p || typeof p.highlight != "function") {
76
+ o.value = void 0, i.value = u(K(e.source), K(e.language));
77
+ return;
78
+ }
79
+ o.value = p;
80
+ try {
81
+ var m, h;
82
+ yield (m = p.load) == null ? void 0 : m.call(p);
83
+ let t = K(e.language);
84
+ t && (yield (h = p.loadLanguage) == null ? void 0 : h.call(p, t));
85
+ } catch (e) {
86
+ c(n("highlighter-load", `The highlighter could not prepare this language: ${t(e)}`, {
87
+ severity: "warning",
88
+ phase: "render"
89
+ }));
90
+ }
91
+ if (s !== f) return;
92
+ let g = K(e.source), _ = K(e.language);
93
+ i.value = d(p, g, _, {
94
+ theme: r.value,
95
+ colorScheme: l()
96
+ });
97
+ }), h.apply(this, arguments);
98
+ }
99
+ function g() {
100
+ var t;
101
+ p && (clearTimeout(p), p = void 0);
102
+ let n = (t = K(e.delay)) == null ? 0 : t;
103
+ return n > 0 ? new Promise((e) => {
104
+ p = setTimeout(() => {
105
+ p = void 0, m().then(e);
106
+ }, n);
107
+ }) : m();
108
+ }
109
+ ge(() => [K(e.source), K(e.language)], ([e, t]) => {
110
+ i.value = u(e, t);
111
+ }), ge(() => {
112
+ var t;
113
+ return [
114
+ K(e.source),
115
+ K(e.language),
116
+ K(e.highlighter),
117
+ r.value,
118
+ (t = K(e.enabled)) == null || t
119
+ ];
120
+ }, () => {
121
+ g();
122
+ }), B(() => {
123
+ g();
124
+ }), V(() => {
125
+ f += 1, p && (clearTimeout(p), p = void 0);
126
+ });
127
+ function _() {
128
+ return i.value;
129
+ }
130
+ return {
131
+ result: i,
132
+ active: o,
133
+ resolvedTheme: r,
134
+ refresh: g,
135
+ getHighlighted: _
136
+ };
137
+ }
138
+ // src/core/highlight-lines.ts
139
+ function X(e) {
140
+ let t = /* @__PURE__ */ new Set();
141
+ for (let n of e == null ? [] : e) {
142
+ if (typeof n == "number") {
143
+ Number.isInteger(n) && n > 0 && t.add(n);
144
+ continue;
145
+ }
146
+ if (typeof n != "string") continue;
147
+ let e = /^\s*(\d+)\s*(?:-\s*(\d+))?\s*$/.exec(n);
148
+ if (!e) continue;
149
+ let r = Number(e[1]), i = e[2] ? Number(e[2]) : r;
150
+ if (!(r <= 0 || i < r)) for (let e = r; e <= i; e += 1) t.add(e);
151
+ }
152
+ return t;
153
+ }
154
+ // src/composables/useLineWindow.ts
155
+ function ye(e) {
156
+ let t = M(() => l(K(e.nodes))), n = M(() => t.value.length), r = U(!1), i = U(0), a = U(0), o = U(), s = U(!1), c = M(() => X(K(e.highlightLines))), u = M(() => {
157
+ var t;
158
+ return Math.max(0, (t = K(e.maxLines)) == null ? 0 : t);
159
+ }), d = M(() => u.value > 0 && n.value > u.value), f = M(() => d.value && !r.value), p = M(() => f.value ? Math.min(n.value, u.value) : n.value), m = M(() => {
160
+ var t;
161
+ return (t = K(e.virtual)) != null && t;
162
+ }), h = M(() => {
163
+ var t;
164
+ return (t = K(e.virtualThreshold)) == null ? 200 : t;
165
+ }), g = M(() => {
166
+ var t;
167
+ return (t = K(e.lineHeight)) == null ? 20 : t;
168
+ }), _ = M(() => s.value && m.value && p.value >= h.value), v = M(() => _.value ? Math.max(0, Math.floor(i.value / g.value) - 4) : 0), y = M(() => _.value ? Math.min(p.value, Math.ceil((i.value + a.value) / g.value) + 4) : p.value), b = M(() => {
169
+ let e = [];
170
+ for (let r = v.value; r < y.value; r += 1) {
171
+ var n;
172
+ e.push({
173
+ index: r,
174
+ nodes: (n = t.value[r]) == null ? [] : n
175
+ });
176
+ }
177
+ return e;
178
+ });
179
+ function x(e) {
180
+ let t = e.target;
181
+ i.value = t.scrollTop, a.value = t.clientHeight;
182
+ }
183
+ function S() {
184
+ o.value && (a.value = o.value.clientHeight);
185
+ }
186
+ function C() {
187
+ r.value = !r.value;
188
+ }
189
+ function ee(e) {
190
+ return c.value.has(e + 1);
191
+ }
192
+ return B(() => {
193
+ S(), s.value = !0;
194
+ }), ge(() => K(e.source), () => {
195
+ r.value = !1;
196
+ }), {
197
+ highlightedLines: t,
198
+ expanded: r,
199
+ truncatable: d,
200
+ totalLines: p,
201
+ virtualActive: _,
202
+ startLine: v,
203
+ endLine: y,
204
+ visibleLines: b,
205
+ lineHeight: g,
206
+ scrollRef: o,
207
+ onScroll: x,
208
+ measure: S,
209
+ toggle: C,
210
+ isHighlightedLine: ee
211
+ };
212
+ }
213
+ // src/components/Icon.ts
214
+ var Z = {
215
+ copy: ["M8 8h12v12H8z", "M4 16V4h12"],
216
+ check: ["M4 12l5 5L20 6"],
217
+ download: [
218
+ "M12 3v12",
219
+ "M7 10l5 5 5-5",
220
+ "M4 20h16"
221
+ ],
222
+ preview: ["M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z", "M12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"],
223
+ source: [
224
+ "M8 6l-5 6 5 6",
225
+ "M16 6l5 6-5 6",
226
+ "M14 4l-4 16"
227
+ ],
228
+ "zoom-in": [
229
+ "M10 4a6 6 0 1 0 0 12 6 6 0 0 0 0-12z",
230
+ "M10 7v6",
231
+ "M7 10h6",
232
+ "M15.5 15.5L21 21"
233
+ ],
234
+ "zoom-out": [
235
+ "M10 4a6 6 0 1 0 0 12 6 6 0 0 0 0-12z",
236
+ "M7 10h6",
237
+ "M15.5 15.5L21 21"
238
+ ],
239
+ reset: [
240
+ "M8 8h8v8H8z",
241
+ "M4 12h4",
242
+ "M16 12h4",
243
+ "M12 4v4",
244
+ "M12 16v4"
245
+ ],
246
+ image: [
247
+ "M4 5h16v14H4z",
248
+ "M4 16l4-4 4 4 3-3 5 5",
249
+ "M9 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"
250
+ ],
251
+ fullscreen: [
252
+ "M8 3H3v5",
253
+ "M16 3h5v5",
254
+ "M21 16v5h-5",
255
+ "M3 16v5h5"
256
+ ],
257
+ "exit-fullscreen": [
258
+ "M3 8h5V3",
259
+ "M21 8h-5V3",
260
+ "M16 21v-5h5",
261
+ "M8 21v-5H3"
262
+ ],
263
+ retry: ["M20 12a8 8 0 1 1-2.34-5.66", "M20 4v6h-6"],
264
+ diagram: [
265
+ "M4 5h6v4H4z",
266
+ "M14 15h6v4h-6z",
267
+ "M7 9v3h10v3"
268
+ ]
269
+ }, be = (e) => R("svg", {
270
+ class: "vmd-icon",
271
+ viewBox: "0 0 24 24",
272
+ "aria-hidden": "true",
273
+ focusable: "false",
274
+ fill: "none",
275
+ stroke: "currentColor",
276
+ "stroke-width": 1.8,
277
+ "stroke-linecap": "round",
278
+ "stroke-linejoin": "round"
279
+ }, Z[e.name].map((e) => R("path", { d: e }))), xe = [
280
+ "data-vmd-theme",
281
+ "data-language",
282
+ "data-highlighter",
283
+ "data-virtual"
284
+ ], Se = {
285
+ "data-vmd-part": "code-header",
286
+ class: "vmd-code-header"
287
+ }, Ce = {
288
+ key: 0,
289
+ "data-vmd-part": "code-body",
290
+ class: "vmd-code-body vmd-code-block-body"
291
+ }, we = ["data-virtual"], Te = {
292
+ key: 2,
293
+ "data-vmd-part": "code-body",
294
+ class: "vmd-code-body"
295
+ }, Ee = /* @__PURE__ */ I({
296
+ __name: "CodeBlock",
297
+ props: {
298
+ node: {},
299
+ code: { default: void 0 },
300
+ language: { default: void 0 },
301
+ highlighter: { default: void 0 },
302
+ theme: { default: void 0 },
303
+ actions: { default: () => [] },
304
+ showActions: {
305
+ type: Boolean,
306
+ default: !0
307
+ },
308
+ showDownload: {
309
+ type: Boolean,
310
+ default: !1
311
+ },
312
+ title: { default: void 0 },
313
+ fileName: { default: void 0 },
314
+ lineNumbers: {
315
+ type: Boolean,
316
+ default: !1
317
+ },
318
+ highlightLines: { default: () => [] },
319
+ maxLines: { default: 0 },
320
+ virtual: {
321
+ type: Boolean,
322
+ default: !1
323
+ },
324
+ virtualThreshold: { default: 200 },
325
+ lineHeight: { default: 20 },
326
+ delay: { default: 0 },
327
+ standalone: {
328
+ type: Boolean,
329
+ default: !1
330
+ },
331
+ ignoreRegion: {
332
+ type: Boolean,
333
+ default: !1
334
+ }
335
+ },
336
+ emits: [
337
+ "copy",
338
+ "download",
339
+ "action",
340
+ "error"
341
+ ],
342
+ setup(i, { expose: l, emit: u }) {
343
+ let d = i, p = u, m = c(), h = o(), g = he(), _ = f({
344
+ standalone: () => d.standalone,
345
+ ignoreRegion: () => d.ignoreRegion
346
+ }), v = M(() => {
347
+ var e, t;
348
+ return d.code === void 0 ? (e = (t = d.node) == null ? void 0 : t.code) == null ? "" : e : d.code;
349
+ }), y = M(() => {
350
+ var e, t;
351
+ return d.language === void 0 ? (e = (t = d.node) == null ? void 0 : t.language) == null ? "" : e : d.language;
352
+ }), b = M(() => y.value || "text");
353
+ function x(e) {
354
+ var t;
355
+ (t = m.onRenderError) == null || t.call(m, e), p("error", e);
356
+ }
357
+ let { result: S, active: C, resolvedTheme: ee, getHighlighted: te } = ve({
358
+ source: v,
359
+ language: y,
360
+ highlighter: () => {
361
+ var e, t;
362
+ return (e = (t = d.highlighter) == null ? m.highlighter : t) == null ? h.value.highlighter : e;
363
+ },
364
+ theme: () => d.theme,
365
+ contextTheme: () => {
366
+ var e;
367
+ return (e = m.theme) == null ? h.value.theme : e;
368
+ },
369
+ enabled: () => !_.value,
370
+ onDiagnostic: x
371
+ }), { highlightedLines: ne, expanded: re, truncatable: w, virtualActive: T, startLine: E, endLine: D, totalLines: O, visibleLines: k, lineHeight: ie, scrollRef: ae, onScroll: A, toggle: oe, isHighlightedLine: j } = ye({
372
+ nodes: () => S.value.nodes,
373
+ source: v,
374
+ maxLines: () => d.maxLines,
375
+ virtual: () => d.virtual,
376
+ virtualThreshold: () => d.virtualThreshold,
377
+ lineHeight: () => d.lineHeight,
378
+ highlightLines: () => d.highlightLines
379
+ }), se = M(() => S.value.mode === "block"), le = M(() => d.lineNumbers || d.highlightLines.length > 0 || d.maxLines > 0 || d.virtual), L = U("idle"), z = M(() => L.value === "copied" ? e(m.labels.copied) : L.value === "failed" ? e(m.labels.copyFailed) : ""), B, V;
380
+ fe(() => {
381
+ B && clearTimeout(B), V && URL.revokeObjectURL(V);
382
+ });
383
+ function G() {
384
+ return me.apply(this, arguments);
385
+ }
386
+ function me() {
387
+ return me = a(function* () {
388
+ let e = v.value;
389
+ try {
390
+ if (typeof navigator < "u" && navigator.clipboard) yield navigator.clipboard.writeText(e);
391
+ else if (typeof document < "u") {
392
+ let t = document.createElement("textarea");
393
+ t.value = e, document.body.appendChild(t), t.select();
394
+ let n = document.execCommand("copy");
395
+ if (t.remove(), n === !1) throw Error("The copy command was rejected.");
396
+ } else throw Error("Clipboard access is not available.");
397
+ p("copy", e), L.value = "copied", B && clearTimeout(B), B = setTimeout(() => {
398
+ L.value = "idle";
399
+ }, 1500);
400
+ } catch (e) {
401
+ L.value = "failed", x(n("copy-error", `The source could not be copied to the clipboard: ${t(e)}`, {
402
+ severity: "warning",
403
+ phase: "render"
404
+ })), B && clearTimeout(B), B = setTimeout(() => {
405
+ L.value = "idle";
406
+ }, 1500);
407
+ }
408
+ }), me.apply(this, arguments);
409
+ }
410
+ function K() {
411
+ return Y.apply(this, arguments);
412
+ }
413
+ function Y() {
414
+ return Y = a(function* () {
415
+ let e = v.value;
416
+ if (typeof document < "u" && typeof URL < "u") try {
417
+ let t = new Blob([e], { type: "text/plain;charset=utf-8" }), n = URL.createObjectURL(t);
418
+ V = n;
419
+ let r = document.createElement("a");
420
+ r.href = n, r.download = d.fileName || `code.${y.value || "txt"}`, r.click(), setTimeout(() => {
421
+ URL.revokeObjectURL(n), V === n && (V = void 0);
422
+ }, 1e3), p("download", e);
423
+ } catch (e) {
424
+ x(n("download-error", `The source could not be downloaded: ${t(e)}`, {
425
+ severity: "warning",
426
+ phase: "render"
427
+ }));
428
+ }
429
+ }), Y.apply(this, arguments);
430
+ }
431
+ let _e = M(() => ({
432
+ copy: G,
433
+ download: K
434
+ })), X = M(() => ({
435
+ node: d.node,
436
+ source: v.value,
437
+ language: y.value,
438
+ highlighted: S.value,
439
+ nodes: S.value.nodes,
440
+ lines: ne.value,
441
+ visibleLines: k.value,
442
+ actions: _e.value
443
+ })), Z = M(() => ({
444
+ source: v.value,
445
+ language: y.value,
446
+ fileName: d.fileName,
447
+ title: d.title,
448
+ highlighted: S.value,
449
+ nodes: S.value.nodes,
450
+ actions: _e.value
451
+ })), Ee = M(() => r(r({}, Z.value), {}, { label: b.value }));
452
+ function De() {
453
+ let t = [];
454
+ T.value && E.value > 0 && t.push(R("div", {
455
+ key: "spacer-top",
456
+ "aria-hidden": "true",
457
+ style: { height: `${E.value * ie.value}px` }
458
+ }));
459
+ for (let e of k.value) {
460
+ let n = j(e.index);
461
+ t.push(R("div", {
462
+ class: "vmd-highlighter-line",
463
+ "data-vmd-part": "highlighter-line",
464
+ "data-line": String(e.index + 1),
465
+ "data-highlighted": n ? "true" : void 0,
466
+ key: `line-${e.index}`
467
+ }, [d.lineNumbers ? R("span", {
468
+ class: "vmd-highlighter-gutter",
469
+ "data-vmd-part": "highlighter-gutter",
470
+ "aria-hidden": "true"
471
+ }, String(e.index + 1)) : null, R("code", { class: ["vmd-highlighter-code", y.value ? `language-${y.value}` : void 0] }, $(e.nodes, m))]));
472
+ }
473
+ return T.value && D.value < O.value && t.push(R("div", {
474
+ key: "spacer-bottom",
475
+ "aria-hidden": "true",
476
+ style: { height: `${(O.value - D.value) * ie.value}px` }
477
+ })), w.value && t.push(R("button", {
478
+ type: "button",
479
+ class: "vmd-highlighter-toggle",
480
+ "data-vmd-part": "highlighter-toggle",
481
+ "aria-expanded": re.value ? "true" : "false",
482
+ onClick: oe
483
+ }, re.value ? e(m.labels.showLess) : e(m.labels.showAll))), t;
484
+ }
485
+ let Oe = I({ setup() {
486
+ return () => m.renderHostSlot("code", X.value, () => {
487
+ let e = g.code;
488
+ if (e) {
489
+ let t = e(X.value);
490
+ if (!s(t)) return t;
491
+ }
492
+ return se.value ? $(S.value.nodes, m) : le.value ? De() : $(S.value.nodes, m);
493
+ });
494
+ } }), ke = I({ setup() {
495
+ return () => m.renderHostSlot("toolbar", Z.value, () => {
496
+ let r = g.toolbar;
497
+ if (r) {
498
+ let e = r(Z.value);
499
+ if (!s(e)) return e;
500
+ }
501
+ return m.renderHostSlot("code-actions", Z.value, () => {
502
+ let r = g["code-actions"];
503
+ if (r) {
504
+ let e = r(Z.value);
505
+ if (!s(e)) return e;
506
+ }
507
+ if (!d.showActions && d.actions.length === 0) return null;
508
+ let i = [];
509
+ if (d.showActions) {
510
+ let t = L.value === "copied" ? e(m.labels.copied) : L.value === "failed" ? e(m.labels.copyFailed) : e(m.labels.copy);
511
+ if (i.push(R("button", {
512
+ type: "button",
513
+ class: "vmd-code-action",
514
+ "data-vmd-part": "code-action",
515
+ "data-action": "copy",
516
+ "data-icon": "true",
517
+ "data-state": L.value,
518
+ "aria-label": t,
519
+ title: t,
520
+ onClick: G
521
+ }, [R(be, { name: L.value === "copied" ? "check" : "copy" }), R("span", { class: "vmd-visually-hidden" }, t)])), d.showDownload) {
522
+ let t = e(m.labels.download);
523
+ i.push(R("button", {
524
+ type: "button",
525
+ class: "vmd-code-action",
526
+ "data-vmd-part": "code-action",
527
+ "data-action": "download",
528
+ "data-icon": "true",
529
+ "aria-label": t,
530
+ title: t,
531
+ onClick: K
532
+ }, [R(be, { name: "download" }), R("span", { class: "vmd-visually-hidden" }, t)]));
533
+ }
534
+ }
535
+ for (let r of d.actions) i.push(R("button", {
536
+ type: "button",
537
+ class: "vmd-code-action",
538
+ "data-vmd-part": "code-action",
539
+ "data-action": r.key,
540
+ onClick: function() {
541
+ var e = a(function* () {
542
+ try {
543
+ yield r.run({
544
+ code: v.value,
545
+ language: y.value,
546
+ copy: G,
547
+ download: K
548
+ }), p("action", r.key);
549
+ } catch (e) {
550
+ x(n("action-error", `The "${r.key}" action failed: ${t(e)}`, {
551
+ severity: "warning",
552
+ phase: "render"
553
+ }));
554
+ }
555
+ });
556
+ return function() {
557
+ return e.apply(this, arguments);
558
+ };
559
+ }()
560
+ }, e(r.label)));
561
+ return i.push(R("span", {
562
+ class: "vmd-code-feedback",
563
+ "data-vmd-part": "code-feedback",
564
+ "data-state": L.value,
565
+ role: "status",
566
+ "aria-live": "polite"
567
+ }, z.value)), i;
568
+ });
569
+ });
570
+ } }), Ae = I({ setup() {
571
+ return () => m.renderHostSlot("header", Ee.value, () => {
572
+ let e = g.header;
573
+ if (e) {
574
+ let t = e(Ee.value);
575
+ if (!s(t)) return t;
576
+ }
577
+ return [R("span", {
578
+ class: "vmd-code-heading",
579
+ "data-vmd-part": "code-heading"
580
+ }, [
581
+ R(be, { name: "source" }),
582
+ d.title ? R("span", {
583
+ class: "vmd-code-title",
584
+ "data-vmd-part": "code-title"
585
+ }, d.title) : null,
586
+ d.fileName ? R("span", {
587
+ class: "vmd-code-file-name",
588
+ "data-vmd-part": "code-file-name"
589
+ }, d.fileName) : null,
590
+ R("span", {
591
+ class: "vmd-code-lang",
592
+ "data-vmd-part": "code-lang"
593
+ }, b.value)
594
+ ]), R("span", {
595
+ class: "vmd-code-toolbar",
596
+ "data-vmd-part": "code-toolbar"
597
+ }, [R(ke)])];
598
+ });
599
+ } });
600
+ return ge(() => [v.value, y.value], () => {
601
+ L.value = "idle";
602
+ }), l({
603
+ copy: G,
604
+ download: K,
605
+ getHighlighted: te,
606
+ highlighted: S
607
+ }), (e, t) => {
608
+ var n;
609
+ return q(_) ? (H(), N(pe(q(_)), {
610
+ key: 0,
611
+ node: i.node,
612
+ code: v.value,
613
+ language: y.value,
614
+ theme: q(ee),
615
+ highlighter: q(C),
616
+ actions: i.actions,
617
+ "show-actions": i.showActions,
618
+ "show-download": i.showDownload,
619
+ title: i.title,
620
+ "file-name": i.fileName,
621
+ "line-numbers": i.lineNumbers,
622
+ "highlight-lines": i.highlightLines,
623
+ "max-lines": i.maxLines,
624
+ virtual: i.virtual,
625
+ "virtual-threshold": i.virtualThreshold,
626
+ "line-height": q(ie),
627
+ delay: i.delay,
628
+ highlighted: q(S),
629
+ "action-handlers": _e.value,
630
+ copy: G,
631
+ download: K
632
+ }, {
633
+ default: J(() => [W(e.$slots, "default")]),
634
+ _: 3
635
+ }, 8, [
636
+ "node",
637
+ "code",
638
+ "language",
639
+ "theme",
640
+ "highlighter",
641
+ "actions",
642
+ "show-actions",
643
+ "show-download",
644
+ "title",
645
+ "file-name",
646
+ "line-numbers",
647
+ "highlight-lines",
648
+ "max-lines",
649
+ "virtual",
650
+ "virtual-threshold",
651
+ "line-height",
652
+ "delay",
653
+ "highlighted",
654
+ "action-handlers"
655
+ ])) : (H(), P("div", {
656
+ key: 1,
657
+ "data-vmd-part": "code",
658
+ class: "vmd-code vmd-code-block",
659
+ "data-vmd-theme": q(ee),
660
+ "data-language": b.value,
661
+ "data-highlighter": (n = q(C)) == null ? void 0 : n.id,
662
+ "data-virtual": q(T) ? "true" : void 0
663
+ }, [ce("div", Se, [F(q(Ae))]), se.value ? (H(), P("div", Ce, [F(q(Oe))])) : le.value ? (H(), P("div", {
664
+ key: 1,
665
+ ref_key: "scrollRef",
666
+ ref: ae,
667
+ "data-vmd-part": "code-body",
668
+ class: "vmd-code-body vmd-code-lines",
669
+ "data-virtual": q(T) ? "true" : void 0,
670
+ style: de(q(T) ? {
671
+ maxHeight: `${q(ie) * 20}px`,
672
+ overflow: "auto"
673
+ } : void 0),
674
+ onScroll: t[0] || (t[0] = (...e) => q(A) && q(A)(...e))
675
+ }, [F(q(Oe))], 44, we)) : (H(), P("pre", Te, [ce("code", { class: ue(["vmd-code-element", y.value ? `language-${y.value}` : void 0]) }, [F(q(Oe))], 2)]))], 8, xe));
676
+ };
677
+ }
678
+ }), De = [
679
+ "data-display",
680
+ "data-error",
681
+ "aria-label"
682
+ ], Oe = {
683
+ key: 0,
684
+ "data-vmd-part": "math-error",
685
+ class: "vmd-math-error",
686
+ role: "status"
687
+ }, ke = /* @__PURE__ */ I({
688
+ __name: "MarkdownMath",
689
+ props: {
690
+ node: {},
691
+ tex: {},
692
+ displayMode: { type: Boolean },
693
+ rendered: {},
694
+ error: {},
695
+ mathEngine: {}
696
+ },
697
+ setup(t) {
698
+ let r = t, i = c(), a = M(() => {
699
+ var e, t;
700
+ return (e = r.tex) == null ? ((t = r.node) == null ? void 0 : t.kind) === "math" ? r.node.tex : "" : e;
701
+ }), o = M(() => {
702
+ var e, t;
703
+ return (e = r.displayMode) == null ? ((t = r.node) == null ? void 0 : t.kind) === "math" && r.node.displayMode : e;
704
+ }), s = M(() => {
705
+ var e, t;
706
+ return (e = r.rendered) == null ? ((t = r.node) == null ? void 0 : t.kind) === "math" ? r.node.rendered : [] : e;
707
+ }), l = M(() => {
708
+ var e;
709
+ return (e = r.mathEngine) == null ? i.mathEngine : e;
710
+ }), u = M(() => {
711
+ if (l.value) try {
712
+ return l.value.render(a.value, { displayMode: o.value });
713
+ } catch (e) {
714
+ return {
715
+ nodes: [{
716
+ kind: "text",
717
+ key: "math-error",
718
+ value: a.value
719
+ }],
720
+ error: e instanceof Error ? e.message : String(e)
721
+ };
722
+ }
723
+ }), d = M(() => !l.value && (s.value === void 0 || s.value.length === 0) && a.value !== ""), f = M(() => {
724
+ var e, t, n;
725
+ let r = (e = (t = (n = u.value) == null ? void 0 : n.nodes) == null ? s.value : t) == null ? [] : e;
726
+ return r.length > 0 ? r : d.value ? [{
727
+ kind: "text",
728
+ key: "math-source",
729
+ value: a.value
730
+ }] : r;
731
+ });
732
+ function p(e) {
733
+ if (e) for (let n of e) {
734
+ var t;
735
+ if (n.kind !== "element") continue;
736
+ if (((t = n.attrs.class) == null ? "" : t).split(/\s+/).includes("katex-error")) return n.attrs.title || "Invalid TeX expression.";
737
+ let e = p(n.children);
738
+ if (e) return e;
739
+ }
740
+ }
741
+ let m = M(() => u.value ? void 0 : p(s.value)), h = M(() => {
742
+ var e, t, n;
743
+ return (e = (t = r.error) == null ? (n = u.value) == null ? void 0 : n.error : t) == null ? m.value : e;
744
+ }), g = M(() => e(i.labels.math, { tex: a.value })), _ = !1;
745
+ function v() {
746
+ if (!_) {
747
+ if (h.value) {
748
+ var e, t;
749
+ _ = !0;
750
+ let r = n("math-error", h.value, { phase: "render" });
751
+ (e = i.onMathError) == null || e.call(i, r), (t = i.onRenderError) == null || t.call(i, r);
752
+ } else if (d.value) {
753
+ var r, a;
754
+ _ = !0;
755
+ let e = n("math-engine-unavailable", "No math engine or pre-rendered math output is available. Provide `mathEngine`, `rendered`, or use `mathPlugin()`.", {
756
+ severity: "warning",
757
+ phase: "render"
758
+ });
759
+ (r = i.onMathError) == null || r.call(i, e), (a = i.onRenderError) == null || a.call(i, e);
760
+ }
761
+ }
762
+ }
763
+ B(v), ge([h, d], v);
764
+ let y = I({ setup() {
765
+ return () => i.renderHostSlot("math", {
766
+ tex: a.value,
767
+ displayMode: o.value,
768
+ rendered: f.value,
769
+ error: h.value
770
+ }, () => $(f.value, i));
771
+ } }), b = I({ setup() {
772
+ return () => i.renderHostSlot("math-error", {
773
+ tex: a.value,
774
+ error: h.value,
775
+ retry: () => void 0
776
+ }, () => R("span", { class: "vmd-math-fallback" }, a.value));
777
+ } });
778
+ return (e, t) => (H(), P("span", {
779
+ "data-vmd-part": "math",
780
+ class: "vmd-math",
781
+ "data-display": o.value ? "true" : "false",
782
+ "data-error": h.value ? "true" : void 0,
783
+ "aria-label": g.value
784
+ }, [h.value ? (H(), P("span", Oe, [F(q(b))])) : (H(), N(q(y), { key: 1 }))], 8, De));
785
+ }
786
+ }), Ae = [
787
+ "data-vmd-theme",
788
+ "data-status",
789
+ "data-renderer",
790
+ "data-fullscreen",
791
+ "data-compact",
792
+ "data-view",
793
+ "aria-label"
794
+ ], je = ["data-vmd-part"], Me = {
795
+ "data-vmd-part": "mermaid-header",
796
+ class: "vmd-mermaid-header"
797
+ }, Ne = {
798
+ key: 0,
799
+ "data-vmd-part": "mermaid-preview",
800
+ class: "vmd-mermaid-preview"
801
+ }, Pe = {
802
+ key: 0,
803
+ class: "vmd-mermaid-error-banner"
804
+ }, Fe = {
805
+ key: 1,
806
+ "data-vmd-part": "mermaid-source",
807
+ class: "vmd-mermaid-source"
808
+ }, Ie = "The Mermaid renderer returned an invalid result. Return an object such as `{ nodes }` or `{ svg }` from `render()`.", Le = "The Mermaid renderer returned no diagram nodes or SVG. Return `{ nodes }` or `{ svg }`, or remove the custom renderer to use the built-in runtime.", Re = "The Mermaid renderer returned SVG that sanitization rejected completely. Return safe SVG markup or sanitized `nodes` instead.", ze = "Mermaid produced no renderable diagram output. Check the diagram syntax and the installed `mermaid` version.", Be = "Mermaid produced SVG that sanitization rejected completely. Check the diagram syntax and the installed `mermaid` version.", Ve = "Mermaid source must be a string. If you used `renderMermaid()`, await its result before passing it as the source.", He = /* @__PURE__ */ I({
809
+ __name: "MermaidBlock",
810
+ props: {
811
+ node: { default: void 0 },
812
+ source: { default: void 0 },
813
+ renderer: { default: void 0 },
814
+ theme: { default: void 0 },
815
+ showErrors: {
816
+ type: Boolean,
817
+ default: !1
818
+ },
819
+ enableZoom: {
820
+ type: Boolean,
821
+ default: !0
822
+ },
823
+ allowFullscreen: {
824
+ type: Boolean,
825
+ default: !0
826
+ },
827
+ compact: {
828
+ type: Boolean,
829
+ default: !1
830
+ },
831
+ actions: { default: () => [] }
832
+ },
833
+ emits: [
834
+ "rendered",
835
+ "error",
836
+ "copy",
837
+ "export",
838
+ "fullscreen",
839
+ "action"
840
+ ],
841
+ setup(o, { expose: l, emit: u }) {
842
+ let d = o, f = u, p = c(), m = he(), h = M(() => {
843
+ var e, t;
844
+ return (e = d.source) == null ? ((t = d.node) == null ? void 0 : t.kind) === "mermaid" ? d.node.code : "" : e;
845
+ }), g = M(() => typeof h.value == "string" ? h.value : ""), _ = M(() => {
846
+ var e, t;
847
+ return (e = (t = d.theme) == null ? p.theme : t) == null ? "light" : e;
848
+ }), v = U("idle"), y = G(), b = G(), x = U(""), S = U("preview"), C = U(1), w = U(!1), T = U(), E = U(!1), D = !1, O, k = M(() => d.renderer && i(d.renderer) ? d.renderer : p.mermaidRenderer), ie = M(() => k.value && i(k.value) ? k.value.id : "mermaid"), ae = M(() => e(p.labels.mermaid, { source: g.value })), A = 0;
849
+ function oe(e) {
850
+ return j.apply(this, arguments);
851
+ }
852
+ function j() {
853
+ return j = a(function* (e) {
854
+ var t;
855
+ if (!e || typeof e != "object") return {
856
+ nodes: [],
857
+ error: Ie
858
+ };
859
+ let n = typeof e.svg == "string" && e.svg ? e.svg : void 0, i = Array.isArray(e.nodes) ? ne(e.nodes) : [];
860
+ if (i.length > 0) return r(r({}, e), {}, {
861
+ svg: n,
862
+ nodes: i
863
+ });
864
+ if (n) {
865
+ var a;
866
+ let t = yield ee(n);
867
+ return t.length > 0 ? r(r({}, e), {}, {
868
+ svg: n,
869
+ nodes: t
870
+ }) : r(r({}, e), {}, {
871
+ svg: n,
872
+ nodes: [],
873
+ error: (a = e.error) == null ? Re : a
874
+ });
875
+ }
876
+ return r(r({}, e), {}, {
877
+ svg: n,
878
+ nodes: [],
879
+ error: (t = e.error) == null ? Le : t
880
+ });
881
+ }), j.apply(this, arguments);
882
+ }
883
+ function N() {
884
+ return le.apply(this, arguments);
885
+ }
886
+ function le() {
887
+ return le = a(function* () {
888
+ if (!D) return;
889
+ let e = ++A;
890
+ v.value = "pending", x.value = "", C.value = 1;
891
+ let a = k.value, o = re(), s;
892
+ if (typeof h.value != "string") s = {
893
+ nodes: [],
894
+ error: Ve
895
+ };
896
+ else if (a && i(a)) try {
897
+ s = yield oe(yield a.render(g.value, {
898
+ theme: _.value,
899
+ id: o
900
+ }));
901
+ } catch (e) {
902
+ s = {
903
+ nodes: [],
904
+ error: `The Mermaid renderer failed: ${t(e)}`
905
+ };
906
+ }
907
+ else {
908
+ let e = yield te(g.value, {
909
+ theme: _.value,
910
+ id: o
911
+ });
912
+ s = e.error || e.nodes.length > 0 ? e : r(r({}, e), {}, { error: e.svg ? Be : ze });
913
+ }
914
+ if (D && e === A) {
915
+ if (y.value = s, s.error) {
916
+ var c;
917
+ v.value = "error", x.value = s.error, f("error", s.error);
918
+ let e = s.error.indexOf("Mermaid is not available") !== -1;
919
+ (c = p.onRenderError) == null || c.call(p, n(e ? "mermaid-unavailable" : "mermaid-error", s.error, { phase: "render" }));
920
+ } else v.value = "ready", b.value = s, f("rendered", s);
921
+ }
922
+ }), le.apply(this, arguments);
923
+ }
924
+ B(() => {
925
+ D = !0, N();
926
+ }), fe(() => {
927
+ D = !1, A += 1, O && clearTimeout(O), typeof document < "u" && document.removeEventListener("keydown", pe);
928
+ }), ge(() => [
929
+ g.value,
930
+ k.value,
931
+ _.value
932
+ ], () => {
933
+ D && N();
934
+ });
935
+ function L() {
936
+ return ue.apply(this, arguments);
937
+ }
938
+ function ue() {
939
+ return ue = a(function* () {
940
+ try {
941
+ typeof navigator < "u" && navigator.clipboard && (yield navigator.clipboard.writeText(g.value)), E.value = !0, f("copy", g.value), O && clearTimeout(O), O = setTimeout(() => {
942
+ E.value = !1;
943
+ }, 1500);
944
+ } catch (r) {
945
+ var e;
946
+ E.value = !1;
947
+ let i = `The source could not be copied to the clipboard: ${t(r)}`;
948
+ f("error", i), (e = p.onRenderError) == null || e.call(p, n("copy-error", i, {
949
+ severity: "warning",
950
+ phase: "render",
951
+ plugin: "mermaid"
952
+ }));
953
+ }
954
+ }), ue.apply(this, arguments);
955
+ }
956
+ function z(e, t) {
957
+ if (typeof document > "u" || typeof URL > "u") return;
958
+ let n = URL.createObjectURL(e), r = document.createElement("a");
959
+ r.href = n, r.download = t, r.click(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
960
+ }
961
+ function de() {
962
+ return V.apply(this, arguments);
963
+ }
964
+ function V() {
965
+ return V = a(function* () {
966
+ var e;
967
+ let t = (e = b.value) == null ? void 0 : e.svg;
968
+ if (t && typeof document < "u" && typeof Image < "u") try {
969
+ var n;
970
+ let e = URL.createObjectURL(new Blob([t], { type: "image/svg+xml" })), r = new Image();
971
+ yield new Promise((t, n) => {
972
+ r.onload = () => t(), r.onerror = () => n(/* @__PURE__ */ Error("Mermaid SVG could not be decoded.")), r.src = e;
973
+ });
974
+ let i = document.createElement("canvas");
975
+ i.width = r.width || 800, i.height = r.height || 600, (n = i.getContext("2d")) == null || n.drawImage(r, 0, 0), URL.revokeObjectURL(e);
976
+ let a = yield new Promise((e) => i.toBlob(e, "image/png"));
977
+ a && (z(a, "diagram.png"), f("export", "png"));
978
+ } catch (e) {}
979
+ }), V.apply(this, arguments);
980
+ }
981
+ function W() {
982
+ var e;
983
+ let t = (e = b.value) == null ? void 0 : e.svg;
984
+ t && (z(new Blob([t], { type: "image/svg+xml" }), "diagram.svg"), f("export", "svg"));
985
+ }
986
+ function pe(e) {
987
+ e.key === "Escape" && w.value && K(!1);
988
+ }
989
+ function K() {
990
+ return J.apply(this, arguments);
991
+ }
992
+ function J() {
993
+ return J = a(function* (e = !w.value) {
994
+ if (!d.allowFullscreen) return;
995
+ let t = T.value;
996
+ if (typeof document < "u") {
997
+ if (e) {
998
+ var n;
999
+ try {
1000
+ var r;
1001
+ yield t == null || (r = t.requestFullscreen) == null ? void 0 : r.call(t);
1002
+ } catch (e) {}
1003
+ if (!D) return;
1004
+ w.value = !0, document.addEventListener("keydown", pe), t == null || (n = t.focus) == null || n.call(t);
1005
+ } else {
1006
+ try {
1007
+ document.fullscreenElement && (yield document.exitFullscreen());
1008
+ } catch (e) {}
1009
+ if (!D) return;
1010
+ w.value = !1, document.removeEventListener("keydown", pe);
1011
+ }
1012
+ f("fullscreen", w.value);
1013
+ }
1014
+ }), J.apply(this, arguments);
1015
+ }
1016
+ function Y(e) {
1017
+ C.value = Math.min(4, Math.max(.25, Number((C.value + e).toFixed(2))));
1018
+ }
1019
+ function _e() {
1020
+ C.value = 1;
1021
+ }
1022
+ function ve() {
1023
+ return R("button", {
1024
+ type: "button",
1025
+ class: "vmd-mermaid-retry",
1026
+ "data-vmd-part": "mermaid-retry",
1027
+ "data-action": "retry",
1028
+ onClick: X
1029
+ }, e(p.labels.retry));
1030
+ }
1031
+ function X() {
1032
+ return ye.apply(this, arguments);
1033
+ }
1034
+ function ye() {
1035
+ return ye = a(function* () {
1036
+ C.value = 1, yield N();
1037
+ }), ye.apply(this, arguments);
1038
+ }
1039
+ function Z() {
1040
+ S.value = "preview", C.value = 1;
1041
+ }
1042
+ function xe() {
1043
+ S.value = "source";
1044
+ }
1045
+ let Se = M(() => ({
1046
+ copy: L,
1047
+ exportPng: de,
1048
+ downloadSvg: W,
1049
+ fullscreen: () => K(),
1050
+ retry: X,
1051
+ zoomIn: () => Y(.25),
1052
+ zoomOut: () => Y(-.25),
1053
+ resetZoom: _e
1054
+ }));
1055
+ function Ce(e) {
1056
+ return we.apply(this, arguments);
1057
+ }
1058
+ function we() {
1059
+ return we = a(function* (e) {
1060
+ try {
1061
+ yield e.run(r({ source: g.value }, Se.value)), f("action", e.key);
1062
+ } catch (r) {
1063
+ var i;
1064
+ let a = `The "${e.key}" action failed: ${t(r)}`;
1065
+ f("error", a), (i = p.onRenderError) == null || i.call(p, n("action-error", a, {
1066
+ severity: "warning",
1067
+ phase: "render",
1068
+ plugin: "mermaid"
1069
+ }));
1070
+ }
1071
+ }), we.apply(this, arguments);
1072
+ }
1073
+ let Te = M(() => ({
1074
+ source: g.value,
1075
+ label: ae.value,
1076
+ view: S.value,
1077
+ status: v.value,
1078
+ copied: E.value,
1079
+ fullscreen: w.value,
1080
+ compact: d.compact,
1081
+ actions: Se.value,
1082
+ showPreview: Z,
1083
+ showSource: xe
1084
+ })), Ee = M(() => ({
1085
+ view: S.value,
1086
+ status: v.value,
1087
+ actions: {
1088
+ preview: Z,
1089
+ source: xe
1090
+ }
1091
+ })), De = M(() => ({
1092
+ source: g.value,
1093
+ status: v.value,
1094
+ copied: E.value,
1095
+ fullscreen: w.value,
1096
+ enableZoom: d.enableZoom,
1097
+ allowFullscreen: d.allowFullscreen,
1098
+ compact: d.compact,
1099
+ actions: Se.value
1100
+ })), Oe = I({ setup() {
1101
+ return () => {
1102
+ var t;
1103
+ return p.renderHostSlot("mermaid", {
1104
+ source: g.value,
1105
+ svg: (t = b.value) == null ? void 0 : t.svg,
1106
+ status: v.value,
1107
+ error: x.value,
1108
+ actions: {
1109
+ copy: L,
1110
+ exportPng: de,
1111
+ fullscreen: () => K(),
1112
+ retry: X
1113
+ }
1114
+ }, () => {
1115
+ let t = m.mermaid;
1116
+ if (t) {
1117
+ var n;
1118
+ let e = t({
1119
+ source: g.value,
1120
+ svg: (n = b.value) == null ? void 0 : n.svg,
1121
+ status: v.value,
1122
+ error: x.value,
1123
+ actions: {
1124
+ copy: L,
1125
+ exportPng: de,
1126
+ fullscreen: () => K(),
1127
+ retry: X
1128
+ }
1129
+ });
1130
+ if (!s(e)) return e;
1131
+ }
1132
+ return b.value ? R("div", {
1133
+ class: "vmd-mermaid-diagram",
1134
+ style: { transform: `scale(${C.value})` }
1135
+ }, $(b.value.nodes, p)) : v.value === "error" ? d.showErrors ? R("div", {
1136
+ "data-vmd-part": "mermaid-error",
1137
+ class: "vmd-mermaid-error",
1138
+ role: "status"
1139
+ }, [x.value, ve()]) : R("div", {
1140
+ "data-vmd-part": "mermaid-fallback",
1141
+ class: "vmd-mermaid-fallback",
1142
+ role: "status"
1143
+ }, [R("span", { class: "vmd-mermaid-fallback-message" }, e(p.labels.mermaidFallback)), ve()]) : R("div", {
1144
+ "data-vmd-part": "mermaid-pending",
1145
+ class: "vmd-mermaid-pending",
1146
+ role: "status"
1147
+ }, "Rendering diagram…");
1148
+ });
1149
+ };
1150
+ } }), ke = I({ setup() {
1151
+ return () => p.renderHostSlot("mermaid-error", {
1152
+ source: g.value,
1153
+ error: x.value,
1154
+ retry: X,
1155
+ focusSource: xe
1156
+ }, () => {
1157
+ let e = m["mermaid-error"];
1158
+ if (e) {
1159
+ let t = e({
1160
+ source: g.value,
1161
+ error: x.value,
1162
+ retry: X,
1163
+ focusSource: xe
1164
+ });
1165
+ if (!s(t)) return t;
1166
+ }
1167
+ return R("div", {
1168
+ "data-vmd-part": "mermaid-error",
1169
+ class: "vmd-mermaid-error",
1170
+ role: "status"
1171
+ }, [x.value, ve()]);
1172
+ });
1173
+ } }), He = I({ setup() {
1174
+ return () => p.renderHostSlot("tabs", Ee.value, () => {
1175
+ let t = m.tabs;
1176
+ if (t) {
1177
+ let e = t(Ee.value);
1178
+ if (!s(e)) return e;
1179
+ }
1180
+ return R("div", {
1181
+ "data-vmd-part": "mermaid-tabs",
1182
+ class: "vmd-mermaid-tabs",
1183
+ role: "tablist"
1184
+ }, [R("button", {
1185
+ type: "button",
1186
+ role: "tab",
1187
+ "data-action": "preview",
1188
+ "aria-selected": S.value === "preview" ? "true" : "false",
1189
+ "data-active": S.value === "preview" ? "true" : void 0,
1190
+ onClick: Z
1191
+ }, [R(be, { name: "preview" }), e(p.labels.preview)]), R("button", {
1192
+ type: "button",
1193
+ role: "tab",
1194
+ "data-action": "source",
1195
+ "aria-selected": S.value === "source" ? "true" : "false",
1196
+ "data-active": S.value === "source" ? "true" : void 0,
1197
+ onClick: xe
1198
+ }, [R(be, { name: "source" }), e(p.labels.source)])]);
1199
+ });
1200
+ } }), Ue = I({ setup() {
1201
+ return () => p.renderHostSlot("actions", De.value, () => {
1202
+ let t = m.actions;
1203
+ if (t) {
1204
+ let e = t(De.value);
1205
+ if (!s(e)) return e;
1206
+ }
1207
+ if (d.compact) return null;
1208
+ let n = E.value ? e(p.labels.copied) : e(p.labels.copy), r = (e, t, n, r) => R("button", {
1209
+ type: "button",
1210
+ class: "vmd-mermaid-action",
1211
+ "data-vmd-part": "mermaid-action",
1212
+ "data-action": e,
1213
+ "data-icon": "true",
1214
+ "aria-label": t,
1215
+ title: t,
1216
+ onClick: r
1217
+ }, [R(be, { name: n }), R("span", { class: "vmd-visually-hidden" }, t)]), i = [];
1218
+ d.enableZoom && i.push(r("zoom-in", e(p.labels.zoomIn), "zoom-in", () => Y(.25)), r("zoom-out", e(p.labels.zoomOut), "zoom-out", () => Y(-.25)), r("reset-zoom", e(p.labels.reset), "reset", _e)), i.push(r("copy", n, E.value ? "check" : "copy", L), r("export-png", e(p.labels.exportPng), "image", de), r("download-svg", `${e(p.labels.download)} SVG`, "download", W)), d.allowFullscreen && i.push(r("fullscreen", w.value ? e(p.labels.exitFullscreen) : e(p.labels.fullscreen), w.value ? "exit-fullscreen" : "fullscreen", () => K())), i.push(r("retry", e(p.labels.retry), "retry", X));
1219
+ for (let t of d.actions) {
1220
+ let n = e(t.label);
1221
+ i.push(R("button", {
1222
+ type: "button",
1223
+ class: "vmd-mermaid-action",
1224
+ "data-vmd-part": "mermaid-action",
1225
+ "data-action": t.key,
1226
+ onClick: () => void Ce(t)
1227
+ }, n));
1228
+ }
1229
+ return R("div", {
1230
+ "data-vmd-part": "mermaid-actions",
1231
+ class: "vmd-mermaid-actions"
1232
+ }, i);
1233
+ });
1234
+ } }), We = I({ setup() {
1235
+ return () => p.renderHostSlot("header", Te.value, () => {
1236
+ let e = m.header;
1237
+ if (e) {
1238
+ let t = e(Te.value);
1239
+ if (!s(t)) return t;
1240
+ }
1241
+ return [
1242
+ R("span", { class: "vmd-mermaid-label" }, [R(be, { name: "diagram" }), ae.value]),
1243
+ R(He),
1244
+ R(Ue)
1245
+ ];
1246
+ });
1247
+ } });
1248
+ return l({
1249
+ render: N,
1250
+ copy: L,
1251
+ exportPng: de,
1252
+ downloadSvg: W,
1253
+ toggleFullscreen: K
1254
+ }), (e, t) => (H(), P("div", {
1255
+ ref_key: "root",
1256
+ ref: T,
1257
+ "data-vmd-part": "mermaid",
1258
+ class: "vmd-mermaid",
1259
+ "data-vmd-theme": _.value,
1260
+ "data-status": v.value,
1261
+ "data-renderer": ie.value,
1262
+ "data-fullscreen": w.value ? "true" : void 0,
1263
+ "data-compact": o.compact ? "true" : void 0,
1264
+ "data-view": S.value,
1265
+ role: "figure",
1266
+ "aria-label": ae.value,
1267
+ tabindex: "-1"
1268
+ }, [ce("div", {
1269
+ class: "vmd-mermaid-surface",
1270
+ "data-vmd-part": w.value ? "mermaid-fullscreen" : void 0
1271
+ }, [ce("div", Me, [F(q(We))]), S.value === "preview" ? (H(), P("div", Ne, [b.value && v.value === "error" && o.showErrors ? (H(), P("div", Pe, [F(q(ke))])) : se("", !0), F(q(Oe))])) : (H(), P("pre", Fe, [ce("code", null, me(g.value), 1)]))], 8, je)], 8, Ae));
1272
+ }
1273
+ }), Ue = /* @__PURE__ */ I({
1274
+ __name: "MarkdownMermaid",
1275
+ props: {
1276
+ node: { default: void 0 },
1277
+ code: { default: void 0 },
1278
+ renderer: { default: void 0 },
1279
+ theme: { default: void 0 },
1280
+ showErrors: {
1281
+ type: Boolean,
1282
+ default: !1
1283
+ },
1284
+ enableZoom: {
1285
+ type: Boolean,
1286
+ default: !0
1287
+ },
1288
+ allowFullscreen: {
1289
+ type: Boolean,
1290
+ default: !0
1291
+ },
1292
+ compact: {
1293
+ type: Boolean,
1294
+ default: !1
1295
+ },
1296
+ actions: { default: () => [] }
1297
+ },
1298
+ emits: [
1299
+ "rendered",
1300
+ "error",
1301
+ "copy",
1302
+ "export",
1303
+ "fullscreen",
1304
+ "action"
1305
+ ],
1306
+ setup(e, { expose: t, emit: n }) {
1307
+ let r = e, i = n, a = c(), o = U(), s = M(() => {
1308
+ var e, t;
1309
+ return (e = r.code) == null ? ((t = r.node) == null ? void 0 : t.kind) === "mermaid" ? r.node.code : "" : e;
1310
+ }), l = M(() => {
1311
+ var e;
1312
+ return (e = a.regions) == null ? void 0 : e.mermaidBlock;
1313
+ });
1314
+ function u() {
1315
+ var e;
1316
+ return (e = o.value) == null ? void 0 : e.render();
1317
+ }
1318
+ function d() {
1319
+ var e;
1320
+ return (e = o.value) == null ? void 0 : e.copy();
1321
+ }
1322
+ function f() {
1323
+ var e;
1324
+ return (e = o.value) == null ? void 0 : e.exportPng();
1325
+ }
1326
+ function p() {
1327
+ var e;
1328
+ (e = o.value) == null || e.downloadSvg();
1329
+ }
1330
+ function m() {
1331
+ var e;
1332
+ return (e = o.value) == null ? void 0 : e.toggleFullscreen();
1333
+ }
1334
+ return t({
1335
+ render: u,
1336
+ copy: d,
1337
+ exportPng: f,
1338
+ downloadSvg: p,
1339
+ toggleFullscreen: m
1340
+ }), (t, n) => l.value ? (H(), N(pe(l.value), {
1341
+ key: 0,
1342
+ node: e.node,
1343
+ source: s.value,
1344
+ renderer: e.renderer,
1345
+ theme: e.theme,
1346
+ "show-errors": e.showErrors,
1347
+ "enable-zoom": e.enableZoom,
1348
+ "allow-fullscreen": e.allowFullscreen,
1349
+ compact: e.compact,
1350
+ actions: e.actions,
1351
+ onRendered: n[0] || (n[0] = (e) => i("rendered", e)),
1352
+ onError: n[1] || (n[1] = (e) => i("error", e)),
1353
+ onCopy: n[2] || (n[2] = (e) => i("copy", e)),
1354
+ onExport: n[3] || (n[3] = (e) => i("export", e)),
1355
+ onFullscreen: n[4] || (n[4] = (e) => i("fullscreen", e)),
1356
+ onAction: n[5] || (n[5] = (e) => i("action", e))
1357
+ }, le({ _: 2 }, [
1358
+ t.$slots.header ? {
1359
+ name: "header",
1360
+ fn: J((e) => [W(t.$slots, "header", z(L(e || {})))]),
1361
+ key: "0"
1362
+ } : void 0,
1363
+ t.$slots.tabs ? {
1364
+ name: "tabs",
1365
+ fn: J((e) => [W(t.$slots, "tabs", z(L(e || {})))]),
1366
+ key: "1"
1367
+ } : void 0,
1368
+ t.$slots.actions ? {
1369
+ name: "actions",
1370
+ fn: J((e) => [W(t.$slots, "actions", z(L(e || {})))]),
1371
+ key: "2"
1372
+ } : void 0,
1373
+ t.$slots.mermaid ? {
1374
+ name: "mermaid",
1375
+ fn: J((e) => [W(t.$slots, "mermaid", z(L(e || {})))]),
1376
+ key: "3"
1377
+ } : void 0,
1378
+ t.$slots["mermaid-error"] ? {
1379
+ name: "mermaid-error",
1380
+ fn: J((e) => [W(t.$slots, "mermaid-error", z(L(e || {})))]),
1381
+ key: "4"
1382
+ } : void 0
1383
+ ]), 1064, [
1384
+ "node",
1385
+ "source",
1386
+ "renderer",
1387
+ "theme",
1388
+ "show-errors",
1389
+ "enable-zoom",
1390
+ "allow-fullscreen",
1391
+ "compact",
1392
+ "actions"
1393
+ ])) : (H(), N(He, {
1394
+ key: 1,
1395
+ ref_key: "block",
1396
+ ref: o,
1397
+ node: e.node,
1398
+ source: s.value,
1399
+ renderer: e.renderer,
1400
+ theme: e.theme,
1401
+ "show-errors": e.showErrors,
1402
+ "enable-zoom": e.enableZoom,
1403
+ "allow-fullscreen": e.allowFullscreen,
1404
+ compact: e.compact,
1405
+ actions: e.actions,
1406
+ onRendered: n[6] || (n[6] = (e) => i("rendered", e)),
1407
+ onError: n[7] || (n[7] = (e) => i("error", e)),
1408
+ onCopy: n[8] || (n[8] = (e) => i("copy", e)),
1409
+ onExport: n[9] || (n[9] = (e) => i("export", e)),
1410
+ onFullscreen: n[10] || (n[10] = (e) => i("fullscreen", e)),
1411
+ onAction: n[11] || (n[11] = (e) => i("action", e))
1412
+ }, le({ _: 2 }, [
1413
+ t.$slots.header ? {
1414
+ name: "header",
1415
+ fn: J((e) => [W(t.$slots, "header", z(L(e || {})))]),
1416
+ key: "0"
1417
+ } : void 0,
1418
+ t.$slots.tabs ? {
1419
+ name: "tabs",
1420
+ fn: J((e) => [W(t.$slots, "tabs", z(L(e || {})))]),
1421
+ key: "1"
1422
+ } : void 0,
1423
+ t.$slots.actions ? {
1424
+ name: "actions",
1425
+ fn: J((e) => [W(t.$slots, "actions", z(L(e || {})))]),
1426
+ key: "2"
1427
+ } : void 0,
1428
+ t.$slots.mermaid ? {
1429
+ name: "mermaid",
1430
+ fn: J((e) => [W(t.$slots, "mermaid", z(L(e || {})))]),
1431
+ key: "3"
1432
+ } : void 0,
1433
+ t.$slots["mermaid-error"] ? {
1434
+ name: "mermaid-error",
1435
+ fn: J((e) => [W(t.$slots, "mermaid-error", z(L(e || {})))]),
1436
+ key: "4"
1437
+ } : void 0
1438
+ ]), 1032, [
1439
+ "node",
1440
+ "source",
1441
+ "renderer",
1442
+ "theme",
1443
+ "show-errors",
1444
+ "enable-zoom",
1445
+ "allow-fullscreen",
1446
+ "compact",
1447
+ "actions"
1448
+ ]));
1449
+ }
1450
+ }), We = {
1451
+ p: D,
1452
+ h1: v,
1453
+ h2: v,
1454
+ h3: v,
1455
+ h4: v,
1456
+ h5: v,
1457
+ h6: v,
1458
+ em: _,
1459
+ strong: ie,
1460
+ del: O,
1461
+ a: S,
1462
+ img: b,
1463
+ ul: C,
1464
+ ol: C,
1465
+ li: w,
1466
+ blockquote: m,
1467
+ hr: y,
1468
+ table: ae,
1469
+ thead: j,
1470
+ tbody: j,
1471
+ tfoot: j,
1472
+ tr: oe,
1473
+ th: A,
1474
+ td: A,
1475
+ code: x,
1476
+ br: h
1477
+ }, Ge = {
1478
+ p: "paragraph",
1479
+ h1: "heading",
1480
+ h2: "heading",
1481
+ h3: "heading",
1482
+ h4: "heading",
1483
+ h5: "heading",
1484
+ h6: "heading",
1485
+ em: "emphasis",
1486
+ strong: "strong",
1487
+ del: "strikethrough",
1488
+ a: "link",
1489
+ img: "image",
1490
+ ul: "list",
1491
+ ol: "list",
1492
+ li: "listItem",
1493
+ blockquote: "blockquote",
1494
+ hr: "horizontalRule",
1495
+ table: "table",
1496
+ thead: "tableSection",
1497
+ tbody: "tableSection",
1498
+ tfoot: "tableSection",
1499
+ tr: "tableRow",
1500
+ th: "tableCell",
1501
+ td: "tableCell",
1502
+ code: "inlineCode",
1503
+ br: "break",
1504
+ input: "taskItem"
1505
+ };
1506
+ function Ke(e) {
1507
+ if (e === "code") return p;
1508
+ if (e === "custom") return g;
1509
+ if (e === "math") return ke;
1510
+ if (e === "mermaid") return Ue;
1511
+ }
1512
+ function Q(e) {
1513
+ return typeof e == "string" || typeof e == "object";
1514
+ }
1515
+ function qe(e) {
1516
+ return typeof e == "function";
1517
+ }
1518
+ function Je(e) {
1519
+ var t;
1520
+ return e.kind === "element" ? (t = Ge[e.tag]) == null ? e.tag : t : e.kind;
1521
+ }
1522
+ function Ye(e) {
1523
+ var t;
1524
+ return ((t = e.attrs.class) == null ? "" : t).split(/\s+/).filter(Boolean);
1525
+ }
1526
+ function Xe(e) {
1527
+ return e.children.find((e) => e.kind === "element" && e.tag === "input" && e.attrs.type === "checkbox");
1528
+ }
1529
+ function Ze(e) {
1530
+ if (e.kind === "element") {
1531
+ if (e.tag === "li" && Xe(e)) return "taskItem";
1532
+ if (e.tag === "sup" && (Ye(e).includes("footnote-ref") || e.attrs["data-footnote-ref"] !== void 0 || e.children.some((e) => e.kind === "element" && e.tag === "a" && (Ye(e).includes("footnote-ref") || e.attrs["data-footnote-ref"] !== void 0)))) return "footnoteReference";
1533
+ if (e.tag === "section" && (Ye(e).includes("footnotes") || e.attrs["data-footnotes"] !== void 0)) return "footnotes";
1534
+ }
1535
+ }
1536
+ function Qe(e, t) {
1537
+ for (let n of e) if (n.kind === "element" && n.attrs.id === t || "children" in n && Array.isArray(n.children) && Qe(n.children, t)) return !0;
1538
+ return !1;
1539
+ }
1540
+ function $e(e) {
1541
+ if (e.kind === "element") for (let n of e.children) {
1542
+ var t;
1543
+ if (n.kind === "element" && n.tag === "a" && (t = n.attrs.href) != null && t.startsWith("#")) return n.attrs.href.slice(1);
1544
+ }
1545
+ }
1546
+ function et(e) {
1547
+ if (e.kind === "element") {
1548
+ let t = Je(e);
1549
+ return t === e.tag ? [e.tag] : [e.tag, t];
1550
+ }
1551
+ return e.kind === "custom" ? [e.tag, "custom"] : e.kind === "plugin" ? [e.type, "plugin"] : [e.kind];
1552
+ }
1553
+ function tt(e, t) {
1554
+ for (let r of et(e)) {
1555
+ var n;
1556
+ let e = (n = t.nodeComponents) == null ? void 0 : n[r];
1557
+ if (qe(e)) return e;
1558
+ }
1559
+ }
1560
+ function nt(e, t) {
1561
+ if (e.kind === "element" && e.tag === "code") {
1562
+ var n;
1563
+ let e = (n = t.nodeComponents) == null ? void 0 : n.inlineCode;
1564
+ if (Q(e)) return e;
1565
+ let r = t.components.code;
1566
+ return typeof r == "function" || Q(r) ? r : void 0;
1567
+ }
1568
+ let r = Ze(e);
1569
+ if (r) {
1570
+ var i;
1571
+ let e = (i = t.nodeComponents) == null ? void 0 : i[r];
1572
+ if (Q(e)) return e;
1573
+ }
1574
+ let a = Je(e);
1575
+ for (let n of et(e)) {
1576
+ var o, s;
1577
+ let e = (o = t.nodeComponents) == null ? void 0 : o[n];
1578
+ if (Q(e)) return e;
1579
+ let r = t.components[n];
1580
+ if (typeof r == "function" || Q(r)) return r;
1581
+ if (n !== a && (s = t.nodeComponents) != null && s[a]) {
1582
+ let e = t.nodeComponents[a];
1583
+ if (Q(e)) return e;
1584
+ }
1585
+ }
1586
+ }
1587
+ function rt(e, t) {
1588
+ if (!e.segments || e.segments.length === 0) return e.value;
1589
+ let n = t.components.mark;
1590
+ return e.segments.map((e, t) => e.match ? typeof n == "string" ? R(n, {
1591
+ class: "vmd-search-match",
1592
+ "data-vmd-part": "search-match",
1593
+ key: t
1594
+ }, e.value) : typeof n == "object" || typeof n == "function" ? R(n, {
1595
+ class: "vmd-search-match",
1596
+ "data-vmd-part": "search-match",
1597
+ key: t
1598
+ }, { default: () => e.value }) : R("mark", {
1599
+ class: "vmd-search-match",
1600
+ "data-vmd-part": "search-match",
1601
+ key: t
1602
+ }, e.value) : e.value);
1603
+ }
1604
+ function it(e, t) {
1605
+ var n;
1606
+ let r = (n = t.nodeComponents) == null ? void 0 : n[e];
1607
+ return Q(r) ? r : void 0;
1608
+ }
1609
+ function at(e) {
1610
+ return e.kind === "element" || e.kind === "custom" ? {
1611
+ kind: e.kind,
1612
+ tag: e.tag,
1613
+ attrs: e.attrs
1614
+ } : {
1615
+ kind: e.kind,
1616
+ attrs: {}
1617
+ };
1618
+ }
1619
+ function ot(e, t) {
1620
+ return () => $(e.children, t);
1621
+ }
1622
+ var st = /* @__PURE__ */ new WeakMap();
1623
+ function ct(e) {
1624
+ let t = st.get(e);
1625
+ if (t !== void 0) return t;
1626
+ let n = e.props, r = Array.isArray(n) ? n.indexOf("children") !== -1 : typeof n == "object" && !!n && Object.prototype.hasOwnProperty.call(n, "children");
1627
+ return st.set(e, r), r;
1628
+ }
1629
+ function lt(e, t, n, i, a = {}, o) {
1630
+ let s = r(r(r({}, i), a), {}, { key: t.key });
1631
+ "children" in s && (typeof e == "string" || !ct(e)) && delete s.children;
1632
+ let c = o == null ? (() => []) : o;
1633
+ return typeof e == "string" ? R(e, s, c()) : R(e, r(r({}, s), {}, { node: t }), { default: c });
1634
+ }
1635
+ function ut(e, t, n = !1) {
1636
+ var i, a, o;
1637
+ let s = (i = t.nodeComponents) == null ? void 0 : i.code, c = e.language ? `language-${e.language}` : void 0, l = `${e.key}-code`;
1638
+ if (!n && qe(s)) return s(r(r({ node: e }, at(e)), {}, {
1639
+ key: l,
1640
+ children: () => [e.code],
1641
+ defaultRender: () => ut(e, t, !0),
1642
+ context: t
1643
+ }));
1644
+ let u = (a = (o = Q(s) ? s : void 0) == null ? Q(t.components.code) ? t.components.code : void 0 : o) == null ? "code" : a;
1645
+ return typeof u == "string" ? R(u, {
1646
+ class: c ? ["vmd-code-element", c] : "vmd-code-element",
1647
+ key: l
1648
+ }, e.code) : R(u, r({
1649
+ node: e,
1650
+ className: c,
1651
+ key: l
1652
+ }, s ? {
1653
+ code: e.code,
1654
+ language: e.language
1655
+ } : {}), { default: () => [e.code] });
1656
+ }
1657
+ function dt(e, t) {
1658
+ var n, r;
1659
+ let i = t.components.pre;
1660
+ return typeof i == "function" || Q(i) ? lt(i, e, t, {}, {}, () => [ut(e, t)]) : Q(t.components.code) || Q((n = t.nodeComponents) == null ? void 0 : n.code) || qe((r = t.nodeComponents) == null ? void 0 : r.code) ? lt(p, e, t, {}, {}, () => [ut(e, t)]) : R(Ee, {
1661
+ node: e,
1662
+ key: e.key
1663
+ });
1664
+ }
1665
+ function ft(e, t) {
1666
+ let n = Xe(e), r = (n == null ? void 0 : n.attrs.checked) !== void 0 && n.attrs.checked !== "false", i = e.children.filter((e) => e !== n);
1667
+ return R(k, {
1668
+ node: e,
1669
+ key: e.key,
1670
+ checked: r,
1671
+ children: e.children
1672
+ }, { default: () => $(i, t) });
1673
+ }
1674
+ function pt(e, t) {
1675
+ return R(E, {
1676
+ node: e,
1677
+ key: e.key
1678
+ }, { default: () => $(e.children, t) });
1679
+ }
1680
+ function mt(e, t) {
1681
+ let n = $e(e), r = n !== void 0 && t.document !== void 0 && !Qe(t.document.nodes, n);
1682
+ return R(T, {
1683
+ node: e,
1684
+ key: e.key,
1685
+ missing: r
1686
+ }, { default: () => $(e.children, t) });
1687
+ }
1688
+ function ht(e, t, n) {
1689
+ if (n === "taskItem") return ft(e, t);
1690
+ if (n === "footnotes") return pt(e, t);
1691
+ if (n === "footnoteReference") return mt(e, t);
1692
+ }
1693
+ function gt(e, t) {
1694
+ var n;
1695
+ let r = (n = it(e.tag, t)) == null ? it("custom", t) : n;
1696
+ return lt(r == null ? g : r, e, t, e.attrs, {
1697
+ tag: e.tag,
1698
+ customProps: e.props
1699
+ }, ot(e, t));
1700
+ }
1701
+ function _t(e, t) {
1702
+ switch (e.kind) {
1703
+ case "text": return rt(e, t);
1704
+ case "element": {
1705
+ let n = nt(e, t);
1706
+ if (!n) {
1707
+ let n = Ze(e), r = n ? ht(e, t, n) : void 0;
1708
+ if (r !== void 0) return r;
1709
+ }
1710
+ let i = n == null ? We[e.tag] : n;
1711
+ if (!i) {
1712
+ let n = r({}, e.attrs);
1713
+ return delete n.children, R(e.tag, r(r({}, n), {}, { key: e.key }), ot(e, t)());
1714
+ }
1715
+ return lt(i, e, t, e.attrs, { children: e.children }, ot(e, t));
1716
+ }
1717
+ case "code": return dt(e, t);
1718
+ case "custom": return gt(e, t);
1719
+ case "math":
1720
+ var n, i;
1721
+ return lt((n = (i = nt(e, t)) == null ? Ke("math") : i) == null ? "span" : n, e, t, {}, {
1722
+ tex: e.tex,
1723
+ displayMode: e.displayMode,
1724
+ rendered: e.rendered
1725
+ });
1726
+ case "mermaid":
1727
+ var a, o;
1728
+ return lt((a = (o = nt(e, t)) == null ? Ke("mermaid") : o) == null ? "pre" : a, e, t, {}, { code: e.code });
1729
+ case "plugin":
1730
+ var s, c;
1731
+ return lt((s = (c = nt(e, t)) == null ? Ke(e.type) : c) == null ? "div" : s, e, t, {}, { payload: e.payload }, e.children ? () => $(e.children, t) : () => []);
1732
+ default: return null;
1733
+ }
1734
+ }
1735
+ function vt(e, t) {
1736
+ if (e.kind === "text") return rt(e, t);
1737
+ if (e.kind !== "code") {
1738
+ let n = tt(e, t);
1739
+ if (n) {
1740
+ let i = n, a = e.kind === "element" || e.kind === "custom" ? ot(e, t) : void 0;
1741
+ return i(r(r({ node: e }, at(e)), {}, {
1742
+ key: e.key,
1743
+ children: () => a ? a() : [],
1744
+ defaultRender: () => _t(e, t),
1745
+ context: t
1746
+ }));
1747
+ }
1748
+ }
1749
+ return _t(e, t);
1750
+ }
1751
+ function $(e, t) {
1752
+ return e.map((e) => vt(e, t));
1753
+ }
1754
+ export { Ee as a, ke as i, Ue as n, ye as o, He as r, ve as s, $ as t };