markstream-vue2 0.0.45 → 0.0.46

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 (46) hide show
  1. package/dist/chunks/{index-b8d5777d.cjs → index-11432088.cjs} +1 -1
  2. package/dist/chunks/{index-87cdc60f.js → index-12ec401a.js} +1 -0
  3. package/dist/chunks/{index-292bb72c.js → index-40b64c02.js} +1 -0
  4. package/dist/chunks/index-6013a5b2.cjs +1 -0
  5. package/dist/chunks/{index-e0a22210.js → index-6ae3630b.js} +1 -0
  6. package/dist/chunks/{index-2a7bea2c.js → index-754b8598.js} +1 -0
  7. package/dist/chunks/{index-42252d16.js → index-8dc37342.js} +1 -0
  8. package/dist/chunks/{index-8693b3db.cjs → index-a4867ea2.cjs} +1 -1
  9. package/dist/chunks/index-e0125777.cjs +1 -0
  10. package/dist/chunks/{index-91325ae4.cjs → index-fb457079.cjs} +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.css +1 -1
  13. package/dist/index.d.ts +5 -3
  14. package/dist/index.js +2289 -1399
  15. package/dist/index.px.css +1 -1
  16. package/dist/index.tailwind.css +1 -1
  17. package/dist/tailwind.ts +1 -1
  18. package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +5 -5
  19. package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +1 -1
  20. package/dist/types/components/ImageNode/ImageNode.vue.d.ts +1 -1
  21. package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +1 -1
  22. package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +48 -9
  23. package/dist/types/components/MarkdownRenderCompat.vue.d.ts +13 -2
  24. package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +5 -1
  25. package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +23 -3
  26. package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +39 -4
  27. package/dist/types/components/PreCodeNode/PreCodeNode.vue.d.ts +2 -0
  28. package/dist/types/components/TextNode/streamingTextState.d.ts +2 -11
  29. package/dist/types/composables/useSmoothMarkdownStream.d.ts +21 -0
  30. package/dist/types/exports.d.ts +5 -3
  31. package/dist/types/types/component-props.d.ts +17 -4
  32. package/dist/types/utils/codeBlockExtraProps.d.ts +4 -0
  33. package/dist/types/utils/devEnv.d.ts +1 -0
  34. package/package.json +9 -6
  35. package/dist/chunks/cssMode-58e68511.cjs +0 -1
  36. package/dist/chunks/cssMode-60d93f28.js +0 -2044
  37. package/dist/chunks/htmlMode-87a75897.cjs +0 -1
  38. package/dist/chunks/htmlMode-8d468223.js +0 -2060
  39. package/dist/chunks/index-c6f74f2d.cjs +0 -1
  40. package/dist/chunks/index-e1315bc2.cjs +0 -1
  41. package/dist/chunks/index.legacy-010f0006.js +0 -126308
  42. package/dist/chunks/index.legacy-e02dc92b.cjs +0 -1
  43. package/dist/chunks/jsonMode-2a97b947.cjs +0 -1
  44. package/dist/chunks/jsonMode-307a9a02.js +0 -2759
  45. package/dist/chunks/tsMode-4f227d36.js +0 -1315
  46. package/dist/chunks/tsMode-b1f6e7cb.cjs +0 -1
package/dist/index.js CHANGED
@@ -51,11 +51,12 @@ var __async = (__this, __arguments, generator) => {
51
51
  });
52
52
  };
53
53
  var _a;
54
- import { sanitizeHtmlAttrs, hasCustomHtmlComponents, tokenizeHtml, BLOCKED_HTML_TAGS, isHtmlTagHardBlocked, isHtmlTagBlocked, isCustomHtmlComponentTag, convertHtmlAttrsToProps, sanitizeHtmlContent, normalizeCustomHtmlTags, getMarkdown, normalizeCustomHtmlTagName, isUnsafeHtmlUrl, NON_STRUCTURING_HTML_TAGS, DANGEROUS_HTML_ATTRS, URL_HTML_ATTRS, sanitizeHtmlTokenAttrs, tokenAttrsToRecord, getHtmlTagFromContent, shouldRenderUnknownHtmlTagAsText, stripCustomHtmlWrapper, mergeCustomHtmlTags, resolveCustomHtmlTags, parseMarkdownToStructure, setDefaultMathOptions } from "stream-markdown-parser";
54
+ import { sanitizeHtmlAttrs, hasCustomHtmlComponents, tokenizeHtml, BLOCKED_HTML_TAGS, isHtmlTagHardBlocked, isHtmlTagBlocked, isCustomHtmlComponentTag, convertHtmlAttrsToProps, sanitizeHtmlContent, sanitizeImageSrc, shouldOpenLinkInNewTab, normalizeCustomHtmlTags, getMarkdown, normalizeCustomHtmlTagName, isUnsafeHtmlUrl, NON_STRUCTURING_HTML_TAGS, DANGEROUS_HTML_ATTRS, URL_HTML_ATTRS, sanitizeHtmlTokenAttrs, tokenAttrsToRecord, getHtmlTagFromContent, shouldRenderUnknownHtmlTagAsText, parseMarkdownToStructure, mergeCustomHtmlTags, stripCustomHtmlWrapper, resolveCustomHtmlTags, toSafeSvgElement, setDefaultMathOptions } from "stream-markdown-parser";
55
55
  export * from "stream-markdown-parser";
56
56
  import { KATEX_COMMANDS, normalizeStandaloneBackslashT, setDefaultMathOptions as setDefaultMathOptions2 } from "stream-markdown-parser";
57
57
  import * as VueModule from "vue-demi";
58
- import { defineComponent, getCurrentInstance, computed, shallowRef, h, inject, ref, watch, readonly, useAttrs, onMounted, nextTick, onUpdated, onBeforeUnmount, provide, markRaw, reactive, onUnmounted } from "vue-demi";
58
+ import { defineComponent, getCurrentInstance, computed, shallowRef, h, inject, ref, watch, readonly, useAttrs, onMounted, nextTick, onUpdated, onBeforeUnmount, provide, getCurrentScope, onScopeDispose, markRaw, reactive, onUnmounted } from "vue-demi";
59
+ import { resolveStreamingTextState, normalizeShikiLanguage, createSmoothMarkdownStream, getHighlightRegistrationKey, getRuntimeShikiRegistrationConfig, registerHighlightOnce } from "markstream-core";
59
60
  import { autoUpdate, offset, flip, shift, computePosition } from "@floating-ui/dom";
