markstream-vue2 0.0.46 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3001,72 +3001,200 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3001
3001
  function splitLines(source) {
3002
3002
  return String(source != null ? source : "").split(/\r\n|\n|\r/);
3003
3003
  }
3004
+ function splitDiffSource(source) {
3005
+ const code = String(source != null ? source : "");
3006
+ if (!code)
3007
+ return [];
3008
+ return code.split(/\r\n|\n|\r/);
3009
+ }
3004
3010
  function isRemovedDiffLine(line) {
3005
3011
  return line.startsWith("-") && !line.startsWith("---");
3006
3012
  }
3007
3013
  function isAddedDiffLine(line) {
3008
3014
  return line.startsWith("+") && !line.startsWith("+++");
3009
3015
  }
3010
- function toDiffLine(code, kind, key, number) {
3016
+ function isExplicitDiffLanguage() {
3017
+ var _a2, _b, _c, _d;
3018
+ if (normalizedLanguage.value === "diff")
3019
+ return true;
3020
+ const firstLine = (_d = (_c = String((_b = (_a2 = props.node) == null ? void 0 : _a2.raw) != null ? _b : "").split(/\r?\n/, 1)[0]) == null ? void 0 : _c.trim()) != null ? _d : "";
3021
+ return /^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(firstLine);
3022
+ }
3023
+ function hasPatchLines(lines) {
3024
+ const hasRemoved = lines.some((line) => isRemovedDiffLine(line));
3025
+ const hasAdded = lines.some((line) => isAddedDiffLine(line));
3026
+ return hasRemoved && hasAdded || isExplicitDiffLanguage() && (hasRemoved || hasAdded);
3027
+ }
3028
+ function hasDiffSourcePair() {
3029
+ var _a2, _b;
3030
+ return ((_a2 = props.node) == null ? void 0 : _a2.originalCode) != null || ((_b = props.node) == null ? void 0 : _b.updatedCode) != null;
3031
+ }
3032
+ function shouldPreserveSourceBlankDiffKind(lines, index2) {
3033
+ return !isBlankDiffLine(lines[index2]) || index2 < lines.length - 1;
3034
+ }
3035
+ function isBlankDiffLine(code) {
3036
+ return String(code != null ? code : "").trim().length === 0;
3037
+ }
3038
+ function toDiffLine(code, kind, key, number, options = {}) {
3011
3039
  const empty = String(code != null ? code : "").trim().length === 0;
3012
3040
  return {
3013
3041
  code,
3014
- kind: empty && kind !== "hunk" ? "context" : kind,
3042
+ empty,
3043
+ kind: empty && kind !== "hunk" && !options.preserveBlankKind ? "context" : kind,
3015
3044
  key,
3016
3045
  number
3017
3046
  };
3018
3047
  }
3048
+ function computeSourceLineMatches(original, modified) {
3049
+ const n = original.length;
3050
+ const m = modified.length;
3051
+ const maxCells = 15e5;
3052
+ if ((n + 1) * (m + 1) > maxCells)
3053
+ return null;
3054
+ const cols = m + 1;
3055
+ const scores = new Uint16Array((n + 1) * (m + 1));
3056
+ for (let i2 = n - 1; i2 >= 0; i2--) {
3057
+ for (let j2 = m - 1; j2 >= 0; j2--) {
3058
+ const current = i2 * cols + j2;
3059
+ if (original[i2] === modified[j2]) {
3060
+ scores[current] = scores[(i2 + 1) * cols + j2 + 1] + 1;
3061
+ } else {
3062
+ scores[current] = Math.max(scores[(i2 + 1) * cols + j2], scores[i2 * cols + j2 + 1]);
3063
+ }
3064
+ }
3065
+ }
3066
+ const matches = [];
3067
+ let i = 0;
3068
+ let j = 0;
3069
+ while (i < n && j < m) {
3070
+ if (original[i] === modified[j]) {
3071
+ matches.push({ originalIndex: i, modifiedIndex: j });
3072
+ i++;
3073
+ j++;
3074
+ } else if (scores[(i + 1) * cols + j] >= scores[i * cols + j + 1]) {
3075
+ i++;
3076
+ } else {
3077
+ j++;
3078
+ }
3079
+ }
3080
+ return matches;
3081
+ }
3082
+ function buildInlinePatchPreviewLines(lines) {
3083
+ let modifiedLine = 1;
3084
+ return lines.map((raw, index2) => {
3085
+ if (raw.startsWith("@@"))
3086
+ return toDiffLine(raw, "hunk", `inline-hunk-${index2}`, "");
3087
+ if (isRemovedDiffLine(raw)) {
3088
+ const line = toDiffLine(raw.slice(1), "removed", `inline-removed-${index2}`, "", { preserveBlankKind: true });
3089
+ return line;
3090
+ }
3091
+ if (isAddedDiffLine(raw))
3092
+ return toDiffLine(raw.slice(1), "added", `inline-added-${index2}`, modifiedLine++, { preserveBlankKind: true });
3093
+ const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3094
+ return toDiffLine(code, "context", `inline-context-${index2}`, modifiedLine++);
3095
+ });
3096
+ }
3097
+ function buildInlineSourcePreviewLines(originalSource, modifiedSource) {
3098
+ const original = splitDiffSource(originalSource);
3099
+ const modified = splitDiffSource(modifiedSource);
3100
+ const matches = computeSourceLineMatches(original, modified);
3101
+ if (matches) {
3102
+ const result2 = [];
3103
+ let originalIndex = 0;
3104
+ let modifiedIndex = 0;
3105
+ for (const match of matches) {
3106
+ while (originalIndex < match.originalIndex) {
3107
+ result2.push(toDiffLine(original[originalIndex], "removed", `inline-removed-source-${originalIndex}`, "", {
3108
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(original, originalIndex)
3109
+ }));
3110
+ originalIndex++;
3111
+ }
3112
+ while (modifiedIndex < match.modifiedIndex) {
3113
+ result2.push(toDiffLine(modified[modifiedIndex], "added", `inline-added-source-${modifiedIndex}`, modifiedIndex + 1, {
3114
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(modified, modifiedIndex)
3115
+ }));
3116
+ modifiedIndex++;
3117
+ }
3118
+ result2.push(toDiffLine(modified[match.modifiedIndex], "context", `inline-context-source-${match.originalIndex}-${match.modifiedIndex}`, match.modifiedIndex + 1));
3119
+ originalIndex = match.originalIndex + 1;
3120
+ modifiedIndex = match.modifiedIndex + 1;
3121
+ }
3122
+ while (originalIndex < original.length) {
3123
+ result2.push(toDiffLine(original[originalIndex], "removed", `inline-removed-source-${originalIndex}`, "", {
3124
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(original, originalIndex)
3125
+ }));
3126
+ originalIndex++;
3127
+ }
3128
+ while (modifiedIndex < modified.length) {
3129
+ result2.push(toDiffLine(modified[modifiedIndex], "added", `inline-added-source-${modifiedIndex}`, modifiedIndex + 1, {
3130
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(modified, modifiedIndex)
3131
+ }));
3132
+ modifiedIndex++;
3133
+ }
3134
+ return result2;
3135
+ }
3136
+ const result = [];
3137
+ let start = 0;
3138
+ let originalEnd = original.length - 1;
3139
+ let modifiedEnd = modified.length - 1;
3140
+ while (start <= originalEnd && start <= modifiedEnd && original[start] === modified[start]) {
3141
+ result.push(toDiffLine(modified[start], "context", `inline-prefix-${start}`, start + 1));
3142
+ start++;
3143
+ }
3144
+ const suffix = [];
3145
+ while (originalEnd >= start && modifiedEnd >= start && original[originalEnd] === modified[modifiedEnd]) {
3146
+ suffix.unshift(toDiffLine(modified[modifiedEnd], "context", `inline-suffix-${modifiedEnd}`, modifiedEnd + 1));
3147
+ originalEnd--;
3148
+ modifiedEnd--;
3149
+ }
3150
+ for (let index2 = start; index2 <= originalEnd; index2++) {
3151
+ result.push(toDiffLine(original[index2], "removed", `inline-removed-source-${index2}`, "", {
3152
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(original, index2)
3153
+ }));
3154
+ }
3155
+ for (let index2 = start; index2 <= modifiedEnd; index2++) {
3156
+ result.push(toDiffLine(modified[index2], "added", `inline-added-source-${index2}`, index2 + 1, {
3157
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(modified, index2)
3158
+ }));
3159
+ }
3160
+ return result.concat(suffix);
3161
+ }
3019
3162
  function buildDiffPanes(inline = false) {
3020
- var _a2, _b, _c, _d, _e, _f, _g;
3163
+ var _a2, _b, _c, _d, _e;
3021
3164
  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);
3165
+ const hasPatchDiffLines = hasPatchLines(patchLines);
3166
+ if (!hasPatchDiffLines && hasDiffSourcePair()) {
3026
3167
  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
- }
3168
+ const lines = buildInlineSourcePreviewLines((_b = props.node) == null ? void 0 : _b.originalCode, (_c = props.node) == null ? void 0 : _c.updatedCode);
3041
3169
  return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3042
3170
  }
