markstream-vue2 0.0.53 → 0.1.0-beta.2

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 (181) hide show
  1. package/README.md +27 -24
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.js +679 -2006
  6. package/dist/index.px.css +1 -1
  7. package/dist/index.tailwind.css +1 -1
  8. package/dist/tailwind.ts +1 -1
  9. package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +38 -19
  10. package/dist/types/components/CodeBlockNode/streamDiffs.d.ts +9 -0
  11. package/dist/types/components/MarkdownRenderCompat.vue.d.ts +11 -14
  12. package/dist/types/components/NodeRenderer/CodeBlockNodeLoading.vue.d.ts +0 -9
  13. package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +9 -20
  14. package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +10 -20
  15. package/dist/types/composables/useSingletonTooltip.d.ts +1 -1
  16. package/dist/types/exports.d.ts +2 -3
  17. package/dist/types/types/component-props.d.ts +59 -69
  18. package/dist/types/utils/index.d.ts +1 -1
  19. package/dist/types/utils/languageIcon.d.ts +1 -1
  20. package/package.json +7 -15
  21. package/dist/chunks/andromeeda-0e066d27.js +0 -4
  22. package/dist/chunks/andromeeda-beebe2f9.cjs +0 -1
  23. package/dist/chunks/aurora-x-7d279c8e.cjs +0 -1
  24. package/dist/chunks/aurora-x-e4f2fe1b.js +0 -4
  25. package/dist/chunks/ayu-dark-349c357c.js +0 -4
  26. package/dist/chunks/ayu-dark-5e86208e.cjs +0 -1
  27. package/dist/chunks/ayu-light-18928686.cjs +0 -1
  28. package/dist/chunks/ayu-light-bfc150f8.js +0 -4
  29. package/dist/chunks/ayu-mirage-3383fcd0.js +0 -4
  30. package/dist/chunks/ayu-mirage-3af5c477.cjs +0 -1
  31. package/dist/chunks/catppuccin-frappe-32dd8ebe.js +0 -4
  32. package/dist/chunks/catppuccin-frappe-5990e1cc.cjs +0 -1
  33. package/dist/chunks/catppuccin-latte-7dd9ec26.cjs +0 -1
  34. package/dist/chunks/catppuccin-latte-842c8be1.js +0 -4
  35. package/dist/chunks/catppuccin-macchiato-0c355ced.js +0 -4
  36. package/dist/chunks/catppuccin-macchiato-12297a0c.cjs +0 -1
  37. package/dist/chunks/catppuccin-mocha-164bffb5.cjs +0 -1
  38. package/dist/chunks/catppuccin-mocha-840be6a5.js +0 -4
  39. package/dist/chunks/dark-plus-37515867.cjs +0 -1
  40. package/dist/chunks/dark-plus-51ee0d5e.js +0 -4
  41. package/dist/chunks/dracula-6e5c19a8.js +0 -4
  42. package/dist/chunks/dracula-ad0b94e0.cjs +0 -1
  43. package/dist/chunks/dracula-soft-223c44b5.cjs +0 -1
  44. package/dist/chunks/dracula-soft-744d21b1.js +0 -4
  45. package/dist/chunks/everforest-dark-3a566062.js +0 -4
  46. package/dist/chunks/everforest-dark-630f597e.cjs +0 -1
  47. package/dist/chunks/everforest-light-92583419.js +0 -4
  48. package/dist/chunks/everforest-light-ba8af69c.cjs +0 -1
  49. package/dist/chunks/github-dark-44cb1819.cjs +0 -1
  50. package/dist/chunks/github-dark-cb4e8bb4.js +0 -4
  51. package/dist/chunks/github-dark-default-d50179ae.js +0 -4
  52. package/dist/chunks/github-dark-default-f99477eb.cjs +0 -1
  53. package/dist/chunks/github-dark-dimmed-96ccf893.cjs +0 -1
  54. package/dist/chunks/github-dark-dimmed-ebbb9420.js +0 -4
  55. package/dist/chunks/github-dark-high-contrast-5cc08661.js +0 -4
  56. package/dist/chunks/github-dark-high-contrast-adcd4e61.cjs +0 -1
  57. package/dist/chunks/github-light-42f759a4.cjs +0 -1
  58. package/dist/chunks/github-light-555bd325.js +0 -4
  59. package/dist/chunks/github-light-default-50fa37cd.cjs +0 -1
  60. package/dist/chunks/github-light-default-9c006cf6.js +0 -4
  61. package/dist/chunks/github-light-high-contrast-15a9bb5a.cjs +0 -1
  62. package/dist/chunks/github-light-high-contrast-ffa0564e.js +0 -4
  63. package/dist/chunks/gruvbox-dark-hard-4412389e.js +0 -4
  64. package/dist/chunks/gruvbox-dark-hard-cc007dcd.cjs +0 -1
  65. package/dist/chunks/gruvbox-dark-medium-415e09f2.cjs +0 -1
  66. package/dist/chunks/gruvbox-dark-medium-fa0eeef7.js +0 -4
  67. package/dist/chunks/gruvbox-dark-soft-3125d894.cjs +0 -1
  68. package/dist/chunks/gruvbox-dark-soft-a4600b2a.js +0 -4
  69. package/dist/chunks/gruvbox-light-hard-4c8c0395.cjs +0 -1
  70. package/dist/chunks/gruvbox-light-hard-8e736562.js +0 -4
  71. package/dist/chunks/gruvbox-light-medium-0c0cbf5d.js +0 -4
  72. package/dist/chunks/gruvbox-light-medium-abf52b0c.cjs +0 -1
  73. package/dist/chunks/gruvbox-light-soft-0e7ed903.cjs +0 -1
  74. package/dist/chunks/gruvbox-light-soft-a35d50d0.js +0 -4
  75. package/dist/chunks/horizon-31da8ee5.js +0 -4
  76. package/dist/chunks/horizon-bright-bb8b03f8.js +0 -4
  77. package/dist/chunks/horizon-bright-d2ea0b12.cjs +0 -1
  78. package/dist/chunks/horizon-f8b833c3.cjs +0 -1
  79. package/dist/chunks/houston-20eb8cbf.cjs +0 -1
  80. package/dist/chunks/houston-d3d3c60d.js +0 -4
  81. package/dist/chunks/index-42602bc0.js +0 -18739
  82. package/dist/chunks/index-b485917b.cjs +0 -1
  83. package/dist/chunks/index-c958c796.cjs +0 -1
  84. package/dist/chunks/index-fce73667.js +0 -1702
  85. package/dist/chunks/kanagawa-dragon-0246ed94.cjs +0 -1
  86. package/dist/chunks/kanagawa-dragon-324edcdc.js +0 -4
  87. package/dist/chunks/kanagawa-lotus-61838bd3.cjs +0 -1
  88. package/dist/chunks/kanagawa-lotus-a847832a.js +0 -4
  89. package/dist/chunks/kanagawa-wave-2b426416.cjs +0 -1
  90. package/dist/chunks/kanagawa-wave-7b8409ec.js +0 -4
  91. package/dist/chunks/laserwave-538ee8e3.js +0 -4
  92. package/dist/chunks/laserwave-d5e6cfa6.cjs +0 -1
  93. package/dist/chunks/light-plus-471df294.cjs +0 -1
  94. package/dist/chunks/light-plus-a0703fa7.js +0 -4
  95. package/dist/chunks/material-theme-686d9ffc.js +0 -4
  96. package/dist/chunks/material-theme-9d859633.cjs +0 -1
  97. package/dist/chunks/material-theme-darker-cac9360e.js +0 -4
  98. package/dist/chunks/material-theme-darker-fe8dd38a.cjs +0 -1
  99. package/dist/chunks/material-theme-lighter-03523bbb.js +0 -4
  100. package/dist/chunks/material-theme-lighter-879be29a.cjs +0 -1
  101. package/dist/chunks/material-theme-ocean-37052f40.js +0 -4
  102. package/dist/chunks/material-theme-ocean-c1caeaa4.cjs +0 -1
  103. package/dist/chunks/material-theme-palenight-70bbf617.js +0 -4
  104. package/dist/chunks/material-theme-palenight-ef8b2399.cjs +0 -1
  105. package/dist/chunks/min-dark-0baaa2b0.cjs +0 -1
  106. package/dist/chunks/min-dark-16b503e6.js +0 -4
  107. package/dist/chunks/min-light-0c4ea4ec.js +0 -4
  108. package/dist/chunks/min-light-f65395e0.cjs +0 -1
  109. package/dist/chunks/monokai-32171550.js +0 -4
  110. package/dist/chunks/monokai-b9c22257.cjs +0 -1
  111. package/dist/chunks/night-owl-5eeb6e45.cjs +0 -1
  112. package/dist/chunks/night-owl-cb71e64c.js +0 -4
  113. package/dist/chunks/night-owl-light-3b4be46f.js +0 -4
  114. package/dist/chunks/night-owl-light-f04fad9f.cjs +0 -1
  115. package/dist/chunks/nord-0b42b6b4.cjs +0 -1
  116. package/dist/chunks/nord-b2f653cd.js +0 -4
  117. package/dist/chunks/one-dark-pro-611d46bc.js +0 -4
  118. package/dist/chunks/one-dark-pro-6ac63500.cjs +0 -1
  119. package/dist/chunks/one-light-2f27f0f0.cjs +0 -1
  120. package/dist/chunks/one-light-f2b411cc.js +0 -4
  121. package/dist/chunks/pierre-dark-9c2ca7e3.cjs +0 -1
  122. package/dist/chunks/pierre-dark-f4c18c96.js +0 -4
  123. package/dist/chunks/pierre-dark-protanopia-deuteranopia-31face57.js +0 -4
  124. package/dist/chunks/pierre-dark-protanopia-deuteranopia-67028f58.cjs +0 -1
  125. package/dist/chunks/pierre-dark-soft-3103370a.js +0 -4
  126. package/dist/chunks/pierre-dark-soft-59e1d5bc.cjs +0 -1
  127. package/dist/chunks/pierre-dark-tritanopia-b2966d75.js +0 -4
  128. package/dist/chunks/pierre-dark-tritanopia-d87f3323.cjs +0 -1
  129. package/dist/chunks/pierre-dark-vibrant-4de6032d.js +0 -4
  130. package/dist/chunks/pierre-dark-vibrant-f4553619.cjs +0 -1
  131. package/dist/chunks/pierre-light-45d08543.js +0 -4
  132. package/dist/chunks/pierre-light-ae152c30.cjs +0 -1
  133. package/dist/chunks/pierre-light-protanopia-deuteranopia-78f5453c.cjs +0 -1
  134. package/dist/chunks/pierre-light-protanopia-deuteranopia-816a3304.js +0 -4
  135. package/dist/chunks/pierre-light-soft-2a7b83ed.cjs +0 -1
  136. package/dist/chunks/pierre-light-soft-9c96aa07.js +0 -4
  137. package/dist/chunks/pierre-light-tritanopia-22534644.cjs +0 -1
  138. package/dist/chunks/pierre-light-tritanopia-b49f3566.js +0 -4
  139. package/dist/chunks/pierre-light-vibrant-178f2e13.cjs +0 -1
  140. package/dist/chunks/pierre-light-vibrant-1d779afc.js +0 -4
  141. package/dist/chunks/plastic-050a5288.js +0 -4
  142. package/dist/chunks/plastic-ab5115cb.cjs +0 -1
  143. package/dist/chunks/poimandres-9b9bffc0.cjs +0 -1
  144. package/dist/chunks/poimandres-e7807ea4.js +0 -4
  145. package/dist/chunks/red-58c74b50.cjs +0 -1
  146. package/dist/chunks/red-8b5bb9fd.js +0 -4
  147. package/dist/chunks/rose-pine-dawn-c54a297c.js +0 -4
  148. package/dist/chunks/rose-pine-dawn-dcd06a2d.cjs +0 -1
  149. package/dist/chunks/rose-pine-e3dfc7b6.js +0 -4
  150. package/dist/chunks/rose-pine-e443c3f3.cjs +0 -1
  151. package/dist/chunks/rose-pine-moon-c4ae0bee.cjs +0 -1
  152. package/dist/chunks/rose-pine-moon-ff747b44.js +0 -4
  153. package/dist/chunks/slack-dark-119fdcba.cjs +0 -1
  154. package/dist/chunks/slack-dark-cba39ccf.js +0 -4
  155. package/dist/chunks/slack-ochin-4a97383e.js +0 -4
  156. package/dist/chunks/slack-ochin-e53abb89.cjs +0 -1
  157. package/dist/chunks/snazzy-light-863adb77.js +0 -4
  158. package/dist/chunks/snazzy-light-aacd1ca8.cjs +0 -1
  159. package/dist/chunks/solarized-dark-18286b81.js +0 -4
  160. package/dist/chunks/solarized-dark-6c53ecf9.cjs +0 -1
  161. package/dist/chunks/solarized-light-abef5a54.cjs +0 -1
  162. package/dist/chunks/solarized-light-e7adfa5b.js +0 -4
  163. package/dist/chunks/synthwave-84-26ebbfca.js +0 -4
  164. package/dist/chunks/synthwave-84-ddb2c535.cjs +0 -1
  165. package/dist/chunks/tokyo-night-25368f86.js +0 -4
  166. package/dist/chunks/tokyo-night-6e0b49fd.cjs +0 -1
  167. package/dist/chunks/vesper-0ba44279.js +0 -4
  168. package/dist/chunks/vesper-a2e0b586.cjs +0 -1
  169. package/dist/chunks/vitesse-black-2be67ba4.cjs +0 -1
  170. package/dist/chunks/vitesse-black-33005deb.js +0 -4
  171. package/dist/chunks/vitesse-dark-82a14fc3.cjs +0 -1
  172. package/dist/chunks/vitesse-dark-9bb81e7a.js +0 -4
  173. package/dist/chunks/vitesse-light-2f9f7ba9.js +0 -4
  174. package/dist/chunks/vitesse-light-ee2c704b.cjs +0 -1
  175. package/dist/chunks/wasm-4cd10f60.cjs +0 -1
  176. package/dist/chunks/wasm-cb55701e.js +0 -30
  177. package/dist/types/components/CodeBlockNode/monaco.d.ts +0 -1
  178. package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +0 -3
  179. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +0 -233
  180. package/dist/types/components/MarkdownCodeBlockNode/index.d.ts +0 -2
  181. /package/dist/types/components/NodeRenderer/{preloadMonaco.d.ts → preloadStreamDiffs.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __pow = Math.pow;
8
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
8
  var __spreadValues = (a, b) => {
10
9
  for (var prop in b || (b = {}))
@@ -56,7 +55,7 @@ export * from "stream-markdown-parser";
56
55
  import { KATEX_COMMANDS, normalizeStandaloneBackslashT, setDefaultMathOptions as setDefaultMathOptions2 } from "stream-markdown-parser";
57
56
  import * as VueModule from "vue-demi";
58
57
  import { defineComponent, getCurrentInstance, computed, shallowRef, h, inject, ref, watch, readonly, useAttrs, onMounted, nextTick, onUpdated, onBeforeUnmount, provide, onUnmounted, getCurrentScope, onScopeDispose, markRaw, reactive } from "vue-demi";
59
- import { normalizeShikiLanguage, createSmoothMarkdownStream, getHighlightRegistrationKey, getRuntimeShikiRegistrationConfig, registerHighlightOnce } from "markstream-core";
58
+ import { normalizeShikiLanguage, createSmoothMarkdownStream } from "markstream-core";
60
59
  import { autoUpdate, offset, flip, shift, computePosition } from "@floating-ui/dom";
61
60
  function getVue2MinorVersion$1(version) {
62
61
  const raw = typeof version === "string" ? version : "";
@@ -130,7 +129,7 @@ function resolveVueListeners(input) {
130
129
  }
131
130
  return listeners;
132
131
  }
133
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
132
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
134
133
  __name: "CheckboxNode",
135
134
  props: {
136
135
  node: null
@@ -140,10 +139,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
140
139
  }
141
140
  });
142
141
  const CheckboxNode_vue_vue_type_style_index_0_scoped_8dc6c46f_lang = "";
143
- function normalizeComponent(scriptExports, render46, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
142
+ function normalizeComponent(scriptExports, render45, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
144
143
  var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
145
- if (render46) {
146
- options.render = render46;
144
+ if (render45) {
145
+ options.render = render45;
147
146
  options.staticRenderFns = staticRenderFns;
148
147
  options._compiled = true;
149
148
  }
@@ -196,24 +195,24 @@ function normalizeComponent(scriptExports, render46, staticRenderFns, functional
196
195
  options
197
196
  };
198
197
  }
199
- var _sfc_render$J = function render() {
198
+ var _sfc_render$I = function render() {
200
199
  var _vm = this, _c = _vm._self._c;
201
200
  _vm._self._setupProxy;
202
201
  return _c("span", { staticClass: "checkbox-node" }, [_c("input", { staticClass: "checkbox-input", attrs: { "type": "checkbox", "disabled": "" }, domProps: { "checked": _vm.node.checked } })]);
203
202
  };
204
- var _sfc_staticRenderFns$J = [];
205
- var __component__$J = /* @__PURE__ */ normalizeComponent(
206
- _sfc_main$J,
207
- _sfc_render$J,
208
- _sfc_staticRenderFns$J,
203
+ var _sfc_staticRenderFns$I = [];
204
+ var __component__$I = /* @__PURE__ */ normalizeComponent(
205
+ _sfc_main$I,
206
+ _sfc_render$I,
207
+ _sfc_staticRenderFns$I,
209
208
  false,
210
209
  null,
211
210
  "8dc6c46f",
212
211
  null,
213
212
  null
214
213
  );
215
- const CheckboxNode = __component__$J.exports;
216
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
214
+ const CheckboxNode = __component__$I.exports;
215
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
217
216
  __name: "DefinitionListNode",
218
217
  props: {
219
218
  node: null,
@@ -249,7 +248,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
249
248
  }
250
249
  });
251
250
  const DefinitionListNode_vue_vue_type_style_index_0_scoped_b089ea12_lang = "";
252
- var _sfc_render$I = function render2() {
251
+ var _sfc_render$H = function render2() {
253
252
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
254
253
  return _c("dl", { staticClass: "definition-list" }, _vm._l(_setup.definitionEntries, function(entry) {
255
254
  return _c(entry.tag, { key: entry.key, tag: "component", class: entry.className }, [_c(_setup.nestedRenderer, { tag: "component", attrs: { "index-key": entry.key, "nodes": entry.nodes, "custom-id": _setup.props.customId, "typewriter": _setup.props.typewriter }, on: { "copy": function($event) {
@@ -257,19 +256,19 @@ var _sfc_render$I = function render2() {
257
256
  } } })], 1);
258
257
  }), 1);
259
258
  };
260
- var _sfc_staticRenderFns$I = [];
261
- var __component__$I = /* @__PURE__ */ normalizeComponent(
262
- _sfc_main$I,
263
- _sfc_render$I,
264
- _sfc_staticRenderFns$I,
259
+ var _sfc_staticRenderFns$H = [];
260
+ var __component__$H = /* @__PURE__ */ normalizeComponent(
261
+ _sfc_main$H,
262
+ _sfc_render$H,
263
+ _sfc_staticRenderFns$H,
265
264
  false,
266
265
  null,
267
266
  "b089ea12",
268
267
  null,
269
268
  null
270
269
  );
271
- const DefinitionListNode = __component__$I.exports;
272
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
270
+ const DefinitionListNode = __component__$H.exports;
271
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
273
272
  __name: "EmojiNode",
274
273
  props: {
275
274
  node: null
@@ -279,23 +278,23 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
279
278
  }
280
279
  });
281
280
  const EmojiNode_vue_vue_type_style_index_0_scoped_de55dc97_lang = "";
282
- var _sfc_render$H = function render3() {
281
+ var _sfc_render$G = function render3() {
283
282
  var _vm = this, _c = _vm._self._c;
284
283
  _vm._self._setupProxy;
285
284
  return _c("span", { staticClass: "emoji-node" }, [_vm._v(_vm._s(_vm.node.name))]);
286
285
  };
287
- var _sfc_staticRenderFns$H = [];
288
- var __component__$H = /* @__PURE__ */ normalizeComponent(
289
- _sfc_main$H,
290
- _sfc_render$H,
291
- _sfc_staticRenderFns$H,
286
+ var _sfc_staticRenderFns$G = [];
287
+ var __component__$G = /* @__PURE__ */ normalizeComponent(
288
+ _sfc_main$G,
289
+ _sfc_render$G,
290
+ _sfc_staticRenderFns$G,
292
291
  false,
293
292
  null,
294
293
  "de55dc97",
295
294
  null,
296
295
  null
297
296
  );
298
- const EmojiNode = __component__$H.exports;
297
+ const EmojiNode = __component__$G.exports;
299
298
  const GLOBAL_KEY = "__global__";
300
299
  const STORE_KEY = "__MARKSTREAM_VUE2_CUSTOM_COMPONENTS_STORE__";
301
300
  const store = (() => {
@@ -340,7 +339,7 @@ function clearGlobalCustomComponents() {
340
339
  delete store.scopedCustomComponents[GLOBAL_KEY];
341
340
  customComponentsRevision.value++;
342
341
  }
343
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
342
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
344
343
  __name: "FootnoteReferenceNode",
345
344
  props: {
346
345
  node: null
@@ -363,22 +362,22 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
363
362
  }
364
363
  });
365
364
  const FootnoteReferenceNode_vue_vue_type_style_index_0_scoped_4da20e16_lang = "";
366
- var _sfc_render$G = function render4() {
365
+ var _sfc_render$F = function render4() {
367
366
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
368
367
  return _c("sup", { staticClass: "footnote-reference", attrs: { "id": `fnref-${_vm.node.id}` }, on: { "click": _setup.handleScroll } }, [_c("span", { staticClass: "footnote-link cursor-pointer", attrs: { "href": _setup.href, "title": `查看脚注 ${_vm.node.id}` } }, [_vm._v("[" + _vm._s(_vm.node.id) + "]")])]);
369
368
  };
370
- var _sfc_staticRenderFns$G = [];
371
- var __component__$G = /* @__PURE__ */ normalizeComponent(
372
- _sfc_main$G,
373
- _sfc_render$G,
374
- _sfc_staticRenderFns$G,
369
+ var _sfc_staticRenderFns$F = [];
370
+ var __component__$F = /* @__PURE__ */ normalizeComponent(
371
+ _sfc_main$F,
372
+ _sfc_render$F,
373
+ _sfc_staticRenderFns$F,
375
374
  false,
376
375
  null,
377
376
  "4da20e16",
378
377
  null,
379
378
  null
380
379
  );
381
- const FootnoteReferenceNode = __component__$G.exports;
380
+ const FootnoteReferenceNode = __component__$F.exports;
382
381
  function getVue2CreateElementFallback() {
383
382
  var _a2, _b, _c;
384
383
  const anyMod = VueModule;
@@ -539,7 +538,7 @@ function parseHtmlToVNodes(content2, customComponents, createElement, htmlPolicy
539
538
  return null;
540
539
  }
541
540
  }
542
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
541
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
543
542
  __name: "HtmlInlineNode",
544
543
  props: {
545
544
  node: null,
@@ -593,23 +592,23 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
593
592
  }
594
593
  });
595
594
  const HtmlInlineNode_vue_vue_type_style_index_0_scoped_e6ed4c9f_lang = "";
596
- var _sfc_render$F = function render5() {
595
+ var _sfc_render$E = function render5() {
597
596
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
598
597
  return _setup.renderMode.mode === "dynamic" ? _c("span", { staticClass: "html-inline-node", class: { "html-inline-node--loading": _setup.props.node.loading } }, [_c(_setup.DynamicRenderer, { attrs: { "content": _setup.renderMode.content, "custom-components": _setup.customComponents, "html-policy": _setup.resolvedHtmlPolicy } })], 1) : _setup.renderMode.mode === "text" ? _c("span", { staticClass: "html-inline-node", class: { "html-inline-node--loading": _setup.props.node.loading } }, [_vm._v(_vm._s(_setup.renderMode.content))]) : _c("span", { staticClass: "html-inline-node", class: { "html-inline-node--loading": _setup.props.node.loading }, domProps: { "innerHTML": _vm._s(_setup.renderMode.content) } });
599
598
  };
600
- var _sfc_staticRenderFns$F = [];
601
- var __component__$F = /* @__PURE__ */ normalizeComponent(
602
- _sfc_main$F,
603
- _sfc_render$F,
604
- _sfc_staticRenderFns$F,
599
+ var _sfc_staticRenderFns$E = [];
600
+ var __component__$E = /* @__PURE__ */ normalizeComponent(
601
+ _sfc_main$E,
602
+ _sfc_render$E,
603
+ _sfc_staticRenderFns$E,
605
604
  false,
606
605
  null,
607
606
  "e6ed4c9f",
608
607
  null,
609
608
  null
610
609
  );
611
- const HtmlInlineNode = __component__$F.exports;
612
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
610
+ const HtmlInlineNode = __component__$E.exports;
611
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
613
612
  __name: "InlineCodeNode",
614
613
  props: {
615
614
  node: null
@@ -728,7 +727,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
728
727
  }
729
728
  });
730
729
  const InlineCodeNode_vue_vue_type_style_index_0_scoped_6ea4ef26_lang = "";
731
- var _sfc_render$E = function render6() {
730
+ var _sfc_render$D = function render6() {
732
731
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
733
732
  return _c("code", { staticClass: "inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']" }, _vm._l(_setup.segments, function(segment) {
734
733
  return _c("span", { key: segment.id, class: segment.fading ? ["inline-code-stream-delta", _setup.streamedDeltaClass(segment)] : void 0, on: { "animationend": function($event) {
@@ -736,18 +735,18 @@ var _sfc_render$E = function render6() {
736
735
  } } }, [_vm._v(" " + _vm._s(segment.content) + " ")]);
737
736
  }), 0);
738
737
  };
739
- var _sfc_staticRenderFns$E = [];
740
- var __component__$E = /* @__PURE__ */ normalizeComponent(
741
- _sfc_main$E,
742
- _sfc_render$E,
743
- _sfc_staticRenderFns$E,
738
+ var _sfc_staticRenderFns$D = [];
739
+ var __component__$D = /* @__PURE__ */ normalizeComponent(
740
+ _sfc_main$D,
741
+ _sfc_render$D,
742
+ _sfc_staticRenderFns$D,
744
743
  false,
745
744
  null,
746
745
  "6ea4ef26",
747
746
  null,
748
747
  null
749
748
  );
750
- const InlineCodeNode = __component__$E.exports;
749
+ const InlineCodeNode = __component__$D.exports;
751
750
  function getVueCtor() {
752
751
  var _a2, _b, _c, _d;
753
752
  const anyMod = VueModule;
@@ -934,7 +933,7 @@ function useSafeI18n() {
934
933
  }
935
934
  return { t: fallbackT };
936
935
  }
937
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
936
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
938
937
  __name: "ImageNode",
939
938
  props: {
940
939
  node: null,
@@ -1008,7 +1007,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1008
1007
  }
1009
1008
  });
1010
1009
  const ImageNode_vue_vue_type_style_index_0_scoped_05ffe4c4_lang = "";
1011
- var _sfc_render$D = function render7() {
1010
+ var _sfc_render$C = function render7() {
1012
1011
  var _a2, _b, _c2, _d, _e;
1013
1012
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
1014
1013
  return _c("transition", { attrs: { "name": "img-switch", "mode": "out-in" } }, [_setup.showImage ? _c("img", { key: "image", staticClass: "image-node__img h-auto rounded-lg transition-opacity duration-200 ease-in-out image-node__img--inline", class: {
@@ -1021,18 +1020,18 @@ var _sfc_render$D = function render7() {
1021
1020
  return [_c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "width": "16", "height": "16", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "currentColor", "d": "M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z" } })]), _c("span", { staticClass: "text-sm whitespace-nowrap" }, [_vm._v(_vm._s(_setup.t("image.loadError")))])];
1022
1021
  }, { "node": _setup.props.node, "displaySrc": _setup.displaySrc, "imageLoaded": _setup.imageLoaded, "hasError": _setup.hasError, "fallbackSrc": _setup.props.fallbackSrc, "lazy": _setup.props.lazy })], 2) : _vm._e()]);
1023
1022
  };
1024
- var _sfc_staticRenderFns$D = [];
1025
- var __component__$D = /* @__PURE__ */ normalizeComponent(
1026
- _sfc_main$D,
1027
- _sfc_render$D,
1028
- _sfc_staticRenderFns$D,
1023
+ var _sfc_staticRenderFns$C = [];
1024
+ var __component__$C = /* @__PURE__ */ normalizeComponent(
1025
+ _sfc_main$C,
1026
+ _sfc_render$C,
1027
+ _sfc_staticRenderFns$C,
1029
1028
  false,
1030
1029
  null,
1031
1030
  "05ffe4c4",
1032
1031
  null,
1033
1032
  null
1034
1033
  );
1035
- const ImageNode = __component__$D.exports;
1034
+ const ImageNode = __component__$C.exports;
1036
1035
  let katex = null;
1037
1036
  let importAttempted$1 = false;
1038
1037
  let katexLoader = defaultKatexLoader;
@@ -1122,7 +1121,7 @@ function useKatexReady() {
1122
1121
  }
1123
1122
  return readonly(katexReadyState);
1124
1123
  }
1125
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
1124
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1126
1125
  __name: "TextNode",
1127
1126
  props: {
1128
1127
  node: null
@@ -1262,7 +1261,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1262
1261
  }
1263
1262
  });
1264
1263
  const TextNode_vue_vue_type_style_index_0_scoped_00951658_lang = "";
1265
- var _sfc_render$C = function render8() {
1264
+ var _sfc_render$B = function render8() {
1266
1265
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
1267
1266
  return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] }, _vm._l(_setup.segments, function(segment) {
1268
1267
  return _c("span", { key: segment.id, class: segment.fading ? ["text-node-stream-delta", _setup.streamedDeltaClass(segment)] : void 0, on: { "animationend": function($event) {
@@ -1270,90 +1269,64 @@ var _sfc_render$C = function render8() {
1270
1269
  } } }, [_vm._v(" " + _vm._s(segment.content) + " ")]);
1271
1270
  }), 0);
1272
1271
  };