60
61
  function getVue2MinorVersion$1(version) {
61
62
  const raw = typeof version === "string" ? version : "";
@@ -608,38 +609,6 @@ var __component__$F = /* @__PURE__ */ normalizeComponent(
608
609
  null
609
610
  );
610
611
  const HtmlInlineNode = __component__$F.exports;
611
- function resolveStreamingTextState({
612
- nextContent,
613
- previousContent,
614
- typewriterEnabled
615
- }) {
616
- if (!typewriterEnabled) {
617
- return {
618
- settledContent: nextContent,
619
- streamedDelta: "",
620
- appended: false
621
- };
622
- }
623
- if (nextContent === previousContent) {
624
- return {
625
- settledContent: nextContent,
626
- streamedDelta: "",
627
- appended: false
628
- };
629
- }
630
- if (previousContent && nextContent.startsWith(previousContent) && nextContent.length > previousContent.length) {
631
- return {
632
- settledContent: previousContent,
633
- streamedDelta: nextContent.slice(previousContent.length),
634
- appended: true
635
- };
636
- }
637
- return {
638
- settledContent: nextContent,
639
- streamedDelta: "",
640
- appended: false
641
- };
642
- }
643
612
  const _sfc_main$E = /* @__PURE__ */ defineComponent({
644
613
  __name: "InlineCodeNode",
645
614
  props: {
@@ -652,21 +621,21 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
652
621
  var _a2, _b;
653
622
  return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$attrs) != null ? _b : {};
654
623
  });
655
- const inheritedTypewriter = inject("markstreamTypewriter", void 0);
624
+ const inheritedFade = inject("markstreamFade", void 0);
656
625
  const inheritedTextStreamState = inject("markstreamTextStreamState", void 0);
657
- const explicitTypewriter = computed(() => {
658
- const raw = attrs.value.typewriter;
626
+ const explicitFade = computed(() => {
627
+ const raw = attrs.value.fade;
659
628
  if (raw === "" || raw === true || raw === "true")
660
629
  return true;
661
630
  if (raw === false || raw === "false")
662
631
  return false;
663
632
  return void 0;
664
633
  });
665
- const typewriterEnabled = computed(() => {
666
- if (typeof explicitTypewriter.value === "boolean")
667
- return explicitTypewriter.value;
668
- if (typeof (inheritedTypewriter == null ? void 0 : inheritedTypewriter.value) === "boolean")
669
- return inheritedTypewriter.value;
634
+ const fadeEnabled = computed(() => {
635
+ if (typeof explicitFade.value === "boolean")
636
+ return explicitFade.value;
637
+ if (typeof (inheritedFade == null ? void 0 : inheritedFade.value) === "boolean")
638
+ return inheritedFade.value;
670
639
  return true;
671
640
  });
672
641
  const streamStateKey = computed(() => {
@@ -693,7 +662,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
693
662
  streamedDelta.value = "";
694
663
  }
695
664
  watch(
696
- [() => props.node.code, streamStateKey, typewriterEnabled],
665
+ [() => props.node.code, streamStateKey, fadeEnabled],
697
666
  ([next]) => {
698
667
  const normalized = String(next != null ? next : "");
699
668
  const rendered = getRenderedContent();
@@ -703,7 +672,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
703
672
  const nextState = resolveStreamingTextState({
704
673
  nextContent: normalized,
705
674
  previousContent,
706
- typewriterEnabled: typewriterEnabled.value
675
+ typewriterEnabled: fadeEnabled.value
707
676
  });
708
677
  settledCode.value = nextState.settledContent;
709
678
  streamedDelta.value = nextState.streamedDelta;
@@ -715,7 +684,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
715
684
  { immediate: true }
716
685
  );
717
686
  watch(
718
- typewriterEnabled,
687
+ fadeEnabled,
719
688
  (enabled) => {
720
689
  if (enabled)
721
690
  return;
@@ -723,10 +692,10 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
723
692
  }
724
693
  );
725
694
  const streamedDeltaClass = computed(() => streamFadeVersion.value % 2 === 0 ? "inline-code-stream-delta--a" : "inline-code-stream-delta--b");
726
- return { __sfc: true, props, instance, attrs, inheritedTypewriter, inheritedTextStreamState, explicitTypewriter, typewriterEnabled, streamStateKey, settledCode, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
695
+ return { __sfc: true, props, instance, attrs, inheritedFade, inheritedTextStreamState, explicitFade, fadeEnabled, streamStateKey, settledCode, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
727
696
  }
728
697
  });
729
- const InlineCodeNode_vue_vue_type_style_index_0_scoped_38cc3b9f_lang = "";
698
+ const InlineCodeNode_vue_vue_type_style_index_0_scoped_820dbd10_lang = "";
730
699
  var _sfc_render$E = function render6() {
731
700
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
732
701
  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-['']" }, [_setup.settledCode ? _c("span", [_vm._v(_vm._s(_setup.settledCode))]) : _vm._e(), _setup.streamedDelta ? _c("span", { staticClass: "inline-code-stream-delta", class: [_setup.streamedDeltaClass], on: { "animationend": _setup.settleStreamedDelta } }, [_vm._v(" " + _vm._s(_setup.streamedDelta) + " ")]) : _vm._e()]);
@@ -738,7 +707,7 @@ var __component__$E = /* @__PURE__ */ normalizeComponent(
738
707
  _sfc_staticRenderFns$E,
739
708
  false,
740
709
  null,
741
- "38cc3b9f",
710
+ "820dbd10",
742
711
  null,
743
712
  null
744
713
  );
@@ -942,16 +911,24 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
942
911
  const props = __props;
943
912
  const imageLoaded = ref(false);
944
913
  const hasError = ref(false);
945
- const fallbackTried = ref(false);
946
- const displaySrc = computed(() => hasError.value && props.fallbackSrc ? props.fallbackSrc : props.node.src);
914
+ const activeSrc = ref("");
915
+ const imageStage = ref("primary");
916
+ const safeNodeSrc = computed(() => sanitizeImageSrc(props.node.src));
917
+ const safeFallbackSrc = computed(() => sanitizeImageSrc(props.fallbackSrc));
918
+ const displaySrc = computed(() => activeSrc.value);
919
+ const showImage = computed(() => !props.node.loading && imageStage.value !== "failed" && activeSrc.value.length > 0);
920
+ const showError = computed(() => !props.node.loading && imageStage.value === "failed");
947
921
  function handleImageError() {
948
- if (props.fallbackSrc && !fallbackTried.value) {
949
- fallbackTried.value = true;
950
- hasError.value = true;
951
- } else {
952
- hasError.value = true;
953
- emit("error", props.node.src);
922
+ if (imageStage.value === "primary" && safeFallbackSrc.value && safeFallbackSrc.value !== activeSrc.value) {
923
+ imageStage.value = "fallback";
924
+ activeSrc.value = safeFallbackSrc.value;
925
+ imageLoaded.value = false;
926
+ hasError.value = false;
927
+ return;
954
928
  }
929
+ imageStage.value = "failed";
930
+ hasError.value = true;
931
+ emit("error", activeSrc.value);
955
932
  }
956
933
  function handleImageLoad() {
957
934
  imageLoaded.value = true;
@@ -965,24 +942,46 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
965
942
  emit("click", [e, displaySrc.value]);
966
943
  }
967
944
  const { t } = useSafeI18n();
968
- watch(displaySrc, () => {
969
- imageLoaded.value = false;
970
- hasError.value = false;
971
- });
972
- return { __sfc: true, props, emit, imageLoaded, hasError, fallbackTried, displaySrc, handleImageError, handleImageLoad, handleClick, t };
945
+ watch(
946
+ [safeNodeSrc, safeFallbackSrc, () => props.node.loading],
947
+ () => {
948
+ imageLoaded.value = false;
949
+ hasError.value = false;
950
+ if (props.node.loading) {
951
+ activeSrc.value = safeNodeSrc.value;
952
+ imageStage.value = "primary";
953
+ return;
954
+ }
955
+ if (safeNodeSrc.value) {
956
+ activeSrc.value = safeNodeSrc.value;
957
+ imageStage.value = "primary";
958
+ return;
959
+ }
960
+ if (safeFallbackSrc.value) {
961
+ activeSrc.value = safeFallbackSrc.value;
962
+ imageStage.value = "fallback";
963
+ return;
964
+ }
965
+ activeSrc.value = "";
966
+ imageStage.value = "failed";
967
+ hasError.value = true;
968
+ },
969
+ { immediate: true }
970
+ );
971
+ return { __sfc: true, props, emit, imageLoaded, hasError, activeSrc, imageStage, safeNodeSrc, safeFallbackSrc, displaySrc, showImage, showError, handleImageError, handleImageLoad, handleClick, t };
973
972
  }
974
973
  });
975
- const ImageNode_vue_vue_type_style_index_0_scoped_0d6967c3_lang = "";
974
+ const ImageNode_vue_vue_type_style_index_0_scoped_05ffe4c4_lang = "";
976
975
  var _sfc_render$D = function render7() {
977
976
  var _a2, _b, _c2, _d, _e;
978
977
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
979
- return _c("transition", { attrs: { "name": "img-switch", "mode": "out-in" } }, [!_vm.node.loading && !_setup.hasError ? _c("img", { key: "image", staticClass: "image-node__img h-auto rounded-lg transition-opacity duration-200 ease-in-out image-node__img--inline", class: {
978
+ 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: {
980
979
  "opacity-0": !_setup.imageLoaded,
981
980
  "opacity-100": _setup.imageLoaded,
982
981
  "cursor-pointer": _setup.imageLoaded
983
- }, attrs: { "src": _setup.displaySrc, "alt": String((_b = (_a2 = _setup.props.node.alt) != null ? _a2 : _setup.props.node.title) != null ? _b : ""), "title": String((_d = (_c2 = _setup.props.node.title) != null ? _c2 : _setup.props.node.alt) != null ? _d : ""), "loading": _setup.props.lazy ? "lazy" : "eager", "decoding": "async", "tabindex": _setup.imageLoaded ? 0 : -1, "aria-label": (_e = _setup.props.node.alt) != null ? _e : _setup.t("image.preview") }, on: { "error": _setup.handleImageError, "load": _setup.handleImageLoad, "click": _setup.handleClick } }) : !_setup.hasError ? _c("span", { key: "placeholder", staticClass: "placeholder-layer placeholder-layer--inline inline-flex items-center justify-center gap-2" }, [_setup.props.usePlaceholder ? [_vm._t("placeholder", function() {
982
+ }, attrs: { "src": _setup.displaySrc, "alt": String((_b = (_a2 = _setup.props.node.alt) != null ? _a2 : _setup.props.node.title) != null ? _b : ""), "title": String((_d = (_c2 = _setup.props.node.title) != null ? _c2 : _setup.props.node.alt) != null ? _d : ""), "loading": _setup.props.lazy ? "lazy" : "eager", "decoding": "async", "tabindex": _setup.imageLoaded ? 0 : -1, "aria-label": (_e = _setup.props.node.alt) != null ? _e : _setup.t("image.preview") }, on: { "error": _setup.handleImageError, "load": _setup.handleImageLoad, "click": _setup.handleClick } }) : _vm.node.loading && !_setup.hasError ? _c("span", { key: "placeholder", staticClass: "placeholder-layer placeholder-layer--inline inline-flex items-center justify-center gap-2" }, [_setup.props.usePlaceholder ? [_vm._t("placeholder", function() {
984
983
  return [_c("div", { staticClass: "w-4 h-4 rounded-full border-2 border-solid border-current border-t-transparent animate-spin", attrs: { "aria-hidden": "true" } }), _c("span", { staticClass: "text-sm whitespace-nowrap" }, [_vm._v(_vm._s(_setup.t("image.loading")))])];
985
- }, { "node": _setup.props.node, "displaySrc": _setup.displaySrc, "imageLoaded": _setup.imageLoaded, "hasError": _setup.hasError, "fallbackSrc": _setup.props.fallbackSrc, "lazy": _setup.props.lazy })] : [_c("span", { staticClass: "text-sm text-gray-500" }, [_vm._v(_vm._s(_vm.node.raw))])]], 2) : !_vm.node.loading && !_setup.props.fallbackSrc ? _c("span", { key: "error", staticClass: "image-node__error image-node__error--inline px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500" }, [_vm._t("error", function() {
984
+ }, { "node": _setup.props.node, "displaySrc": _setup.displaySrc, "imageLoaded": _setup.imageLoaded, "hasError": _setup.hasError, "fallbackSrc": _setup.props.fallbackSrc, "lazy": _setup.props.lazy })] : [_c("span", { staticClass: "text-sm text-gray-500" }, [_vm._v(_vm._s(_vm.node.raw))])]], 2) : _setup.showError ? _c("span", { key: "error", staticClass: "image-node__error image-node__error--inline px-4 py-2 bg-gray-100 flex items-center justify-center rounded-lg gap-2 text-red-500" }, [_vm._t("error", function() {
986
985
  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")))])];
987
986
  }, { "node": _setup.props.node, "displaySrc": _setup.displaySrc, "imageLoaded": _setup.imageLoaded, "hasError": _setup.hasError, "fallbackSrc": _setup.props.fallbackSrc, "lazy": _setup.props.lazy })], 2) : _vm._e()]);
988
987
  };
@@ -993,7 +992,7 @@ var __component__$D = /* @__PURE__ */ normalizeComponent(
993
992
  _sfc_staticRenderFns$D,
994
993
  false,
995
994
  null,
996
- "0d6967c3",
995
+ "05ffe4c4",
997
996
  null,
998
997
  null
999
998
  );
@@ -1101,22 +1100,22 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1101
1100
  var _a2, _b;
1102
1101
  return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$attrs) != null ? _b : {};
1103
1102
  });
1104
- const inheritedTypewriter = inject("markstreamTypewriter", void 0);
1103
+ const inheritedFade = inject("markstreamFade", void 0);
1105
1104
  const inheritedTextStreamState = inject("markstreamTextStreamState", void 0);
1106
1105
  const inheritedStreamVersion = inject("markstreamStreamVersion", void 0);
1107
- const explicitTypewriter = computed(() => {
1108
- const raw = attrs.value.typewriter;
1106
+ const explicitFade = computed(() => {
1107
+ const raw = attrs.value.fade;
1109
1108
  if (raw === "" || raw === true || raw === "true")
1110
1109
  return true;
1111
1110
  if (raw === false || raw === "false")
1112
1111
  return false;
1113
1112
  return void 0;
1114
1113
  });
1115
- const typewriterEnabled = computed(() => {
1116
- if (typeof explicitTypewriter.value === "boolean")
1117
- return explicitTypewriter.value;
1118
- if (typeof (inheritedTypewriter == null ? void 0 : inheritedTypewriter.value) === "boolean")
1119
- return inheritedTypewriter.value;
1114
+ const fadeEnabled = computed(() => {
1115
+ if (typeof explicitFade.value === "boolean")
1116
+ return explicitFade.value;
1117
+ if (typeof (inheritedFade == null ? void 0 : inheritedFade.value) === "boolean")
1118
+ return inheritedFade.value;
1120
1119
  return true;
1121
1120
  });
1122
1121
  const streamStateKey = computed(() => {
@@ -1143,14 +1142,14 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1143
1142
  streamedDelta.value = "";
1144
1143
  }
1145
1144
  watch(
1146
- [() => props.node.content, streamStateKey, typewriterEnabled, () => inheritedStreamVersion == null ? void 0 : inheritedStreamVersion.value],
1145
+ [() => props.node.content, streamStateKey, fadeEnabled, () => inheritedStreamVersion == null ? void 0 : inheritedStreamVersion.value],
1147
1146
  ([next]) => {
1148
1147
  const normalized = String(next != null ? next : "");
1149
1148
  const rendered = getRenderedContent();
1150
1149
  const key = streamStateKey.value;
1151
1150
  const previousPersisted = key ? inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.get(key) : void 0;
1152
1151
  const previousContent = previousPersisted != null ? previousPersisted : rendered;
1153
- if (!typewriterEnabled.value) {
1152
+ if (!fadeEnabled.value) {
1154
1153
  setFullContent(normalized);
1155
1154
  if (key)
1156
1155
  inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
@@ -1168,7 +1167,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1168
1167
  const nextState = resolveStreamingTextState({
1169
1168
  nextContent: normalized,
1170
1169
  previousContent,
1171
- typewriterEnabled: typewriterEnabled.value
1170
+ typewriterEnabled: fadeEnabled.value
1172
1171
  });
1173
1172
  settledContent.value = nextState.settledContent;
1174
1173
  streamedDelta.value = nextState.streamedDelta;
@@ -1180,7 +1179,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1180
1179
  { immediate: true }
1181
1180
  );
1182
1181
  watch(
1183
- typewriterEnabled,
1182
+ fadeEnabled,
1184
1183
  (enabled) => {
1185
1184
  if (enabled)
1186
1185
  return;
@@ -1188,10 +1187,10 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1188
1187
  }
1189
1188
  );
1190
1189
  const streamedDeltaClass = computed(() => streamFadeVersion.value % 2 === 0 ? "text-node-stream-delta--a" : "text-node-stream-delta--b");
1191
- return { __sfc: true, props, katexReady, instance, attrs, inheritedTypewriter, inheritedTextStreamState, inheritedStreamVersion, explicitTypewriter, typewriterEnabled, streamStateKey, settledContent, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
1190
+ return { __sfc: true, props, katexReady, instance, attrs, inheritedFade, inheritedTextStreamState, inheritedStreamVersion, explicitFade, fadeEnabled, streamStateKey, settledContent, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
1192
1191
  }
1193
1192
  });
1194
- const TextNode_vue_vue_type_style_index_0_scoped_356c331b_lang = "";
1193
+ const TextNode_vue_vue_type_style_index_0_scoped_e8e0f51e_lang = "";
1195
1194
  var _sfc_render$C = function render8() {
1196
1195
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
1197
1196
  return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] }, [_setup.settledContent ? _c("span", [_vm._v(_vm._s(_setup.settledContent))]) : _vm._e(), _setup.streamedDelta ? _c("span", { staticClass: "text-node-stream-delta", class: [_setup.streamedDeltaClass], on: { "animationend": _setup.settleStreamedDelta } }, [_vm._v(" " + _vm._s(_setup.streamedDelta) + " ")]) : _vm._e()]);
@@ -1203,7 +1202,7 @@ var __component__$C = /* @__PURE__ */ normalizeComponent(
1203
1202
  _sfc_staticRenderFns$C,
1204
1203
  false,
1205
1204
  null,
1206
- "356c331b",
1205
+ "e8e0f51e",
1207
1206
  null,
1208
1207
  null
1209
1208
  );
@@ -1228,7 +1227,7 @@ function MathInlineNodeAsync() {
1228
1227
  try {
1229
1228
  const katex2 = yield getKatex();
1230
1229
  if (katex2) {
1231
- const mod2 = yield import("./chunks/index-42252d16.js");
1230
+ const mod2 = yield import("./chunks/index-8dc37342.js");
1232
1231
  return (_c = mod2.default) != null ? _c : mod2;
1233
1232
  }
1234
1233
  } catch (e) {
@@ -1246,7 +1245,7 @@ function MathBlockNodeAsync() {
1246
1245
  try {
1247
1246
  const katex2 = yield getKatex();
1248
1247
  if (katex2) {
1249
- const mod2 = yield import("./chunks/index-87cdc60f.js");
1248
+ const mod2 = yield import("./chunks/index-12ec401a.js");
1250
1249
  return (_a2 = mod2.default) != null ? _a2 : mod2;
1251
1250
  }
1252
1251
  } catch (e) {
@@ -1589,6 +1588,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1589
1588
  const merged = __spreadValues(__spreadValues({}, attrs), nodeAttrs.value);
1590
1589
  delete merged.title;
1591
1590
  delete merged.href;
1591
+ delete merged.target;
1592
+ delete merged.rel;
1592
1593
  return merged;
1593
1594
  });
1594
1595
  const safeHref = computed(() => {
@@ -1596,6 +1597,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1596
1597
  const href = String((_b = (_a2 = props.node) == null ? void 0 : _a2.href) != null ? _b : "");
1597
1598
  return sanitizeAttrs({ href }).href;
1598
1599
  });
1600
+ const openInNewTab = computed(() => shouldOpenLinkInNewTab(safeHref.value));
1599
1601
  function getTooltipText() {
1600
1602
  var _a2, _b;
1601
1603
  return ((_a2 = props.node) == null ? void 0 : _a2.title) || safeHref.value || ((_b = props.node) == null ? void 0 : _b.text) || "";
@@ -1660,14 +1662,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1660
1662
  isHovering.value = false;
1661
1663
  hideTooltip(true);
1662
1664
  });
1663
- return { __sfc: true, props, lastPointerPosition, pointerTrackerRefCount, pointerTrackerCleanup, ensurePointerTracker, retainPointerTracker, releasePointerTracker, cssVars, nodeComponents, attrs, nodeAttrs, anchorEl: anchorEl2, isHovering, anchorAttrs, safeHref, getTooltipText, isPointerInsideAnchor, syncTooltipForHoveredAnchor, onAnchorEnter, onAnchorLeave, title, TextNode };
1665
+ return { __sfc: true, props, lastPointerPosition, pointerTrackerRefCount, pointerTrackerCleanup, ensurePointerTracker, retainPointerTracker, releasePointerTracker, cssVars, nodeComponents, attrs, nodeAttrs, anchorEl: anchorEl2, isHovering, anchorAttrs, safeHref, openInNewTab, getTooltipText, isPointerInsideAnchor, syncTooltipForHoveredAnchor, onAnchorEnter, onAnchorLeave, title, TextNode };
1664
1666
  }
1665
1667
  });
1666
- const LinkNode_vue_vue_type_style_index_0_scoped_ae37fdb2_lang = "";
1668
+ const LinkNode_vue_vue_type_style_index_0_scoped_636cac94_lang = "";
1667
1669
  var _sfc_render$w = function render14() {
1668
1670
  var _a2, _b;
1669
1671
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
1670
- 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": "_blank", "rel": "noopener noreferrer" }, on: { "mouseenter": (e) => _setup.onAnchorEnter(e), "mouseleave": _setup.onAnchorLeave } }, "a", _setup.anchorAttrs, false), _vm._l(_vm.node.children, function(child, index2) {
1672
+ 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) {
1671
1673
  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}` } });
1672
1674
  }), 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" } })])]);
1673
1675
  };
@@ -1678,7 +1680,7 @@ var __component__$w = /* @__PURE__ */ normalizeComponent(
1678
1680
  _sfc_staticRenderFns$w,
1679
1681
  false,
1680
1682
  null,
1681
- "ae37fdb2",
1683
+ "636cac94",
1682
1684
  null,
1683
1685
  null
1684
1686
  );
@@ -2499,11 +2501,15 @@ function renderLinkNode(node, ctx) {
2499
2501
  const title = getString(node.title);
2500
2502
  const content2 = getNodeList$1(node.children).length > 0 ? renderNodesToHtml(getNodeList$1(node.children), ctx) : escapeHtml(getString(node.text || href));
2501
2503
  const titleAttr = title ? ` title="${escapeAttr(title)}"` : "";
2502
- const hrefAttr = href && !isUnsafeHtmlUrl(href) ? ` href="${escapeAttr(href)}"` : "";
2503
- return `<a${hrefAttr}${titleAttr} target="_blank" rel="noreferrer noopener">${content2}</a>`;
2504
+ const safeHref = href && !isUnsafeHtmlUrl(href) ? href : "";
2505
+ const hrefAttr = safeHref ? ` href="${escapeAttr(safeHref)}"` : "";
2506
+ const externalAttrs = shouldOpenLinkInNewTab(safeHref) ? ' target="_blank" rel="noreferrer noopener"' : "";
2507
+ return `<a${hrefAttr}${titleAttr}${externalAttrs}>${content2}</a>`;
2504
2508
  }
2505
2509
  function renderImageNode(node) {
2506
- const src = getString(node.src);
2510
+ const src = sanitizeImageSrc(node.src);
2511
+ if (!src)
2512
+ return "";
2507
2513
  const alt = getString(node.alt);
2508
2514
  const title = getString(node.title);
2509
2515
  const titleAttr = title ? ` title="${escapeAttr(title)}"` : "";
@@ -2631,7 +2637,7 @@ function serializeAttrs(attrs, extraClass = "") {
2631
2637
  continue;
2632
2638
  if (DANGEROUS_HTML_ATTRS.has(lowerName))
2633
2639
  continue;
2634
- if (value !== true && URL_HTML_ATTRS.has(lowerName) && value && isUnsafeHtmlUrl(String(value)))
2640
+ if (value !== true && URL_HTML_ATTRS.has(lowerName) && value && isUnsafeHtmlUrl(String(value), { attrName: lowerName }))
2635
2641
  continue;
2636
2642
  if (lowerName === "class") {
2637
2643
  mergedClasses.push(String(value));
@@ -2962,29 +2968,149 @@ const ParagraphNode = __component__$l.exports;
2962
2968
  const _sfc_main$k = /* @__PURE__ */ defineComponent({
2963
2969
  __name: "PreCodeNode",
2964
2970
  props: {
2965
- node: null
2971
+ node: null,
2972
+ showLineNumbers: { type: Boolean },
2973
+ diffInline: { type: Boolean }
2966
2974
  },
2967
2975
  setup(__props) {
2968
2976
  const props = __props;
2969
2977
  const normalizedLanguage = computed(() => {
2970
2978
  var _a2, _b, _c;
2971
2979
  const raw = String((_b = (_a2 = props.node) == null ? void 0 : _a2.language) != null ? _b : "");
2972
- const head = String((_c = String(raw).split(/\s+/g)[0]) != null ? _c : "").toLowerCase();
2980
+ const head = String((_c = String(raw).split(/\s+/g)[0]) != null ? _c : "").split(":")[0].toLowerCase();
2973
2981
  const safe = head.replace(/[^\w-]/g, "");
2974
2982
  return safe || "plaintext";
2975
2983
  });
2976
2984
  const languageClass = computed(() => `language-${normalizedLanguage.value}`);
2985
+ const isDiffPreview = computed(() => {
2986
+ var _a2;
2987
+ return props.showLineNumbers === true && ((_a2 = props.node) == null ? void 0 : _a2.diff) === true;
2988
+ });
2989
+ const isInlineDiffPreview = computed(() => isDiffPreview.value && props.diffInline === true);
2990
+ const displayCode = computed(() => {
2991
+ var _a2, _b, _c, _d, _e, _f;
2992
+ if (((_a2 = props.node) == null ? void 0 : _a2.diff) === true)
2993
+ return String((_c = (_b = props.node) == null ? void 0 : _b.code) != null ? _c : "");
2994
+ const value = String((_e = (_d = props.node) == null ? void 0 : _d.code) != null ? _e : "");
2995
+ return ((_f = props.node) == null ? void 0 : _f.loading) === true ? value : value.replace(/\r\n$|\n$|\r$/, "");
2996
+ });
2977
2997
  const ariaLabel = computed(() => {
2978
2998
  const lang = normalizedLanguage.value;
2979
2999
  return lang ? `Code block: ${lang}` : "Code block";
2980
3000
  });
2981
- return { __sfc: true, props, normalizedLanguage, languageClass, ariaLabel };
3001
+ function splitLines(source) {
3002
+ return String(source != null ? source : "").split(/\r\n|\n|\r/);
3003
+ }
3004
+ function isRemovedDiffLine(line) {
3005
+ return line.startsWith("-") && !line.startsWith("---");
3006
+ }
3007
+ function isAddedDiffLine(line) {
3008
+ return line.startsWith("+") && !line.startsWith("+++");
3009
+ }
3010
+ function toDiffLine(code, kind, key, number) {
3011
+ const empty = String(code != null ? code : "").trim().length === 0;
3012
+ return {
3013
+ code,
3014
+ kind: empty && kind !== "hunk" ? "context" : kind,
3015
+ key,
3016
+ number
3017
+ };
3018
+ }
3019
+ function buildDiffPanes(inline = false) {
3020
+ var _a2, _b, _c, _d, _e, _f, _g;
3021
+ const patchLines = splitLines((_a2 = props.node) == null ? void 0 : _a2.code);
3022
+ const hasPatchLines = patchLines.some((line) => isRemovedDiffLine(line) || isAddedDiffLine(line));
3023
+ if (!hasPatchLines && (((_b = props.node) == null ? void 0 : _b.originalCode) != null || ((_c = props.node) == null ? void 0 : _c.updatedCode) != null)) {
3024
+ const original2 = splitLines((_d = props.node) == null ? void 0 : _d.originalCode);
3025
+ const modified2 = splitLines((_e = props.node) == null ? void 0 : _e.updatedCode);
3026
+ if (inline) {
3027
+ const count = Math.max(original2.length, modified2.length);
3028
+ const lines = [];
3029
+ for (let index2 = 0; index2 < count; index2 += 1) {
3030
+ const before = (_f = original2[index2]) != null ? _f : "";
3031
+ const after = (_g = modified2[index2]) != null ? _g : "";
3032
+ if (before === after) {
3033
+ lines.push(toDiffLine(after, "context", `inline-context-${index2}`, index2 + 1));
3034
+ } else {
3035
+ if (index2 < original2.length)
3036
+ lines.push(toDiffLine(before, "removed", `inline-removed-${index2}`, index2 + 1));
3037
+ if (index2 < modified2.length)
3038
+ lines.push(toDiffLine(after, "added", `inline-added-${index2}`, index2 + 1));
3039
+ }
3040
+ }
3041
+ return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3042
+ }
3043
+ return [
3044
+ {
3045
+ key: "original",
3046
+ className: "markstream-pre__diff-pane--original",
3047
+ lines: original2.map((line, index2) => toDiffLine(line, modified2[index2] === line ? "context" : "removed", `original-${index2}`, index2 + 1))
3048
+ },
3049
+ {
3050
+ key: "modified",
3051
+ className: "markstream-pre__diff-pane--modified",
3052
+ lines: modified2.map((line, index2) => toDiffLine(line, original2[index2] === line ? "context" : "added", `modified-${index2}`, index2 + 1))
3053
+ }
3054
+ ];
3055
+ }
3056
+ if (inline) {
3057
+ let originalLine2 = 1;
3058
+ let modifiedLine2 = 1;
3059
+ const lines = patchLines.map((raw, index2) => {
3060
+ if (raw.startsWith("@@"))
3061
+ return toDiffLine(raw, "hunk", `inline-hunk-${index2}`, "");
3062
+ if (isRemovedDiffLine(raw))
3063
+ return toDiffLine(raw.slice(1), "removed", `inline-removed-${index2}`, originalLine2++);
3064
+ if (isAddedDiffLine(raw))
3065
+ return toDiffLine(raw.slice(1), "added", `inline-added-${index2}`, modifiedLine2++);
3066
+ const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3067
+ originalLine2 += 1;
3068
+ return toDiffLine(code, "context", `inline-context-${index2}`, modifiedLine2++);
3069
+ });
3070
+ return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3071
+ }
3072
+ const original = [];
3073
+ const modified = [];
3074
+ let originalLine = 1;
3075
+ let modifiedLine = 1;
3076
+ for (const [index2, raw] of patchLines.entries()) {
3077
+ if (raw.startsWith("@@")) {
3078
+ original.push(toDiffLine(raw, "hunk", `original-hunk-${index2}`, ""));
3079
+ modified.push(toDiffLine(raw, "hunk", `modified-hunk-${index2}`, ""));
3080
+ } else if (isRemovedDiffLine(raw)) {
3081
+ original.push(toDiffLine(raw.slice(1), "removed", `original-removed-${index2}`, originalLine++));
3082
+ } else if (isAddedDiffLine(raw)) {
3083
+ modified.push(toDiffLine(raw.slice(1), "added", `modified-added-${index2}`, modifiedLine++));
3084
+ } else {
3085
+ const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3086
+ original.push(toDiffLine(code, "context", `original-context-${index2}`, originalLine++));
3087
+ modified.push(toDiffLine(code, "context", `modified-context-${index2}`, modifiedLine++));
3088
+ }
3089
+ }
3090
+ return [
3091
+ { key: "original", className: "markstream-pre__diff-pane--original", lines: original },
3092
+ { key: "modified", className: "markstream-pre__diff-pane--modified", lines: modified }
3093
+ ];
3094
+ }
3095
+ const diffPreviewPanes = computed(() => isDiffPreview.value ? buildDiffPanes(isInlineDiffPreview.value) : []);
3096
+ return { __sfc: true, props, normalizedLanguage, languageClass, isDiffPreview, isInlineDiffPreview, displayCode, ariaLabel, splitLines, isRemovedDiffLine, isAddedDiffLine, toDiffLine, buildDiffPanes, diffPreviewPanes };
2982
3097
  }
2983
3098
  });
2984
3099
  const PreCodeNode_vue_vue_type_style_index_0_lang = "";
2985
3100
  var _sfc_render$k = function render26() {
2986
3101
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2987
- return _c("pre", { class: [_setup.languageClass], attrs: { "aria-busy": _vm.node.loading === true, "aria-label": _setup.ariaLabel, "data-language": _setup.normalizedLanguage, "tabindex": "0" } }, [_c("code", { attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_vm.node.code) } })]);
3102
+ return _c("pre", { class: [
3103
+ _setup.languageClass,
3104
+ {
3105
+ "markstream-pre--line-numbers": _setup.props.showLineNumbers,
3106
+ "markstream-pre--diff-preview": _setup.isDiffPreview,
3107
+ "markstream-pre--diff-inline": _setup.isInlineDiffPreview
3108
+ }
3109
+ ], attrs: { "aria-busy": _vm.node.loading === true, "aria-label": _setup.ariaLabel, "data-language": _setup.normalizedLanguage, "data-markstream-line-numbers": _setup.props.showLineNumbers ? "1" : void 0, "data-markstream-pre": "1", "tabindex": "0" } }, [_setup.isDiffPreview ? _c("code", { staticClass: "markstream-pre__diff-code", attrs: { "translate": "no" } }, _vm._l(_setup.diffPreviewPanes, function(pane) {
3110
+ return _c("span", { key: pane.key, staticClass: "markstream-pre__diff-pane", class: pane.className }, _vm._l(pane.lines, function(line) {
3111
+ return _c("span", { key: line.key, staticClass: "markstream-pre__diff-line", class: [`markstream-pre__diff-line--${line.kind}`, { "markstream-pre__diff-line--empty": !line.code.trim() }] }, [_c("span", { staticClass: "markstream-pre__diff-rail", attrs: { "aria-hidden": "true" } }), _c("span", { staticClass: "markstream-pre__diff-number", attrs: { "aria-hidden": "true" } }, [_vm._v(_vm._s(line.number))]), _c("span", { staticClass: "markstream-pre__diff-content" }, [_c("span", { staticClass: "markstream-pre__diff-content-inner" }, [_vm._v(_vm._s(line.code))])])]);
3112
+ }), 0);
3113
+ }), 0) : _c("code", { attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_setup.displayCode) } })]);
2988
3114
  };
2989
3115
  var _sfc_staticRenderFns$k = [];
2990
3116
  var __component__$k = /* @__PURE__ */ normalizeComponent(
@@ -3240,628 +3366,1132 @@ var __component__$g = /* @__PURE__ */ normalizeComponent(
3240
3366
  null
3241
3367
  );
3242
3368
  const VmrContainerNode = __component__$g.exports;
3243
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
3244
- __name: "LegacyNodesRenderer",
3245
- props: {
3246
- nodes: null,
3247
- customId: null,
3248
- indexKey: null,
3249
- typewriter: { type: Boolean, default: true },
3250
- showTooltips: { type: Boolean, default: true },
3251
- codeBlockStream: { type: Boolean, default: true },
3252
- codeBlockDarkTheme: null,
3253
- codeBlockLightTheme: null,
3254
- codeBlockMonacoOptions: null,
3255
- codeBlockMinWidth: null,
3256
- codeBlockMaxWidth: null,
3257
- codeBlockProps: null,
3258
- renderCodeBlocksAsPre: { type: Boolean },
3259
- themes: null,
3260
- isDark: { type: Boolean },
3261
- customHtmlTags: null,
3262
- htmlPolicy: null
3263
- },
3264
- emits: ["copy", "handleArtifactClick", "click"],
3265
- setup(__props, { emit }) {
3266
- const props = __props;
3267
- const nodeComponents = {
3268
- text: TextNode,
3269
- paragraph: ParagraphNode,
3270
- heading: HeadingNode,
3271
- code_block: PreCodeNode,
3272
- list: ListNode,
3273
- list_item: ListItemNode,
3274
- blockquote: BlockquoteNode,
3275
- table: TableNode,
3276
- definition_list: DefinitionListNode,
3277
- footnote: FootnoteNode,
3278
- footnote_reference: FootnoteReferenceNode,
3279
- footnote_anchor: FootnoteAnchorNode,
3280
- admonition: AdmonitionNode,
3281
- vmr_container: VmrContainerNode,
3282
- hardbreak: HardBreakNode,
3283
- link: LinkNode,
3284
- image: ImageNode,
3285
- thematic_break: ThematicBreakNode,
3286
- math_inline: MathInlineNodeAsync,
3287
- math_block: MathBlockNodeAsync,
3288
- strong: StrongNode,
3289
- emphasis: EmphasisNode,
3290
- strikethrough: StrikethroughNode,
3291
- highlight: HighlightNode,
3292
- insert: InsertNode,
3293
- subscript: SubscriptNode,
3294
- superscript: SuperscriptNode,
3295
- emoji: EmojiNode,
3296
- checkbox: CheckboxNode,
3297
- checkbox_input: CheckboxNode,
3298
- inline_code: InlineCodeNode,
3299
- html_inline: HtmlInlineNode,
3300
- html_block: HtmlBlockNode,
3301
- reference: ReferenceNode
3302
- };
3303
- const customComponentsMap = computed(() => {
3304
- void customComponentsRevision.value;
3305
- return getCustomNodeComponents(props.customId);
3306
- });
3307
- const indexPrefix = computed(() => props.indexKey != null ? String(props.indexKey) : "legacy-renderer");
3308
- const codeBlockBindings = computed(() => __spreadValues({
3309
- stream: props.codeBlockStream,
3310
- darkTheme: props.codeBlockDarkTheme,
3311
- lightTheme: props.codeBlockLightTheme,
3312
- monacoOptions: props.codeBlockMonacoOptions,
3313
- themes: props.themes,
3314
- minWidth: props.codeBlockMinWidth,
3315
- maxWidth: props.codeBlockMaxWidth
3316
- }, props.codeBlockProps || {}));
3317
- const nonCodeBindings = computed(() => {
3318
- var _a2;
3319
- return { typewriter: props.typewriter, htmlPolicy: (_a2 = props.htmlPolicy) != null ? _a2 : "safe" };
3320
- });
3321
- const linkBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltip: props.showTooltips } : {}));
3322
- const listBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}));
3323
- const effectiveCustomHtmlTagsSet = computed(() => {
3324
- return new Set(normalizeCustomHtmlTags(props.customHtmlTags));
3325
- });
3326
- const renderedItems = computed(() => {
3327
- const nodes = Array.isArray(props.nodes) ? props.nodes : [];
3328
- return nodes.map((rawNode, index2) => {
3329
- var _a2, _b, _c, _d;
3330
- let node = rawNode;
3331
- const language = getCodeBlockLanguage(node);
3332
- const type = String((node == null ? void 0 : node.type) || "unknown");
3333
- let component = getNodeComponent(node, language);
3334
- if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
3335
- const tag = String((_a2 = node.tag) != null ? _a2 : "").trim().toLowerCase() || getHtmlTagFromContent(node.content);
3336
- if (tag) {
3337
- if (effectiveCustomHtmlTagsSet.value.has(tag)) {
3338
- const customComponents = customComponentsMap.value;
3339
- const customForTag = customComponents[tag];
3340
- if (customForTag) {
3341
- component = customForTag;
3342
- node = __spreadProps(__spreadValues({}, node), {
3343
- type: tag,
3344
- tag,
3345
- content: stripCustomHtmlWrapper(node.content, tag)
3346
- });
3347
- }
3348
- } else if (shouldRenderUnknownHtmlTagAsText((_b = node.content) != null ? _b : node.raw, tag)) {
3349
- const rawContent = String((_d = (_c = node.content) != null ? _c : node.raw) != null ? _d : "");
3350
- if (node.type === "html_inline") {
3351
- component = TextNode;
3352
- node = {
3353
- type: "text",
3354
- content: rawContent,
3355
- raw: rawContent
3356
- };
3357
- } else {
3358
- component = ParagraphNode;
3359
- node = {
3360
- type: "paragraph",
3361
- children: [{ type: "text", content: rawContent, raw: rawContent }],
3362
- raw: rawContent
3363
- };
3364
- }
3365
- }
3366
- }
3367
- }
3368
- return {
3369
- index: index2,
3370
- indexKey: `${indexPrefix.value}-${index2}`,
3371
- // Keep code blocks mounted during streaming so Shiki/Monaco renderers can
3372
- // preserve their last successful DOM instead of flashing back to <pre>.
3373
- renderKey: type === "code_block" ? `${indexPrefix.value}-${index2}-${type}` : `${indexPrefix.value}-${index2}-${type}-${String((rawNode == null ? void 0 : rawNode.raw) || "").length}`,
3374
- node,
3375
- isCodeBlock: (node == null ? void 0 : node.type) === "code_block",
3376
- component,
3377
- bindings: getBindingsFor(node, language)
3378
- };
3379
- });
3380
- });
3381
- function getCodeBlockLanguage(node) {
3382
- var _a2;
3383
- return (node == null ? void 0 : node.type) === "code_block" ? String((_a2 = node.language) != null ? _a2 : "").trim().toLowerCase() : "";
3384
- }
3385
- function getNodeComponent(node, language) {
3386
- if (!node)
3387
- return FallbackComponent;
3388
- const customComponents = customComponentsMap.value;
3389
- const customForType = customComponents[String(node.type)];
3390
- if (node.type === "code_block") {
3391
- const lang = language != null ? language : getCodeBlockLanguage(node);
3392
- const customForLanguage = lang ? customComponents[lang] : void 0;
3393
- if (customForLanguage)
3394
- return customForLanguage;
3395
- if (lang === "mermaid") {
3396
- const customMermaid = customComponents.mermaid;
3397
- return customMermaid || PreCodeNode;
3398
- }
3399
- if (lang === "infographic") {
3400
- const customInfographic = customComponents.infographic;
3401
- return customInfographic || PreCodeNode;
3402
- }
3403
- if (lang === "d2" || lang === "d2lang") {
3404
- const customD2 = customComponents.d2;
3405
- return customD2 || PreCodeNode;
3406
- }
3407
- if (customForType)
3408
- return customForType;
3409
- const customCodeBlock = customComponents.code_block;
3410
- return customCodeBlock || (props.renderCodeBlocksAsPre ? PreCodeNode : PreCodeNode);
3369
+ let isPreload = false;
3370
+ function preload(m) {
3371
+ return __async(this, null, function* () {
3372
+ if (isPreload)
3373
+ return;
3374
+ isPreload = true;
3375
+ const existingEnv = globalThis == null ? void 0 : globalThis.MonacoEnvironment;
3376
+ if (existingEnv && (typeof existingEnv.getWorker === "function" || typeof existingEnv.getWorkerUrl === "function"))
3377
+ return;
3378
+ return m.preloadMonacoWorkers();
3379
+ });
3380
+ }
3381
+ let mod = null;
3382
+ let importAttempted = false;
3383
+ function warmupShikiTokenizer(m) {
3384
+ return __async(this, null, function* () {
3385
+ const getOrCreateHighlighter = m == null ? void 0 : m.getOrCreateHighlighter;
3386
+ if (typeof getOrCreateHighlighter !== "function")
3387
+ return true;
3388
+ try {
3389
+ const highlighter = yield getOrCreateHighlighter(
3390
+ ["vitesse-dark", "vitesse-light"],
3391
+ ["plaintext", "text", "javascript"]
3392
+ );
3393
+ if (highlighter && typeof highlighter.codeToTokens === "function") {
3394
+ highlighter.codeToTokens("const a = 1", { lang: "javascript", theme: "vitesse-dark" });
3411
3395
  }
3412
- if (customForType)
3413
- return customForType;
3414
- return nodeComponents[String(node.type)] || FallbackComponent;
3396
+ return true;
3397
+ } catch (err) {
3398
+ console.warn("[markstream-vue2] Failed to warm up Shiki tokenizer; disabling stream-monaco for this session.", err);
3399
+ return false;
3415
3400
  }
3416
- function getBindingsFor(node, language) {
3417
- const lang = language != null ? language : getCodeBlockLanguage(node);
3418
- if (lang === "mermaid" || lang === "infographic" || lang === "d2" || lang === "d2lang")
3419
- return {};
3420
- if (node.type === "link")
3421
- return linkBindings.value;
3422
- if (node.type === "list")
3423
- return listBindings.value;
3424
- return node.type === "code_block" ? codeBlockBindings.value : nonCodeBindings.value;
3425
- }
3426
- function handleClick(event) {
3427
- emit("click", event);
3401
+ });
3402
+ }
3403
+ function getUseMonaco() {
3404
+ return __async(this, null, function* () {
3405
+ var _a2;
3406
+ if (mod)
3407
+ return mod;
3408
+ if (importAttempted)
3409
+ return null;
3410
+ try {
3411
+ const imported = yield import("stream-monaco/legacy");
3412
+ mod = (_a2 = imported == null ? void 0 : imported.default) != null ? _a2 : imported;
3413
+ yield preload(mod);
3414
+ const ok = yield warmupShikiTokenizer(mod);
3415
+ if (!ok) {
3416
+ mod = null;
3417
+ importAttempted = true;
3418
+ return null;
3419
+ }
3420
+ return mod;
3421
+ } catch (e) {
3422
+ importAttempted = true;
3423
+ return null;
3428
3424
  }
3429
- return { __sfc: true, props, emit, nodeComponents, customComponentsMap, indexPrefix, codeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getNodeComponent, getBindingsFor, handleClick };
3430
- }
3431
- });
3432
- var _sfc_render$f = function render31() {
3433
- var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3434
- 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) {
3435
- 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({ 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) {
3436
- return _setup.emit("copy", $event);
3437
- }, "handle-artifact-click": function($event) {
3438
- return _setup.emit("handleArtifactClick", $event);
3439
- } } }, "component", item.bindings, false))], 1)]);
3440
- }), 0);
3425
+ });
3426
+ }
3427
+ 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';
3428
+ const CppIcon = '<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 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n';
3429
+ const CsharpIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n';
3430
+ const CssIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n';
3431
+ const GoIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n';
3432
+ const HtmlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n';
3433
+ const JavaIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n';
3434
+ const JsxReactIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n';
3435
+ const JsIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n';
3436
+ const JsonIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n';
3437
+ const KotlinIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n';
3438
+ const MarkdownIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n';
3439
+ const MermaidIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n';
3440
+ const PhpIcon = '<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="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n';
3441
+ const PythonIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n';
3442
+ const RubyIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n';
3443
+ const RustIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n';
3444
+ const SassIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n';
3445
+ const ShellIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n';
3446
+ const SqlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n';
3447
+ const SquareCodeIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>';
3448
+ const SvgIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />\n</svg>\n';
3449
+ const TextIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';
3450
+ const TsReactIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n';
3451
+ const TsIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n';
3452
+ const VueIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n';
3453
+ const XmlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n';
3454
+ const YamlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n';
3455
+ let userLanguageIconResolver = null;
3456
+ let extendedLanguageIconMap = null;
3457
+ let extendedLanguageIconPromise = null;
3458
+ const languageIconsRevision = ref(0);
3459
+ const DEFAULT_LANGUAGE_ICON = SquareCodeIcon;
3460
+ const CORE_LANGUAGE_ICON_MAP = {
3461
+ "": TextIcon,
3462
+ "plain": TextIcon,
3463
+ "text": TextIcon,
3464
+ "javascript": JsIcon,
3465
+ "typescript": TsIcon,
3466
+ "jsx": JsxReactIcon,
3467
+ "tsx": TsReactIcon,
3468
+ "html": HtmlIcon,
3469
+ "css": CssIcon,
3470
+ "scss": SassIcon,
3471
+ "json": JsonIcon,
3472
+ "python": PythonIcon,
3473
+ "ruby": RubyIcon,
3474
+ "go": GoIcon,
3475
+ "java": JavaIcon,
3476
+ "kotlin": KotlinIcon,
3477
+ "c": CIcon,
3478
+ "cpp": CppIcon,
3479
+ "cs": CsharpIcon,
3480
+ "csharp": CsharpIcon,
3481
+ "php": PhpIcon,
3482
+ "shell": ShellIcon,
3483
+ "powershell": ShellIcon,
3484
+ "sql": SqlIcon,
3485
+ "yaml": YamlIcon,
3486
+ "markdown": MarkdownIcon,
3487
+ "xml": XmlIcon,
3488
+ "rust": RustIcon,
3489
+ "vue": VueIcon,
3490
+ "mermaid": MermaidIcon,
3491
+ "svg": SvgIcon
3441
3492
  };
3442
- var _sfc_staticRenderFns$f = [];
3443
- var __component__$f = /* @__PURE__ */ normalizeComponent(
3444
- _sfc_main$f,
3445
- _sfc_render$f,
3446
- _sfc_staticRenderFns$f,
3447
- false,
3448
- null,
3449
- null,
3450
- null,
3451
- null
3452
- );
3453
- const LegacyNodesRenderer = __component__$f.exports;
3454
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
3455
- __name: "BlockquoteNode",
3456
- props: {
3457
- node: null,
3458
- indexKey: null,
3459
- typewriter: { type: Boolean },
3460
- customId: null
3461
- },
3462
- setup(__props) {
3463
- const props = __props;
3464
- const instance = getCurrentInstance();
3465
- const nestedRenderer = computed(() => {
3466
- const vm = instance == null ? void 0 : instance.proxy;
3467
- return isLegacyVue26Vm(vm) ? LegacyNodesRenderer : NodeRenderer;
3468
- });
3469
- return { __sfc: true, props, instance, nestedRenderer };
3470
- }
3471
- });
3472
- const BlockquoteNode_vue_vue_type_style_index_0_scoped_0bfb818f_lang = "";
3473
- var _sfc_render$e = function render32() {
3474
- var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3475
- 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) {
3476
- return _vm.$emit("copy", $event);
3477
- } } })], 1);
3493
+ const LANGUAGE_ALIAS_MAP = {
3494
+ "": "",
3495
+ "javascript": "javascript",
3496
+ "js": "javascript",
3497
+ "mjs": "javascript",
3498
+ "cjs": "javascript",
3499
+ "typescript": "typescript",
3500
+ "ts": "typescript",
3501
+ "jsx": "jsx",
3502
+ "tsx": "tsx",
3503
+ "golang": "go",
3504
+ "py": "python",
3505
+ "rb": "ruby",
3506
+ "sh": "shell",
3507
+ "bash": "shell",
3508
+ "zsh": "shell",
3509
+ "shellscript": "shell",
3510
+ "bat": "shell",
3511
+ "batch": "shell",
3512
+ "ps1": "powershell",
3513
+ "plaintext": "plain",
3514
+ "text": "plain",
3515
+ "txt": "plain",
3516
+ "c++": "cpp",
3517
+ "c#": "csharp",
3518
+ "cs": "csharp",
3519
+ "objective-c": "objectivec",
3520
+ "objective-c++": "objectivecpp",
3521
+ "yml": "yaml",
3522
+ "md": "markdown",
3523
+ "rs": "rust",
3524
+ "kt": "kotlin",
3525
+ "d": "dlang",
3526
+ "vbnet": "vb.net"
3478
3527
  };
3479
- var _sfc_staticRenderFns$e = [];
3480
- var __component__$e = /* @__PURE__ */ normalizeComponent(
3481
- _sfc_main$e,
3482
- _sfc_render$e,
3483
- _sfc_staticRenderFns$e,
3484
- false,
3485
- null,
3486
- "0bfb818f",
3487
- null,
3488
- null
3489
- );
3490
- const BlockquoteNode = __component__$e.exports;
3491
- const MERMAID_PREVIEW_MIN_HEIGHT = 360;
3492
- const MERMAID_PREVIEW_MAX_HEIGHT = 500;
3493
- const INFOGRAPHIC_PREVIEW_MIN_HEIGHT = 360;
3494
- const INFOGRAPHIC_PREVIEW_MAX_HEIGHT = 500;
3495
- function parsePositiveNumber(value) {
3496
- const numeric = typeof value === "number" ? value : Number.parseFloat(String(value != null ? value : ""));
3497
- return Number.isFinite(numeric) && numeric > 0 ? numeric : null;
3498
- }
3499
- function getMermaidDiagramKind(code) {
3500
- var _a2;
3501
- for (const rawLine of code.split(/\r?\n/)) {
3502
- const line = rawLine.trim();
3503
- if (!line || line.startsWith("%%"))
3504
- continue;
3505
- const match = line.match(/^([A-Z][\w-]*)\b/i);
3506
- return ((_a2 = match == null ? void 0 : match[1]) == null ? void 0 : _a2.toLowerCase()) || "";
3507
- }
3508
- return "";
3528
+ function extractLanguageToken(lang) {
3529
+ if (!lang)
3530
+ return "";
3531
+ const trimmed = lang.trim();
3532
+ if (!trimmed)
3533
+ return "";
3534
+ const [firstToken] = trimmed.split(/\s+/);
3535
+ const [base] = firstToken.split(":");
3536
+ return base.toLowerCase();
3509
3537
  }
3510
- function estimateMermaidPreviewHeight(code) {
3511
- const meaningfulLines = code.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("%%"));
3512
- const lineCount = Math.max(1, meaningfulLines.length);
3513
- const kind = getMermaidDiagramKind(code);
3514
- if (kind === "gantt")
3515
- return 220 + lineCount * 28;
3516
- if (kind === "sequencediagram")
3517
- return 180 + lineCount * 26;
3518
- if (kind === "classdiagram" || kind === "statediagram" || kind === "erdiagram")
3519
- return 180 + lineCount * 24;
3520
- if (kind === "flowchart" || kind === "graph")
3521
- return 170 + lineCount * 28;
3522
- return 200 + lineCount * 22;
3538
+ function loadExtendedLanguageIconMap() {
3539
+ return __async(this, null, function* () {
3540
+ if (extendedLanguageIconMap)
3541
+ return extendedLanguageIconMap;
3542
+ if (!extendedLanguageIconPromise) {
3543
+ extendedLanguageIconPromise = import("./chunks/languageIconExtended-feb078ee.js").then((mod2) => {
3544
+ extendedLanguageIconMap = mod2.EXTENDED_LANGUAGE_ICON_MAP;
3545
+ languageIconsRevision.value++;
3546
+ return extendedLanguageIconMap;
3547
+ }).catch(() => null);
3548
+ }
3549
+ return extendedLanguageIconPromise;
3550
+ });
3523
3551
  }
3524
- function estimateInfographicPreviewHeight(code) {
3525
- const itemCount = code.split(/\r?\n/).filter((line) => /^\s*-\s+/.test(line)).length;
3526
- if (itemCount >= 3)
3527
- return INFOGRAPHIC_PREVIEW_MAX_HEIGHT;
3528
- if (itemCount > 0)
3529
- return 280 + itemCount * 60;
3530
- return INFOGRAPHIC_PREVIEW_MIN_HEIGHT;
3552
+ function setLanguageIconResolver(resolver) {
3553
+ userLanguageIconResolver = resolver != null ? resolver : null;
3531
3554
  }
3532
- function clampPreviewHeight(height, minHeight = MERMAID_PREVIEW_MIN_HEIGHT, maxHeight = MERMAID_PREVIEW_MAX_HEIGHT) {
3533
- return maxHeight == null ? Math.max(minHeight, height) : Math.min(Math.max(minHeight, height), maxHeight);
3555
+ function normalizeLanguageIdentifier(lang) {
3556
+ var _a2;
3557
+ const token = extractLanguageToken(lang);
3558
+ return (_a2 = LANGUAGE_ALIAS_MAP[token]) != null ? _a2 : token;
3534
3559
  }
3535
- function clampMermaidPreviewHeight(height, minHeight = MERMAID_PREVIEW_MIN_HEIGHT, maxHeight = MERMAID_PREVIEW_MAX_HEIGHT) {
3536
- return clampPreviewHeight(height, minHeight, maxHeight);
3560
+ function resolveMonacoLanguageId(lang) {
3561
+ const canonical = normalizeLanguageIdentifier(lang);
3562
+ if (!canonical)
3563
+ return "plaintext";
3564
+ switch (canonical) {
3565
+ case "plain":
3566
+ return "plaintext";
3567
+ case "jsx":
3568
+ return "javascript";
3569
+ case "tsx":
3570
+ return "typescript";
3571
+ default:
3572
+ return canonical;
3573
+ }
3537
3574
  }
3538
- function clampInfographicPreviewHeight(height, minHeight = INFOGRAPHIC_PREVIEW_MIN_HEIGHT, maxHeight = INFOGRAPHIC_PREVIEW_MAX_HEIGHT) {
3539
- return clampPreviewHeight(height, minHeight, maxHeight);
3575
+ function preloadExtendedLanguageIcons() {
3576
+ return __async(this, null, function* () {
3577
+ yield loadExtendedLanguageIconMap();
3578
+ });
3540
3579
  }
3541
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
3542
- __name: "NodeRenderer",
3580
+ function getLanguageIcon(lang) {
3581
+ if (userLanguageIconResolver) {
3582
+ const hit = userLanguageIconResolver(lang);
3583
+ if (hit != null && hit !== "")
3584
+ return hit;
3585
+ }
3586
+ const normalized = normalizeLanguageIdentifier(lang);
3587
+ const coreIcon = CORE_LANGUAGE_ICON_MAP[normalized];
3588
+ if (coreIcon)
3589
+ return coreIcon;
3590
+ const extendedIcon = extendedLanguageIconMap == null ? void 0 : extendedLanguageIconMap[normalized];
3591
+ if (extendedIcon)
3592
+ return extendedIcon;
3593
+ void loadExtendedLanguageIconMap();
3594
+ return DEFAULT_LANGUAGE_ICON;
3595
+ }
3596
+ const languageMap = {
3597
+ "js": "JavaScript",
3598
+ "javascript": "JavaScript",
3599
+ "ts": "TypeScript",
3600
+ "jsx": "JSX",
3601
+ "tsx": "TSX",
3602
+ "html": "HTML",
3603
+ "css": "CSS",
3604
+ "scss": "SCSS",
3605
+ "json": "JSON",
3606
+ "py": "Python",
3607
+ "python": "Python",
3608
+ "rb": "Ruby",
3609
+ "go": "Go",
3610
+ "java": "Java",
3611
+ "c": "C",
3612
+ "cpp": "C++",
3613
+ "cs": "C#",
3614
+ "csharp": "C#",
3615
+ "php": "PHP",
3616
+ "sh": "Shell",
3617
+ "bash": "Bash",
3618
+ "sql": "SQL",
3619
+ "yaml": "YAML",
3620
+ "md": "Markdown",
3621
+ "d2": "D2",
3622
+ "d2lang": "D2",
3623
+ "": "Plain Text",
3624
+ "plain": "Plain Text"
3625
+ };
3626
+ const DEFAULT_CACHE_KEY = "markstream-vue2-nested-nodes";
3627
+ const markdownCache = /* @__PURE__ */ new Map();
3628
+ function parseNestedMarkdownToNodes(input, options = {}) {
3629
+ if (Array.isArray(input.nodes))
3630
+ return input.nodes.slice();
3631
+ const nestedNode = input.node;
3632
+ if (nestedNode) {
3633
+ const children = getNodeList(nestedNode.children);
3634
+ if (children.length > 0)
3635
+ return children.slice();
3636
+ }
3637
+ const content2 = resolveContent(input);
3638
+ if (!content2)
3639
+ return [];
3640
+ const parseOptions = resolveParseOptions(input, options);
3641
+ const markdown = resolveMarkdownInstance(options);
3642
+ return parseMarkdownToStructure(content2, markdown, parseOptions);
3643
+ }
3644
+ function resolveContent(input) {
3645
+ var _a2;
3646
+ if (typeof input.content === "string")
3647
+ return input.content;
3648
+ if (typeof ((_a2 = input.node) == null ? void 0 : _a2.content) === "string")
3649
+ return input.node.content;
3650
+ return "";
3651
+ }
3652
+ function resolveParseOptions(input, options) {
3653
+ var _a2, _b;
3654
+ const base = (_a2 = options.parseOptions) != null ? _a2 : {};
3655
+ const resolvedFinal = (_b = options.final) != null ? _b : resolveFinalFromNode(input.node);
3656
+ const customHtmlTags = mergeCustomHtmlTags(options.customHtmlTags, base.customHtmlTags);
3657
+ if (resolvedFinal == null && customHtmlTags.length === 0)
3658
+ return base;
3659
+ return __spreadValues(__spreadValues(__spreadValues({}, base), resolvedFinal == null ? {} : { final: resolvedFinal }), customHtmlTags.length === 0 ? {} : { customHtmlTags });
3660
+ }
3661
+ function resolveFinalFromNode(node) {
3662
+ if (!node || typeof node !== "object")
3663
+ return void 0;
3664
+ if (typeof node.loading === "boolean")
3665
+ return !node.loading;
3666
+ return void 0;
3667
+ }
3668
+ function resolveMarkdownInstance(options) {
3669
+ var _a2;
3670
+ const normalizedTags = mergeCustomHtmlTags(options.customHtmlTags, (_a2 = options.parseOptions) == null ? void 0 : _a2.customHtmlTags);
3671
+ const cacheKey = `${options.cacheKey || DEFAULT_CACHE_KEY}::${normalizedTags.join(",")}`;
3672
+ let markdown = markdownCache.get(cacheKey);
3673
+ if (!markdown) {
3674
+ markdown = getMarkdown(cacheKey, {
3675
+ customHtmlTags: normalizedTags
3676
+ });
3677
+ markdownCache.set(cacheKey, markdown);
3678
+ }
3679
+ return options.customMarkdownIt ? options.customMarkdownIt(markdown) : markdown;
3680
+ }
3681
+ function getNodeList(value) {
3682
+ return Array.isArray(value) ? value : [];
3683
+ }
3684
+ const RESERVED_CODE_BLOCK_EXTRA_PROPS = /* @__PURE__ */ new Set([
3685
+ "node",
3686
+ "key",
3687
+ "ref",
3688
+ "ctx",
3689
+ "renderNode",
3690
+ "indexKey",
3691
+ "__proto__",
3692
+ "prototype",
3693
+ "constructor"
3694
+ ]);
3695
+ function getCodeBlockExtraProps(source, options = {}) {
3696
+ var _a2;
3697
+ const extraProps = {};
3698
+ const omittedProps = new Set((_a2 = options.omit) != null ? _a2 : []);
3699
+ if (!source || typeof source !== "object")
3700
+ return extraProps;
3701
+ const descriptors = Object.getOwnPropertyDescriptors(source);
3702
+ for (const [key, descriptor] of Object.entries(descriptors)) {
3703
+ if (RESERVED_CODE_BLOCK_EXTRA_PROPS.has(key) || omittedProps.has(key))
3704
+ continue;
3705
+ if (!descriptor.enumerable || !("value" in descriptor))
3706
+ continue;
3707
+ extraProps[key] = descriptor.value;
3708
+ }
3709
+ return extraProps;
3710
+ }
3711
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3712
+ __name: "LegacyNodesRenderer",
3543
3713
  props: {
3544
- content: null,
3545
3714
  nodes: null,
3546
- final: { type: Boolean },
3547
- parseOptions: null,
3548
- customMarkdownIt: null,
3549
- debugPerformance: { type: Boolean, default: false },
3550
- customHtmlTags: null,
3551
- htmlPolicy: null,
3552
- viewportPriority: { type: Boolean },
3715
+ customId: null,
3716
+ indexKey: null,
3717
+ typewriter: { type: Boolean, default: false },
3718
+ fade: { type: Boolean, default: true },
3719
+ showTooltips: { type: Boolean, default: true },
3553
3720
  codeBlockStream: { type: Boolean, default: true },
3554
3721
  codeBlockDarkTheme: null,
3555
3722
  codeBlockLightTheme: null,
3556
3723
  codeBlockMonacoOptions: null,
3557
- renderCodeBlocksAsPre: { type: Boolean },
3558
3724
  codeBlockMinWidth: null,
3559
3725
  codeBlockMaxWidth: null,
3560
3726
  codeBlockProps: null,
3561
- mermaidProps: null,
3562
- d2Props: null,
3563
- infographicProps: null,
3564
- showTooltips: { type: Boolean, default: true },
3727
+ renderCodeBlocksAsPre: { type: Boolean },
3565
3728
  themes: null,
3729
+ langs: null,
3566
3730
  isDark: { type: Boolean },
3567
- customId: null,
3568
- indexKey: null,
3569
- typewriter: { type: Boolean, default: true },
3570
- batchRendering: { type: Boolean, default: true },
3571
- initialRenderBatchSize: { default: 40 },
3572
- renderBatchSize: { default: 80 },
3573
- renderBatchDelay: { default: 16 },
3574
- renderBatchBudgetMs: { default: 6 },
3575
- renderBatchIdleTimeoutMs: { default: 120 },
3576
- deferNodesUntilVisible: { type: Boolean, default: true },
3577
- maxLiveNodes: { default: 320 },
3578
- liveNodeBuffer: { default: 60 }
3731
+ customHtmlTags: null,
3732
+ htmlPolicy: null
3579
3733
  },
3580
- emits: ["copy", "handleArtifactClick", "click", "mouseover", "mouseout"],
3734
+ emits: ["copy", "handleArtifactClick", "click"],
3581
3735
  setup(__props, { emit }) {
3582
- var _a2, _b, _c;
3583
3736
  const props = __props;
3584
- const MAX_DEFERRED_NODE_COUNT = 900;
3585
- const MAX_VIEWPORT_OBSERVER_TARGETS = 640;
3586
- const VIEWPORT_PRIORITY_RECOVERY_COUNT = 200;
3587
- const containerRef = ref();
3588
- const viewportPriorityAutoDisabled = ref(false);
3589
- const SCROLL_PARENT_OVERFLOW_RE = /auto|scroll|overlay/i;
3590
- const isClient = typeof window !== "undefined";
3591
- const instance = getCurrentInstance();
3592
- const debugPerformanceEnabled = computed(() => props.debugPerformance && isClient && typeof console !== "undefined");
3593
- const attrs = computed(() => {
3594
- var _a3, _b2;
3595
- return (_b2 = (_a3 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a3.$attrs) != null ? _b2 : {};
3737
+ provide("markstreamTypewriter", computed(() => props.typewriter === true));
3738
+ provide("markstreamFade", computed(() => props.fade !== false));
3739
+ function handleCopy(code) {
3740
+ emit("copy", code);
3741
+ }
3742
+ function handleArtifactClick(payload) {
3743
+ emit("handleArtifactClick", payload);
3744
+ }
3745
+ const nodeComponents = {
3746
+ text: TextNode,
3747
+ paragraph: ParagraphNode,
3748
+ heading: HeadingNode,
3749
+ code_block: PreCodeNode,
3750
+ list: ListNode,
3751
+ list_item: ListItemNode,
3752
+ blockquote: BlockquoteNode,
3753
+ table: TableNode,
3754
+ definition_list: DefinitionListNode,
3755
+ footnote: FootnoteNode,
3756
+ footnote_reference: FootnoteReferenceNode,
3757
+ footnote_anchor: FootnoteAnchorNode,
3758
+ admonition: AdmonitionNode,
3759
+ vmr_container: VmrContainerNode,
3760
+ hardbreak: HardBreakNode,
3761
+ link: LinkNode,
3762
+ image: ImageNode,
3763
+ thematic_break: ThematicBreakNode,
3764
+ math_inline: MathInlineNodeAsync,
3765
+ math_block: MathBlockNodeAsync,
3766
+ strong: StrongNode,
3767
+ emphasis: EmphasisNode,
3768
+ strikethrough: StrikethroughNode,
3769
+ highlight: HighlightNode,
3770
+ insert: InsertNode,
3771
+ subscript: SubscriptNode,
3772
+ superscript: SuperscriptNode,
3773
+ emoji: EmojiNode,
3774
+ checkbox: CheckboxNode,
3775
+ checkbox_input: CheckboxNode,
3776
+ inline_code: InlineCodeNode,
3777
+ html_inline: HtmlInlineNode,
3778
+ html_block: HtmlBlockNode,
3779
+ reference: ReferenceNode
3780
+ };
3781
+ const customComponentsMap = computed(() => {
3782
+ void customComponentsRevision.value;
3783
+ return getCustomNodeComponents(props.customId);
3596
3784
  });
3597
- const textStreamState = /* @__PURE__ */ new Map();
3598
- const streamRenderVersion = ref(0);
3599
- const resolvedShowTooltips = computed(() => {
3600
- var _a3;
3601
- if (typeof props.showTooltips === "boolean")
3602
- return props.showTooltips;
3603
- const raw = (_a3 = attrs.value.showTooltips) != null ? _a3 : attrs.value["show-tooltips"];
3604
- if (raw === "" || raw === true || raw === "true")
3605
- return true;
3606
- if (raw === false || raw === "false")
3607
- return false;
3608
- return void 0;
3785
+ const indexPrefix = computed(() => props.indexKey != null ? String(props.indexKey) : "legacy-renderer");
3786
+ const codeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
3787
+ const builtinCodeBlockExtraProps = computed(
3788
+ () => getCodeBlockExtraProps(props.codeBlockProps, { omit: ["langs"] })
3789
+ );
3790
+ const codeBlockBindings = computed(() => __spreadValues({
3791
+ stream: props.codeBlockStream,
3792
+ darkTheme: props.codeBlockDarkTheme,
3793
+ lightTheme: props.codeBlockLightTheme,
3794
+ monacoOptions: props.codeBlockMonacoOptions,
3795
+ themes: props.themes,
3796
+ minWidth: props.codeBlockMinWidth,
3797
+ maxWidth: props.codeBlockMaxWidth
3798
+ }, builtinCodeBlockExtraProps.value));
3799
+ const customCodeBlockBindings = computed(() => __spreadValues(__spreadProps(__spreadValues({}, codeBlockBindings.value), {
3800
+ langs: props.langs
3801
+ }), codeBlockExtraProps.value));
3802
+ const nonCodeBindings = computed(() => {
3803
+ var _a2;
3804
+ return { typewriter: props.typewriter, fade: props.fade, htmlPolicy: (_a2 = props.htmlPolicy) != null ? _a2 : "safe" };
3609
3805
  });
3610
- const inheritedHtmlPolicy = inject("markstreamHtmlPolicy", void 0);
3611
- const resolvedHtmlPolicy = computed(() => {
3612
- var _a3, _b2;
3613
- return (_b2 = (_a3 = props.htmlPolicy) != null ? _a3 : inheritedHtmlPolicy == null ? void 0 : inheritedHtmlPolicy.value) != null ? _b2 : "safe";
3806
+ const linkBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltip: props.showTooltips } : {}));
3807
+ const listBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}));
3808
+ const effectiveCustomHtmlTagsSet = computed(() => {
3809
+ return new Set(normalizeCustomHtmlTags(props.customHtmlTags));
3614
3810
  });
3615
- provide("markstreamShowTooltips", resolvedShowTooltips);
3616
- provide("markstreamHtmlPolicy", resolvedHtmlPolicy);
3617
- provide("markstreamTypewriter", computed(() => props.typewriter !== false));
3618
- provide("markstreamTextStreamState", textStreamState);
3619
- provide("markstreamStreamVersion", streamRenderVersion);
3620
- watch(
3621
- [() => props.content, () => props.nodes],
3622
- () => {
3623
- streamRenderVersion.value += 1;
3624
- },
3625
- { immediate: true }
3626
- );
3627
- function logPerf(label, data) {
3628
- if (!debugPerformanceEnabled.value)
3629
- return;
3630
- console.info(`[markstream-vue2][perf] ${label}`, data);
3811
+ const renderedItems = computed(() => {
3812
+ const nodes = Array.isArray(props.nodes) ? props.nodes : [];
3813
+ return nodes.map((rawNode, index2) => {
3814
+ var _a2, _b, _c, _d;
3815
+ let node = rawNode;
3816
+ const type = String((rawNode == null ? void 0 : rawNode.type) || "unknown");
3817
+ const language = getCodeBlockLanguage(node);
3818
+ let component = getNodeComponent(node, language);
3819
+ if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
3820
+ const tag = String((_a2 = node.tag) != null ? _a2 : "").trim().toLowerCase() || getHtmlTagFromContent(node.content);
3821
+ if (tag) {
3822
+ if (effectiveCustomHtmlTagsSet.value.has(tag)) {
3823
+ const customComponents = customComponentsMap.value;
3824
+ const customForTag = customComponents[tag];
3825
+ if (customForTag) {
3826
+ component = customForTag;
3827
+ node = __spreadProps(__spreadValues({}, node), {
3828
+ type: tag,
3829
+ tag,
3830
+ content: stripCustomHtmlWrapper(node.content, tag)
3831
+ });
3832
+ }
3833
+ } else if (shouldRenderUnknownHtmlTagAsText((_b = node.content) != null ? _b : node.raw, tag)) {
3834
+ const rawContent = String((_d = (_c = node.content) != null ? _c : node.raw) != null ? _d : "");
3835
+ if (node.type === "html_inline") {
3836
+ component = TextNode;
3837
+ node = {
3838
+ type: "text",
3839
+ content: rawContent,
3840
+ raw: rawContent
3841
+ };
3842
+ } else {
3843
+ component = ParagraphNode;
3844
+ node = {
3845
+ type: "paragraph",
3846
+ children: [{ type: "text", content: rawContent, raw: rawContent }],
3847
+ raw: rawContent
3848
+ };
3849
+ }
3850
+ }
3851
+ }
3852
+ }
3853
+ return {
3854
+ index: index2,
3855
+ indexKey: `${indexPrefix.value}-${index2}`,
3856
+ // Keep code blocks mounted during streaming so Shiki/Monaco renderers can
3857
+ // preserve their last successful DOM instead of flashing back to <pre>.
3858
+ renderKey: type === "code_block" ? `${indexPrefix.value}-${index2}-${type}` : `${indexPrefix.value}-${index2}-${type}-${String((rawNode == null ? void 0 : rawNode.raw) || "").length}`,
3859
+ node,
3860
+ isCodeBlock: (node == null ? void 0 : node.type) === "code_block",
3861
+ component,
3862
+ bindings: getBindingsFor(node, language, component)
3863
+ };
3864
+ });
3865
+ });
3866
+ function getCodeBlockLanguage(node) {
3867
+ var _a2;
3868
+ return (node == null ? void 0 : node.type) === "code_block" ? String((_a2 = node.language) != null ? _a2 : "").trim().toLowerCase() : "";
3631
3869
  }
3632
- function resolveViewportRoot(node) {
3633
- if (typeof window === "undefined")
3634
- return null;
3635
- const base = node != null ? node : containerRef.value;
3636
- if (!base)
3637
- return null;
3638
- const doc = base.ownerDocument || document;
3639
- const rootScrollable = doc.scrollingElement || doc.documentElement;
3640
- let current = base;
3641
- while (current) {
3642
- if (current === doc.body || current === rootScrollable)
3643
- break;
3644
- const style = window.getComputedStyle(current);
3645
- const overflowY = (style.overflowY || "").toLowerCase();
3646
- const overflow = (style.overflow || "").toLowerCase();
3647
- if (SCROLL_PARENT_OVERFLOW_RE.test(overflowY) || SCROLL_PARENT_OVERFLOW_RE.test(overflow))
3648
- return current;
3649
- current = current.parentElement;
3870
+ function getCustomCodeLanguageComponent(customComponents, language) {
3871
+ const raw = language.trim().toLowerCase();
3872
+ if (!raw)
3873
+ return void 0;
3874
+ for (const key of [raw, normalizeLanguageIdentifier(raw), normalizeShikiLanguage(raw)]) {
3875
+ const component = key && customComponents[key];
3876
+ if (component)
3877
+ return component;
3650
3878
  }
3651
- return null;
3879
+ return void 0;
3652
3880
  }
3653
- const instanceMsgId = props.customId ? `renderer-${props.customId}` : `renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`;
3654
- const defaultMd = getMarkdown(instanceMsgId);
3655
- const customTagCache = /* @__PURE__ */ new Map();
3656
- const EMPTY_PARSED_NODES = markRaw([]);
3657
- const customComponentsMap = computed(() => {
3658
- void customComponentsRevision.value;
3659
- return getCustomNodeComponents(props.customId);
3660
- });
3661
- const effectiveCustomHtmlTags = computed(() => {
3662
- var _a3;
3663
- return mergeCustomHtmlTags(props.customHtmlTags, (_a3 = props.parseOptions) == null ? void 0 : _a3.customHtmlTags);
3664
- });
3665
- const mdBase = computed(() => {
3666
- const { key, tags } = resolveCustomHtmlTags(effectiveCustomHtmlTags.value);
3667
- if (!key)
3668
- return defaultMd;
3669
- const cached = customTagCache.get(key);
3670
- if (cached)
3671
- return cached;
3672
- const md = getMarkdown(instanceMsgId, { customHtmlTags: tags });
3673
- customTagCache.set(key, md);
3674
- return md;
3675
- });
3676
- const mdInstance = computed(() => {
3677
- const base = mdBase.value;
3678
- return props.customMarkdownIt ? props.customMarkdownIt(base) : base;
3679
- });
3680
- function cloneNodeValue(value) {
3681
- if (Array.isArray(value))
3682
- return Object.freeze(value.map((item) => cloneNodeValue(item)));
3683
- if (!value || typeof value !== "object")
3684
- return value;
3685
- const output = {};
3686
- for (const [key, child] of Object.entries(value))
3687
- output[key] = cloneNodeValue(child);
3688
- return Object.freeze(output);
3881
+ function getNodeComponent(node, language) {
3882
+ if (!node)
3883
+ return FallbackComponent;
3884
+ const customComponents = customComponentsMap.value;
3885
+ const customForType = customComponents[String(node.type)];
3886
+ if (node.type === "code_block") {
3887
+ const lang = language != null ? language : getCodeBlockLanguage(node);
3888
+ const customForLanguage = lang ? getCustomCodeLanguageComponent(customComponents, lang) : void 0;
3889
+ if (customForLanguage)
3890
+ return customForLanguage;
3891
+ if (lang === "mermaid") {
3892
+ const customMermaid = customComponents.mermaid;
3893
+ return customMermaid || PreCodeNode;
3894
+ }
3895
+ if (lang === "infographic") {
3896
+ const customInfographic = customComponents.infographic;
3897
+ return customInfographic || PreCodeNode;
3898
+ }
3899
+ if (lang === "d2" || lang === "d2lang") {
3900
+ const customD2 = customComponents.d2;
3901
+ return customD2 || PreCodeNode;
3902
+ }
3903
+ if (customForType)
3904
+ return customForType;
3905
+ const customCodeBlock = customComponents.code_block;
3906
+ return customCodeBlock || (props.renderCodeBlocksAsPre ? PreCodeNode : PreCodeNode);
3907
+ }
3908
+ if (customForType)
3909
+ return customForType;
3910
+ return nodeComponents[String(node.type)] || FallbackComponent;
3689
3911
  }
3690
- function cloneParsedNodeList(nodes) {
3691
- return nodes.map((node) => cloneNodeValue(node));
3912
+ function isCustomCodeBlockComponent(component) {
3913
+ return Boolean(component && component === customComponentsMap.value.code_block);
3692
3914
  }
3693
- const mergedParseOptions = computed(() => {
3694
- var _a3, _b2;
3695
- const base = (_a3 = props.parseOptions) != null ? _a3 : {};
3696
- const resolvedFinal = (_b2 = props.final) != null ? _b2 : base.final;
3697
- const merged = effectiveCustomHtmlTags.value;
3698
- const hasFinal = resolvedFinal != null;
3699
- const hasCustom = merged.length > 0;
3700
- if (!hasFinal && !hasCustom)
3701
- return base;
3702
- return __spreadValues(__spreadValues(__spreadValues({}, base), hasFinal ? { final: resolvedFinal } : {}), hasCustom ? { customHtmlTags: merged } : {});
3703
- });
3704
- const effectiveCustomHtmlTagsSet = computed(() => {
3705
- var _a3;
3706
- const arr = (_a3 = mergedParseOptions.value.customHtmlTags) != null ? _a3 : [];
3707
- return new Set(arr.map((t) => String(t).trim().toLowerCase()).filter(Boolean));
3708
- });
3709
- const parsedNodes = computed(() => {
3710
- var _a3;
3711
- if (isLegacyVue26Vm(instance == null ? void 0 : instance.proxy) && !props.content && Array.isArray(props.nodes))
3712
- return EMPTY_PARSED_NODES;
3713
- if ((_a3 = props.nodes) == null ? void 0 : _a3.length)
3714
- return markRaw(cloneParsedNodeList(props.nodes));
3715
- if (props.content) {
3716
- const parseStart = debugPerformanceEnabled.value ? performance.now() : 0;
3717
- const parsed = parseMarkdownToStructure(props.content, mdInstance.value, mergedParseOptions.value);
3718
- if (debugPerformanceEnabled.value) {
3719
- logPerf("parse(sync)", {
3720
- ms: Math.round(performance.now() - parseStart),
3721
- nodes: parsed.length,
3722
- contentLength: props.content.length
3723
- });
3724
- }
3725
- return markRaw(cloneParsedNodeList(parsed));
3915
+ function isCustomLanguageCodeBlockComponent(component, language) {
3916
+ return Boolean(component && language && component === getCustomCodeLanguageComponent(customComponentsMap.value, language));
3917
+ }
3918
+ function getBindingsFor(node, language, component) {
3919
+ const lang = language != null ? language : getCodeBlockLanguage(node);
3920
+ if (node.type === "code_block" && isCustomLanguageCodeBlockComponent(component, lang)) {
3921
+ if (lang === "mermaid" || lang === "infographic" || lang === "d2" || lang === "d2lang")
3922
+ return {};
3923
+ return customCodeBlockBindings.value;
3726
3924
  }
3727
- return [];
3728
- });
3729
- const maxLiveNodesResolved = computed(() => {
3730
- var _a3;
3731
- return Math.max(1, (_a3 = props.maxLiveNodes) != null ? _a3 : 320);
3732
- });
3733
- const virtualizationEnabled = computed(() => {
3734
- var _a3;
3735
- if (((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0)
3736
- return false;
3737
- return parsedNodes.value.length > maxLiveNodesResolved.value;
3738
- });
3739
- const viewportPriorityEnabled = computed(() => {
3740
- if (props.viewportPriority === false)
3741
- return false;
3742
- if (viewportPriorityAutoDisabled.value)
3743
- return false;
3744
- return true;
3925
+ if (node.type === "code_block" && isCustomCodeBlockComponent(component)) {
3926
+ return customCodeBlockBindings.value;
3927
+ }
3928
+ if (lang === "mermaid" || lang === "infographic" || lang === "d2" || lang === "d2lang")
3929
+ return {};
3930
+ if (node.type === "link")
3931
+ return linkBindings.value;
3932
+ if (node.type === "list")
3933
+ return listBindings.value;
3934
+ return node.type === "code_block" ? codeBlockBindings.value : nonCodeBindings.value;
3935
+ }
3936
+ function handleClick(event) {
3937
+ emit("click", event);
3938
+ }
3939
+ return { __sfc: true, props, emit, handleCopy, handleArtifactClick, nodeComponents, customComponentsMap, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getCustomCodeLanguageComponent, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleClick };
3940
+ }
3941
+ });
3942
+ var _sfc_render$f = function render31() {
3943
+ var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3944
+ 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) {
3945
+ 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)]);
3946
+ }), 0);
3947
+ };
3948
+ var _sfc_staticRenderFns$f = [];
3949
+ var __component__$f = /* @__PURE__ */ normalizeComponent(
3950
+ _sfc_main$f,
3951
+ _sfc_render$f,
3952
+ _sfc_staticRenderFns$f,
3953
+ false,
3954
+ null,
3955
+ null,
3956
+ null,
3957
+ null
3958
+ );
3959
+ const LegacyNodesRenderer = __component__$f.exports;
3960
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3961
+ __name: "BlockquoteNode",
3962
+ props: {
3963
+ node: null,
3964
+ indexKey: null,
3965
+ typewriter: { type: Boolean },
3966
+ customId: null
3967
+ },
3968
+ setup(__props) {
3969
+ const props = __props;
3970
+ const instance = getCurrentInstance();
3971
+ const nestedRenderer = computed(() => {
3972
+ const vm = instance == null ? void 0 : instance.proxy;
3973
+ return isLegacyVue26Vm(vm) ? LegacyNodesRenderer : NodeRenderer;
3745
3974
  });
3746
- const registerNodeVisibility = provideViewportPriority(
3747
- (target) => {
3748
- var _a3;
3749
- return resolveViewportRoot((_a3 = target != null ? target : containerRef.value) != null ? _a3 : null);
3750
- },
3751
- viewportPriorityEnabled
3752
- );
3753
- const requestFrame = isClient && typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame.bind(window) : null;
3754
- const cancelFrame = isClient && typeof window.cancelAnimationFrame === "function" ? window.cancelAnimationFrame.bind(window) : null;
3755
- const isTestEnv = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" && ((_b = (_a2 = globalThis.process) == null ? void 0 : _a2.env) == null ? void 0 : _b.NODE_ENV) === "test";
3756
- const hasIdleCallback = isClient && typeof window.requestIdleCallback === "function";
3757
- const resolvedBatchSize = computed(() => {
3758
- var _a3;
3759
- const size = Math.trunc((_a3 = props.renderBatchSize) != null ? _a3 : 80);
3760
- return Number.isFinite(size) ? Math.max(0, size) : 0;
3761
- });
3762
- const resolvedInitialBatch = computed(() => {
3763
- var _a3;
3764
- const initial = Math.trunc((_a3 = props.initialRenderBatchSize) != null ? _a3 : resolvedBatchSize.value);
3765
- if (!Number.isFinite(initial))
3766
- return resolvedBatchSize.value;
3767
- return Math.max(0, initial);
3768
- });
3769
- const batchingEnabled = computed(() => props.batchRendering !== false && resolvedBatchSize.value > 0 && isClient && !isTestEnv);
3770
- const renderedCount = ref(0);
3771
- const previousRenderContext = ref({
3772
- key: props.indexKey,
3773
- total: 0
3774
- });
3775
- const adaptiveBatchSize = ref(Math.max(1, resolvedBatchSize.value || 1));
3776
- const nodeVisibilityState = reactive({});
3777
- const nodeVisibilityHandles = /* @__PURE__ */ new Map();
3778
- const nodeVisibilityFallbackTimers = /* @__PURE__ */ new Map();
3779
- const nodeSlotElements = /* @__PURE__ */ new Map();
3780
- const codeBlockRenderCache = /* @__PURE__ */ new WeakMap();
3781
- const nodeSlotVersion = ref(0);
3782
- const sortedNodeSlots = computed(() => {
3783
- void nodeSlotVersion.value;
3784
- return Array.from(nodeSlotElements.entries()).sort((a, b) => a[0] - b[0]);
3975
+ return { __sfc: true, props, instance, nestedRenderer };
3976
+ }
3977
+ });
3978
+ const BlockquoteNode_vue_vue_type_style_index_0_scoped_0bfb818f_lang = "";
3979
+ var _sfc_render$e = function render32() {
3980
+ var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
3981
+ 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) {
3982
+ return _vm.$emit("copy", $event);
3983
+ } } })], 1);
3984
+ };
3985
+ var _sfc_staticRenderFns$e = [];
3986
+ var __component__$e = /* @__PURE__ */ normalizeComponent(
3987
+ _sfc_main$e,
3988
+ _sfc_render$e,
3989
+ _sfc_staticRenderFns$e,
3990
+ false,
3991
+ null,
3992
+ "0bfb818f",
3993
+ null,
3994
+ null
3995
+ );
3996
+ const BlockquoteNode = __component__$e.exports;
3997
+ function useSmoothMarkdownStream(options = {}) {
3998
+ const source = ref("");
3999
+ const visible2 = ref("");
4000
+ const done = ref(false);
4001
+ const controller = createSmoothMarkdownStream(options);
4002
+ const sync = () => {
4003
+ const snapshot = controller.getSnapshot();
4004
+ source.value = snapshot.source;
4005
+ visible2.value = snapshot.visible;
4006
+ done.value = snapshot.done;
4007
+ };
4008
+ const unsubscribe = controller.subscribe(sync);
4009
+ sync();
4010
+ const pendingChars = computed(() => Math.max(0, source.value.length - visible2.value.length));
4011
+ const caughtUp = computed(() => pendingChars.value === 0);
4012
+ const final = computed(() => done.value && caughtUp.value);
4013
+ if (getCurrentScope()) {
4014
+ onScopeDispose(() => {
4015
+ unsubscribe();
4016
+ controller.destroy();
3785
4017
  });
3786
- const scrollRootElement = ref(null);
3787
- let detachScrollHandler = null;
3788
- let pendingFocusSync = null;
3789
- const liveRange = reactive({ start: 0, end: 0 });
3790
- const visibleNodes = computed(() => {
3791
- if (!virtualizationEnabled.value)
3792
- return parsedNodes.value.map((node, index2) => ({ node, index: index2 }));
3793
- const total = parsedNodes.value.length;
3794
- const start = clamp(liveRange.start, 0, total);
3795
- const end = clamp(liveRange.end, start, total);
3796
- return parsedNodes.value.slice(start, end).map((node, idx) => ({
3797
- node,
3798
- index: start + idx
3799
- }));
4018
+ }
4019
+ return {
4020
+ source,
4021
+ visible: visible2,
4022
+ done,
4023
+ final,
4024
+ caughtUp,
4025
+ pendingChars,
4026
+ enqueue: (chunk) => controller.enqueue(chunk),
4027
+ finish: (options2) => controller.finish(options2),
4028
+ flush: () => controller.flush(),
4029
+ reset: (initialMarkdown) => controller.reset(initialMarkdown),
4030
+ pause: () => controller.pause(),
4031
+ resume: () => controller.resume()
4032
+ };
4033
+ }
4034
+ const MERMAID_PREVIEW_MIN_HEIGHT = 360;
4035
+ const MERMAID_PREVIEW_MAX_HEIGHT = 500;
4036
+ const INFOGRAPHIC_PREVIEW_MIN_HEIGHT = 360;
4037
+ const INFOGRAPHIC_PREVIEW_MAX_HEIGHT = 500;
4038
+ function parsePositiveNumber(value) {
4039
+ const numeric = typeof value === "number" ? value : Number.parseFloat(String(value != null ? value : ""));
4040
+ return Number.isFinite(numeric) && numeric > 0 ? numeric : null;
4041
+ }
4042
+ function getMermaidDiagramKind(code) {
4043
+ var _a2;
4044
+ for (const rawLine of code.split(/\r?\n/)) {
4045
+ const line = rawLine.trim();
4046
+ if (!line || line.startsWith("%%"))
4047
+ continue;
4048
+ const match = line.match(/^([A-Z][\w-]*)\b/i);
4049
+ return ((_a2 = match == null ? void 0 : match[1]) == null ? void 0 : _a2.toLowerCase()) || "";
4050
+ }
4051
+ return "";
4052
+ }
4053
+ function estimateMermaidPreviewHeight(code) {
4054
+ const meaningfulLines = code.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("%%"));
4055
+ const lineCount = Math.max(1, meaningfulLines.length);
4056
+ const kind = getMermaidDiagramKind(code);
4057
+ if (kind === "gantt")
4058
+ return 220 + lineCount * 28;
4059
+ if (kind === "sequencediagram")
4060
+ return 180 + lineCount * 26;
4061
+ if (kind === "classdiagram" || kind === "statediagram" || kind === "erdiagram")
4062
+ return 180 + lineCount * 24;
4063
+ if (kind === "flowchart" || kind === "graph")
4064
+ return 170 + lineCount * 28;
4065
+ return 200 + lineCount * 22;
4066
+ }
4067
+ function estimateInfographicPreviewHeight(code) {
4068
+ const itemCount = code.split(/\r?\n/).filter((line) => /^\s*-\s+/.test(line)).length;
4069
+ if (itemCount >= 3)
4070
+ return INFOGRAPHIC_PREVIEW_MAX_HEIGHT;
4071
+ if (itemCount > 0)
4072
+ return 280 + itemCount * 60;
4073
+ return INFOGRAPHIC_PREVIEW_MIN_HEIGHT;
4074
+ }
4075
+ function clampPreviewHeight(height, minHeight = MERMAID_PREVIEW_MIN_HEIGHT, maxHeight = MERMAID_PREVIEW_MAX_HEIGHT) {
4076
+ return maxHeight == null ? Math.max(minHeight, height) : Math.min(Math.max(minHeight, height), maxHeight);
4077
+ }
4078
+ function clampMermaidPreviewHeight(height, minHeight = MERMAID_PREVIEW_MIN_HEIGHT, maxHeight = MERMAID_PREVIEW_MAX_HEIGHT) {
4079
+ return clampPreviewHeight(height, minHeight, maxHeight);
4080
+ }
4081
+ function clampInfographicPreviewHeight(height, minHeight = INFOGRAPHIC_PREVIEW_MIN_HEIGHT, maxHeight = INFOGRAPHIC_PREVIEW_MAX_HEIGHT) {
4082
+ return clampPreviewHeight(height, minHeight, maxHeight);
4083
+ }
4084
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4085
+ __name: "NodeRenderer",
4086
+ props: {
4087
+ content: null,
4088
+ nodes: null,
4089
+ final: { type: Boolean },
4090
+ parseOptions: null,
4091
+ customMarkdownIt: null,
4092
+ debugPerformance: { type: Boolean, default: false },
4093
+ customHtmlTags: null,
4094
+ htmlPolicy: null,
4095
+ viewportPriority: { type: Boolean },
4096
+ codeBlockStream: { type: Boolean, default: true },
4097
+ codeBlockDarkTheme: null,
4098
+ codeBlockLightTheme: null,
4099
+ codeBlockMonacoOptions: null,
4100
+ renderCodeBlocksAsPre: { type: Boolean },
4101
+ codeBlockMinWidth: null,
4102
+ codeBlockMaxWidth: null,
4103
+ codeBlockProps: null,
4104
+ mermaidProps: null,
4105
+ d2Props: null,
4106
+ infographicProps: null,
4107
+ showTooltips: { type: Boolean, default: true },
4108
+ themes: null,
4109
+ langs: null,
4110
+ isDark: { type: Boolean },
4111
+ customId: null,
4112
+ indexKey: null,
4113
+ typewriter: { type: Boolean, default: false },
4114
+ fade: { type: Boolean, default: true },
4115
+ smoothStreaming: { type: [Boolean, String], default: "auto" },
4116
+ smoothStreamingOptions: null,
4117
+ batchRendering: { type: Boolean, default: true },
4118
+ initialRenderBatchSize: { default: 40 },
4119
+ renderBatchSize: { default: 80 },
4120
+ renderBatchDelay: { default: 16 },
4121
+ renderBatchBudgetMs: { default: 6 },
4122
+ renderBatchIdleTimeoutMs: { default: 120 },
4123
+ deferNodesUntilVisible: { type: Boolean, default: true },
4124
+ maxLiveNodes: { default: 320 },
4125
+ liveNodeBuffer: { default: 60 }
4126
+ },
4127
+ emits: ["copy", "handleArtifactClick", "click", "mouseover", "mouseout"],
4128
+ setup(__props, { emit }) {
4129
+ var _a2, _b, _c;
4130
+ const props = __props;
4131
+ const MAX_DEFERRED_NODE_COUNT = 900;
4132
+ const MAX_VIEWPORT_OBSERVER_TARGETS = 640;
4133
+ const VIEWPORT_PRIORITY_RECOVERY_COUNT = 200;
4134
+ const containerRef = ref();
4135
+ const viewportPriorityAutoDisabled = ref(false);
4136
+ const SCROLL_PARENT_OVERFLOW_RE = /auto|scroll|overlay/i;
4137
+ const isClient = typeof window !== "undefined";
4138
+ const instance = getCurrentInstance();
4139
+ const debugPerformanceEnabled = computed(() => props.debugPerformance && isClient && typeof console !== "undefined");
4140
+ const attrs = computed(() => {
4141
+ var _a3, _b2;
4142
+ return (_b2 = (_a3 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a3.$attrs) != null ? _b2 : {};
3800
4143
  });
3801
- const deferNodes = computed(() => {
4144
+ const textStreamState = /* @__PURE__ */ new Map();
4145
+ const streamRenderVersion = ref(0);
4146
+ const smoothStream = useSmoothMarkdownStream(props.smoothStreamingOptions);
4147
+ const resolvedShowTooltips = computed(() => {
3802
4148
  var _a3;
3803
- if (props.deferNodesUntilVisible === false)
4149
+ if (typeof props.showTooltips === "boolean")
4150
+ return props.showTooltips;
4151
+ const raw = (_a3 = attrs.value.showTooltips) != null ? _a3 : attrs.value["show-tooltips"];
4152
+ if (raw === "" || raw === true || raw === "true")
4153
+ return true;
4154
+ if (raw === false || raw === "false")
3804
4155
  return false;
3805
- if (((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0)
4156
+ return void 0;
4157
+ });
4158
+ const inheritedHtmlPolicy = inject("markstreamHtmlPolicy", void 0);
4159
+ const inheritedSmoothStreaming = inject("markstreamSmoothStreaming", void 0);
4160
+ const resolvedHtmlPolicy = computed(() => {
4161
+ var _a3, _b2;
4162
+ return (_b2 = (_a3 = props.htmlPolicy) != null ? _a3 : inheritedHtmlPolicy == null ? void 0 : inheritedHtmlPolicy.value) != null ? _b2 : "safe";
4163
+ });
4164
+ provide("markstreamShowTooltips", resolvedShowTooltips);
4165
+ provide("markstreamHtmlPolicy", resolvedHtmlPolicy);
4166
+ provide("markstreamTypewriter", computed(() => props.typewriter === true));
4167
+ provide("markstreamFade", computed(() => props.fade !== false));
4168
+ provide("markstreamTextStreamState", textStreamState);
4169
+ provide("markstreamStreamVersion", streamRenderVersion);
4170
+ const smoothStreamingEligible = computed(() => {
4171
+ var _a3, _b2;
4172
+ if (props.smoothStreaming === false)
3806
4173
  return false;
3807
- if (virtualizationEnabled.value)
4174
+ if ((_a3 = props.nodes) == null ? void 0 : _a3.length)
3808
4175
  return false;
3809
- if (parsedNodes.value.length > MAX_DEFERRED_NODE_COUNT)
4176
+ if (props.smoothStreaming !== true && (inheritedSmoothStreaming == null ? void 0 : inheritedSmoothStreaming.value))
3810
4177
  return false;
3811
- return viewportPriorityEnabled.value;
3812
- });
3813
- const incrementalRenderingActive = computed(() => {
3814
- var _a3;
3815
- return batchingEnabled.value && ((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0;
4178
+ if (props.smoothStreaming === true)
4179
+ return true;
4180
+ return props.typewriter === true || ((_b2 = props.maxLiveNodes) != null ? _b2 : 0) <= 0;
3816
4181
  });
3817
- const previousBatchConfig = ref({
3818
- batchSize: resolvedBatchSize.value,
3819
- initial: resolvedInitialBatch.value,
3820
- delay: (_c = props.renderBatchDelay) != null ? _c : 16,
3821
- enabled: incrementalRenderingActive.value
4182
+ const hasMountedForSmoothStreaming = ref(!isClient || props.smoothStreaming === true);
4183
+ onMounted(() => {
4184
+ hasMountedForSmoothStreaming.value = true;
3822
4185
  });
3823
- const shouldObserveSlots = computed(() => !!registerNodeVisibility && (deferNodes.value || virtualizationEnabled.value));
3824
- const liveNodeBufferResolved = computed(() => {
4186
+ const smoothStreamingEnabled = computed(() => hasMountedForSmoothStreaming.value && smoothStreamingEligible.value);
4187
+ provide("markstreamSmoothStreaming", smoothStreamingEnabled);
4188
+ const renderContent = computed(() => {
3825
4189
  var _a3;
3826
- return Math.max(0, (_a3 = props.liveNodeBuffer) != null ? _a3 : 60);
4190
+ return smoothStreamingEnabled.value ? smoothStream.visible.value : (_a3 = props.content) != null ? _a3 : "";
3827
4191
  });
3828
- const focusIndex = ref(0);
3829
- const nodeContentElements = /* @__PURE__ */ new Map();
3830
- const legacyVue26 = computed(() => {
3831
- const vm = instance == null ? void 0 : instance.proxy;
3832
- return isLegacyVue26Vm(vm);
4192
+ const rawContent = computed(() => {
4193
+ var _a3;
4194
+ return (_a3 = props.content) != null ? _a3 : "";
3833
4195
  });
3834
- const legacyNodesMode = computed(() => legacyVue26.value && !props.content && Array.isArray(props.nodes));
3835
- const legacyNodeItems = computed(() => {
3836
- if (!legacyNodesMode.value)
3837
- return EMPTY_PARSED_NODES;
3838
- return markRaw(cloneParsedNodeList(props.nodes || []));
4196
+ const smoothSourceSynced = computed(() => {
4197
+ var _a3;
4198
+ return Boolean((_a3 = props.nodes) == null ? void 0 : _a3.length) || smoothStream.source.value === rawContent.value;
3839
4199
  });
3840
- function syncNodeRefs() {
4200
+ const requestedFinal = computed(() => {
3841
4201
  var _a3, _b2;
3842
- const proxy = instance == null ? void 0 : instance.proxy;
3843
- if (!proxy || !proxy.$refs)
3844
- return;
3845
- const refs = proxy.$refs;
3846
- const seen = /* @__PURE__ */ new Set();
3847
- for (const item of visibleNodes.value) {
3848
- const slot = resolveTemplateRef(refs[`node-slot-${item.index}`]);
3849
- const content2 = resolveTemplateRef(refs[`node-content-${item.index}`]);
3850
- if (((_a3 = nodeSlotElements.get(item.index)) != null ? _a3 : null) !== slot)
3851
- setNodeSlotElement(item.index, slot);
3852
- if (((_b2 = nodeContentElements.get(item.index)) != null ? _b2 : null) !== content2)
3853
- setNodeContentRef(item.index, content2);
3854
- seen.add(item.index);
3855
- }
3856
- for (const index2 of Array.from(nodeSlotElements.keys())) {
3857
- if (!seen.has(index2))
3858
- setNodeSlotElement(index2, null);
3859
- }
3860
- for (const index2 of Array.from(nodeContentElements.keys())) {
3861
- if (!seen.has(index2))
3862
- setNodeContentRef(index2, null);
4202
+ const base = (_a3 = props.parseOptions) != null ? _a3 : {};
4203
+ return (_b2 = props.final) != null ? _b2 : base.final;
4204
+ });
4205
+ const effectiveFinal = computed(() => {
4206
+ const finalRequested = requestedFinal.value;
4207
+ if (smoothStreamingEnabled.value && finalRequested != null) {
4208
+ return Boolean(
4209
+ finalRequested && smoothSourceSynced.value && smoothStream.caughtUp.value
4210
+ );
3863
4211
  }
3864
- }
4212
+ return finalRequested;
4213
+ });
4214
+ const renderVersionSource = computed(() => {
4215
+ var _a3;
4216
+ if ((_a3 = props.nodes) == null ? void 0 : _a3.length)
4217
+ return props.nodes;
4218
+ return renderContent.value;
4219
+ });
4220
+ watch(
4221
+ [() => props.content, () => props.nodes, smoothStreamingEnabled, requestedFinal],
4222
+ ([content2, nodes, enabled, finalRequested]) => {
4223
+ if (nodes == null ? void 0 : nodes.length) {
4224
+ smoothStream.reset("");
4225
+ return;
4226
+ }
4227
+ const nextContent = content2 != null ? content2 : "";
4228
+ if (!enabled) {
4229
+ smoothStream.reset(nextContent);
4230
+ if (finalRequested)
4231
+ smoothStream.finish({ flush: true });
4232
+ return;
4233
+ }
4234
+ const source = smoothStream.source.value;
4235
+ if (!nextContent) {
4236
+ smoothStream.reset("");
4237
+ } else if (nextContent === source)
4238
+ ;
4239
+ else if (nextContent.startsWith(source)) {
4240
+ smoothStream.enqueue(nextContent.slice(source.length));
4241
+ } else {
4242
+ smoothStream.reset(nextContent);
4243
+ }
4244
+ if (finalRequested)
4245
+ smoothStream.finish();
4246
+ },
4247
+ { immediate: true }
4248
+ );
4249
+ watch(
4250
+ renderVersionSource,
4251
+ () => {
4252
+ streamRenderVersion.value += 1;
4253
+ },
4254
+ { immediate: true }
4255
+ );
4256
+ function logPerf(label, data) {
4257
+ if (!debugPerformanceEnabled.value)
4258
+ return;
4259
+ console.info(`[markstream-vue2][perf] ${label}`, data);
4260
+ }
4261
+ function resolveViewportRoot(node) {
4262
+ if (typeof window === "undefined")
4263
+ return null;
4264
+ const base = node != null ? node : containerRef.value;
4265
+ if (!base)
4266
+ return null;
4267
+ const doc = base.ownerDocument || document;
4268
+ const rootScrollable = doc.scrollingElement || doc.documentElement;
4269
+ let current = base;
4270
+ while (current) {
4271
+ if (current === doc.body || current === rootScrollable)
4272
+ break;
4273
+ const style = window.getComputedStyle(current);
4274
+ const overflowY = (style.overflowY || "").toLowerCase();
4275
+ const overflow = (style.overflow || "").toLowerCase();
4276
+ if (SCROLL_PARENT_OVERFLOW_RE.test(overflowY) || SCROLL_PARENT_OVERFLOW_RE.test(overflow))
4277
+ return current;
4278
+ current = current.parentElement;
4279
+ }
4280
+ return null;
4281
+ }
4282
+ const instanceMsgId = props.customId ? `renderer-${props.customId}` : `renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`;
4283
+ const defaultMd = getMarkdown(instanceMsgId);
4284
+ const customTagCache = /* @__PURE__ */ new Map();
4285
+ const EMPTY_PARSED_NODES = markRaw([]);
4286
+ const customComponentsMap = computed(() => {
4287
+ void customComponentsRevision.value;
4288
+ return getCustomNodeComponents(props.customId);
4289
+ });
4290
+ const effectiveCustomHtmlTags = computed(() => {
4291
+ var _a3;
4292
+ return mergeCustomHtmlTags(props.customHtmlTags, (_a3 = props.parseOptions) == null ? void 0 : _a3.customHtmlTags);
4293
+ });
4294
+ const mdBase = computed(() => {
4295
+ const { key, tags } = resolveCustomHtmlTags(effectiveCustomHtmlTags.value);
4296
+ if (!key)
4297
+ return defaultMd;
4298
+ const cached = customTagCache.get(key);
4299
+ if (cached)
4300
+ return cached;
4301
+ const md = getMarkdown(instanceMsgId, { customHtmlTags: tags });
4302
+ customTagCache.set(key, md);
4303
+ return md;
4304
+ });
4305
+ const mdInstance = computed(() => {
4306
+ const base = mdBase.value;
4307
+ return props.customMarkdownIt ? props.customMarkdownIt(base) : base;
4308
+ });
4309
+ function cloneNodeValue(value) {
4310
+ if (Array.isArray(value))
4311
+ return Object.freeze(value.map((item) => cloneNodeValue(item)));
4312
+ if (!value || typeof value !== "object")
4313
+ return value;
4314
+ const output = {};
4315
+ for (const [key, child] of Object.entries(value))
4316
+ output[key] = cloneNodeValue(child);
4317
+ return Object.freeze(output);
4318
+ }
4319
+ function cloneParsedNodeList(nodes) {
4320
+ return nodes.map((node) => cloneNodeValue(node));
4321
+ }
4322
+ const mergedParseOptions = computed(() => {
4323
+ var _a3;
4324
+ const base = (_a3 = props.parseOptions) != null ? _a3 : {};
4325
+ const resolvedFinal = effectiveFinal.value;
4326
+ const merged = effectiveCustomHtmlTags.value;
4327
+ const hasFinal = resolvedFinal != null;
4328
+ const hasCustom = merged.length > 0;
4329
+ if (!hasFinal && !hasCustom)
4330
+ return base;
4331
+ return __spreadValues(__spreadValues(__spreadValues({}, base), hasFinal ? { final: resolvedFinal } : {}), hasCustom ? { customHtmlTags: merged } : {});
4332
+ });
4333
+ const effectiveCustomHtmlTagsSet = computed(() => {
4334
+ var _a3;
4335
+ const arr = (_a3 = mergedParseOptions.value.customHtmlTags) != null ? _a3 : [];
4336
+ return new Set(arr.map((t) => String(t).trim().toLowerCase()).filter(Boolean));
4337
+ });
4338
+ const parsedNodes = computed(() => {
4339
+ var _a3;
4340
+ if (isLegacyVue26Vm(instance == null ? void 0 : instance.proxy) && !props.content && Array.isArray(props.nodes))
4341
+ return EMPTY_PARSED_NODES;
4342
+ if ((_a3 = props.nodes) == null ? void 0 : _a3.length)
4343
+ return markRaw(cloneParsedNodeList(props.nodes));
4344
+ const contentToParse = renderContent.value;
4345
+ if (contentToParse) {
4346
+ const parseStart = debugPerformanceEnabled.value ? performance.now() : 0;
4347
+ const parsed = parseMarkdownToStructure(contentToParse, mdInstance.value, mergedParseOptions.value);
4348
+ if (debugPerformanceEnabled.value) {
4349
+ logPerf("parse(sync)", {
4350
+ ms: Math.round(performance.now() - parseStart),
4351
+ nodes: parsed.length,
4352
+ contentLength: contentToParse.length
4353
+ });
4354
+ }
4355
+ return markRaw(cloneParsedNodeList(parsed));
4356
+ }
4357
+ return [];
4358
+ });
4359
+ const maxLiveNodesResolved = computed(() => {
4360
+ var _a3;
4361
+ return Math.max(1, (_a3 = props.maxLiveNodes) != null ? _a3 : 320);
4362
+ });
4363
+ const virtualizationEnabled = computed(() => {
4364
+ var _a3;
4365
+ if (((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0)
4366
+ return false;
4367
+ return parsedNodes.value.length > maxLiveNodesResolved.value;
4368
+ });
4369
+ const viewportPriorityEnabled = computed(() => {
4370
+ if (props.viewportPriority === false)
4371
+ return false;
4372
+ if (viewportPriorityAutoDisabled.value)
4373
+ return false;
4374
+ return true;
4375
+ });
4376
+ const registerNodeVisibility = provideViewportPriority(
4377
+ (target) => {
4378
+ var _a3;
4379
+ return resolveViewportRoot((_a3 = target != null ? target : containerRef.value) != null ? _a3 : null);
4380
+ },
4381
+ viewportPriorityEnabled
4382
+ );
4383
+ const requestFrame = isClient && typeof window.requestAnimationFrame === "function" ? window.requestAnimationFrame.bind(window) : null;
4384
+ const cancelFrame = isClient && typeof window.cancelAnimationFrame === "function" ? window.cancelAnimationFrame.bind(window) : null;
4385
+ const isTestEnv = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" && ((_b = (_a2 = globalThis.process) == null ? void 0 : _a2.env) == null ? void 0 : _b.NODE_ENV) === "test";
4386
+ const hasIdleCallback = isClient && typeof window.requestIdleCallback === "function";
4387
+ const resolvedBatchSize = computed(() => {
4388
+ var _a3;
4389
+ const size = Math.trunc((_a3 = props.renderBatchSize) != null ? _a3 : 80);
4390
+ return Number.isFinite(size) ? Math.max(0, size) : 0;
4391
+ });
4392
+ const resolvedInitialBatch = computed(() => {
4393
+ var _a3;
4394
+ const initial = Math.trunc((_a3 = props.initialRenderBatchSize) != null ? _a3 : resolvedBatchSize.value);
4395
+ if (!Number.isFinite(initial))
4396
+ return resolvedBatchSize.value;
4397
+ return Math.max(0, initial);
4398
+ });
4399
+ const batchingEnabled = computed(() => props.batchRendering !== false && resolvedBatchSize.value > 0 && isClient && !isTestEnv);
4400
+ const renderedCount = ref(0);
4401
+ const previousRenderContext = ref({
4402
+ key: props.indexKey,
4403
+ total: 0
4404
+ });
4405
+ const adaptiveBatchSize = ref(Math.max(1, resolvedBatchSize.value || 1));
4406
+ const nodeVisibilityState = reactive({});
4407
+ const nodeVisibilityHandles = /* @__PURE__ */ new Map();
4408
+ const nodeVisibilityFallbackTimers = /* @__PURE__ */ new Map();
4409
+ const nodeSlotElements = /* @__PURE__ */ new Map();
4410
+ const codeBlockRenderCache = /* @__PURE__ */ new WeakMap();
4411
+ const nodeSlotVersion = ref(0);
4412
+ const sortedNodeSlots = computed(() => {
4413
+ void nodeSlotVersion.value;
4414
+ return Array.from(nodeSlotElements.entries()).sort((a, b) => a[0] - b[0]);
4415
+ });
4416
+ const scrollRootElement = ref(null);
4417
+ let detachScrollHandler = null;
4418
+ let pendingFocusSync = null;
4419
+ const liveRange = reactive({ start: 0, end: 0 });
4420
+ const visibleNodes = computed(() => {
4421
+ if (!virtualizationEnabled.value)
4422
+ return parsedNodes.value.map((node, index2) => ({ node, index: index2 }));
4423
+ const total = parsedNodes.value.length;
4424
+ const start = clamp(liveRange.start, 0, total);
4425
+ const end = clamp(liveRange.end, start, total);
4426
+ return parsedNodes.value.slice(start, end).map((node, idx) => ({
4427
+ node,
4428
+ index: start + idx
4429
+ }));
4430
+ });
4431
+ const deferNodes = computed(() => {
4432
+ var _a3;
4433
+ if (props.deferNodesUntilVisible === false)
4434
+ return false;
4435
+ if (((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0)
4436
+ return false;
4437
+ if (virtualizationEnabled.value)
4438
+ return false;
4439
+ if (parsedNodes.value.length > MAX_DEFERRED_NODE_COUNT)
4440
+ return false;
4441
+ return viewportPriorityEnabled.value;
4442
+ });
4443
+ const incrementalRenderingActive = computed(() => {
4444
+ var _a3;
4445
+ return batchingEnabled.value && ((_a3 = props.maxLiveNodes) != null ? _a3 : 0) <= 0;
4446
+ });
4447
+ const previousBatchConfig = ref({
4448
+ batchSize: resolvedBatchSize.value,
4449
+ initial: resolvedInitialBatch.value,
4450
+ delay: (_c = props.renderBatchDelay) != null ? _c : 16,
4451
+ enabled: incrementalRenderingActive.value
4452
+ });
4453
+ const shouldObserveSlots = computed(() => !!registerNodeVisibility && (deferNodes.value || virtualizationEnabled.value));
4454
+ const liveNodeBufferResolved = computed(() => {
4455
+ var _a3;
4456
+ return Math.max(0, (_a3 = props.liveNodeBuffer) != null ? _a3 : 60);
4457
+ });
4458
+ const focusIndex = ref(0);
4459
+ const nodeContentElements = /* @__PURE__ */ new Map();
4460
+ const legacyVue26 = computed(() => {
4461
+ const vm = instance == null ? void 0 : instance.proxy;
4462
+ return isLegacyVue26Vm(vm);
4463
+ });
4464
+ const legacyNodesMode = computed(() => legacyVue26.value && !props.content && Array.isArray(props.nodes));
4465
+ const legacyNodeItems = computed(() => {
4466
+ if (!legacyNodesMode.value)
4467
+ return EMPTY_PARSED_NODES;
4468
+ return markRaw(cloneParsedNodeList(props.nodes || []));
4469
+ });
4470
+ function syncNodeRefs() {
4471
+ var _a3, _b2;
4472
+ const proxy = instance == null ? void 0 : instance.proxy;
4473
+ if (!proxy || !proxy.$refs)
4474
+ return;
4475
+ const refs = proxy.$refs;
4476
+ const seen = /* @__PURE__ */ new Set();
4477
+ for (const item of visibleNodes.value) {
4478
+ const slot = resolveTemplateRef(refs[`node-slot-${item.index}`]);
4479
+ const content2 = resolveTemplateRef(refs[`node-content-${item.index}`]);
4480
+ if (((_a3 = nodeSlotElements.get(item.index)) != null ? _a3 : null) !== slot)
4481
+ setNodeSlotElement(item.index, slot);
4482
+ if (((_b2 = nodeContentElements.get(item.index)) != null ? _b2 : null) !== content2)
4483
+ setNodeContentRef(item.index, content2);
4484
+ seen.add(item.index);
4485
+ }
4486
+ for (const index2 of Array.from(nodeSlotElements.keys())) {
4487
+ if (!seen.has(index2))
4488
+ setNodeSlotElement(index2, null);
4489
+ }
4490
+ for (const index2 of Array.from(nodeContentElements.keys())) {
4491
+ if (!seen.has(index2))
4492
+ setNodeContentRef(index2, null);
4493
+ }
4494
+ }
3865
4495
  function resolveTemplateRef(value) {
3866
4496
  if (Array.isArray(value)) {
3867
4497
  for (const item of value) {
@@ -4784,12 +5414,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4784
5414
  clearVisibilityFallback(index2);
4785
5415
  cleanupScrollListener();
4786
5416
  cancelScheduledFocusSync();
5417
+ clearTypewriterCursorTimeout();
4787
5418
  });
4788
5419
  function CodeBlockNodeAsync() {
4789
5420
  return __async(this, null, function* () {
4790
5421
  var _a3;
4791
5422
  try {
4792
- const mod2 = yield import("./chunks/index-2a7bea2c.js");
5423
+ const mod2 = yield import("./chunks/index-754b8598.js");
4793
5424
  return (_a3 = mod2.default) != null ? _a3 : mod2;
4794
5425
  } catch (e) {
4795
5426
  console.warn(
@@ -4843,7 +5474,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4843
5474
  function loadMermaidBlockNode() {
4844
5475
  if (mermaidBlockNodeComponent.value || mermaidBlockNodeImport)
4845
5476
  return;
4846
- mermaidBlockNodeImport = import("./chunks/index-e0a22210.js").then((mod2) => {
5477
+ mermaidBlockNodeImport = import("./chunks/index-6ae3630b.js").then((mod2) => {
4847
5478
  var _a3;
4848
5479
  return (_a3 = mod2.default) != null ? _a3 : mod2;
4849
5480
  }).then((component) => {
@@ -4903,7 +5534,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4903
5534
  function loadInfographicBlockNode() {
4904
5535
  if (infographicBlockNodeComponent.value || infographicBlockNodeImport)
4905
5536
  return;
4906
- infographicBlockNodeImport = import("./chunks/index-292bb72c.js").then((mod2) => {
5537
+ infographicBlockNodeImport = import("./chunks/index-40b64c02.js").then((mod2) => {
4907
5538
  var _a3;
4908
5539
  return (_a3 = mod2.default) != null ? _a3 : mod2;
4909
5540
  }).then((component) => {
@@ -4975,6 +5606,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4975
5606
  // 例如:custom_node: CustomNode,
4976
5607
  };
4977
5608
  const indexPrefix = computed(() => props.indexKey != null ? String(props.indexKey) : "markdown-renderer");
5609
+ const codeBlockExtraProps = computed(() => getCodeBlockExtraProps(props.codeBlockProps));
5610
+ const builtinCodeBlockExtraProps = computed(
5611
+ () => getCodeBlockExtraProps(props.codeBlockProps, { omit: ["langs"] })
5612
+ );
4978
5613
  const codeBlockBindings = computed(() => __spreadValues(__spreadValues({
4979
5614
  // streaming behavior control for CodeBlockNode
4980
5615
  stream: props.codeBlockStream,
@@ -4984,14 +5619,19 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4984
5619
  themes: props.themes,
4985
5620
  minWidth: props.codeBlockMinWidth,
4986
5621
  maxWidth: props.codeBlockMaxWidth
4987
- }, typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}), props.codeBlockProps || {}));
5622
+ }, typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}), builtinCodeBlockExtraProps.value));
5623
+ const customCodeBlockBindings = computed(() => __spreadValues(__spreadProps(__spreadValues({}, codeBlockBindings.value), {
5624
+ langs: props.langs
5625
+ }), codeBlockExtraProps.value));
4988
5626
  const mermaidBindings = computed(() => __spreadValues({}, props.mermaidProps || {}));
4989
5627
  const d2Bindings = computed(() => __spreadValues({}, props.d2Props || {}));
4990
5628
  const infographicBindings = computed(() => __spreadValues({}, props.infographicProps || {}));
4991
5629
  const nonCodeBindings = computed(() => ({
4992
5630
  // Forward `typewriter` flag to non-code node components so they can
4993
- // opt in/out of enter transitions or other typewriter-like behaviour.
5631
+ // opt in/out of typewriter cursor behavior.
4994
5632
  typewriter: props.typewriter,
5633
+ // Forward `fade` flag to non-code node components for enter animations.
5634
+ fade: props.fade,
4995
5635
  // Forward customHtmlTags for non-whitelisted tag detection in child components
4996
5636
  customHtmlTags: mergedParseOptions.value.customHtmlTags,
4997
5637
  htmlPolicy: resolvedHtmlPolicy.value
@@ -5019,20 +5659,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5019
5659
  });
5020
5660
  }
5021
5661
  } else if (shouldRenderUnknownHtmlTagAsText((_b2 = node.content) != null ? _b2 : node.raw, tag)) {
5022
- const rawContent = String((_d = (_c2 = node.content) != null ? _c2 : node.raw) != null ? _d : "");
5662
+ const rawContent2 = String((_d = (_c2 = node.content) != null ? _c2 : node.raw) != null ? _d : "");
5023
5663
  if (node.type === "html_inline") {
5024
5664
  component = TextNode;
5025
5665
  resolvedNode = {
5026
5666
  type: "text",
5027
- content: rawContent,
5028
- raw: rawContent
5667
+ content: rawContent2,
5668
+ raw: rawContent2
5029
5669
  };
5030
5670
  } else {
5031
5671
  component = ParagraphNode;
5032
5672
  resolvedNode = {
5033
5673
  type: "paragraph",
5034
- children: [{ type: "text", content: rawContent, raw: rawContent }],
5035
- raw: rawContent
5674
+ children: [{ type: "text", content: rawContent2, raw: rawContent2 }],
5675
+ raw: rawContent2
5036
5676
  };
5037
5677
  }
5038
5678
  }
@@ -5041,7 +5681,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5041
5681
  return {
5042
5682
  node: resolvedNode,
5043
5683
  component,
5044
- bindings: getBindingsFor(resolvedNode, language),
5684
+ bindings: getBindingsFor(resolvedNode, language, component),
5045
5685
  isCodeBlock: resolvedNode.type === "code_block",
5046
5686
  index: index2,
5047
5687
  indexKey: `${indexPrefix.value}-${index2}`,
@@ -5075,20 +5715,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5075
5715
  });
5076
5716
  }
5077
5717
  } else if (shouldRenderUnknownHtmlTagAsText((_b2 = node.content) != null ? _b2 : node.raw, tag)) {
5078
- const rawContent = String((_d = (_c2 = node.content) != null ? _c2 : node.raw) != null ? _d : "");
5718
+ const rawContent2 = String((_d = (_c2 = node.content) != null ? _c2 : node.raw) != null ? _d : "");
5079
5719
  if (node.type === "html_inline") {
5080
5720
  component = TextNode;
5081
5721
  node = {
5082
5722
  type: "text",
5083
- content: rawContent,
5084
- raw: rawContent
5723
+ content: rawContent2,
5724
+ raw: rawContent2
5085
5725
  };
5086
5726
  } else {
5087
5727
  component = ParagraphNode;
5088
5728
  node = {
5089
5729
  type: "paragraph",
5090
- children: [{ type: "text", content: rawContent, raw: rawContent }],
5091
- raw: rawContent
5730
+ children: [{ type: "text", content: rawContent2, raw: rawContent2 }],
5731
+ raw: rawContent2
5092
5732
  };
5093
5733
  }
5094
5734
  }
@@ -5097,7 +5737,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5097
5737
  return __spreadProps(__spreadValues({}, item), {
5098
5738
  node,
5099
5739
  component,
5100
- bindings: getBindingsFor(node, language),
5740
+ bindings: getBindingsFor(node, language, component),
5101
5741
  isCodeBlock: node.type === "code_block",
5102
5742
  indexKey: `${indexPrefix.value}-${item.index}`,
5103
5743
  renderKey: getRenderKey(node, item.index)
@@ -5129,6 +5769,17 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5129
5769
  var _a3;
5130
5770
  return (node == null ? void 0 : node.type) === "code_block" ? String((_a3 = node.language) != null ? _a3 : "").trim().toLowerCase() : "";
5131
5771
  }
5772
+ function getCustomCodeLanguageComponent(customComponents, language) {
5773
+ const raw = language.trim().toLowerCase();
5774
+ if (!raw)
5775
+ return void 0;
5776
+ for (const key of [raw, normalizeLanguageIdentifier(raw), normalizeShikiLanguage(raw)]) {
5777
+ const component = key && customComponents[key];
5778
+ if (component)
5779
+ return component;
5780
+ }
5781
+ return void 0;
5782
+ }
5132
5783
  function isLegacyStructuredNode(node) {
5133
5784
  if (!node)
5134
5785
  return false;
@@ -5197,7 +5848,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5197
5848
  const customForType = customComponents[String(node.type)];
5198
5849
  if (node.type === "code_block") {
5199
5850
  const lang = language != null ? language : getCodeBlockLanguage(node);
5200
- const customForLanguage = lang ? customComponents[lang] : void 0;
5851
+ const customForLanguage = lang ? getCustomCodeLanguageComponent(customComponents, lang) : void 0;
5201
5852
  if (customForLanguage)
5202
5853
  return customForLanguage;
5203
5854
  if (lang === "mermaid") {
@@ -5223,8 +5874,25 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5223
5874
  return customForType;
5224
5875
  return nodeComponents[String(node.type)] || FallbackComponent;
5225
5876
  }
5226
- function getBindingsFor(node, language) {
5877
+ function isCustomCodeBlockComponent(component) {
5878
+ return Boolean(component && component === customComponentsMap.value.code_block);
5879
+ }
5880
+ function isCustomLanguageCodeBlockComponent(component, language) {
5881
+ return Boolean(component && language && component === getCustomCodeLanguageComponent(customComponentsMap.value, language));
5882
+ }
5883
+ function getBindingsFor(node, language, component) {
5227
5884
  const lang = language != null ? language : getCodeBlockLanguage(node);
5885
+ if (node.type === "code_block" && isCustomLanguageCodeBlockComponent(component, lang)) {
5886
+ if (lang === "mermaid")
5887
+ return getMermaidBindingsFor(node);
5888
+ if (lang === "infographic")
5889
+ return getInfographicBindingsFor(node);
5890
+ if (lang === "d2" || lang === "d2lang")
5891
+ return d2Bindings.value;
5892
+ return customCodeBlockBindings.value;
5893
+ }
5894
+ if (node.type === "code_block" && isCustomCodeBlockComponent(component))
5895
+ return customCodeBlockBindings.value;
5228
5896
  if (lang === "mermaid")
5229
5897
  return getMermaidBindingsFor(node);
5230
5898
  if (lang === "infographic")
@@ -5246,435 +5914,257 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
5246
5914
  if (!target)
5247
5915
  return;
5248
5916
  emit("mouseover", event);
5249
- }
5250
- function handleContainerMouseout(event) {
5251
- var _a3;
5252
- const target = (_a3 = event.target) == null ? void 0 : _a3.closest("[data-node-index]");
5253
- if (!target)
5254
- return;
5255
- emit("mouseout", event);
5256
- }
5257
- return { __sfc: true, props, emit, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, attrs, textStreamState, streamRenderVersion, resolvedShowTooltips, inheritedHtmlPolicy, resolvedHtmlPolicy, 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, CodeBlockNodeAsync, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getCodeBlockLanguage, isLegacyStructuredNode, getRenderKey, getMermaidBindingsFor, getInfographicBindingsFor, getNodeComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, LegacyNodesRenderer };
5258
- }
5259
- });
5260
- const NodeRenderer_vue_vue_type_style_index_0_scoped_f972faa5_lang = "";
5261
- const NodeRenderer_vue_vue_type_style_index_1_lang = "";
5262
- var _sfc_render$d = function render33() {
5263
- var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
5264
- 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) {
5265
- 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.typewriter !== false ? _c("transition", { attrs: { "name": "typewriter", "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) {
5266
- return _setup.emit("copy", $event);
5267
- }, "handle-artifact-click": function($event) {
5268
- return _setup.emit("handleArtifactClick", $event);
5269
- } } }, "component", item.bindings, false))], 1) : _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) {
5270
- return _setup.emit("copy", $event);
5271
- }, "handle-artifact-click": function($event) {
5272
- return _setup.emit("handleArtifactClick", $event);
5273
- } } }, "component", item.bindings, false))], 1)]);
5274
- }) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "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, "is-dark": _setup.props.isDark, "custom-html-tags": _setup.mergedParseOptions.customHtmlTags, "html-policy": _setup.resolvedHtmlPolicy }, on: { "copy": function($event) {
5275
- return _setup.emit("copy", $event);
5276
- }, "handle-artifact-click": function($event) {
5277
- return _setup.emit("handleArtifactClick", $event);
5278
- } } }) : [_setup.virtualizationEnabled ? _c("div", { staticClass: "node-spacer", style: { height: `${_setup.topSpacerHeight}px` }, attrs: { "aria-hidden": "true" } }) : _vm._e(), _vm._l(_setup.renderedItems, function(item) {
5279
- var _a2;
5280
- return _c("div", { key: item.renderKey, ref: `node-slot-${item.index}`, refInFor: true, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_setup.shouldRenderNode(item.index) ? _c("div", { ref: `node-content-${item.index}`, refInFor: true, staticClass: "node-content" }, [!item.isCodeBlock && _setup.props.typewriter !== false ? _c("transition", { attrs: { "name": "typewriter", "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) {
5281
- return _setup.emit("copy", $event);
5282
- }, "handle-artifact-click": function($event) {
5283
- return _setup.emit("handleArtifactClick", $event);
5284
- } } }, "component", item.bindings, false))], 1) : _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) {
5285
- return _setup.emit("copy", $event);
5286
- }, "handle-artifact-click": function($event) {
5287
- return _setup.emit("handleArtifactClick", $event);
5288
- } } }, "component", item.bindings, false))], 1) : _c("div", { staticClass: "node-placeholder", style: { height: `${(_a2 = _setup.nodeHeights[item.index]) != null ? _a2 : _setup.averageNodeHeight}px` } })]);
5289
- }), _setup.virtualizationEnabled ? _c("div", { staticClass: "node-spacer", style: { height: `${_setup.bottomSpacerHeight}px` }, attrs: { "aria-hidden": "true" } }) : _vm._e()]], 2);
5290
- };
5291
- var _sfc_staticRenderFns$d = [];
5292
- var __component__$d = /* @__PURE__ */ normalizeComponent(
5293
- _sfc_main$d,
5294
- _sfc_render$d,
5295
- _sfc_staticRenderFns$d,
5296
- false,
5297
- null,
5298
- "f972faa5",
5299
- null,
5300
- null
5301
- );
5302
- const NodeRenderer = __component__$d.exports;
5303
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
5304
- __name: "AdmonitionNode",
5305
- props: {
5306
- node: null,
5307
- indexKey: null,
5308
- isDark: { type: Boolean },
5309
- typewriter: { type: Boolean },
5310
- customId: null
5311
- },
5312
- emits: ["copy"],
5313
- setup(__props, { emit }) {
5314
- var _a2;
5315
- const props = __props;
5316
- const iconMap = {
5317
- note: "ℹ️",
5318
- info: "ℹ️",
5319
- tip: "💡",
5320
- warning: "⚠️",
5321
- danger: "❗",
5322
- // 'error' is a common alias for 'danger' in some markdown flavors
5323
- error: "⛔",
5324
- caution: "⚠️"
5325
- };
5326
- const displayTitle = computed(() => {
5327
- if (props.node.title && props.node.title.trim().length)
5328
- return props.node.title;
5329
- const k = props.node.kind || "note";
5330
- return k.charAt(0).toUpperCase() + k.slice(1);
5331
- });
5332
- const collapsed = ref(props.node.collapsible ? !((_a2 = props.node.open) != null ? _a2 : true) : false);
5333
- function toggleCollapse() {
5334
- if (!props.node.collapsible)
5335
- return;
5336
- collapsed.value = !collapsed.value;
5337
- }
5338
- const headerId = `admonition-${Math.random().toString(36).slice(2, 9)}`;
5339
- const instance = getCurrentInstance();
5340
- const nestedRenderer = computed(() => {
5341
- const vm = instance == null ? void 0 : instance.proxy;
5342
- return isLegacyVue26Vm(vm) ? LegacyNodesRenderer : NodeRenderer;
5343
- });
5344
- return { __sfc: true, props, emit, iconMap, displayTitle, collapsed, toggleCollapse, headerId, instance, nestedRenderer };
5345
- }
5346
- });
5347
- const AdmonitionNode_vue_vue_type_style_index_0_scoped_f9c1d6b9_lang = "";
5348
- var _sfc_render$c = function render34() {
5349
- var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
5350
- 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) {
5351
- return _setup.emit("copy", $event);
5352
- } } })], 1)]);
5353
- };
5354
- var _sfc_staticRenderFns$c = [];
5355
- var __component__$c = /* @__PURE__ */ normalizeComponent(
5356
- _sfc_main$c,
5357
- _sfc_render$c,
5358
- _sfc_staticRenderFns$c,
5359
- false,
5360
- null,
5361
- "f9c1d6b9",
5362
- null,
5363
- null
5364
- );
5365
- const AdmonitionNode = __component__$c.exports;
5366
- let isPreload = false;
5367
- function preload(m) {
5368
- return __async(this, null, function* () {
5369
- if (isPreload)
5370
- return;
5371
- isPreload = true;
5372
- const existingEnv = globalThis == null ? void 0 : globalThis.MonacoEnvironment;
5373
- if (existingEnv && (typeof existingEnv.getWorker === "function" || typeof existingEnv.getWorkerUrl === "function"))
5374
- return;
5375
- return m.preloadMonacoWorkers();
5376
- });
5377
- }
5378
- let mod = null;
5379
- let importAttempted = false;
5380
- function warmupShikiTokenizer(m) {
5381
- return __async(this, null, function* () {
5382
- const getOrCreateHighlighter = m == null ? void 0 : m.getOrCreateHighlighter;
5383
- if (typeof getOrCreateHighlighter !== "function")
5384
- return true;
5385
- try {
5386
- const highlighter = yield getOrCreateHighlighter(
5387
- ["vitesse-dark", "vitesse-light"],
5388
- ["plaintext", "text", "javascript"]
5389
- );
5390
- if (highlighter && typeof highlighter.codeToTokens === "function") {
5391
- highlighter.codeToTokens("const a = 1", { lang: "javascript", theme: "vitesse-dark" });
5392
- }
5393
- return true;
5394
- } catch (err) {
5395
- console.warn("[markstream-vue2] Failed to warm up Shiki tokenizer; disabling stream-monaco for this session.", err);
5396
- return false;
5397
- }
5398
- });
5399
- }
5400
- function getUseMonaco() {
5401
- return __async(this, null, function* () {
5402
- var _a2;
5403
- if (mod)
5404
- return mod;
5405
- if (importAttempted)
5406
- return null;
5407
- try {
5408
- const imported = yield import("./chunks/index.legacy-010f0006.js").then((n) => n.i);
5409
- mod = (_a2 = imported == null ? void 0 : imported.default) != null ? _a2 : imported;
5410
- yield preload(mod);
5411
- const ok = yield warmupShikiTokenizer(mod);
5412
- if (!ok) {
5413
- mod = null;
5414
- importAttempted = true;
5415
- return null;
5416
- }
5417
- return mod;
5418
- } catch (e) {
5419
- importAttempted = true;
5420
- return null;
5421
- }
5422
- });
5423
- }
5424
- 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';
5425
- const CppIcon = '<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 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n';
5426
- const CsharpIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" d="m 6.665625,1.0107144 c 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 7.18125,3.9983098 h 2.971875 L 10.5125,1.8326156 c 0.09063,-0.5437673 0.60625,-0.9125291 1.15,-0.8219012 0.54375,0.090628 0.9125,0.6062693 0.821875,1.1500367 L 12.18125,3.9983098 H 14 c 0.553125,0 1,0.4468892 1,1.0000319 0,0.5531426 -0.446875,1.0000319 -1,1.0000319 H 11.846875 L 11.18125,9.9985013 H 13 c 0.553125,0 1,0.4468897 1,1.0000317 0,0.553143 -0.446875,1.000032 -1,1.000032 H 10.846875 L 10.4875,14.164259 c -0.09063,0.543768 -0.60625,0.912529 -1.15,0.821902 -0.54375,-0.09063 -0.9125,-0.60627 -0.821875,-1.150037 l 0.30625,-1.834434 h -2.975 L 5.4875,14.167384 c -0.090625,0.543768 -0.60625,0.91253 -1.15,0.821902 C 3.79375,14.898658 3.425,14.383016 3.515625,13.839249 L 3.81875,11.998565 H 2 c -0.553125,0 -1,-0.446889 -1,-1.000032 C 1,10.445391 1.446875,9.9985013 2,9.9985013 H 4.153125 L 4.81875,5.9983736 H 3 c -0.553125,0 -1,-0.4468893 -1,-1.0000319 C 2,4.445199 2.446875,3.9983098 3,3.9983098 H 5.153125 L 5.5125,1.8326156 C 5.603125,1.2888483 6.11875,0.9200865 6.6625,1.0107144 Z M 6.846875,5.9983736 6.18125,9.9985013 H 9.153125 L 9.81875,5.9983736 Z" />\n</svg>\n';
5427
- const CssIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n';
5428
- const GoIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m15.48 8.06-4.85.48m4.85-.48a4.98 4.98 0 01-4.54 5.42 5 5 0 112.95-8.66l-1.7 1.84a2.5 2.5 0 00-4.18 2.06c.05.57.3 1.1.69 1.51.25.27 1 .83 1.78.82.8-.02 1.58-.25 2.07-.81 0 0 .8-.96.68-1.88M2.5 8.5l-2 .01m1.5 2h1.5m-2-3.99 2-.02" />\n</svg>\n';
5429
- const HtmlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n';
5430
- const JavaIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#c6d0f5" d="M10.73 8.41c.57 3 1.59 5.83 2.77 7.09-6.63-3.45-9.76-1.75-10.5 0-.66-3.4-.54-5.74.09-7.78" />\n <path stroke="#e78284" d="M8.5 7c.63.34 1.82 1.07 2.24 1.41-.54-2.9-.64-5.96-.74-7.91-2.13.58-5.73 1.98-6.9 7.22.52-.69 1.72-1.05 2.4-1.22" />\n <path stroke="#e78284" d="M5.5 7A1.5 1.5 0 007 8.5 1.5 1.5 0 008.5 7 1.5 1.5 0 007 5.5 1.5 1.5 0 005.5 7" />\n </g>\n</svg>\n';
5431
- const JsxReactIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n';
5432
- const JsIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n';
5433
- const JsonIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n';
5434
- const KotlinIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ca9ee6" d="M2.5 13.5h11L8 8" />\n <path stroke="#ef9f76" d="M8.03 2.5h5.47l-8 8" />\n <path stroke="#e78284" d="M2.5 13.5V8" />\n <path stroke="#85c1dc" d="M8 2.5H2.5V8l3-2.5" />\n </g>\n</svg>\n';
5435
- const MarkdownIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n';
5436
- const MermaidIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n';
5437
- const PhpIcon = '<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="M0.5,12.5 L0.5,13.24 C0.5,14 1.27360724,14.5 2,14.5 C2.9375516,14.5 3.5,14 3.5,13.2445661 L3.5,6.00089968 C3.5,4.28551107 4.99401107,2.52263547 7.14960413,2.5 C9.49387886,2.5 11,4.0579782 11,5.5 C11.1657296,8.48962302 9.57820404,9.63684469 7.49621582,10.5 L7.49621582,14.5 L15.4979764,14.5 L15.4979764,9 C15.5394484,8.36478228 14.9387379,7.15595371 14.1308258,6.5 C13.1942239,5.80827275 12.0584852,5.50253264 11,5.5 M11.5,14.5 L11.5,11.5 M6,6.5 C6.27614237,6.5 6.5,6.27614237 6.5,6 C6.5,5.72385763 6.27614237,5.5 6,5.5 C5.72385763,5.5 5.5,5.72385763 5.5,6 C5.5,6.27614237 5.72385763,6.5 6,6.5 Z" />\n</svg>\n';
5438
- const PythonIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n';
5439
- const RubyIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M1.5 9.06v2.5c.02.86.36 1.61.9 2.15 1.76 1.76 5.71.65 8.84-2.47 3.12-3.13 4.23-7.08 2.47-8.84a3.1 3.1 0 00-2.15-.9h-2.5M14.5 4l-.25 10.25L4 14.5m4.39-6.11c2.34-2.35 3.29-5.2 2.12-6.37S6.49 1.8 4.14 4.14C1.8 6.5.85 9.34 2.02 10.51s4.02.22 6.37-2.12M5.5 14.5l.25-3.75L11 11l-.25-5.25 3.75-.25" />\n</svg>\n';
5440
- const RustIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round">\n <path d="M15.5 9.5Q8 13.505.5 9.5l1-1-1-2 2-.5V4.5h2l.5-2 1.5 1 1.5-2 1.5 2 1.5-1 .5 2h2V6l2 .5-1 2z" />\n <path d="M6.5 7.5a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1m5 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1M4 11.02c-.67.37-1.5.98-1.5 2.23s1.22 1.22 2 1.25v-2M12 11c.67.37 1.5 1 1.5 2.25s-1.22 1.22-2 1.25v-2" />\n </g>\n</svg>\n';
5441
- const SassIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#f4b8e4" stroke-linecap="round" stroke-linejoin="round" d="M6.75 6.38c1.85 1.07 3.35.74 4.83-.2 1.5-.95 2.7-2.78 1.3-4.15-.7-.68-3.25-.8-5.62.19-2.36.99-4.59 3.02-4.74 4.11-.31 2.19 3.15 2.88 3.64 4.23s.28 1.98-.2 2.83c-.5.85-1.96 1.62-2.8.68-.83-.95 1.67-2.75 2.98-3.25 1.3-.5 3.1-.4 3.69.25.58.64-.07 1.79-.03 1.79" />\n</svg>\n';
5442
- const ShellIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n';
5443
- const SqlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M8 6.5c3.59 0 6.5-1.4 6.5-2.68S11.59 1.5 8 1.5 1.5 2.54 1.5 3.82 4.41 6.5 8 6.5M14.5 8c0 .83-1.24 1.79-3.25 2.2s-4.49.41-6.5 0S1.5 8.83 1.5 8m13 4.18c0 .83-1.24 1.6-3.25 2-2.01.42-4.49.42-6.5 0-2.01-.4-3.25-1.17-3.25-2m0-8.3v8.3m13-8.3v8.3" />\n</svg>\n';
5444
- const SquareCodeIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>';
5445
- const SvgIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />\n</svg>\n';
5446
- const TextIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n';
5447
- const TsReactIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n';
5448
- const TsIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n';
5449
- const VueIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n';
5450
- const XmlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="M4.5 4.5 1 8 4.5 11.5M11.5 4.5 15 8 11.5 11.5M9.5 2 6.5 14" />\n</svg>\n';
5451
- const YamlIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e78284" stroke-linecap="round" stroke-linejoin="round" d="M2.5 1.5h3l3 4 3-4h3l-9 13h-3L7 8z" />\n</svg>\n';
5452
- let userLanguageIconResolver = null;
5453
- let extendedLanguageIconMap = null;
5454
- let extendedLanguageIconPromise = null;
5455
- const languageIconsRevision = ref(0);
5456
- const DEFAULT_LANGUAGE_ICON = SquareCodeIcon;
5457
- const CORE_LANGUAGE_ICON_MAP = {
5458
- "": TextIcon,
5459
- "plain": TextIcon,
5460
- "text": TextIcon,
5461
- "javascript": JsIcon,
5462
- "typescript": TsIcon,
5463
- "jsx": JsxReactIcon,
5464
- "tsx": TsReactIcon,
5465
- "html": HtmlIcon,
5466
- "css": CssIcon,
5467
- "scss": SassIcon,
5468
- "json": JsonIcon,
5469
- "python": PythonIcon,
5470
- "ruby": RubyIcon,
5471
- "go": GoIcon,
5472
- "java": JavaIcon,
5473
- "kotlin": KotlinIcon,
5474
- "c": CIcon,
5475
- "cpp": CppIcon,
5476
- "cs": CsharpIcon,
5477
- "csharp": CsharpIcon,
5478
- "php": PhpIcon,
5479
- "shell": ShellIcon,
5480
- "powershell": ShellIcon,
5481
- "sql": SqlIcon,
5482
- "yaml": YamlIcon,
5483
- "markdown": MarkdownIcon,
5484
- "xml": XmlIcon,
5485
- "rust": RustIcon,
5486
- "vue": VueIcon,
5487
- "mermaid": MermaidIcon,
5488
- "svg": SvgIcon
5489
- };
5490
- const LANGUAGE_ALIAS_MAP = {
5491
- "": "",
5492
- "javascript": "javascript",
5493
- "js": "javascript",
5494
- "mjs": "javascript",
5495
- "cjs": "javascript",
5496
- "typescript": "typescript",
5497
- "ts": "typescript",
5498
- "jsx": "jsx",
5499
- "tsx": "tsx",
5500
- "golang": "go",
5501
- "py": "python",
5502
- "rb": "ruby",
5503
- "sh": "shell",
5504
- "bash": "shell",
5505
- "zsh": "shell",
5506
- "shellscript": "shell",
5507
- "bat": "shell",
5508
- "batch": "shell",
5509
- "ps1": "powershell",
5510
- "plaintext": "plain",
5511
- "text": "plain",
5512
- "c++": "cpp",
5513
- "c#": "csharp",
5514
- "objective-c": "objectivec",
5515
- "objective-c++": "objectivecpp",
5516
- "yml": "yaml",
5517
- "md": "markdown",
5518
- "rs": "rust",
5519
- "kt": "kotlin",
5520
- "d": "dlang",
5521
- "vbnet": "vb.net"
5522
- };
5523
- function extractLanguageToken(lang) {
5524
- if (!lang)
5525
- return "";
5526
- const trimmed = lang.trim();
5527
- if (!trimmed)
5528
- return "";
5529
- const [firstToken] = trimmed.split(/\s+/);
5530
- const [base] = firstToken.split(":");
5531
- return base.toLowerCase();
5532
- }
5533
- function loadExtendedLanguageIconMap() {
5534
- return __async(this, null, function* () {
5535
- if (extendedLanguageIconMap)
5536
- return extendedLanguageIconMap;
5537
- if (!extendedLanguageIconPromise) {
5538
- extendedLanguageIconPromise = import("./chunks/languageIconExtended-feb078ee.js").then((mod2) => {
5539
- extendedLanguageIconMap = mod2.EXTENDED_LANGUAGE_ICON_MAP;
5540
- languageIconsRevision.value++;
5541
- return extendedLanguageIconMap;
5542
- }).catch(() => null);
5543
- }
5544
- return extendedLanguageIconPromise;
5545
- });
5546
- }
5547
- function setLanguageIconResolver(resolver) {
5548
- userLanguageIconResolver = resolver != null ? resolver : null;
5549
- }
5550
- function normalizeLanguageIdentifier(lang) {
5551
- var _a2;
5552
- const token = extractLanguageToken(lang);
5553
- return (_a2 = LANGUAGE_ALIAS_MAP[token]) != null ? _a2 : token;
5554
- }
5555
- function resolveMonacoLanguageId(lang) {
5556
- const canonical = normalizeLanguageIdentifier(lang);
5557
- if (!canonical)
5558
- return "plaintext";
5559
- switch (canonical) {
5560
- case "plain":
5561
- return "plaintext";
5562
- case "jsx":
5563
- return "javascript";
5564
- case "tsx":
5565
- return "typescript";
5566
- default:
5567
- return canonical;
5568
- }
5569
- }
5570
- function preloadExtendedLanguageIcons() {
5571
- return __async(this, null, function* () {
5572
- yield loadExtendedLanguageIconMap();
5573
- });
5574
- }
5575
- function getLanguageIcon(lang) {
5576
- if (userLanguageIconResolver) {
5577
- const hit = userLanguageIconResolver(lang);
5578
- if (hit != null && hit !== "")
5579
- return hit;
5580
- }
5581
- const normalized = normalizeLanguageIdentifier(lang);
5582
- const coreIcon = CORE_LANGUAGE_ICON_MAP[normalized];
5583
- if (coreIcon)
5584
- return coreIcon;
5585
- const extendedIcon = extendedLanguageIconMap == null ? void 0 : extendedLanguageIconMap[normalized];
5586
- if (extendedIcon)
5587
- return extendedIcon;
5588
- void loadExtendedLanguageIconMap();
5589
- return DEFAULT_LANGUAGE_ICON;
5590
- }
5591
- const languageMap = {
5592
- "js": "JavaScript",
5593
- "javascript": "JavaScript",
5594
- "ts": "TypeScript",
5595
- "jsx": "JSX",
5596
- "tsx": "TSX",
5597
- "html": "HTML",
5598
- "css": "CSS",
5599
- "scss": "SCSS",
5600
- "json": "JSON",
5601
- "py": "Python",
5602
- "python": "Python",
5603
- "rb": "Ruby",
5604
- "go": "Go",
5605
- "java": "Java",
5606
- "c": "C",
5607
- "cpp": "C++",
5608
- "cs": "C#",
5609
- "php": "PHP",
5610
- "sh": "Shell",
5611
- "bash": "Bash",
5612
- "sql": "SQL",
5613
- "yaml": "YAML",
5614
- "md": "Markdown",
5615
- "d2": "D2",
5616
- "d2lang": "D2",
5617
- "": "Plain Text",
5618
- "plain": "Plain Text"
5619
- };
5620
- const DEFAULT_CACHE_KEY = "markstream-vue2-nested-nodes";
5621
- const markdownCache = /* @__PURE__ */ new Map();
5622
- function parseNestedMarkdownToNodes(input, options = {}) {
5623
- if (Array.isArray(input.nodes))
5624
- return input.nodes.slice();
5625
- const nestedNode = input.node;
5626
- if (nestedNode) {
5627
- const children = getNodeList(nestedNode.children);
5628
- if (children.length > 0)
5629
- return children.slice();
5917
+ }
5918
+ function handleContainerMouseout(event) {
5919
+ var _a3;
5920
+ const target = (_a3 = event.target) == null ? void 0 : _a3.closest("[data-node-index]");
5921
+ if (!target)
5922
+ return;
5923
+ emit("mouseout", event);
5924
+ }
5925
+ const hasExplicitNodes = computed(() => Array.isArray(props.nodes) && props.nodes.length > 0);
5926
+ const typewriterCursorRef = ref(null);
5927
+ const showTypewriterCursor = ref(false);
5928
+ let typewriterCursorTimeout;
5929
+ let lastTypewriterContentLength = 0;
5930
+ const TYPEWRITER_CURSOR_EXCLUDED_NODE_TYPES = /* @__PURE__ */ new Set(["code_block", "admonition", "table", "math_block", "html_block", "image"]);
5931
+ function shouldSkipTypewriterCursorForNode(node) {
5932
+ if (!node || typeof node !== "object")
5933
+ return false;
5934
+ const type = node.type;
5935
+ return typeof type === "string" && TYPEWRITER_CURSOR_EXCLUDED_NODE_TYPES.has(type);
5936
+ }
5937
+ function shouldShowTypewriterCursorForCurrentNodes() {
5938
+ const lastNode = parsedNodes.value[parsedNodes.value.length - 1];
5939
+ return !shouldSkipTypewriterCursorForNode(lastNode);
5940
+ }
5941
+ function getNodeTextLength(node) {
5942
+ var _a3, _b2;
5943
+ if (!node || typeof node !== "object")
5944
+ return 0;
5945
+ const record = node;
5946
+ const direct = (_b2 = (_a3 = record.raw) != null ? _a3 : record.content) != null ? _b2 : record.code;
5947
+ if (typeof direct === "string")
5948
+ return direct.length;
5949
+ const children = record.children;
5950
+ if (Array.isArray(children))
5951
+ return children.reduce((total, child) => total + getNodeTextLength(child), 0);
5952
+ const items = record.items;
5953
+ if (Array.isArray(items))
5954
+ return items.reduce((total, item) => total + getNodeTextLength(item), 0);
5955
+ return 0;
5956
+ }
5957
+ function getTypewriterContentLength() {
5958
+ var _a3;
5959
+ if ((_a3 = props.nodes) == null ? void 0 : _a3.length)
5960
+ return props.nodes.reduce((total, node) => total + getNodeTextLength(node), 0);
5961
+ return rawContent.value.length;
5962
+ }
5963
+ function clearTypewriterCursorTimeout() {
5964
+ if (!typewriterCursorTimeout)
5965
+ return;
5966
+ clearTimeout(typewriterCursorTimeout);
5967
+ typewriterCursorTimeout = void 0;
5968
+ }
5969
+ function getLastTextNode(root) {
5970
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
5971
+ acceptNode(node) {
5972
+ var _a3;
5973
+ const text = (_a3 = node.textContent) != null ? _a3 : "";
5974
+ if (!text.trim())
5975
+ return NodeFilter.FILTER_REJECT;
5976
+ const parent = node.parentElement;
5977
+ if (!parent)
5978
+ return NodeFilter.FILTER_REJECT;
5979
+ if (parent.closest('.typewriter-cursor, .height-estimation-probes, [data-node-type="code_block"], [data-node-type="admonition"], [data-node-type="table"], [data-node-type="math_block"], [data-node-type="html_block"], [data-node-type="image"], script, style'))
5980
+ return NodeFilter.FILTER_REJECT;
5981
+ return NodeFilter.FILTER_ACCEPT;
5982
+ }
5983
+ });
5984
+ let last = null;
5985
+ let current = walker.nextNode();
5986
+ while (current) {
5987
+ last = current;
5988
+ current = walker.nextNode();
5989
+ }
5990
+ return last;
5991
+ }
5992
+ function updateTypewriterCursorPosition() {
5993
+ var _a3, _b2;
5994
+ if (typeof window === "undefined" || !showTypewriterCursor.value || !containerRef.value || !typewriterCursorRef.value)
5995
+ return;
5996
+ const root = containerRef.value;
5997
+ const cursor = typewriterCursorRef.value;
5998
+ const lastText = getLastTextNode(root);
5999
+ const rootRect = root.getBoundingClientRect();
6000
+ let left = 0;
6001
+ let top = 0;
6002
+ let height = 20;
6003
+ if (lastText == null ? void 0 : lastText.textContent) {
6004
+ const range = document.createRange();
6005
+ const end = lastText.textContent.length;
6006
+ range.setStart(lastText, Math.max(0, end - 1));
6007
+ range.setEnd(lastText, end);
6008
+ const rects = typeof range.getClientRects === "function" ? range.getClientRects() : void 0;
6009
+ const rect = (_b2 = rects == null ? void 0 : rects[rects.length - 1]) != null ? _b2 : (_a3 = lastText.parentElement) == null ? void 0 : _a3.getBoundingClientRect();
6010
+ if (rect) {
6011
+ left = rect.right - rootRect.left + root.scrollLeft;
6012
+ top = rect.top - rootRect.top + root.scrollTop;
6013
+ height = rect.height || height;
6014
+ }
6015
+ range.detach();
6016
+ }
6017
+ cursor.style.transform = `translate(${Math.max(0, left)}px, ${Math.max(0, top)}px)`;
6018
+ cursor.style.height = `${height}px`;
6019
+ }
6020
+ watch(
6021
+ [renderContent, rawContent, () => props.nodes, () => props.typewriter, effectiveFinal],
6022
+ () => __async(this, null, function* () {
6023
+ if (typeof window === "undefined" || hasExplicitNodes.value)
6024
+ return;
6025
+ if (effectiveFinal.value) {
6026
+ showTypewriterCursor.value = false;
6027
+ clearTypewriterCursorTimeout();
6028
+ return;
6029
+ }
6030
+ const nextLength = getTypewriterContentLength();
6031
+ const cursorAllowed = shouldShowTypewriterCursorForCurrentNodes();
6032
+ if (props.typewriter === false || !cursorAllowed || nextLength <= lastTypewriterContentLength) {
6033
+ if (props.typewriter === false || !cursorAllowed)
6034
+ showTypewriterCursor.value = false;
6035
+ lastTypewriterContentLength = nextLength;
6036
+ return;
6037
+ }
6038
+ lastTypewriterContentLength = nextLength;
6039
+ showTypewriterCursor.value = true;
6040
+ clearTypewriterCursorTimeout();
6041
+ yield nextTick();
6042
+ updateTypewriterCursorPosition();
6043
+ typewriterCursorTimeout = setTimeout(() => {
6044
+ showTypewriterCursor.value = false;
6045
+ }, 3e3);
6046
+ }),
6047
+ { flush: "post", immediate: true }
6048
+ );
6049
+ watch(
6050
+ showTypewriterCursor,
6051
+ (visible2) => __async(this, null, function* () {
6052
+ if (!visible2)
6053
+ return;
6054
+ yield nextTick();
6055
+ updateTypewriterCursorPosition();
6056
+ }),
6057
+ { flush: "post" }
6058
+ );
6059
+ return { __sfc: true, props, emit, 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, CodeBlockNodeAsync, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, 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 };
5630
6060
  }
5631
- const content2 = resolveContent(input);
5632
- if (!content2)
5633
- return [];
5634
- const parseOptions = resolveParseOptions(input, options);
5635
- const markdown = resolveMarkdownInstance(options);
5636
- return parseMarkdownToStructure(content2, markdown, parseOptions);
5637
- }
5638
- function resolveContent(input) {
5639
- var _a2;
5640
- if (typeof input.content === "string")
5641
- return input.content;
5642
- if (typeof ((_a2 = input.node) == null ? void 0 : _a2.content) === "string")
5643
- return input.node.content;
5644
- return "";
5645
- }
5646
- function resolveParseOptions(input, options) {
5647
- var _a2, _b;
5648
- const base = (_a2 = options.parseOptions) != null ? _a2 : {};
5649
- const resolvedFinal = (_b = options.final) != null ? _b : resolveFinalFromNode(input.node);
5650
- const customHtmlTags = mergeCustomHtmlTags(options.customHtmlTags, base.customHtmlTags);
5651
- if (resolvedFinal == null && customHtmlTags.length === 0)
5652
- return base;
5653
- return __spreadValues(__spreadValues(__spreadValues({}, base), resolvedFinal == null ? {} : { final: resolvedFinal }), customHtmlTags.length === 0 ? {} : { customHtmlTags });
5654
- }
5655
- function resolveFinalFromNode(node) {
5656
- if (!node || typeof node !== "object")
5657
- return void 0;
5658
- if (typeof node.loading === "boolean")
5659
- return !node.loading;
5660
- return void 0;
5661
- }
5662
- function resolveMarkdownInstance(options) {
5663
- var _a2;
5664
- const normalizedTags = mergeCustomHtmlTags(options.customHtmlTags, (_a2 = options.parseOptions) == null ? void 0 : _a2.customHtmlTags);
5665
- const cacheKey = `${options.cacheKey || DEFAULT_CACHE_KEY}::${normalizedTags.join(",")}`;
5666
- let markdown = markdownCache.get(cacheKey);
5667
- if (!markdown) {
5668
- markdown = getMarkdown(cacheKey, {
5669
- customHtmlTags: normalizedTags
6061
+ });
6062
+ const NodeRenderer_vue_vue_type_style_index_0_scoped_6b8b1370_lang = "";
6063
+ const NodeRenderer_vue_vue_type_style_index_1_lang = "";
6064
+ var _sfc_render$d = function render33() {
6065
+ var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
6066
+ 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) {
6067
+ 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) {
6068
+ return _setup.emit("copy", $event);
6069
+ }, "handle-artifact-click": function($event) {
6070
+ return _setup.emit("handleArtifactClick", $event);
6071
+ } } }, "component", item.bindings, false))], 1) : _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) {
6072
+ return _setup.emit("copy", $event);
6073
+ }, "handle-artifact-click": function($event) {
6074
+ return _setup.emit("handleArtifactClick", $event);
6075
+ } } }, "component", item.bindings, false))], 1)]);
6076
+ }) : _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) {
6077
+ return _setup.emit("copy", $event);
6078
+ }, "handle-artifact-click": function($event) {
6079
+ return _setup.emit("handleArtifactClick", $event);
6080
+ } } }) : [_setup.virtualizationEnabled ? _c("div", { staticClass: "node-spacer", style: { height: `${_setup.topSpacerHeight}px` }, attrs: { "aria-hidden": "true" } }) : _vm._e(), _vm._l(_setup.renderedItems, function(item) {
6081
+ var _a2;
6082
+ return _c("div", { key: item.renderKey, ref: `node-slot-${item.index}`, refInFor: true, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_setup.shouldRenderNode(item.index) ? _c("div", { ref: `node-content-${item.index}`, refInFor: true, 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) {
6083
+ return _setup.emit("copy", $event);
6084
+ }, "handle-artifact-click": function($event) {
6085
+ return _setup.emit("handleArtifactClick", $event);
6086
+ } } }, "component", item.bindings, false))], 1) : _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) {
6087
+ return _setup.emit("copy", $event);
6088
+ }, "handle-artifact-click": function($event) {
6089
+ return _setup.emit("handleArtifactClick", $event);
6090
+ } } }, "component", item.bindings, false))], 1) : _c("div", { staticClass: "node-placeholder", style: { height: `${(_a2 = _setup.nodeHeights[item.index]) != null ? _a2 : _setup.averageNodeHeight}px` } })]);
6091
+ }), _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);
6092
+ };
6093
+ var _sfc_staticRenderFns$d = [];
6094
+ var __component__$d = /* @__PURE__ */ normalizeComponent(
6095
+ _sfc_main$d,
6096
+ _sfc_render$d,
6097
+ _sfc_staticRenderFns$d,
6098
+ false,
6099
+ null,
6100
+ "6b8b1370",
6101
+ null,
6102
+ null
6103
+ );
6104
+ const NodeRenderer = __component__$d.exports;
6105
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
6106
+ __name: "AdmonitionNode",
6107
+ props: {
6108
+ node: null,
6109
+ indexKey: null,
6110
+ isDark: { type: Boolean },
6111
+ typewriter: { type: Boolean },
6112
+ customId: null
6113
+ },
6114
+ emits: ["copy"],
6115
+ setup(__props, { emit }) {
6116
+ var _a2;
6117
+ const props = __props;
6118
+ const iconMap = {
6119
+ note: "ℹ️",
6120
+ info: "ℹ️",
6121
+ tip: "💡",
6122
+ warning: "⚠️",
6123
+ danger: "❗",
6124
+ // 'error' is a common alias for 'danger' in some markdown flavors
6125
+ error: "⛔",
6126
+ caution: "⚠️"
6127
+ };
6128
+ const displayTitle = computed(() => {
6129
+ if (props.node.title && props.node.title.trim().length)
6130
+ return props.node.title;
6131
+ const k = props.node.kind || "note";
6132
+ return k.charAt(0).toUpperCase() + k.slice(1);
5670
6133
  });
5671
- markdownCache.set(cacheKey, markdown);
6134
+ const collapsed = ref(props.node.collapsible ? !((_a2 = props.node.open) != null ? _a2 : true) : false);
6135
+ function toggleCollapse() {
6136
+ if (!props.node.collapsible)
6137
+ return;
6138
+ collapsed.value = !collapsed.value;
6139
+ }
6140
+ const headerId = `admonition-${Math.random().toString(36).slice(2, 9)}`;
6141
+ const instance = getCurrentInstance();
6142
+ const nestedRenderer = computed(() => {
6143
+ const vm = instance == null ? void 0 : instance.proxy;
6144
+ return isLegacyVue26Vm(vm) ? LegacyNodesRenderer : NodeRenderer;
6145
+ });
6146
+ return { __sfc: true, props, emit, iconMap, displayTitle, collapsed, toggleCollapse, headerId, instance, nestedRenderer };
5672
6147
  }
5673
- return options.customMarkdownIt ? options.customMarkdownIt(markdown) : markdown;
5674
- }
5675
- function getNodeList(value) {
5676
- return Array.isArray(value) ? value : [];
5677
- }
6148
+ });
6149
+ const AdmonitionNode_vue_vue_type_style_index_0_scoped_f9c1d6b9_lang = "";
6150
+ var _sfc_render$c = function render34() {
6151
+ var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
6152
+ 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) {
6153
+ return _setup.emit("copy", $event);
6154
+ } } })], 1)]);
6155
+ };
6156
+ var _sfc_staticRenderFns$c = [];
6157
+ var __component__$c = /* @__PURE__ */ normalizeComponent(
6158
+ _sfc_main$c,
6159
+ _sfc_render$c,
6160
+ _sfc_staticRenderFns$c,
6161
+ false,
6162
+ null,
6163
+ "f9c1d6b9",
6164
+ null,
6165
+ null
6166
+ );
6167
+ const AdmonitionNode = __component__$c.exports;
5678
6168
  function safeRaf(cb) {
5679
6169
  try {
5680
6170
  if (typeof globalThis !== "undefined" && typeof globalThis.requestAnimationFrame === "function")
@@ -6029,6 +6519,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6029
6519
  const isExpanded = ref(false);
6030
6520
  const isCollapsed = ref(false);
6031
6521
  const editorCreated = ref(false);
6522
+ const editorReady = ref(false);
6032
6523
  const monacoReady = ref(false);
6033
6524
  let expandRafId = null;
6034
6525
  const heightBeforeCollapse = ref(null);
@@ -6094,6 +6585,21 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6094
6585
  minimumLineCount: 4,
6095
6586
  revealLineCount: 5
6096
6587
  });
6588
+ const defaultPreFallbackFontSize = 12;
6589
+ const defaultPreFallbackLineHeight = 18;
6590
+ function readPositiveNumber(value) {
6591
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
6592
+ }
6593
+ function readMonacoPadding(value) {
6594
+ var _a3, _b2;
6595
+ if (!value || typeof value !== "object")
6596
+ return { top: 0, bottom: 0 };
6597
+ const raw = value;
6598
+ return {
6599
+ top: (_a3 = readPositiveNumber(raw.top)) != null ? _a3 : 0,
6600
+ bottom: (_b2 = readPositiveNumber(raw.bottom)) != null ? _b2 : 0
6601
+ };
6602
+ }
6097
6603
  function resolveDiffHideUnchangedRegionsOption(value) {
6098
6604
  var _a3;
6099
6605
  if (typeof value === "boolean")
@@ -6107,14 +6613,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6107
6613
  return __spreadValues({}, defaultDiffHideUnchangedRegions);
6108
6614
  }
6109
6615
  const resolvedMonacoOptions = computed(() => {
6110
- var _a3;
6616
+ var _a3, _b2;
6111
6617
  const raw = props.monacoOptions ? __spreadValues({}, props.monacoOptions) : {};
6112
6618
  if (!isDiff.value)
6113
6619
  return raw;
6114
6620
  const diffHideUnchangedRegions = raw.diffHideUnchangedRegions === void 0 ? __spreadValues({}, defaultDiffHideUnchangedRegions) : resolveDiffHideUnchangedRegionsOption(raw.diffHideUnchangedRegions);
6115
6621
  const hideUnchangedRegions = raw.hideUnchangedRegions === void 0 ? void 0 : resolveDiffHideUnchangedRegionsOption(raw.hideUnchangedRegions);
6116
6622
  const diffUnchangedRegionStyle = (_a3 = raw.diffUnchangedRegionStyle) != null ? _a3 : "line-info";
6117
- const needsExtraBottomSpace = diffUnchangedRegionStyle === "line-info" || diffUnchangedRegionStyle === "line-info-basic" || diffUnchangedRegionStyle === "metadata";
6118
6623
  const diffDefaults = {
6119
6624
  maxComputationTime: 0,
6120
6625
  diffAlgorithm: "legacy",
@@ -6126,21 +6631,20 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6126
6631
  selectionHighlight: false,
6127
6632
  occurrencesHighlight: "off",
6128
6633
  matchBrackets: "never",
6129
- lineDecorationsWidth: 12,
6634
+ lineDecorationsWidth: 4,
6130
6635
  lineNumbersMinChars: 2,
6131
6636
  glyphMargin: false,
6132
- fontSize: 13,
6133
- lineHeight: 30,
6637
+ minimap: { enabled: false },
6134
6638
  renderOverviewRuler: false,
6135
6639
  overviewRulerBorder: false,
6136
6640
  hideCursorInOverviewRuler: true,
6137
6641
  scrollBeyondLastLine: false,
6138
- padding: { top: 10, bottom: needsExtraBottomSpace ? 22 : 14 },
6139
6642
  diffHideUnchangedRegions,
6643
+ useInlineViewWhenSpaceIsLimited: (_b2 = raw.useInlineViewWhenSpaceIsLimited) != null ? _b2 : false,
6140
6644
  diffLineStyle: "background",
6141
6645
  diffAppearance: "auto",
6142
6646
  diffUnchangedRegionStyle,
6143
- diffHunkActionsOnHover: true,
6647
+ diffHunkActionsOnHover: false,
6144
6648
  diffHunkHoverHideDelayMs: 160
6145
6649
  };
6146
6650
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, diffDefaults), raw), hideUnchangedRegions === void 0 ? {} : { hideUnchangedRegions }), {
@@ -6201,7 +6705,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6201
6705
  const codeFontMax = 36;
6202
6706
  const codeFontStep = 1;
6203
6707
  const defaultCodeFontSize = ref(
6204
- typeof ((_b = resolvedMonacoOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : Number.NaN
6708
+ typeof ((_b = resolvedMonacoOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : defaultPreFallbackFontSize
6205
6709
  );
6206
6710
  const codeFontSize = ref(defaultCodeFontSize.value);
6207
6711
  const fontBaselineReady = computed(() => {
@@ -6920,6 +7424,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6920
7424
  scheduleEditorVisualSync();
6921
7425
  });
6922
7426
  }
7427
+ editorReady.value = true;
6923
7428
  });
6924
7429
  }
6925
7430
  function ensureEditorCreation(el) {
@@ -6928,6 +7433,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6928
7433
  if (createEditorPromise)
6929
7434
  return createEditorPromise;
6930
7435
  editorCreated.value = true;
7436
+ editorReady.value = false;
6931
7437
  const pending2 = (() => __async(this, null, function* () {
6932
7438
  yield runEditorCreation(el);
6933
7439
  }))();
@@ -6988,12 +7494,48 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6988
7494
  return String(theme.name);
6989
7495
  return null;
6990
7496
  }
6991
- function resolveRequestedTheme() {
7497
+ function hasTheme(themes, theme) {
7498
+ const name = getThemeName(theme);
7499
+ return themes.some((item) => item === theme || name && getThemeName(item) === name);
7500
+ }
7501
+ function addRuntimeLanguage(languages, language) {
7502
+ if (typeof language !== "string")
7503
+ return;
7504
+ const canonical = normalizeLanguageIdentifier(language);
7505
+ const monacoId = resolveMonacoLanguageId(canonical);
7506
+ for (const value of [canonical, monacoId]) {
7507
+ if (value && !languages.includes(value))
7508
+ languages.push(value);
7509
+ }
7510
+ }
7511
+ const runtimeMonacoThemes = computed(() => {
7512
+ const themes = Array.isArray(props.themes) ? [...props.themes] : [];
7513
+ for (const theme of [props.darkTheme, props.lightTheme]) {
7514
+ if (theme != null && !hasTheme(themes, theme))
7515
+ themes.push(theme);
7516
+ }
7517
+ return themes.length ? themes : void 0;
7518
+ });
7519
+ const runtimeMonacoLanguages = computed(() => {
6992
7520
  var _a3;
7521
+ const languages = [];
7522
+ const configured = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.languages;
7523
+ if (Array.isArray(configured)) {
7524
+ for (const language of configured)
7525
+ addRuntimeLanguage(languages, language);
7526
+ }
7527
+ addRuntimeLanguage(languages, props.node.language);
7528
+ addRuntimeLanguage(languages, codeLanguage.value);
7529
+ addRuntimeLanguage(languages, monacoLanguage.value);
7530
+ addRuntimeLanguage(languages, "plaintext");
7531
+ return languages;
7532
+ });
7533
+ function resolveRequestedTheme() {
7534
+ var _a3, _b2;
6993
7535
  const preferred = getPreferredColorScheme();
6994
7536
  const explicit = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.theme;
6995
7537
  const requested = preferred != null ? preferred : explicit;
6996
- const availableThemes = Array.isArray(props.themes) ? props.themes : [];
7538
+ const availableThemes = (_b2 = runtimeMonacoThemes.value) != null ? _b2 : [];
6997
7539
  if (!availableThemes.length || requested == null)
6998
7540
  return requested;
6999
7541
  const requestedName = getThemeName(requested);
@@ -7069,18 +7611,72 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7069
7611
  const resolvedSurfaceIsDark = computed(
7070
7612
  () => isDiff.value ? effectiveDiffAppearance.value === "dark" : resolvedChromeIsDark.value
7071
7613
  );
7614
+ const preFallbackMetrics = computed(() => {
7615
+ var _a3, _b2, _c;
7616
+ const raw = resolvedMonacoOptions.value;
7617
+ const fallbackFontSize = Number.isFinite(codeFontSize.value) && codeFontSize.value > 0 ? codeFontSize.value : defaultPreFallbackFontSize;
7618
+ const resolvedFontSize = (_a3 = readPositiveNumber(raw == null ? void 0 : raw.fontSize)) != null ? _a3 : fallbackFontSize;
7619
+ const resolvedLineHeight = (_b2 = readPositiveNumber(raw == null ? void 0 : raw.lineHeight)) != null ? _b2 : resolvedFontSize === defaultPreFallbackFontSize ? defaultPreFallbackLineHeight : Math.max(12, Math.round(resolvedFontSize * 1.5));
7620
+ const fontFamily = typeof (raw == null ? void 0 : raw.fontFamily) === "string" && raw.fontFamily.trim() ? raw.fontFamily.trim() : void 0;
7621
+ const padding = readMonacoPadding(raw == null ? void 0 : raw.padding);
7622
+ const tabSize = (_c = readPositiveNumber(raw == null ? void 0 : raw.tabSize)) != null ? _c : 4;
7623
+ return {
7624
+ fontFamily,
7625
+ fontSize: resolvedFontSize,
7626
+ lineHeight: resolvedLineHeight,
7627
+ paddingBottom: padding.bottom,
7628
+ paddingTop: padding.top,
7629
+ tabSize
7630
+ };
7631
+ });
7632
+ const preFallbackDiffInline = computed(() => {
7633
+ var _a3;
7634
+ if (!isDiff.value)
7635
+ return false;
7636
+ return ((_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.renderSideBySide) === false;
7637
+ });
7638
+ const preFallbackStyle = computed(() => {
7639
+ const metrics = preFallbackMetrics.value;
7640
+ const style = {
7641
+ "--markstream-code-padding-left": "62px",
7642
+ "--markstream-pre-diff-line-height": `${metrics.lineHeight}px`,
7643
+ "--markstream-pre-line-number-top": `${metrics.paddingTop}px`,
7644
+ "--markstream-pre-line-number-width": "36px",
7645
+ "--markstream-pre-line-number-gap": "0px",
7646
+ "fontSize": `${metrics.fontSize}px`,
7647
+ "lineHeight": `${metrics.lineHeight}px`,
7648
+ "paddingBottom": `${metrics.paddingBottom}px`,
7649
+ "paddingTop": `${metrics.paddingTop}px`,
7650
+ "tabSize": metrics.tabSize
7651
+ };
7652
+ if (metrics.fontFamily)
7653
+ style.fontFamily = metrics.fontFamily;
7654
+ return style;
7655
+ });
7072
7656
  function buildRuntimeMonacoOptions() {
7073
- return __spreadProps(__spreadValues(__spreadProps(__spreadValues({
7657
+ var _a3, _b2, _c, _d, _e;
7658
+ const nextOptions = __spreadProps(__spreadValues(__spreadProps(__spreadValues({
7074
7659
  wordWrap: "on",
7075
- wrappingIndent: "same",
7076
- themes: props.themes
7660
+ wrappingIndent: "same"
7077
7661
  }, resolvedMonacoOptions.value || {}), {
7662
+ themes: runtimeMonacoThemes.value,
7663
+ languages: runtimeMonacoLanguages.value,
7078
7664
  theme: resolveRequestedTheme()
7079
7665
  }), isDiff.value ? { diffAppearance: effectiveDiffAppearance.value } : {}), {
7080
7666
  onThemeChange() {
7081
7667
  syncEditorCssVars();
7082
7668
  }
7083
7669
  });
7670
+ if (isDiff.value) {
7671
+ const metrics = preFallbackMetrics.value;
7672
+ (_a3 = nextOptions.fontSize) != null ? _a3 : nextOptions.fontSize = metrics.fontSize;
7673
+ (_b2 = nextOptions.lineHeight) != null ? _b2 : nextOptions.lineHeight = metrics.lineHeight;
7674
+ (_c = nextOptions.padding) != null ? _c : nextOptions.padding = { top: metrics.paddingTop, bottom: metrics.paddingBottom };
7675
+ (_d = nextOptions.tabSize) != null ? _d : nextOptions.tabSize = metrics.tabSize;
7676
+ if (metrics.fontFamily)
7677
+ (_e = nextOptions.fontFamily) != null ? _e : nextOptions.fontFamily = metrics.fontFamily;
7678
+ }
7679
+ return nextOptions;
7084
7680
  }
7085
7681
  function syncRuntimeMonacoOptions() {
7086
7682
  const nextOptions = buildRuntimeMonacoOptions();
@@ -7204,13 +7800,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7204
7800
  }
7205
7801
  cleanupEditor();
7206
7802
  });
7207
- return { __sfc: true, props, emits, MONACO_TOUCH_PATCH_FLAG, ensureMonacoPassiveTouchListeners, shouldForcePassiveForMonaco, withPassiveOptions, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, monacoLanguage, isPlainTextLanguage, isExpanded, isCollapsed, editorCreated, monacoReady, expandRafId, heightBeforeCollapse, resumeGuardFrames, registerVisibility, viewportHandle, viewportReady, createEditor, createDiffEditor, updateCode, updateDiffCode, getEditor, getEditorView, getDiffEditorView, cleanupEditor, safeClean, refreshDiffPresentation, createEditorPromise, detectLanguage, setTheme, runtimeMonacoOptions, inlineFoldProxyCleanups, deferredEditorVisualSyncRafId, isDiff, defaultDiffHideUnchangedRegions, resolveDiffHideUnchangedRegionsOption, resolvedMonacoOptions, desiredEditorKind, currentEditorKind, usePreCodeRender, showInlinePreview, isDevEnv: isDevEnv2, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, CONTENT_PADDING, LINE_EXTRA_PER_LINE, PIXEL_EPSILON, measureLineHeightFromDom, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, computeContentHeight, getColorLuminance, shouldPreferPlainTextFallbackSurface, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, clearInlineFoldProxies, syncInlineFoldProxies, scheduleEditorVisualSync, syncDiffRevealButtons, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, containerStyle, headerStyle, tooltipsEnabled, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, previewCode, setAutomaticLayout, runEditorCreation, ensureEditorCreation, stopCreateEditorWatch, getPreferredColorScheme, getThemeName, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
7803
+ 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, runtimeMonacoOptions, inlineFoldProxyCleanups, deferredEditorVisualSyncRafId, isDiff, defaultDiffHideUnchangedRegions, 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, measureLineHeightFromDom, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, computeContentHeight, getColorLuminance, shouldPreferPlainTextFallbackSurface, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, clearInlineFoldProxies, syncInlineFoldProxies, scheduleEditorVisualSync, syncDiffRevealButtons, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, containerStyle, 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, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
7208
7804
  }
7209
7805
  });
7210
- const CodeBlockNode_vue_vue_type_style_index_0_scoped_f73cb5ae_lang = "";
7806
+ const CodeBlockNode_vue_vue_type_style_index_0_scoped_b3974933_lang = "";
7211
7807
  var _sfc_render$9 = function render37() {
7212
7808
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
7213
- return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { attrs: { "node": _vm.node, "loading": _setup.props.loading } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
7809
+ return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.isDiff, "diff-inline": _setup.preFallbackDiffInline } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
7214
7810
  _setup.resolvedSurfaceIsDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
7215
7811
  { "is-rendering": _setup.props.loading, "is-dark": _setup.resolvedSurfaceIsDark, "is-diff": _setup.isDiff, "is-plain-text": _setup.isPlainTextLanguage }
7216
7812
  ], style: _setup.containerStyle }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", style: _setup.headerStyle }, [_vm._t("header-left", function() {
@@ -7253,7 +7849,7 @@ var _sfc_render$9 = function render37() {
7253
7849
  }, "focus": function($event) {
7254
7850
  _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
7255
7851
  }, "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)];
7256
- })], 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"] })]), _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() {
7852
+ })], 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: { visibility: _setup.editorReady ? "visible" : "hidden" }, attrs: { "aria-hidden": _setup.editorReady ? void 0 : "true" } }), !_setup.editorReady ? _c("div", { staticClass: "code-editor-fallback-surface" }, [_c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.isDiff, "diff-inline": _setup.preFallbackDiffInline } })], 1) : _vm._e()]), _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() {
7257
7853
  return [_c("div", { staticClass: "loading-skeleton" }, [_c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line short" })])];
7258
7854
  }, { "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);
7259
7855
  };
@@ -7264,7 +7860,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
7264
7860
  _sfc_staticRenderFns$9,
7265
7861
  false,
7266
7862
  null,
7267
- "f73cb5ae",
7863
+ "b3974933",
7268
7864
  null,
7269
7865
  null
7270
7866
  );
@@ -8262,10 +8858,17 @@ var __component__$7 = /* @__PURE__ */ normalizeComponent(
8262
8858
  null
8263
8859
  );
8264
8860
  const InfographicBlockNode = __component__$7.exports;
8861
+ function isDevEnvironment() {
8862
+ const viteEnv = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false };
8863
+ return viteEnv.DEV;
8864
+ }
8265
8865
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8266
8866
  __name: "MarkdownCodeBlockNode",
8267
8867
  props: {
8268
- node: { type: Object, required: true },
8868
+ node: {
8869
+ type: Object,
8870
+ required: true
8871
+ },
8269
8872
  loading: { type: Boolean, default: true },
8270
8873
  stream: { type: Boolean, default: true },
8271
8874
  darkTheme: { type: String, default: "vitesse-dark" },
@@ -8276,6 +8879,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8276
8879
  minWidth: { type: [String, Number], default: void 0 },
8277
8880
  maxWidth: { type: [String, Number], default: void 0 },
8278
8881
  themes: { type: Array, default: void 0 },
8882
+ langs: { type: Array, default: void 0 },
8279
8883
  showHeader: { type: Boolean, default: true },
8280
8884
  showCopyButton: { type: Boolean, default: true },
8281
8885
  showExpandButton: { type: Boolean, default: true },
@@ -8286,10 +8890,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8286
8890
  },
8287
8891
  emits: ["previewCode", "copy"],
8288
8892
  setup(__props, { emit: emits }) {
8289
- var _a2, _b;
8290
8893
  const props = __props;
8291
8894
  const { t } = useSafeI18n();
8292
- const codeLanguage = ref(normalizeLanguageIdentifier(String((_a2 = props.node.language) != null ? _a2 : "")));
8895
+ const codeLanguage = ref(normalizeLanguageIdentifier(props.node.language));
8293
8896
  const copyText = ref(false);
8294
8897
  const isExpanded = ref(false);
8295
8898
  const isCollapsed = ref(false);
@@ -8300,6 +8903,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8300
8903
  const rendererReady = ref(false);
8301
8904
  const hasStableRender = ref(false);
8302
8905
  let renderObserver;
8906
+ let lastCommittedRenderSignature = "";
8907
+ let rendererMutationVersion = 0;
8908
+ let pendingRenderSignature = null;
8303
8909
  const autoScrollEnabled = ref(true);
8304
8910
  const lastScrollTop = ref(0);
8305
8911
  const codeFontMin = 10;
@@ -8388,7 +8994,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8388
8994
  return luminance < 140;
8389
8995
  }
8390
8996
  function syncRenderedCssVars() {
8391
- var _a3;
8997
+ var _a2;
8392
8998
  if (typeof window === "undefined" || typeof window.getComputedStyle !== "function")
8393
8999
  return;
8394
9000
  const rootEl = container.value;
@@ -8407,7 +9013,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8407
9013
  rootEl.style.setProperty("--vscode-editor-background", bg);
8408
9014
  const darkBg = bg ? isDarkBackgroundColor(bg) : props.isDark;
8409
9015
  const fallbackFg = darkBg ? "rgb(229, 231, 235)" : "rgb(17, 24, 39)";
8410
- const resolvedFg = bg && detectedFg && ((_a3 = getContrastRatio(detectedFg, bg)) != null ? _a3 : 0) >= 3 ? detectedFg : fallbackFg;
9016
+ const resolvedFg = bg && detectedFg && ((_a2 = getContrastRatio(detectedFg, bg)) != null ? _a2 : 0) >= 3 ? detectedFg : fallbackFg;
8411
9017
  rootEl.style.setProperty("--vscode-editor-foreground", resolvedFg);
8412
9018
  rootEl.style.setProperty("--markstream-code-fallback-selection-bg", darkBg ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.06)");
8413
9019
  rootEl.style.setProperty("--vscode-editor-selectionBackground", `var(--markstream-code-fallback-selection-bg)`);
@@ -8416,145 +9022,404 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8416
9022
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
8417
9023
  }
8418
9024
  function renderFallback(code, force = false) {
8419
- renderObserver == null ? void 0 : renderObserver.disconnect();
8420
- renderObserver = void 0;
8421
- if (!force && hasStableRender.value) {
8422
- fallbackHtml.value = "";
8423
- rendererReady.value = true;
8424
- return;
8425
- }
9025
+ var _a2;
9026
+ pendingRenderSignature = null;
9027
+ disconnectReadyObserver();
9028
+ const fallbackEl = (_a2 = codeBlockContent.value) == null ? void 0 : _a2.querySelector(".code-fallback-plain");
9029
+ fallbackEl == null ? void 0 : fallbackEl.style.removeProperty("display");
8426
9030
  if (!code) {
9031
+ clearRendererTarget();
8427
9032
  fallbackHtml.value = "";
8428
9033
  rendererReady.value = false;
8429
9034
  hasStableRender.value = false;
9035
+ lastCommittedRenderSignature = "";
9036
+ return;
9037
+ }
9038
+ if (!force && hasStableRender.value) {
9039
+ fallbackHtml.value = "";
9040
+ rendererReady.value = true;
8430
9041
  return;
8431
9042
  }
8432
9043
  fallbackHtml.value = `<pre class="shiki shiki-fallback"><code>${escapeHtml2(code)}</code></pre>`;
8433
9044
  rendererReady.value = false;
8434
9045
  }
8435
9046
  function clearFallback() {
9047
+ var _a2;
8436
9048
  fallbackHtml.value = "";
8437
9049
  rendererReady.value = true;
8438
9050
  hasStableRender.value = true;
8439
- void nextTick().then(() => {
9051
+ const fallbackEl = (_a2 = codeBlockContent.value) == null ? void 0 : _a2.querySelector(".code-fallback-plain");
9052
+ if (fallbackEl)
9053
+ fallbackEl.style.display = "none";
9054
+ void nextTick().then(() => __async(this, null, function* () {
9055
+ yield nextTick();
9056
+ if (!fallbackHtml.value && rendererReady.value) {
9057
+ rendererReady.value = false;
9058
+ rendererReady.value = true;
9059
+ }
8440
9060
  syncRenderedCssVars();
8441
- });
9061
+ }));
8442
9062
  }
8443
9063
  function keepLastSuccessfulRender() {
8444
- renderObserver == null ? void 0 : renderObserver.disconnect();
8445
- renderObserver = void 0;
9064
+ pendingRenderSignature = null;
9065
+ disconnectReadyObserver();
8446
9066
  if (!hasStableRender.value)
8447
9067
  return;
8448
9068
  fallbackHtml.value = "";
8449
9069
  rendererReady.value = true;
8450
9070
  }
9071
+ function clearRendererTarget() {
9072
+ if (rendererTarget.value)
9073
+ rendererTarget.value.innerHTML = "";
9074
+ }
8451
9075
  function hasRendererContent() {
8452
- var _a3;
9076
+ var _a2;
8453
9077
  const target = rendererTarget.value;
8454
9078
  if (!target)
8455
9079
  return false;
8456
9080
  if (target.childNodes.length > 0)
8457
9081
  return true;
8458
- return Boolean((_a3 = target.textContent) == null ? void 0 : _a3.trim().length);
9082
+ return Boolean((_a2 = target.textContent) == null ? void 0 : _a2.trim().length);
9083
+ }
9084
+ function getRenderSignature(configKey, lang, code) {
9085
+ return `${configKey != null ? configKey : ""}\0${lang}\0${code}`;
9086
+ }
9087
+ function markRendererCommitted(renderSignature) {
9088
+ lastCommittedRenderSignature = renderSignature;
9089
+ clearFallback();
9090
+ }
9091
+ function disconnectReadyObserver(observer) {
9092
+ observer == null ? void 0 : observer.disconnect();
9093
+ if (!observer || renderObserver === observer)
9094
+ renderObserver = void 0;
9095
+ }
9096
+ function startRendererReadyObserver(epoch, previousVersion) {
9097
+ disconnectReadyObserver();
9098
+ const target = rendererTarget.value;
9099
+ if (!target || typeof MutationObserver === "undefined")
9100
+ return;
9101
+ pendingRenderSignature = null;
9102
+ const observer = new MutationObserver(() => {
9103
+ rendererMutationVersion += 1;
9104
+ const signature = pendingRenderSignature;
9105
+ if (!signature)
9106
+ return;
9107
+ if (!isCurrentRenderEpoch(epoch)) {
9108
+ pendingRenderSignature = null;
9109
+ disconnectReadyObserver(observer);
9110
+ return;
9111
+ }
9112
+ if (rendererMutationVersion === previousVersion || !hasRendererContent())
9113
+ return;
9114
+ pendingRenderSignature = null;
9115
+ disconnectReadyObserver(observer);
9116
+ markRendererCommitted(signature);
9117
+ });
9118
+ renderObserver = observer;
9119
+ observer.observe(target, {
9120
+ childList: true,
9121
+ subtree: true,
9122
+ characterData: true,
9123
+ attributes: true
9124
+ });
8459
9125
  }
8460
- function clearFallbackWhenRendererReady() {
9126
+ function clearFallbackWhenRendererReady(epoch, previousVersion, renderSignature, previousRendererHtml) {
8461
9127
  return __async(this, null, function* () {
9128
+ var _a2;
9129
+ pendingRenderSignature = renderSignature;
8462
9130
  yield nextTick();
8463
- if (hasRendererContent()) {
8464
- clearFallback();
9131
+ if (!isCurrentRenderEpoch(epoch))
8465
9132
  return;
9133
+ const rendererHasContent = hasRendererContent();
9134
+ const hasObservedMutation = rendererMutationVersion !== previousVersion;
9135
+ const hasDomSnapshotChange = previousRendererHtml !== void 0 && ((_a2 = rendererTarget.value) == null ? void 0 : _a2.innerHTML) !== previousRendererHtml;
9136
+ if (rendererHasContent && (!lastCommittedRenderSignature || hasObservedMutation || hasDomSnapshotChange || lastCommittedRenderSignature === renderSignature)) {
9137
+ pendingRenderSignature = null;
9138
+ disconnectReadyObserver();
9139
+ markRendererCommitted(renderSignature);
8466
9140
  }
8467
- const target = rendererTarget.value;
8468
- if (!target)
8469
- return;
8470
- renderObserver == null ? void 0 : renderObserver.disconnect();
8471
- renderObserver = new MutationObserver(() => {
8472
- if (!hasRendererContent())
8473
- return;
8474
- clearFallback();
8475
- renderObserver == null ? void 0 : renderObserver.disconnect();
8476
- renderObserver = void 0;
8477
- });
8478
- renderObserver.observe(target, { childList: true, subtree: true });
8479
9141
  });
8480
9142
  }
8481
9143
  let renderer;
9144
+ let rendererConfigKey = null;
9145
+ let rendererTheme;
9146
+ let rendererThemeSyncQueued = false;
9147
+ let rendererThemeObserver;
8482
9148
  let createShikiRenderer;
8483
9149
  let registerHighlight;
8484
- let registeredHighlightLanguages;
8485
- const warnedMissingLanguages = /* @__PURE__ */ new Set();
9150
+ let registeredHighlightKey = null;
9151
+ let latestHighlightRegistrationKey = "";
9152
+ let highlightRegistrationSeq = 0;
9153
+ let renderEpoch = 0;
9154
+ let disposed = false;
8486
9155
  const warnedRendererErrors = /* @__PURE__ */ new Set();
8487
- const isDevEnv2 = typeof import.meta !== "undefined" && Boolean((_b = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false }) == null ? void 0 : _b.DEV);
8488
- function normalizeRendererLanguage(rawLang, hasContent = false) {
8489
- const normalized = normalizeLanguageIdentifier(String(rawLang != null ? rawLang : ""));
8490
- if (!normalized)
8491
- return "plaintext";
8492
- if (!registeredHighlightLanguages || registeredHighlightLanguages.has(normalized))
8493
- return normalized;
8494
- if (hasContent && isDevEnv2 && !warnedMissingLanguages.has(normalized)) {
8495
- warnedMissingLanguages.add(normalized);
8496
- console.warn(`[MarkdownCodeBlockNode] Language "${normalized}" not preloaded in stream-markdown; falling back to plaintext.`);
9156
+ const failedRendererLanguages = /* @__PURE__ */ new Set();
9157
+ const failedHighlightRegistrationKeys = /* @__PURE__ */ new Set();
9158
+ const isDevEnv2 = isDevEnvironment();
9159
+ let warnedMissingRegisterHighlightForLangs = false;
9160
+ let streamMarkdownLoadPromise = null;
9161
+ let streamMarkdownLoadFailed = false;
9162
+ let warnedStreamMarkdownUnavailable = false;
9163
+ function nextRenderEpoch() {
9164
+ renderEpoch += 1;
9165
+ return renderEpoch;
9166
+ }
9167
+ function isCurrentRenderEpoch(epoch = renderEpoch) {
9168
+ return !disposed && epoch === renderEpoch;
9169
+ }
9170
+ function disposeCurrentRenderer(options = {}) {
9171
+ const current = renderer;
9172
+ renderer = void 0;
9173
+ rendererConfigKey = null;
9174
+ rendererTheme = void 0;
9175
+ lastCommittedRenderSignature = "";
9176
+ pendingRenderSignature = null;
9177
+ failedRendererLanguages.clear();
9178
+ try {
9179
+ current == null ? void 0 : current.dispose();
9180
+ } catch (err) {
9181
+ if (isDevEnv2)
9182
+ console.warn("[MarkdownCodeBlockNode] Failed to dispose Shiki renderer.", err);
9183
+ } finally {
9184
+ clearRendererTarget();
9185
+ rendererReady.value = false;
9186
+ if (options.resetStableRender)
9187
+ hasStableRender.value = false;
8497
9188
  }
8498
- return "plaintext";
8499
9189
  }
8500
- function updateRendererWithFallback(code, rawLang) {
9190
+ function syncRendererTheme() {
8501
9191
  return __async(this, null, function* () {
8502
9192
  if (!renderer)
8503
- return false;
8504
- const normalized = normalizeRendererLanguage(rawLang, Boolean(code && code.length));
8505
- try {
8506
- yield renderer.updateCode(code, normalized);
8507
- return true;
8508
- } catch (err) {
9193
+ return;
9194
+ const theme = getRenderedColorScheme();
9195
+ if (rendererTheme === theme)
9196
+ return;
9197
+ yield renderer.setTheme(theme);
9198
+ rendererTheme = theme;
9199
+ });
9200
+ }
9201
+ function queueRendererThemeChange() {
9202
+ const theme = getRenderedColorScheme();
9203
+ if (!renderer || theme === rendererTheme || rendererThemeSyncQueued)
9204
+ return;
9205
+ rendererThemeSyncQueued = true;
9206
+ void nextTick(() => {
9207
+ rendererThemeSyncQueued = false;
9208
+ void handleRendererThemeChange();
9209
+ });
9210
+ }
9211
+ function startRendererThemeObserver() {
9212
+ if (rendererThemeObserver || typeof MutationObserver === "undefined")
9213
+ return;
9214
+ const rootEl = container.value;
9215
+ if (!rootEl)
9216
+ return;
9217
+ rendererThemeObserver = new MutationObserver(() => {
9218
+ queueRendererThemeChange();
9219
+ });
9220
+ rendererThemeObserver.observe(rootEl, {
9221
+ attributes: true,
9222
+ attributeFilter: ["data-markstream-code-theme"]
9223
+ });
9224
+ }
9225
+ function disconnectRendererThemeObserver() {
9226
+ rendererThemeObserver == null ? void 0 : rendererThemeObserver.disconnect();
9227
+ rendererThemeObserver = void 0;
9228
+ }
9229
+ function getRenderedColorScheme() {
9230
+ var _a2;
9231
+ return ((_a2 = container.value) == null ? void 0 : _a2.getAttribute("data-markstream-code-theme")) || getPreferredColorScheme();
9232
+ }
9233
+ const highlightRegistrationKey = computed(
9234
+ () => getHighlightRegistrationKey(getResolvedThemes(), props.langs)
9235
+ );
9236
+ function getShikiRuntimeCapabilities() {
9237
+ return {
9238
+ hasRegisterHighlight: Boolean(registerHighlight),
9239
+ hasCreateRenderer: Boolean(createShikiRenderer)
9240
+ };
9241
+ }
9242
+ function getRuntimeConfigWithFailedLangsFallback(themes, langs) {
9243
+ var _a2;
9244
+ const capabilities = getShikiRuntimeCapabilities();
9245
+ const runtimeConfig = getRuntimeShikiRegistrationConfig(themes, langs, capabilities);
9246
+ if (((_a2 = runtimeConfig.rendererOptions.langs) == null ? void 0 : _a2.length) && failedHighlightRegistrationKeys.has(runtimeConfig.key)) {
9247
+ return getRuntimeShikiRegistrationConfig(themes, void 0, capabilities);
9248
+ }
9249
+ return runtimeConfig;
9250
+ }
9251
+ function rendererNeedsReconfigure() {
9252
+ const runtimeConfig = getRuntimeConfigWithFailedLangsFallback(getResolvedThemes(), props.langs);
9253
+ return Boolean(renderer && rendererConfigKey !== runtimeConfig.key);
9254
+ }
9255
+ function normalizeRendererLanguage(rawLang) {
9256
+ const normalized = normalizeShikiLanguage(rawLang);
9257
+ return normalized || "plaintext";
9258
+ }
9259
+ function updateRendererWithFallback(_0, _1) {
9260
+ return __async(this, arguments, function* (code, rawLang, epoch = renderEpoch) {
9261
+ if (!renderer || !isCurrentRenderEpoch(epoch))
9262
+ return void 0;
9263
+ const normalized = normalizeRendererLanguage(rawLang);
9264
+ const renderPlaintext = (originalError) => __async(this, null, function* () {
9265
+ if (!renderer || !isCurrentRenderEpoch(epoch))
9266
+ return void 0;
8509
9267
  if (normalized !== "plaintext") {
8510
- if (isDevEnv2 && !warnedRendererErrors.has(normalized)) {
9268
+ if (originalError)
9269
+ failedRendererLanguages.add(normalized);
9270
+ if (originalError && isDevEnv2 && !warnedRendererErrors.has(normalized)) {
8511
9271
  warnedRendererErrors.add(normalized);
8512
- console.warn(`[MarkdownCodeBlockNode] Failed to render language "${normalized}", retrying as plaintext.`, err);
9272
+ console.warn(`[MarkdownCodeBlockNode] Failed to render language "${normalized}", retrying as plaintext.`, originalError);
8513
9273
  }
8514
- try {
8515
- yield renderer.updateCode(code, "plaintext");
8516
- return true;
8517
- } catch (plainErr) {
8518
- if (isDevEnv2)
8519
- console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", plainErr);
8520
- return false;
8521
- }
8522
- } else if (isDevEnv2) {
8523
- console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", err);
8524
9274
  }
8525
- return false;
9275
+ try {
9276
+ yield renderer.updateCode(code, "plaintext");
9277
+ return isCurrentRenderEpoch(epoch) ? "plaintext" : void 0;
9278
+ } catch (plainErr) {
9279
+ if (!isCurrentRenderEpoch(epoch))
9280
+ return void 0;
9281
+ if (isDevEnv2)
9282
+ console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", plainErr);
9283
+ return void 0;
9284
+ }
9285
+ });
9286
+ if (normalized !== "plaintext" && failedRendererLanguages.has(normalized))
9287
+ return renderPlaintext();
9288
+ try {
9289
+ yield renderer.updateCode(code, normalized);
9290
+ return isCurrentRenderEpoch(epoch) ? normalized : void 0;
9291
+ } catch (err) {
9292
+ if (!isCurrentRenderEpoch(epoch))
9293
+ return void 0;
9294
+ if (normalized !== "plaintext")
9295
+ return renderPlaintext(err);
9296
+ if (isDevEnv2)
9297
+ console.warn("[MarkdownCodeBlockNode] Failed to render code block even as plaintext.", err);
9298
+ return void 0;
8526
9299
  }
8527
9300
  });
8528
9301
  }
8529
- function ensureStreamMarkdownLoaded() {
9302
+ function ensureHighlightRegistered(registerOptions, key) {
8530
9303
  return __async(this, null, function* () {
8531
- if (createShikiRenderer)
8532
- return;
9304
+ if (!registerHighlight)
9305
+ return "ready";
9306
+ if (latestHighlightRegistrationKey !== key)
9307
+ return "stale";
9308
+ if (registeredHighlightKey === key)
9309
+ return "ready";
9310
+ const seq = ++highlightRegistrationSeq;
8533
9311
  try {
8534
- const mod2 = yield import("stream-markdown");
8535
- createShikiRenderer = mod2.createShikiStreamRenderer;
8536
- registerHighlight = mod2.registerHighlight;
8537
- const defaultLangs = Array.isArray(mod2.defaultLanguages) ? mod2.defaultLanguages : void 0;
8538
- registeredHighlightLanguages = defaultLangs ? new Set(defaultLangs.map((l) => l.toLowerCase())) : void 0;
8539
- registerHighlight == null ? void 0 : registerHighlight({ themes: getResolvedThemes() });
9312
+ yield registerHighlightOnce(registerHighlight, registerOptions, key);
8540
9313
  } catch (e) {
8541
- console.warn("[MarkdownCodeBlockNode] stream-markdown not available:", e);
8542
- }
9314
+ if (seq !== highlightRegistrationSeq || latestHighlightRegistrationKey !== key)
9315
+ return "stale";
9316
+ return "failed";
9317
+ }
9318
+ if (seq !== highlightRegistrationSeq || latestHighlightRegistrationKey !== key)
9319
+ return "stale";
9320
+ registeredHighlightKey = key;
9321
+ return "ready";
9322
+ });
9323
+ }
9324
+ function waitForCurrentHighlightRegistration(registerOptions, key) {
9325
+ return __async(this, null, function* () {
9326
+ const status = yield ensureHighlightRegistered(registerOptions, key);
9327
+ if (status !== "failed")
9328
+ return status;
9329
+ if (latestHighlightRegistrationKey !== key)
9330
+ return "stale";
9331
+ return ensureHighlightRegistered(registerOptions, key);
9332
+ });
9333
+ }
9334
+ function ensureStreamMarkdownLoaded() {
9335
+ return __async(this, null, function* () {
9336
+ if (createShikiRenderer || streamMarkdownLoadFailed)
9337
+ return;
9338
+ if (streamMarkdownLoadPromise)
9339
+ return streamMarkdownLoadPromise;
9340
+ streamMarkdownLoadPromise = (() => __async(this, null, function* () {
9341
+ try {
9342
+ const mod2 = yield import("stream-markdown");
9343
+ const nextCreateRenderer = mod2.createShikiStreamRenderer;
9344
+ if (typeof nextCreateRenderer !== "function")
9345
+ throw new TypeError("stream-markdown.createShikiStreamRenderer is not available");
9346
+ createShikiRenderer = nextCreateRenderer;
9347
+ const nextRegisterHighlight = mod2.registerHighlight;
9348
+ registerHighlight = typeof nextRegisterHighlight === "function" ? nextRegisterHighlight : void 0;
9349
+ streamMarkdownLoadFailed = false;
9350
+ warnedStreamMarkdownUnavailable = false;
9351
+ } catch (e) {
9352
+ streamMarkdownLoadFailed = true;
9353
+ if (isDevEnv2 && !warnedStreamMarkdownUnavailable) {
9354
+ warnedStreamMarkdownUnavailable = true;
9355
+ console.warn("[MarkdownCodeBlockNode] stream-markdown not available:", e);
9356
+ }
9357
+ } finally {
9358
+ streamMarkdownLoadPromise = null;
9359
+ }
9360
+ }))();
9361
+ return streamMarkdownLoadPromise;
8543
9362
  });
8544
9363
  }
8545
- function initRenderer() {
9364
+ function initRenderer(epoch) {
8546
9365
  return __async(this, null, function* () {
9366
+ var _a2, _b;
9367
+ if (!isCurrentRenderEpoch(epoch))
9368
+ return;
8547
9369
  yield ensureStreamMarkdownLoaded();
9370
+ if (!isCurrentRenderEpoch(epoch))
9371
+ return;
8548
9372
  if (!codeBlockContent.value || !rendererTarget.value) {
8549
9373
  renderFallback(props.node.code, true);
8550
9374
  return;
8551
9375
  }
8552
- registerHighlight == null ? void 0 : registerHighlight({ themes: getResolvedThemes() });
9376
+ let runtimeConfig = getRuntimeConfigWithFailedLangsFallback(getResolvedThemes(), props.langs);
9377
+ if (runtimeConfig.ignoredLangs && isDevEnv2 && !warnedMissingRegisterHighlightForLangs) {
9378
+ warnedMissingRegisterHighlightForLangs = true;
9379
+ console.warn(
9380
+ "[MarkdownCodeBlockNode] `langs` requires stream-markdown >=0.0.15 with registerHighlight(); ignoring `langs` and using stream-markdown default language preload."
9381
+ );
9382
+ }
9383
+ let rendererOptions = runtimeConfig.rendererOptions;
9384
+ let nextRendererConfigKey = runtimeConfig.key;
9385
+ latestHighlightRegistrationKey = nextRendererConfigKey;
9386
+ let needsRendererReconfigure = Boolean(renderer && rendererConfigKey !== nextRendererConfigKey);
9387
+ if (needsRendererReconfigure)
9388
+ renderFallback(props.node.code, !hasStableRender.value);
9389
+ let highlightStatus = yield waitForCurrentHighlightRegistration(runtimeConfig.registerOptions, nextRendererConfigKey);
9390
+ if (highlightStatus === "failed" && ((_a2 = rendererOptions.langs) == null ? void 0 : _a2.length)) {
9391
+ failedHighlightRegistrationKeys.add(nextRendererConfigKey);
9392
+ if (isDevEnv2) {
9393
+ console.warn(
9394
+ "[MarkdownCodeBlockNode] Failed to register configured Shiki languages; retrying without `langs`.",
9395
+ { langs: rendererOptions.langs }
9396
+ );
9397
+ }
9398
+ runtimeConfig = getRuntimeShikiRegistrationConfig(getResolvedThemes(), void 0, getShikiRuntimeCapabilities());
9399
+ rendererOptions = runtimeConfig.rendererOptions;
9400
+ nextRendererConfigKey = runtimeConfig.key;
9401
+ latestHighlightRegistrationKey = nextRendererConfigKey;
9402
+ highlightStatus = yield waitForCurrentHighlightRegistration(runtimeConfig.registerOptions, nextRendererConfigKey);
9403
+ }
9404
+ if (!isCurrentRenderEpoch(epoch) || highlightStatus === "stale")
9405
+ return;
9406
+ needsRendererReconfigure = Boolean(renderer && rendererConfigKey !== nextRendererConfigKey);
9407
+ if (highlightStatus === "failed") {
9408
+ if (needsRendererReconfigure && renderer && hasRendererContent())
9409
+ clearFallback();
9410
+ else
9411
+ renderFallback(props.node.code, true);
9412
+ return;
9413
+ }
9414
+ if (needsRendererReconfigure)
9415
+ disposeCurrentRenderer({ resetStableRender: true });
8553
9416
  if (!renderer && createShikiRenderer) {
8554
- renderer = createShikiRenderer(rendererTarget.value, {
8555
- theme: getPreferredColorScheme(),
8556
- themes: getResolvedThemes()
8557
- });
9417
+ const theme = getRenderedColorScheme();
9418
+ renderer = createShikiRenderer(rendererTarget.value, __spreadValues({
9419
+ theme
9420
+ }, rendererOptions));
9421
+ rendererTheme = theme;
9422
+ rendererConfigKey = nextRendererConfigKey;
8558
9423
  rendererReady.value = true;
8559
9424
  }
8560
9425
  if (!renderer) {
@@ -8566,40 +9431,91 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8566
9431
  return;
8567
9432
  }
8568
9433
  renderFallback(props.node.code, !hasStableRender.value);
8569
- const updated = yield updateRendererWithFallback(props.node.code, codeLanguage.value);
8570
- if (!updated) {
9434
+ const previousMutationVersion = rendererMutationVersion;
9435
+ const previousRendererHtml = (_b = rendererTarget.value) == null ? void 0 : _b.innerHTML;
9436
+ startRendererReadyObserver(epoch, previousMutationVersion);
9437
+ const renderedLang = yield updateRendererWithFallback(props.node.code, props.node.language, epoch);
9438
+ if (!isCurrentRenderEpoch(epoch))
9439
+ return;
9440
+ if (!renderedLang) {
9441
+ pendingRenderSignature = null;
9442
+ disconnectReadyObserver();
8571
9443
  keepLastSuccessfulRender();
8572
9444
  return;
8573
9445
  }
8574
- if (hasStableRender.value)
9446
+ if (hasStableRender.value) {
8575
9447
  keepLastSuccessfulRender();
8576
- else
8577
- yield clearFallbackWhenRendererReady();
9448
+ } else {
9449
+ yield clearFallbackWhenRendererReady(
9450
+ epoch,
9451
+ previousMutationVersion,
9452
+ getRenderSignature(nextRendererConfigKey, renderedLang, props.node.code),
9453
+ previousRendererHtml
9454
+ );
9455
+ }
8578
9456
  });
8579
9457
  }
8580
- initRenderer();
8581
- onMounted(() => {
8582
- initRenderer();
8583
- });
8584
- onBeforeUnmount(() => {
9458
+ function safeInitRenderer() {
9459
+ return __async(this, arguments, function* (epoch = nextRenderEpoch()) {
9460
+ try {
9461
+ yield initRenderer(epoch);
9462
+ } catch (err) {
9463
+ if (!isCurrentRenderEpoch(epoch))
9464
+ return;
9465
+ if (isDevEnv2)
9466
+ console.warn("[MarkdownCodeBlockNode] Failed to initialize Shiki renderer.", err);
9467
+ renderFallback(props.node.code, !hasStableRender.value);
9468
+ }
9469
+ });
9470
+ }
9471
+ function cleanupRenderer() {
9472
+ disposed = true;
9473
+ renderEpoch += 1;
8585
9474
  renderObserver == null ? void 0 : renderObserver.disconnect();
8586
9475
  renderObserver = void 0;
8587
- });
8588
- watch(() => props.themes, () => __async(this, null, function* () {
8589
- if (registerHighlight)
8590
- registerHighlight({ themes: getResolvedThemes() });
9476
+ disconnectRendererThemeObserver();
9477
+ pendingRenderSignature = null;
9478
+ disposeCurrentRenderer({ resetStableRender: true });
9479
+ }
9480
+ renderFallback(props.node.code, true);
9481
+ if (getCurrentInstance()) {
9482
+ onMounted(() => {
9483
+ startRendererThemeObserver();
9484
+ void safeInitRenderer();
9485
+ });
9486
+ onBeforeUnmount(cleanupRenderer);
9487
+ } else {
9488
+ void nextTick(() => __async(this, null, function* () {
9489
+ yield nextTick();
9490
+ startRendererThemeObserver();
9491
+ yield safeInitRenderer();
9492
+ if (!lastCommittedRenderSignature && hasRendererContent()) {
9493
+ markRendererCommitted(
9494
+ getRenderSignature(
9495
+ rendererConfigKey != null ? rendererConfigKey : highlightRegistrationKey.value,
9496
+ normalizeRendererLanguage(props.node.language),
9497
+ props.node.code
9498
+ )
9499
+ );
9500
+ }
9501
+ }));
9502
+ }
9503
+ watch(highlightRegistrationKey, () => __async(this, null, function* () {
9504
+ yield safeInitRenderer();
8591
9505
  }));
8592
9506
  watch(() => props.loading, (loading) => {
8593
9507
  if (loading)
8594
9508
  return;
8595
- initRenderer();
9509
+ void safeInitRenderer();
8596
9510
  });
8597
9511
  watch(tooltipsEnabled, (enabled) => {
8598
9512
  if (!enabled)
8599
9513
  hideTooltip();
8600
9514
  });
8601
9515
  watch(() => [props.node.code, props.node.language], (_0) => __async(this, [_0], function* ([code, lang]) {
8602
- const normalizedLang = normalizeLanguageIdentifier(String(lang != null ? lang : ""));
9516
+ var _a2;
9517
+ const epoch = nextRenderEpoch();
9518
+ const normalizedLang = normalizeLanguageIdentifier(lang);
8603
9519
  if (normalizedLang !== codeLanguage.value)
8604
9520
  codeLanguage.value = normalizedLang;
8605
9521
  if (!codeBlockContent.value || !rendererTarget.value) {
@@ -8607,44 +9523,54 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8607
9523
  return;
8608
9524
  }
8609
9525
  if (!code) {
8610
- renderObserver == null ? void 0 : renderObserver.disconnect();
8611
- renderObserver = void 0;
8612
- rendererTarget.value.innerHTML = "";
8613
- fallbackHtml.value = "";
8614
- rendererReady.value = false;
8615
- hasStableRender.value = false;
9526
+ renderFallback("");
8616
9527
  return;
8617
9528
  }
8618
- if (!renderer) {
9529
+ if (!renderer || rendererNeedsReconfigure()) {
8619
9530
  renderFallback(code, !hasStableRender.value);
8620
- yield initRenderer();
9531
+ yield safeInitRenderer(epoch);
9532
+ return;
8621
9533
  }
8622
- if (!renderer || !code)
9534
+ if (!isCurrentRenderEpoch(epoch))
9535
+ return;
9536
+ if (!renderer)
8623
9537
  return;
8624
9538
  if (props.stream === false && props.loading)
8625
9539
  return;
8626
9540
  renderFallback(code, !hasStableRender.value);
8627
- const updated = yield updateRendererWithFallback(code, normalizedLang);
8628
- if (!updated) {
9541
+ const previousMutationVersion = rendererMutationVersion;
9542
+ const previousRendererHtml = (_a2 = rendererTarget.value) == null ? void 0 : _a2.innerHTML;
9543
+ startRendererReadyObserver(epoch, previousMutationVersion);
9544
+ const renderedLang = yield updateRendererWithFallback(code, lang, epoch);
9545
+ if (!isCurrentRenderEpoch(epoch))
9546
+ return;
9547
+ if (!renderedLang) {
9548
+ pendingRenderSignature = null;
9549
+ disconnectReadyObserver();
8629
9550
  keepLastSuccessfulRender();
8630
9551
  return;
8631
9552
  }
8632
- if (hasStableRender.value)
9553
+ if (hasStableRender.value) {
8633
9554
  keepLastSuccessfulRender();
8634
- else
8635
- yield clearFallbackWhenRendererReady();
9555
+ } else {
9556
+ yield clearFallbackWhenRendererReady(
9557
+ epoch,
9558
+ previousMutationVersion,
9559
+ getRenderSignature(rendererConfigKey != null ? rendererConfigKey : highlightRegistrationKey.value, renderedLang, code),
9560
+ previousRendererHtml
9561
+ );
9562
+ }
8636
9563
  }));
8637
- watch(
8638
- () => [props.darkTheme, props.lightTheme],
8639
- () => __async(this, null, function* () {
9564
+ function handleRendererThemeChange() {
9565
+ return __async(this, null, function* () {
8640
9566
  if (!codeBlockContent.value || !rendererTarget.value)
8641
9567
  return;
8642
9568
  if (!renderer)
8643
- yield initRenderer();
8644
- yield renderer == null ? void 0 : renderer.setTheme(getPreferredColorScheme());
9569
+ yield safeInitRenderer();
9570
+ yield syncRendererTheme();
8645
9571
  syncRenderedCssVars();
8646
- })
8647
- );
9572
+ });
9573
+ }
8648
9574
  watch(() => props.node.code, () => __async(this, null, function* () {
8649
9575
  if (isExpanded.value || !autoScrollEnabled.value)
8650
9576
  return;
@@ -8763,7 +9689,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8763
9689
  function previewCode() {
8764
9690
  if (!isPreviewable.value)
8765
9691
  return;
8766
- const lowerLang = normalizeLanguageIdentifier(String(codeLanguage.value || props.node.language)).toLowerCase();
9692
+ const lowerLang = normalizeLanguageIdentifier(codeLanguage.value || props.node.language).toLowerCase();
8767
9693
  const artifactType = lowerLang === "html" ? "text/html" : "image/svg+xml";
8768
9694
  const artifactTitle = lowerLang === "html" ? "HTML Preview" : "SVG Preview";
8769
9695
  emits("previewCode", {
@@ -8772,16 +9698,16 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8772
9698
  title: artifactTitle
8773
9699
  });
8774
9700
  }
8775
- return { __sfc: true, props, emits, t, codeLanguage, copyText, isExpanded, isCollapsed, container, codeBlockContent, rendererTarget, fallbackHtml, rendererReady, hasStableRender, renderObserver, 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, hasRendererContent, clearFallbackWhenRendererReady, renderer, createShikiRenderer, registerHighlight, registeredHighlightLanguages, warnedMissingLanguages, warnedRendererErrors, isDevEnv: isDevEnv2, normalizeRendererLanguage, updateRendererWithFallback, ensureStreamMarkdownLoaded, initRenderer, isAtBottom, handleScroll, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, increaseCodeFont, decreaseCodeFont, resetCodeFont, previewCode };
9701
+ 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 };
8776
9702
  }
8777
9703
  });
8778
- const MarkdownCodeBlockNode_vue_vue_type_style_index_0_scoped_67f44524_lang = "";
9704
+ const MarkdownCodeBlockNode_vue_vue_type_style_index_0_scoped_fbed7233_lang = "";
8779
9705
  var _sfc_render$6 = function render40() {
8780
9706
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
8781
9707
  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), {
8782
9708
  backgroundColor: "var(--vscode-editor-background, var(--markstream-code-fallback-bg))",
8783
9709
  color: "var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))"
8784
- }) }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", staticStyle: { "color": "var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))", "background-color": "var(--vscode-editor-background, var(--markstream-code-fallback-bg))" } }, [_vm._t("header-left", function() {
9710
+ }), attrs: { "data-markstream-code-theme": _setup.props.isDark ? _setup.props.darkTheme : _setup.props.lightTheme } }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", staticStyle: { "color": "var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))", "background-color": "var(--vscode-editor-background, var(--markstream-code-fallback-bg))" } }, [_vm._t("header-left", function() {
8785
9711
  return [_c("div", { staticClass: "flex items-center space-x-2 flex-1 overflow-hidden" }, [_c("span", { staticClass: "icon-slot h-4 w-4 flex-shrink-0", domProps: { "innerHTML": _vm._s(_setup.languageIcon) } }), _c("span", { staticClass: "text-sm font-medium font-mono truncate" }, [_vm._v(_vm._s(_setup.displayLanguage))])])];
8786
9712
  }), _vm._t("header-right", function() {
8787
9713
  return [_c("div", { staticClass: "flex items-center space-x-2" }, [_setup.props.showCollapseButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-pressed": _setup.isCollapsed }, on: { "click": _setup.toggleHeaderCollapse, "mouseenter": function($event) {
@@ -8821,7 +9747,7 @@ var _sfc_render$6 = function render40() {
8821
9747
  }, "focus": function($event) {
8822
9748
  _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
8823
9749
  }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { staticClass: "w-3 h-3", 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)];
8824
- })], 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 ? _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() {
9750
+ })], 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() {
8825
9751
  return [_vm._m(0)];
8826
9752
  }, { "loading": _vm.loading, "stream": _vm.stream })], 2)]);
8827
9753
  };
@@ -8836,7 +9762,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
8836
9762
  _sfc_staticRenderFns$6,
8837
9763
  false,
8838
9764
  null,
8839
- "67f44524",
9765
+ "fbed7233",
8840
9766
  null,
8841
9767
  null
8842
9768
  );
@@ -8869,10 +9795,15 @@ const _sfc_main$5 = defineComponent({
8869
9795
  codeBlockProps: Object,
8870
9796
  showTooltips: Boolean,
8871
9797
  themes: Array,
9798
+ langs: Array,
8872
9799
  isDark: Boolean,
8873
9800
  customId: [String, Number],
8874
9801
  indexKey: [String, Number],
8875
9802
  typewriter: Boolean,
9803
+ fade: {
9804
+ type: Boolean,
9805
+ default: true
9806
+ },
8876
9807
  batchRendering: Boolean,
8877
9808
  initialRenderBatchSize: Number,
8878
9809
  renderBatchSize: Number,
@@ -8936,10 +9867,12 @@ const _sfc_main$5 = defineComponent({
8936
9867
  codeBlockProps: this.codeBlockProps,
8937
9868
  showTooltips: this.showTooltips,
8938
9869
  themes: this.themes,
9870
+ langs: this.langs,
8939
9871
  isDark: this.isDark,
8940
9872
  customId: this.customId,
8941
9873
  indexKey: this.indexKey,
8942
9874
  typewriter: this.typewriter,
9875
+ fade: this.fade,
8943
9876
  batchRendering: this.batchRendering,
8944
9877
  initialRenderBatchSize: this.initialRenderBatchSize,
8945
9878
  renderBatchSize: this.renderBatchSize,
@@ -8961,6 +9894,7 @@ const _sfc_main$5 = defineComponent({
8961
9894
  customId: this.customId,
8962
9895
  indexKey: this.indexKey,
8963
9896
  typewriter: this.typewriter,
9897
+ fade: this.fade,
8964
9898
  showTooltips: this.showTooltips,
8965
9899
  codeBlockStream: this.codeBlockStream,
8966
9900
  codeBlockDarkTheme: this.codeBlockDarkTheme,
@@ -8971,6 +9905,7 @@ const _sfc_main$5 = defineComponent({
8971
9905
  codeBlockMaxWidth: this.codeBlockMaxWidth,
8972
9906
  codeBlockProps: this.codeBlockProps,
8973
9907
  themes: this.themes,
9908
+ langs: this.langs,
8974
9909
  isDark: this.isDark
8975
9910
  }
8976
9911
  }, Object.keys(listeners).length > 0 ? { on: listeners } : {}));
@@ -9978,6 +10913,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
9978
10913
  showZoomControls: { type: Boolean, default: true },
9979
10914
  enableWheelZoom: { type: Boolean, default: false },
9980
10915
  isStrict: { type: Boolean, default: true },
10916
+ enableMermaidInteractions: { type: Boolean, default: false },
9981
10917
  onRenderError: null
9982
10918
  },
9983
10919
  emits: ["copy", "export", "openModal", "toggleMode"],
@@ -10000,81 +10936,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10000
10936
  dompurifyConfig: mermaidSecurityLevel.value === "strict" ? DOMPURIFY_CONFIG : void 0,
10001
10937
  flowchart: mermaidSecurityLevel.value === "strict" ? { htmlLabels: false } : void 0
10002
10938
  }));
10003
- function neutralizeScriptProtocols(raw) {
10004
- return raw.replace(/["']\s*javascript:/gi, "#").replace(/\bjavascript:/gi, "#").replace(/["']\s*vbscript:/gi, "#").replace(/\bvbscript:/gi, "#").replace(/\bdata:text\/html/gi, "#");
10005
- }
10006
- const DISALLOWED_STYLE_PATTERNS = [/javascript:/i, /expression\s*\(/i, /url\s*\(\s*javascript:/i, /@import/i];
10007
- const SAFE_URL_PROTOCOLS = /^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;
10008
- function sanitizeUrl(value) {
10009
- if (!value)
10010
- return "";
10011
- const trimmed = value.trim();
10012
- if (SAFE_URL_PROTOCOLS.test(trimmed))
10013
- return trimmed;
10014
- return "";
10015
- }
10016
- function scrubSvgElement(svgEl) {
10017
- const forbiddenTags = /* @__PURE__ */ new Set(["script"]);
10018
- const nodes = [svgEl, ...Array.from(svgEl.querySelectorAll("*"))];
10019
- for (const node of nodes) {
10020
- if (forbiddenTags.has(node.tagName.toLowerCase())) {
10021
- node.remove();
10022
- continue;
10023
- }
10024
- const attrs = Array.from(node.attributes);
10025
- for (const attr of attrs) {
10026
- const name = attr.name;
10027
- if (/^on/i.test(name)) {
10028
- node.removeAttribute(name);
10029
- continue;
10030
- }
10031
- if (name === "style" && attr.value) {
10032
- const val = attr.value;
10033
- if (DISALLOWED_STYLE_PATTERNS.some((re) => re.test(val))) {
10034
- node.removeAttribute(name);
10035
- continue;
10036
- }
10037
- }
10038
- if ((name === "href" || name === "xlink:href") && attr.value) {
10039
- const safe = sanitizeUrl(attr.value);
10040
- if (!safe) {
10041
- node.removeAttribute(name);
10042
- continue;
10043
- }
10044
- if (safe !== attr.value)
10045
- node.setAttribute(name, safe);
10046
- }
10047
- }
10048
- }
10049
- }
10050
- function toSafeSvgElement(svg) {
10051
- if (typeof window === "undefined" || typeof DOMParser === "undefined")
10052
- return null;
10053
- if (!svg)
10054
- return null;
10055
- const neutralized = neutralizeScriptProtocols(svg);
10056
- const parsed = new DOMParser().parseFromString(neutralized, "image/svg+xml");
10057
- const svgEl = parsed.documentElement;
10058
- if (!svgEl || svgEl.nodeName.toLowerCase() !== "svg")
10059
- return null;
10060
- const svgElement = svgEl;
10061
- scrubSvgElement(svgElement);
10062
- return svgElement;
10063
- }
10064
10939
  function setSafeSvg(target, svg) {
10065
10940
  if (!target)
10066
- return "";
10067
- try {
10068
- target.replaceChildren();
10069
- } catch (e) {
10070
- target.innerHTML = "";
10071
- }
10941
+ return null;
10072
10942
  const safeElement = toSafeSvgElement(svg);
10073
10943
  if (safeElement) {
10944
+ clearElement(target);
10074
10945
  target.appendChild(safeElement);
10075
- return target.innerHTML;
10946
+ return {
10947
+ svg: target.innerHTML,
10948
+ bindTarget: target
10949
+ };
10076
10950
  }
10077
- return "";
10951
+ return null;
10078
10952
  }
10079
10953
  function clearElement(target) {
10080
10954
  if (!target)
@@ -10085,53 +10959,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10085
10959
  target.innerHTML = "";
10086
10960
  }
10087
10961
  }
10088
- function renderSvgToTarget(target, svg) {
10962
+ function renderSvgToTarget(target, svg, options = {}) {
10089
10963
  if (!target)
10090
- return "";
10091
- if (mermaidSecurityLevel.value === "strict") {
10092
- return setSafeSvg(target, svg);
10093
- }
10964
+ return null;
10965
+ const rendered = setSafeSvg(target, svg);
10966
+ if (!rendered && !options.keepPreviousOnFailure)
10967
+ clearElement(target);
10968
+ return rendered;
10969
+ }
10970
+ let lastMermaidBindFunctions = null;
10971
+ function bindMermaidInteractions(element) {
10972
+ if (!props.enableMermaidInteractions || !(element == null ? void 0 : element.querySelector("svg")))
10973
+ return;
10094
10974
  try {
10095
- target.replaceChildren();
10975
+ lastMermaidBindFunctions == null ? void 0 : lastMermaidBindFunctions(element);
10096
10976
  } catch (e) {
10097
- target.innerHTML = "";
10098
- }
10099
- if (svg) {
10100
- try {
10101
- target.insertAdjacentHTML("afterbegin", svg);
10102
- } catch (e) {
10103
- target.innerHTML = svg;
10104
- }
10105
- }
10106
- return target.innerHTML;
10107
- }
10108
- function isBrokenMermaidSvg(svg) {
10109
- if (!svg || typeof DOMParser === "undefined")
10110
- return !svg;
10111
- const parsed = new DOMParser().parseFromString(svg, "image/svg+xml");
10112
- const svgEl = parsed.documentElement;
10113
- if (!svgEl || svgEl.nodeName.toLowerCase() !== "svg")
10114
- return true;
10115
- const viewBox = svgEl.getAttribute("viewBox");
10116
- if (viewBox) {
10117
- const parts = viewBox.trim().split(/[\s,]+/);
10118
- if (parts.length === 4) {
10119
- const width = Number.parseFloat(parts[2] || "");
10120
- const height = Number.parseFloat(parts[3] || "");
10121
- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0)
10122
- return true;
10123
- }
10124
10977
  }
10125
- const nodes = [svgEl, ...Array.from(svgEl.querySelectorAll("*"))];
10126
- for (const node of nodes) {
10127
- for (const attr of Array.from(node.attributes)) {
10128
- if (/\bNaN\b/i.test(attr.value))
10129
- return true;
10130
- if (attr.name === "style" && /max-width:\s*0(?:px)?/i.test(attr.value))
10131
- return true;
10132
- }
10133
- }
10134
- return false;
10135
10978
  }
10136
10979
  const { t } = useSafeI18n();
10137
10980
  function resolveMermaidInstance() {
@@ -10656,6 +11499,29 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10656
11499
  closeModal();
10657
11500
  }
10658
11501
  }
11502
+ function mountModalClone() {
11503
+ var _a3;
11504
+ if (!mermaidContainer.value || !modalContent.value)
11505
+ return false;
11506
+ if (((_a3 = modalContent.value.firstElementChild) == null ? void 0 : _a3.getAttribute("data-mermaid-modal-clone")) === "1")
11507
+ return true;
11508
+ const clone = mermaidContainer.value.cloneNode(true);
11509
+ clone.dataset.mermaidModalClone = "1";
11510
+ clone.classList.add("fullscreen");
11511
+ clone.style.height = "100%";
11512
+ clone.style.maxHeight = "100%";
11513
+ const wrapper = clone.querySelector(
11514
+ "[data-mermaid-wrapper]"
11515
+ );
11516
+ if (wrapper) {
11517
+ modalCloneWrapper.value = wrapper;
11518
+ wrapper.style.transform = transformStyle.value.transform;
11519
+ }
11520
+ clearElement(modalContent.value);
11521
+ modalContent.value.appendChild(clone);
11522
+ bindMermaidInteractions(clone);
11523
+ return true;
11524
+ }
10659
11525
  function openModal() {
10660
11526
  isModalOpen.value = true;
10661
11527
  if (typeof document !== "undefined") {
@@ -10671,21 +11537,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10671
11537
  }
10672
11538
  }
10673
11539
  nextTick(() => {
10674
- if (mermaidContainer.value && modalContent.value) {
10675
- const clone = mermaidContainer.value.cloneNode(true);
10676
- clone.classList.add("fullscreen");
10677
- clone.style.height = "100%";
10678
- clone.style.maxHeight = "100%";
10679
- const wrapper = clone.querySelector(
10680
- "[data-mermaid-wrapper]"
10681
- );
10682
- if (wrapper) {
10683
- modalCloneWrapper.value = wrapper;
10684
- wrapper.style.transform = transformStyle.value.transform;
10685
- }
10686
- clearElement(modalContent.value);
10687
- modalContent.value.appendChild(clone);
10688
- }
11540
+ if (!mountModalClone())
11541
+ nextTick(mountModalClone);
10689
11542
  });
10690
11543
  }
10691
11544
  function closeModal() {
@@ -10707,6 +11560,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10707
11560
  }
10708
11561
  }
10709
11562
  }
11563
+ watch(modalContent, (element) => {
11564
+ if (isModalOpen.value && element)
11565
+ mountModalClone();
11566
+ });
10710
11567
  function checkContentStability() {
10711
11568
  if (!showSource.value) {
10712
11569
  return;
@@ -10948,7 +11805,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10948
11805
  }
10949
11806
  isRendering.value = true;
10950
11807
  renderQueue.value = (() => __async(this, null, function* () {
10951
- var _a3, _b2;
11808
+ var _a3, _b2, _c;
10952
11809
  try {
10953
11810
  const mermaidInstance = yield resolveMermaidInstance();
10954
11811
  if (!mermaidInstance)
@@ -10969,10 +11826,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10969
11826
  { timeoutMs: timeouts.value.fullRender }
10970
11827
  );
10971
11828
  const svg = res == null ? void 0 : res.svg;
10972
- if (isBrokenMermaidSvg(svg))
10973
- throw new Error("Mermaid produced invalid SVG during preview");
10974
11829
  if (mermaidContent.value) {
10975
11830
  const rendered = renderSvgToTarget(mermaidContent.value, svg);
11831
+ if (!rendered) {
11832
+ if (isThemeRendering.value)
11833
+ isThemeRendering.value = false;
11834
+ return false;
11835
+ }
11836
+ const bindFunctions = (_b2 = res == null ? void 0 : res.bindFunctions) != null ? _b2 : null;
11837
+ lastMermaidBindFunctions = bindFunctions;
11838
+ bindMermaidInteractions(rendered.bindTarget);
10976
11839
  if (!hasRenderedOnce.value && !isThemeRendering.value) {
10977
11840
  updateContainerHeight();
10978
11841
  hasRenderedOnce.value = true;
@@ -10985,7 +11848,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10985
11848
  }
10986
11849
  const currentTheme2 = props.isDark ? "dark" : "light";
10987
11850
  if (rendered)
10988
- svgCache.value[currentTheme2] = rendered;
11851
+ svgCache.value[currentTheme2] = { svg: rendered.svg, bindFunctions };
10989
11852
  if (isThemeRendering.value) {
10990
11853
  isThemeRendering.value = false;
10991
11854
  }
@@ -11001,7 +11864,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11001
11864
  consecutiveRenderTimeouts = nextAttempt;
11002
11865
  const backoff = Math.min(1200, 600 * nextAttempt);
11003
11866
  scheduleRenderRetry(backoff);
11004
- if (typeof import.meta !== "undefined" && ((_b2 = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false }) == null ? void 0 : _b2.DEV))
11867
+ if (typeof import.meta !== "undefined" && ((_c = { "BASE_URL": "/", "MODE": "npm", "DEV": false, "PROD": true, "SSR": false }) == null ? void 0 : _c.DEV))
11005
11868
  console.warn("[markstream-vue2] Mermaid render timed out, retry scheduled:", nextAttempt);
11006
11869
  } else {
11007
11870
  consecutiveRenderTimeouts = 0;
@@ -11022,6 +11885,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11022
11885
  }
11023
11886
  function renderPartial(code) {
11024
11887
  return __async(this, null, function* () {
11888
+ var _a3;
11025
11889
  if (!canApplyPartialPreview())
11026
11890
  return;
11027
11891
  if (!mermaidContent.value) {
@@ -11046,9 +11910,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11046
11910
  { timeoutMs: timeouts.value.render }
11047
11911
  );
11048
11912
  const svg = res == null ? void 0 : res.svg;
11049
- if (mermaidContent.value && svg && !isBrokenMermaidSvg(svg)) {
11050
- renderSvgToTarget(mermaidContent.value, svg);
11051
- updateContainerHeight();
11913
+ if (mermaidContent.value && svg) {
11914
+ const rendered = renderSvgToTarget(mermaidContent.value, svg, { keepPreviousOnFailure: true });
11915
+ if (rendered) {
11916
+ lastMermaidBindFunctions = (_a3 = res == null ? void 0 : res.bindFunctions) != null ? _a3 : null;
11917
+ bindMermaidInteractions(rendered.bindTarget);
11918
+ updateContainerHeight();
11919
+ }
11052
11920
  }
11053
11921
  } catch (e) {
11054
11922
  } finally {
@@ -11058,7 +11926,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11058
11926
  }
11059
11927
  function progressiveRender() {
11060
11928
  return __async(this, null, function* () {
11061
- var _a3, _b2;
11929
+ var _a3, _b2, _c;
11062
11930
  const scheduledAt = Date.now();
11063
11931
  const token = ++renderToken.value;
11064
11932
  if (currentWorkController) {
@@ -11108,7 +11976,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11108
11976
  return;
11109
11977
  const cached = svgCache.value[theme];
11110
11978
  if (cached && mermaidContent.value) {
11111
- renderSvgToTarget(mermaidContent.value, cached);
11979
+ const rendered = renderSvgToTarget(mermaidContent.value, cached.svg);
11980
+ if (rendered) {
11981
+ lastMermaidBindFunctions = (_c = cached.bindFunctions) != null ? _c : null;
11982
+ bindMermaidInteractions(rendered.bindTarget);
11983
+ }
11112
11984
  }
11113
11985
  });
11114
11986
  }
@@ -11244,6 +12116,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11244
12116
  }
11245
12117
  );
11246
12118
  watch(() => props.isDark, () => __async(this, null, function* () {
12119
+ var _a3;
11247
12120
  if (!hasRenderedOnce.value) {
11248
12121
  return;
11249
12122
  }
@@ -11254,7 +12127,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11254
12127
  const cachedForTheme = svgCache.value[targetTheme];
11255
12128
  if (cachedForTheme) {
11256
12129
  if (mermaidContent.value) {
11257
- renderSvgToTarget(mermaidContent.value, cachedForTheme);
12130
+ const rendered2 = renderSvgToTarget(mermaidContent.value, cachedForTheme.svg);
12131
+ if (rendered2) {
12132
+ lastMermaidBindFunctions = (_a3 = cachedForTheme.bindFunctions) != null ? _a3 : null;
12133
+ bindMermaidInteractions(rendered2.bindTarget);
12134
+ }
11258
12135
  }
11259
12136
  return;
11260
12137
  }
@@ -11287,6 +12164,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11287
12164
  watch(
11288
12165
  () => showSource.value,
11289
12166
  (newValue) => __async(this, null, function* () {
12167
+ var _a3;
11290
12168
  if (!newValue) {
11291
12169
  if (hasRenderError.value) {
11292
12170
  return;
@@ -11295,7 +12173,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11295
12173
  if (hasRenderedOnce.value && svgCache.value[currentTheme]) {
11296
12174
  yield nextTick();
11297
12175
  if (mermaidContent.value) {
11298
- renderSvgToTarget(mermaidContent.value, svgCache.value[currentTheme]);
12176
+ const cached = svgCache.value[currentTheme];
12177
+ const rendered = renderSvgToTarget(mermaidContent.value, cached.svg);
12178
+ if (rendered) {
12179
+ lastMermaidBindFunctions = (_a3 = cached.bindFunctions) != null ? _a3 : null;
12180
+ bindMermaidInteractions(rendered.bindTarget);
12181
+ }
11299
12182
  }
11300
12183
  zoom.value = savedTransformState.value.zoom;
11301
12184
  translateX.value = savedTransformState.value.translateX;
@@ -11324,6 +12207,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11324
12207
  watch(
11325
12208
  () => props.loading,
11326
12209
  (loaded, prev) => __async(this, null, function* () {
12210
+ var _a3;
11327
12211
  if (prev === true && loaded === false) {
11328
12212
  const base = baseFixedCode.value.trim();
11329
12213
  if (!base)
@@ -11333,7 +12217,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11333
12217
  if (hasRenderedOnce.value && normalizedBase === lastRenderedCode.value) {
11334
12218
  yield nextTick();
11335
12219
  if (mermaidContent.value && !mermaidContent.value.querySelector("svg") && svgCache.value[theme]) {
11336
- renderSvgToTarget(mermaidContent.value, svgCache.value[theme]);
12220
+ const cached = svgCache.value[theme];
12221
+ const rendered = renderSvgToTarget(mermaidContent.value, cached.svg);
12222
+ if (rendered) {
12223
+ lastMermaidBindFunctions = (_a3 = cached.bindFunctions) != null ? _a3 : null;
12224
+ bindMermaidInteractions(rendered.bindTarget);
12225
+ }
11337
12226
  }
11338
12227
  cleanupAfterLoadingSettled();
11339
12228
  return;
@@ -11452,10 +12341,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
11452
12341
  const computedButtonStyle = computed(() => {
11453
12342
  return props.isDark ? "mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200" : "mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700";
11454
12343
  });
11455
- return { __sfc: true, props, emits, DOMPURIFY_CONFIG, mermaidAvailable, mermaidSecurityLevel, mermaidInitConfig, neutralizeScriptProtocols, DISALLOWED_STYLE_PATTERNS, SAFE_URL_PROTOCOLS, sanitizeUrl, scrubSvgElement, toSafeSvgElement, setSafeSvg, clearElement, renderSvgToTarget, isBrokenMermaidSvg, t, resolveMermaidInstance, copyText, isCollapsed, mermaidContainer, mermaidContent, modalContent, modalCloneWrapper, registerViewport, viewportHandle, viewportReady, modeContainerRef, baseFixedCode, maxPreviewHeight, estimatedPreviewHeight, getCodeWithTheme, getMermaidDiagramKind: getMermaidDiagramKind2, zoom, translateX, translateY, isDragging, dragStart, showSource, userToggledShowSource, isRendering, renderQueue, lastContentLength, isContentGenerating, renderDebounceDelay, contentStableDelay, previewPollInitialDelay, previewPollMaxDelay, previewPollMaxAttempts, contentStableTimer, renderRetryTimer, progressiveRenderDebounceTimer, consecutiveRenderTimeouts, MAX_RENDER_TIMEOUT_RETRIES, requestIdle, canScheduleViewportWork, clearProgressiveRenderDebounceTimer, debouncedProgressiveRender, clearRenderRetryTimer, scheduleRenderRetry, containerHeight, resizeObserver, hasRenderedOnce, isThemeRendering, svgCache, lastSvgSnapshot, lastRenderedCode, renderToken, currentWorkController, hasRenderError, savedTransformState, wheelListeners, timeouts, cancelIdle, previewPollTimeoutId, previewPollIdleId, isPreviewPolling, previewPollDelay, previewPollController, lastPreviewStopAt, allowPartialPreview, previewPollAttempts, withTimeoutSignal, renderErrorToContainer, isTimeoutError, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, applyThemeTo, canApplyPartialPreview, isGanttTaskLine, getSafeGanttPreviewCandidate, getSafePrefixCandidate, canParseOnMain, canParseOffthread: canParseOffthread$1, canParseOrPrefix, isFullscreenDisabled, resolveMaxContainerHeight, updateContainerHeight, isModalOpen, transformStyle, handleKeydown, openModal, closeModal, checkContentStability, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, handleWheel, copy, exportSvg, handleExportClick, handleOpenModalClick, handleSwitchMode, switchMode, initMermaid, renderPartial, progressiveRender, stopPreviewPolling, cleanupAfterLoadingSettled, scheduleNextPreviewPoll, startPreviewPolling, computedButtonStyle, mermaidIconUrl, Portal };
12344
+ return { __sfc: true, props, emits, DOMPURIFY_CONFIG, mermaidAvailable, mermaidSecurityLevel, mermaidInitConfig, setSafeSvg, clearElement, renderSvgToTarget, lastMermaidBindFunctions, bindMermaidInteractions, t, resolveMermaidInstance, copyText, isCollapsed, mermaidContainer, mermaidContent, modalContent, modalCloneWrapper, registerViewport, viewportHandle, viewportReady, modeContainerRef, baseFixedCode, maxPreviewHeight, estimatedPreviewHeight, getCodeWithTheme, getMermaidDiagramKind: getMermaidDiagramKind2, zoom, translateX, translateY, isDragging, dragStart, showSource, userToggledShowSource, isRendering, renderQueue, lastContentLength, isContentGenerating, renderDebounceDelay, contentStableDelay, previewPollInitialDelay, previewPollMaxDelay, previewPollMaxAttempts, contentStableTimer, renderRetryTimer, progressiveRenderDebounceTimer, consecutiveRenderTimeouts, MAX_RENDER_TIMEOUT_RETRIES, requestIdle, canScheduleViewportWork, clearProgressiveRenderDebounceTimer, debouncedProgressiveRender, clearRenderRetryTimer, scheduleRenderRetry, containerHeight, resizeObserver, hasRenderedOnce, isThemeRendering, svgCache, lastSvgSnapshot, lastRenderedCode, renderToken, currentWorkController, hasRenderError, savedTransformState, wheelListeners, timeouts, cancelIdle, previewPollTimeoutId, previewPollIdleId, isPreviewPolling, previewPollDelay, previewPollController, lastPreviewStopAt, allowPartialPreview, previewPollAttempts, withTimeoutSignal, renderErrorToContainer, isTimeoutError, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, applyThemeTo, canApplyPartialPreview, isGanttTaskLine, getSafeGanttPreviewCandidate, getSafePrefixCandidate, canParseOnMain, canParseOffthread: canParseOffthread$1, canParseOrPrefix, isFullscreenDisabled, resolveMaxContainerHeight, updateContainerHeight, isModalOpen, transformStyle, handleKeydown, mountModalClone, openModal, closeModal, checkContentStability, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, handleWheel, copy, exportSvg, handleExportClick, handleOpenModalClick, handleSwitchMode, switchMode, initMermaid, renderPartial, progressiveRender, stopPreviewPolling, cleanupAfterLoadingSettled, scheduleNextPreviewPoll, startPreviewPolling, computedButtonStyle, mermaidIconUrl, Portal };
11456
12345
  }
11457
12346
  });
11458
- const MermaidBlockNode_vue_vue_type_style_index_0_scoped_44df5452_lang = "";
12347
+ const MermaidBlockNode_vue_vue_type_style_index_0_scoped_5b401883_lang = "";
11459
12348
  var _sfc_render$2 = function render43() {
11460
12349
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
11461
12350
  return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
@@ -11528,7 +12417,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
11528
12417
  _sfc_staticRenderFns$2,
11529
12418
  false,
11530
12419
  null,
11531
- "44df5452",
12420
+ "5b401883",
11532
12421
  null,
11533
12422
  null
11534
12423
  );
@@ -12382,5 +13271,6 @@ export {
12382
13271
  setMermaidWorkerClientDebug,
12383
13272
  setMermaidWorkerMaxConcurrency,
12384
13273
  terminateWorker,
13274
+ useSmoothMarkdownStream,
12385
13275
  waitForKaTeXWorkerSlot
12386
13276
  };