markstream-vue 0.0.2-beta.4 → 0.0.2-beta.6

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.
@@ -0,0 +1,860 @@
1
+ var gt = Object.defineProperty, pt = Object.defineProperties;
2
+ var wt = Object.getOwnPropertyDescriptors;
3
+ var He = Object.getOwnPropertySymbols;
4
+ var yt = Object.prototype.hasOwnProperty, xt = Object.prototype.propertyIsEnumerable;
5
+ var Te = (f, k, i) => k in f ? gt(f, k, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[k] = i, Oe = (f, k) => {
6
+ for (var i in k || (k = {}))
7
+ yt.call(k, i) && Te(f, i, k[i]);
8
+ if (He)
9
+ for (var i of He(k))
10
+ xt.call(k, i) && Te(f, i, k[i]);
11
+ return f;
12
+ }, Le = (f, k) => pt(f, wt(k));
13
+ var $ = (f, k, i) => new Promise((G, u) => {
14
+ var x = (v) => {
15
+ try {
16
+ N(i.next(v));
17
+ } catch (w) {
18
+ u(w);
19
+ }
20
+ }, j = (v) => {
21
+ try {
22
+ N(i.throw(v));
23
+ } catch (w) {
24
+ u(w);
25
+ }
26
+ }, N = (v) => v.done ? G(v.value) : Promise.resolve(v.value).then(x, j);
27
+ N((i = i.apply(f, k)).next());
28
+ });
29
+ import { defineComponent as kt, ref as B, watch as V, onBeforeUnmount as bt, computed as Y, nextTick as ve, onUnmounted as Ct, createBlock as Mt, createElementBlock as L, openBlock as H, unref as g, normalizeClass as Ne, normalizeStyle as De, createCommentVNode as U, withDirectives as Pe, createElementVNode as r, renderSlot as me, toDisplayString as ze, Fragment as Bt, vShow as $e } from "vue";
30
+ import { u as St, a as Et, g as Ft, s as te, l as Ht, b as Tt, _ as Ot, c as Ve, h as Lt, d as Nt } from "./exports-QodAGrc3.js";
31
+ const Dt = {
32
+ key: 0,
33
+ class: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",
34
+ style: { color: "var(--vscode-editor-foreground)", "background-color": "var(--vscode-editor-background)" }
35
+ }, Pt = { class: "flex items-center space-x-2" }, zt = ["innerHTML"], $t = { class: "text-sm font-medium font-mono" }, Vt = { class: "flex items-center space-x-2" }, Rt = ["aria-pressed"], It = ["disabled"], Yt = ["disabled"], At = ["disabled"], jt = ["aria-label"], qt = {
36
+ key: 0,
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
39
+ "aria-hidden": "true",
40
+ role: "img",
41
+ width: "1em",
42
+ height: "1em",
43
+ viewBox: "0 0 24 24",
44
+ class: "w-3 h-3"
45
+ }, Wt = {
46
+ key: 1,
47
+ xmlns: "http://www.w3.org/2000/svg",
48
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
49
+ "aria-hidden": "true",
50
+ role: "img",
51
+ width: "1em",
52
+ height: "1em",
53
+ viewBox: "0 0 24 24",
54
+ class: "w-3 h-3"
55
+ }, Xt = ["aria-pressed"], Ut = {
56
+ key: 0,
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
59
+ "aria-hidden": "true",
60
+ role: "img",
61
+ width: "1em",
62
+ height: "1em",
63
+ viewBox: "0 0 24 24",
64
+ class: "w-3 h-3"
65
+ }, Gt = {
66
+ key: 1,
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
69
+ "aria-hidden": "true",
70
+ role: "img",
71
+ width: "1em",
72
+ height: "1em",
73
+ viewBox: "0 0 24 24",
74
+ class: "w-3 h-3"
75
+ }, Jt = ["aria-label"], Kt = { class: "code-loading-placeholder" }, Qt = {
76
+ class: "sr-only",
77
+ "aria-live": "polite",
78
+ role: "status"
79
+ }, Re = 10, Ie = 36, Ye = 1, Ae = 0, je = 1.5, oe = 1, Zt = /* @__PURE__ */ kt({
80
+ __name: "CodeBlockNode",
81
+ props: {
82
+ node: {},
83
+ isDark: { type: Boolean },
84
+ loading: { type: Boolean, default: !0 },
85
+ stream: { type: Boolean, default: !0 },
86
+ darkTheme: { default: void 0 },
87
+ lightTheme: { default: void 0 },
88
+ isShowPreview: { type: Boolean, default: !0 },
89
+ monacoOptions: {},
90
+ enableFontSizeControl: { type: Boolean, default: !0 },
91
+ minWidth: { default: void 0 },
92
+ maxWidth: { default: void 0 },
93
+ themes: {},
94
+ showHeader: { type: Boolean, default: !0 },
95
+ showCopyButton: { type: Boolean, default: !0 },
96
+ showExpandButton: { type: Boolean, default: !0 },
97
+ showPreviewButton: { type: Boolean, default: !0 },
98
+ showFontSizeButtons: { type: Boolean, default: !0 },
99
+ customId: {}
100
+ },
101
+ emits: ["previewCode", "copy"],
102
+ setup(f, { emit: k }) {
103
+ var Be, Se;
104
+ const i = f, G = k, { t: u } = St(), x = B(null), j = B(null), N = B(!1), v = B(String((Be = i.node.language) != null ? Be : "")), w = B(!1), b = B(!1), J = B(!1), ge = B(!1), R = B(null);
105
+ let ne = 0;
106
+ const qe = Et(), q = B(null), P = B(typeof window == "undefined");
107
+ typeof window != "undefined" && V(
108
+ () => j.value,
109
+ (t) => {
110
+ var o;
111
+ if ((o = q.value) == null || o.destroy(), q.value = null, !t) {
112
+ P.value = !1;
113
+ return;
114
+ }
115
+ const e = qe(t, { rootMargin: "400px" });
116
+ q.value = e, P.value = e.isVisible.value, e.whenVisible.then(() => {
117
+ P.value = !0;
118
+ });
119
+ },
120
+ { immediate: !0 }
121
+ ), bt(() => {
122
+ var t;
123
+ (t = q.value) == null || t.destroy(), q.value = null;
124
+ });
125
+ let z = null, K = null, ie = () => {
126
+ }, le = () => {
127
+ }, Q = () => null, D = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
128
+ } }), T = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
129
+ } }), Z = () => {
130
+ }, ae = () => {
131
+ }, W = null, pe = () => {
132
+ var t;
133
+ return String((t = i.node.language) != null ? t : "plaintext");
134
+ }, re = () => $(null, null, function* () {
135
+ });
136
+ const S = Y(() => i.node.diff), se = B(!1);
137
+ typeof window != "undefined" && $(null, null, function* () {
138
+ try {
139
+ const t = yield Ft();
140
+ if (!t) {
141
+ se.value = !0;
142
+ return;
143
+ }
144
+ const e = t.useMonaco, o = t.detectLanguage;
145
+ if (typeof o == "function" && (pe = o), typeof e == "function") {
146
+ const n = Me();
147
+ if (n && i.themes && Array.isArray(i.themes) && !i.themes.includes(n))
148
+ throw new Error("Preferred theme not in provided themes array");
149
+ const l = e(Le(Oe({
150
+ wordWrap: "on",
151
+ wrappingIndent: "same",
152
+ themes: i.themes,
153
+ theme: n
154
+ }, i.monacoOptions || {}), {
155
+ onThemeChange() {
156
+ Ke();
157
+ }
158
+ }));
159
+ z = l.createEditor || z, K = l.createDiffEditor || K, ie = l.updateCode || ie, le = l.updateDiff || le, Q = l.getEditor || Q, D = l.getEditorView || D, T = l.getDiffEditorView || T, Z = l.cleanupEditor || Z, ae = l.safeClean || l.cleanupEditor || ae, re = l.setTheme || re, ge.value = !0, x.value && (yield de(x.value));
160
+ }
161
+ } catch (t) {
162
+ se.value = !0;
163
+ }
164
+ });
165
+ const E = B(
166
+ typeof ((Se = i.monacoOptions) == null ? void 0 : Se.fontSize) == "number" ? i.monacoOptions.fontSize : Number.NaN
167
+ ), c = B(E.value), We = Y(() => {
168
+ const t = E.value, e = c.value;
169
+ return typeof t == "number" && Number.isFinite(t) && t > 0 && typeof e == "number" && Number.isFinite(e) && e > 0;
170
+ });
171
+ function Xe() {
172
+ try {
173
+ const t = x.value;
174
+ if (!t)
175
+ return null;
176
+ const e = t.querySelector(".view-lines .view-line");
177
+ if (e) {
178
+ const o = Math.ceil(e.getBoundingClientRect().height);
179
+ if (o > 0)
180
+ return o;
181
+ }
182
+ } catch (t) {
183
+ }
184
+ return null;
185
+ }
186
+ function we() {
187
+ var t, e, o, n, l;
188
+ try {
189
+ const a = S.value ? (o = (e = (t = T()) == null ? void 0 : t.getModifiedEditor) == null ? void 0 : e.call(t)) != null ? o : T() : D(), p = Q(), y = (n = p == null ? void 0 : p.EditorOption) == null ? void 0 : n.fontInfo;
190
+ if (a && y != null) {
191
+ const m = (l = a.getOption) == null ? void 0 : l.call(a, y), s = m == null ? void 0 : m.fontSize;
192
+ if (typeof s == "number" && Number.isFinite(s) && s > 0)
193
+ return s;
194
+ }
195
+ } catch (a) {
196
+ }
197
+ try {
198
+ const a = x.value;
199
+ if (a) {
200
+ const p = a.querySelector(".view-lines .view-line");
201
+ if (p)
202
+ try {
203
+ if (typeof window != "undefined" && typeof window.getComputedStyle == "function") {
204
+ const y = window.getComputedStyle(p).fontSize, m = y && y.match(/^(\d+(?:\.\d+)?)/);
205
+ if (m)
206
+ return Number.parseFloat(m[1]);
207
+ }
208
+ } catch (y) {
209
+ }
210
+ }
211
+ } catch (a) {
212
+ }
213
+ return null;
214
+ }
215
+ function ue(t) {
216
+ var n, l;
217
+ try {
218
+ const a = Q(), p = (n = a == null ? void 0 : a.EditorOption) == null ? void 0 : n.lineHeight;
219
+ if (p != null) {
220
+ const y = (l = t == null ? void 0 : t.getOption) == null ? void 0 : l.call(t, p);
221
+ if (typeof y == "number" && y > 0)
222
+ return y;
223
+ }
224
+ } catch (a) {
225
+ }
226
+ const e = Xe();
227
+ if (e && e > 0)
228
+ return e;
229
+ const o = Number.isFinite(c.value) && c.value > 0 ? c.value : 12;
230
+ return Math.max(12, Math.round(o * 1.35));
231
+ }
232
+ function ce() {
233
+ var e;
234
+ if (Number.isFinite(c.value) && c.value > 0 && Number.isFinite(E.value))
235
+ return c.value;
236
+ const t = we();
237
+ return typeof ((e = i.monacoOptions) == null ? void 0 : e.fontSize) == "number" ? (E.value = i.monacoOptions.fontSize, c.value = i.monacoOptions.fontSize, c.value) : t && t > 0 ? (E.value = t, c.value = t, t) : (E.value = 12, c.value = 12, 12);
238
+ }
239
+ function Ue() {
240
+ const t = ce(), e = Math.min(Ie, t + Ye);
241
+ c.value = e;
242
+ }
243
+ function Ge() {
244
+ const t = ce(), e = Math.max(Re, t - Ye);
245
+ c.value = e;
246
+ }
247
+ function Je() {
248
+ ce(), Number.isFinite(E.value) && (c.value = E.value);
249
+ }
250
+ function ye() {
251
+ var t, e, o, n, l, a, p, y, m, s, h;
252
+ try {
253
+ const d = S.value ? T() : D();
254
+ if (!d)
255
+ return null;
256
+ if (S.value && (d != null && d.getOriginalEditor) && (d != null && d.getModifiedEditor)) {
257
+ const M = (t = d.getOriginalEditor) == null ? void 0 : t.call(d), O = (e = d.getModifiedEditor) == null ? void 0 : e.call(d), ct = ((o = M == null ? void 0 : M.getContentHeight) == null ? void 0 : o.call(M)) || 0, dt = ((n = O == null ? void 0 : O.getContentHeight) == null ? void 0 : n.call(O)) || 0, Fe = Math.max(ct, dt);
258
+ if (Fe > 0)
259
+ return Math.ceil(Fe + oe);
260
+ const ft = ((p = (a = (l = M == null ? void 0 : M.getModel) == null ? void 0 : l.call(M)) == null ? void 0 : a.getLineCount) == null ? void 0 : p.call(a)) || 1, vt = ((s = (m = (y = O == null ? void 0 : O.getModel) == null ? void 0 : y.call(O)) == null ? void 0 : m.getLineCount) == null ? void 0 : s.call(m)) || 1, mt = Math.max(ft, vt), ht = Math.max(ue(M), ue(O));
261
+ return Math.ceil(mt * (ht + je) + Ae + oe);
262
+ } else if (d != null && d.getContentHeight) {
263
+ const M = d.getContentHeight();
264
+ if (M > 0)
265
+ return Math.ceil(M + oe);
266
+ }
267
+ const fe = (h = d == null ? void 0 : d.getModel) == null ? void 0 : h.call(d);
268
+ let Ee = 1;
269
+ fe && typeof fe.getLineCount == "function" && (Ee = fe.getLineCount());
270
+ const ut = ue(d);
271
+ return Math.ceil(Ee * (ut + je) + Ae + oe);
272
+ } catch (d) {
273
+ return null;
274
+ }
275
+ }
276
+ function Ke() {
277
+ var y, m, s;
278
+ const t = x.value, e = j.value;
279
+ if (!t || !e)
280
+ return;
281
+ const o = t.querySelector(".monaco-editor") || t;
282
+ let n = null;
283
+ try {
284
+ typeof window != "undefined" && typeof window.getComputedStyle == "function" && (n = window.getComputedStyle(o));
285
+ } catch (h) {
286
+ n = null;
287
+ }
288
+ const l = String((y = n == null ? void 0 : n.getPropertyValue("--vscode-editor-foreground")) != null ? y : ""), a = String((m = n == null ? void 0 : n.getPropertyValue("--vscode-editor-background")) != null ? m : ""), p = String((s = n == null ? void 0 : n.getPropertyValue("--vscode-editor-hoverHighlightBackground")) != null ? s : "");
289
+ if (l && a)
290
+ return e.style.setProperty("--vscode-editor-foreground", l.trim()), e.style.setProperty("--vscode-editor-background", a.trim()), e.style.setProperty("--vscode-editor-selectionBackground", p.trim()), !0;
291
+ }
292
+ function I() {
293
+ try {
294
+ const t = x.value;
295
+ if (!t)
296
+ return;
297
+ const e = t.getBoundingClientRect(), o = window.scrollY + e.top, n = ye();
298
+ if (n != null && n > 0) {
299
+ const l = e.height;
300
+ t.style.height = `${Math.ceil(n)}px`, t.style.maxHeight = "none";
301
+ const a = Math.ceil(n) - l;
302
+ a !== 0 && o < window.scrollY && window.scrollBy(0, a);
303
+ }
304
+ } catch (t) {
305
+ }
306
+ }
307
+ function A() {
308
+ var t;
309
+ try {
310
+ const e = x.value;
311
+ if (!e)
312
+ return;
313
+ const o = e.getBoundingClientRect(), n = window.scrollY + o.top, l = o.height, a = Qe();
314
+ if (ne > 0 && (ne--, R.value != null)) {
315
+ const s = Math.min(R.value, a);
316
+ e.style.height = `${Math.ceil(s)}px`, e.style.maxHeight = `${Math.ceil(a)}px`, e.style.overflow = "auto";
317
+ const h = Math.ceil(s) - l;
318
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
319
+ return;
320
+ }
321
+ const p = ye();
322
+ if (p != null && p > 0) {
323
+ const s = Math.min(p, a);
324
+ e.style.height = `${Math.ceil(s)}px`, e.style.maxHeight = `${Math.ceil(a)}px`, e.style.overflow = "auto";
325
+ const h = Math.ceil(s) - l;
326
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
327
+ return;
328
+ }
329
+ if (R.value != null) {
330
+ const s = Math.min(R.value, a);
331
+ e.style.height = `${Math.ceil(s)}px`, e.style.maxHeight = `${Math.ceil(a)}px`, e.style.overflow = "auto";
332
+ const h = Math.ceil(s) - l;
333
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
334
+ return;
335
+ }
336
+ const y = Math.ceil(((t = e.getBoundingClientRect) == null ? void 0 : t.call(e).height) || 0);
337
+ if (y > 0) {
338
+ const s = Math.min(y, a);
339
+ e.style.height = `${Math.ceil(s)}px`, e.style.maxHeight = `${Math.ceil(a)}px`, e.style.overflow = "auto";
340
+ const h = Math.ceil(s) - l;
341
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
342
+ return;
343
+ }
344
+ const m = Number.parseFloat(e.style.height);
345
+ if (!Number.isNaN(m) && m > 0) {
346
+ const s = Math.ceil(Math.min(m, a));
347
+ e.style.height = `${s}px`;
348
+ const h = s - l;
349
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
350
+ } else {
351
+ const s = Math.ceil(a);
352
+ e.style.height = `${s}px`;
353
+ const h = s - l;
354
+ h !== 0 && n < window.scrollY && window.scrollBy(0, h);
355
+ }
356
+ e.style.maxHeight = `${Math.ceil(a)}px`, e.style.overflow = "auto";
357
+ } catch (e) {
358
+ }
359
+ }
360
+ function Qe() {
361
+ var o, n;
362
+ const t = (n = (o = i.monacoOptions) == null ? void 0 : o.MAX_HEIGHT) != null ? n : 500;
363
+ if (typeof t == "number")
364
+ return t;
365
+ const e = String(t).match(/^(\d+(?:\.\d+)?)/);
366
+ return e ? Number.parseFloat(e[1]) : 500;
367
+ }
368
+ const xe = Y(() => {
369
+ const t = v.value.trim().toLowerCase();
370
+ return i.isShowPreview && (t === "html" || t === "svg");
371
+ }), X = Y(
372
+ () => v.value.trim().toLowerCase() === "mermaid"
373
+ );
374
+ V(
375
+ () => i.node.language,
376
+ (t) => {
377
+ v.value = t;
378
+ }
379
+ ), V(
380
+ () => i.node.code,
381
+ (t) => $(null, null, function* () {
382
+ var e, o;
383
+ if (i.stream !== !1) {
384
+ if (v.value || (v.value = pe(t)), z && !J.value && x.value)
385
+ try {
386
+ yield de(x.value);
387
+ } catch (n) {
388
+ }
389
+ S.value ? le(String((e = i.node.originalCode) != null ? e : ""), String((o = i.node.updatedCode) != null ? o : ""), v.value) : ie(t, v.value), w.value && te(() => I());
390
+ }
391
+ })
392
+ );
393
+ const Ze = Y(() => {
394
+ const t = v.value.trim().toLowerCase();
395
+ return Ht[t] || t.charAt(0).toUpperCase() + t.slice(1);
396
+ }), _e = Y(() => {
397
+ const t = v.value.trim().toLowerCase();
398
+ return Tt(t.split(":")[0]);
399
+ }), et = Y(() => {
400
+ const t = {}, e = (l) => {
401
+ if (l != null)
402
+ return typeof l == "number" ? `${l}px` : String(l);
403
+ }, o = e(i.minWidth), n = e(i.maxWidth);
404
+ return o && (t.minWidth = o), n && (t.maxWidth = n), t;
405
+ });
406
+ function tt() {
407
+ return $(this, null, function* () {
408
+ try {
409
+ typeof navigator != "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && (yield navigator.clipboard.writeText(i.node.code)), N.value = !0, G("copy", i.node.code), setTimeout(() => {
410
+ N.value = !1;
411
+ }, 1e3);
412
+ } catch (t) {
413
+ console.error("复制失败:", t);
414
+ }
415
+ });
416
+ }
417
+ function ke(t) {
418
+ const e = t;
419
+ return !e || e.disabled;
420
+ }
421
+ function F(t, e, o = "top") {
422
+ if (ke(t.currentTarget))
423
+ return;
424
+ const n = t, l = (n == null ? void 0 : n.clientX) != null && (n == null ? void 0 : n.clientY) != null ? { x: n.clientX, y: n.clientY } : void 0;
425
+ Ve(t.currentTarget, e, o, !1, l, i.isDark);
426
+ }
427
+ function C() {
428
+ Lt();
429
+ }
430
+ function be(t) {
431
+ if (ke(t.currentTarget))
432
+ return;
433
+ const e = N.value ? u("common.copied") || "Copied" : u("common.copy") || "Copy", o = t, n = (o == null ? void 0 : o.clientX) != null && (o == null ? void 0 : o.clientY) != null ? { x: o.clientX, y: o.clientY } : void 0;
434
+ Ve(t.currentTarget, e, "top", !1, n, i.isDark);
435
+ }
436
+ function ot() {
437
+ w.value = !w.value;
438
+ const t = S.value ? T() : D(), e = x.value;
439
+ !t || !e || (w.value ? (_(!0), e.style.maxHeight = "none", e.style.overflow = "visible", I()) : (_(!1), e.style.overflow = "auto", A()));
440
+ }
441
+ function nt() {
442
+ var t, e, o;
443
+ if (b.value = !b.value, b.value) {
444
+ if (x.value) {
445
+ const n = Math.ceil(((e = (t = x.value).getBoundingClientRect) == null ? void 0 : e.call(t).height) || 0);
446
+ n > 0 && (R.value = n);
447
+ }
448
+ _(!1);
449
+ } else {
450
+ w.value && _(!0), x.value && R.value != null && (x.value.style.height = `${R.value}px`);
451
+ const n = S.value ? T() : D();
452
+ try {
453
+ (o = n == null ? void 0 : n.layout) == null || o.call(n);
454
+ } catch (l) {
455
+ }
456
+ ne = 2, te(() => {
457
+ w.value ? I() : A();
458
+ });
459
+ }
460
+ }
461
+ V(
462
+ () => c.value,
463
+ (t, e) => {
464
+ const o = S.value ? T() : D();
465
+ o && typeof t == "number" && Number.isFinite(t) && t > 0 && (o.updateOptions({ fontSize: t }), w.value && !b.value && I());
466
+ },
467
+ { flush: "post", immediate: !1 }
468
+ );
469
+ function it() {
470
+ if (!xe.value)
471
+ return;
472
+ const t = (v.value || i.node.language).toLowerCase(), e = t === "html" ? "text/html" : "image/svg+xml", o = t === "html" ? u("artifacts.htmlPreviewTitle") || "HTML Preview" : u("artifacts.svgPreviewTitle") || "SVG Preview";
473
+ G("previewCode", {
474
+ node: i.node,
475
+ artifactType: e,
476
+ artifactTitle: o,
477
+ id: `temp-${t}-${Date.now()}`
478
+ });
479
+ }
480
+ function _(t) {
481
+ var e, o;
482
+ try {
483
+ if (S.value) {
484
+ const n = T();
485
+ (e = n == null ? void 0 : n.updateOptions) == null || e.call(n, { automaticLayout: t });
486
+ } else {
487
+ const n = D();
488
+ (o = n == null ? void 0 : n.updateOptions) == null || o.call(n, { automaticLayout: t });
489
+ }
490
+ } catch (n) {
491
+ }
492
+ }
493
+ function lt(t) {
494
+ return $(this, null, function* () {
495
+ var o, n, l;
496
+ if (!z)
497
+ return;
498
+ S.value ? (ae(), K ? yield K(t, String((o = i.node.originalCode) != null ? o : ""), String((n = i.node.updatedCode) != null ? n : ""), v.value) : yield z(t, i.node.code, v.value)) : yield z(t, i.node.code, v.value);
499
+ const e = S.value ? T() : D();
500
+ if (typeof ((l = i.monacoOptions) == null ? void 0 : l.fontSize) == "number")
501
+ e == null || e.updateOptions({ fontSize: i.monacoOptions.fontSize, automaticLayout: !1 }), E.value = i.monacoOptions.fontSize, c.value = i.monacoOptions.fontSize;
502
+ else {
503
+ const a = we();
504
+ a && a > 0 ? (E.value = a, c.value = a) : (E.value = 12, c.value = 12);
505
+ }
506
+ !w.value && !b.value && A(), i.loading === !1 && (yield ve(), te(() => {
507
+ w.value && !b.value ? I() : b.value || A();
508
+ }));
509
+ });
510
+ }
511
+ function de(t) {
512
+ return z ? W || (J.value = !0, W = $(null, null, function* () {
513
+ yield lt(t);
514
+ }).finally(() => {
515
+ W = null;
516
+ }), W) : null;
517
+ }
518
+ const Ce = V(
519
+ () => [x.value, X.value, S.value, i.stream, i.loading, ge.value, P.value],
520
+ (y) => $(null, [y], function* ([t, e, o, n, l, a, p]) {
521
+ if (!t || !z || !p || n === !1 && l !== !1)
522
+ return;
523
+ if (X.value) {
524
+ Z(), Ce();
525
+ return;
526
+ }
527
+ const m = de(t);
528
+ m && (yield m, Ce());
529
+ })
530
+ ), at = V(
531
+ () => [i.darkTheme, i.lightTheme, J.value, P.value],
532
+ () => {
533
+ if (!(!J.value || !P.value)) {
534
+ if (X.value)
535
+ return at();
536
+ rt();
537
+ }
538
+ }
539
+ );
540
+ function Me() {
541
+ return i.isDark ? i.darkTheme : i.lightTheme;
542
+ }
543
+ function rt() {
544
+ const t = Me();
545
+ t && re(t);
546
+ }
547
+ const st = V(
548
+ () => [i.monacoOptions, P.value],
549
+ () => {
550
+ var o, n;
551
+ if (!z || !P.value)
552
+ return;
553
+ if (X.value)
554
+ return st();
555
+ const t = S.value ? T() : D(), e = typeof ((o = i.monacoOptions) == null ? void 0 : o.fontSize) == "number" ? i.monacoOptions.fontSize : Number.isFinite(c.value) ? c.value : void 0;
556
+ typeof e == "number" && Number.isFinite(e) && e > 0 && ((n = t == null ? void 0 : t.updateOptions) == null || n.call(t, { fontSize: e })), w.value && !b.value ? I() : b.value || A();
557
+ },
558
+ { deep: !0 }
559
+ ), ee = V(
560
+ () => [i.loading, P.value],
561
+ (o) => $(null, [o], function* ([t, e]) {
562
+ if (e) {
563
+ if (X.value) {
564
+ ve(() => {
565
+ ee == null || ee();
566
+ });
567
+ return;
568
+ }
569
+ t || (yield ve(), te(() => {
570
+ b.value || (w.value ? I() : A()), ee();
571
+ }));
572
+ }
573
+ }),
574
+ { immediate: !0, flush: "post" }
575
+ );
576
+ return Ct(() => {
577
+ Z();
578
+ }), (t, e) => se.value ? (H(), Mt(g(Ot), {
579
+ key: 0,
580
+ node: f.node,
581
+ loading: i.loading
582
+ }, null, 8, ["node", "loading"])) : (H(), L("div", {
583
+ key: 1,
584
+ ref_key: "container",
585
+ ref: j,
586
+ style: De(et.value),
587
+ class: Ne(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", [
588
+ i.isDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
589
+ { "is-rendering": i.loading, "is-dark": i.isDark }
590
+ ]])
591
+ }, [
592
+ i.showHeader ? (H(), L("div", Dt, [
593
+ me(t.$slots, "header-left", {}, () => [
594
+ r("div", Pt, [
595
+ r("span", {
596
+ class: "icon-slot h-4 w-4 flex-shrink-0",
597
+ innerHTML: _e.value
598
+ }, null, 8, zt),
599
+ r("span", $t, ze(Ze.value), 1)
600
+ ])
601
+ ], !0),
602
+ me(t.$slots, "header-right", {}, () => [
603
+ r("div", Vt, [
604
+ r("button", {
605
+ type: "button",
606
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
607
+ "aria-pressed": b.value,
608
+ onClick: nt,
609
+ onMouseenter: e[0] || (e[0] = (o) => F(o, b.value ? g(u)("common.expand") || "Expand" : g(u)("common.collapse") || "Collapse")),
610
+ onFocus: e[1] || (e[1] = (o) => F(o, b.value ? g(u)("common.expand") || "Expand" : g(u)("common.collapse") || "Collapse")),
611
+ onMouseleave: C,
612
+ onBlur: C
613
+ }, [
614
+ (H(), L("svg", {
615
+ style: De({ rotate: b.value ? "0deg" : "90deg" }),
616
+ xmlns: "http://www.w3.org/2000/svg",
617
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
618
+ "aria-hidden": "true",
619
+ role: "img",
620
+ width: "1em",
621
+ height: "1em",
622
+ viewBox: "0 0 24 24",
623
+ class: "w-3 h-3"
624
+ }, [...e[17] || (e[17] = [
625
+ r("path", {
626
+ fill: "none",
627
+ stroke: "currentColor",
628
+ "stroke-linecap": "round",
629
+ "stroke-linejoin": "round",
630
+ "stroke-width": "2",
631
+ d: "m9 18l6-6l-6-6"
632
+ }, null, -1)
633
+ ])], 4))
634
+ ], 40, Rt),
635
+ i.showFontSizeButtons && i.enableFontSizeControl ? (H(), L(Bt, { key: 0 }, [
636
+ r("button", {
637
+ type: "button",
638
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
639
+ disabled: Number.isFinite(c.value) ? c.value <= Re : !1,
640
+ onClick: e[2] || (e[2] = (o) => Ge()),
641
+ onMouseenter: e[3] || (e[3] = (o) => F(o, g(u)("common.decrease") || "Decrease")),
642
+ onFocus: e[4] || (e[4] = (o) => F(o, g(u)("common.decrease") || "Decrease")),
643
+ onMouseleave: C,
644
+ onBlur: C
645
+ }, [...e[18] || (e[18] = [
646
+ r("svg", {
647
+ xmlns: "http://www.w3.org/2000/svg",
648
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
649
+ "aria-hidden": "true",
650
+ role: "img",
651
+ width: "1em",
652
+ height: "1em",
653
+ viewBox: "0 0 24 24",
654
+ class: "w-3 h-3"
655
+ }, [
656
+ r("path", {
657
+ fill: "none",
658
+ stroke: "currentColor",
659
+ "stroke-linecap": "round",
660
+ "stroke-linejoin": "round",
661
+ "stroke-width": "2",
662
+ d: "M5 12h14"
663
+ })
664
+ ], -1)
665
+ ])], 40, It),
666
+ r("button", {
667
+ type: "button",
668
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
669
+ disabled: !We.value || c.value === E.value,
670
+ onClick: e[5] || (e[5] = (o) => Je()),
671
+ onMouseenter: e[6] || (e[6] = (o) => F(o, g(u)("common.reset") || "Reset")),
672
+ onFocus: e[7] || (e[7] = (o) => F(o, g(u)("common.reset") || "Reset")),
673
+ onMouseleave: C,
674
+ onBlur: C
675
+ }, [...e[19] || (e[19] = [
676
+ r("svg", {
677
+ xmlns: "http://www.w3.org/2000/svg",
678
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
679
+ "aria-hidden": "true",
680
+ role: "img",
681
+ width: "1em",
682
+ height: "1em",
683
+ viewBox: "0 0 24 24",
684
+ class: "w-3 h-3"
685
+ }, [
686
+ r("g", {
687
+ fill: "none",
688
+ stroke: "currentColor",
689
+ "stroke-linecap": "round",
690
+ "stroke-linejoin": "round",
691
+ "stroke-width": "2"
692
+ }, [
693
+ r("path", { d: "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" }),
694
+ r("path", { d: "M3 3v5h5" })
695
+ ])
696
+ ], -1)
697
+ ])], 40, Yt),
698
+ r("button", {
699
+ type: "button",
700
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
701
+ disabled: Number.isFinite(c.value) ? c.value >= Ie : !1,
702
+ onClick: e[8] || (e[8] = (o) => Ue()),
703
+ onMouseenter: e[9] || (e[9] = (o) => F(o, g(u)("common.increase") || "Increase")),
704
+ onFocus: e[10] || (e[10] = (o) => F(o, g(u)("common.increase") || "Increase")),
705
+ onMouseleave: C,
706
+ onBlur: C
707
+ }, [...e[20] || (e[20] = [
708
+ r("svg", {
709
+ xmlns: "http://www.w3.org/2000/svg",
710
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
711
+ "aria-hidden": "true",
712
+ role: "img",
713
+ width: "1em",
714
+ height: "1em",
715
+ viewBox: "0 0 24 24",
716
+ class: "w-3 h-3"
717
+ }, [
718
+ r("path", {
719
+ fill: "none",
720
+ stroke: "currentColor",
721
+ "stroke-linecap": "round",
722
+ "stroke-linejoin": "round",
723
+ "stroke-width": "2",
724
+ d: "M5 12h14m-7-7v14"
725
+ })
726
+ ], -1)
727
+ ])], 40, At)
728
+ ], 64)) : U("", !0),
729
+ i.showCopyButton ? (H(), L("button", {
730
+ key: 1,
731
+ type: "button",
732
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
733
+ "aria-label": N.value ? g(u)("common.copied") || "Copied" : g(u)("common.copy") || "Copy",
734
+ onClick: tt,
735
+ onMouseenter: e[11] || (e[11] = (o) => be(o)),
736
+ onFocus: e[12] || (e[12] = (o) => be(o)),
737
+ onMouseleave: C,
738
+ onBlur: C
739
+ }, [
740
+ N.value ? (H(), L("svg", Wt, [...e[22] || (e[22] = [
741
+ r("path", {
742
+ fill: "none",
743
+ stroke: "currentColor",
744
+ "stroke-linecap": "round",
745
+ "stroke-linejoin": "round",
746
+ "stroke-width": "2",
747
+ d: "M20 6L9 17l-5-5"
748
+ }, null, -1)
749
+ ])])) : (H(), L("svg", qt, [...e[21] || (e[21] = [
750
+ r("g", {
751
+ fill: "none",
752
+ stroke: "currentColor",
753
+ "stroke-linecap": "round",
754
+ "stroke-linejoin": "round",
755
+ "stroke-width": "2"
756
+ }, [
757
+ r("rect", {
758
+ width: "14",
759
+ height: "14",
760
+ x: "8",
761
+ y: "8",
762
+ rx: "2",
763
+ ry: "2"
764
+ }),
765
+ r("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
766
+ ], -1)
767
+ ])]))
768
+ ], 40, jt)) : U("", !0),
769
+ i.showExpandButton ? (H(), L("button", {
770
+ key: 2,
771
+ type: "button",
772
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
773
+ "aria-pressed": w.value,
774
+ onClick: ot,
775
+ onMouseenter: e[13] || (e[13] = (o) => F(o, w.value ? g(u)("common.collapse") || "Collapse" : g(u)("common.expand") || "Expand")),
776
+ onFocus: e[14] || (e[14] = (o) => F(o, w.value ? g(u)("common.collapse") || "Collapse" : g(u)("common.expand") || "Expand")),
777
+ onMouseleave: C,
778
+ onBlur: C
779
+ }, [
780
+ w.value ? (H(), L("svg", Ut, [...e[23] || (e[23] = [
781
+ r("path", {
782
+ fill: "none",
783
+ stroke: "currentColor",
784
+ "stroke-linecap": "round",
785
+ "stroke-linejoin": "round",
786
+ "stroke-width": "2",
787
+ d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"
788
+ }, null, -1)
789
+ ])])) : (H(), L("svg", Gt, [...e[24] || (e[24] = [
790
+ r("path", {
791
+ fill: "none",
792
+ stroke: "currentColor",
793
+ "stroke-linecap": "round",
794
+ "stroke-linejoin": "round",
795
+ "stroke-width": "2",
796
+ d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"
797
+ }, null, -1)
798
+ ])]))
799
+ ], 40, Xt)) : U("", !0),
800
+ xe.value && i.showPreviewButton ? (H(), L("button", {
801
+ key: 3,
802
+ type: "button",
803
+ class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
804
+ "aria-label": g(u)("common.preview") || "Preview",
805
+ onClick: it,
806
+ onMouseenter: e[15] || (e[15] = (o) => F(o, g(u)("common.preview") || "Preview")),
807
+ onFocus: e[16] || (e[16] = (o) => F(o, g(u)("common.preview") || "Preview")),
808
+ onMouseleave: C,
809
+ onBlur: C
810
+ }, [...e[25] || (e[25] = [
811
+ r("svg", {
812
+ xmlns: "http://www.w3.org/2000/svg",
813
+ width: "12",
814
+ height: "12",
815
+ viewBox: "0 0 24 24"
816
+ }, [
817
+ r("g", {
818
+ fill: "currentColor",
819
+ "fill-rule": "evenodd",
820
+ "clip-rule": "evenodd"
821
+ }, [
822
+ r("path", { d: "M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496" }),
823
+ r("path", { d: "M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23" })
824
+ ])
825
+ ], -1)
826
+ ])], 40, Jt)) : U("", !0)
827
+ ])
828
+ ], !0)
829
+ ])) : U("", !0),
830
+ Pe(r("div", {
831
+ ref_key: "codeEditor",
832
+ ref: x,
833
+ class: Ne(["code-editor-container", [f.stream ? "" : "code-height-placeholder"]])
834
+ }, null, 2), [
835
+ [$e, !b.value && (f.stream ? !0 : !f.loading)]
836
+ ]),
837
+ Pe(r("div", Kt, [
838
+ me(t.$slots, "loading", {
839
+ loading: f.loading,
840
+ stream: f.stream
841
+ }, () => [
842
+ e[26] || (e[26] = r("div", { class: "loading-skeleton" }, [
843
+ r("div", { class: "skeleton-line" }),
844
+ r("div", { class: "skeleton-line" }),
845
+ r("div", { class: "skeleton-line short" })
846
+ ], -1))
847
+ ], !0)
848
+ ], 512), [
849
+ [$e, !f.stream && f.loading]
850
+ ]),
851
+ r("span", Qt, ze(N.value ? g(u)("common.copied") || "Copied" : ""), 1)
852
+ ], 6));
853
+ }
854
+ }), he = /* @__PURE__ */ Nt(Zt, [["__scopeId", "data-v-8443b140"]]);
855
+ he.install = (f) => {
856
+ f.component(he.__name, he);
857
+ };
858
+ export {
859
+ he as default
860
+ };