1273
- var _sfc_staticRenderFns$C = [];
1274
- var __component__$C = /* @__PURE__ */ normalizeComponent(
1275
- _sfc_main$C,
1276
- _sfc_render$C,
1277
- _sfc_staticRenderFns$C,
1272
+ var _sfc_staticRenderFns$B = [];
1273
+ var __component__$B = /* @__PURE__ */ normalizeComponent(
1274
+ _sfc_main$B,
1275
+ _sfc_render$B,
1276
+ _sfc_staticRenderFns$B,
1278
1277
  false,
1279
1278
  null,
1280
1279
  "00951658",
1281
1280
  null,
1282
1281
  null
1283
1282
  );
1284
- const TextNode = __component__$C.exports;
1283
+ const TextNode = __component__$B.exports;
1285
1284
  let isPreload = false;
1286
1285
  function preload(m) {
1287
1286
  return __async(this, null, function* () {
1287
+ var _a2;
1288
1288
  if (isPreload)
1289
1289
  return;
1290
1290
  isPreload = true;
1291
- const existingEnv = globalThis == null ? void 0 : globalThis.MonacoEnvironment;
1292
- if (existingEnv && (typeof existingEnv.getWorker === "function" || typeof existingEnv.getWorkerUrl === "function"))
1293
- return;
1294
- return m.preloadMonacoWorkers();
1291
+ return (_a2 = m.preloadStreamDiffs) == null ? void 0 : _a2.call(m);
1295
1292
  });
1296
1293
  }
1297
1294
  let mod = null;
1298
1295
  let importAttempted = false;
1299
- function warmupShikiTokenizer(m) {
1300
- return __async(this, null, function* () {
1301
- const getOrCreateHighlighter = m == null ? void 0 : m.getOrCreateHighlighter;
1302
- if (typeof getOrCreateHighlighter !== "function")
1303
- return true;
1304
- try {
1305
- const highlighter = yield getOrCreateHighlighter(
1306
- ["vitesse-dark", "vitesse-light"],
1307
- ["plaintext", "text", "javascript"]
1308
- );
1309
- if (highlighter && typeof highlighter.codeToTokens === "function") {
1310
- highlighter.codeToTokens("const a = 1", { lang: "javascript", theme: "vitesse-dark" });
1311
- }
1312
- return true;
1313
- } catch (err) {
1314
- console.warn("[markstream-vue2] Failed to warm up Shiki tokenizer; disabling stream-monaco for this session.", err);
1315
- return false;
1316
- }
1317
- });
1296
+ function normalizeStreamDiffsModule(value) {
1297
+ var _a2, _b, _c;
1298
+ const source = typeof (value == null ? void 0 : value.createCodeBlockRuntime) === "function" || typeof (value == null ? void 0 : value.useMonaco) === "function" ? value : value == null ? void 0 : value.default;
1299
+ const factory = (_a2 = source == null ? void 0 : source.createCodeBlockRuntime) != null ? _a2 : source == null ? void 0 : source.useMonaco;
1300
+ if (typeof factory !== "function")
1301
+ return null;
1302
+ return {
1303
+ createCodeBlockRuntime: (options) => factory.call(source, options),
1304
+ detectLanguage: (_b = source == null ? void 0 : source.detectLanguage) == null ? void 0 : _b.bind(source),
1305
+ preloadStreamDiffs: (_c = source == null ? void 0 : source.preloadStreamDiffs) == null ? void 0 : _c.bind(source)
1306
+ };
1318
1307
  }
1319
- function getUseMonaco() {
1308
+ function getStreamDiffsRuntime() {
1320
1309
  return __async(this, null, function* () {
1321
- var _a2, _b;
1322
1310
  if (mod)
1323
1311
  return mod;
1324
1312
  if (importAttempted)
1325
1313
  return null;
1326
1314
  try {
1327
- const diffs = yield import("./chunks/index-fce73667.js");
1328
- const resolved = (_a2 = diffs == null ? void 0 : diffs.default) != null ? _a2 : diffs;
1329
- if (typeof (resolved == null ? void 0 : resolved.useMonaco) === "function") {
1330
- mod = resolved;
1315
+ const diffs = normalizeStreamDiffsModule(yield import("stream-diffs/markstream"));
1316
+ if (diffs) {
1317
+ mod = diffs;
1331
1318
  yield preload(mod);
1332
- const ok = yield warmupShikiTokenizer(mod);
1333
- if (!ok) {
1334
- mod = null;
1335
- importAttempted = true;
1336
- return null;
1337
- }
1338
1319
  return mod;
1339
1320
  }
1340
1321
  } catch (e) {
1341
1322
  }
1342
- try {
1343
- const imported = yield import("stream-monaco/legacy");
1344
- mod = (_b = imported == null ? void 0 : imported.default) != null ? _b : imported;
1345
- yield preload(mod);
1346
- const ok = yield warmupShikiTokenizer(mod);
1347
- if (!ok) {
1348
- mod = null;
1349
- importAttempted = true;
1350
- return null;
1351
- }
1352
- return mod;
1353
- } catch (e) {
1354
- importAttempted = true;
1355
- return null;
1356
- }
1323
+ importAttempted = true;
1324
+ return null;
1325
+ });
1326
+ }
1327
+ function preloadCodeBlockRuntime() {
1328
+ return __async(this, null, function* () {
1329
+ return Boolean(yield getStreamDiffsRuntime());
1357
1330
  });
1358
1331
  }
1359
1332
  const CIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 4.0559072,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441188,0 l -1.789955,-1.782586 c -1.75742,1.750224 -4.6067879,1.750224 -6.3642294,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642294,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.746003,-2.73472867 -7.1981359,-2.73472867 -9.944119,0 -2.7459858,2.7347089 -2.7459858,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n</svg>\n';
@@ -1489,17 +1462,19 @@ function normalizeLanguageIdentifier(lang) {
1489
1462
  const token = extractLanguageToken(lang);
1490
1463
  return (_a2 = LANGUAGE_ALIAS_MAP[token]) != null ? _a2 : token;
1491
1464
  }
1492
- function resolveMonacoLanguageId(lang) {
1465
+ function resolveLanguageId(lang) {
1493
1466
  const canonical = normalizeLanguageIdentifier(lang);
1494
1467
  if (!canonical)
1495
1468
  return "plaintext";
1496
1469
  switch (canonical) {
1497
1470
  case "plain":
1498
1471
  return "plaintext";
1499
- case "jsx":
1500
- return "javascript";
1501
- case "tsx":
1502
- return "typescript";
1472
+ case "shell":
1473
+ return "zsh";
1474
+ case "objectivec":
1475
+ return "objective-c";
1476
+ case "objectivecpp":
1477
+ return "objective-cpp";
1503
1478
  default:
1504
1479
  return canonical;
1505
1480
  }
@@ -1980,7 +1955,7 @@ function resolveMarkdownInstance(options) {
1980
1955
  function getNodeList(value) {
1981
1956
  return Array.isArray(value) ? value : [];
1982
1957
  }
1983
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
1958
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1984
1959
  __name: "PreCodeNode",
1985
1960
  props: {
1986
1961
  node: null,
@@ -2051,7 +2026,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
2051
2026
  if (props.showLineNumbers !== true || isDiffPreview.value)
2052
2027
  return void 0;
2053
2028
  const maximumLineNumber = codeLineCount.value;
2054
- const width = `${Math.max(4, String(maximumLineNumber).length)}ch`;
2029
+ const width = `${Math.max(2, String(maximumLineNumber).length)}ch`;
2055
2030
  return {
2056
2031
  "--markstream-pre-line-number-width": width,
2057
2032
  "--markstream-code-padding-left": "calc(var(--markstream-pre-line-number-padding-left, 2ch) + var(--markstream-pre-line-number-width, 2ch) + var(--markstream-pre-line-number-padding-right, 1ch) + var(--markstream-pre-line-number-separator-width, 2px) + var(--markstream-pre-line-number-gap-to-code, 1ch))"
@@ -2288,7 +2263,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
2288
2263
  }
2289
2264
  });
2290
2265
  const PreCodeNode_vue_vue_type_style_index_0_lang = "";
2291
- var _sfc_render$B = function render9() {
2266
+ var _sfc_render$A = function render9() {
2292
2267
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2293
2268
  return _c("pre", { class: [
2294
2269
  _setup.languageClass,
@@ -2303,18 +2278,18 @@ var _sfc_render$B = function render9() {
2303
2278
  }), 0);
2304
2279
  }), 0) : [_setup.props.showLineNumbers ? _c("span", { staticClass: "markstream-pre__line-numbers", attrs: { "aria-hidden": "true" } }, [_c("span", { staticClass: "markstream-pre__line-numbers-text", domProps: { "textContent": _vm._s(_setup.lineNumbersText) } })]) : _vm._e(), _c("code", { staticClass: "markstream-pre__code", attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_setup.displayCode) } })]], 2);
2305
2280
  };
2306
- var _sfc_staticRenderFns$B = [];
2307
- var __component__$B = /* @__PURE__ */ normalizeComponent(
2308
- _sfc_main$B,
2309
- _sfc_render$B,
2310
- _sfc_staticRenderFns$B,
2281
+ var _sfc_staticRenderFns$A = [];
2282
+ var __component__$A = /* @__PURE__ */ normalizeComponent(
2283
+ _sfc_main$A,
2284
+ _sfc_render$A,
2285
+ _sfc_staticRenderFns$A,
2311
2286
  false,
2312
2287
  null,
2313
2288
  null,
2314
2289
  null,
2315
2290
  null
2316
2291
  );
2317
- const PreCodeNode = __component__$B.exports;
2292
+ const PreCodeNode = __component__$A.exports;
2318
2293
  function createMathFallbackNode(wrapper) {
2319
2294
  return (props) => {
2320
2295
  var _a2, _b;
@@ -2365,7 +2340,7 @@ function MathBlockNodeAsync() {
2365
2340
  return createMathFallbackNode((content2) => `$$${content2}$$`);
2366
2341
  });
2367
2342
  }
2368
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
2343
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
2369
2344
  __name: "ReferenceNode",
2370
2345
  props: {
2371
2346
  node: null,
@@ -2377,7 +2352,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
2377
2352
  return { __sfc: true };
2378
2353
  }
2379
2354
  });
2380
- var _sfc_render$A = function render10() {
2355
+ var _sfc_render$z = function render10() {
2381
2356
  var _vm = this, _c = _vm._self._c;
2382
2357
  _vm._self._setupProxy;
2383
2358
  return _c("span", { staticClass: "reference-node cursor-pointer bg-[hsl(var(--muted))] text-xs rounded-md px-1.5 mx-0.5 hover:bg-[hsl(var(--secondary))]", attrs: { "role": "button", "tabindex": "0" }, on: { "click": function($event) {
@@ -2388,19 +2363,19 @@ var _sfc_render$A = function render10() {
2388
2363
  return _vm.$emit("mouseLeave", $event, _vm.node.id, _vm.messageId, _vm.threadId);
2389
2364
  } } }, [_vm._v(" " + _vm._s(_vm.node.id) + " ")]);
2390
2365
  };
2391
- var _sfc_staticRenderFns$A = [];
2392
- var __component__$A = /* @__PURE__ */ normalizeComponent(
2393
- _sfc_main$A,
2394
- _sfc_render$A,
2395
- _sfc_staticRenderFns$A,
2366
+ var _sfc_staticRenderFns$z = [];
2367
+ var __component__$z = /* @__PURE__ */ normalizeComponent(
2368
+ _sfc_main$z,
2369
+ _sfc_render$z,
2370
+ _sfc_staticRenderFns$z,
2396
2371
  false,
2397
2372
  null,
2398
2373
  null,
2399
2374
  null,
2400
2375
  null
2401
2376
  );
2402
- const ReferenceNode = __component__$A.exports;
2403
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
2377
+ const ReferenceNode = __component__$z.exports;
2378
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2404
2379
  __name: "SuperscriptNode",
2405
2380
  props: {
2406
2381
  node: null,
@@ -2430,25 +2405,25 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
2430
2405
  }
2431
2406
  });
2432
2407
  const SuperscriptNode_vue_vue_type_style_index_0_scoped_ef2512b4_lang = "";
2433
- var _sfc_render$z = function render11() {
2408
+ var _sfc_render$y = function render11() {
2434
2409
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2435
2410
  return _c("sup", { staticClass: "superscript-node" }, _vm._l(_vm.node.children, function(child, index2) {
2436
2411
  return _c("span", { key: `${_vm.indexKey || "superscript"}-${index2}`, staticClass: "superscript-child" }, [_setup.nodeComponents[child.type] ? _c(_setup.nodeComponents[child.type], { tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "superscript"}-${index2}` } }) : _c("span", [_vm._v(_vm._s(child.content || child.raw || ""))])], 1);
2437
2412
  }), 0);
2438
2413
  };
2439
- var _sfc_staticRenderFns$z = [];
2440
- var __component__$z = /* @__PURE__ */ normalizeComponent(
2441
- _sfc_main$z,
2442
- _sfc_render$z,
2443
- _sfc_staticRenderFns$z,
2414
+ var _sfc_staticRenderFns$y = [];
2415
+ var __component__$y = /* @__PURE__ */ normalizeComponent(
2416
+ _sfc_main$y,
2417
+ _sfc_render$y,
2418
+ _sfc_staticRenderFns$y,
2444
2419
  false,
2445
2420
  null,
2446
2421
  "ef2512b4",
2447
2422
  null,
2448
2423
  null
2449
2424
  );
2450
- const SuperscriptNode = __component__$z.exports;
2451
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
2425
+ const SuperscriptNode = __component__$y.exports;
2426
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2452
2427
  __name: "SubscriptNode",
2453
2428
  props: {
2454
2429
  node: null,
@@ -2478,25 +2453,25 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2478
2453
  }
2479
2454
  });
2480
2455
  const SubscriptNode_vue_vue_type_style_index_0_scoped_3d49d031_lang = "";
2481
- var _sfc_render$y = function render12() {
2456
+ var _sfc_render$x = function render12() {
2482
2457
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2483
2458
  return _c("sub", { staticClass: "subscript-node" }, _vm._l(_vm.node.children, function(child, index2) {
2484
2459
  return _c("span", { key: `${_vm.indexKey || "subscript"}-${index2}`, staticClass: "subscript-child" }, [_setup.nodeComponents[child.type] ? _c(_setup.nodeComponents[child.type], { tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "subscript"}-${index2}` } }) : _c("span", [_vm._v(_vm._s(child.content || child.raw || ""))])], 1);
2485
2460
  }), 0);
2486
2461
  };
2487
- var _sfc_staticRenderFns$y = [];
2488
- var __component__$y = /* @__PURE__ */ normalizeComponent(
2489
- _sfc_main$y,
2490
- _sfc_render$y,
2491
- _sfc_staticRenderFns$y,
2462
+ var _sfc_staticRenderFns$x = [];
2463
+ var __component__$x = /* @__PURE__ */ normalizeComponent(
2464
+ _sfc_main$x,
2465
+ _sfc_render$x,
2466
+ _sfc_staticRenderFns$x,
2492
2467
  false,
2493
2468
  null,
2494
2469
  "3d49d031",
2495
2470
  null,
2496
2471
  null
2497
2472
  );
2498
- const SubscriptNode = __component__$y.exports;
2499
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
2473
+ const SubscriptNode = __component__$x.exports;
2474
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
2500
2475
  __name: "StrongNode",
2501
2476
  props: {
2502
2477
  node: null,
@@ -2526,25 +2501,25 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2526
2501
  }
2527
2502
  });
2528
2503
  const StrongNode_vue_vue_type_style_index_0_scoped_af3ce037_lang = "";
2529
- var _sfc_render$x = function render13() {
2504
+ var _sfc_render$w = function render13() {
2530
2505
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2531
2506
  return _c("strong", { staticClass: "strong-node" }, _vm._l(_vm.node.children, function(child, index2) {
2532
2507
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "strong"}-${index2}`, tag: "component", attrs: { "index-key": `${_vm.indexKey || "strong"}-${index2}`, "node": child, "custom-id": _setup.props.customId } });
2533
2508
  }), 1);
2534
2509
  };
2535
- var _sfc_staticRenderFns$x = [];
2536
- var __component__$x = /* @__PURE__ */ normalizeComponent(
2537
- _sfc_main$x,
2538
- _sfc_render$x,
2539
- _sfc_staticRenderFns$x,
2510
+ var _sfc_staticRenderFns$w = [];
2511
+ var __component__$w = /* @__PURE__ */ normalizeComponent(
2512
+ _sfc_main$w,
2513
+ _sfc_render$w,
2514
+ _sfc_staticRenderFns$w,
2540
2515
  false,
2541
2516
  null,
2542
2517
  "af3ce037",
2543
2518
  null,
2544
2519
  null
2545
2520
  );
2546
- const StrongNode = __component__$x.exports;
2547
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
2521
+ const StrongNode = __component__$w.exports;
2522
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2548
2523
  __name: "StrikethroughNode",
2549
2524
  props: {
2550
2525
  node: null,
@@ -2574,25 +2549,25 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
2574
2549
  }
2575
2550
  });
2576
2551
  const StrikethroughNode_vue_vue_type_style_index_0_scoped_904d5bd1_lang = "";
2577
- var _sfc_render$w = function render14() {
2552
+ var _sfc_render$v = function render14() {
2578
2553
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2579
2554
  return _c("del", { staticClass: "strikethrough-node" }, _vm._l(_vm.node.children, function(child, index2) {
2580
2555
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "strikethrough"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "strikethrough"}-${index2}` } });
2581
2556
  }), 1);
2582
2557
  };
2583
- var _sfc_staticRenderFns$w = [];
2584
- var __component__$w = /* @__PURE__ */ normalizeComponent(
2585
- _sfc_main$w,
2586
- _sfc_render$w,
2587
- _sfc_staticRenderFns$w,
2558
+ var _sfc_staticRenderFns$v = [];
2559
+ var __component__$v = /* @__PURE__ */ normalizeComponent(
2560
+ _sfc_main$v,
2561
+ _sfc_render$v,
2562
+ _sfc_staticRenderFns$v,
2588
2563
  false,
2589
2564
  null,
2590
2565
  "904d5bd1",
2591
2566
  null,
2592
2567
  null
2593
2568
  );
2594
- const StrikethroughNode = __component__$w.exports;
2595
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
2569
+ const StrikethroughNode = __component__$v.exports;
2570
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2596
2571
  __name: "LinkNode",
2597
2572
  props: {
2598
2573
  node: null,
@@ -2774,26 +2749,26 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2774
2749
  }
2775
2750
  });
2776
2751
  const LinkNode_vue_vue_type_style_index_0_scoped_636cac94_lang = "";
2777
- var _sfc_render$v = function render15() {
2752
+ var _sfc_render$u = function render15() {
2778
2753
  var _a2, _b;
2779
2754
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2780
2755
  return !_vm.node.loading ? _c("a", _vm._b({ ref: "anchorEl", staticClass: "link-node", style: _setup.cssVars, attrs: { "href": _setup.safeHref, "title": _vm.showTooltip ? "" : _setup.title, "aria-label": `Link: ${_setup.title}`, "aria-hidden": _vm.node.loading ? "true" : "false", "target": _setup.openInNewTab ? "_blank" : void 0, "rel": _setup.openInNewTab ? "noopener noreferrer" : void 0 }, on: { "mouseenter": (e) => _setup.onAnchorEnter(e), "mouseleave": _setup.onAnchorLeave } }, "a", _setup.anchorAttrs, false), _vm._l(_vm.node.children, function(child, index2) {
2781
2756
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "emphasis"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "link-text"}-${index2}` } });
2782
2757
  }), 1) : _c("span", _vm._b({ staticClass: "link-loading inline-flex items-baseline gap-1.5", style: _setup.cssVars, attrs: { "aria-hidden": !_vm.node.loading ? "true" : "false" } }, "span", _setup.attrs, false), [_c("span", { staticClass: "link-text-wrapper relative inline-flex" }, [_c("span", { staticClass: "leading-[normal] link-text" }, [_c(_setup.TextNode, { staticClass: "leading-[normal] link-text", attrs: { "node": { type: "text", content: String((_a2 = _vm.node.text) != null ? _a2 : ""), raw: String((_b = _vm.node.text) != null ? _b : "") }, "index-key": `${_vm.indexKey || "link-text"}-loading` } })], 1), _c("span", { staticClass: "link-loading-indicator", attrs: { "aria-hidden": "true" } })])]);
2783
2758
  };
2784
- var _sfc_staticRenderFns$v = [];
2785
- var __component__$v = /* @__PURE__ */ normalizeComponent(
2786
- _sfc_main$v,
2787
- _sfc_render$v,
2788
- _sfc_staticRenderFns$v,
2759
+ var _sfc_staticRenderFns$u = [];
2760
+ var __component__$u = /* @__PURE__ */ normalizeComponent(
2761
+ _sfc_main$u,
2762
+ _sfc_render$u,
2763
+ _sfc_staticRenderFns$u,
2789
2764
  false,
2790
2765
  null,
2791
2766
  "636cac94",
2792
2767
  null,
2793
2768
  null
2794
2769
  );
2795
- const LinkNode = __component__$v.exports;
2796
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
2770
+ const LinkNode = __component__$u.exports;
2771
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2797
2772
  __name: "InsertNode",
2798
2773
  props: {
2799
2774
  node: null,
@@ -2823,25 +2798,25 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2823
2798
  }
2824
2799
  });
2825
2800
  const InsertNode_vue_vue_type_style_index_0_scoped_ab1ec9bc_lang = "";
2826
- var _sfc_render$u = function render16() {
2801
+ var _sfc_render$t = function render16() {
2827
2802
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2828
2803
  return _c("ins", { staticClass: "insert-node" }, _vm._l(_vm.node.children, function(child, index2) {
2829
2804
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "insert"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "insert"}-${index2}` } });
2830
2805
  }), 1);
2831
2806
  };
2832
- var _sfc_staticRenderFns$u = [];
2833
- var __component__$u = /* @__PURE__ */ normalizeComponent(
2834
- _sfc_main$u,
2835
- _sfc_render$u,
2836
- _sfc_staticRenderFns$u,
2807
+ var _sfc_staticRenderFns$t = [];
2808
+ var __component__$t = /* @__PURE__ */ normalizeComponent(
2809
+ _sfc_main$t,
2810
+ _sfc_render$t,
2811
+ _sfc_staticRenderFns$t,
2837
2812
  false,
2838
2813
  null,
2839
2814
  "ab1ec9bc",
2840
2815
  null,
2841
2816
  null
2842
2817
  );
2843
- const InsertNode = __component__$u.exports;
2844
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
2818
+ const InsertNode = __component__$t.exports;
2819
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2845
2820
  __name: "HighlightNode",
2846
2821
  props: {
2847
2822
  node: null,
@@ -2871,25 +2846,25 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2871
2846
  }
2872
2847
  });
2873
2848
  const HighlightNode_vue_vue_type_style_index_0_scoped_38e31bf6_lang = "";
2874
- var _sfc_render$t = function render17() {
2849
+ var _sfc_render$s = function render17() {
2875
2850
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2876
2851
  return _c("mark", { staticClass: "highlight-node" }, _vm._l(_vm.node.children, function(child, index2) {
2877
2852
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "highlight"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "highlight"}-${index2}` } });
2878
2853
  }), 1);
2879
2854
  };
2880
- var _sfc_staticRenderFns$t = [];
2881
- var __component__$t = /* @__PURE__ */ normalizeComponent(
2882
- _sfc_main$t,
2883
- _sfc_render$t,
2884
- _sfc_staticRenderFns$t,
2855
+ var _sfc_staticRenderFns$s = [];
2856
+ var __component__$s = /* @__PURE__ */ normalizeComponent(
2857
+ _sfc_main$s,
2858
+ _sfc_render$s,
2859
+ _sfc_staticRenderFns$s,
2885
2860
  false,
2886
2861
  null,
2887
2862
  "38e31bf6",
2888
2863
  null,
2889
2864
  null
2890
2865
  );
2891
- const HighlightNode = __component__$t.exports;
2892
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
2866
+ const HighlightNode = __component__$s.exports;
2867
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2893
2868
  __name: "EmphasisNode",
2894
2869
  props: {
2895
2870
  node: null,
@@ -2919,25 +2894,25 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2919
2894
  }
2920
2895
  });
2921
2896
  const EmphasisNode_vue_vue_type_style_index_0_scoped_8264674d_lang = "";
2922
- var _sfc_render$s = function render18() {
2897
+ var _sfc_render$r = function render18() {
2923
2898
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2924
2899
  return _c("em", { staticClass: "emphasis-node" }, _vm._l(_vm.node.children, function(child, index2) {
2925
2900
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "emphasis"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "emphasis"}-${index2}` } });
2926
2901
  }), 1);
2927
2902
  };
2928
- var _sfc_staticRenderFns$s = [];
2929
- var __component__$s = /* @__PURE__ */ normalizeComponent(
2930
- _sfc_main$s,
2931
- _sfc_render$s,
2932
- _sfc_staticRenderFns$s,
2903
+ var _sfc_staticRenderFns$r = [];
2904
+ var __component__$r = /* @__PURE__ */ normalizeComponent(
2905
+ _sfc_main$r,
2906
+ _sfc_render$r,
2907
+ _sfc_staticRenderFns$r,
2933
2908
  false,
2934
2909
  null,
2935
2910
  "8264674d",
2936
2911
  null,
2937
2912
  null
2938
2913
  );
2939
- const EmphasisNode = __component__$s.exports;
2940
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
2914
+ const EmphasisNode = __component__$r.exports;
2915
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2941
2916
  __name: "FootnoteAnchorNode",
2942
2917
  props: {
2943
2918
  node: null
@@ -2959,23 +2934,23 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2959
2934
  }
2960
2935
  });
2961
2936
  const FootnoteAnchorNode_vue_vue_type_style_index_0_scoped_4a90fe82_lang = "";
2962
- var _sfc_render$r = function render19() {
2937
+ var _sfc_render$q = function render19() {
2963
2938
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2964
2939
  return _c("a", { staticClass: "footnote-anchor text-sm hover:underline cursor-pointer", attrs: { "href": `#fnref-${_vm.node.id}`, "title": `返回引用 ${_vm.node.id}` }, on: { "click": _setup.scrollToReference } }, [_vm._v(" ↩︎ ")]);
2965
2940
  };
2966
- var _sfc_staticRenderFns$r = [];
2967
- var __component__$r = /* @__PURE__ */ normalizeComponent(
2968
- _sfc_main$r,
2969
- _sfc_render$r,
2970
- _sfc_staticRenderFns$r,
2941
+ var _sfc_staticRenderFns$q = [];
2942
+ var __component__$q = /* @__PURE__ */ normalizeComponent(
2943
+ _sfc_main$q,
2944
+ _sfc_render$q,
2945
+ _sfc_staticRenderFns$q,
2971
2946
  false,
2972
2947
  null,
2973
2948
  "4a90fe82",
2974
2949
  null,
2975
2950
  null
2976
2951
  );
2977
- const FootnoteAnchorNode = __component__$r.exports;
2978
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
2952
+ const FootnoteAnchorNode = __component__$q.exports;
2953
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2979
2954
  __name: "FootnoteNode",
2980
2955
  props: {
2981
2956
  node: null,
@@ -2995,25 +2970,25 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2995
2970
  }
2996
2971
  });
2997
2972
  const FootnoteNode_vue_vue_type_style_index_0_lang = "";
2998
- var _sfc_render$q = function render20() {
2973
+ var _sfc_render$p = function render20() {
2999
2974
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3000
2975
  return _c("div", { staticClass: "footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border,#eaecef)] pt-2", attrs: { "id": `fnref--${_vm.node.id}` } }, [_c("div", { staticClass: "flex-1" }, [_c(_setup.nestedRenderer, { tag: "component", attrs: { "index-key": `footnote-${_setup.props.indexKey}`, "nodes": _setup.props.node.children, "custom-id": _setup.props.customId, "typewriter": _setup.props.typewriter }, on: { "copy": function($event) {
3001
2976
  return _vm.$emit("copy", $event);
3002
2977
  } } })], 1)]);
3003
2978
  };
3004
- var _sfc_staticRenderFns$q = [];
3005
- var __component__$q = /* @__PURE__ */ normalizeComponent(
3006
- _sfc_main$q,
3007
- _sfc_render$q,
3008
- _sfc_staticRenderFns$q,
2979
+ var _sfc_staticRenderFns$p = [];
2980
+ var __component__$p = /* @__PURE__ */ normalizeComponent(
2981
+ _sfc_main$p,
2982
+ _sfc_render$p,
2983
+ _sfc_staticRenderFns$p,
3009
2984
  false,
3010
2985
  null,
3011
2986
  null,
3012
2987
  null,
3013
2988
  null
3014
2989
  );
3015
- const FootnoteNode = __component__$q.exports;
3016
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
2990
+ const FootnoteNode = __component__$p.exports;
2991
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3017
2992
  __name: "HardBreakNode",
3018
2993
  props: {
3019
2994
  node: null
@@ -3023,24 +2998,24 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
3023
2998
  }
3024
2999
  });
3025
3000
  const HardBreakNode_vue_vue_type_style_index_0_scoped_50c58f70_lang = "";
3026
- var _sfc_render$p = function render21() {
3001
+ var _sfc_render$o = function render21() {
3027
3002
  var _vm = this, _c = _vm._self._c;
3028
3003
  _vm._self._setupProxy;
3029
3004
  return _c("br", { staticClass: "hard-break" });
3030
3005
  };
3031
- var _sfc_staticRenderFns$p = [];
3032
- var __component__$p = /* @__PURE__ */ normalizeComponent(
3033
- _sfc_main$p,
3034
- _sfc_render$p,
3035
- _sfc_staticRenderFns$p,
3006
+ var _sfc_staticRenderFns$o = [];
3007
+ var __component__$o = /* @__PURE__ */ normalizeComponent(
3008
+ _sfc_main$o,
3009
+ _sfc_render$o,
3010
+ _sfc_staticRenderFns$o,
3036
3011
  false,
3037
3012
  null,
3038
3013
  "50c58f70",
3039
3014
  null,
3040
3015
  null
3041
3016
  );
3042
- const HardBreakNode = __component__$p.exports;
3043
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
3017
+ const HardBreakNode = __component__$o.exports;
3018
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3044
3019
  __name: "HeadingNode",
3045
3020
  props: {
3046
3021
  node: null,
@@ -3074,25 +3049,25 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
3074
3049
  }
3075
3050
  });
3076
3051
  const HeadingNode_vue_vue_type_style_index_0_scoped_ffb7cf51_lang = "";