3171
+ const original2 = splitDiffSource((_d = props.node) == null ? void 0 : _d.originalCode);
3172
+ const modified2 = splitDiffSource((_e = props.node) == null ? void 0 : _e.updatedCode);
3043
3173
  return [
3044
3174
  {
3045
3175
  key: "original",
3046
3176
  className: "markstream-pre__diff-pane--original",
3047
- lines: original2.map((line, index2) => toDiffLine(line, modified2[index2] === line ? "context" : "removed", `original-${index2}`, index2 + 1))
3177
+ lines: original2.map((line, index2) => {
3178
+ const kind = modified2[index2] === line ? "context" : "removed";
3179
+ return toDiffLine(line, kind, `original-${index2}`, index2 + 1, {
3180
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(original2, index2)
3181
+ });
3182
+ })
3048
3183
  },
3049
3184
  {
3050
3185
  key: "modified",
3051
3186
  className: "markstream-pre__diff-pane--modified",
3052
- lines: modified2.map((line, index2) => toDiffLine(line, original2[index2] === line ? "context" : "added", `modified-${index2}`, index2 + 1))
3187
+ lines: modified2.map((line, index2) => {
3188
+ const kind = original2[index2] === line ? "context" : "added";
3189
+ return toDiffLine(line, kind, `modified-${index2}`, index2 + 1, {
3190
+ preserveBlankKind: shouldPreserveSourceBlankDiffKind(modified2, index2)
3191
+ });
3192
+ })
3053
3193
  }
3054
3194
  ];
