@superlc/md-vue 0.2.0 → 0.2.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.
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
- import { defineComponent as C, ref as h, h as e, computed as B, onMounted as $, onUnmounted as F, watch as H } from "vue";
2
- import { detectColorScheme as te, observeColorScheme as ae, MermaidRenderer as ne, downloadAsPng as le, parseToHast as j, createStreamingParser as P, OutputRateController as U } from "@superlc/md-core";
3
- let O = !1, A = null;
1
+ import { defineComponent as C, ref as y, h as t, computed as N, onMounted as $, onUnmounted as E, watch as T } from "vue";
2
+ import { detectColorScheme as te, observeColorScheme as ae, downloadAsPng as ne, MermaidRenderer as le, parseToHast as j, createStreamingParser as P, OutputRateController as U } from "@superlc/md-core";
3
+ let R = !1, F = null;
4
4
  async function oe() {
5
- if (!O)
6
- return A || (A = (async () => {
7
- await import("katex/dist/katex.min.css"), O = !0;
8
- })(), A);
5
+ if (!R)
6
+ return F || (F = (async () => {
7
+ await import("katex/dist/katex.min.css"), R = !0;
8
+ })(), F);
9
9
  }
10
- function Se() {
11
- return O;
10
+ function Ne() {
11
+ return R;
12
12
  }
13
13
  function Y() {
14
14
  return oe();
15
15
  }
16
- async function re(t) {
16
+ async function re(e) {
17
17
  try {
18
- return await navigator.clipboard.writeText(t), !0;
18
+ return await navigator.clipboard.writeText(e), !0;
19
19
  } catch {
20
- return se(t);
20
+ return se(e);
21
21
  }
22
22
  }
23
- function se(t) {
23
+ function se(e) {
24
24
  const n = document.createElement("textarea");
25
- n.value = t, n.style.position = "fixed", n.style.left = "-9999px", document.body.appendChild(n), n.select();
25
+ n.value = e, n.style.position = "fixed", n.style.left = "-9999px", document.body.appendChild(n), n.select();
26
26
  try {
27
27
  return document.execCommand("copy"), !0;
28
28
  } catch {
@@ -31,31 +31,31 @@ function se(t) {
31
31
  document.body.removeChild(n);
32
32
  }
33
33
  }
34
- const ue = () => e(
34
+ const ue = () => t(
35
35
  "svg",
36
36
  {
37
37
  viewBox: "0 0 24 24",
38
38
  fill: "currentColor"
39
39
  },
40
40
  [
41
- e("path", {
41
+ t("path", {
42
42
  d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
43
43
  })
44
44
  ]
45
- ), ce = () => e(
45
+ ), ce = () => t(
46
46
  "svg",
47
47
  {
48
48
  viewBox: "0 0 24 24",
49
49
  fill: "currentColor"
50
50
  },
51
51
  [
52
- e("path", {
52
+ t("path", {
53
53
  d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
54
54
  })
55
55
  ]
56
56
  );
57
- function X(t) {
58
- return typeof t == "string" ? t : Array.isArray(t) ? t.map((n) => typeof n == "string" ? n : n && typeof n == "object" && "children" in n ? X(n.children) : "").join("") : "";
57
+ function X(e) {
58
+ return typeof e == "string" ? e : Array.isArray(e) ? e.map((n) => typeof n == "string" ? n : n && typeof n == "object" && "children" in n ? X(n.children) : "").join("") : "";
59
59
  }
60
60
  const q = C({
61
61
  name: "CodeBlock",
@@ -66,29 +66,29 @@ const q = C({
66
66
  }
67
67
  },
68
68
  emits: ["copy"],
69
- setup(t, { slots: n, emit: l }) {
70
- const s = h(!1), o = async () => {
69
+ setup(e, { slots: n, emit: l }) {
70
+ const r = y(!1), o = async () => {
71
71
  var u;
72
- const a = (u = n.default) == null ? void 0 : u.call(n), r = a ? X(a) : "";
73
- await re(r) && (s.value = !0, l("copy", r), setTimeout(() => {
74
- s.value = !1;
72
+ const a = (u = n.default) == null ? void 0 : u.call(n), s = a ? X(a) : "";
73
+ await re(s) && (r.value = !0, l("copy", s), setTimeout(() => {
74
+ r.value = !1;
75
75
  }, 2e3));
76
76
  };
77
77
  return () => {
78
- var r;
79
- const a = (r = n.default) == null ? void 0 : r.call(n);
80
- return e("div", { class: "md-code-block-wrapper" }, [
81
- e("pre", {}, a),
82
- t.showCopyButton && e(
78
+ var s;
79
+ const a = (s = n.default) == null ? void 0 : s.call(n);
80
+ return t("div", { class: "md-code-block-wrapper" }, [
81
+ t("pre", {}, a),
82
+ e.showCopyButton && t(
83
83
  "button",
84
84
  {
85
85
  type: "button",
86
- class: `md-copy-button${s.value ? " md-copy-button--copied" : ""}`,
86
+ class: `md-copy-button${r.value ? " md-copy-button--copied" : ""}`,
87
87
  onClick: o,
88
- title: s.value ? "已复制" : "复制代码",
89
- "aria-label": s.value ? "已复制" : "复制代码"
88
+ title: r.value ? "已复制" : "复制代码",
89
+ "aria-label": r.value ? "已复制" : "复制代码"
90
90
  },
91
- [s.value ? e(ce) : e(ue)]
91
+ [r.value ? t(ce) : t(ue)]
92
92
  )
93
93
  ]);
94
94
  };
@@ -99,24 +99,24 @@ const q = C({
99
99
  step: 0.25,
100
100
  default: 1
101
101
  };
102
- function W(t = {}) {
102
+ function W(e = {}) {
103
103
  const {
104
104
  config: n,
105
105
  enableDrag: l = !1,
106
- enableWheelZoom: s = !1
107
- } = t, o = { ...ie, ...n }, a = h({
106
+ enableWheelZoom: r = !1
107
+ } = e, o = { ...ie, ...n }, a = y({
108
108
  scale: o.default,
109
109
  translateX: 0,
110
110
  translateY: 0
111
- }), r = h(!1), c = h({ x: 0, y: 0 }), u = h({ x: 0, y: 0 }), d = (g) => Math.max(o.min, Math.min(o.max, g)), v = B(() => a.value.scale < o.max), y = B(() => a.value.scale > o.min), m = () => {
111
+ }), s = y(!1), i = y({ x: 0, y: 0 }), u = y({ x: 0, y: 0 }), c = (m) => Math.max(o.min, Math.min(o.max, m)), f = N(() => a.value.scale < o.max), g = N(() => a.value.scale > o.min), v = () => {
112
112
  a.value = {
113
113
  ...a.value,
114
- scale: d(a.value.scale + o.step)
114
+ scale: c(a.value.scale + o.step)
115
115
  };
116
- }, i = () => {
116
+ }, d = () => {
117
117
  a.value = {
118
118
  ...a.value,
119
- scale: d(a.value.scale - o.step)
119
+ scale: c(a.value.scale - o.step)
120
120
  };
121
121
  }, p = () => {
122
122
  a.value = {
@@ -124,72 +124,72 @@ function W(t = {}) {
124
124
  translateX: 0,
125
125
  translateY: 0
126
126
  };
127
- }, k = (g) => {
127
+ }, M = (m) => {
128
128
  a.value = {
129
129
  ...a.value,
130
- scale: d(g)
130
+ scale: c(m)
131
131
  };
132
- }, f = (g, z) => {
133
- const T = g.width / z.width, M = g.height / z.height, V = Math.min(T, M) * 0.95;
132
+ }, h = (m, b) => {
133
+ const k = m.width / b.width, z = m.height / b.height, V = Math.min(k, z) * 0.95;
134
134
  a.value = {
135
- scale: d(V),
135
+ scale: c(V),
136
136
  translateX: 0,
137
137
  translateY: 0
138
138
  };
139
- }, I = (g) => {
140
- l && (g.preventDefault(), r.value = !0, c.value = { x: g.clientX, y: g.clientY }, u.value = { x: a.value.translateX, y: a.value.translateY });
141
- }, x = (g) => {
142
- if (!r.value) return;
143
- const z = g.clientX - c.value.x, T = g.clientY - c.value.y;
139
+ }, x = (m) => {
140
+ l && (m.preventDefault(), s.value = !0, i.value = { x: m.clientX, y: m.clientY }, u.value = { x: a.value.translateX, y: a.value.translateY });
141
+ }, w = (m) => {
142
+ if (!s.value) return;
143
+ const b = m.clientX - i.value.x, k = m.clientY - i.value.y;
144
144
  a.value = {
145
145
  ...a.value,
146
- translateX: u.value.x + z,
147
- translateY: u.value.y + T
146
+ translateX: u.value.x + b,
147
+ translateY: u.value.y + k
148
148
  };
149
- }, b = () => {
150
- r.value = !1;
151
- }, w = (g) => {
152
- if (!s) return;
153
- g.preventDefault();
154
- const z = g.deltaY > 0 ? -o.step : o.step;
149
+ }, B = () => {
150
+ s.value = !1;
151
+ }, I = (m) => {
152
+ if (!r) return;
153
+ m.preventDefault();
154
+ const b = m.deltaY > 0 ? -o.step : o.step;
155
155
  a.value = {
156
156
  ...a.value,
157
- scale: d(a.value.scale + z)
157
+ scale: c(a.value.scale + b)
158
158
  };
159
- }, S = () => {
159
+ }, L = () => {
160
160
  p();
161
- }, N = B(() => ({
161
+ }, S = N(() => ({
162
162
  transform: `translate(${a.value.translateX}px, ${a.value.translateY}px) scale(${a.value.scale})`,
163
163
  transformOrigin: "center center",
164
- transition: r.value ? "none" : "transform 0.2s ease-out",
165
- cursor: l ? r.value ? "grabbing" : "grab" : "default"
164
+ transition: s.value ? "none" : "transform 0.2s ease-out",
165
+ cursor: l ? s.value ? "grabbing" : "grab" : "default"
166
166
  }));
167
167
  return $(() => {
168
- l && (document.addEventListener("mousemove", x), document.addEventListener("mouseup", b));
169
- }), F(() => {
170
- l && (document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", b));
168
+ l && (document.addEventListener("mousemove", w), document.addEventListener("mouseup", B));
169
+ }), E(() => {
170
+ l && (document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", B));
171
171
  }), {
172
172
  state: a,
173
- zoomIn: m,
174
- zoomOut: i,
173
+ zoomIn: v,
174
+ zoomOut: d,
175
175
  reset: p,
176
- fitToContainer: f,
177
- setScale: k,
178
- canZoomIn: v,
179
- canZoomOut: y,
180
- contentStyle: N,
181
- onMouseDown: I,
182
- onWheel: w,
183
- onDoubleClick: S
176
+ fitToContainer: h,
177
+ setScale: M,
178
+ canZoomIn: f,
179
+ canZoomOut: g,
180
+ contentStyle: S,
181
+ onMouseDown: x,
182
+ onWheel: I,
183
+ onDoubleClick: L
184
184
  };
185
185
  }
186
186
  const de = C({
187
187
  name: "ImageIcon",
188
188
  setup() {
189
- return () => e(
189
+ return () => t(
190
190
  "svg",
191
191
  { viewBox: "0 0 24 24", fill: "currentColor" },
192
- e("path", {
192
+ t("path", {
193
193
  d: "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"
194
194
  })
195
195
  );
@@ -197,43 +197,43 @@ const de = C({
197
197
  }), me = C({
198
198
  name: "CodeIcon",
199
199
  setup() {
200
- return () => e(
200
+ return () => t(
201
201
  "svg",
202
202
  { viewBox: "0 0 24 24", fill: "currentColor" },
203
- e("path", {
203
+ t("path", {
204
204
  d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"
205
205
  })
206
206
  );
207
207
  }
208
- }), K = C({
208
+ }), _ = C({
209
209
  name: "ZoomInIcon",
210
210
  setup() {
211
- return () => e(
211
+ return () => t(
212
212
  "svg",
213
213
  { viewBox: "0 0 24 24", fill: "currentColor" },
214
- e("path", {
214
+ t("path", {
215
215
  d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm.5-7H9v2H7v1h2v2h1v-2h2V9h-2V7z"
216
216
  })
217
217
  );
218
218
  }
219
- }), G = C({
219
+ }), K = C({
220
220
  name: "ZoomOutIcon",
221
221
  setup() {
222
- return () => e(
222
+ return () => t(
223
223
  "svg",
224
224
  { viewBox: "0 0 24 24", fill: "currentColor" },
225
- e("path", {
225
+ t("path", {
226
226
  d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7V9z"
227
227
  })
228
228
  );
229
229
  }
230
- }), _ = C({
230
+ }), G = C({
231
231
  name: "ResetIcon",
232
232
  setup() {
233
- return () => e(
233
+ return () => t(
234
234
  "svg",
235
235
  { viewBox: "0 0 24 24", fill: "currentColor" },
236
- e("path", {
236
+ t("path", {
237
237
  d: "M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"
238
238
  })
239
239
  );
@@ -241,10 +241,10 @@ const de = C({
241
241
  }), ve = C({
242
242
  name: "FullscreenIcon",
243
243
  setup() {
244
- return () => e(
244
+ return () => t(
245
245
  "svg",
246
246
  { viewBox: "0 0 24 24", fill: "currentColor" },
247
- e("path", {
247
+ t("path", {
248
248
  d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"
249
249
  })
250
250
  );
@@ -252,10 +252,10 @@ const de = C({
252
252
  }), fe = C({
253
253
  name: "FullscreenExitIcon",
254
254
  setup() {
255
- return () => e(
255
+ return () => t(
256
256
  "svg",
257
257
  { viewBox: "0 0 24 24", fill: "currentColor" },
258
- e("path", {
258
+ t("path", {
259
259
  d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"
260
260
  })
261
261
  );
@@ -263,10 +263,10 @@ const de = C({
263
263
  }), J = C({
264
264
  name: "DownloadIcon",
265
265
  setup() {
266
- return () => e(
266
+ return () => t(
267
267
  "svg",
268
268
  { viewBox: "0 0 24 24", fill: "currentColor" },
269
- e("path", {
269
+ t("path", {
270
270
  d: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
271
271
  })
272
272
  );
@@ -274,10 +274,10 @@ const de = C({
274
274
  }), pe = C({
275
275
  name: "CloseIcon",
276
276
  setup() {
277
- return () => e(
277
+ return () => t(
278
278
  "svg",
279
279
  { viewBox: "0 0 24 24", fill: "currentColor" },
280
- e("path", {
280
+ t("path", {
281
281
  d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
282
282
  })
283
283
  );
@@ -285,10 +285,10 @@ const de = C({
285
285
  }), he = C({
286
286
  name: "CopyIcon",
287
287
  setup() {
288
- return () => e(
288
+ return () => t(
289
289
  "svg",
290
290
  { viewBox: "0 0 24 24", fill: "currentColor" },
291
- e("path", {
291
+ t("path", {
292
292
  d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
293
293
  })
294
294
  );
@@ -296,10 +296,10 @@ const de = C({
296
296
  }), ye = C({
297
297
  name: "CheckIcon",
298
298
  setup() {
299
- return () => e(
299
+ return () => t(
300
300
  "svg",
301
301
  { viewBox: "0 0 24 24", fill: "currentColor" },
302
- e("path", {
302
+ t("path", {
303
303
  d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
304
304
  })
305
305
  );
@@ -308,10 +308,10 @@ const de = C({
308
308
  C({
309
309
  name: "FitIcon",
310
310
  setup() {
311
- return () => e(
311
+ return () => t(
312
312
  "svg",
313
313
  { viewBox: "0 0 24 24", fill: "currentColor" },
314
- e("path", {
314
+ t("path", {
315
315
  d: "M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"
316
316
  })
317
317
  );
@@ -330,70 +330,70 @@ const ge = C({
330
330
  }
331
331
  },
332
332
  emits: ["close", "download"],
333
- setup(t, { emit: n }) {
334
- const l = h(null), s = h(null), o = h(null), a = h(!1), {
335
- state: r,
336
- zoomIn: c,
333
+ setup(e, { emit: n }) {
334
+ const l = y(null), r = y(null), o = y(null), a = y(!1), {
335
+ state: s,
336
+ zoomIn: i,
337
337
  zoomOut: u,
338
- reset: d,
339
- fitToContainer: v,
340
- canZoomIn: y,
341
- canZoomOut: m,
342
- contentStyle: i,
338
+ reset: c,
339
+ fitToContainer: f,
340
+ canZoomIn: g,
341
+ canZoomOut: v,
342
+ contentStyle: d,
343
343
  onMouseDown: p,
344
- onWheel: k,
345
- onDoubleClick: f
344
+ onWheel: M,
345
+ onDoubleClick: h
346
346
  } = W({
347
347
  enableDrag: !0,
348
348
  enableWheelZoom: !0
349
- }), I = async () => {
349
+ }), x = async () => {
350
350
  if (l.value)
351
351
  try {
352
352
  await l.value.requestFullscreen(), a.value = !0;
353
353
  } catch {
354
354
  a.value = !0;
355
355
  }
356
- }, x = () => {
356
+ }, w = () => {
357
357
  document.fullscreenElement && document.exitFullscreen().catch(() => {
358
358
  }), a.value = !1, n("close");
359
359
  };
360
- H(
361
- () => t.open,
362
- (N) => {
363
- N ? I() : a.value && x();
360
+ T(
361
+ () => e.open,
362
+ (S) => {
363
+ S ? x() : a.value && w();
364
364
  }
365
365
  );
366
- const b = () => {
366
+ const B = () => {
367
367
  !document.fullscreenElement && a.value && (a.value = !1, n("close"));
368
- }, w = (N) => {
368
+ }, I = (S) => {
369
369
  if (a.value)
370
- switch (N.key) {
370
+ switch (S.key) {
371
371
  case "+":
372
372
  case "=":
373
- c();
373
+ i();
374
374
  break;
375
375
  case "-":
376
376
  u();
377
377
  break;
378
378
  case "0":
379
- d();
379
+ c();
380
380
  break;
381
381
  }
382
382
  };
383
383
  $(() => {
384
- document.addEventListener("fullscreenchange", b), document.addEventListener("keydown", w);
385
- }), F(() => {
386
- document.removeEventListener("fullscreenchange", b), document.removeEventListener("keydown", w);
384
+ document.addEventListener("fullscreenchange", B), document.addEventListener("keydown", I);
385
+ }), E(() => {
386
+ document.removeEventListener("fullscreenchange", B), document.removeEventListener("keydown", I);
387
387
  });
388
- const S = () => {
389
- if (!s.value || !o.value) return;
390
- const N = s.value.getBoundingClientRect(), g = o.value.querySelector("svg");
391
- if (g) {
392
- const z = g.getBoundingClientRect();
393
- v(N, z);
388
+ const L = () => {
389
+ if (!r.value || !o.value) return;
390
+ const S = r.value.getBoundingClientRect(), m = o.value.querySelector("svg");
391
+ if (m) {
392
+ const b = m.getBoundingClientRect();
393
+ f(S, b);
394
394
  }
395
395
  };
396
- return () => e(
396
+ return () => t(
397
397
  "div",
398
398
  {
399
399
  ref: l,
@@ -408,62 +408,62 @@ const ge = C({
408
408
  },
409
409
  a.value ? [
410
410
  // 工具栏
411
- e("div", { class: "md-mermaid-fullscreen-toolbar" }, [
412
- e("div", { class: "md-mermaid-toolbar-group" }, [
413
- e(
411
+ t("div", { class: "md-mermaid-fullscreen-toolbar" }, [
412
+ t("div", { class: "md-mermaid-toolbar-group" }, [
413
+ t(
414
414
  "button",
415
415
  {
416
416
  type: "button",
417
417
  class: "md-mermaid-toolbar-btn",
418
418
  onClick: u,
419
- disabled: !m.value,
419
+ disabled: !v.value,
420
420
  title: "缩小 (-)",
421
421
  "aria-label": "缩小"
422
422
  },
423
- e(G)
423
+ t(K)
424
424
  ),
425
- e(
425
+ t(
426
426
  "span",
427
427
  { class: "md-mermaid-zoom-label" },
428
- `${Math.round(r.value.scale * 100)}%`
428
+ `${Math.round(s.value.scale * 100)}%`
429
429
  ),
430
- e(
430
+ t(
431
431
  "button",
432
432
  {
433
433
  type: "button",
434
434
  class: "md-mermaid-toolbar-btn",
435
- onClick: c,
436
- disabled: !y.value,
435
+ onClick: i,
436
+ disabled: !g.value,
437
437
  title: "放大 (+)",
438
438
  "aria-label": "放大"
439
439
  },
440
- e(K)
440
+ t(_)
441
441
  ),
442
- e(
442
+ t(
443
443
  "button",
444
444
  {
445
445
  type: "button",
446
446
  class: "md-mermaid-toolbar-btn",
447
- onClick: d,
447
+ onClick: c,
448
448
  title: "重置 (0)",
449
449
  "aria-label": "重置"
450
450
  },
451
- e(_)
451
+ t(G)
452
452
  ),
453
- e(
453
+ t(
454
454
  "button",
455
455
  {
456
456
  type: "button",
457
457
  class: "md-mermaid-toolbar-btn",
458
- onClick: S,
458
+ onClick: L,
459
459
  title: "适应窗口",
460
460
  "aria-label": "适应窗口"
461
461
  },
462
- e(fe)
462
+ t(fe)
463
463
  )
464
464
  ]),
465
- e("div", { class: "md-mermaid-toolbar-group" }, [
466
- e(
465
+ t("div", { class: "md-mermaid-toolbar-group" }, [
466
+ t(
467
467
  "button",
468
468
  {
469
469
  type: "button",
@@ -472,52 +472,52 @@ const ge = C({
472
472
  title: "下载 PNG",
473
473
  "aria-label": "下载"
474
474
  },
475
- e(J)
475
+ t(J)
476
476
  ),
477
- e(
477
+ t(
478
478
  "button",
479
479
  {
480
480
  type: "button",
481
481
  class: "md-mermaid-toolbar-btn",
482
- onClick: x,
482
+ onClick: w,
483
483
  title: "退出全屏 (Esc)",
484
484
  "aria-label": "退出全屏"
485
485
  },
486
- e(pe)
486
+ t(pe)
487
487
  )
488
488
  ])
489
489
  ]),
490
490
  // 内容区域
491
- e(
491
+ t(
492
492
  "div",
493
493
  {
494
- ref: s,
494
+ ref: r,
495
495
  class: "md-mermaid-fullscreen-content",
496
- onWheel: k
496
+ onWheel: M
497
497
  },
498
- e("div", {
498
+ t("div", {
499
499
  ref: o,
500
500
  class: "md-mermaid-fullscreen-svg",
501
- style: i.value,
501
+ style: d.value,
502
502
  onMousedown: p,
503
- onDblclick: f,
504
- innerHTML: t.svg
503
+ onDblclick: h,
504
+ innerHTML: e.svg
505
505
  })
506
506
  )
507
507
  ] : void 0
508
508
  );
509
509
  }
510
- });
511
- let E = null;
512
- function be(t = "auto") {
513
- return E ? E.setTheme(t ?? "auto") : E = new ne({ theme: t }), E;
510
+ }), be = 150;
511
+ let A = null;
512
+ function Ce(e = "auto") {
513
+ return A ? A.setTheme(e ?? "auto") : A = new le({ theme: e }), A;
514
514
  }
515
- async function Ce(t) {
515
+ async function we(e) {
516
516
  try {
517
- return await navigator.clipboard.writeText(t), !0;
517
+ return await navigator.clipboard.writeText(e), !0;
518
518
  } catch {
519
519
  const n = document.createElement("textarea");
520
- n.value = t, n.style.position = "fixed", n.style.left = "-9999px", document.body.appendChild(n), n.select();
520
+ n.value = e, n.style.position = "fixed", n.style.left = "-9999px", document.body.appendChild(n), n.select();
521
521
  try {
522
522
  return document.execCommand("copy"), !0;
523
523
  } catch {
@@ -527,7 +527,7 @@ async function Ce(t) {
527
527
  }
528
528
  }
529
529
  }
530
- const we = C({
530
+ const ke = C({
531
531
  name: "MermaidBlock",
532
532
  props: {
533
533
  code: {
@@ -541,73 +541,90 @@ const we = C({
541
541
  showToolbar: {
542
542
  type: Boolean,
543
543
  default: !0
544
+ },
545
+ streamStatus: {
546
+ type: String,
547
+ default: "done"
544
548
  }
545
549
  },
546
550
  emits: ["copy"],
547
- setup(t, { emit: n }) {
548
- const l = h("preview"), s = h(null), o = h(!0), a = h(!1), r = h(!1), c = h(te()), {
549
- state: u,
550
- zoomIn: d,
551
+ setup(e, { emit: n }) {
552
+ const l = y("preview"), r = y(null), o = y(!0), a = y(!1), s = y(!1), i = y(te());
553
+ let u = null, c = null;
554
+ const {
555
+ state: f,
556
+ zoomIn: g,
551
557
  zoomOut: v,
552
- reset: y,
553
- canZoomIn: m,
554
- canZoomOut: i,
555
- contentStyle: p
556
- } = W(), k = B(
558
+ reset: d,
559
+ canZoomIn: p,
560
+ canZoomOut: M,
561
+ contentStyle: h
562
+ } = W(), x = N(
557
563
  () => {
558
- var b;
559
- return ((b = s.value) == null ? void 0 : b.success) && s.value.svg;
564
+ var m;
565
+ return ((m = r.value) == null ? void 0 : m.success) && r.value.svg;
560
566
  }
561
567
  );
562
- let f = null;
568
+ let w = null;
563
569
  $(() => {
564
- t.theme === "auto" && (f = ae((b) => {
565
- c.value = b;
570
+ e.theme === "auto" && (w = ae((m) => {
571
+ i.value = m;
566
572
  }));
567
- }), F(() => {
568
- f == null || f();
569
- }), H(
570
- () => [t.code, t.theme, c.value],
573
+ }), E(() => {
574
+ w == null || w(), c && (clearTimeout(c), c = null);
575
+ });
576
+ let B = e.code, I = e.streamStatus;
577
+ T(
578
+ () => [e.code, e.theme, i.value, e.streamStatus],
571
579
  async () => {
572
- o.value = !0;
573
- const w = await be(t.theme).render(t.code);
574
- s.value = w, o.value = !1, w.success || (l.value = "code");
580
+ B = e.code, I = e.streamStatus;
581
+ const m = async () => {
582
+ I === "loading" && u || (o.value = !0);
583
+ const k = await Ce(e.theme).render(B);
584
+ k.success && k.svg ? (u = k.svg, r.value = k, o.value = !1, l.value = "preview") : I === "loading" ? u && (r.value = {
585
+ success: !0,
586
+ svg: u
587
+ }, o.value = !1) : (r.value = k, o.value = !1, l.value = "code");
588
+ };
589
+ e.streamStatus === "loading" ? c || (c = setTimeout(() => {
590
+ c = null, m();
591
+ }, be)) : (c && (clearTimeout(c), c = null), m());
575
592
  },
576
593
  { immediate: !0 }
577
594
  );
578
- const I = async () => {
579
- await Ce(t.code) && (r.value = !0, n("copy", t.code), setTimeout(() => r.value = !1, 2e3));
580
- }, x = async () => {
581
- var b, w;
582
- if ((b = s.value) != null && b.svg)
595
+ const L = async () => {
596
+ await we(e.code) && (s.value = !0, n("copy", e.code), setTimeout(() => s.value = !1, 2e3));
597
+ }, S = async () => {
598
+ var m, b;
599
+ if ((m = r.value) != null && m.svg)
583
600
  try {
584
- const S = ((w = window.matchMedia) == null ? void 0 : w.call(window, "(prefers-color-scheme: dark)").matches) ?? !1;
585
- await le(s.value.svg, {
586
- backgroundColor: S ? "#1a1a2e" : "#ffffff",
601
+ const k = ((b = window.matchMedia) == null ? void 0 : b.call(window, "(prefers-color-scheme: dark)").matches) ?? !1;
602
+ await ne(r.value.svg, {
603
+ backgroundColor: k ? "#1a1a2e" : "#ffffff",
587
604
  padding: 20,
588
605
  scale: 2
589
606
  });
590
- } catch (S) {
591
- console.error("Download failed:", S);
607
+ } catch (k) {
608
+ console.error("Download failed:", k);
592
609
  }
593
610
  };
594
611
  return () => {
595
- const b = t.showToolbar ? e("div", { class: "md-mermaid-toolbar" }, [
612
+ const m = e.showToolbar ? t("div", { class: "md-mermaid-toolbar" }, [
596
613
  // 模式切换
597
- e("div", { class: "md-mermaid-toolbar-group md-mermaid-mode-switch" }, [
598
- e(
614
+ t("div", { class: "md-mermaid-toolbar-group md-mermaid-mode-switch" }, [
615
+ t(
599
616
  "button",
600
617
  {
601
618
  type: "button",
602
619
  class: `md-mermaid-toolbar-btn${l.value === "preview" ? " md-mermaid-toolbar-btn--active" : ""}`,
603
620
  onClick: () => l.value = "preview",
604
- disabled: !k.value,
621
+ disabled: !x.value,
605
622
  title: "图片模式",
606
623
  "aria-label": "图片模式"
607
624
  },
608
- e(de)
625
+ t(de)
609
626
  ),
610
- e(
627
+ t(
611
628
  "button",
612
629
  {
613
630
  type: "button",
@@ -616,56 +633,56 @@ const we = C({
616
633
  title: "代码模式",
617
634
  "aria-label": "代码模式"
618
635
  },
619
- e(me)
636
+ t(me)
620
637
  )
621
638
  ]),
622
639
  // 缩放控制 - 仅图片模式显示
623
- l.value === "preview" && k.value ? e("div", { class: "md-mermaid-toolbar-group" }, [
624
- e(
640
+ l.value === "preview" && x.value ? t("div", { class: "md-mermaid-toolbar-group" }, [
641
+ t(
625
642
  "button",
626
643
  {
627
644
  type: "button",
628
645
  class: "md-mermaid-toolbar-btn",
629
646
  onClick: v,
630
- disabled: !i.value,
647
+ disabled: !M.value,
631
648
  title: "缩小",
632
649
  "aria-label": "缩小"
633
650
  },
634
- e(G)
651
+ t(K)
635
652
  ),
636
- e(
653
+ t(
637
654
  "span",
638
655
  { class: "md-mermaid-zoom-label" },
639
- `${Math.round(u.value.scale * 100)}%`
656
+ `${Math.round(f.value.scale * 100)}%`
640
657
  ),
641
- e(
658
+ t(
642
659
  "button",
643
660
  {
644
661
  type: "button",
645
662
  class: "md-mermaid-toolbar-btn",
646
- onClick: d,
647
- disabled: !m.value,
663
+ onClick: g,
664
+ disabled: !p.value,
648
665
  title: "放大",
649
666
  "aria-label": "放大"
650
667
  },
651
- e(K)
668
+ t(_)
652
669
  ),
653
- e(
670
+ t(
654
671
  "button",
655
672
  {
656
673
  type: "button",
657
674
  class: "md-mermaid-toolbar-btn",
658
- onClick: y,
675
+ onClick: d,
659
676
  title: "重置",
660
677
  "aria-label": "重置缩放"
661
678
  },
662
- e(_)
679
+ t(G)
663
680
  )
664
681
  ]) : null,
665
682
  // 操作按钮
666
- e("div", { class: "md-mermaid-toolbar-group" }, [
667
- l.value === "preview" && k.value ? [
668
- e(
683
+ t("div", { class: "md-mermaid-toolbar-group" }, [
684
+ l.value === "preview" && x.value ? [
685
+ t(
669
686
  "button",
670
687
  {
671
688
  type: "button",
@@ -674,80 +691,81 @@ const we = C({
674
691
  title: "全屏",
675
692
  "aria-label": "全屏查看"
676
693
  },
677
- e(ve)
694
+ t(ve)
678
695
  ),
679
- e(
696
+ t(
680
697
  "button",
681
698
  {
682
699
  type: "button",
683
700
  class: "md-mermaid-toolbar-btn",
684
- onClick: x,
701
+ onClick: S,
685
702
  title: "下载 PNG",
686
703
  "aria-label": "下载"
687
704
  },
688
- e(J)
705
+ t(J)
689
706
  )
690
707
  ] : null,
691
- l.value === "code" ? e(
708
+ l.value === "code" ? t(
692
709
  "button",
693
710
  {
694
711
  type: "button",
695
- class: `md-mermaid-toolbar-btn${r.value ? " md-mermaid-toolbar-btn--success" : ""}`,
696
- onClick: I,
697
- title: r.value ? "已复制" : "复制代码",
698
- "aria-label": r.value ? "已复制" : "复制代码"
712
+ class: `md-mermaid-toolbar-btn${s.value ? " md-mermaid-toolbar-btn--success" : ""}`,
713
+ onClick: L,
714
+ title: s.value ? "已复制" : "复制代码",
715
+ "aria-label": s.value ? "已复制" : "复制代码"
699
716
  },
700
- r.value ? e(ye) : e(he)
717
+ s.value ? t(ye) : t(he)
701
718
  ) : null
702
719
  ])
703
720
  ]) : null;
704
- let w;
705
- return o.value ? w = e("div", { class: "md-mermaid-skeleton" }, [
706
- e("div", { class: "md-mermaid-skeleton-box" })
707
- ]) : l.value === "preview" && k.value ? w = e("div", { class: "md-mermaid-preview", style: { overflow: "hidden" } }, [
708
- e("div", {
721
+ let b;
722
+ return o.value ? b = t("div", { class: "md-mermaid-skeleton" }, [
723
+ t("div", { class: "md-mermaid-skeleton-box" })
724
+ ]) : l.value === "preview" && x.value ? b = t("div", { class: "md-mermaid-preview", style: { overflow: "hidden" } }, [
725
+ t("div", {
709
726
  class: "md-mermaid-svg-container",
710
- style: p.value,
711
- innerHTML: s.value.svg
727
+ style: h.value,
728
+ innerHTML: r.value.svg
712
729
  })
713
- ]) : w = e("div", { class: "md-mermaid-code" }, [
714
- e("pre", [e("code", { class: "language-mermaid" }, t.code)]),
715
- s.value && !s.value.success ? e("div", { class: "md-mermaid-error" }, [
716
- e("span", "渲染失败: "),
717
- e("span", s.value.error)
730
+ ]) : b = t("div", { class: "md-mermaid-code" }, [
731
+ t("pre", [t("code", { class: "language-mermaid" }, e.code)]),
732
+ // 错误提示 - 仅在非流式或流式完成时显示
733
+ r.value && !r.value.success && e.streamStatus === "done" ? t("div", { class: "md-mermaid-error" }, [
734
+ t("span", "渲染失败: "),
735
+ t("span", r.value.error)
718
736
  ]) : null
719
- ]), e("div", { class: "md-mermaid-block" }, [
720
- b,
721
- e("div", { class: "md-mermaid-content" }, [w]),
737
+ ]), t("div", { class: "md-mermaid-block" }, [
738
+ m,
739
+ t("div", { class: "md-mermaid-content" }, [b]),
722
740
  // 全屏查看器
723
- k.value ? e(ge, {
724
- svg: s.value.svg,
741
+ x.value ? t(ge, {
742
+ svg: r.value.svg,
725
743
  open: a.value,
726
744
  onClose: () => a.value = !1,
727
- onDownload: x
745
+ onDownload: S
728
746
  }) : null
729
747
  ]);
730
748
  };
731
749
  }
732
750
  });
733
- function ke(t) {
734
- var s;
735
- if (t.tagName !== "pre") return !1;
736
- const n = t.children.find(
751
+ function xe(e) {
752
+ var r;
753
+ if (e.tagName !== "pre") return !1;
754
+ const n = e.children.find(
737
755
  (o) => o.type === "element" && o.tagName === "code"
738
756
  );
739
757
  if (!n) return !1;
740
- const l = (s = n.properties) == null ? void 0 : s.className;
758
+ const l = (r = n.properties) == null ? void 0 : r.className;
741
759
  return Array.isArray(l) ? l.some((o) => typeof o == "string" && o.includes("language-mermaid")) : typeof l == "string" && l.includes("language-mermaid");
742
760
  }
743
- function xe(t) {
744
- const n = t.children.find(
761
+ function Me(e) {
762
+ const n = e.children.find(
745
763
  (l) => l.type === "element" && l.tagName === "code"
746
764
  );
747
765
  return n ? n.children.map((l) => l.type === "text" ? l.value : "").join("") : "";
748
766
  }
749
- function Me(t) {
750
- return t ? t === !0 ? { enabled: !0 } : t.enabled !== !1 ? t : null : null;
767
+ function Se(e) {
768
+ return e ? e === !0 ? { enabled: !0 } : e.enabled !== !1 ? e : null : null;
751
769
  }
752
770
  const Q = C({
753
771
  name: "Markdown",
@@ -794,179 +812,179 @@ const Q = C({
794
812
  }
795
813
  },
796
814
  emits: ["codeCopy"],
797
- setup(t, { emit: n }) {
798
- H(
799
- () => t.math,
815
+ setup(e, { emit: n }) {
816
+ T(
817
+ () => e.math,
800
818
  (o) => {
801
819
  o && Y();
802
820
  },
803
821
  { immediate: !0 }
804
822
  );
805
- function l(o, a = {}, r = null) {
823
+ function l(o, a = {}, s = null) {
806
824
  if (o.type === "text")
807
825
  return o.value;
808
826
  if (o.type === "comment")
809
827
  return null;
810
828
  if (o.type === "root") {
811
- const c = o.children.map((u) => l(u, a, r)).filter((u) => u !== null);
812
- return e("div", { class: t.class }, c);
829
+ const i = o.children.map((u) => l(u, a, s)).filter((u) => u !== null);
830
+ return t("div", { class: e.class }, i);
813
831
  }
814
832
  if (o.type === "element") {
815
- const { tagName: c, properties: u, children: d } = o;
816
- if (r && ke(o)) {
817
- const i = xe(o);
818
- return e(we, {
819
- code: i,
820
- theme: r.theme,
833
+ const { tagName: i, properties: u, children: c } = o;
834
+ if (s && xe(o)) {
835
+ const d = Me(o);
836
+ return t(ke, {
837
+ code: d,
838
+ theme: s.theme,
821
839
  onCopy: (p) => n("codeCopy", p)
822
840
  });
823
841
  }
824
- const v = a[c] || c, y = {};
842
+ const f = a[i] || i, g = {};
825
843
  if (u)
826
- for (const [i, p] of Object.entries(u))
827
- i === "className" ? y.class = Array.isArray(p) ? p.join(" ") : p : y[i] = p;
828
- const m = d.map((i) => l(i, a, r)).filter((i) => i !== null);
829
- return typeof v == "string" ? e(v, y, m) : e(v, y, () => m);
844
+ for (const [d, p] of Object.entries(u))
845
+ d === "className" ? g.class = Array.isArray(p) ? p.join(" ") : p : g[d] = p;
846
+ const v = c.map((d) => l(d, a, s)).filter((d) => d !== null);
847
+ return typeof f == "string" ? t(f, g, v) : t(f, g, () => v);
830
848
  }
831
849
  return null;
832
850
  }
833
- const s = B(() => {
834
- if (!t.content) return null;
835
- const o = j(t.content, {
836
- gfm: t.gfm,
837
- highlight: t.highlight,
838
- math: t.math,
839
- remarkPlugins: t.remarkPlugins,
840
- rehypePlugins: t.rehypePlugins
841
- }), a = Me(t.mermaid), r = {
842
- ...t.copyButton ? {
851
+ const r = N(() => {
852
+ if (!e.content) return null;
853
+ const o = j(e.content, {
854
+ gfm: e.gfm,
855
+ highlight: e.highlight,
856
+ math: e.math,
857
+ remarkPlugins: e.remarkPlugins,
858
+ rehypePlugins: e.rehypePlugins
859
+ }), a = Se(e.mermaid), s = {
860
+ ...e.copyButton ? {
843
861
  pre: C({
844
- setup(c, { slots: u }) {
845
- return () => e(
862
+ setup(i, { slots: u }) {
863
+ return () => t(
846
864
  q,
847
865
  {
848
- showCopyButton: t.copyButton,
849
- onCopy: (d) => n("codeCopy", d)
866
+ showCopyButton: e.copyButton,
867
+ onCopy: (c) => n("codeCopy", c)
850
868
  },
851
869
  u.default
852
870
  );
853
871
  }
854
872
  })
855
873
  } : {},
856
- ...t.components
874
+ ...e.components
857
875
  };
858
- return l(o, r, a);
876
+ return l(o, s, a);
859
877
  });
860
- return () => s.value ? s.value : null;
878
+ return () => r.value ? r.value : null;
861
879
  }
862
880
  });
863
- function D(t, n) {
864
- if (t.type === "text")
865
- return t.value;
866
- if (t.type === "root") {
867
- const l = t.children.map((s) => D(s, n)).filter((s) => s !== null);
868
- return e("div", {}, l);
881
+ function D(e, n) {
882
+ if (e.type === "text")
883
+ return e.value;
884
+ if (e.type === "root") {
885
+ const l = e.children.map((r) => D(r, n)).filter((r) => r !== null);
886
+ return t("div", {}, l);
869
887
  }
870
- if (t.type === "element") {
871
- const l = t, s = l.tagName, o = n == null ? void 0 : n[s], a = { ...l.properties };
888
+ if (e.type === "element") {
889
+ const l = e, r = l.tagName, o = n == null ? void 0 : n[r], a = { ...l.properties };
872
890
  a.className && (a.class = Array.isArray(a.className) ? a.className.join(" ") : a.className, delete a.className);
873
- const r = l.children.map((c) => D(c, n)).filter((c) => c !== null);
874
- return o ? e(o, a, () => r) : e(s, a, r);
891
+ const s = l.children.map((i) => D(i, n)).filter((i) => i !== null);
892
+ return o ? t(o, a, () => s) : t(r, a, s);
875
893
  }
876
894
  return null;
877
895
  }
878
- function Ne(t = {}) {
896
+ function Ve(e = {}) {
879
897
  const {
880
898
  components: n,
881
899
  minUpdateInterval: l = 16,
882
- immediate: s = !1,
900
+ immediate: r = !1,
883
901
  outputRate: o = "medium",
884
902
  ...a
885
- } = t, r = P(a), c = new U(o), u = h(0), d = h(!1), v = h(0), y = h("idle");
886
- let m = 0, i = null;
903
+ } = e, s = P(a), i = new U(o), u = y(0), c = y(!1), f = y(0), g = y("idle");
904
+ let v = 0, d = null;
887
905
  const p = () => {
888
- const M = performance.now(), V = M - m;
889
- s || V >= l ? (m = M, u.value++) : i === null && (i = requestAnimationFrame(() => {
890
- i = null, m = performance.now(), u.value++;
906
+ const z = performance.now(), V = z - v;
907
+ r || V >= l ? (v = z, u.value++) : d === null && (d = requestAnimationFrame(() => {
908
+ d = null, v = performance.now(), u.value++;
891
909
  }));
892
- }, k = (M) => {
893
- r.append(M), p();
894
- }, f = (M) => {
895
- r.reset(), d.value = !1, v.value = 0, y.value = "running", c.start(
896
- M,
910
+ }, M = (z) => {
911
+ s.append(z), p();
912
+ }, h = (z) => {
913
+ s.reset(), c.value = !1, f.value = 0, g.value = "running", i.start(
914
+ z,
897
915
  (V) => {
898
- V && r.append(V), v.value = c.progress, p();
916
+ V && s.append(V), f.value = i.progress, p();
899
917
  },
900
918
  () => {
901
- r.finish(), d.value = !0, v.value = 1, y.value = "complete", p();
919
+ s.finish(), c.value = !0, f.value = 1, g.value = "complete", p();
902
920
  }
903
921
  );
904
- }, I = () => {
905
- c.pause(), y.value = c.status;
906
922
  }, x = () => {
907
- c.resume(), y.value = c.status;
908
- }, b = () => {
909
- c.skipToEnd(), y.value = c.status, v.value = 1;
923
+ i.pause(), g.value = i.status;
910
924
  }, w = () => {
911
- c.stop(), r.finish(), d.value = !0, y.value = "complete", i !== null && (cancelAnimationFrame(i), i = null), u.value++;
912
- }, S = () => {
913
- c.stop(), r.reset(), d.value = !1, v.value = 0, y.value = "idle", i !== null && (cancelAnimationFrame(i), i = null), u.value++;
925
+ i.resume(), g.value = i.status;
926
+ }, B = () => {
927
+ i.skipToEnd(), g.value = i.status, f.value = 1;
928
+ }, I = () => {
929
+ i.stop(), s.finish(), c.value = !0, g.value = "complete", d !== null && (cancelAnimationFrame(d), d = null), u.value++;
930
+ }, L = () => {
931
+ i.stop(), s.reset(), c.value = !1, f.value = 0, g.value = "idle", d !== null && (cancelAnimationFrame(d), d = null), u.value++;
914
932
  };
915
- F(() => {
916
- c.stop(), i !== null && cancelAnimationFrame(i);
933
+ E(() => {
934
+ i.stop(), d !== null && cancelAnimationFrame(d);
917
935
  });
918
- const N = B(() => (u.value, r.getState().blocks)), g = B(() => (u.value, r.getStats())), z = B(() => (u.value, r.getContent()));
936
+ const S = N(() => (u.value, s.getState().blocks)), m = N(() => (u.value, s.getStats())), b = N(() => (u.value, s.getContent()));
919
937
  return {
920
- vnode: B(() => {
938
+ vnode: N(() => {
921
939
  u.value;
922
- const M = r.getState();
923
- if (M.blocks.length === 0)
940
+ const z = s.getState();
941
+ if (z.blocks.length === 0)
924
942
  return null;
925
- const V = M.blocks.map((L) => L.hast ? e(
943
+ const V = z.blocks.map((H) => H.hast ? t(
926
944
  "div",
927
945
  {
928
- key: L.key,
929
- "data-block-key": L.key,
930
- "data-pending": !L.stable || void 0
946
+ key: H.key,
947
+ "data-block-key": H.key,
948
+ "data-pending": !H.stable || void 0
931
949
  },
932
- [D(L.hast, n)]
933
- ) : null).filter((L) => L !== null);
934
- return e("div", { "data-streaming": !d.value }, V);
950
+ [D(H.hast, n)]
951
+ ) : null).filter((H) => H !== null);
952
+ return t("div", { "data-streaming": !c.value }, V);
935
953
  }),
936
- append: k,
937
- start: f,
938
- pause: I,
939
- resume: x,
940
- skipToEnd: b,
941
- reset: S,
942
- finish: w,
943
- blocks: N,
944
- stats: g,
945
- isComplete: d,
946
- content: z,
947
- progress: v,
948
- outputStatus: y
954
+ append: M,
955
+ start: h,
956
+ pause: x,
957
+ resume: w,
958
+ skipToEnd: B,
959
+ reset: L,
960
+ finish: I,
961
+ blocks: S,
962
+ stats: m,
963
+ isComplete: c,
964
+ content: b,
965
+ progress: f,
966
+ outputStatus: g
949
967
  };
950
968
  }
951
- function R(t, n, l, s, o) {
952
- if (t.type === "text")
953
- return t.value;
954
- if (t.type === "root") {
955
- const a = t.children.map((r) => R(r, n, l, s, o)).filter((r) => r !== null);
956
- return e("div", {}, a);
969
+ function O(e, n, l, r, o) {
970
+ if (e.type === "text")
971
+ return e.value;
972
+ if (e.type === "root") {
973
+ const a = e.children.map((s) => O(s, n, l, r, o)).filter((s) => s !== null);
974
+ return t("div", {}, a);
957
975
  }
958
- if (t.type === "element") {
959
- const a = t, r = a.tagName, c = n == null ? void 0 : n[r], u = { ...a.properties };
976
+ if (e.type === "element") {
977
+ const a = e, s = a.tagName, i = n == null ? void 0 : n[s], u = { ...a.properties };
960
978
  u.className && (u.class = Array.isArray(u.className) ? u.className.join(" ") : u.className, delete u.className);
961
- const d = a.children.map((v) => R(v, n, l, s, o)).filter((v) => v !== null);
962
- return r === "pre" && l && !c ? e(
979
+ const c = a.children.map((f) => O(f, n, l, r, o)).filter((f) => f !== null);
980
+ return s === "pre" && l && !i ? t(
963
981
  q,
964
982
  {
965
983
  showCopyButton: o && l,
966
- onCopy: s
984
+ onCopy: r
967
985
  },
968
- () => d
969
- ) : c ? e(c, u, () => d) : e(r, u, d);
986
+ () => c
987
+ ) : i ? t(i, u, () => c) : t(s, u, c);
970
988
  }
971
989
  return null;
972
990
  }
@@ -1023,127 +1041,127 @@ const ee = C({
1023
1041
  }
1024
1042
  },
1025
1043
  emits: ["complete", "blockStable", "progress", "codeCopy"],
1026
- setup(t, { emit: n }) {
1027
- H(
1028
- () => t.math,
1029
- (m) => {
1030
- m && Y();
1044
+ setup(e, { emit: n }) {
1045
+ T(
1046
+ () => e.math,
1047
+ (v) => {
1048
+ v && Y();
1031
1049
  },
1032
1050
  { immediate: !0 }
1033
1051
  );
1034
1052
  const l = P({
1035
- gfm: t.gfm,
1036
- highlight: t.highlight,
1037
- math: t.math
1038
- }), s = new U(t.outputRate), o = h(0), a = h(""), r = h(void 0), c = h([]), u = h(!1);
1039
- let d = 0, v = null;
1040
- const y = () => {
1041
- const m = performance.now();
1042
- m - d >= t.minUpdateInterval ? (d = m, o.value++) : v === null && (v = requestAnimationFrame(() => {
1043
- v = null, d = performance.now(), o.value++;
1053
+ gfm: e.gfm,
1054
+ highlight: e.highlight,
1055
+ math: e.math
1056
+ }), r = new U(e.outputRate), o = y(0), a = y(""), s = y(void 0), i = y([]), u = y(!1);
1057
+ let c = 0, f = null;
1058
+ const g = () => {
1059
+ const v = performance.now();
1060
+ v - c >= e.minUpdateInterval ? (c = v, o.value++) : f === null && (f = requestAnimationFrame(() => {
1061
+ f = null, c = performance.now(), o.value++;
1044
1062
  }));
1045
1063
  };
1046
- return H(
1047
- () => t.source,
1048
- (m) => {
1049
- m !== void 0 && m !== r.value && (r.value = m, t.autoStart && m && (l.reset(), a.value = "", u.value = !1, s.start(
1050
- m,
1051
- (i) => {
1052
- i && (l.append(i), a.value += i), n("progress", s.progress), y();
1064
+ return T(
1065
+ () => e.source,
1066
+ (v) => {
1067
+ v !== void 0 && v !== s.value && (s.value = v, e.autoStart && v && (l.reset(), a.value = "", u.value = !1, r.start(
1068
+ v,
1069
+ (d) => {
1070
+ d && (l.append(d), a.value += d), n("progress", r.progress), g();
1053
1071
  },
1054
1072
  () => {
1055
- l.finish(), u.value = !0, n("complete"), y();
1073
+ l.finish(), u.value = !0, n("complete"), g();
1056
1074
  }
1057
1075
  )));
1058
1076
  },
1059
1077
  { immediate: !0 }
1060
- ), H(
1061
- () => t.content,
1062
- (m) => {
1063
- if (t.source !== void 0)
1078
+ ), T(
1079
+ () => e.content,
1080
+ (v) => {
1081
+ if (e.source !== void 0)
1064
1082
  return;
1065
- const i = a.value, p = m || "";
1066
- if (p !== i) {
1067
- if (p.startsWith(i)) {
1068
- const f = p.slice(i.length);
1069
- f && l.append(f);
1083
+ const d = a.value, p = v || "";
1084
+ if (p !== d) {
1085
+ if (p.startsWith(d)) {
1086
+ const h = p.slice(d.length);
1087
+ h && l.append(h);
1070
1088
  } else
1071
1089
  l.reset(), p && l.append(p);
1072
- a.value = p, y();
1073
- const k = l.getState().blocks;
1074
- k.forEach((f, I) => {
1075
- const x = c.value[I];
1076
- f.stable && (!x || !x.stable) && n("blockStable", f);
1077
- }), c.value = k;
1090
+ a.value = p, g();
1091
+ const M = l.getState().blocks;
1092
+ M.forEach((h, x) => {
1093
+ const w = i.value[x];
1094
+ h.stable && (!w || !w.stable) && n("blockStable", h);
1095
+ }), i.value = M;
1078
1096
  }
1079
1097
  },
1080
1098
  { immediate: !0 }
1081
- ), H(
1082
- () => t.isComplete,
1083
- (m) => {
1084
- t.source === void 0 && m && (l.finish(), v !== null && (cancelAnimationFrame(v), v = null), o.value++, n("complete"));
1099
+ ), T(
1100
+ () => e.isComplete,
1101
+ (v) => {
1102
+ e.source === void 0 && v && (l.finish(), f !== null && (cancelAnimationFrame(f), f = null), o.value++, n("complete"));
1085
1103
  }
1086
- ), H(
1087
- () => t.outputRate,
1088
- (m) => {
1089
- s.setRate(m);
1104
+ ), T(
1105
+ () => e.outputRate,
1106
+ (v) => {
1107
+ r.setRate(v);
1090
1108
  }
1091
- ), F(() => {
1092
- s.stop(), v !== null && cancelAnimationFrame(v);
1109
+ ), E(() => {
1110
+ r.stop(), f !== null && cancelAnimationFrame(f);
1093
1111
  }), () => {
1094
1112
  o.value;
1095
- const m = l.getState(), i = t.source !== void 0 ? u.value : t.isComplete, p = (f) => n("codeCopy", f), k = m.blocks.map((f) => f.hast ? e(
1113
+ const v = l.getState(), d = e.source !== void 0 ? u.value : e.isComplete, p = (h) => n("codeCopy", h), M = v.blocks.map((h) => h.hast ? t(
1096
1114
  "div",
1097
1115
  {
1098
- key: f.key,
1099
- "data-block-key": f.key,
1100
- "data-pending": !f.stable || void 0
1116
+ key: h.key,
1117
+ "data-block-key": h.key,
1118
+ "data-pending": !h.stable || void 0
1101
1119
  },
1102
- [R(f.hast, t.components, t.copyButton, p, f.stable)]
1103
- ) : null).filter((f) => f !== null);
1104
- return e(
1120
+ [O(h.hast, e.components, e.copyButton, p, h.stable)]
1121
+ ) : null).filter((h) => h !== null);
1122
+ return t(
1105
1123
  "div",
1106
1124
  {
1107
- class: t.class,
1108
- "data-streaming": !i
1125
+ class: e.class,
1126
+ "data-streaming": !d
1109
1127
  },
1110
- k
1128
+ M
1111
1129
  );
1112
1130
  };
1113
1131
  }
1114
1132
  });
1115
- function Z(t, n = {}) {
1116
- if (t.type === "text")
1117
- return t.value;
1118
- if (t.type === "comment")
1133
+ function Z(e, n = {}) {
1134
+ if (e.type === "text")
1135
+ return e.value;
1136
+ if (e.type === "comment")
1119
1137
  return null;
1120
- if (t.type === "root") {
1121
- const l = t.children.map((s) => Z(s, n)).filter((s) => s !== null);
1122
- return e("div", {}, l);
1138
+ if (e.type === "root") {
1139
+ const l = e.children.map((r) => Z(r, n)).filter((r) => r !== null);
1140
+ return t("div", {}, l);
1123
1141
  }
1124
- if (t.type === "element") {
1125
- const { tagName: l, properties: s, children: o } = t, a = n[l] || l, r = {};
1126
- if (s)
1127
- for (const [u, d] of Object.entries(s))
1128
- u === "className" ? r.class = Array.isArray(d) ? d.join(" ") : d : r[u] = d;
1129
- const c = o.map((u) => Z(u, n)).filter((u) => u !== null);
1130
- return e(a, r, () => c);
1142
+ if (e.type === "element") {
1143
+ const { tagName: l, properties: r, children: o } = e, a = n[l] || l, s = {};
1144
+ if (r)
1145
+ for (const [u, c] of Object.entries(r))
1146
+ u === "className" ? s.class = Array.isArray(c) ? c.join(" ") : c : s[u] = c;
1147
+ const i = o.map((u) => Z(u, n)).filter((u) => u !== null);
1148
+ return t(a, s, () => i);
1131
1149
  }
1132
1150
  return null;
1133
1151
  }
1134
- function Ve(t, n = {}) {
1135
- const { components: l = {}, ...s } = n;
1136
- return B(() => {
1137
- const o = t();
1152
+ function Te(e, n = {}) {
1153
+ const { components: l = {}, ...r } = n;
1154
+ return N(() => {
1155
+ const o = e();
1138
1156
  if (!o) return null;
1139
- const a = j(o, s);
1157
+ const a = j(o, r);
1140
1158
  return Z(a, l);
1141
1159
  });
1142
1160
  }
1143
- function ze(t) {
1144
- t.component("Markdown", Q), t.component("StreamingMarkdown", ee);
1161
+ function ze(e) {
1162
+ e.component("Markdown", Q), e.component("StreamingMarkdown", ee);
1145
1163
  }
1146
- const He = {
1164
+ const Le = {
1147
1165
  install: ze,
1148
1166
  Markdown: Q,
1149
1167
  StreamingMarkdown: ee
@@ -1151,14 +1169,14 @@ const He = {
1151
1169
  export {
1152
1170
  q as CodeBlock,
1153
1171
  Q as Markdown,
1154
- we as MermaidBlock,
1172
+ ke as MermaidBlock,
1155
1173
  ge as MermaidFullscreenViewer,
1156
1174
  ee as StreamingMarkdown,
1157
- He as default,
1175
+ Le as default,
1158
1176
  ze as install,
1159
- Se as isKatexCssLoaded,
1177
+ Ne as isKatexCssLoaded,
1160
1178
  Y as preloadKatexCss,
1161
- Ve as useMarkdown,
1162
- Ne as useStreamingMarkdown,
1179
+ Te as useMarkdown,
1180
+ Ve as useStreamingMarkdown,
1163
1181
  W as useZoom
1164
1182
  };