3077
- var _sfc_render$o = function render22() {
3052
+ var _sfc_render$n = function render22() {
3078
3053
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3079
3054
  return _c(`h${_vm.node.level}`, _vm._b({ tag: "component", staticClass: "heading-node", class: [`heading-${_vm.node.level}`], attrs: { "dir": "auto" } }, "component", _vm.node.attrs, false), _vm._l(_vm.node.children, function(child, index2) {
3080
3055
  return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "heading"}-${index2}`, tag: "component", attrs: { "custom-id": _setup.props.customId, "node": child, "index-key": `${_vm.indexKey || "heading"}-${index2}` } });
3081
3056
  }), 1);
3082
3057
  };
3083
- var _sfc_staticRenderFns$o = [];
3084
- var __component__$o = /* @__PURE__ */ normalizeComponent(
3085
- _sfc_main$o,
3086
- _sfc_render$o,
3087
- _sfc_staticRenderFns$o,
3058
+ var _sfc_staticRenderFns$n = [];
3059
+ var __component__$n = /* @__PURE__ */ normalizeComponent(
3060
+ _sfc_main$n,
3061
+ _sfc_render$n,
3062
+ _sfc_staticRenderFns$n,
3088
3063
  false,
3089
3064
  null,
3090
3065
  "ffb7cf51",
3091
3066
  null,
3092
3067
  null
3093
3068
  );
3094
- const HeadingNode = __component__$o.exports;
3095
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
3069
+ const HeadingNode = __component__$n.exports;
3070
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
3096
3071
  __name: "ListItemNode",
3097
3072
  props: {
3098
3073
  node: null,
@@ -3119,26 +3094,26 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
3119
3094
  }
3120
3095
  });
3121
3096
  const ListItemNode_vue_vue_type_style_index_0_scoped_5c58ad56_lang = "";
3122
- var _sfc_render$n = function render23() {
3097
+ var _sfc_render$m = function render23() {
3123
3098
  var _a2, _b;
3124
3099
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3125
3100
  return _c("li", _vm._b({ staticClass: "list-item pl-1.5 my-2", attrs: { "dir": "auto" } }, "li", _setup.liValueAttr, false), [_c(_setup.nestedRenderer, _vm._b({ tag: "component", attrs: { "index-key": `list-item-${_setup.props.indexKey}`, "nodes": (_b = (_a2 = _setup.itemNode) == null ? void 0 : _a2.children) != null ? _b : [], "custom-id": _setup.props.customId, "typewriter": _setup.props.typewriter, "batch-rendering": false }, on: { "copy": function($event) {
3126
3101
  return _vm.$emit("copy", $event);
3127
3102
  } } }, "component", { showTooltips: _setup.props.showTooltips }, false))], 1);
3128
3103
  };
3129
- var _sfc_staticRenderFns$n = [];
3130
- var __component__$n = /* @__PURE__ */ normalizeComponent(
3131
- _sfc_main$n,
3132
- _sfc_render$n,
3133
- _sfc_staticRenderFns$n,
3104
+ var _sfc_staticRenderFns$m = [];
3105
+ var __component__$m = /* @__PURE__ */ normalizeComponent(
3106
+ _sfc_main$m,
3107
+ _sfc_render$m,
3108
+ _sfc_staticRenderFns$m,
3134
3109
  false,
3135
3110
  null,
3136
3111
  "5c58ad56",
3137
3112
  null,
3138
3113
  null
3139
3114
  );
3140
- const ListItemNode = __component__$n.exports;
3141
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
3115
+ const ListItemNode = __component__$m.exports;
3116
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
3142
3117
  __name: "ListNode",
3143
3118
  props: {
3144
3119
  node: null,
@@ -3159,7 +3134,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
3159
3134
  }
3160
3135
  });
3161
3136
  const ListNode_vue_vue_type_style_index_0_scoped_91e6dafc_lang = "";
3162
- var _sfc_render$m = function render24() {
3137
+ var _sfc_render$l = function render24() {
3163
3138
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3164
3139
  return _c(_vm.node.ordered ? "ol" : "ul", { tag: "component", staticClass: "list-node", class: { "list-decimal": _vm.node.ordered, "list-disc": !_vm.node.ordered } }, _vm._l(_vm.node.items, function(item, index2) {
3165
3140
  var _a2;
@@ -3168,18 +3143,18 @@ var _sfc_render$m = function render24() {
3168
3143
  } } }, "component", { showTooltips: _vm.showTooltips }, false));
3169
3144
  }), 1);
3170
3145
  };
3171
- var _sfc_staticRenderFns$m = [];
3172
- var __component__$m = /* @__PURE__ */ normalizeComponent(
3173
- _sfc_main$m,
3174
- _sfc_render$m,
3175
- _sfc_staticRenderFns$m,
3146
+ var _sfc_staticRenderFns$l = [];
3147
+ var __component__$l = /* @__PURE__ */ normalizeComponent(
3148
+ _sfc_main$l,
3149
+ _sfc_render$l,
3150
+ _sfc_staticRenderFns$l,
3176
3151
  false,
3177
3152
  null,
3178
3153
  "91e6dafc",
3179
3154
  null,
3180
3155
  null
3181
3156
  );
3182
- const ListNode = __component__$m.exports;
3157
+ const ListNode = __component__$l.exports;
3183
3158
  const ViewportPriorityKey = Symbol("ViewportPriority");
3184
3159
  function provideViewportPriority(getRootEl, enabled) {
3185
3160
  var _a2, _b;
@@ -3433,7 +3408,7 @@ function useViewportPriority() {
3433
3408
  };
3434
3409
  return register;
3435
3410
  }
3436
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
3411
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3437
3412
  __name: "HtmlBlockNode",
3438
3413
  props: {
3439
3414
  node: null,
@@ -3560,7 +3535,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
3560
3535
  }
3561
3536
  });
3562
3537
  const HtmlBlockNode_vue_vue_type_style_index_0_scoped_83cd7b66_lang = "";
3563
- var _sfc_render$l = function render25() {
3538
+ var _sfc_render$k = function render25() {
3564
3539
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3565
3540
  return _setup.renderMode.mode === "structured" && _setup.shouldRender ? _c(_setup.structuredTag, _vm._b({ ref: "htmlRef", tag: "component", staticClass: "html-block-node", domProps: { "innerHTML": _vm._s(_setup.structuredHtml) } }, "component", _setup.structuredBoundAttrs, false)) : _setup.renderMode.mode === "structured" ? _c(_setup.structuredTag, _vm._b({ ref: "htmlRef", tag: "component", staticClass: "html-block-node" }, "component", _setup.structuredBoundAttrs, false), [_c("div", { staticClass: "html-block-node__placeholder" }, [_vm._t("placeholder", function() {
3566
3541
  return [_c("span", { staticClass: "html-block-node__placeholder-bar" }), _c("span", { staticClass: "html-block-node__placeholder-bar w-4/5" }), _c("span", { staticClass: "html-block-node__placeholder-bar w-2/3" })];
@@ -3568,19 +3543,19 @@ var _sfc_render$l = function render25() {
3568
3543
  return [_c("span", { staticClass: "html-block-node__placeholder-bar" }), _c("span", { staticClass: "html-block-node__placeholder-bar w-4/5" }), _c("span", { staticClass: "html-block-node__placeholder-bar w-2/3" })];
3569
3544
  }, { "node": _vm.node })], 2)], 2);
3570
3545
  };
3571
- var _sfc_staticRenderFns$l = [];
3572
- var __component__$l = /* @__PURE__ */ normalizeComponent(
3573
- _sfc_main$l,
3574
- _sfc_render$l,
3575
- _sfc_staticRenderFns$l,
3546
+ var _sfc_staticRenderFns$k = [];
3547
+ var __component__$k = /* @__PURE__ */ normalizeComponent(
3548
+ _sfc_main$k,
3549
+ _sfc_render$k,
3550
+ _sfc_staticRenderFns$k,
3576
3551
  false,
3577
3552
  null,
3578
3553
  "83cd7b66",
3579
3554
  null,
3580
3555
  null
3581
3556
  );
3582
- const HtmlBlockNode = __component__$l.exports;
3583
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
3557
+ const HtmlBlockNode = __component__$k.exports;
3558
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3584
3559
  __name: "ParagraphNode",
3585
3560
  props: {
3586
3561
  node: null,
@@ -3689,25 +3664,25 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3689
3664
  }
3690
3665
  });
3691
3666
  const ParagraphNode_vue_vue_type_style_index_0_scoped_3275cbf4_lang = "";
3692
- var _sfc_render$k = function render26() {
3667
+ var _sfc_render$j = function render26() {
3693
3668
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3694
3669
  return _c("p", { staticClass: "paragraph-node", attrs: { "dir": "auto" } }, [_vm._l(_setup.renderedChildren, function(child, index2) {
3695
3670
  return [_setup.isMediaOnlyParagraph && _setup.isWhitespaceText(child) ? [_vm._v(" " + _vm._s(_setup.getTextContent(child)) + " ")] : _c(_setup.processChild(child).component, _vm._b({ key: `${_vm.indexKey || "paragraph"}-${index2}`, tag: "component" }, "component", _setup.getChildProps(_setup.processChild(child).child, index2), false))];
3696
3671
  })], 2);
3697
3672
  };
3698
- var _sfc_staticRenderFns$k = [];
3699
- var __component__$k = /* @__PURE__ */ normalizeComponent(
3700
- _sfc_main$k,
3701
- _sfc_render$k,
3702
- _sfc_staticRenderFns$k,
3673
+ var _sfc_staticRenderFns$j = [];
3674
+ var __component__$j = /* @__PURE__ */ normalizeComponent(
3675
+ _sfc_main$j,
3676
+ _sfc_render$j,
3677
+ _sfc_staticRenderFns$j,
3703
3678
  false,
3704
3679
  null,
3705
3680
  "3275cbf4",
3706
3681
  null,
3707
3682
  null
3708
3683
  );
3709
- const ParagraphNode = __component__$k.exports;
3710
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
3684
+ const ParagraphNode = __component__$j.exports;
3685
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3711
3686
  __name: "TableNode",
3712
3687
  props: {
3713
3688
  node: null,
@@ -3801,7 +3776,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3801
3776
  }
3802
3777
  });
3803
3778
  const TableNode_vue_vue_type_style_index_0_scoped_11208a21_lang = "";
3804
- var _sfc_render$j = function render27() {
3779
+ var _sfc_render$i = function render27() {
3805
3780
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3806
3781
  return _c("div", { staticClass: "table-node-wrapper" }, [_c("table", { ref: "tableRef", staticClass: "my-8 text-sm table-node", class: { "table-node--loading": _setup.isLoading }, attrs: { "aria-busy": _setup.isLoading } }, [_setup.hasColumnWidths ? _c("colgroup", _vm._l(_vm.node.header.cells, function(_, index2) {
3807
3782
  return _c("col", { key: `col-${index2}`, style: _setup.columnStyles[index2] });
@@ -3825,43 +3800,43 @@ var _sfc_render$j = function render27() {
3825
3800
  return [_c("span", { staticClass: "table-node__spinner animate-spin", attrs: { "aria-hidden": "true" } }), _c("span", { staticClass: "sr-only" }, [_vm._v("Loading")])];
3826
3801
  }, { "isLoading": _setup.isLoading })], 2) : _vm._e()])], 1);
3827
3802
  };
3828
- var _sfc_staticRenderFns$j = [];
3829
- var __component__$j = /* @__PURE__ */ normalizeComponent(
3830
- _sfc_main$j,
3831
- _sfc_render$j,
3832
- _sfc_staticRenderFns$j,
3803
+ var _sfc_staticRenderFns$i = [];
3804
+ var __component__$i = /* @__PURE__ */ normalizeComponent(
3805
+ _sfc_main$i,
3806
+ _sfc_render$i,
3807
+ _sfc_staticRenderFns$i,
3833
3808
  false,
3834
3809
  null,
3835
3810
  "11208a21",
3836
3811
  null,
3837
3812
  null
3838
3813
  );
3839
- const TableNode = __component__$j.exports;
3840
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
3814
+ const TableNode = __component__$i.exports;
3815
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3841
3816
  __name: "ThematicBreakNode",
3842
3817
  setup(__props) {
3843
3818
  return { __sfc: true };
3844
3819
  }
3845
3820
  });
3846
3821
  const ThematicBreakNode_vue_vue_type_style_index_0_scoped_639cbad9_lang = "";
3847
- var _sfc_render$i = function render28() {
3822
+ var _sfc_render$h = function render28() {
3848
3823
  var _vm = this, _c = _vm._self._c;
3849
3824
  _vm._self._setupProxy;
3850
3825
  return _c("hr", { staticClass: "hr-node" });
3851
3826
  };
3852
- var _sfc_staticRenderFns$i = [];
3853
- var __component__$i = /* @__PURE__ */ normalizeComponent(
3854
- _sfc_main$i,
3855
- _sfc_render$i,
3856
- _sfc_staticRenderFns$i,
3827
+ var _sfc_staticRenderFns$h = [];
3828
+ var __component__$h = /* @__PURE__ */ normalizeComponent(
3829
+ _sfc_main$h,
3830
+ _sfc_render$h,
3831
+ _sfc_staticRenderFns$h,
3857
3832
  false,
3858
3833
  null,
3859
3834
  "639cbad9",
3860
3835
  null,
3861
3836
  null
3862
3837
  );
3863
- const ThematicBreakNode = __component__$i.exports;
3864
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
3838
+ const ThematicBreakNode = __component__$h.exports;
3839
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3865
3840
  __name: "FallbackComponent",
3866
3841
  props: {
3867
3842
  node: null
@@ -3871,24 +3846,24 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3871
3846
  }
3872
3847
  });
3873
3848
  const FallbackComponent_vue_vue_type_style_index_0_scoped_89aff01f_lang = "";
3874
- var _sfc_render$h = function render29() {
3849
+ var _sfc_render$g = function render29() {
3875
3850
  var _vm = this, _c = _vm._self._c;
3876
3851
  _vm._self._setupProxy;
3877
3852
  return _c("div", { staticClass: "unknown-node" }, [_vm._v(" " + _vm._s(_vm.node.raw) + " ")]);
3878
3853
  };
3879
- var _sfc_staticRenderFns$h = [];
3880
- var __component__$h = /* @__PURE__ */ normalizeComponent(
3881
- _sfc_main$h,
3882
- _sfc_render$h,
3883
- _sfc_staticRenderFns$h,
3854
+ var _sfc_staticRenderFns$g = [];
3855
+ var __component__$g = /* @__PURE__ */ normalizeComponent(
3856
+ _sfc_main$g,
3857
+ _sfc_render$g,
3858
+ _sfc_staticRenderFns$g,
3884
3859
  false,
3885
3860
  null,
3886
3861
  "89aff01f",
3887
3862
  null,
3888
3863
  null
3889
3864
  );
3890
- const FallbackComponent = __component__$h.exports;
3891
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
3865
+ const FallbackComponent = __component__$g.exports;
3866
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3892
3867
  __name: "VmrContainerNode",
3893
3868
  props: {
3894
3869
  node: null,
@@ -3931,24 +3906,24 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3931
3906
  }
3932
3907
  });
3933
3908
  const VmrContainerNode_vue_vue_type_style_index_0_scoped_3cd2aff2_lang = "";
3934
- var _sfc_render$g = function render30() {
3909
+ var _sfc_render$f = function render30() {
3935
3910
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3936
3911
  return _c("div", _vm._b({ class: _setup.containerClass }, "div", _vm.node.attrs, false), _vm._l(_vm.node.children, function(child, index2) {
3937
3912
  return _c(_setup.getNodeComponent(child.type), { key: `${_vm.indexKey || "vmr-container"}-${index2}`, tag: "component", attrs: { "custom-id": _setup.props.customId, "node": child, "index-key": `${_vm.indexKey || "vmr-container"}-${index2}` } });
3938
3913
  }), 1);
3939
3914
  };
3940
- var _sfc_staticRenderFns$g = [];
3941
- var __component__$g = /* @__PURE__ */ normalizeComponent(
3942
- _sfc_main$g,
3943
- _sfc_render$g,
3944
- _sfc_staticRenderFns$g,
3915
+ var _sfc_staticRenderFns$f = [];
3916
+ var __component__$f = /* @__PURE__ */ normalizeComponent(
3917
+ _sfc_main$f,
3918
+ _sfc_render$f,
3919
+ _sfc_staticRenderFns$f,
3945
3920
  false,
3946
3921
  null,
3947
3922
  "3cd2aff2",
3948
3923
  null,
3949
3924
  null
3950
3925
  );
3951
- const VmrContainerNode = __component__$g.exports;
3926
+ const VmrContainerNode = __component__$f.exports;
3952
3927
  const RESERVED_CODE_BLOCK_EXTRA_PROPS = /* @__PURE__ */ new Set([
3953
3928
  "node",
3954
3929
  "key",
@@ -3976,7 +3951,7 @@ function getCodeBlockExtraProps(source, options = {}) {
3976
3951
  }
3977
3952
  return extraProps;
3978
3953
  }
3979
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
3954
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3980
3955
  __name: "LegacyNodesRenderer",
3981
3956
  props: {
3982
3957
  nodes: null,
@@ -3988,13 +3963,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3988
3963
  codeBlockStream: { type: Boolean, default: true },
3989
3964
  codeBlockDarkTheme: null,
3990
3965
  codeBlockLightTheme: null,
3991
- codeBlockMonacoOptions: null,
3992
3966
  codeBlockMinWidth: null,
3993
3967
  codeBlockMaxWidth: null,
3968
+ codeBlockOptions: null,
3994
3969
  codeBlockProps: null,
3995
3970
  renderCodeBlocksAsPre: { type: Boolean },
3996
3971
  themes: null,
3997
- langs: null,
3998
3972
  isDark: { type: Boolean },
3999
3973
  customHtmlTags: null,
4000
3974
  htmlPolicy: null
@@ -4062,21 +4036,25 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4062
4036
  });
4063
4037
  const indexPrefix = computed(() => props.indexKey != null ? String(props.indexKey) : "legacy-renderer");
4064
4038
  const codeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
4065
- const builtinCodeBlockExtraProps = computed(
4066
- () => getCodeBlockExtraProps(props.codeBlockProps, { omit: ["langs"] })
4067
- );
4068
- const codeBlockBindings = computed(() => __spreadValues({
4069
- stream: props.codeBlockStream,
4070
- darkTheme: props.codeBlockDarkTheme,
4071
- lightTheme: props.codeBlockLightTheme,
4072
- monacoOptions: props.codeBlockMonacoOptions,
4073
- themes: props.themes,
4074
- minWidth: props.codeBlockMinWidth,
4075
- maxWidth: props.codeBlockMaxWidth
4076
- }, builtinCodeBlockExtraProps.value));
4077
- const customCodeBlockBindings = computed(() => __spreadValues(__spreadProps(__spreadValues({}, codeBlockBindings.value), {
4078
- langs: props.langs
4079
- }), codeBlockExtraProps.value));
4039
+ const builtinCodeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
4040
+ const codeBlockBindings = computed(() => {
4041
+ var _a2, _b;
4042
+ return __spreadProps(__spreadValues(__spreadProps(__spreadValues({
4043
+ stream: props.codeBlockStream,
4044
+ darkTheme: props.codeBlockDarkTheme,
4045
+ lightTheme: props.codeBlockLightTheme,
4046
+ themes: props.themes,
4047
+ minWidth: props.codeBlockMinWidth,
4048
+ maxWidth: props.codeBlockMaxWidth
4049
+ }, builtinCodeBlockExtraProps.value), {
4050
+ showLineNumbers: typeof builtinCodeBlockExtraProps.value.showLineNumbers === "boolean" ? builtinCodeBlockExtraProps.value.showLineNumbers : typeof ((_a2 = props.codeBlockOptions) == null ? void 0 : _a2.disableLineNumbers) === "boolean" ? !props.codeBlockOptions.disableLineNumbers : false
4051
+ }), ((_b = props.codeBlockOptions) == null ? void 0 : _b.overflow) ? { style: { whiteSpace: props.codeBlockOptions.overflow === "scroll" ? "pre" : "pre-wrap" } } : {}), {
4052
+ codeBlockOptions: props.codeBlockOptions
4053
+ });
4054
+ });
4055
+ const customCodeBlockBindings = computed(() => __spreadProps(__spreadValues(__spreadValues({}, codeBlockBindings.value), codeBlockExtraProps.value), {
4056
+ codeBlockOptions: props.codeBlockOptions
4057
+ }));
4080
4058
  const nonCodeBindings = computed(() => {
4081
4059
  var _a2;
4082
4060
  return { typewriter: props.typewriter, fade: props.fade, htmlPolicy: (_a2 = props.htmlPolicy) != null ? _a2 : "safe" };
@@ -4131,7 +4109,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4131
4109
  return {
4132
4110
  index: index2,
4133
4111
  indexKey: `${indexPrefix.value}-${index2}`,
4134
- // Keep code blocks mounted during streaming so Shiki/Monaco renderers can
4112
+ // Keep code blocks mounted during streaming so Shiki/stream-diffs renderers can
4135
4113
  // preserve their last successful DOM instead of flashing back to <pre>.
4136
4114
  renderKey: type === "code_block" ? `${indexPrefix.value}-${index2}-${type}` : `${indexPrefix.value}-${index2}-${type}-${String((rawNode == null ? void 0 : rawNode.raw) || "").length}`,
4137
4115
  node,
@@ -4217,25 +4195,25 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
4217
4195
  return { __sfc: true, props, emit, isNativeDomEvent, handleCopy, handleArtifactClick, nodeComponents, customComponentsMap, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getCustomCodeLanguageComponent, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleClick };
4218
4196
  }
4219
4197
  });
4220
- var _sfc_render$f = function render31() {
4198
+ var _sfc_render$e = function render31() {
4221
4199
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
4222
4200
  return _c("div", { staticClass: "markstream-vue2 markdown-renderer legacy-nodes-renderer", class: { dark: _setup.props.isDark }, on: { "click": _setup.handleClick } }, _vm._l(_setup.renderedItems, function(item) {
4223
4201
  return _c("div", { key: item.renderKey, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_c("div", { staticClass: "node-content" }, [_c(item.component, _vm._b({ key: `${item.renderKey}-component`, tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": _setup.handleCopy, "handle-artifact-click": _setup.handleArtifactClick } }, "component", item.bindings, false))], 1)]);
4224
4202
  }), 0);
4225
4203
  };
4226
- var _sfc_staticRenderFns$f = [];
4227
- var __component__$f = /* @__PURE__ */ normalizeComponent(
4228
- _sfc_main$f,
4229
- _sfc_render$f,
4230
- _sfc_staticRenderFns$f,
4204
+ var _sfc_staticRenderFns$e = [];
4205
+ var __component__$e = /* @__PURE__ */ normalizeComponent(
4206
+ _sfc_main$e,
4207
+ _sfc_render$e,
4208
+ _sfc_staticRenderFns$e,
4231
4209
  false,
4232
4210
  null,
4233
4211
  null,
4234
4212
  null,
4235
4213
  null
4236
4214
  );
4237
- const LegacyNodesRenderer = __component__$f.exports;
4238
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
4215
+ const LegacyNodesRenderer = __component__$e.exports;
4216
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4239
4217
  __name: "BlockquoteNode",
4240
4218
  props: {
4241
4219
  node: null,
@@ -4254,24 +4232,24 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
4254
4232
  }
4255
4233
  });
4256
4234
  const BlockquoteNode_vue_vue_type_style_index_0_scoped_0bfb818f_lang = "";
4257
- var _sfc_render$e = function render32() {
4235
+ var _sfc_render$d = function render32() {
4258
4236
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
4259
4237
  return _c("blockquote", { staticClass: "blockquote", attrs: { "dir": "auto", "cite": _vm.node.cite } }, [_c(_setup.nestedRenderer, { tag: "component", attrs: { "index-key": `blockquote-${_setup.props.indexKey}`, "nodes": _setup.props.node.children || [], "custom-id": _setup.props.customId, "typewriter": _setup.props.typewriter }, on: { "copy": function($event) {
4260
4238
  return _vm.$emit("copy", $event);
4261
4239
  } } })], 1);
4262
4240
  };
4263
- var _sfc_staticRenderFns$e = [];
4264
- var __component__$e = /* @__PURE__ */ normalizeComponent(
4265
- _sfc_main$e,
4266
- _sfc_render$e,
4267
- _sfc_staticRenderFns$e,
4241
+ var _sfc_staticRenderFns$d = [];
4242
+ var __component__$d = /* @__PURE__ */ normalizeComponent(
4243
+ _sfc_main$d,
4244
+ _sfc_render$d,
4245
+ _sfc_staticRenderFns$d,
4268
4246
  false,
4269
4247
  null,
4270
4248
  "0bfb818f",
4271
4249
  null,
4272
4250
  null
4273
4251
  );
4274
- const BlockquoteNode = __component__$e.exports;
4252
+ const BlockquoteNode = __component__$d.exports;
4275
4253
  function safeRaf(cb) {
4276
4254
  try {
4277
4255
  if (typeof globalThis !== "undefined" && typeof globalThis.requestAnimationFrame === "function")
@@ -4296,7 +4274,7 @@ function safeCancelRaf(id) {
4296
4274
  } catch (e) {
4297
4275
  }
4298
4276
  }
4299
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
4277
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4300
4278
  __name: "Portal",
4301
4279
  props: {
4302
4280
  to: null
@@ -4334,24 +4312,24 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4334
4312
  }
4335
4313
  });
4336
4314
  const Portal_vue_vue_type_style_index_0_scoped_5b7455c5_lang = "";
4337
- var _sfc_render$d = function render33() {
4315
+ var _sfc_render$c = function render33() {
4338
4316
  var _vm = this, _c = _vm._self._c;
4339
4317
  _vm._self._setupProxy;
4340
4318
  return _c("div", { ref: "rootRef", staticClass: "portal-root" }, [_vm._t("default")], 2);
4341
4319
  };
4342
- var _sfc_staticRenderFns$d = [];
4343
- var __component__$d = /* @__PURE__ */ normalizeComponent(
4344
- _sfc_main$d,
4345
- _sfc_render$d,
4346
- _sfc_staticRenderFns$d,
4320
+ var _sfc_staticRenderFns$c = [];
4321
+ var __component__$c = /* @__PURE__ */ normalizeComponent(
4322
+ _sfc_main$c,
4323
+ _sfc_render$c,
4324
+ _sfc_staticRenderFns$c,
4347
4325
  false,
4348
4326
  null,
4349
4327
  "5b7455c5",
4350
4328
  null,
4351
4329
  null
4352
4330
  );
4353
- const Portal = __component__$d.exports;
4354
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
4331
+ const Portal = __component__$c.exports;
4332
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4355
4333
  __name: "HtmlPreviewFrame",
4356
4334
  props: {
4357
4335
  code: null,
@@ -4440,7 +4418,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4440
4418
  }
4441
4419
  });
4442
4420
  const HtmlPreviewFrame_vue_vue_type_style_index_0_scoped_56f5a269_lang = "";
4443
- var _sfc_render$c = function render34() {
4421
+ var _sfc_render$b = function render34() {
4444
4422
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
4445
4423
  return _c(_setup.Portal, { attrs: { "to": "body" } }, [_c("div", { staticClass: "markstream-vue2" }, [_c("div", { staticClass: "html-preview-frame__backdrop", class: { "html-preview-frame__backdrop--dark": _setup.props.isDark }, on: { "click": function($event) {
4446
4424
  var _a2, _b;
@@ -4452,91 +4430,31 @@ var _sfc_render$c = function render34() {
4452
4430
  (_b = (_a2 = _setup.props).onClose) == null ? void 0 : _b.call(_a2);
4453
4431
  } } }, [_vm._v(" × ")])]), _c("iframe", { staticClass: "html-preview-frame__iframe", attrs: { "sandbox": _setup.sandboxValue, "referrerpolicy": "no-referrer", "srcdoc": _setup.srcdoc } })])])])]);
4454
4432
  };
4455
- var _sfc_staticRenderFns$c = [];
4456
- var __component__$c = /* @__PURE__ */ normalizeComponent(
4457
- _sfc_main$c,
4458
- _sfc_render$c,
4459
- _sfc_staticRenderFns$c,
4433
+ var _sfc_staticRenderFns$b = [];
4434
+ var __component__$b = /* @__PURE__ */ normalizeComponent(
4435
+ _sfc_main$b,
4436
+ _sfc_render$b,
4437
+ _sfc_staticRenderFns$b,
4460
4438
  false,
4461
4439
  null,
4462
4440
  "56f5a269",
4463
4441
  null,
4464
4442
  null
4465
4443
  );
4466
- const HtmlPreviewFrame = __component__$c.exports;
4467
- let applyPromise = null;
4468
- let pendingTheme = null;
4469
- let pendingKey = null;
4470
- let lastAppliedKey = null;
4471
- let currentSetTheme = null;
4472
- const themeKeyCache = /* @__PURE__ */ new WeakMap();
4473
- let themeKeySeq = 0;
4474
- function getThemeKey(theme) {
4475
- if (theme == null)
4476
- return null;
4477
- if (typeof theme === "string")
4478
- return theme;
4479
- if (typeof theme === "object" && theme && "name" in theme)
4480
- return String(theme.name);
4481
- if (typeof theme === "object") {
4482
- const cached = themeKeyCache.get(theme);
4483
- if (cached)
4484
- return cached;
4485
- try {
4486
- const str = JSON.stringify(theme);
4487
- if (str) {
4488
- themeKeyCache.set(theme, str);
4489
- return str;
4490
- }
4491
- } catch (e) {
4492
- }
4493
- const id = `__theme_${++themeKeySeq}`;
4494
- themeKeyCache.set(theme, id);
4495
- return id;
4496
- }
4497
- return String(theme);
4498
- }
4499
- function scheduleGlobalMonacoTheme(setTheme, theme) {
4500
- const key = getThemeKey(theme);
4501
- if (!key)
4502
- return Promise.resolve();
4503
- currentSetTheme = setTheme;
4504
- if (!applyPromise && lastAppliedKey === key)
4505
- return Promise.resolve();
4506
- pendingTheme = theme;
4507
- pendingKey = key;
4508
- if (applyPromise)
4509
- return applyPromise;
4510
- applyPromise = (() => __async(this, null, function* () {
4511
- while (pendingKey && pendingTheme != null) {
4512
- const nextTheme = pendingTheme;
4513
- const nextKey = pendingKey;
4514
- pendingTheme = null;
4515
- pendingKey = null;
4516
- if (lastAppliedKey === nextKey)
4517
- continue;
4518
- try {
4519
- yield (currentSetTheme != null ? currentSetTheme : setTheme)(nextTheme);
4520
- lastAppliedKey = nextKey;
4521
- } catch (e) {
4522
- }
4523
- }
4524
- }))().finally(() => {
4525
- applyPromise = null;
4526
- });
4527
- return applyPromise;
4528
- }
4529
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
4444
+ const HtmlPreviewFrame = __component__$b.exports;
4445
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4530
4446
  __name: "CodeBlockNode",
4531
4447
  props: {
4532
4448
  node: { type: Object, required: true },
4533
4449
  isDark: { type: Boolean, default: false },
4534
4450
  loading: { type: Boolean, default: true },
4535
4451
  stream: { type: Boolean, default: true },
4536
- darkTheme: { type: [Object, String], default: void 0 },
4537
- lightTheme: { type: [Object, String], default: void 0 },
4452
+ codeBlockOptions: { type: Object, default: void 0 },
4453
+ showLineNumbers: { type: Boolean, default: void 0 },
4454
+ theme: { type: [Object, String], default: void 0 },
4455
+ darkTheme: { type: String, default: void 0 },
4456
+ lightTheme: { type: String, default: void 0 },
4538
4457
  isShowPreview: { type: Boolean, default: true },
4539
- monacoOptions: { type: Object, default: void 0 },
4540
4458
  enableFontSizeControl: { type: Boolean, default: true },
4541
4459
  minWidth: { type: [String, Number], default: void 0 },
4542
4460
  maxWidth: { type: [String, Number], default: void 0 },
@@ -4560,52 +4478,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4560
4478
  setup(__props, { emit: emits }) {
4561
4479
  var _a2, _b;
4562
4480
  const props = __props;
4563
- const MONACO_TOUCH_PATCH_FLAG = "__markstreamMonacoPassiveTouch__";
4564
- if (typeof window !== "undefined")
4565
- ensureMonacoPassiveTouchListeners();
4566
- function ensureMonacoPassiveTouchListeners() {
4567
- var _a3;
4568
- try {
4569
- const globalObj = window;
4570
- if (globalObj[MONACO_TOUCH_PATCH_FLAG])
4571
- return;
4572
- const proto = (_a3 = window.Element) == null ? void 0 : _a3.prototype;
4573
- const nativeAdd = proto == null ? void 0 : proto.addEventListener;
4574
- if (!proto || !nativeAdd)
4575
- return;
4576
- proto.addEventListener = function patchedMonacoTouchStart(type, listener, options) {
4577
- if (type === "touchstart" && shouldForcePassiveForMonaco(this, options))
4578
- return nativeAdd.call(this, type, listener, withPassiveOptions(options));
4579
- return nativeAdd.call(this, type, listener, options);
4580
- };
4581
- globalObj[MONACO_TOUCH_PATCH_FLAG] = true;
4582
- } catch (e) {
4583
- }
4584
- }
4585
- function shouldForcePassiveForMonaco(target, options) {
4586
- if (!target)
4587
- return false;
4588
- const el = target;
4589
- if (typeof el.closest !== "function")
4590
- return false;
4591
- if (!el.closest(".monaco-editor, .monaco-diff-editor"))
4592
- return false;
4593
- if (options && typeof options === "object" && "passive" in options)
4594
- return false;
4595
- return true;
4596
- }
4597
- function withPassiveOptions(options) {
4598
- if (options == null)
4599
- return { passive: true };
4600
- if (typeof options === "boolean")
4601
- return { capture: options, passive: true };
4602
- if (typeof options === "object") {
4603
- if ("passive" in options)
4604
- return options;
4605
- return __spreadProps(__spreadValues({}, options), { passive: true });
4606
- }
4607
- return { passive: true };
4608
- }
4609
4481
  const instance = getCurrentInstance();
4610
4482
  const hasPreviewListener = computed(() => {
4611
4483
  var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
@@ -4624,13 +4496,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4624
4496
  const container = ref(null);
4625
4497
  const copyText = ref(false);
4626
4498
  const codeLanguage = ref(normalizeLanguageIdentifier(props.node.language));
4627
- const monacoLanguage = computed(() => resolveMonacoLanguageId(codeLanguage.value));
4628
- const isPlainTextLanguage = computed(() => monacoLanguage.value === "plaintext");
4499
+ const languageId = computed(() => resolveLanguageId(codeLanguage.value));
4500
+ const isPlainTextLanguage = computed(() => languageId.value === "plaintext");
4629
4501
  const isExpanded = ref(false);
4630
4502
  const isCollapsed = ref(false);
4631
4503
  const editorCreated = ref(false);
4632
4504
  const editorReady = ref(false);
4633
- const monacoReady = ref(false);
4505
+ const runtimeReady = ref(false);
4634
4506
  let expandRafId = null;
4635
4507
  const heightBeforeCollapse = ref(null);
4636
4508
  let resumeGuardFrames = 0;
@@ -4679,6 +4551,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4679
4551
  let refreshDiffPresentation = () => {
4680
4552
  };
4681
4553
  let createEditorPromise = null;
4554
+ let editorCreationGeneration = 0;
4682
4555
  let detectLanguage = () => {
4683
4556
  var _a3;
4684
4557
  return String((_a3 = props.node.language) != null ? _a3 : "plaintext");
@@ -4686,82 +4559,59 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4686
4559
  let setTheme = () => __async(this, null, function* () {
4687
4560
  });
4688
4561
  let whenRuntimeVisualReady = null;
4689
- let runtimeMonacoOptions = null;
4562
+ let runtimeOptions = null;
4563
+ let createRuntimeHelpersFactory = null;
4690
4564
  let isUnmounted = false;
4691
- const inlineFoldProxyCleanups = [];
4692
4565
  let deferredEditorVisualSyncRafId = null;
4693
4566
  const isDiff = computed(() => props.node.diff);
4694
- const defaultDiffHideUnchangedRegions = Object.freeze({
4695
- enabled: true,
4696
- contextLineCount: 2,
4697
- minimumLineCount: 4,
4698
- revealLineCount: 5
4699
- });
4700
4567
  const defaultPreFallbackFontFamily = '"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace';
4701
4568
  const defaultPreFallbackFontSize = 12;
4702
4569
  const defaultPreFallbackLineHeight = 18;
4703
4570
  function readPositiveNumber(value) {
4704
4571
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
4705
4572
  }
4706
- function readMonacoPadding(value) {
4707
- var _a3, _b2;
4708
- if (!value || typeof value !== "object")
4709
- return { top: 0, bottom: 0 };
4710
- const raw = value;
4711
- return {
4712
- top: (_a3 = readPositiveNumber(raw.top)) != null ? _a3 : 0,
4713
- bottom: (_b2 = readPositiveNumber(raw.bottom)) != null ? _b2 : 0
4714
- };
4715
- }
4716
- function resolveDiffHideUnchangedRegionsOption(value) {
4573
+ function readPadding(value) {
4717
4574
  var _a3;
4718
- if (typeof value === "boolean")
4719
- return value;
4720
- if (value && typeof value === "object") {
4721
- const raw = value;
4722
- return __spreadProps(__spreadValues(__spreadValues({}, defaultDiffHideUnchangedRegions), raw), {
4723
- enabled: (_a3 = raw.enabled) != null ? _a3 : true
4724
- });
4725
- }
4726
- return __spreadValues({}, defaultDiffHideUnchangedRegions);
4575
+ const padding = (_a3 = readPositiveNumber(value)) != null ? _a3 : 0;
4576
+ return { top: padding, bottom: padding };
4727
4577
  }
4728
- const resolvedMonacoOptions = computed(() => {
4729
- var _a3, _b2;
4730
- const raw = props.monacoOptions ? __spreadValues({}, props.monacoOptions) : {};
4578
+ const resolvedCodeBlockOptions = computed(() => {
4579
+ var _a3;
4580
+ return (_a3 = props.codeBlockOptions) != null ? _a3 : {};
4581
+ });
4582
+ const effectiveShowLineNumbers = computed(() => {
4583
+ var _a3;
4584
+ return (_a3 = props.showLineNumbers) != null ? _a3 : resolvedCodeBlockOptions.value.disableLineNumbers !== true;
4585
+ });
4586
+ const resolvedRuntimeOptions = computed(() => {
4587
+ const raw = __spreadValues({}, resolvedCodeBlockOptions.value);
4588
+ for (const key of [
4589
+ "maxHeight",
4590
+ "padding",
4591
+ "tabSize",
4592
+ "theme",
4593
+ "themes",
4594
+ "themeType",
4595
+ "language",
4596
+ "languages",
4597
+ "stream",
4598
+ "disableFileHeader",
4599
+ "onThemeChange",
4600
+ "renderCustomHeader",
4601
+ "renderHeaderMetadata",
4602
+ "renderHeaderPrefix"
4603
+ ])
4604
+ delete raw[key];
4731
4605
  if (!isDiff.value)
4732
4606
  return raw;
4733
- const diffHideUnchangedRegions = raw.diffHideUnchangedRegions === void 0 ? __spreadValues({}, defaultDiffHideUnchangedRegions) : resolveDiffHideUnchangedRegionsOption(raw.diffHideUnchangedRegions);
4734
- const hideUnchangedRegions = raw.hideUnchangedRegions === void 0 ? void 0 : resolveDiffHideUnchangedRegionsOption(raw.hideUnchangedRegions);
4735
- const diffUnchangedRegionStyle = (_a3 = raw.diffUnchangedRegionStyle) != null ? _a3 : "line-info";
4736
- const diffDefaults = {
4737
- maxComputationTime: 0,
4738
- diffAlgorithm: "legacy",
4739
- ignoreTrimWhitespace: false,
4740
- renderIndicators: true,
4741
- diffUpdateThrottleMs: 120,
4742
- renderLineHighlight: "none",
4743
- renderLineHighlightOnlyWhenFocus: true,
4744
- selectionHighlight: false,
4745
- occurrencesHighlight: "off",
4746
- matchBrackets: "never",
4747
- lineDecorationsWidth: 4,
4748
- lineNumbersMinChars: 2,
4749
- glyphMargin: false,
4750
- minimap: { enabled: false },
4751
- renderOverviewRuler: false,
4752
- overviewRulerBorder: false,
4753
- hideCursorInOverviewRuler: true,
4754
- scrollBeyondLastLine: false,
4755
- diffHideUnchangedRegions,
4756
- useInlineViewWhenSpaceIsLimited: (_b2 = raw.useInlineViewWhenSpaceIsLimited) != null ? _b2 : false,
4757
- diffLineStyle: "background",
4758
- diffAppearance: "auto",
4759
- diffUnchangedRegionStyle,
4760
- diffHunkActionsOnHover: false,
4761
- diffHunkHoverHideDelayMs: 160
4762
- };
4763
- return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, diffDefaults), raw), hideUnchangedRegions === void 0 ? {} : { hideUnchangedRegions }), {
4764
- diffHideUnchangedRegions
4607
+ const parseDiffOptions = raw.parseDiffOptions && typeof raw.parseDiffOptions === "object" ? raw.parseDiffOptions : {};
4608
+ return __spreadProps(__spreadValues({
4609
+ diffStyle: "split",
4610
+ expandUnchanged: false,
4611
+ collapsedContextThreshold: 5,
4612
+ hunkSeparators: "line-info"
4613
+ }, raw), {
4614
+ parseDiffOptions: __spreadValues({ context: 2 }, parseDiffOptions)
4765
4615
  });
4766
4616
  });
4767
4617
  const desiredEditorKind = computed(() => isDiff.value ? "diff" : "single");
@@ -4769,47 +4619,47 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4769
4619
  const usePreCodeRender = ref(false);
4770
4620
  const showInlinePreview = ref(false);
4771
4621
  const isDevEnv2 = typeof import.meta !== "undefined" && Boolean((_a2 = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false }) == null ? void 0 : _a2.DEV);
4622
+ function initializeRuntimeHelpers(factory) {
4623
+ createRuntimeHelpersFactory = factory;
4624
+ runtimeOptions = buildRuntimeOptions();
4625
+ const helpers = factory(runtimeOptions);
4626
+ createEditor = helpers.createEditor || createEditor;
4627
+ createDiffEditor = helpers.createDiffEditor || createDiffEditor;
4628
+ updateCode = helpers.updateCode || updateCode;
4629
+ updateDiffCode = helpers.updateDiff || updateDiffCode;
4630
+ getEditor = helpers.getEditor || getEditor;
4631
+ getEditorView = helpers.getEditorView || getEditorView;
4632
+ getDiffEditorView = helpers.getDiffEditorView || getDiffEditorView;
4633
+ cleanupEditor = helpers.cleanupEditor || cleanupEditor;
4634
+ safeClean = helpers.safeClean || helpers.cleanupEditor || safeClean;
4635
+ refreshDiffPresentation = helpers.refreshDiffPresentation || refreshDiffPresentation;
4636
+ setTheme = helpers.setTheme || setTheme;
4637
+ whenRuntimeVisualReady = helpers.whenVisualReady || null;
4638
+ runtimeReady.value = true;
4639
+ }
4772
4640
  if (typeof window !== "undefined") {
4773
4641
  (() => __async(this, null, function* () {
4774
4642
  try {
4775
- const mod2 = yield getUseMonaco();
4643
+ const mod2 = yield getStreamDiffsRuntime();
4776
4644
  if (!mod2) {
4777
4645
  if (isDevEnv2) {
4778
- console.warn("[markstream-vue2] stream-monaco is not installed. Code blocks will use basic rendering. Install stream-monaco for enhanced code editor features.");
4646
+ console.warn("[markstream-vue2] stream-diffs is not installed. Code blocks will use basic rendering. Install stream-diffs for enhanced code editor features.");
4779
4647
  }
4780
4648
  usePreCodeRender.value = true;
4781
4649
  return;
4782
4650
  }
4783
- const useMonaco = mod2.useMonaco;
4651
+ const createRuntimeHelpers = mod2.createCodeBlockRuntime;
4784
4652
  const det = mod2.detectLanguage;
4785
4653
  if (typeof det === "function")
4786
4654
  detectLanguage = det;
4787
- if (typeof useMonaco === "function") {
4788
- const theme = resolveRequestedTheme();
4789
- if (theme && props.themes && Array.isArray(props.themes) && !props.themes.includes(theme)) {
4790
- throw new Error("Preferred theme not in provided themes array");
4791
- }
4792
- runtimeMonacoOptions = buildRuntimeMonacoOptions();
4793
- const helpers = useMonaco(runtimeMonacoOptions);
4794
- createEditor = helpers.createEditor || createEditor;
4795
- createDiffEditor = helpers.createDiffEditor || createDiffEditor;
4796
- updateCode = helpers.updateCode || updateCode;
4797
- updateDiffCode = helpers.updateDiff || updateDiffCode;
4798
- getEditor = helpers.getEditor || getEditor;
4799
- getEditorView = helpers.getEditorView || getEditorView;
4800
- getDiffEditorView = helpers.getDiffEditorView || getDiffEditorView;
4801
- cleanupEditor = helpers.cleanupEditor || cleanupEditor;
4802
- safeClean = helpers.safeClean || helpers.cleanupEditor || safeClean;
4803
- refreshDiffPresentation = helpers.refreshDiffPresentation || refreshDiffPresentation;
4804
- setTheme = helpers.setTheme || setTheme;
4805
- whenRuntimeVisualReady = helpers.whenVisualReady || null;
4806
- monacoReady.value = true;
4655
+ if (typeof createRuntimeHelpers === "function") {
4656
+ initializeRuntimeHelpers(createRuntimeHelpers);
4807
4657
  if (codeEditor.value)
4808
4658
  yield ensureEditorCreation(codeEditor.value);
4809
4659
  }
4810
4660
  } catch (err) {
4811
4661
  if (isDevEnv2) {
4812
- console.warn("[markstream-vue2] Failed to initialize Monaco editor:", err);
4662
+ console.warn("[markstream-vue2] Failed to initialize stream-diffs:", err);
4813
4663
  }
4814
4664
  usePreCodeRender.value = true;
4815
4665
  }
@@ -4819,7 +4669,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4819
4669
  const codeFontMax = 36;
4820
4670
  const codeFontStep = 1;
4821
4671
  const defaultCodeFontSize = ref(
4822
- typeof ((_b = resolvedMonacoOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : defaultPreFallbackFontSize
4672
+ typeof ((_b = resolvedRuntimeOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedRuntimeOptions.value.fontSize : defaultPreFallbackFontSize
4823
4673
  );
4824
4674
  const codeFontSize = ref(defaultCodeFontSize.value);
4825
4675
  const fontBaselineReady = computed(() => {
@@ -4849,62 +4699,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4849
4699
  rafId = safeRaf(finish);
4850
4700
  });
4851
4701
  }
4852
- function expectsLanguageTokensForLine(text) {
4853
- return /['"`{}()[\]:;=<>.,]|\/\/|\/\*|\b(?:async|await|class|const|enum|export|for|function|if|import|interface|let|return|switch|type|var|while)\b/.test(
4854
- text.replace(/\u00A0/g, " ").trim()
4855
- );
4856
- }
4857
- function hasLanguageHighlightReady(root) {
4858
- if (isPlainTextLanguage.value)
4859
- return true;
4860
- if (!root)
4861
- return false;
4862
- const viewLines = Array.from(
4863
- root.querySelectorAll(
4864
- ".monaco-diff-editor .view-lines .view-line, .monaco-editor .view-lines .view-line"
4865
- )
4866
- ).filter((line) => {
4867
- var _a3;
4868
- return Boolean((_a3 = line.textContent) == null ? void 0 : _a3.trim());
4869
- });
4870
- if (!viewLines.length)
4871
- return false;
4872
- const tokenCandidateLines = viewLines.filter((line) => {
4702
+ function waitForEditorVisualReady() {
4703
+ return __async(this, null, function* () {
4873
4704
  var _a3;
4874
- return expectsLanguageTokensForLine((_a3 = line.textContent) != null ? _a3 : "");
4875
- });
4876
- if (!tokenCandidateLines.length)
4877
- return true;
4878
- return tokenCandidateLines.some((line) => {
4879
- const spans = Array.from(line.querySelectorAll("span")).filter((span) => {
4880
- var _a3;
4881
- return (_a3 = span.textContent) == null ? void 0 : _a3.trim();
4882
- });
4883
- return spans.some((span) => {
4884
- const tokenClasses = String(span.className || "").split(/\s+/);
4885
- return tokenClasses.some((className) => /^mtk\d+$/.test(className) && className !== "mtk1");
4886
- });
4887
- });
4888
- }
4889
- function hasCurrentEditorContent() {
4890
- var _a3, _b2, _c, _d, _e, _f, _g;
4891
- const editor = isDiff.value ? (_c = (_b2 = (_a3 = getDiffEditorView()) == null ? void 0 : _a3.getModifiedEditor) == null ? void 0 : _b2.call(_a3)) != null ? _c : getDiffEditorView() : getEditorView();
4892
- const model = (_d = editor == null ? void 0 : editor.getModel) == null ? void 0 : _d.call(editor);
4893
- if (typeof (model == null ? void 0 : model.getValue) !== "function")
4894
- return true;
4895
- const expected = isDiff.value ? String((_f = (_e = props.node.updatedCode) != null ? _e : props.node.code) != null ? _f : "") : String((_g = props.node.code) != null ? _g : "");
4896
- return model.getValue() === expected;
4897
- }
4898
- function hasRenderedEditorDom(root = codeEditor.value) {
4899
- if (!root)
4900
- return false;
4901
- if (root.querySelector("diffs-container, .stream-diffs-shell"))
4902
- return true;
4903
- return Boolean(root.querySelector(".monaco-diff-editor .view-lines .view-line, .monaco-editor .view-lines .view-line"));
4904
- }
4905
- function waitForEditorVisualReady() {
4906
- return __async(this, null, function* () {
4907
- var _a3, _b2, _c;
4908
4705
  if (whenRuntimeVisualReady) {
4909
4706
  try {
4910
4707
  const ready = yield whenRuntimeVisualReady();
@@ -4921,14 +4718,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4921
4718
  for (let pass = 0; pass < maxPasses; pass++) {
4922
4719
  if (isUnmounted)
4923
4720
  return false;
4924
- const code = isDiff.value ? String((_b2 = (_a3 = props.node.updatedCode) != null ? _a3 : props.node.code) != null ? _b2 : "") : String((_c = props.node.code) != null ? _c : "");
4925
- const domReady = hasRenderedEditorDom();
4926
- const highlightReady = !code.trim() || isPlainTextLanguage.value || hasLanguageHighlightReady(codeEditor.value);
4927
- if (hasCurrentEditorContent() && domReady && highlightReady) {
4721
+ if ((_a3 = codeEditor.value) == null ? void 0 : _a3.querySelector("diffs-container, .stream-diffs-shell")) {
4928
4722
  yield nextTick();
4929
4723
  yield waitForAnimationFrame();
4930
- if (!isUnmounted && hasCurrentEditorContent() && hasRenderedEditorDom())
4931
- return !code.trim() || isPlainTextLanguage.value || hasLanguageHighlightReady(codeEditor.value);
4724
+ return !isUnmounted;
4932
4725
  }
4933
4726
  yield nextTick();
4934
4727
  yield waitForAnimationFrame();
@@ -4936,21 +4729,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4936
4729
  return false;
4937
4730
  });
4938
4731
  }
4939
- function measureLineHeightFromDom() {
4940
- try {
4941
- const root = codeEditor.value;
4942
- if (!root)
4943
- return null;
4944
- const lineEl = root.querySelector(".view-lines .view-line");
4945
- if (lineEl) {
4946
- const h2 = Math.ceil(lineEl.getBoundingClientRect().height);
4947
- if (h2 > 0)
4948
- return h2;
4949
- }
4950
- } catch (e) {
4951
- }
4952
- return null;
4953
- }
4954
4732
  function readActualFontSizeFromEditor() {
4955
4733
  var _a3, _b2, _c, _d, _e;
4956
4734
  try {
@@ -4965,31 +4743,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4965
4743
  }
4966
4744
  } catch (e) {
4967
4745
  }
4968
- try {
4969
- const root = codeEditor.value;
4970
- if (root) {
4971
- const lineEl = root.querySelector(".view-lines .view-line");
4972
- if (lineEl) {
4973
- try {
4974
- if (typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
4975
- const fs = window.getComputedStyle(lineEl).fontSize;
4976
- const m = fs && fs.match(/^(\d+(?:\.\d+)?)/);
4977
- if (m)
4978
- return Number.parseFloat(m[1]);
4979
- }
4980
- } catch (e) {
4981
- }
4982
- }
4983
- }
4984
- } catch (e) {
4985
- }
4986
4746
  return null;
4987
4747
  }
4988
4748
  function getLineHeightSafe(editor) {
4989
4749
  var _a3, _b2;
4990
4750
  try {
4991
- const monacoEditor = getEditor();
4992
- const key = (_a3 = monacoEditor == null ? void 0 : monacoEditor.EditorOption) == null ? void 0 : _a3.lineHeight;
4751
+ const editorModule = getEditor();
4752
+ const key = (_a3 = editorModule == null ? void 0 : editorModule.EditorOption) == null ? void 0 : _a3.lineHeight;
4993
4753
  if (key != null) {
4994
4754
  const v = (_b2 = editor == null ? void 0 : editor.getOption) == null ? void 0 : _b2.call(editor, key);
4995
4755
  if (typeof v === "number" && v > 0)
@@ -4997,9 +4757,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4997
4757
  }
4998
4758
  } catch (e) {
4999
4759
  }
5000
- const domH = measureLineHeightFromDom();
5001
- if (domH && domH > 0)
5002
- return domH;
5003
4760
  const fs = Number.isFinite(codeFontSize.value) && codeFontSize.value > 0 ? codeFontSize.value : 12;
5004
4761
  return Math.max(12, Math.round(fs * 1.35));
5005
4762
  }
@@ -5008,9 +4765,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5008
4765
  if (Number.isFinite(codeFontSize.value) && codeFontSize.value > 0 && Number.isFinite(defaultCodeFontSize.value))
5009
4766
  return codeFontSize.value;
5010
4767
  const actual = readActualFontSizeFromEditor();
5011
- if (typeof ((_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.fontSize) === "number") {
5012
- defaultCodeFontSize.value = resolvedMonacoOptions.value.fontSize;
5013
- codeFontSize.value = resolvedMonacoOptions.value.fontSize;
4768
+ if (typeof ((_a3 = resolvedRuntimeOptions.value) == null ? void 0 : _a3.fontSize) === "number") {
4769
+ defaultCodeFontSize.value = resolvedRuntimeOptions.value.fontSize;
4770
+ codeFontSize.value = resolvedRuntimeOptions.value.fontSize;
5014
4771
  return codeFontSize.value;
5015
4772
  }
5016
4773
  if (actual && actual > 0) {
@@ -5089,85 +4846,22 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5089
4846
  return null;
5090
4847
  }
5091
4848
  }
5092
- function getColorLuminance(color) {
5093
- const channels = String(color != null ? color : "").match(/\d+(?:\.\d+)?/g);
5094
- if (!channels || channels.length < 3)
5095
- return null;
5096
- const [r, g, b] = channels.slice(0, 3).map(Number);
5097
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
5098
- }
5099
- function shouldPreferPlainTextFallbackSurface(bg, fg, expectDark) {
5100
- if (!isPlainTextLanguage.value)
5101
- return false;
5102
- const bgLuminance = getColorLuminance(bg);
5103
- const fgLuminance = getColorLuminance(fg);
5104
- if (expectDark) {
5105
- return bgLuminance != null && bgLuminance > 170 || fgLuminance != null && fgLuminance < 110;
5106
- }
5107
- return bgLuminance != null && bgLuminance < 85 || fgLuminance != null && fgLuminance > 190;
5108
- }
5109
4849
  function syncEditorCssVars() {
5110
- var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
4850
+ var _a3;
5111
4851
  const editorEl = codeEditor.value;
5112
4852
  const rootEl = container.value;
5113
4853
  if (!editorEl || !rootEl)
5114
4854
  return;
5115
- rootEl.style.removeProperty("--vscode-editor-foreground");
5116
- rootEl.style.removeProperty("--vscode-editor-background");
5117
- rootEl.style.removeProperty("--vscode-editor-selectionBackground");
5118
4855
  const targetEl = editorEl;
5119
- const runtimeMetrics = resolvedMonacoOptions.value;
5120
- const tabSize = (_a3 = readPositiveNumber(runtimeMetrics == null ? void 0 : runtimeMetrics.tabSize)) != null ? _a3 : 4;
4856
+ const codeOptions = resolvedCodeBlockOptions.value;
4857
+ const tabSize = (_a3 = readPositiveNumber(codeOptions.tabSize)) != null ? _a3 : 4;
5121
4858
  targetEl.style.setProperty("--diffs-tab-size", String(tabSize));
5122
- const configuredPadding = runtimeMetrics == null ? void 0 : runtimeMetrics.padding;
5123
- if (configuredPadding && typeof configuredPadding === "object") {
5124
- const paddingTop = (_b2 = readPositiveNumber(configuredPadding.top)) != null ? _b2 : 0;
5125
- targetEl.style.setProperty("--diffs-gap-block", `${paddingTop}px`);
4859
+ const configuredPadding = codeOptions.padding;
4860
+ if (typeof configuredPadding === "number") {
4861
+ targetEl.style.setProperty("--diffs-gap-block", `${configuredPadding}px`);
5126
4862
  } else {
5127
4863
  targetEl.style.removeProperty("--diffs-gap-block");
5128
4864
  }
5129
- if (isDiff.value) {
5130
- targetEl.style.removeProperty("--vscode-editor-foreground");
5131
- targetEl.style.removeProperty("--vscode-editor-background");
5132
- targetEl.style.removeProperty("--vscode-editor-selectionBackground");
5133
- return;
5134
- }
5135
- const editorRoot = editorEl.querySelector(".monaco-editor") || editorEl;
5136
- const bgEl = editorRoot.querySelector(".monaco-editor-background") || editorRoot;
5137
- const fgEl = editorRoot.querySelector(".view-lines") || editorRoot;
5138
- let rootStyles = null;
5139
- let bgStyles = null;
5140
- let fgStyles = null;
5141
- try {
5142
- if (typeof window !== "undefined" && typeof window.getComputedStyle === "function") {
5143
- rootStyles = window.getComputedStyle(editorRoot);
5144
- bgStyles = bgEl === editorRoot ? rootStyles : window.getComputedStyle(bgEl);
5145
- fgStyles = fgEl === editorRoot ? rootStyles : window.getComputedStyle(fgEl);
5146
- }
5147
- } catch (e) {
5148
- rootStyles = null;
5149
- bgStyles = null;
5150
- fgStyles = null;
5151
- }
5152
- const fgVar = String((_c = rootStyles == null ? void 0 : rootStyles.getPropertyValue("--vscode-editor-foreground")) != null ? _c : "").trim();
5153
- const bgVar = String((_d = rootStyles == null ? void 0 : rootStyles.getPropertyValue("--vscode-editor-background")) != null ? _d : "").trim();
5154
- const selVar = String(
5155
- (_f = (_e = rootStyles == null ? void 0 : rootStyles.getPropertyValue("--vscode-editor-selectionBackground")) != null ? _e : rootStyles == null ? void 0 : rootStyles.getPropertyValue("--vscode-editor-hoverHighlightBackground")) != null ? _f : ""
5156
- ).trim();
5157
- const fg = fgVar || String((_h = (_g = fgStyles == null ? void 0 : fgStyles.color) != null ? _g : rootStyles == null ? void 0 : rootStyles.color) != null ? _h : "").trim();
5158
- const bg = bgVar || String((_j = (_i = bgStyles == null ? void 0 : bgStyles.backgroundColor) != null ? _i : rootStyles == null ? void 0 : rootStyles.backgroundColor) != null ? _j : "").trim();
5159
- if (shouldPreferPlainTextFallbackSurface(bg, fg, rootEl.classList.contains("is-dark"))) {
5160
- targetEl.style.removeProperty("--vscode-editor-foreground");
5161
- targetEl.style.removeProperty("--vscode-editor-background");
5162
- targetEl.style.removeProperty("--vscode-editor-selectionBackground");
5163
- return;
5164
- }
5165
- if (fg)
5166
- targetEl.style.setProperty("--vscode-editor-foreground", fg);
5167
- if (bg)
5168
- targetEl.style.setProperty("--vscode-editor-background", bg);
5169
- if (selVar)
5170
- targetEl.style.setProperty("--vscode-editor-selectionBackground", selVar);
5171
4865
  }
5172
4866
  let resizeSyncHandler = null;
5173
4867
  const SCROLL_PARENT_OVERFLOW_RE = /auto|scroll|overlay/i;
@@ -5232,113 +4926,21 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5232
4926
  } catch (e) {
5233
4927
  }
5234
4928
  }
5235
- function clearInlineFoldProxies() {
5236
- var _a3;
5237
- while (inlineFoldProxyCleanups.length > 0) {
5238
- try {
5239
- (_a3 = inlineFoldProxyCleanups.pop()) == null ? void 0 : _a3();
5240
- } catch (e) {
5241
- }
5242
- }
5243
- }
5244
- function syncInlineFoldProxies() {
5245
- clearInlineFoldProxies();
5246
- if (!isDiff.value)
5247
- return;
5248
- const root = codeEditor.value;
5249
- if (!root)
5250
- return;
5251
- const diffRoot = root.querySelector(".monaco-diff-editor");
5252
- if (!diffRoot || diffRoot.classList.contains("side-by-side"))
5253
- return;
5254
- const originalWidgets = Array.from(diffRoot.querySelectorAll(".editor.original .diff-hidden-lines"));
5255
- const modifiedWidgets = Array.from(diffRoot.querySelectorAll(".editor.modified .diff-hidden-lines"));
5256
- const pairCount = Math.min(originalWidgets.length, modifiedWidgets.length);
5257
- for (let i = 0; i < pairCount; i++) {
5258
- const originalWidget = originalWidgets[i];
5259
- const modifiedWidget = modifiedWidgets[i];
5260
- const modifiedTrigger = modifiedWidget.querySelector("a");
5261
- const originalSlot = originalWidget.querySelector(".center > div:first-child");
5262
- if (!modifiedTrigger || !originalSlot)
5263
- continue;
5264
- const proxyButton = document.createElement("button");
5265
- proxyButton.type = "button";
5266
- proxyButton.className = "markstream-inline-fold-proxy";
5267
- const label = modifiedTrigger.getAttribute("title") || "Show Unchanged Region";
5268
- proxyButton.title = label;
5269
- proxyButton.setAttribute("aria-label", label);
5270
- const sourceIcon = modifiedTrigger.querySelector(".codicon");
5271
- const icon = document.createElement("span");
5272
- icon.className = (sourceIcon == null ? void 0 : sourceIcon.className) || "codicon codicon-unfold";
5273
- proxyButton.append(icon);
5274
- const handlePointerDown = (event) => {
5275
- event.preventDefault();
5276
- event.stopPropagation();
5277
- };
5278
- const handleClick = (event) => {
5279
- event.preventDefault();
5280
- event.stopPropagation();
5281
- modifiedTrigger.click();
5282
- };
5283
- const handleKeyDown = (event) => {
5284
- if (event.key !== "Enter" && event.key !== " ")
5285
- return;
5286
- event.preventDefault();
5287
- event.stopPropagation();
5288
- modifiedTrigger.click();
5289
- };
5290
- proxyButton.addEventListener("mousedown", handlePointerDown);
5291
- proxyButton.addEventListener("click", handleClick);
5292
- proxyButton.addEventListener("keydown", handleKeyDown);
5293
- originalSlot.replaceChildren(proxyButton);
5294
- inlineFoldProxyCleanups.push(() => {
5295
- proxyButton.removeEventListener("mousedown", handlePointerDown);
5296
- proxyButton.removeEventListener("click", handleClick);
5297
- proxyButton.removeEventListener("keydown", handleKeyDown);
5298
- if (originalSlot.contains(proxyButton))
5299
- originalSlot.replaceChildren();
5300
- });
5301
- }
5302
- }
5303
4929
  function scheduleEditorVisualSync() {
5304
4930
  if (deferredEditorVisualSyncRafId != null)
5305
4931
  return;
5306
4932
  deferredEditorVisualSyncRafId = safeRaf(() => {
5307
4933
  deferredEditorVisualSyncRafId = null;
5308
4934
  safeRaf(() => {
5309
- syncDiffRevealButtons();
5310
- syncInlineFoldProxies();
5311
4935
  if (isCollapsed.value)
5312
4936
  return;
5313
4937
  if (isExpanded.value)
5314
4938
  updateExpandedHeight();
5315
4939
  else
5316
4940
  updateCollapsedHeight();
5317
- safeRaf(() => {
5318
- syncDiffRevealButtons();
5319
- syncInlineFoldProxies();
5320
- });
5321
4941
  });
5322
4942
  });
5323
4943
  }
5324
- function syncDiffRevealButtons() {
5325
- if (!isDiff.value)
5326
- return;
5327
- const root = codeEditor.value;
5328
- if (!root)
5329
- return;
5330
- const revealButtons = Array.from(
5331
- root.querySelectorAll(".stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal")
5332
- );
5333
- for (const button of revealButtons) {
5334
- if (!(button instanceof HTMLButtonElement))
5335
- continue;
5336
- const direction = button.dataset.direction === "up" ? "up" : "down";
5337
- const icon = document.createElement("span");
5338
- icon.className = `codicon codicon-chevron-${direction}`;
5339
- button.replaceChildren(icon);
5340
- }
5341
- }
5342
4944
  function applyCollapsedContainerHeight(container2, contentHeight, maxHeight) {
5343
4945
  const cappedHeight = Math.min(contentHeight, maxHeight);
5344
4946
  const shouldScroll = contentHeight > maxHeight + PIXEL_EPSILON;
@@ -5393,12 +4995,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5393
4995
  }
5394
4996
  }
5395
4997
  function getMaxHeightValue() {
5396
- var _a3, _b2;
5397
- const maxH = (_b2 = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.MAX_HEIGHT) != null ? _b2 : 500;
5398
- if (typeof maxH === "number")
5399
- return maxH;
5400
- const m = String(maxH).match(/^(\d+(?:\.\d+)?)/);
5401
- return m ? Number.parseFloat(m[1]) : 500;
4998
+ var _a3;
4999
+ return (_a3 = resolvedCodeBlockOptions.value.maxHeight) != null ? _a3 : 500;
5402
5000
  }
5403
5001
  const isPreviewable = computed(() => props.isShowPreview && (codeLanguage.value === "html" || codeLanguage.value === "svg"));
5404
5002
  watch(
@@ -5408,7 +5006,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5408
5006
  }
5409
5007
  );
5410
5008
  watch(
5411
- () => [props.node.originalCode, props.node.updatedCode, monacoLanguage.value, isDiff.value],
5009
+ () => [props.node.originalCode, props.node.updatedCode, languageId.value, isDiff.value],
5412
5010
  (_0) => __async(this, [_0], function* ([originalCode, updatedCode, _language, diff]) {
5413
5011
  if (props.stream === false || !diff)
5414
5012
  return;
@@ -5421,7 +5019,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5421
5019
  updateDiffCode(
5422
5020
  String(originalCode != null ? originalCode : ""),
5423
5021
  String(updatedCode != null ? updatedCode : ""),
5424
- monacoLanguage.value
5022
+ languageId.value
5425
5023
  );
5426
5024
  scheduleEditorVisualSync();
5427
5025
  })
@@ -5441,7 +5039,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5441
5039
  } catch (e) {
5442
5040
  }
5443
5041
  }
5444
- updateCode(newCode, monacoLanguage.value);
5042
+ updateCode(newCode, languageId.value);
5445
5043
  if (isExpanded.value)
5446
5044
  scheduleEditorVisualSync();
5447
5045
  })
@@ -5531,12 +5129,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5531
5129
  if (!editor || !container2)
5532
5130
  return;
5533
5131
  if (isExpanded.value) {
5534
- setAutomaticLayout(true);
5535
5132
  container2.style.maxHeight = "none";
5536
5133
  container2.style.overflow = "visible";
5537
5134
  updateExpandedHeight();
5538
5135
  } else {
5539
- setAutomaticLayout(false);
5540
5136
  container2.style.overflow = "auto";
5541
5137
  updateCollapsedHeight();
5542
5138
  }
@@ -5550,10 +5146,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5550
5146
  if (rectH > 0)
5551
5147
  heightBeforeCollapse.value = rectH;
5552
5148
  }
5553
- setAutomaticLayout(false);
5554
5149
  } else {
5555
- if (isExpanded.value)
5556
- setAutomaticLayout(true);
5557
5150
  if (codeEditor.value && heightBeforeCollapse.value != null) {
5558
5151
  codeEditor.value.style.height = `${heightBeforeCollapse.value}px`;
5559
5152
  }
@@ -5598,39 +5191,28 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5598
5191
  if (lowerLang === "html")
5599
5192
  showInlinePreview.value = !showInlinePreview.value;
5600
5193
  }
5601
- function setAutomaticLayout(expanded) {
5602
- var _a3, _b2;
5603
- try {
5604
- if (isDiff.value) {
5605
- const diff = getDiffEditorView();
5606
- (_a3 = diff == null ? void 0 : diff.updateOptions) == null ? void 0 : _a3.call(diff, { automaticLayout: expanded });
5607
- } else {
5608
- const ed = getEditorView();
5609
- (_b2 = ed == null ? void 0 : ed.updateOptions) == null ? void 0 : _b2.call(ed, { automaticLayout: expanded });
5610
- }
5611
- } catch (e) {
5612
- }
5613
- }
5614
- function runEditorCreation(el) {
5194
+ function runEditorCreation(el, generation) {
5615
5195
  return __async(this, null, function* () {
5616
5196
  var _a3, _b2, _c;
5617
- if (!createEditor)
5197
+ if (!createEditor || isUnmounted || generation !== editorCreationGeneration)
5618
5198
  return;
5619
- syncRuntimeMonacoOptions();
5199
+ syncRuntimeOptions();
5620
5200
  if (isDiff.value) {
5621
5201
  safeClean();
5622
5202
  if (createDiffEditor)
5623
- yield createDiffEditor(el, String((_a3 = props.node.originalCode) != null ? _a3 : ""), String((_b2 = props.node.updatedCode) != null ? _b2 : ""), monacoLanguage.value);
5203
+ yield createDiffEditor(el, String((_a3 = props.node.originalCode) != null ? _a3 : ""), String((_b2 = props.node.updatedCode) != null ? _b2 : ""), languageId.value);
5624
5204
  else
5625
- yield createEditor(el, props.node.code, monacoLanguage.value);
5205
+ yield createEditor(el, props.node.code, languageId.value);
5626
5206
  } else {
5627
- yield createEditor(el, props.node.code, monacoLanguage.value);
5207
+ yield createEditor(el, props.node.code, languageId.value);
5628
5208
  }
5209
+ if (isUnmounted || generation !== editorCreationGeneration)
5210
+ return;
5629
5211
  const editor = isDiff.value ? getDiffEditorView() : getEditorView();
5630
- if (typeof ((_c = resolvedMonacoOptions.value) == null ? void 0 : _c.fontSize) === "number") {
5631
- editor == null ? void 0 : editor.updateOptions({ fontSize: resolvedMonacoOptions.value.fontSize, automaticLayout: false });
5632
- defaultCodeFontSize.value = resolvedMonacoOptions.value.fontSize;
5633
- codeFontSize.value = resolvedMonacoOptions.value.fontSize;
5212
+ if (typeof ((_c = resolvedRuntimeOptions.value) == null ? void 0 : _c.fontSize) === "number") {
5213
+ editor == null ? void 0 : editor.updateOptions({ fontSize: resolvedRuntimeOptions.value.fontSize });
5214
+ defaultCodeFontSize.value = resolvedRuntimeOptions.value.fontSize;
5215
+ codeFontSize.value = resolvedRuntimeOptions.value.fontSize;
5634
5216
  } else {
5635
5217
  const actual = readActualFontSizeFromEditor();
5636
5218
  if (actual && actual > 0) {
@@ -5645,11 +5227,17 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5645
5227
  scheduleEditorVisualSync();
5646
5228
  if (props.loading === false) {
5647
5229
  yield nextTick();
5230
+ if (isUnmounted || generation !== editorCreationGeneration)
5231
+ return;
5648
5232
  safeRaf(() => {
5233
+ if (isUnmounted || generation !== editorCreationGeneration)
5234
+ return;
5649
5235
  scheduleEditorVisualSync();
5650
5236
  });
5651
5237
  }
5652
5238
  const visuallyReady = yield waitForEditorVisualReady();
5239
+ if (isUnmounted || generation !== editorCreationGeneration)
5240
+ return;
5653
5241
  if (visuallyReady && !isCollapsed.value && !isExpanded.value) {
5654
5242
  updateCollapsedHeight();
5655
5243
  }
@@ -5663,17 +5251,20 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5663
5251
  return createEditorPromise;
5664
5252
  editorCreated.value = true;
5665
5253
  editorReady.value = false;
5254
+ const generation = editorCreationGeneration;
5666
5255
  const pending2 = (() => __async(this, null, function* () {
5667
- yield runEditorCreation(el);
5256
+ yield runEditorCreation(el, generation);
5668
5257
  }))();
5669
- createEditorPromise = pending2.finally(() => {
5670
- createEditorPromise = null;
5258
+ const tracked = pending2.finally(() => {
5259
+ if (createEditorPromise === tracked)
5260
+ createEditorPromise = null;
5671
5261
  });
5672
- return createEditorPromise;
5262
+ createEditorPromise = tracked;
5263
+ return tracked;
5673
5264
  }
5674
5265
  const stopCreateEditorWatch = watch(
5675
- () => [codeEditor.value, isDiff.value, props.stream, props.loading, monacoReady.value, viewportReady.value],
5676
- (_0) => __async(this, [_0], function* ([el, _isDiff, stream, loading, _monacoReady, visible2]) {
5266
+ () => [codeEditor.value, isDiff.value, props.stream, props.loading, runtimeReady.value, viewportReady.value],
5267
+ (_0) => __async(this, [_0], function* ([el, _isDiff, stream, loading, _runtimeReady, visible2]) {
5677
5268
  if (!el || !createEditor)
5678
5269
  return;
5679
5270
  if (!visible2)
@@ -5683,7 +5274,16 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5683
5274
  const creation = ensureEditorCreation(el);
5684
5275
  if (!creation)
5685
5276
  return;
5686
- yield creation;
5277
+ const generation = editorCreationGeneration;
5278
+ try {
5279
+ yield creation;
5280
+ } catch (error) {
5281
+ if (!isUnmounted && generation === editorCreationGeneration)
5282
+ throw error;
5283
+ return;
5284
+ }
5285
+ if (isUnmounted || generation !== editorCreationGeneration)
5286
+ return;
5687
5287
  stopCreateEditorWatch();
5688
5288
  })
5689
5289
  );
@@ -5703,8 +5303,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5703
5303
  return;
5704
5304
  try {
5705
5305
  editorCreated.value = false;
5306
+ editorCreationGeneration += 1;
5706
5307
  createEditorPromise = null;
5707
- clearInlineFoldProxies();
5708
5308
  safeClean();
5709
5309
  yield nextTick();
5710
5310
  yield ensureEditorCreation(codeEditor.value);
@@ -5714,70 +5314,27 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5714
5314
  })
5715
5315
  );
5716
5316
  function getPreferredColorScheme() {
5317
+ if (typeof props.theme === "string")
5318
+ return props.theme;
5319
+ if (props.theme && typeof props.theme === "object")
5320
+ return props.isDark ? props.theme.dark : props.theme.light;
5717
5321
  return props.isDark ? props.darkTheme : props.lightTheme;
5718
5322
  }
5719
5323
  function getThemeName(theme) {
5720
- if (typeof theme === "string")
5721
- return theme;
5722
- if (theme && typeof theme === "object" && "name" in theme)
5723
- return String(theme.name);
5724
- return null;
5725
- }
5726
- function hasTheme(themes, theme) {
5727
- const name = getThemeName(theme);
5728
- return themes.some((item) => item === theme || name && getThemeName(item) === name);
5729
- }
5730
- function addRuntimeLanguage(languages, language) {
5731
- if (typeof language !== "string")
5732
- return;
5733
- const canonical = normalizeLanguageIdentifier(language);
5734
- const monacoId = resolveMonacoLanguageId(canonical);
5735
- for (const value of [canonical, monacoId]) {
5736
- if (value && !languages.includes(value))
5737
- languages.push(value);
5738
- }
5324
+ return typeof theme === "string" ? theme : null;
5739
5325
  }
5740
- const runtimeMonacoThemes = computed(() => {
5741
- const themes = Array.isArray(props.themes) ? [...props.themes] : [];
5742
- for (const theme of [props.darkTheme, props.lightTheme]) {
5743
- if (theme != null && !hasTheme(themes, theme))
5744
- themes.push(theme);
5745
- }
5746
- return themes.length ? themes : void 0;
5747
- });
5748
- const runtimeMonacoLanguages = computed(() => {
5749
- var _a3;
5750
- const languages = [];
5751
- const configured = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.languages;
5752
- if (Array.isArray(configured)) {
5753
- for (const language of configured)
5754
- addRuntimeLanguage(languages, language);
5755
- }
5756
- addRuntimeLanguage(languages, props.node.language);
5757
- addRuntimeLanguage(languages, codeLanguage.value);
5758
- addRuntimeLanguage(languages, monacoLanguage.value);
5759
- addRuntimeLanguage(languages, "plaintext");
5760
- return languages;
5326
+ const runtimeThemes = computed(() => {
5327
+ var _a3, _b2;
5328
+ if (Array.isArray(props.themes) && typeof props.themes[0] === "string" && typeof props.themes[1] === "string")
5329
+ return [props.themes[0], props.themes[1]];
5330
+ return [(_a3 = props.darkTheme) != null ? _a3 : "vitesse-dark", (_b2 = props.lightTheme) != null ? _b2 : "vitesse-light"];
5761
5331
  });
5762
5332
  function resolveRequestedTheme() {
5763
- var _a3, _b2;
5764
- const preferred = getPreferredColorScheme();
5765
- const explicit = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.theme;
5766
- const requested = preferred != null ? preferred : explicit;
5767
- const availableThemes = (_b2 = runtimeMonacoThemes.value) != null ? _b2 : [];
5768
- if (!availableThemes.length || requested == null)
5769
- return requested;
5770
- const requestedName = getThemeName(requested);
5771
- const availableNames = availableThemes.map((theme) => getThemeName(theme)).filter((name) => !!name);
5772
- if (!requestedName || availableNames.includes(requestedName))
5773
- return requested;
5774
- const explicitName = getThemeName(explicit);
5775
- if (explicit != null && explicitName && availableNames.includes(explicitName))
5776
- return explicit;
5777
- return availableThemes[0];
5333
+ var _a3;
5334
+ return (_a3 = getPreferredColorScheme()) != null ? _a3 : props.isDark ? runtimeThemes.value[0] : runtimeThemes.value[1];
5778
5335
  }
5779
5336
  function themeUpdate() {
5780
- syncRuntimeMonacoOptions();
5337
+ syncRuntimeOptions();
5781
5338
  const themeToSet = resolveRequestedTheme();
5782
5339
  const syncPresentation = () => {
5783
5340
  if (isDiff.value)
@@ -5791,7 +5348,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5791
5348
  syncPresentation();
5792
5349
  return;
5793
5350
  }
5794
- void scheduleGlobalMonacoTheme(setTheme, themeToSet).then(syncPresentation).catch(() => {
5351
+ void Promise.resolve(setTheme(themeToSet)).then(syncPresentation).catch(() => {
5795
5352
  });
5796
5353
  }
5797
5354
  function themeLooksDark(theme) {
@@ -5829,27 +5386,21 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5829
5386
  }
5830
5387
  const resolvedChromeIsDark = computed(() => themeLooksDark(resolveRequestedTheme()));
5831
5388
  const effectiveDiffAppearance = computed(() => {
5832
- var _a3;
5833
- if (!isDiff.value)
5834
- return resolvedChromeIsDark.value ? "dark" : "light";
5835
- const explicit = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.diffAppearance;
5836
- if (explicit === "light" || explicit === "dark")
5837
- return explicit;
5838
- return props.isDark ? "dark" : "light";
5389
+ return resolvedChromeIsDark.value ? "dark" : "light";
5839
5390
  });
5840
5391
  const resolvedSurfaceIsDark = computed(
5841
5392
  () => isDiff.value ? effectiveDiffAppearance.value === "dark" : resolvedChromeIsDark.value
5842
5393
  );
5843
5394
  const preFallbackMetrics = computed(() => {
5844
5395
  var _a3, _b2, _c;
5845
- const raw = resolvedMonacoOptions.value;
5396
+ const raw = resolvedCodeBlockOptions.value;
5846
5397
  const fallbackFontSize = Number.isFinite(codeFontSize.value) && codeFontSize.value > 0 ? codeFontSize.value : defaultPreFallbackFontSize;
5847
5398
  const resolvedFontSize = (_a3 = readPositiveNumber(raw == null ? void 0 : raw.fontSize)) != null ? _a3 : fallbackFontSize;
5848
5399
  const resolvedLineHeight = (_b2 = readPositiveNumber(raw == null ? void 0 : raw.lineHeight)) != null ? _b2 : resolvedFontSize === defaultPreFallbackFontSize ? defaultPreFallbackLineHeight : Math.max(12, Math.round(resolvedFontSize * 1.5));
5849
5400
  const fontFamily = typeof (raw == null ? void 0 : raw.fontFamily) === "string" && raw.fontFamily.trim() ? raw.fontFamily.trim() : defaultPreFallbackFontFamily;
5850
- const padding = readMonacoPadding(raw == null ? void 0 : raw.padding);
5401
+ const padding = readPadding(raw == null ? void 0 : raw.padding);
5851
5402
  const defaultPadding = isDiff.value ? 0 : 8;
5852
- const hasConfiguredPadding = Boolean((raw == null ? void 0 : raw.padding) && typeof raw.padding === "object");
5403
+ const hasConfiguredPadding = typeof raw.padding === "number";
5853
5404
  const tabSize = (_c = readPositiveNumber(raw == null ? void 0 : raw.tabSize)) != null ? _c : 4;
5854
5405
  return {
5855
5406
  fontFamily,
@@ -5866,7 +5417,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5866
5417
  return false;
5867
5418
  if (typeof props.estimatedDiffInline === "boolean")
5868
5419
  return props.estimatedDiffInline;
5869
- return ((_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.renderSideBySide) === false;
5420
+ return ((_a3 = resolvedRuntimeOptions.value) == null ? void 0 : _a3.diffStyle) === "unified";
5870
5421
  });
5871
5422
  const preFallbackStyle = computed(() => {
5872
5423
  const metrics = preFallbackMetrics.value;
@@ -5876,7 +5427,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5876
5427
  "lineHeight": `${metrics.lineHeight}px`,
5877
5428
  "paddingBottom": `${metrics.paddingBottom}px`,
5878
5429
  "paddingTop": `${metrics.paddingTop}px`,
5879
- "tabSize": metrics.tabSize
5430
+ "tabSize": metrics.tabSize,
5431
+ "maxHeight": `${getMaxHeightValue()}px`,
5432
+ "overflow": "auto",
5433
+ "whiteSpace": resolvedCodeBlockOptions.value.overflow === "scroll" ? "pre" : "pre-wrap"
5880
5434
  };
5881
5435
  if (isDiff.value) {
5882
5436
  style["--markstream-code-padding-left"] = "62px";
@@ -5934,104 +5488,102 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5934
5488
  const estimatedContentHeight = readPositiveNumber(props.estimatedContentHeightPx);
5935
5489
  return estimatedContentHeight == null ? void 0 : { minHeight: `${Math.ceil(Math.min(estimatedContentHeight, getMaxHeightValue()))}px` };
5936
5490
  });
5937
- function buildRuntimeMonacoOptions() {
5491
+ function buildRuntimeOptions() {
5492
+ var _a3;
5938
5493
  const metrics = preFallbackMetrics.value;
5939
- const nextOptions = __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadProps(__spreadValues({
5940
- wordWrap: "on",
5941
- wrappingIndent: "same"
5942
- }, resolvedMonacoOptions.value || {}), {
5943
- themes: runtimeMonacoThemes.value,
5944
- languages: runtimeMonacoLanguages.value,
5945
- // CodeBlockNode owns both the header and streamed content. Keep the runtime
5946
- // surface final and headerless, and lock it to the visible pre's metrics so
5947
- // the handoff cannot introduce an intermediate font/layout state.
5494
+ const nextOptions = __spreadProps(__spreadValues(__spreadProps(__spreadValues({
5495
+ overflow: "wrap"
5496
+ }, resolvedRuntimeOptions.value || {}), {
5497
+ themes: [...runtimeThemes.value],
5948
5498
  stream: false,
5949
5499
  disableFileHeader: true,
5500
+ MAX_HEIGHT: (_a3 = resolvedCodeBlockOptions.value.maxHeight) != null ? _a3 : 500,
5950
5501
  fontSize: metrics.fontSize,
5951
- lineHeight: metrics.lineHeight,
5952
- padding: { top: metrics.paddingTop, bottom: metrics.paddingBottom },
5953
- tabSize: metrics.tabSize
5502
+ lineHeight: metrics.lineHeight
5954
5503
  }), metrics.fontFamily ? { fontFamily: metrics.fontFamily } : {}), {
5955
- theme: resolveRequestedTheme()
5956
- }), isDiff.value ? { diffAppearance: effectiveDiffAppearance.value } : {}), {
5504
+ disableLineNumbers: !effectiveShowLineNumbers.value,
5505
+ theme: resolveRequestedTheme(),
5506
+ themeType: props.isDark ? "dark" : "light",
5957
5507
  onThemeChange() {
5958
5508
  syncEditorCssVars();
5959
5509
  }
5960
5510
  });
5961
5511
  const configuredUnsafeCSS = typeof nextOptions.unsafeCSS === "string" ? nextOptions.unsafeCSS : "";
5962
- nextOptions.unsafeCSS = `[data-file], [data-diff] { --diffs-min-number-column-width-default: 4ch !important; }
5512
+ nextOptions.unsafeCSS = `[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }
5963
5513
  ${configuredUnsafeCSS}`.trim();
5964
5514
  return nextOptions;
5965
5515
  }
5966
- function syncRuntimeMonacoOptions() {
5967
- const nextOptions = buildRuntimeMonacoOptions();
5968
- if (!runtimeMonacoOptions) {
5969
- runtimeMonacoOptions = nextOptions;
5970
- return runtimeMonacoOptions;
5516
+ function syncRuntimeOptions() {
5517
+ const nextOptions = buildRuntimeOptions();
5518
+ if (!runtimeOptions) {
5519
+ runtimeOptions = nextOptions;
5520
+ return runtimeOptions;
5971
5521
  }
5972
- for (const key of Object.keys(runtimeMonacoOptions)) {
5522
+ for (const key of Object.keys(runtimeOptions)) {
5973
5523
  if (!(key in nextOptions))
5974
- delete runtimeMonacoOptions[key];
5524
+ delete runtimeOptions[key];
5975
5525
  }
5976
- Object.assign(runtimeMonacoOptions, nextOptions);
5977
- return runtimeMonacoOptions;
5526
+ Object.assign(runtimeOptions, nextOptions);
5527
+ return runtimeOptions;
5978
5528
  }
5979
- const monacoStructuralSignature = computed(() => {
5980
- var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
5981
- return JSON.stringify({
5982
- diffLineStyle: (_b2 = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.diffLineStyle) != null ? _b2 : "background",
5983
- diffUnchangedRegionStyle: (_d = (_c = resolvedMonacoOptions.value) == null ? void 0 : _c.diffUnchangedRegionStyle) != null ? _d : "line-info",
5984
- diffHideUnchangedRegions: (_f = (_e = resolvedMonacoOptions.value) == null ? void 0 : _e.diffHideUnchangedRegions) != null ? _f : true,
5985
- renderSideBySide: (_h = (_g = resolvedMonacoOptions.value) == null ? void 0 : _g.renderSideBySide) != null ? _h : true,
5986
- enableSplitViewResizing: (_j = (_i = resolvedMonacoOptions.value) == null ? void 0 : _i.enableSplitViewResizing) != null ? _j : true,
5987
- ignoreTrimWhitespace: (_l = (_k = resolvedMonacoOptions.value) == null ? void 0 : _k.ignoreTrimWhitespace) != null ? _l : true,
5988
- originalEditable: (_n = (_m = resolvedMonacoOptions.value) == null ? void 0 : _m.originalEditable) != null ? _n : false
5989
- });
5990
- });
5529
+ const runtimeOptionsRevision = ref(0);
5530
+ const runtimeStructuralSignature = computed(() => String(runtimeOptionsRevision.value));
5531
+ let deferredRuntimeOptionsRecreation = false;
5991
5532
  watch(
5992
- () => [props.monacoOptions, viewportReady.value],
5533
+ () => [props.codeBlockOptions, props.showLineNumbers],
5993
5534
  () => {
5994
- var _a3, _b2;
5995
- syncRuntimeMonacoOptions();
5535
+ runtimeOptionsRevision.value += 1;
5536
+ if (props.stream === false && props.loading !== false)
5537
+ deferredRuntimeOptionsRecreation = true;
5538
+ const configuredFontSize = resolvedCodeBlockOptions.value.fontSize;
5539
+ if (typeof configuredFontSize === "number") {
5540
+ defaultCodeFontSize.value = configuredFontSize;
5541
+ codeFontSize.value = configuredFontSize;
5542
+ } else {
5543
+ defaultCodeFontSize.value = defaultPreFallbackFontSize;
5544
+ codeFontSize.value = defaultPreFallbackFontSize;
5545
+ }
5546
+ },
5547
+ { deep: true }
5548
+ );
5549
+ watch(
5550
+ () => [viewportReady.value],
5551
+ () => {
5552
+ var _a3;
5553
+ syncRuntimeOptions();
5996
5554
  if (!createEditor || !viewportReady.value)
5997
5555
  return;
5998
5556
  const ed = isDiff.value ? getDiffEditorView() : getEditorView();
5999
- const applying = typeof ((_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : Number.isFinite(codeFontSize.value) ? codeFontSize.value : void 0;
5557
+ const applying = Number.isFinite(codeFontSize.value) ? codeFontSize.value : void 0;
6000
5558
  if (typeof applying === "number" && Number.isFinite(applying) && applying > 0) {
6001
- (_b2 = ed == null ? void 0 : ed.updateOptions) == null ? void 0 : _b2.call(ed, { fontSize: applying });
5559
+ (_a3 = ed == null ? void 0 : ed.updateOptions) == null ? void 0 : _a3.call(ed, { fontSize: applying });
6002
5560
  }
6003
5561
  scheduleEditorVisualSync();
6004
5562
  },
6005
5563
  { deep: true }
6006
5564
  );
6007
5565
  watch(
5566
+ () => [
5567
+ props.isDark,
5568
+ props.darkTheme,
5569
+ props.lightTheme,
5570
+ props.themes,
5571
+ props.theme,
5572
+ runtimeReady.value,
5573
+ editorCreated.value,
5574
+ viewportReady.value
5575
+ ],
6008
5576
  () => {
6009
- var _a3, _b2;
6010
- return [
6011
- props.isDark,
6012
- props.darkTheme,
6013
- props.lightTheme,
6014
- props.themes,
6015
- (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.theme,
6016
- (_b2 = resolvedMonacoOptions.value) == null ? void 0 : _b2.diffAppearance,
6017
- monacoReady.value,
6018
- editorCreated.value,
6019
- viewportReady.value
6020
- ];
6021
- },
6022
- () => {
6023
- if (!monacoReady.value)
5577
+ if (!runtimeReady.value)
6024
5578
  return;
6025
5579
  themeUpdate();
6026
5580
  },
6027
5581
  { flush: "post" }
6028
5582
  );
6029
5583
  watch(
6030
- () => [monacoStructuralSignature.value, monacoReady.value, viewportReady.value],
5584
+ () => [runtimeStructuralSignature.value, runtimeReady.value, viewportReady.value],
6031
5585
  (_0, _1) => __async(this, [_0, _1], function* ([nextSignature, ready, visible2], [prevSignature]) {
6032
- syncRuntimeMonacoOptions();
6033
- if (!isDiff.value)
6034
- return;
5586
+ syncRuntimeOptions();
6035
5587
  if (!ready || !visible2)
6036
5588
  return;
6037
5589
  if (!createEditor || !codeEditor.value)
@@ -6040,13 +5592,43 @@ ${configuredUnsafeCSS}`.trim();
6040
5592
  return;
6041
5593
  if (nextSignature === prevSignature)
6042
5594
  return;
6043
- if (props.stream === false && props.loading !== false)
5595
+ if (props.stream === false && props.loading !== false) {
5596
+ deferredRuntimeOptionsRecreation = true;
5597
+ return;
5598
+ }
5599
+ deferredRuntimeOptionsRecreation = false;
5600
+ try {
5601
+ editorCreated.value = false;
5602
+ editorCreationGeneration += 1;
5603
+ createEditorPromise = null;
5604
+ safeClean();
5605
+ if (createRuntimeHelpersFactory)
5606
+ initializeRuntimeHelpers(createRuntimeHelpersFactory);
5607
+ yield nextTick();
5608
+ yield ensureEditorCreation(codeEditor.value);
5609
+ } catch (e) {
5610
+ editorCreated.value = false;
5611
+ }
5612
+ }),
5613
+ { flush: "post" }
5614
+ );
5615
+ watch(
5616
+ () => [props.loading, viewportReady.value],
5617
+ (_0) => __async(this, [_0], function* ([loading, visible2]) {
5618
+ if (loading !== false || !visible2 || !deferredRuntimeOptionsRecreation)
5619
+ return;
5620
+ deferredRuntimeOptionsRecreation = false;
5621
+ syncRuntimeOptions();
5622
+ yield nextTick();
5623
+ if (!createEditor || !codeEditor.value || !editorCreated.value)
6044
5624
  return;
6045
5625
  try {
6046
5626
  editorCreated.value = false;
5627
+ editorCreationGeneration += 1;
6047
5628
  createEditorPromise = null;
6048
- clearInlineFoldProxies();
6049
5629
  safeClean();
5630
+ if (createRuntimeHelpersFactory)
5631
+ initializeRuntimeHelpers(createRuntimeHelpersFactory);
6050
5632
  yield nextTick();
6051
5633
  yield ensureEditorCreation(codeEditor.value);
6052
5634
  } catch (e) {
@@ -6079,20 +5661,21 @@ ${configuredUnsafeCSS}`.trim();
6079
5661
  }
6080
5662
  onUnmounted(() => {
6081
5663
  isUnmounted = true;
6082
- clearInlineFoldProxies();
5664
+ editorCreationGeneration += 1;
5665
+ createEditorPromise = null;
6083
5666
  if (deferredEditorVisualSyncRafId != null) {
6084
5667
  safeCancelRaf(deferredEditorVisualSyncRafId);
6085
5668
  deferredEditorVisualSyncRafId = null;
6086
5669
  }
6087
5670
  cleanupEditor();
6088
5671
  });
6089
- return { __sfc: true, props, emits, MONACO_TOUCH_PATCH_FLAG, ensureMonacoPassiveTouchListeners, shouldForcePassiveForMonaco, withPassiveOptions, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, monacoLanguage, isPlainTextLanguage, isExpanded, isCollapsed, editorCreated, editorReady, monacoReady, expandRafId, heightBeforeCollapse, resumeGuardFrames, registerVisibility, viewportHandle, viewportReady, createEditor, createDiffEditor, updateCode, updateDiffCode, getEditor, getEditorView, getDiffEditorView, cleanupEditor, safeClean, refreshDiffPresentation, createEditorPromise, detectLanguage, setTheme, whenRuntimeVisualReady, runtimeMonacoOptions, isUnmounted, inlineFoldProxyCleanups, deferredEditorVisualSyncRafId, isDiff, defaultDiffHideUnchangedRegions, defaultPreFallbackFontFamily, defaultPreFallbackFontSize, defaultPreFallbackLineHeight, readPositiveNumber, readMonacoPadding, resolveDiffHideUnchangedRegionsOption, resolvedMonacoOptions, desiredEditorKind, currentEditorKind, usePreCodeRender, showInlinePreview, isDevEnv: isDevEnv2, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, CONTENT_PADDING, LINE_EXTRA_PER_LINE, PIXEL_EPSILON, waitForAnimationFrame, expectsLanguageTokensForLine, hasLanguageHighlightReady, hasCurrentEditorContent, hasRenderedEditorDom, waitForEditorVisualReady, measureLineHeightFromDom, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, measureRenderedStaticSurfaceHeight, computeContentHeight, getColorLuminance, shouldPreferPlainTextFallbackSurface, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, clearInlineFoldProxies, syncInlineFoldProxies, scheduleEditorVisualSync, syncDiffRevealButtons, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, headerStyle, tooltipsEnabled, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, previewCode, setAutomaticLayout, runEditorCreation, ensureEditorCreation, stopCreateEditorWatch, getPreferredColorScheme, getThemeName, hasTheme, addRuntimeLanguage, runtimeMonacoThemes, runtimeMonacoLanguages, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, preFallbackMetrics, preFallbackDiffInline, preFallbackStyle, containerStyle, codeEditorContainerStyle, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
5672
+ return { __sfc: true, props, emits, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, languageId, isPlainTextLanguage, isExpanded, isCollapsed, editorCreated, editorReady, runtimeReady, expandRafId, heightBeforeCollapse, resumeGuardFrames, registerVisibility, viewportHandle, viewportReady, createEditor, createDiffEditor, updateCode, updateDiffCode, getEditor, getEditorView, getDiffEditorView, cleanupEditor, safeClean, refreshDiffPresentation, createEditorPromise, editorCreationGeneration, detectLanguage, setTheme, whenRuntimeVisualReady, runtimeOptions, createRuntimeHelpersFactory, isUnmounted, deferredEditorVisualSyncRafId, isDiff, defaultPreFallbackFontFamily, defaultPreFallbackFontSize, defaultPreFallbackLineHeight, readPositiveNumber, readPadding, resolvedCodeBlockOptions, effectiveShowLineNumbers, resolvedRuntimeOptions, desiredEditorKind, currentEditorKind, usePreCodeRender, showInlinePreview, isDevEnv: isDevEnv2, initializeRuntimeHelpers, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, CONTENT_PADDING, LINE_EXTRA_PER_LINE, PIXEL_EPSILON, waitForAnimationFrame, waitForEditorVisualReady, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, measureRenderedStaticSurfaceHeight, computeContentHeight, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, scheduleEditorVisualSync, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, headerStyle, tooltipsEnabled, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, previewCode, runEditorCreation, ensureEditorCreation, stopCreateEditorWatch, getPreferredColorScheme, getThemeName, runtimeThemes, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, preFallbackMetrics, preFallbackDiffInline, preFallbackStyle, containerStyle, codeEditorContainerStyle, buildRuntimeOptions, syncRuntimeOptions, runtimeOptionsRevision, runtimeStructuralSignature, deferredRuntimeOptionsRecreation, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
6090
5673
  }
6091
5674
  });
6092
- const CodeBlockNode_vue_vue_type_style_index_0_scoped_ce162b3f_lang = "";
6093
- var _sfc_render$b = function render35() {
5675
+ const CodeBlockNode_vue_vue_type_style_index_0_scoped_3c431ffa_lang = "";
5676
+ var _sfc_render$a = function render35() {
6094
5677
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
6095
- return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": true, "diff-inline": _setup.preFallbackDiffInline } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
5678
+ return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.effectiveShowLineNumbers, "diff-inline": _setup.preFallbackDiffInline } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
6096
5679
  _setup.resolvedSurfaceIsDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
6097
5680
  { "is-rendering": _setup.props.loading, "is-dark": _setup.resolvedSurfaceIsDark, "is-diff": _setup.isDiff, "is-plain-text": _setup.isPlainTextLanguage }
6098
5681
  ], style: _setup.containerStyle, attrs: { "data-markstream-code-block": "1", "data-markstream-enhanced": _setup.editorReady ? "true" : "false", "data-markstream-enhancement-state": _setup.editorReady ? "ready" : "pending" } }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header flex justify-between items-center", style: _setup.headerStyle }, [_vm._t("header-left", function() {
@@ -6135,22 +5718,22 @@ var _sfc_render$b = function render35() {
6135
5718
  }, "focus": function($event) {
6136
5719
  _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
6137
5720
  }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "width": "12", "height": "12", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "currentColor", "fill-rule": "evenodd", "clip-rule": "evenodd" } }, [_c("path", { attrs: { "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" } }), _c("path", { attrs: { "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" } })])])]) : _vm._e()], 2)];
6138
- })], 2) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed && (_vm.stream ? true : !_vm.loading), expression: "!isCollapsed && (stream ? true : !loading)" }], staticClass: "code-editor-layer" }, [_c("div", { ref: "codeEditor", staticClass: "code-editor-container", class: [_vm.stream ? "" : "code-height-placeholder"], style: _setup.codeEditorContainerStyle, attrs: { "data-markstream-host-hidden": !_setup.editorReady ? "true" : void 0, "aria-hidden": _setup.editorReady ? void 0 : "true" } }), !_setup.editorReady ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": true, "diff-inline": _setup.preFallbackDiffInline } }) : _vm._e()], 1), _setup.showInlinePreview && !_setup.hasPreviewListener && _setup.isPreviewable && _setup.codeLanguage === "html" ? _c(_setup.HtmlPreviewFrame, { attrs: { "code": _vm.node.code, "html-preview-allow-scripts": _setup.props.htmlPreviewAllowScripts, "html-preview-sandbox": _setup.props.htmlPreviewSandbox, "is-dark": _setup.props.isDark, "on-close": () => _setup.showInlinePreview = false } }) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_vm.stream && _vm.loading, expression: "!stream && loading" }], staticClass: "code-loading-placeholder" }, [_vm._t("loading", function() {
5721
+ })], 2) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed && (_vm.stream ? true : !_vm.loading), expression: "!isCollapsed && (stream ? true : !loading)" }], staticClass: "code-editor-layer" }, [_c("div", { ref: "codeEditor", staticClass: "code-editor-container", class: [_vm.stream ? "" : "code-height-placeholder"], style: _setup.codeEditorContainerStyle, attrs: { "data-markstream-host-hidden": !_setup.editorReady ? "true" : void 0, "aria-hidden": _setup.editorReady ? void 0 : "true" } }), !_setup.editorReady ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.effectiveShowLineNumbers, "diff-inline": _setup.preFallbackDiffInline } }) : _vm._e()], 1), _setup.showInlinePreview && !_setup.hasPreviewListener && _setup.isPreviewable && _setup.codeLanguage === "html" ? _c(_setup.HtmlPreviewFrame, { attrs: { "code": _vm.node.code, "html-preview-allow-scripts": _setup.props.htmlPreviewAllowScripts, "html-preview-sandbox": _setup.props.htmlPreviewSandbox, "is-dark": _setup.props.isDark, "on-close": () => _setup.showInlinePreview = false } }) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_vm.stream && _vm.loading, expression: "!stream && loading" }], staticClass: "code-loading-placeholder" }, [_vm._t("loading", function() {
6139
5722
  return [_c("div", { staticClass: "loading-skeleton" }, [_c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line short" })])];
6140
5723
  }, { "loading": _vm.loading, "stream": _vm.stream })], 2), _c("span", { staticClass: "sr-only", attrs: { "aria-live": "polite", "role": "status" } }, [_vm._v(_vm._s(_setup.copyText ? _setup.t("common.copied") || "Copied" : ""))])], 1);
6141
5724
  };
6142
- var _sfc_staticRenderFns$b = [];
6143
- var __component__$b = /* @__PURE__ */ normalizeComponent(
6144
- _sfc_main$b,
6145
- _sfc_render$b,
6146
- _sfc_staticRenderFns$b,
5725
+ var _sfc_staticRenderFns$a = [];
5726
+ var __component__$a = /* @__PURE__ */ normalizeComponent(
5727
+ _sfc_main$a,
5728
+ _sfc_render$a,
5729
+ _sfc_staticRenderFns$a,
6147
5730
  false,
6148
5731
  null,
6149
- "ce162b3f",
5732
+ "3c431ffa",
6150
5733
  null,
6151
5734
  null
6152
5735
  );
6153
- const CodeBlockNode = __component__$b.exports;
5736
+ const CodeBlockNode = __component__$a.exports;
6154
5737
  function useSmoothMarkdownStream(options = {}) {
6155
5738
  const source = ref("");
6156
5739
  const visible2 = ref("");
@@ -6238,7 +5821,7 @@ function clampMermaidPreviewHeight(height, minHeight = MERMAID_PREVIEW_MIN_HEIGH
6238
5821
  function clampInfographicPreviewHeight(height, minHeight = INFOGRAPHIC_PREVIEW_MIN_HEIGHT, maxHeight = INFOGRAPHIC_PREVIEW_MAX_HEIGHT) {
6239
5822
  return clampPreviewHeight(height, minHeight, maxHeight);
6240
5823
  }
6241
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
5824
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6242
5825
  __name: "NodeRenderer",
6243
5826
  props: {
6244
5827
  content: null,
@@ -6253,17 +5836,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6253
5836
  codeBlockStream: { type: Boolean, default: true },
6254
5837
  codeBlockDarkTheme: null,
6255
5838
  codeBlockLightTheme: null,
6256
- codeBlockMonacoOptions: null,
6257
5839
  renderCodeBlocksAsPre: { type: Boolean },
6258
5840
  codeBlockMinWidth: null,
6259
5841
  codeBlockMaxWidth: null,
5842
+ codeBlockOptions: null,
6260
5843
  codeBlockProps: null,
6261
5844
  mermaidProps: null,
6262
5845
  d2Props: null,
6263
5846
  infographicProps: null,
6264
5847
  showTooltips: { type: Boolean, default: true },
6265
5848
  themes: null,
6266
- langs: null,
6267
5849
  isDark: { type: Boolean },
6268
5850
  customId: null,
6269
5851
  indexKey: null,
@@ -7762,38 +7344,37 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
7762
7344
  };
7763
7345
  const indexPrefix = computed(() => props.indexKey != null ? String(props.indexKey) : "markdown-renderer");
7764
7346
  const codeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
7765
- const builtinCodeBlockExtraProps = computed(
7766
- () => getCodeBlockExtraProps(props.codeBlockProps, { omit: ["langs"] })
7767
- );
7768
- const codeBlockBindings = computed(() => __spreadValues(__spreadValues({
7347
+ const builtinCodeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
7348
+ const codeBlockBindings = computed(() => __spreadProps(__spreadValues(__spreadValues({
7769
7349
  // streaming behavior control for CodeBlockNode
7770
7350
  stream: props.codeBlockStream,
7771
7351
  darkTheme: props.codeBlockDarkTheme,
7772
7352
  lightTheme: props.codeBlockLightTheme,
7773
- monacoOptions: props.codeBlockMonacoOptions,
7774
7353
  themes: props.themes,
7775
7354
  minWidth: props.codeBlockMinWidth,
7776
7355
  maxWidth: props.codeBlockMaxWidth
7777
- }, typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}), builtinCodeBlockExtraProps.value));
7778
- const customCodeBlockBindings = computed(() => __spreadValues(__spreadProps(__spreadValues({}, codeBlockBindings.value), {
7779
- langs: props.langs
7780
- }), codeBlockExtraProps.value));
7356
+ }, typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}), builtinCodeBlockExtraProps.value), {
7357
+ codeBlockOptions: props.codeBlockOptions
7358
+ }));
7359
+ const customCodeBlockBindings = computed(() => __spreadProps(__spreadValues(__spreadValues({}, codeBlockBindings.value), codeBlockExtraProps.value), {
7360
+ codeBlockOptions: props.codeBlockOptions
7361
+ }));
7781
7362
  function countCodeLines(value) {
7782
7363
  const code = String(value != null ? value : "").replace(/(?:\r\n|\n|\r)$/, "");
7783
7364
  return code ? code.split(/\r\n|\n|\r/).length : 1;
7784
7365
  }
7785
7366
  function estimateBuiltinCodeBlockHeight(node) {
7786
- var _a3, _b2, _c2, _d, _e;
7787
- const raw = props.codeBlockMonacoOptions || {};
7788
- const fontSize = (_a3 = parsePositiveNumber(raw.fontSize)) != null ? _a3 : 12;
7789
- const lineHeight = (_b2 = parsePositiveNumber(raw.lineHeight)) != null ? _b2 : Math.round(fontSize * 1.5);
7367
+ var _a3, _b2, _c2, _d, _e, _f, _g;
7368
+ const lineHeight = (_b2 = (_a3 = props.codeBlockOptions) == null ? void 0 : _a3.lineHeight) != null ? _b2 : 18;
7790
7369
  const isDiff = Boolean(node.diff);
7791
- const diffInline = isDiff && raw.renderSideBySide === false;
7370
+ const configuredDiffInline = pickBoolean(builtinCodeBlockExtraProps.value.diffInline);
7371
+ const diffInline = isDiff && (configuredDiffInline != null ? configuredDiffInline : ((_c2 = props.codeBlockOptions) == null ? void 0 : _c2.diffStyle) === "unified");
7792
7372
  const lineCount = isDiff ? diffInline ? countCodeLines(node.originalCode) + countCodeLines(node.updatedCode) : Math.max(countCodeLines(node.originalCode), countCodeLines(node.updatedCode)) : countCodeLines(node.code);
7793
7373
  const defaultPadding = isDiff ? 0 : 8;
7794
- const paddingTop = typeof ((_c2 = raw.padding) == null ? void 0 : _c2.top) === "number" && Number.isFinite(raw.padding.top) ? Math.max(0, raw.padding.top) : defaultPadding;
7795
- const paddingBottom = typeof ((_d = raw.padding) == null ? void 0 : _d.bottom) === "number" && Number.isFinite(raw.padding.bottom) ? Math.max(0, raw.padding.bottom) : defaultPadding;
7796
- const maxHeight = (_e = parsePositiveNumber(raw.MAX_HEIGHT)) != null ? _e : 500;
7374
+ const padding = (_e = (_d = props.codeBlockOptions) == null ? void 0 : _d.padding) != null ? _e : defaultPadding;
7375
+ const paddingTop = padding;
7376
+ const paddingBottom = padding;
7377
+ const maxHeight = (_g = (_f = props.codeBlockOptions) == null ? void 0 : _f.maxHeight) != null ? _g : 500;
7797
7378
  const contentHeight = Math.max(1, Math.min(
7798
7379
  maxHeight,
7799
7380
  Math.round(lineCount * lineHeight + paddingTop + paddingBottom)
@@ -7809,11 +7390,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
7809
7390
  return typeof value === "boolean" ? value : void 0;
7810
7391
  }
7811
7392
  const preCodeBlockBindings = computed(() => {
7393
+ var _a3, _b2;
7812
7394
  const source = props.codeBlockProps || {};
7813
7395
  const bindings = {};
7814
7396
  const showLineNumbers = pickBoolean(source.showLineNumbers);
7815
- if (showLineNumbers !== void 0)
7816
- bindings.showLineNumbers = showLineNumbers;
7397
+ const disableLineNumbers = (_a3 = props.codeBlockOptions) == null ? void 0 : _a3.disableLineNumbers;
7398
+ bindings.showLineNumbers = showLineNumbers != null ? showLineNumbers : typeof disableLineNumbers === "boolean" ? !disableLineNumbers : false;
7399
+ if ((_b2 = props.codeBlockOptions) == null ? void 0 : _b2.overflow) {
7400
+ bindings.style = {
7401
+ whiteSpace: props.codeBlockOptions.overflow === "scroll" ? "pre" : "pre-wrap"
7402
+ };
7403
+ }
7817
7404
  const diffInline = pickBoolean(source.diffInline);
7818
7405
  if (diffInline !== void 0)
7819
7406
  bindings.diffInline = diffInline;
@@ -8260,9 +7847,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
8260
7847
  return { __sfc: true, props, emit, isNativeDomEvent, emitCodeCopy, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, attrs, textStreamState, streamRenderVersion, smoothStream, resolvedShowTooltips, inheritedHtmlPolicy, inheritedSmoothStreaming, resolvedHtmlPolicy, smoothStreamingEligible, hasMountedForSmoothStreaming, smoothStreamingEnabled, renderContent, rawContent, smoothSourceSynced, requestedFinal, effectiveFinal, renderVersionSource, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, customComponentsMap, effectiveCustomHtmlTags, mdBase, mdInstance, cloneNodeValue, cloneParsedNodeList, mergedParseOptions, effectiveCustomHtmlTagsSet, parsedNodes, maxLiveNodesResolved, virtualizationEnabled, viewportPriorityEnabled, registerNodeVisibility, requestFrame, cancelFrame, isTestEnv, hasIdleCallback, resolvedBatchSize, resolvedInitialBatch, batchingEnabled, renderedCount, previousRenderContext, adaptiveBatchSize, nodeVisibilityState, nodeVisibilityHandles, nodeVisibilityFallbackTimers, nodeSlotElements, codeBlockRenderCache, nodeSlotVersion, sortedNodeSlots, scrollRootElement, detachScrollHandler, pendingFocusSync, liveRange, visibleNodes, deferNodes, incrementalRenderingActive, previousBatchConfig, shouldObserveSlots, liveNodeBufferResolved, focusIndex, nodeContentElements, legacyVue26, legacyNodesMode, legacyNodeItems, syncNodeRefs, resolveTemplateRef, desiredRenderedCount, resolveScrollContainer, isReverseFlexScrollRoot, getNormalizedScrollTop, getOffsetTopWithinRoot, cleanupScrollListener, setupScrollListener, cancelScheduledFocusSync, scheduleFocusSync, syncFocusToScroll, clamp, updateLiveRange, nodeHeights, heightStats, heightTreeSize, heightSumTree, heightKnownTree, resetHeightMeasurements, pruneHeightMeasurements, fenwickUpdate, fenwickQuery, fenwickRangeSum, rebuildHeightTrees, recordNodeHeight, averageNodeHeight, estimateHeightRange, topSpacerHeight, bottomSpacerHeight, estimateIndexForOffset, estimateIndexForOffsetFromEnd, cleanupNodeVisibility, markNodeVisible, shouldRenderNode, destroyNodeHandle, setNodeSlotElement, bumpNodeSlotVersion, setNodeContentRef, batchRaf, batchTimeout, batchPending, pendingIncrement, batchIdle, VIEWPORT_FALLBACK_DELAY, VIEWPORT_FALLBACK_MARGIN_PX, cancelBatchTimers, clearVisibilityFallback, scheduleVisibilityFallback, autoDisableViewportPriority, scheduleBatch, queueNextBatch, adjustAdaptiveBatchSize, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, countCodeLines, estimateBuiltinCodeBlockHeight, pickBoolean, preCodeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getCodeBlockLanguage, getCustomCodeLanguageComponent, isLegacyStructuredNode, getRenderKey, getMermaidBindingsFor, getInfographicBindingsFor, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, hasExplicitNodes, typewriterCursorRef, showTypewriterCursor, typewriterCursorTimeout, lastTypewriterContentLength, TYPEWRITER_CURSOR_EXCLUDED_NODE_TYPES, shouldSkipTypewriterCursorForNode, shouldShowTypewriterCursorForCurrentNodes, getNodeTextLength, getTypewriterContentLength, clearTypewriterCursorTimeout, getLastTextNode, updateTypewriterCursorPosition, LegacyNodesRenderer };
8261
7848
  }
8262
7849
  });
8263
- const NodeRenderer_vue_vue_type_style_index_0_scoped_9c63598d_lang = "";
7850
+ const NodeRenderer_vue_vue_type_style_index_0_scoped_ebe176a0_lang = "";
8264
7851
  const NodeRenderer_vue_vue_type_style_index_1_lang = "";
8265
- var _sfc_render$a = function render36() {
7852
+ var _sfc_render$9 = function render36() {
8266
7853
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
8267
7854
  return _c("div", { ref: "containerRef", staticClass: "markstream-vue2 markdown-renderer", class: [{ dark: _setup.props.isDark }, { virtualized: _setup.virtualizationEnabled }], attrs: { "data-custom-id": _setup.props.customId }, on: { "click": _setup.handleContainerClick, "mouseover": _setup.handleContainerMouseover, "mouseout": _setup.handleContainerMouseout } }, [_setup.legacyNodesMode ? _vm._l(_setup.legacyRenderedItems, function(item) {
8268
7855
  return _c("div", { key: item.renderKey, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_c("div", { staticClass: "node-content" }, [!item.isCodeBlock && _setup.props.fade !== false ? _c("transition", { attrs: { "name": "fade", "appear": "" } }, [_c(item.component, _vm._b({ tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
@@ -8274,7 +7861,7 @@ var _sfc_render$a = function render36() {
8274
7861
  }, "handle-artifact-click": function($event) {
8275
7862
  return _setup.emit("handleArtifactClick", $event);
8276
7863
  } } }, "component", item.bindings, false))], 1)]);
8277
- }) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "fade": _setup.props.fade, "show-tooltips": _setup.props.showTooltips, "code-block-stream": _setup.props.codeBlockStream, "code-block-dark-theme": _setup.props.codeBlockDarkTheme, "code-block-light-theme": _setup.props.codeBlockLightTheme, "code-block-monaco-options": _setup.props.codeBlockMonacoOptions, "render-code-blocks-as-pre": _setup.props.renderCodeBlocksAsPre, "code-block-min-width": _setup.props.codeBlockMinWidth, "code-block-max-width": _setup.props.codeBlockMaxWidth, "code-block-props": _setup.props.codeBlockProps, "themes": _setup.props.themes, "langs": _setup.props.langs, "is-dark": _setup.props.isDark, "custom-html-tags": _setup.mergedParseOptions.customHtmlTags, "html-policy": _setup.resolvedHtmlPolicy }, on: { "copy": function($event) {
7864
+ }) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "fade": _setup.props.fade, "show-tooltips": _setup.props.showTooltips, "code-block-stream": _setup.props.codeBlockStream, "code-block-dark-theme": _setup.props.codeBlockDarkTheme, "code-block-light-theme": _setup.props.codeBlockLightTheme, "render-code-blocks-as-pre": _setup.props.renderCodeBlocksAsPre, "code-block-min-width": _setup.props.codeBlockMinWidth, "code-block-max-width": _setup.props.codeBlockMaxWidth, "code-block-options": _setup.props.codeBlockOptions, "code-block-props": _setup.props.codeBlockProps, "themes": _setup.props.themes, "is-dark": _setup.props.isDark, "custom-html-tags": _setup.mergedParseOptions.customHtmlTags, "html-policy": _setup.resolvedHtmlPolicy }, on: { "copy": function($event) {
8278
7865
  return _setup.emitCodeCopy($event);
8279
7866
  }, "handle-artifact-click": function($event) {
8280
7867
  return _setup.emit("handleArtifactClick", $event);
@@ -8291,19 +7878,19 @@ var _sfc_render$a = function render36() {
8291
7878
  } } }, "component", item.bindings, false))], 1) : _c("div", { staticClass: "node-placeholder", style: { height: `${(_a2 = _setup.nodeHeights[item.index]) != null ? _a2 : _setup.averageNodeHeight}px` } })]);
8292
7879
  }), _setup.virtualizationEnabled ? _c("div", { staticClass: "node-spacer", style: { height: `${_setup.bottomSpacerHeight}px` }, attrs: { "aria-hidden": "true" } }) : _vm._e()], _setup.showTypewriterCursor ? _c("span", { ref: "typewriterCursorRef", staticClass: "typewriter-cursor", attrs: { "aria-hidden": "true" } }) : _vm._e()], 2);
8293
7880
  };
8294
- var _sfc_staticRenderFns$a = [];
8295
- var __component__$a = /* @__PURE__ */ normalizeComponent(
8296
- _sfc_main$a,
8297
- _sfc_render$a,
8298
- _sfc_staticRenderFns$a,
7881
+ var _sfc_staticRenderFns$9 = [];
7882
+ var __component__$9 = /* @__PURE__ */ normalizeComponent(
7883
+ _sfc_main$9,
7884
+ _sfc_render$9,
7885
+ _sfc_staticRenderFns$9,
8299
7886
  false,
8300
7887
  null,
8301
- "9c63598d",
7888
+ "ebe176a0",
8302
7889
  null,
8303
7890
  null
8304
7891
  );
8305
- const NodeRenderer = __component__$a.exports;
8306
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7892
+ const NodeRenderer = __component__$9.exports;
7893
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8307
7894
  __name: "AdmonitionNode",
8308
7895
  props: {
8309
7896
  node: null,
@@ -8348,24 +7935,24 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
8348
7935
  }
8349
7936
  });
8350
7937
  const AdmonitionNode_vue_vue_type_style_index_0_scoped_f9c1d6b9_lang = "";
8351
- var _sfc_render$9 = function render37() {
7938
+ var _sfc_render$8 = function render37() {
8352
7939
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
8353
7940
  return _c("div", { staticClass: "admonition", class: [`admonition-${_setup.props.node.kind}`, _setup.props.isDark ? "is-dark" : ""] }, [_c("div", { staticClass: "admonition-header", attrs: { "id": _setup.headerId } }, [_setup.iconMap[_setup.props.node.kind] ? _c("span", { staticClass: "admonition-icon" }, [_vm._v(_vm._s(_setup.iconMap[_setup.props.node.kind]))]) : _vm._e(), _c("span", { staticClass: "admonition-title" }, [_vm._v(_vm._s(_setup.displayTitle))]), _setup.props.node.collapsible ? _c("button", { staticClass: "admonition-toggle", attrs: { "aria-expanded": !_setup.collapsed, "aria-controls": `${_setup.headerId}-content`, "title": _setup.collapsed ? "Expand" : "Collapse" }, on: { "click": _setup.toggleCollapse } }, [_setup.collapsed ? _c("span", [_vm._v("▶")]) : _c("span", [_vm._v("▼")])]) : _vm._e()]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.collapsed, expression: "!collapsed" }], staticClass: "admonition-content", attrs: { "id": `${_setup.headerId}-content`, "aria-labelledby": _setup.headerId } }, [_c(_setup.nestedRenderer, { tag: "component", attrs: { "index-key": `admonition-${_vm.indexKey}`, "nodes": _setup.props.node.children, "custom-id": _setup.props.customId, "typewriter": _setup.props.typewriter }, on: { "copy": function($event) {
8354
7941
  return _setup.emit("copy", $event);
8355
7942
  } } })], 1)]);
8356
7943
  };
8357
- var _sfc_staticRenderFns$9 = [];
8358
- var __component__$9 = /* @__PURE__ */ normalizeComponent(
8359
- _sfc_main$9,
8360
- _sfc_render$9,
8361
- _sfc_staticRenderFns$9,
7944
+ var _sfc_staticRenderFns$8 = [];
7945
+ var __component__$8 = /* @__PURE__ */ normalizeComponent(
7946
+ _sfc_main$8,
7947
+ _sfc_render$8,
7948
+ _sfc_staticRenderFns$8,
8362
7949
  false,
8363
7950
  null,
8364
7951
  "f9c1d6b9",
8365
7952
  null,
8366
7953
  null
8367
7954
  );
8368
- const AdmonitionNode = __component__$9.exports;
7955
+ const AdmonitionNode = __component__$8.exports;
8369
7956
  const defaultD2Loader = () => import("@terrastruct/d2");
8370
7957
  let cachedD2 = null;
8371
7958
  let d2Loader = defaultD2Loader;
@@ -8422,7 +8009,7 @@ function getD2() {
8422
8009
  return cachedD2;
8423
8010
  });
8424
8011
  }
8425
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8012
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8426
8013
  __name: "D2BlockNode",
8427
8014
  props: {
8428
8015
  node: null,
@@ -8835,7 +8422,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8835
8422
  }
8836
8423
  });
8837
8424
  const D2BlockNode_vue_vue_type_style_index_0_scoped_fdf24c90_lang = "";
8838
- var _sfc_render$8 = function render38() {
8425
+ var _sfc_render$7 = function render38() {
8839
8426
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
8840
8427
  return _c("div", { staticClass: "d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: _setup.props.isDark ? "border-gray-700/30 bg-gray-900 text-gray-100" : "border-gray-200 bg-white text-gray-900" }, [_setup.props.showHeader ? _c("div", { staticClass: "d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", staticStyle: { "color": "var(--vscode-editor-foreground)", "background-color": "var(--vscode-editor-background)" } }, [_vm._m(0), _c("div", { staticClass: "flex items-center gap-x-2" }, [_setup.props.showModeToggle ? _c("div", { staticClass: "flex items-center gap-x-1 rounded-md p-0.5", class: _setup.props.isDark ? "bg-gray-700" : "bg-gray-100" }, [_c("button", { staticClass: "mode-btn px-2 py-1 text-xs rounded", class: !_setup.showSource ? "is-active" : "", attrs: { "type": "button" }, on: { "click": function($event) {
8841
8428
  return _setup.handleSwitchMode("preview");
@@ -8863,22 +8450,22 @@ var _sfc_render$8 = function render38() {
8863
8450
  _setup.onBtnHover($event, _setup.isCollapsed ? _setup.t("common.expand") || "Expand" : _setup.t("common.collapse") || "Collapse");
8864
8451
  }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "w-3 h-3", style: { rotate: _setup.isCollapsed ? "0deg" : "90deg" }, attrs: { "xmlns": "http://www.w3.org/2000/svg", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "m9 18l6-6l-6-6" } })])]) : _vm._e()])]) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed, expression: "!isCollapsed" }], ref: "bodyRef", staticClass: "d2-block-body", style: _setup.bodyStyle }, [_setup.props.loading && !_setup.hasPreview ? _c("div", { staticClass: "d2-source px-4 py-4" }, [_c("pre", { staticClass: "d2-code" }, [_c("code", [_vm._v(_vm._s(_setup.baseCode))])]), _setup.renderError ? _c("p", { staticClass: "d2-error mt-2 text-xs" }, [_vm._v(" " + _vm._s(_setup.renderError) + " ")]) : _vm._e()]) : _c("div", [_setup.showSourceFallback ? _c("div", { staticClass: "d2-source px-4 py-4" }, [_c("pre", { staticClass: "d2-code" }, [_c("code", [_vm._v(_vm._s(_setup.baseCode))])]), _setup.renderError ? _c("p", { staticClass: "d2-error mt-2 text-xs" }, [_vm._v(" " + _vm._s(_setup.renderError) + " ")]) : _vm._e()]) : _c("div", { staticClass: "d2-render", style: _setup.renderStyle }, [_c("div", { staticClass: "d2-svg", domProps: { "innerHTML": _vm._s(_setup.svgMarkup) } }), _setup.renderError ? _c("p", { staticClass: "d2-error px-4 pb-3 text-xs" }, [_vm._v(" " + _vm._s(_setup.renderError) + " ")]) : _vm._e()])])])]);
8865
8452
  };
8866
- var _sfc_staticRenderFns$8 = [function() {
8453
+ var _sfc_staticRenderFns$7 = [function() {
8867
8454
  var _vm = this, _c = _vm._self._c;
8868
8455
  _vm._self._setupProxy;
8869
8456
  return _c("div", { staticClass: "flex items-center gap-x-2" }, [_c("span", { staticClass: "text-sm font-medium font-mono" }, [_vm._v("D2")])]);
8870
8457
  }];
8871
- var __component__$8 = /* @__PURE__ */ normalizeComponent(
8872
- _sfc_main$8,
8873
- _sfc_render$8,
8874
- _sfc_staticRenderFns$8,
8458
+ var __component__$7 = /* @__PURE__ */ normalizeComponent(
8459
+ _sfc_main$7,
8460
+ _sfc_render$7,
8461
+ _sfc_staticRenderFns$7,
8875
8462
  false,
8876
8463
  null,
8877
8464
  "fdf24c90",
8878
8465
  null,
8879
8466
  null
8880
8467
  );
8881
- const D2BlockNode = __component__$8.exports;
8468
+ const D2BlockNode = __component__$7.exports;
8882
8469
  D2BlockNode.install = (app) => {
8883
8470
  app.component(D2BlockNode.__name, D2BlockNode);
8884
8471
  };
@@ -8914,7 +8501,7 @@ function getInfographic() {
8914
8501
  return infographicPromise;
8915
8502
  });
8916
8503
  }
8917
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8504
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8918
8505
  __name: "InfographicBlockNode",
8919
8506
  props: {
8920
8507
  node: null,
@@ -9281,7 +8868,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
9281
8868
  }
9282
8869
  });
9283
8870
  const InfographicBlockNode_vue_vue_type_style_index_0_scoped_4fbaa9a8_lang = "";
9284
- var _sfc_render$7 = function render39() {
8871
+ var _sfc_render$6 = function render39() {
9285
8872
  var _a2;
9286
8873
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
9287
8874
  return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
@@ -9347,956 +8934,46 @@ var _sfc_render$7 = function render39() {
9347
8934
  return _setup.stopDrag.apply(null, arguments);
9348
8935
  } } })])]) : _vm._e()])], 1)])], 1);
9349
8936
  };
9350
- var _sfc_staticRenderFns$7 = [];
9351
- var __component__$7 = /* @__PURE__ */ normalizeComponent(
9352
- _sfc_main$7,
9353
- _sfc_render$7,
9354
- _sfc_staticRenderFns$7,
8937
+ var _sfc_staticRenderFns$6 = [];
8938
+ var __component__$6 = /* @__PURE__ */ normalizeComponent(
8939
+ _sfc_main$6,
8940
+ _sfc_render$6,
8941
+ _sfc_staticRenderFns$6,
9355
8942
  false,
9356
8943
  null,
9357
8944
  "4fbaa9a8",
9358
8945
  null,
9359
8946
  null
9360
8947
  );
9361
- const InfographicBlockNode = __component__$7.exports;
9362
- function isDevEnvironment() {
9363
- const viteEnv = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false };
9364
- return viteEnv.DEV;
9365
- }
9366
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
9367
- __name: "MarkdownCodeBlockNode",
8948
+ const InfographicBlockNode = __component__$6.exports;
8949
+ const _sfc_main$5 = defineComponent({
8950
+ name: "MarkdownRender",
8951
+ components: {
8952
+ LegacyNodesRenderer,
8953
+ NodeRenderer
8954
+ },
9368
8955
  props: {
9369
- node: {
9370
- type: Object,
9371
- required: true
8956
+ content: String,
8957
+ nodes: Array,
8958
+ final: Boolean,
8959
+ parseOptions: Object,
8960
+ customMarkdownIt: Function,
8961
+ debugPerformance: Boolean,
8962
+ customHtmlTags: Array,
8963
+ viewportPriority: Boolean,
8964
+ codeBlockStream: {
8965
+ type: Boolean,
8966
+ default: true
9372
8967
  },
9373
- loading: { type: Boolean, default: true },
9374
- stream: { type: Boolean, default: true },
9375
- darkTheme: { type: String, default: "vitesse-dark" },
9376
- lightTheme: { type: String, default: "vitesse-light" },
9377
- isDark: { type: Boolean, default: false },
9378
- isShowPreview: { type: Boolean, default: true },
9379
- enableFontSizeControl: { type: Boolean, default: true },
9380
- minWidth: { type: [String, Number], default: void 0 },
9381
- maxWidth: { type: [String, Number], default: void 0 },
9382
- themes: { type: Array, default: void 0 },
9383
- langs: { type: Array, default: void 0 },
9384
- showHeader: { type: Boolean, default: true },
9385
- showCopyButton: { type: Boolean, default: true },
9386
- showExpandButton: { type: Boolean, default: true },
9387
- showPreviewButton: { type: Boolean, default: true },
9388
- showCollapseButton: { type: Boolean, default: true },
9389
- showFontSizeButtons: { type: Boolean, default: true },
9390
- showTooltips: { type: Boolean, default: void 0 }
9391
- },
9392
- emits: ["previewCode", "copy"],
9393
- setup(__props, { emit: emits }) {
9394
- const props = __props;
9395
- const { t } = useSafeI18n();
9396
- const codeLanguage = ref(normalizeLanguageIdentifier(props.node.language));
9397
- const copyText = ref(false);
9398
- const isExpanded = ref(false);
9399
- const isCollapsed = ref(false);
9400
- const container = ref(null);
9401
- const codeBlockContent = ref(null);
9402
- const rendererTarget = ref(null);
9403
- const fallbackHtml = ref("");
9404
- const rendererReady = ref(false);
9405
- const hasStableRender = ref(false);
9406
- let renderObserver;
9407
- let lastCommittedRenderSignature = "";
9408
- let rendererMutationVersion = 0;
9409
- let pendingRenderSignature = null;
9410
- const autoScrollEnabled = ref(true);
9411
- const lastScrollTop = ref(0);
9412
- const codeFontMin = 10;
9413
- const codeFontMax = 36;
9414
- const codeFontStep = 1;
9415
- const defaultCodeFontSize = ref(14);
9416
- const codeFontSize = ref(defaultCodeFontSize.value);
9417
- const fontBaselineReady = computed(() => {
9418
- const a = defaultCodeFontSize.value;
9419
- const b = codeFontSize.value;
9420
- return typeof a === "number" && Number.isFinite(a) && a > 0 && typeof b === "number" && Number.isFinite(b) && b > 0;
9421
- });
9422
- const displayLanguage = computed(() => {
9423
- const lang = codeLanguage.value.trim().toLowerCase();
9424
- if (!lang)
9425
- return languageMap[""] || "Plain Text";
9426
- return languageMap[lang] || lang.charAt(0).toUpperCase() + lang.slice(1);
9427
- });
9428
- const languageIcon = computed(() => {
9429
- void languageIconsRevision.value;
9430
- const lang = codeLanguage.value.trim().toLowerCase();
9431
- return getLanguageIcon(lang.split(":")[0]);
9432
- });
9433
- const isPreviewable = computed(() => {
9434
- const lang = codeLanguage.value.trim().toLowerCase();
9435
- return props.isShowPreview && (lang === "html" || lang === "svg");
9436
- });
9437
- const containerStyle = computed(() => {
9438
- const s = {};
9439
- const fmt = (v) => {
9440
- if (v == null)
9441
- return void 0;
9442
- return typeof v === "number" ? `${v}px` : String(v);
9443
- };
9444
- const min = fmt(props.minWidth);
9445
- const max = fmt(props.maxWidth);
9446
- if (min)
9447
- s.minWidth = min;
9448
- if (max)
9449
- s.maxWidth = max;
9450
- return s;
9451
- });
9452
- const contentStyle = computed(() => {
9453
- return {
9454
- fontSize: `${codeFontSize.value}px`
9455
- };
9456
- });
9457
- const tooltipsEnabled = computed(() => props.showTooltips !== false);
9458
- function getPreferredColorScheme() {
9459
- return props.isDark ? props.darkTheme : props.lightTheme;
9460
- }
9461
- function getResolvedThemes() {
9462
- return props.themes;
9463
- }
9464
- function getColorChannels(color) {
9465
- const match = color.match(/\d+(\.\d+)?/g);
9466
- if (!match || match.length < 3)
9467
- return null;
9468
- return match.slice(0, 3).map(Number);
9469
- }
9470
- function getRelativeLuminance(color) {
9471
- const channels = getColorChannels(color);
9472
- if (!channels)
9473
- return null;
9474
- const normalized = channels.map((channel) => {
9475
- const value = channel / 255;
9476
- return value <= 0.03928 ? value / 12.92 : __pow((value + 0.055) / 1.055, 2.4);
9477
- });
9478
- return 0.2126 * normalized[0] + 0.7152 * normalized[1] + 0.0722 * normalized[2];
9479
- }
9480
- function getContrastRatio(foreground, background) {
9481
- const fg = getRelativeLuminance(foreground);
9482
- const bg = getRelativeLuminance(background);
9483
- if (fg == null || bg == null)
9484
- return null;
9485
- const lighter = Math.max(fg, bg);
9486
- const darker = Math.min(fg, bg);
9487
- return (lighter + 0.05) / (darker + 0.05);
9488
- }
9489
- function isDarkBackgroundColor(color) {
9490
- const channels = getColorChannels(color);
9491
- if (!channels)
9492
- return props.isDark;
9493
- const [r, g, b] = channels;
9494
- const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
9495
- return luminance < 140;
9496
- }
9497
- function syncRenderedCssVars() {
9498
- var _a2;
9499
- if (typeof window === "undefined" || typeof window.getComputedStyle !== "function")
9500
- return;
9501
- const rootEl = container.value;
9502
- const target = rendererTarget.value;
9503
- if (!rootEl || !target)
9504
- return;
9505
- const preEl = target.querySelector(".shiki") || target.querySelector("pre");
9506
- if (!preEl)
9507
- return;
9508
- const preStyles = window.getComputedStyle(preEl);
9509
- const codeEl = preEl.querySelector("code") || preEl;
9510
- const codeStyles = window.getComputedStyle(codeEl);
9511
- const bg = String(preStyles.backgroundColor || "").trim();
9512
- const detectedFg = String(codeStyles.color || preStyles.color || "").trim();
9513
- if (bg)
9514
- rootEl.style.setProperty("--vscode-editor-background", bg);
9515
- const darkBg = bg ? isDarkBackgroundColor(bg) : props.isDark;
9516
- const fallbackFg = darkBg ? "rgb(229, 231, 235)" : "rgb(17, 24, 39)";
9517
- const resolvedFg = bg && detectedFg && ((_a2 = getContrastRatio(detectedFg, bg)) != null ? _a2 : 0) >= 3 ? detectedFg : fallbackFg;
9518
- rootEl.style.setProperty("--vscode-editor-foreground", resolvedFg);
9519
- rootEl.style.setProperty("--markstream-code-fallback-selection-bg", darkBg ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.06)");
9520
- rootEl.style.setProperty("--vscode-editor-selectionBackground", `var(--markstream-code-fallback-selection-bg)`);
9521
- }
9522
- function escapeHtml2(str) {
9523
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
9524
- }
9525
- function renderFallback(code, force = false) {
9526
- var _a2;
9527
- pendingRenderSignature = null;
9528
- disconnectReadyObserver();
9529
- const fallbackEl = (_a2 = codeBlockContent.value) == null ? void 0 : _a2.querySelector(".code-fallback-plain");
9530
- fallbackEl == null ? void 0 : fallbackEl.style.removeProperty("display");
9531
- if (!code) {
9532
- clearRendererTarget();
9533
- fallbackHtml.value = "";
9534
- rendererReady.value = false;
9535
- hasStableRender.value = false;
9536
- lastCommittedRenderSignature = "";
9537
- return;
9538
- }
9539
- if (!force && hasStableRender.value) {
9540
- fallbackHtml.value = "";
9541
- rendererReady.value = true;
9542
- return;
9543
- }
9544
- fallbackHtml.value = `<pre class="shiki shiki-fallback"><code>${escapeHtml2(code)}</code></pre>`;
9545
- rendererReady.value = false;
9546
- }
9547
- function clearFallback() {
9548
- var _a2;
9549
- fallbackHtml.value = "";
9550
- rendererReady.value = true;
9551
- hasStableRender.value = true;
9552
- const fallbackEl = (_a2 = codeBlockContent.value) == null ? void 0 : _a2.querySelector(".code-fallback-plain");
9553
- if (fallbackEl)
9554
- fallbackEl.style.display = "none";
9555
- void nextTick().then(() => __async(this, null, function* () {
9556
- yield nextTick();
9557
- if (!fallbackHtml.value && rendererReady.value) {
9558
- rendererReady.value = false;
9559
- rendererReady.value = true;
9560
- }
9561
- syncRenderedCssVars();
9562
- }));
9563
- }
9564
- function keepLastSuccessfulRender() {
9565
- pendingRenderSignature = null;
9566
- disconnectReadyObserver();
9567
- if (!hasStableRender.value)
9568
- return;
9569
- fallbackHtml.value = "";
9570
- rendererReady.value = true;
9571
- }
9572
- function clearRendererTarget() {
9573
- if (rendererTarget.value)
9574
- rendererTarget.value.innerHTML = "";
9575
- }
9576
- function hasRendererContent() {
9577
- var _a2;
9578
- const target = rendererTarget.value;
9579
- if (!target)
9580
- return false;
9581
- if (target.childNodes.length > 0)
9582
- return true;
9583
- return Boolean((_a2 = target.textContent) == null ? void 0 : _a2.trim().length);
9584
- }
9585
- function getRenderSignature(configKey, lang, code) {
9586
- return `${configKey != null ? configKey : ""}\0${lang}\0${code}`;
9587
- }
9588
- function markRendererCommitted(renderSignature) {
9589
- lastCommittedRenderSignature = renderSignature;
9590
- clearFallback();
9591
- }
9592
- function disconnectReadyObserver(observer) {
9593
- observer == null ? void 0 : observer.disconnect();
9594
- if (!observer || renderObserver === observer)
9595
- renderObserver = void 0;
9596
- }
9597
- function startRendererReadyObserver(epoch, previousVersion) {
9598
- disconnectReadyObserver();
9599
- const target = rendererTarget.value;
9600
- if (!target || typeof MutationObserver === "undefined")
9601
- return;
9602
- pendingRenderSignature = null;
9603
- const observer = new MutationObserver(() => {
9604
- rendererMutationVersion += 1;
9605
- const signature = pendingRenderSignature;
9606
- if (!signature)
9607
- return;
9608
- if (!isCurrentRenderEpoch(epoch)) {
9609
- pendingRenderSignature = null;
9610
- disconnectReadyObserver(observer);
9611
- return;
9612
- }
9613
- if (rendererMutationVersion === previousVersion || !hasRendererContent())
9614
- return;
9615
- pendingRenderSignature = null;
9616
- disconnectReadyObserver(observer);
9617
- markRendererCommitted(signature);
9618
- });
9619
- renderObserver = observer;
9620
- observer.observe(target, {
9621
- childList: true,
9622
- subtree: true,
9623
- characterData: true,
9624
- attributes: true
9625
- });
9626
- }
9627
- function clearFallbackWhenRendererReady(epoch, previousVersion, renderSignature, previousRendererHtml) {
9628
- return __async(this, null, function* () {
9629
- var _a2;
9630
- pendingRenderSignature = renderSignature;
9631
- yield nextTick();
9632
- if (!isCurrentRenderEpoch(epoch))
9633
- return;
9634
- const rendererHasContent = hasRendererContent();
9635
- const hasObservedMutation = rendererMutationVersion !== previousVersion;
9636
- const hasDomSnapshotChange = previousRendererHtml !== void 0 && ((_a2 = rendererTarget.value) == null ? void 0 : _a2.innerHTML) !== previousRendererHtml;
9637
- if (rendererHasContent && (!lastCommittedRenderSignature || hasObservedMutation || hasDomSnapshotChange || lastCommittedRenderSignature === renderSignature)) {
9638
- pendingRenderSignature = null;
9639
- disconnectReadyObserver();
9640
- markRendererCommitted(renderSignature);
9641
- }
9642
- });
9643
- }
9644
- let renderer;
9645
- let rendererConfigKey = null;
9646
- let rendererTheme;
9647
- let rendererThemeSyncQueued = false;
9648
- let rendererThemeObserver;
9649
- let createShikiRenderer;
9650
- let registerHighlight;
9651
- let registeredHighlightKey = null;
9652
- let latestHighlightRegistrationKey = "";
9653
- let highlightRegistrationSeq = 0;
9654
- let renderEpoch = 0;
9655
- let disposed = false;
9656
- const warnedRendererErrors = /* @__PURE__ */ new Set();
9657
- const failedRendererLanguages = /* @__PURE__ */ new Set();
9658
- const failedHighlightRegistrationKeys = /* @__PURE__ */ new Set();
9659
- const isDevEnv2 = isDevEnvironment();
9660
- let warnedMissingRegisterHighlightForLangs = false;
9661
- let streamMarkdownLoadPromise = null;
9662
- let streamMarkdownLoadFailed = false;
9663
- let warnedStreamMarkdownUnavailable = false;
9664
- function nextRenderEpoch() {
9665
- renderEpoch += 1;
9666
- return renderEpoch;
9667
- }
9668
- function isCurrentRenderEpoch(epoch = renderEpoch) {
9669
- return !disposed && epoch === renderEpoch;
9670
- }
9671
- function disposeCurrentRenderer(options = {}) {
9672
- const current = renderer;
9673
- renderer = void 0;
9674
- rendererConfigKey = null;
9675
- rendererTheme = void 0;
9676
- lastCommittedRenderSignature = "";
9677
- pendingRenderSignature = null;
9678
- failedRendererLanguages.clear();
9679
- try {
9680
- current == null ? void 0 : current.dispose();
9681
- } catch (err) {
9682
- if (isDevEnv2)
9683
- console.warn("[MarkdownCodeBlockNode] Failed to dispose Shiki renderer.", err);
9684
- } finally {
9685
- clearRendererTarget();
9686
- rendererReady.value = false;
9687
- if (options.resetStableRender)
9688
- hasStableRender.value = false;
9689
- }
9690
- }
9691
- function syncRendererTheme() {
9692
- return __async(this, null, function* () {
9693
- if (!renderer)
9694
- return;
9695
- const theme = getRenderedColorScheme();
9696
- if (rendererTheme === theme)
9697
- return;
9698
- yield renderer.setTheme(theme);
9699
- rendererTheme = theme;
9700
- });
9701
- }
9702
- function queueRendererThemeChange() {
9703
- const theme = getRenderedColorScheme();
9704
- if (!renderer || theme === rendererTheme || rendererThemeSyncQueued)
9705
- return;
9706
- rendererThemeSyncQueued = true;
9707
- void nextTick(() => {
9708
- rendererThemeSyncQueued = false;
9709
- void handleRendererThemeChange();
9710
- });
9711
- }
9712
- function startRendererThemeObserver() {
9713
- if (rendererThemeObserver || typeof MutationObserver === "undefined")
9714
- return;
9715
- const rootEl = container.value;
9716
- if (!rootEl)
9717
- return;
9718
- rendererThemeObserver = new MutationObserver(() => {
9719
- queueRendererThemeChange();
9720
- });
9721
- rendererThemeObserver.observe(rootEl, {
9722
- attributes: true,
9723
- attributeFilter: ["data-markstream-code-theme"]
9724
- });
9725
- }
9726
- function disconnectRendererThemeObserver() {
9727
- rendererThemeObserver == null ? void 0 : rendererThemeObserver.disconnect();
9728
- rendererThemeObserver = void 0;
9729
- }
9730
- function getRenderedColorScheme() {
9731
- var _a2;
9732
- return ((_a2 = container.value) == null ? void 0 : _a2.getAttribute("data-markstream-code-theme")) || getPreferredColorScheme();
9733
- }
9734
- const highlightRegistrationKey = computed(
9735
- () => getHighlightRegistrationKey(getResolvedThemes(), props.langs)
9736
- );
9737
- function getShikiRuntimeCapabilities() {
9738
- return {
9739
- hasRegisterHighlight: Boolean(registerHighlight),
9740
- hasCreateRenderer: Boolean(createShikiRenderer)
9741
- };
9742
- }
9743
- function getRuntimeConfigWithFailedLangsFallback(themes, langs) {
9744
- var _a2;
9745
- const capabilities = getShikiRuntimeCapabilities();
9746
- const runtimeConfig = getRuntimeShikiRegistrationConfig(themes, langs, capabilities);
9747
- if (((_a2 = runtimeConfig.rendererOptions.langs) == null ? void 0 : _a2.length) && failedHighlightRegistrationKeys.has(runtimeConfig.key)) {
9748
- return getRuntimeShikiRegistrationConfig(themes, void 0, capabilities);
9749
- }
9750
- return runtimeConfig;
9751
- }
9752
- function rendererNeedsReconfigure() {
9753
- const runtimeConfig = getRuntimeConfigWithFailedLangsFallback(getResolvedThemes(), props.langs);
9754
- return Boolean(renderer && rendererConfigKey !== runtimeConfig.key);
9755
- }
9756
- function normalizeRendererLanguage(rawLang) {
9757
- const normalized = normalizeShikiLanguage(rawLang);
9758
- return normalized || "plaintext";
9759
- }
9760
- function updateRendererWithFallback(_0, _1) {
9761
- return __async(this, arguments, function* (code, rawLang, epoch = renderEpoch) {
9762
- if (!renderer || !isCurrentRenderEpoch(epoch))
9763
- return void 0;
9764
- const normalized = normalizeRendererLanguage(rawLang);
9765
- const renderPlaintext = (originalError) => __async(this, null, function* () {
9766
- if (!renderer || !isCurrentRenderEpoch(epoch))
9767
- return void 0;
9768
- if (normalized !== "plaintext") {
9769
- if (originalError)
9770
- failedRendererLanguages.add(normalized);
9771
- if (originalError && isDevEnv2 && !warnedRendererErrors.has(normalized)) {
9772
- warnedRendererErrors.add(normalized);
9773
- console.warn(`[MarkdownCodeBlockNode] Failed to render language "${normalized}", retrying as plaintext.`, originalError);
9774
- }
9775
- }
9776
- try {
9777
- yield renderer.updateCode(code, "plaintext");
9778
- return isCurrentRenderEpoch(epoch) ? "plaintext" : void 0;
9779
- } catch (plainErr) {
9780
- if (!isCurrentRenderEpoch(epoch))
9781
- return void 0;
9782
- if (isDevEnv2)
9783
- console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", plainErr);
9784
- return void 0;
9785
- }
9786
- });
9787
- if (normalized !== "plaintext" && failedRendererLanguages.has(normalized))
9788
- return renderPlaintext();
9789
- try {
9790
- yield renderer.updateCode(code, normalized);
9791
- return isCurrentRenderEpoch(epoch) ? normalized : void 0;
9792
- } catch (err) {
9793
- if (!isCurrentRenderEpoch(epoch))
9794
- return void 0;
9795
- if (normalized !== "plaintext")
9796
- return renderPlaintext(err);
9797
- if (isDevEnv2)
9798
- console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", err);
9799
- return void 0;
9800
- }
9801
- });
9802
- }
9803
- function ensureHighlightRegistered(registerOptions, key) {
9804
- return __async(this, null, function* () {
9805
- if (!registerHighlight)
9806
- return "ready";
9807
- if (latestHighlightRegistrationKey !== key)
9808
- return "stale";
9809
- if (registeredHighlightKey === key)
9810
- return "ready";
9811
- const seq = ++highlightRegistrationSeq;
9812
- try {
9813
- yield registerHighlightOnce(registerHighlight, registerOptions, key);
9814
- } catch (e) {
9815
- if (seq !== highlightRegistrationSeq || latestHighlightRegistrationKey !== key)
9816
- return "stale";
9817
- return "failed";
9818
- }
9819
- if (seq !== highlightRegistrationSeq || latestHighlightRegistrationKey !== key)
9820
- return "stale";
9821
- registeredHighlightKey = key;
9822
- return "ready";
9823
- });
9824
- }
9825
- function waitForCurrentHighlightRegistration(registerOptions, key) {
9826
- return __async(this, null, function* () {
9827
- const status = yield ensureHighlightRegistered(registerOptions, key);
9828
- if (status !== "failed")
9829
- return status;
9830
- if (latestHighlightRegistrationKey !== key)
9831
- return "stale";
9832
- return ensureHighlightRegistered(registerOptions, key);
9833
- });
9834
- }
9835
- function ensureStreamMarkdownLoaded() {
9836
- return __async(this, null, function* () {
9837
- if (createShikiRenderer || streamMarkdownLoadFailed)
9838
- return;
9839
- if (streamMarkdownLoadPromise)
9840
- return streamMarkdownLoadPromise;
9841
- streamMarkdownLoadPromise = (() => __async(this, null, function* () {
9842
- try {
9843
- const mod2 = yield import("stream-markdown");
9844
- const nextCreateRenderer = mod2.createShikiStreamRenderer;
9845
- if (typeof nextCreateRenderer !== "function")
9846
- throw new TypeError("stream-markdown.createShikiStreamRenderer is not available");
9847
- createShikiRenderer = nextCreateRenderer;
9848
- const nextRegisterHighlight = mod2.registerHighlight;
9849
- registerHighlight = typeof nextRegisterHighlight === "function" ? nextRegisterHighlight : void 0;
9850
- streamMarkdownLoadFailed = false;
9851
- warnedStreamMarkdownUnavailable = false;
9852
- } catch (e) {
9853
- streamMarkdownLoadFailed = true;
9854
- if (isDevEnv2 && !warnedStreamMarkdownUnavailable) {
9855
- warnedStreamMarkdownUnavailable = true;
9856
- console.warn("[MarkdownCodeBlockNode] stream-markdown not available:", e);
9857
- }
9858
- } finally {
9859
- streamMarkdownLoadPromise = null;
9860
- }
9861
- }))();
9862
- return streamMarkdownLoadPromise;
9863
- });
9864
- }
9865
- function initRenderer(epoch) {
9866
- return __async(this, null, function* () {
9867
- var _a2, _b;
9868
- if (!isCurrentRenderEpoch(epoch))
9869
- return;
9870
- yield ensureStreamMarkdownLoaded();
9871
- if (!isCurrentRenderEpoch(epoch))
9872
- return;
9873
- if (!codeBlockContent.value || !rendererTarget.value) {
9874
- renderFallback(props.node.code, true);
9875
- return;
9876
- }
9877
- let runtimeConfig = getRuntimeConfigWithFailedLangsFallback(getResolvedThemes(), props.langs);
9878
- if (runtimeConfig.ignoredLangs && isDevEnv2 && !warnedMissingRegisterHighlightForLangs) {
9879
- warnedMissingRegisterHighlightForLangs = true;
9880
- console.warn(
9881
- "[MarkdownCodeBlockNode] `langs` requires stream-markdown >=0.0.15 with registerHighlight(); ignoring `langs` and using stream-markdown default language preload."
9882
- );
9883
- }
9884
- let rendererOptions = runtimeConfig.rendererOptions;
9885
- let nextRendererConfigKey = runtimeConfig.key;
9886
- latestHighlightRegistrationKey = nextRendererConfigKey;
9887
- let needsRendererReconfigure = Boolean(renderer && rendererConfigKey !== nextRendererConfigKey);
9888
- if (needsRendererReconfigure)
9889
- renderFallback(props.node.code, !hasStableRender.value);
9890
- let highlightStatus = yield waitForCurrentHighlightRegistration(runtimeConfig.registerOptions, nextRendererConfigKey);
9891
- if (highlightStatus === "failed" && ((_a2 = rendererOptions.langs) == null ? void 0 : _a2.length)) {
9892
- failedHighlightRegistrationKeys.add(nextRendererConfigKey);
9893
- if (isDevEnv2) {
9894
- console.warn(
9895
- "[MarkdownCodeBlockNode] Failed to register configured Shiki languages; retrying without `langs`.",
9896
- { langs: rendererOptions.langs }
9897
- );
9898
- }
9899
- runtimeConfig = getRuntimeShikiRegistrationConfig(getResolvedThemes(), void 0, getShikiRuntimeCapabilities());
9900
- rendererOptions = runtimeConfig.rendererOptions;
9901
- nextRendererConfigKey = runtimeConfig.key;
9902
- latestHighlightRegistrationKey = nextRendererConfigKey;
9903
- highlightStatus = yield waitForCurrentHighlightRegistration(runtimeConfig.registerOptions, nextRendererConfigKey);
9904
- }
9905
- if (!isCurrentRenderEpoch(epoch) || highlightStatus === "stale")
9906
- return;
9907
- needsRendererReconfigure = Boolean(renderer && rendererConfigKey !== nextRendererConfigKey);
9908
- if (highlightStatus === "failed") {
9909
- if (needsRendererReconfigure && renderer && hasRendererContent())
9910
- clearFallback();
9911
- else
9912
- renderFallback(props.node.code, true);
9913
- return;
9914
- }
9915
- if (needsRendererReconfigure)
9916
- disposeCurrentRenderer({ resetStableRender: true });
9917
- if (!renderer && createShikiRenderer) {
9918
- const theme = getRenderedColorScheme();
9919
- renderer = createShikiRenderer(rendererTarget.value, __spreadValues({
9920
- theme
9921
- }, rendererOptions));
9922
- rendererTheme = theme;
9923
- rendererConfigKey = nextRendererConfigKey;
9924
- rendererReady.value = true;
9925
- }
9926
- if (!renderer) {
9927
- renderFallback(props.node.code, true);
9928
- return;
9929
- }
9930
- if (props.stream === false && props.loading) {
9931
- renderFallback(props.node.code, !hasStableRender.value);
9932
- return;
9933
- }
9934
- renderFallback(props.node.code, !hasStableRender.value);
9935
- const previousMutationVersion = rendererMutationVersion;
9936
- const previousRendererHtml = (_b = rendererTarget.value) == null ? void 0 : _b.innerHTML;
9937
- startRendererReadyObserver(epoch, previousMutationVersion);
9938
- const renderedLang = yield updateRendererWithFallback(props.node.code, props.node.language, epoch);
9939
- if (!isCurrentRenderEpoch(epoch))
9940
- return;
9941
- if (!renderedLang) {
9942
- pendingRenderSignature = null;
9943
- disconnectReadyObserver();
9944
- keepLastSuccessfulRender();
9945
- return;
9946
- }
9947
- if (hasStableRender.value) {
9948
- keepLastSuccessfulRender();
9949
- } else {
9950
- yield clearFallbackWhenRendererReady(
9951
- epoch,
9952
- previousMutationVersion,
9953
- getRenderSignature(nextRendererConfigKey, renderedLang, props.node.code),
9954
- previousRendererHtml
9955
- );
9956
- }
9957
- });
9958
- }
9959
- function safeInitRenderer() {
9960
- return __async(this, arguments, function* (epoch = nextRenderEpoch()) {
9961
- try {
9962
- yield initRenderer(epoch);
9963
- } catch (err) {
9964
- if (!isCurrentRenderEpoch(epoch))
9965
- return;
9966
- if (isDevEnv2)
9967
- console.warn("[MarkdownCodeBlockNode] Failed to initialize Shiki renderer.", err);
9968
- renderFallback(props.node.code, !hasStableRender.value);
9969
- }
9970
- });
9971
- }
9972
- function cleanupRenderer() {
9973
- disposed = true;
9974
- renderEpoch += 1;
9975
- renderObserver == null ? void 0 : renderObserver.disconnect();
9976
- renderObserver = void 0;
9977
- disconnectRendererThemeObserver();
9978
- pendingRenderSignature = null;
9979
- disposeCurrentRenderer({ resetStableRender: true });
9980
- }
9981
- renderFallback(props.node.code, true);
9982
- if (getCurrentInstance()) {
9983
- onMounted(() => {
9984
- startRendererThemeObserver();
9985
- void safeInitRenderer();
9986
- });
9987
- onBeforeUnmount(cleanupRenderer);
9988
- } else {
9989
- void nextTick(() => __async(this, null, function* () {
9990
- yield nextTick();
9991
- startRendererThemeObserver();
9992
- yield safeInitRenderer();
9993
- if (!lastCommittedRenderSignature && hasRendererContent()) {
9994
- markRendererCommitted(
9995
- getRenderSignature(
9996
- rendererConfigKey != null ? rendererConfigKey : highlightRegistrationKey.value,
9997
- normalizeRendererLanguage(props.node.language),
9998
- props.node.code
9999
- )
10000
- );
10001
- }
10002
- }));
10003
- }
10004
- watch(highlightRegistrationKey, () => __async(this, null, function* () {
10005
- yield safeInitRenderer();
10006
- }));
10007
- watch(() => props.loading, (loading) => {
10008
- if (loading)
10009
- return;
10010
- void safeInitRenderer();
10011
- });
10012
- watch(tooltipsEnabled, (enabled) => {
10013
- if (!enabled)
10014
- hideTooltip();
10015
- });
10016
- watch(() => [props.node.code, props.node.language], (_0) => __async(this, [_0], function* ([code, lang]) {
10017
- var _a2;
10018
- const epoch = nextRenderEpoch();
10019
- const normalizedLang = normalizeLanguageIdentifier(lang);
10020
- if (normalizedLang !== codeLanguage.value)
10021
- codeLanguage.value = normalizedLang;
10022
- if (!codeBlockContent.value || !rendererTarget.value) {
10023
- renderFallback(code, true);
10024
- return;
10025
- }
10026
- if (!code) {
10027
- renderFallback("");
10028
- return;
10029
- }
10030
- if (!renderer || rendererNeedsReconfigure()) {
10031
- renderFallback(code, !hasStableRender.value);
10032
- yield safeInitRenderer(epoch);
10033
- return;
10034
- }
10035
- if (!isCurrentRenderEpoch(epoch))
10036
- return;
10037
- if (!renderer)
10038
- return;
10039
- if (props.stream === false && props.loading)
10040
- return;
10041
- renderFallback(code, !hasStableRender.value);
10042
- const previousMutationVersion = rendererMutationVersion;
10043
- const previousRendererHtml = (_a2 = rendererTarget.value) == null ? void 0 : _a2.innerHTML;
10044
- startRendererReadyObserver(epoch, previousMutationVersion);
10045
- const renderedLang = yield updateRendererWithFallback(code, lang, epoch);
10046
- if (!isCurrentRenderEpoch(epoch))
10047
- return;
10048
- if (!renderedLang) {
10049
- pendingRenderSignature = null;
10050
- disconnectReadyObserver();
10051
- keepLastSuccessfulRender();
10052
- return;
10053
- }
10054
- if (hasStableRender.value) {
10055
- keepLastSuccessfulRender();
10056
- } else {
10057
- yield clearFallbackWhenRendererReady(
10058
- epoch,
10059
- previousMutationVersion,
10060
- getRenderSignature(rendererConfigKey != null ? rendererConfigKey : highlightRegistrationKey.value, renderedLang, code),
10061
- previousRendererHtml
10062
- );
10063
- }
10064
- }));
10065
- function handleRendererThemeChange() {
10066
- return __async(this, null, function* () {
10067
- if (!codeBlockContent.value || !rendererTarget.value)
10068
- return;
10069
- if (!renderer)
10070
- yield safeInitRenderer();
10071
- yield syncRendererTheme();
10072
- syncRenderedCssVars();
10073
- });
10074
- }
10075
- watch(() => props.node.code, () => __async(this, null, function* () {
10076
- if (isExpanded.value || !autoScrollEnabled.value)
10077
- return;
10078
- yield nextTick();
10079
- const content2 = codeBlockContent.value;
10080
- if (!content2)
10081
- return;
10082
- if (content2.scrollHeight > content2.clientHeight) {
10083
- content2.scrollTop = content2.scrollHeight;
10084
- }
10085
- }));
10086
- function isAtBottom(element, threshold = 50) {
10087
- return element.scrollHeight - element.scrollTop - element.clientHeight <= threshold;
10088
- }
10089
- function handleScroll() {
10090
- const content2 = codeBlockContent.value;
10091
- if (!content2 || isExpanded.value)
10092
- return;
10093
- const currentScrollTop = content2.scrollTop;
10094
- if (currentScrollTop < lastScrollTop.value) {
10095
- autoScrollEnabled.value = false;
10096
- } else if (isAtBottom(content2)) {
10097
- autoScrollEnabled.value = true;
10098
- }
10099
- lastScrollTop.value = currentScrollTop;
10100
- }
10101
- function copy() {
10102
- return __async(this, null, function* () {
10103
- try {
10104
- if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
10105
- yield navigator.clipboard.writeText(props.node.code);
10106
- }
10107
- copyText.value = true;
10108
- emits("copy", props.node.code);
10109
- setTimeout(() => {
10110
- copyText.value = false;
10111
- }, 1e3);
10112
- } catch (err) {
10113
- console.error("Copy failed:", err);
10114
- }
10115
- });
10116
- }
10117
- function resolveTooltipTarget(e) {
10118
- const btn = e.currentTarget || e.target;
10119
- if (!btn || btn.disabled)
10120
- return null;
10121
- return btn;
10122
- }
10123
- function onBtnHover(e, text, place = "top") {
10124
- if (!tooltipsEnabled.value)
10125
- return;
10126
- const target = resolveTooltipTarget(e);
10127
- if (!target)
10128
- return;
10129
- const ev = e;
10130
- const origin = (ev == null ? void 0 : ev.clientX) != null && (ev == null ? void 0 : ev.clientY) != null ? { x: ev.clientX, y: ev.clientY } : void 0;
10131
- showTooltipForAnchor(target, text, place, false, origin, props.isDark);
10132
- }
10133
- function onBtnLeave() {
10134
- if (!tooltipsEnabled.value)
10135
- return;
10136
- hideTooltip();
10137
- }
10138
- function onCopyHover(e) {
10139
- if (!tooltipsEnabled.value)
10140
- return;
10141
- const target = resolveTooltipTarget(e);
10142
- if (!target)
10143
- return;
10144
- const txt = copyText.value ? t("common.copied") || "Copied" : t("common.copy") || "Copy";
10145
- const ev = e;
10146
- const origin = (ev == null ? void 0 : ev.clientX) != null && (ev == null ? void 0 : ev.clientY) != null ? { x: ev.clientX, y: ev.clientY } : void 0;
10147
- showTooltipForAnchor(target, txt, "top", false, origin, props.isDark);
10148
- }
10149
- function toggleExpand(e) {
10150
- isExpanded.value = !isExpanded.value;
10151
- if (e && tooltipsEnabled.value) {
10152
- const target = resolveTooltipTarget(e);
10153
- if (target) {
10154
- const txt = isExpanded.value ? t("common.collapse") || "Collapse" : t("common.expand") || "Expand";
10155
- showTooltipForAnchor(target, txt, "top", false, void 0, props.isDark);
10156
- }
10157
- }
10158
- const content2 = codeBlockContent.value;
10159
- if (!content2)
10160
- return;
10161
- if (isExpanded.value) {
10162
- content2.style.maxHeight = "none";
10163
- content2.style["overflow-y"] = "visible";
10164
- content2.style["overflow-x"] = "auto";
10165
- } else {
10166
- content2.style.maxHeight = "500px";
10167
- content2.style.overflow = "auto";
10168
- autoScrollEnabled.value = true;
10169
- nextTick(() => {
10170
- if (content2.scrollHeight > content2.clientHeight) {
10171
- content2.scrollTop = content2.scrollHeight;
10172
- }
10173
- });
10174
- }
10175
- }
10176
- function toggleHeaderCollapse() {
10177
- isCollapsed.value = !isCollapsed.value;
10178
- }
10179
- function increaseCodeFont() {
10180
- const after = Math.min(codeFontMax, codeFontSize.value + codeFontStep);
10181
- codeFontSize.value = after;
10182
- }
10183
- function decreaseCodeFont() {
10184
- const after = Math.max(codeFontMin, codeFontSize.value - codeFontStep);
10185
- codeFontSize.value = after;
10186
- }
10187
- function resetCodeFont() {
10188
- codeFontSize.value = defaultCodeFontSize.value;
10189
- }
10190
- function previewCode() {
10191
- if (!isPreviewable.value)
10192
- return;
10193
- const lowerLang = normalizeLanguageIdentifier(codeLanguage.value || props.node.language).toLowerCase();
10194
- const artifactType = lowerLang === "html" ? "text/html" : "image/svg+xml";
10195
- const artifactTitle = lowerLang === "html" ? "HTML Preview" : "SVG Preview";
10196
- emits("previewCode", {
10197
- type: artifactType,
10198
- content: props.node.code,
10199
- title: artifactTitle
10200
- });
10201
- }
10202
- return { __sfc: true, props, emits, t, codeLanguage, copyText, isExpanded, isCollapsed, container, codeBlockContent, rendererTarget, fallbackHtml, rendererReady, hasStableRender, renderObserver, lastCommittedRenderSignature, rendererMutationVersion, pendingRenderSignature, autoScrollEnabled, lastScrollTop, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, displayLanguage, languageIcon, isPreviewable, containerStyle, contentStyle, tooltipsEnabled, getPreferredColorScheme, getResolvedThemes, getColorChannels, getRelativeLuminance, getContrastRatio, isDarkBackgroundColor, syncRenderedCssVars, escapeHtml: escapeHtml2, renderFallback, clearFallback, keepLastSuccessfulRender, clearRendererTarget, hasRendererContent, getRenderSignature, markRendererCommitted, disconnectReadyObserver, startRendererReadyObserver, clearFallbackWhenRendererReady, renderer, rendererConfigKey, rendererTheme, rendererThemeSyncQueued, rendererThemeObserver, createShikiRenderer, registerHighlight, registeredHighlightKey, latestHighlightRegistrationKey, highlightRegistrationSeq, renderEpoch, disposed, warnedRendererErrors, failedRendererLanguages, failedHighlightRegistrationKeys, isDevEnv: isDevEnv2, warnedMissingRegisterHighlightForLangs, streamMarkdownLoadPromise, streamMarkdownLoadFailed, warnedStreamMarkdownUnavailable, nextRenderEpoch, isCurrentRenderEpoch, disposeCurrentRenderer, syncRendererTheme, queueRendererThemeChange, startRendererThemeObserver, disconnectRendererThemeObserver, getRenderedColorScheme, highlightRegistrationKey, getShikiRuntimeCapabilities, getRuntimeConfigWithFailedLangsFallback, rendererNeedsReconfigure, normalizeRendererLanguage, updateRendererWithFallback, ensureHighlightRegistered, waitForCurrentHighlightRegistration, ensureStreamMarkdownLoaded, initRenderer, safeInitRenderer, cleanupRenderer, handleRendererThemeChange, isAtBottom, handleScroll, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, increaseCodeFont, decreaseCodeFont, resetCodeFont, previewCode };
10203
- }
10204
- });
10205
- const MarkdownCodeBlockNode_vue_vue_type_style_index_0_scoped_9bd302bf_lang = "";
10206
- var _sfc_render$6 = function render40() {
10207
- var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
10208
- return _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [_setup.props.isDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white", _setup.props.isDark ? "is-dark" : ""], style: __spreadProps(__spreadValues({}, _setup.containerStyle), {
10209
- backgroundColor: "var(--vscode-editor-background, var(--markstream-code-fallback-bg))",
10210
- color: "var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))"
10211
- }), attrs: { "data-markstream-code-theme": _setup.props.isDark ? _setup.props.darkTheme : _setup.props.lightTheme } }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header", staticStyle: { "color": "var(--code-fg, var(--markstream-code-fallback-fg))", "background-color": "var(--code-header-bg, transparent)" } }, [_vm._t("header-left", function() {
10212
- return [_c("div", { staticClass: "code-header-main" }, [_c("span", { staticClass: "icon-slot h-4 w-4 flex-shrink-0", domProps: { "innerHTML": _vm._s(_setup.languageIcon) } }), _c("div", { staticClass: "code-header-copy" }, [_c("div", { staticClass: "code-header-title" }, [_vm._v(" " + _vm._s(_setup.displayLanguage) + " ")])])])];
10213
- }), _vm._t("header-right", function() {
10214
- return [_c("div", { staticClass: "code-header-actions" }, [_setup.props.showCollapseButton ? _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "aria-pressed": _setup.isCollapsed }, on: { "click": _setup.toggleHeaderCollapse, "mouseenter": function($event) {
10215
- _setup.onBtnHover($event, _setup.isCollapsed ? _setup.t("common.expand") || "Expand" : _setup.t("common.collapse") || "Collapse");
10216
- }, "focus": function($event) {
10217
- _setup.onBtnHover($event, _setup.isCollapsed ? _setup.t("common.expand") || "Expand" : _setup.t("common.collapse") || "Collapse");
10218
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "action-icon", style: { rotate: _setup.isCollapsed ? "0deg" : "90deg" }, attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "m9 18l6-6l-6-6" } })])]) : _vm._e(), _setup.props.showFontSizeButtons && _setup.props.enableFontSizeControl ? [_c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "disabled": Number.isFinite(_setup.codeFontSize) ? _setup.codeFontSize <= _setup.codeFontMin : false }, on: { "click": function($event) {
10219
- return _setup.decreaseCodeFont();
10220
- }, "mouseenter": function($event) {
10221
- _setup.onBtnHover($event, _setup.t("common.decrease") || "Decrease");
10222
- }, "focus": function($event) {
10223
- _setup.onBtnHover($event, _setup.t("common.decrease") || "Decrease");
10224
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M5 12h14" } })])]), _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "disabled": !_setup.fontBaselineReady || _setup.codeFontSize === _setup.defaultCodeFontSize }, on: { "click": function($event) {
10225
- return _setup.resetCodeFont();
10226
- }, "mouseenter": function($event) {
10227
- _setup.onBtnHover($event, _setup.t("common.reset") || "Reset");
10228
- }, "focus": function($event) {
10229
- _setup.onBtnHover($event, _setup.t("common.reset") || "Reset");
10230
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("path", { attrs: { "d": "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" } }), _c("path", { attrs: { "d": "M3 3v5h5" } })])])]), _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "disabled": Number.isFinite(_setup.codeFontSize) ? _setup.codeFontSize >= _setup.codeFontMax : false }, on: { "click": function($event) {
10231
- return _setup.increaseCodeFont();
10232
- }, "mouseenter": function($event) {
10233
- _setup.onBtnHover($event, _setup.t("common.increase") || "Increase");
10234
- }, "focus": function($event) {
10235
- _setup.onBtnHover($event, _setup.t("common.increase") || "Increase");
10236
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M5 12h14m-7-7v14" } })])])] : _vm._e(), _setup.props.showCopyButton ? _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "aria-label": _setup.copyText ? _setup.t("common.copied") || "Copied" : _setup.t("common.copy") || "Copy" }, on: { "click": _setup.copy, "mouseenter": function($event) {
10237
- return _setup.onCopyHover($event);
10238
- }, "focus": function($event) {
10239
- return _setup.onCopyHover($event);
10240
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [!_setup.copyText ? _c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("rect", { attrs: { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" } }), _c("path", { attrs: { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" } })])]) : _c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M20 6L9 17l-5-5" } })])]) : _vm._e(), _setup.props.showExpandButton ? _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "aria-pressed": _setup.isExpanded }, on: { "click": function($event) {
10241
- return _setup.toggleExpand($event);
10242
- }, "mouseenter": function($event) {
10243
- _setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
10244
- }, "focus": function($event) {
10245
- _setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
10246
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_setup.isExpanded ? _c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "0.75rem", "height": "0.75rem", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" } })]) : _c("svg", { staticClass: "action-icon", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "0.75rem", "height": "0.75rem", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" } })])]) : _vm._e(), _setup.isPreviewable && _setup.props.showPreviewButton ? _c("button", { staticClass: "code-action-btn transition-colors", attrs: { "type": "button", "aria-label": _setup.t("common.preview") || "Preview" }, on: { "click": _setup.previewCode, "mouseenter": function($event) {
10247
- _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
10248
- }, "focus": function($event) {
10249
- _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
10250
- }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "action-icon", attrs: { "data-v-3d59cc65": "", "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("path", { attrs: { "d": "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" } }), _c("circle", { attrs: { "cx": "12", "cy": "12", "r": "3" } })])])]) : _vm._e()], 2)];
10251
- })], 2) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed && (_vm.stream ? true : !_vm.loading), expression: "!isCollapsed && (stream ? true : !loading)" }], ref: "codeBlockContent", staticClass: "code-block-content", style: _setup.contentStyle, on: { "scroll": _setup.handleScroll } }, [_c("div", { ref: "rendererTarget", staticClass: "code-block-render" }), !_setup.rendererReady && _setup.fallbackHtml ? _c("div", { staticClass: "code-fallback-plain", domProps: { "innerHTML": _vm._s(_setup.fallbackHtml) } }) : _vm._e()]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_vm.stream && _vm.loading, expression: "!stream && loading" }], staticClass: "code-loading-placeholder" }, [_vm._t("loading", function() {
10252
- return [_vm._m(0)];
10253
- }, { "loading": _vm.loading, "stream": _vm.stream })], 2)]);
10254
- };
10255
- var _sfc_staticRenderFns$6 = [function() {
10256
- var _vm = this, _c = _vm._self._c;
10257
- _vm._self._setupProxy;
10258
- return _c("div", { staticClass: "loading-skeleton" }, [_c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line short" })]);
10259
- }];
10260
- var __component__$6 = /* @__PURE__ */ normalizeComponent(
10261
- _sfc_main$6,
10262
- _sfc_render$6,
10263
- _sfc_staticRenderFns$6,
10264
- false,
10265
- null,
10266
- "9bd302bf",
10267
- null,
10268
- null
10269
- );
10270
- const MarkdownCodeBlockNode = __component__$6.exports;
10271
- const _sfc_main$5 = defineComponent({
10272
- name: "MarkdownRender",
10273
- components: {
10274
- LegacyNodesRenderer,
10275
- NodeRenderer
10276
- },
10277
- props: {
10278
- content: String,
10279
- nodes: Array,
10280
- final: Boolean,
10281
- parseOptions: Object,
10282
- customMarkdownIt: Function,
10283
- debugPerformance: Boolean,
10284
- customHtmlTags: Array,
10285
- viewportPriority: Boolean,
10286
- codeBlockStream: {
10287
- type: Boolean,
10288
- default: true
10289
- },
10290
- codeBlockDarkTheme: null,
10291
- codeBlockLightTheme: null,
10292
- codeBlockMonacoOptions: Object,
8968
+ codeBlockDarkTheme: String,
8969
+ codeBlockLightTheme: String,
10293
8970
  renderCodeBlocksAsPre: Boolean,
10294
8971
  codeBlockMinWidth: [String, Number],
10295
8972
  codeBlockMaxWidth: [String, Number],
8973
+ codeBlockOptions: Object,
10296
8974
  codeBlockProps: Object,
10297
8975
  showTooltips: Boolean,
10298
8976
  themes: Array,
10299
- langs: Array,
10300
8977
  isDark: Boolean,
10301
8978
  customId: [String, Number],
10302
8979
  indexKey: [String, Number],
@@ -10361,14 +9038,13 @@ const _sfc_main$5 = defineComponent({
10361
9038
  codeBlockStream: this.codeBlockStream,
10362
9039
  codeBlockDarkTheme: this.codeBlockDarkTheme,
10363
9040
  codeBlockLightTheme: this.codeBlockLightTheme,
10364
- codeBlockMonacoOptions: this.codeBlockMonacoOptions,
10365
9041
  renderCodeBlocksAsPre: this.renderCodeBlocksAsPre,
10366
9042
  codeBlockMinWidth: this.codeBlockMinWidth,
10367
9043
  codeBlockMaxWidth: this.codeBlockMaxWidth,
9044
+ codeBlockOptions: this.codeBlockOptions,
10368
9045
  codeBlockProps: this.codeBlockProps,
10369
9046
  showTooltips: this.showTooltips,
10370
9047
  themes: this.themes,
10371
- langs: this.langs,
10372
9048
  isDark: this.isDark,
10373
9049
  customId: this.customId,
10374
9050
  indexKey: this.indexKey,
@@ -10400,13 +9076,12 @@ const _sfc_main$5 = defineComponent({
10400
9076
  codeBlockStream: this.codeBlockStream,
10401
9077
  codeBlockDarkTheme: this.codeBlockDarkTheme,
10402
9078
  codeBlockLightTheme: this.codeBlockLightTheme,
10403
- codeBlockMonacoOptions: this.codeBlockMonacoOptions,
10404
9079
  renderCodeBlocksAsPre: this.renderCodeBlocksAsPre,
10405
9080
  codeBlockMinWidth: this.codeBlockMinWidth,
10406
9081
  codeBlockMaxWidth: this.codeBlockMaxWidth,
9082
+ codeBlockOptions: this.codeBlockOptions,
10407
9083
  codeBlockProps: this.codeBlockProps,
10408
9084
  themes: this.themes,
10409
- langs: this.langs,
10410
9085
  isDark: this.isDark
10411
9086
  }
10412
9087
  }, Object.keys(listeners).length > 0 ? { on: listeners } : {}));
@@ -10931,7 +9606,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
10931
9606
  }
10932
9607
  });
10933
9608
  const MathBlockNode_vue_vue_type_style_index_0_scoped_50fb5666_lang = "";
10934
- var _sfc_render$4 = function render41() {
9609
+ var _sfc_render$4 = function render40() {
10935
9610
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
10936
9611
  return _c("div", { ref: "containerEl", staticClass: "math-block text-center overflow-x-auto relative min-h-[40px]" }, [_setup.renderedHtml ? _c("div", { staticClass: "math-block__content", domProps: { "innerHTML": _vm._s(_setup.renderedHtml) } }) : _setup.fallbackText ? _c("div", { staticClass: "math-block__fallback" }, [_vm._v(" " + _vm._s(_setup.fallbackText) + " ")]) : _vm._e(), _setup.renderingLoading && !_setup.renderedHtml && !_setup.fallbackText ? _c("div", { staticClass: "math-loading-overlay" }, [_c("div", { staticClass: "math-loading-spinner" })]) : _vm._e()]);
10937
9612
  };
@@ -11087,7 +9762,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
11087
9762
  }
11088
9763
  });
11089
9764
  const MathInlineNode_vue_vue_type_style_index_0_scoped_6e33b527_lang = "";
11090
- var _sfc_render$3 = function render42() {
9765
+ var _sfc_render$3 = function render41() {
11091
9766
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
11092
9767
  return _c("span", { ref: "containerEl", staticClass: "math-inline-wrapper" }, [_setup.renderedHtml ? _c("span", { staticClass: "math-inline", domProps: { "innerHTML": _vm._s(_setup.renderedHtml) } }) : _setup.fallbackText ? _c("span", { staticClass: "math-inline math-inline--fallback" }, [_vm._v(_vm._s(_setup.fallbackText))]) : _vm._e(), _setup.renderingLoading && !_setup.renderedHtml && !_setup.fallbackText ? _c("span", { staticClass: "math-inline__loading", attrs: { "role": "status", "aria-live": "polite" } }, [_vm._t("loading", function() {
11093
9768
  return [_c("span", { staticClass: "math-inline__spinner animate-spin", attrs: { "aria-hidden": "true" } }), _c("span", { staticClass: "sr-only" }, [_vm._v("Loading")])];
@@ -12848,7 +11523,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
12848
11523
  }
12849
11524
  });
12850
11525
  const MermaidBlockNode_vue_vue_type_style_index_0_scoped_5b401883_lang = "";
12851
- var _sfc_render$2 = function render43() {
11526
+ var _sfc_render$2 = function render42() {
12852
11527
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
12853
11528
  return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
12854
11529
  _setup.props.isDark ? "border-gray-700/30" : "border-gray-200",
@@ -12980,7 +11655,7 @@ const _sfc_main$1 = defineComponent({
12980
11655
  };
12981
11656
  }
12982
11657
  });
12983
- var _sfc_render$1 = function render44() {
11658
+ var _sfc_render$1 = function render43() {
12984
11659
  var _vm = this, _c = _vm._self._c;
12985
11660
  _vm._self._setupProxy;
12986
11661
  return _c("MarkdownRender", _vm._g(_vm._b({ attrs: { "nodes": _vm.resolvedNodes, "final": _vm.resolvedFinal, "custom-html-tags": _vm.customHtmlTags } }, "MarkdownRender", _vm.$attrs, false), _vm.forwardedListeners));
@@ -13110,7 +11785,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13110
11785
  }
13111
11786
  });
13112
11787
  const Tooltip_vue_vue_type_style_index_0_scoped_703da293_lang = "";
13113
- var _sfc_render = function render45() {
11788
+ var _sfc_render = function render44() {
13114
11789
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
13115
11790
  return _c(_setup.Portal, { attrs: { "to": "body" } }, [_c("div", { staticClass: "markstream-vue2" }, [_c("transition", { attrs: { "name": "tooltip", "appear": "" } }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.visible && _setup.ready, expression: "visible && ready" }], ref: "tooltip", staticClass: "z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border", class: [_setup.isDarkEffective ? "bg-gray-900 text-white border-gray-700 border is-dark" : "bg-white text-gray-900 border-gray-200 border"], style: { position: "fixed", left: _setup.style.left, top: _setup.style.top, transform: _setup.style.transform }, attrs: { "id": _setup.props.id, "role": "tooltip" } }, [_vm._v(" " + _vm._s(_vm.content) + " ")])])], 1)]);
13116
11791
  };
@@ -13640,7 +12315,6 @@ const componentMap = {
13640
12315
  LinkNode,
13641
12316
  ListItemNode,
13642
12317
  ListNode,
13643
- MarkdownCodeBlockNode,
13644
12318
  MathBlockNode,
13645
12319
  MathInlineNode,
13646
12320
  MermaidBlockNode,
@@ -13699,7 +12373,6 @@ export {
13699
12373
  ListNode,
13700
12374
  MERMAID_DISABLED_CODE,
13701
12375
  MERMAID_WORKER_BUSY_CODE,
13702
- MarkdownCodeBlockNode,
13703
12376
  MarkdownRender,
13704
12377
  MathBlockNode,
13705
12378
  MathInlineNode,
@@ -13740,7 +12413,6 @@ export {
13740
12413
  getKaTeXWorkerLoad,
13741
12414
  getLanguageIcon,
13742
12415
  getMermaidWorkerLoad,
13743
- getUseMonaco,
13744
12416
  isD2Enabled,
13745
12417
  isKaTeXWorkerBusy,
13746
12418
  isKatexEnabled,
@@ -13750,6 +12422,7 @@ export {
13750
12422
  normalizeLanguageIdentifier,
13751
12423
  normalizeStandaloneBackslashT,
13752
12424
  parseNestedMarkdownToNodes,
12425
+ preloadCodeBlockRuntime,
13753
12426
  preloadExtendedLanguageIcons,
13754
12427
  removeCustomComponents,
13755
12428
  renderKaTeXInWorker,
@@ -13757,7 +12430,7 @@ export {
13757
12430
  renderMarkdownNodeToHtml,
13758
12431
  renderMarkdownNodesToHtml,
13759
12432
  renderNestedMarkdownToHtml,
13760
- resolveMonacoLanguageId,
12433
+ resolveLanguageId,
13761
12434
  setCustomComponents,
13762
12435
  setD2Loader,
13763
12436
  setDefaultI18nMap,