3055
3195
  }
3056
3196
  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
- });
3197
+ const lines = buildInlinePatchPreviewLines(patchLines);
3070
3198
  return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3071
3199
  }
3072
3200
  const original = [];
@@ -3078,9 +3206,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3078
3206
  original.push(toDiffLine(raw, "hunk", `original-hunk-${index2}`, ""));
3079
3207
  modified.push(toDiffLine(raw, "hunk", `modified-hunk-${index2}`, ""));
3080
3208
  } else if (isRemovedDiffLine(raw)) {
3081
- original.push(toDiffLine(raw.slice(1), "removed", `original-removed-${index2}`, originalLine++));
3209
+ original.push(toDiffLine(raw.slice(1), "removed", `original-removed-${index2}`, originalLine++, { preserveBlankKind: true }));
3082
3210
  } else if (isAddedDiffLine(raw)) {
3083
- modified.push(toDiffLine(raw.slice(1), "added", `modified-added-${index2}`, modifiedLine++));
3211
+ modified.push(toDiffLine(raw.slice(1), "added", `modified-added-${index2}`, modifiedLine++, { preserveBlankKind: true }));
3084
3212
  } else {
3085
3213
  const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3086
3214
  original.push(toDiffLine(code, "context", `original-context-${index2}`, originalLine++));
@@ -3093,7 +3221,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3093
3221
  ];
3094
3222
  }
3095
3223
  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 };
3224
+ return { __sfc: true, props, normalizedLanguage, languageClass, isDiffPreview, isInlineDiffPreview, displayCode, ariaLabel, splitLines, splitDiffSource, isRemovedDiffLine, isAddedDiffLine, isExplicitDiffLanguage, hasPatchLines, hasDiffSourcePair, shouldPreserveSourceBlankDiffKind, isBlankDiffLine, toDiffLine, computeSourceLineMatches, buildInlinePatchPreviewLines, buildInlineSourcePreviewLines, buildDiffPanes, diffPreviewPanes };
3097
3225
  }
3098
3226
  });
3099
3227
  const PreCodeNode_vue_vue_type_style_index_0_lang = "";
@@ -3108,7 +3236,7 @@ var _sfc_render$k = function render26() {
3108
3236
  }
3109
3237
  ], 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
3238
  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))])])]);
3239
+ return _c("span", { key: line.key, staticClass: "markstream-pre__diff-line", class: [`markstream-pre__diff-line--${line.kind}`, { "markstream-pre__diff-line--empty": line.empty }] }, [_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
3240
  }), 0);
3113
3241
  }), 0) : _c("code", { attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_setup.displayCode) } })]);
3114
3242
  };
@@ -3731,13 +3859,23 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3731
3859
  customHtmlTags: null,
3732
3860
  htmlPolicy: null
3733
3861
  },
3734
- emits: ["copy", "handleArtifactClick", "click"],
3862
+ emits: ["copy", "copy-code", "handleArtifactClick", "click"],
3735
3863
  setup(__props, { emit }) {
3736
3864
  const props = __props;
3737
3865
  provide("markstreamTypewriter", computed(() => props.typewriter === true));
3738
3866
  provide("markstreamFade", computed(() => props.fade !== false));
3739
- function handleCopy(code) {
3740
- emit("copy", code);
3867
+ function isNativeDomEvent(value) {
3868
+ return typeof Event !== "undefined" && value instanceof Event;
3869
+ }
3870
+ function handleCopy(payload) {
3871
+ if (isNativeDomEvent(payload))
3872
+ return;
3873
+ if (typeof payload === "string") {
3874
+ emit("copy-code", payload);
3875
+ emit("copy", payload);
3876
+ return;
3877
+ }
3878
+ emit("copy", payload);
3741
3879
  }
3742
3880
  function handleArtifactClick(payload) {
3743
3881
  emit("handleArtifactClick", payload);
@@ -3936,7 +4074,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3936
4074
  function handleClick(event) {
3937
4075
  emit("click", event);
3938
4076
  }
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 };
4077
+ return { __sfc: true, props, emit, isNativeDomEvent, handleCopy, handleArtifactClick, nodeComponents, customComponentsMap, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getCustomCodeLanguageComponent, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleClick };
3940
4078
  }
3941
4079
  });
3942
4080
  var _sfc_render$f = function render31() {
@@ -4124,10 +4262,23 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4124
4262
  maxLiveNodes: { default: 320 },
4125
4263
  liveNodeBuffer: { default: 60 }
4126
4264
  },
4127
- emits: ["copy", "handleArtifactClick", "click", "mouseover", "mouseout"],
4265
+ emits: ["copy", "copy-code", "handleArtifactClick", "click", "mouseover", "mouseout"],
4128
4266
  setup(__props, { emit }) {
4129
4267
  var _a2, _b, _c;
4130
4268
  const props = __props;
4269
+ function isNativeDomEvent(value) {
4270
+ return typeof Event !== "undefined" && value instanceof Event;
4271
+ }
4272
+ function emitCodeCopy(payload) {
4273
+ if (isNativeDomEvent(payload))
4274
+ return;
4275
+ if (typeof payload === "string") {
4276
+ emit("copy-code", payload);
4277
+ emit("copy", payload);
4278
+ return;
4279
+ }
4280
+ emit("copy", payload);
4281
+ }
4131
4282
  const MAX_DEFERRED_NODE_COUNT = 900;
4132
4283
  const MAX_VIEWPORT_OBSERVER_TARGETS = 640;
4133
4284
  const VIEWPORT_PRIORITY_RECOVERY_COUNT = 200;
@@ -6056,35 +6207,35 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
6056
6207
  }),
6057
6208
  { flush: "post" }
6058
6209
  );
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 };
6210
+ return { __sfc: true, props, emit, isNativeDomEvent, emitCodeCopy, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, attrs, textStreamState, streamRenderVersion, smoothStream, resolvedShowTooltips, inheritedHtmlPolicy, inheritedSmoothStreaming, resolvedHtmlPolicy, smoothStreamingEligible, hasMountedForSmoothStreaming, smoothStreamingEnabled, renderContent, rawContent, smoothSourceSynced, requestedFinal, effectiveFinal, renderVersionSource, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, customComponentsMap, effectiveCustomHtmlTags, mdBase, mdInstance, cloneNodeValue, cloneParsedNodeList, mergedParseOptions, effectiveCustomHtmlTagsSet, parsedNodes, maxLiveNodesResolved, virtualizationEnabled, viewportPriorityEnabled, registerNodeVisibility, requestFrame, cancelFrame, isTestEnv, hasIdleCallback, resolvedBatchSize, resolvedInitialBatch, batchingEnabled, renderedCount, previousRenderContext, adaptiveBatchSize, nodeVisibilityState, nodeVisibilityHandles, nodeVisibilityFallbackTimers, nodeSlotElements, codeBlockRenderCache, nodeSlotVersion, sortedNodeSlots, scrollRootElement, detachScrollHandler, pendingFocusSync, liveRange, visibleNodes, deferNodes, incrementalRenderingActive, previousBatchConfig, shouldObserveSlots, liveNodeBufferResolved, focusIndex, nodeContentElements, legacyVue26, legacyNodesMode, legacyNodeItems, syncNodeRefs, resolveTemplateRef, desiredRenderedCount, resolveScrollContainer, isReverseFlexScrollRoot, getNormalizedScrollTop, getOffsetTopWithinRoot, cleanupScrollListener, setupScrollListener, cancelScheduledFocusSync, scheduleFocusSync, syncFocusToScroll, clamp, updateLiveRange, nodeHeights, heightStats, heightTreeSize, heightSumTree, heightKnownTree, resetHeightMeasurements, pruneHeightMeasurements, fenwickUpdate, fenwickQuery, fenwickRangeSum, rebuildHeightTrees, recordNodeHeight, averageNodeHeight, estimateHeightRange, topSpacerHeight, bottomSpacerHeight, estimateIndexForOffset, estimateIndexForOffsetFromEnd, cleanupNodeVisibility, markNodeVisible, shouldRenderNode, destroyNodeHandle, setNodeSlotElement, bumpNodeSlotVersion, setNodeContentRef, batchRaf, batchTimeout, batchPending, pendingIncrement, batchIdle, VIEWPORT_FALLBACK_DELAY, VIEWPORT_FALLBACK_MARGIN_PX, cancelBatchTimers, clearVisibilityFallback, scheduleVisibilityFallback, autoDisableViewportPriority, scheduleBatch, queueNextBatch, adjustAdaptiveBatchSize, 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 };
6060
6211
  }
6061
6212
  });
6062
- const NodeRenderer_vue_vue_type_style_index_0_scoped_6b8b1370_lang = "";
6213
+ const NodeRenderer_vue_vue_type_style_index_0_scoped_1dc14ae3_lang = "";
6063
6214
  const NodeRenderer_vue_vue_type_style_index_1_lang = "";
6064
6215
  var _sfc_render$d = function render33() {
6065
6216
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
6066
6217
  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
6218
  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);
6219
+ return _setup.emitCodeCopy($event);
6069
6220
  }, "handle-artifact-click": function($event) {
6070
6221
  return _setup.emit("handleArtifactClick", $event);
6071
6222
  } } }, "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);
6223
+ return _setup.emitCodeCopy($event);
6073
6224
  }, "handle-artifact-click": function($event) {
6074
6225
  return _setup.emit("handleArtifactClick", $event);
6075
6226
  } } }, "component", item.bindings, false))], 1)]);
6076
6227
  }) : _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);
6228
+ return _setup.emitCodeCopy($event);
6078
6229
  }, "handle-artifact-click": function($event) {
6079
6230
  return _setup.emit("handleArtifactClick", $event);
6080
6231
  } } }) : [_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
6232
  var _a2;
6082
6233
  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);
6234
+ return _setup.emitCodeCopy($event);
6084
6235
  }, "handle-artifact-click": function($event) {
6085
6236
  return _setup.emit("handleArtifactClick", $event);
6086
6237
  } } }, "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);
6238
+ return _setup.emitCodeCopy($event);
6088
6239
  }, "handle-artifact-click": function($event) {
6089
6240
  return _setup.emit("handleArtifactClick", $event);
6090
6241
  } } }, "component", item.bindings, false))], 1) : _c("div", { staticClass: "node-placeholder", style: { height: `${(_a2 = _setup.nodeHeights[item.index]) != null ? _a2 : _setup.averageNodeHeight}px` } })]);
@@ -6097,7 +6248,7 @@ var __component__$d = /* @__PURE__ */ normalizeComponent(
6097
6248
  _sfc_staticRenderFns$d,
6098
6249
  false,
6099
6250
  null,
6100
- "6b8b1370",
6251
+ "1dc14ae3",
6101
6252
  null,
6102
6253
  null
6103
6254
  );
@@ -10507,8 +10658,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
10507
10658
  if (isUnmounted)
10508
10659
  return;
10509
10660
  if (!props.node.content) {
10510
- applyRawFallback();
10511
- hasRenderedOnce = true;
10661
+ renderedHtml.value = "";
10662
+ fallbackText.value = props.node.loading ? "" : props.node.raw;
10663
+ renderingLoading.value = !!props.node.loading;
10664
+ hasRenderedOnce = !props.node.loading;
10512
10665
  return;
10513
10666
  }
10514
10667
  const cached = getCachedMathRender(cacheKey.value);
@@ -10583,7 +10736,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
10583
10736
  return { __sfc: true, props, containerEl, registerVisibility, visibilityHandle, currentRenderId, isUnmounted, currentAbortController, displayMode, mathContent, cacheKey, initialCached, renderedHtml, fallbackText, renderingLoading, hasRenderedOnce, renderWithMainThreadFallback, applySuccessfulRender, applyRawFallback, renderMath };
10584
10737
  }
10585
10738
  });
10586
- const MathInlineNode_vue_vue_type_style_index_0_scoped_d2f0cfa6_lang = "";
10739
+ const MathInlineNode_vue_vue_type_style_index_0_scoped_6e33b527_lang = "";
10587
10740
  var _sfc_render$3 = function render42() {
10588
10741
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
10589
10742
  return _c("span", { ref: "containerEl", staticClass: "math-inline-wrapper" }, [_setup.renderedHtml ? _c("span", { staticClass: "math-inline", domProps: { "innerHTML": _vm._s(_setup.renderedHtml) } }) : _setup.fallbackText ? _c("span", { staticClass: "math-inline math-inline--fallback" }, [_vm._v(_vm._s(_setup.fallbackText))]) : _vm._e(), _setup.renderingLoading && !_setup.renderedHtml && !_setup.fallbackText ? _c("span", { staticClass: "math-inline__loading", attrs: { "role": "status", "aria-live": "polite" } }, [_vm._t("loading", function() {
@@ -10597,7 +10750,7 @@ var __component__$3 = /* @__PURE__ */ normalizeComponent(
10597
10750
  _sfc_staticRenderFns$3,
10598
10751
  false,
10599
10752
  null,
10600
- "d2f0cfa6",
10753
+ "6e33b527",
10601
10754
  null,
10602
10755
  null
10603
10756
  );