stream-monaco 0.0.19 → 0.0.21

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.
@@ -1,9 +1,32 @@
1
- import { __export, __reExport } from "./chunk-CHLpw0oG.js";
2
1
  import * as _monaco from "monaco-editor/esm/vs/editor/editor.api";
3
2
  import { computed } from "alien-signals";
4
3
  import { shikiToMonaco } from "@shikijs/monaco";
5
4
  import { createHighlighter } from "shiki";
6
5
 
6
+ //#region rolldown:runtime
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __export = (target, all) => {
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
28
+
29
+ //#endregion
7
30
  //#region src/code.detect.ts
8
31
  /**
9
32
  * Language detection definitions
@@ -448,9 +471,20 @@ function createScrollWatcherForEditor(ed, opts) {
448
471
  //#region src/core/DiffEditorManager.ts
449
472
  var DiffEditorManager = class DiffEditorManager {
450
473
  static diffUiStyleId = "stream-monaco-diff-ui-style";
474
+ static diffLineStyleClasses = ["stream-monaco-diff-style-background", "stream-monaco-diff-style-bar"];
475
+ static diffUnchangedRegionStyleClasses = [
476
+ "stream-monaco-diff-unchanged-style-line-info",
477
+ "stream-monaco-diff-unchanged-style-line-info-basic",
478
+ "stream-monaco-diff-unchanged-style-metadata",
479
+ "stream-monaco-diff-unchanged-style-simple"
480
+ ];
481
+ static diffLayoutModeClasses = ["stream-monaco-diff-inline", "stream-monaco-diff-side-by-side"];
482
+ static diffAppearanceClasses = ["stream-monaco-diff-appearance-light", "stream-monaco-diff-appearance-dark"];
451
483
  diffEditorView = null;
452
484
  originalModel = null;
453
485
  modifiedModel = null;
486
+ originalModelOwned = false;
487
+ modifiedModelOwned = false;
454
488
  lastContainer = null;
455
489
  lastKnownOriginalCode = null;
456
490
  lastKnownModifiedCode = null;
@@ -508,15 +542,82 @@ var DiffEditorManager = class DiffEditorManager {
508
542
  diffHunkUpperNode = null;
509
543
  diffHunkLowerNode = null;
510
544
  diffHunkActiveChange = null;
545
+ diffHunkActiveHoverSide = null;
511
546
  diffHunkLineChanges = [];
512
547
  diffHunkFallbackLineChanges = [];
513
548
  diffHunkFallbackVersions = null;
549
+ diffHunkActionInFlight = false;
550
+ diffComputedVersions = null;
551
+ preserveNativeDiffDecorationsOnStaleAppend = false;
552
+ diffPresentationDisposables = [];
553
+ fallbackOriginalDecorationIds = [];
554
+ fallbackModifiedDecorationIds = [];
514
555
  diffHunkHideTimer = null;
515
556
  diffUnchangedRegionDisposables = [];
516
557
  diffUnchangedRegionObserver = null;
517
558
  diffUnchangedBridgeOverlay = null;
518
- diffUnchangedBridgeDisposables = [];
559
+ diffUnchangedBridgeEntries = /* @__PURE__ */ new Map();
560
+ diffUnchangedBridgePool = [];
561
+ diffUnchangedNodeIds = /* @__PURE__ */ new WeakMap();
562
+ diffUnchangedNodeIdSequence = 0;
563
+ diffUnchangedOverlayScrollTop = 0;
564
+ diffUnchangedOverlayScrollLeft = 0;
565
+ diffRootAppearanceSignature = null;
519
566
  diffPersistedUnchangedModelState = null;
567
+ pendingPreparedDiffViewModel = null;
568
+ cancelRafs() {
569
+ this.rafScheduler.cancel("sync-diff-presentation");
570
+ this.rafScheduler.cancel("capture-diff-unchanged-state");
571
+ this.rafScheduler.cancel("restore-diff-unchanged-state");
572
+ this.rafScheduler.cancel("patch-diff-unchanged-regions");
573
+ this.rafScheduler.cancel("maybe-scroll-diff");
574
+ this.rafScheduler.cancel("revealDiff");
575
+ this.rafScheduler.cancel("immediate-reveal-diff");
576
+ this.rafScheduler.cancel("maybe-resume-diff");
577
+ this.rafScheduler.cancel("content-size-change-diff");
578
+ this.rafScheduler.cancel("sync-last-known-modified");
579
+ this.rafScheduler.cancel("diff");
580
+ this.rafScheduler.cancel("appendDiff");
581
+ }
582
+ clearRevealTimers() {
583
+ if (this.revealDebounceIdDiff != null) {
584
+ clearTimeout(this.revealDebounceIdDiff);
585
+ this.revealDebounceIdDiff = null;
586
+ }
587
+ if (this.revealIdleTimerIdDiff != null) {
588
+ clearTimeout(this.revealIdleTimerIdDiff);
589
+ this.revealIdleTimerIdDiff = null;
590
+ }
591
+ }
592
+ resetAppendState() {
593
+ this.appendBufferDiffScheduled = false;
594
+ this.appendBufferOriginalDiff.length = 0;
595
+ this.appendBufferModifiedDiff.length = 0;
596
+ if (this.appendFlushThrottleTimerDiff != null) {
597
+ clearTimeout(this.appendFlushThrottleTimerDiff);
598
+ this.appendFlushThrottleTimerDiff = null;
599
+ }
600
+ }
601
+ clearAsyncWork() {
602
+ this.cancelRafs();
603
+ this.pendingDiffUpdate = null;
604
+ this.lastKnownModifiedDirty = false;
605
+ this.resetAppendState();
606
+ this.clearRevealTimers();
607
+ if (this.diffScrollWatcherSuppressionTimer != null) {
608
+ clearTimeout(this.diffScrollWatcherSuppressionTimer);
609
+ this.diffScrollWatcherSuppressionTimer = null;
610
+ }
611
+ this.cancelScheduledHideDiffHunkActions();
612
+ this.clearPendingDiffThemeSync();
613
+ }
614
+ diffModelTransitionRequestId = 0;
615
+ pendingDiffScrollRestorePosition = null;
616
+ pendingDiffScrollRestoreBudget = 0;
617
+ diffHideUnchangedRegionsResolved = null;
618
+ diffHideUnchangedRegionsDeferred = false;
619
+ diffHideUnchangedRegionsIdleTimer = null;
620
+ diffThemeSyncRafId = null;
520
621
  constructor(options, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, diffAutoScroll, revealDebounceMsOption, diffUpdateThrottleMsOption) {
521
622
  this.options = options;
522
623
  this.maxHeightValue = maxHeightValue;
@@ -549,15 +650,212 @@ var DiffEditorManager = class DiffEditorManager {
549
650
  enabled: true,
550
651
  contextLineCount: 3,
551
652
  minimumLineCount: 3,
552
- revealLineCount: 3
653
+ revealLineCount: 5
654
+ };
655
+ }
656
+ resolveDiffLineStyleOption() {
657
+ return this.options.diffLineStyle === "bar" ? "bar" : "background";
658
+ }
659
+ resolveDiffUnchangedRegionStyleOption() {
660
+ if (this.options.diffUnchangedRegionStyle === "simple") return "simple";
661
+ if (this.options.diffUnchangedRegionStyle === "line-info-basic") return "line-info-basic";
662
+ return this.options.diffUnchangedRegionStyle === "metadata" ? "metadata" : "line-info";
663
+ }
664
+ resolveDiffStreamingThrottleMs() {
665
+ const explicitThrottle = this.diffUpdateThrottleMsOption ?? this.options.diffUpdateThrottleMs;
666
+ if (typeof explicitThrottle === "number") return explicitThrottle;
667
+ return 50;
668
+ }
669
+ parseCssColorRgb(color) {
670
+ const normalized = color.trim().toLowerCase();
671
+ const rgbMatch = normalized.match(/^rgba?\(\s*([+\-.\d]+)\s*,\s*([+\-.\d]+)\s*,\s*([+\-.\d]+)/);
672
+ if (rgbMatch) return [
673
+ Number.parseFloat(rgbMatch[1]),
674
+ Number.parseFloat(rgbMatch[2]),
675
+ Number.parseFloat(rgbMatch[3])
676
+ ];
677
+ const hexMatch = normalized.match(/^#([\da-f]{3,8})$/i);
678
+ if (!hexMatch) return null;
679
+ const hex = hexMatch[1];
680
+ if (hex.length === 3 || hex.length === 4) return [
681
+ Number.parseInt(`${hex[0]}${hex[0]}`, 16),
682
+ Number.parseInt(`${hex[1]}${hex[1]}`, 16),
683
+ Number.parseInt(`${hex[2]}${hex[2]}`, 16)
684
+ ];
685
+ if (hex.length === 6 || hex.length === 8) return [
686
+ Number.parseInt(hex.slice(0, 2), 16),
687
+ Number.parseInt(hex.slice(2, 4), 16),
688
+ Number.parseInt(hex.slice(4, 6), 16)
689
+ ];
690
+ return null;
691
+ }
692
+ resolveCssColorLuminance(color) {
693
+ const rgb = this.parseCssColorRgb(color);
694
+ if (!rgb) return null;
695
+ const channel = (value) => {
696
+ const normalized = Math.max(0, Math.min(255, value)) / 255;
697
+ return normalized <= .03928 ? normalized / 12.92 : ((normalized + .055) / 1.055) ** 2.4;
698
+ };
699
+ const [r, g, b] = rgb;
700
+ return .2126 * channel(r) + .7152 * channel(g) + .0722 * channel(b);
701
+ }
702
+ resolveDiffUnchangedLineInfoRailMetrics(node) {
703
+ const editorRoot = node.closest(".monaco-editor");
704
+ if (!editorRoot) return {
705
+ leftInset: 0,
706
+ width: null
707
+ };
708
+ const editorRect = editorRoot.getBoundingClientRect();
709
+ const lineNumberNode = Array.from(editorRoot.querySelectorAll(".line-numbers")).find((candidate) => {
710
+ const rect = candidate.getBoundingClientRect();
711
+ return rect.width > 0 && rect.height > 0;
712
+ });
713
+ if (!lineNumberNode) return {
714
+ leftInset: 0,
715
+ width: null
716
+ };
717
+ const lineNumberRect = lineNumberNode.getBoundingClientRect();
718
+ return {
719
+ leftInset: Math.max(0, lineNumberRect.left - editorRect.left),
720
+ width: Math.max(0, lineNumberRect.width) || null
553
721
  };
554
722
  }
723
+ looksLikeDarkThemeName(themeName) {
724
+ if (!themeName) return false;
725
+ const normalized = themeName.toLowerCase();
726
+ return [
727
+ "dark",
728
+ "night",
729
+ "moon",
730
+ "black",
731
+ "dracula",
732
+ "mocha",
733
+ "frappe",
734
+ "macchiato",
735
+ "palenight",
736
+ "ocean",
737
+ "poimandres",
738
+ "monokai",
739
+ "laserwave",
740
+ "tokyo",
741
+ "slack-dark",
742
+ "rose-pine",
743
+ "github-dark",
744
+ "material-theme",
745
+ "one-dark",
746
+ "catppuccin-mocha",
747
+ "catppuccin-frappe",
748
+ "catppuccin-macchiato"
749
+ ].some((token) => normalized.includes(token)) && !normalized.includes("light") && !normalized.includes("latte") && !normalized.includes("dawn") && !normalized.includes("lotus");
750
+ }
751
+ looksLikeLightThemeName(themeName) {
752
+ if (!themeName) return false;
753
+ const normalized = themeName.toLowerCase();
754
+ return [
755
+ "light",
756
+ "day",
757
+ "dawn",
758
+ "latte",
759
+ "solarized-light",
760
+ "github-light",
761
+ "rose-pine-dawn",
762
+ "catppuccin-latte",
763
+ "one-light",
764
+ "vitesse-light",
765
+ "snazzy-light",
766
+ "material-lighter",
767
+ "material-theme-lighter",
768
+ "lotus"
769
+ ].some((token) => normalized.includes(token));
770
+ }
771
+ resolveDiffAppearanceOption() {
772
+ var _this$diffEditorView, _this$diffEditorView$, _this$diffEditorView$2, _this$diffEditorView2, _this$diffEditorView3, _this$diffEditorView4;
773
+ if (this.options.diffAppearance === "light") return "light";
774
+ if (this.options.diffAppearance === "dark") return "dark";
775
+ if (this.looksLikeDarkThemeName(this.options.theme)) return "dark";
776
+ if (this.looksLikeLightThemeName(this.options.theme)) return "light";
777
+ const appearanceProbeNodes = [
778
+ (_this$diffEditorView = this.diffEditorView) === null || _this$diffEditorView === void 0 || (_this$diffEditorView$2 = (_this$diffEditorView$ = _this$diffEditorView.getModifiedEditor()).getContainerDomNode) === null || _this$diffEditorView$2 === void 0 ? void 0 : _this$diffEditorView$2.call(_this$diffEditorView$),
779
+ (_this$diffEditorView2 = this.diffEditorView) === null || _this$diffEditorView2 === void 0 || (_this$diffEditorView4 = (_this$diffEditorView3 = _this$diffEditorView2.getOriginalEditor()).getContainerDomNode) === null || _this$diffEditorView4 === void 0 ? void 0 : _this$diffEditorView4.call(_this$diffEditorView3),
780
+ this.lastContainer
781
+ ];
782
+ for (const node of appearanceProbeNodes) {
783
+ if (!(node instanceof HTMLElement)) continue;
784
+ const style = globalThis.getComputedStyle(node);
785
+ const editorSurface = node.querySelector(".monaco-editor .monaco-editor-background, .monaco-editor .margin, .monaco-editor .lines-content");
786
+ const candidates = [
787
+ style.getPropertyValue("--stream-monaco-editor-bg"),
788
+ style.getPropertyValue("--vscode-editor-background"),
789
+ editorSurface ? globalThis.getComputedStyle(editorSurface).backgroundColor : "",
790
+ style.backgroundColor
791
+ ];
792
+ for (const color of candidates) {
793
+ const luminance = this.resolveCssColorLuminance(color);
794
+ if (luminance == null) continue;
795
+ return luminance <= .42 ? "dark" : "light";
796
+ }
797
+ }
798
+ return this.looksLikeDarkThemeName(this.options.theme) ? "dark" : "light";
799
+ }
800
+ syncDiffRootThemeVariables(appearance) {
801
+ var _this$diffEditorView5, _this$diffEditorView6, _this$diffEditorView7, _this$diffEditorView8, _this$diffEditorView9, _this$diffEditorView10;
802
+ if (!(this.lastContainer instanceof HTMLElement)) return;
803
+ const probeNodes = [
804
+ (_this$diffEditorView5 = this.diffEditorView) === null || _this$diffEditorView5 === void 0 || (_this$diffEditorView7 = (_this$diffEditorView6 = _this$diffEditorView5.getModifiedEditor()).getContainerDomNode) === null || _this$diffEditorView7 === void 0 ? void 0 : _this$diffEditorView7.call(_this$diffEditorView6),
805
+ (_this$diffEditorView8 = this.diffEditorView) === null || _this$diffEditorView8 === void 0 || (_this$diffEditorView10 = (_this$diffEditorView9 = _this$diffEditorView8.getOriginalEditor()).getContainerDomNode) === null || _this$diffEditorView10 === void 0 ? void 0 : _this$diffEditorView10.call(_this$diffEditorView9),
806
+ this.lastContainer
807
+ ];
808
+ const containerStyle = globalThis.getComputedStyle(this.lastContainer);
809
+ const fixedBackgroundColor = containerStyle.getPropertyValue("--stream-monaco-fixed-editor-bg").trim() || null;
810
+ let backgroundColor = null;
811
+ let foregroundColor = null;
812
+ for (const node of probeNodes) {
813
+ if (!(node instanceof HTMLElement)) continue;
814
+ const backgroundProbe = node.querySelector(".monaco-editor-background, .margin, .lines-content") ?? node;
815
+ const foregroundProbe = node.querySelector(".view-lines, .monaco-editor, .view-overlays") ?? node;
816
+ const nextBackground = globalThis.getComputedStyle(backgroundProbe).backgroundColor;
817
+ if (!backgroundColor && this.resolveCssColorLuminance(nextBackground) != null) backgroundColor = nextBackground;
818
+ const nextForeground = globalThis.getComputedStyle(foregroundProbe).color;
819
+ if (!foregroundColor && this.resolveCssColorLuminance(nextForeground) != null) foregroundColor = nextForeground;
820
+ if (backgroundColor && foregroundColor) break;
821
+ }
822
+ const resolvedBackgroundColor = fixedBackgroundColor || backgroundColor || (appearance === "dark" ? "rgb(10 10 11)" : "rgb(255 255 255)");
823
+ if (resolvedBackgroundColor) this.lastContainer.style.setProperty("--stream-monaco-editor-bg", resolvedBackgroundColor);
824
+ else this.lastContainer.style.removeProperty("--stream-monaco-editor-bg");
825
+ if (foregroundColor) this.lastContainer.style.setProperty("--stream-monaco-editor-fg", foregroundColor);
826
+ else this.lastContainer.style.removeProperty("--stream-monaco-editor-fg");
827
+ }
828
+ applyDiffRootAppearanceClass() {
829
+ if (!this.lastContainer) return;
830
+ const resolvedAppearance = this.resolveDiffAppearanceOption();
831
+ this.syncDiffRootThemeVariables(resolvedAppearance);
832
+ const containerClassList = this.lastContainer.classList;
833
+ const activeLineStyleClass = `stream-monaco-diff-style-${this.resolveDiffLineStyleOption()}`;
834
+ const activeUnchangedRegionStyleClass = `stream-monaco-diff-unchanged-style-${this.resolveDiffUnchangedRegionStyleOption()}`;
835
+ const sideBySide = !this.isDiffInlineMode();
836
+ const activeLayoutModeClass = sideBySide ? "stream-monaco-diff-side-by-side" : "stream-monaco-diff-inline";
837
+ const activeAppearanceClass = `stream-monaco-diff-appearance-${resolvedAppearance}`;
838
+ const nextSignature = [
839
+ activeLineStyleClass,
840
+ activeUnchangedRegionStyleClass,
841
+ activeLayoutModeClass,
842
+ activeAppearanceClass
843
+ ].join("|");
844
+ if (this.diffRootAppearanceSignature === nextSignature && containerClassList.contains("stream-monaco-diff-root")) return;
845
+ containerClassList.add("stream-monaco-diff-root");
846
+ for (const className of DiffEditorManager.diffLineStyleClasses) containerClassList.toggle(className, className === activeLineStyleClass);
847
+ for (const className of DiffEditorManager.diffUnchangedRegionStyleClasses) containerClassList.toggle(className, className === activeUnchangedRegionStyleClass);
848
+ for (const className of DiffEditorManager.diffLayoutModeClasses) containerClassList.toggle(className, className === activeLayoutModeClass);
849
+ for (const className of DiffEditorManager.diffAppearanceClasses) containerClassList.toggle(className, className === activeAppearanceClass);
850
+ this.diffRootAppearanceSignature = nextSignature;
851
+ }
555
852
  disposeDiffHunkInteractions() {
556
853
  if (this.diffHunkHideTimer != null) {
557
854
  clearTimeout(this.diffHunkHideTimer);
558
855
  this.diffHunkHideTimer = null;
559
856
  }
560
857
  this.diffHunkActiveChange = null;
858
+ this.diffHunkActiveHoverSide = null;
561
859
  this.diffHunkLineChanges = [];
562
860
  this.diffHunkFallbackLineChanges = [];
563
861
  this.diffHunkFallbackVersions = null;
@@ -645,7 +943,7 @@ var DiffEditorManager = class DiffEditorManager {
645
943
  getEffectiveLineChanges() {
646
944
  if (!this.diffEditorView) return [];
647
945
  const nativeLineChanges = this.diffEditorView.getLineChanges();
648
- if (nativeLineChanges) {
946
+ if (nativeLineChanges && this.hasFreshNativeDiffResult()) {
649
947
  this.diffHunkFallbackLineChanges = [];
650
948
  this.diffHunkFallbackVersions = null;
651
949
  return nativeLineChanges;
@@ -660,6 +958,72 @@ var DiffEditorManager = class DiffEditorManager {
660
958
  this.diffHunkFallbackVersions = versions;
661
959
  return this.diffHunkFallbackLineChanges;
662
960
  }
961
+ captureCurrentDiffVersions() {
962
+ if (!this.originalModel || !this.modifiedModel) return null;
963
+ return {
964
+ original: this.originalModel.getAlternativeVersionId(),
965
+ modified: this.modifiedModel.getAlternativeVersionId()
966
+ };
967
+ }
968
+ hasFreshNativeDiffResult() {
969
+ const versions = this.captureCurrentDiffVersions();
970
+ return !!(versions && this.diffComputedVersions && versions.original === this.diffComputedVersions.original && versions.modified === this.diffComputedVersions.modified);
971
+ }
972
+ scheduleSyncDiffPresentationDecorations() {
973
+ this.rafScheduler.schedule("sync-diff-presentation", () => {
974
+ this.syncDiffPresentationDecorations();
975
+ });
976
+ }
977
+ clearFallbackDiffDecorations() {
978
+ var _this$diffEditorView11, _this$diffEditorView12;
979
+ const originalEditor = (_this$diffEditorView11 = this.diffEditorView) === null || _this$diffEditorView11 === void 0 ? void 0 : _this$diffEditorView11.getOriginalEditor();
980
+ const modifiedEditor = (_this$diffEditorView12 = this.diffEditorView) === null || _this$diffEditorView12 === void 0 ? void 0 : _this$diffEditorView12.getModifiedEditor();
981
+ if (originalEditor && this.fallbackOriginalDecorationIds.length > 0) this.fallbackOriginalDecorationIds = originalEditor.deltaDecorations(this.fallbackOriginalDecorationIds, []);
982
+ else this.fallbackOriginalDecorationIds = [];
983
+ if (modifiedEditor && this.fallbackModifiedDecorationIds.length > 0) this.fallbackModifiedDecorationIds = modifiedEditor.deltaDecorations(this.fallbackModifiedDecorationIds, []);
984
+ else this.fallbackModifiedDecorationIds = [];
985
+ }
986
+ toWholeLineDecoration(side, startLineNumber, endLineNumber) {
987
+ if (endLineNumber < startLineNumber || startLineNumber < 1) return null;
988
+ const removed = side === "original";
989
+ return {
990
+ range: new monaco_shim_exports.Range(startLineNumber, 1, endLineNumber, 1),
991
+ options: {
992
+ isWholeLine: true,
993
+ className: removed ? "stream-monaco-fallback-line-delete" : "stream-monaco-fallback-line-insert",
994
+ marginClassName: removed ? "stream-monaco-fallback-gutter-delete" : "stream-monaco-fallback-gutter-insert",
995
+ linesDecorationsClassName: removed ? "stream-monaco-fallback-lines-delete" : "stream-monaco-fallback-lines-insert",
996
+ lineNumberClassName: removed ? "stream-monaco-fallback-line-number-delete" : "stream-monaco-fallback-line-number-insert",
997
+ zIndex: 5
998
+ }
999
+ };
1000
+ }
1001
+ syncDiffPresentationDecorations() {
1002
+ var _this$diffEditorView$3, _this$lastContainer$q, _this$lastContainer;
1003
+ if (!this.diffEditorView || !this.lastContainer) return;
1004
+ const nativeFresh = this.hasFreshNativeDiffResult();
1005
+ const keepNativeDecorationsWhileStale = !nativeFresh && this.preserveNativeDiffDecorationsOnStaleAppend && ((((_this$diffEditorView$3 = this.diffEditorView.getLineChanges()) === null || _this$diffEditorView$3 === void 0 ? void 0 : _this$diffEditorView$3.length) ?? 0) > 0 || !!((_this$lastContainer$q = (_this$lastContainer = this.lastContainer).querySelector) === null || _this$lastContainer$q === void 0 ? void 0 : _this$lastContainer$q.call(_this$lastContainer, ".line-insert, .line-delete, .gutter-insert, .gutter-delete")));
1006
+ this.lastContainer.classList.toggle("stream-monaco-diff-native-stale", !nativeFresh && !keepNativeDecorationsWhileStale);
1007
+ if (nativeFresh) {
1008
+ this.clearFallbackDiffDecorations();
1009
+ return;
1010
+ }
1011
+ const originalEditor = this.diffEditorView.getOriginalEditor();
1012
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
1013
+ const lineChanges = this.getEffectiveLineChanges();
1014
+ const originalDecorations = lineChanges.map((change) => this.toWholeLineDecoration("original", change.originalStartLineNumber, change.originalEndLineNumber)).filter(Boolean);
1015
+ const modifiedDecorations = lineChanges.map((change) => this.toWholeLineDecoration("modified", change.modifiedStartLineNumber, change.modifiedEndLineNumber)).filter(Boolean);
1016
+ this.fallbackOriginalDecorationIds = originalEditor.deltaDecorations(this.fallbackOriginalDecorationIds, originalDecorations);
1017
+ this.fallbackModifiedDecorationIds = modifiedEditor.deltaDecorations(this.fallbackModifiedDecorationIds, modifiedDecorations);
1018
+ }
1019
+ disposeDiffPresentationTracking() {
1020
+ this.clearFallbackDiffDecorations();
1021
+ if (this.lastContainer) this.lastContainer.classList.remove("stream-monaco-diff-native-stale");
1022
+ this.diffComputedVersions = null;
1023
+ this.diffPresentationDisposables.forEach((disposable) => disposable.dispose());
1024
+ this.diffPresentationDisposables = [];
1025
+ this.rafScheduler.cancel("sync-diff-presentation");
1026
+ }
663
1027
  ensureDiffUiStyle() {
664
1028
  if (typeof document === "undefined") return;
665
1029
  if (document.getElementById(DiffEditorManager.diffUiStyleId)) return;
@@ -667,30 +1031,549 @@ var DiffEditorManager = class DiffEditorManager {
667
1031
  style.id = DiffEditorManager.diffUiStyleId;
668
1032
  style.textContent = `
669
1033
  .stream-monaco-diff-root {
670
- --stream-monaco-unchanged-fg: var(--vscode-diffEditor-unchangedRegionForeground, var(--vscode-editor-foreground, currentColor));
671
- --stream-monaco-unchanged-bg: var(--vscode-diffEditor-unchangedRegionBackground, transparent);
1034
+ --stream-monaco-editor-fg: var(--vscode-editor-foreground, #111827);
672
1035
  --stream-monaco-editor-bg: var(--vscode-editor-background, #fff);
673
- --stream-monaco-widget-shadow: var(--vscode-widget-shadow, rgb(0 0 0 / 30%));
674
- --stream-monaco-focus: var(--vscode-focusBorder, var(--stream-monaco-unchanged-fg));
675
- --stream-monaco-surface: color-mix(in srgb, var(--stream-monaco-unchanged-bg) 82%, var(--stream-monaco-editor-bg) 18%);
676
- --stream-monaco-surface-hover: color-mix(in srgb, var(--stream-monaco-unchanged-bg) 72%, var(--stream-monaco-editor-bg) 28%);
1036
+ --stream-monaco-unchanged-fg: var(--vscode-diffEditor-unchangedRegionForeground, var(--stream-monaco-editor-fg));
1037
+ --stream-monaco-unchanged-bg: var(--vscode-diffEditor-unchangedRegionBackground, transparent);
1038
+ --stream-monaco-gutter-marker-width: 4px;
1039
+ --stream-monaco-gutter-gap: 16px;
1040
+ --stream-monaco-widget-shadow: var(--vscode-widget-shadow, rgb(15 23 42 / 26%));
1041
+ --stream-monaco-focus: var(--vscode-focusBorder, color-mix(in srgb, var(--stream-monaco-editor-fg) 56%, transparent));
1042
+ --stream-monaco-frame-radius: 20px;
1043
+ --stream-monaco-frame-border: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1044
+ --stream-monaco-frame-shadow: 0 28px 60px -46px var(--stream-monaco-widget-shadow);
1045
+ --stream-monaco-panel-border: color-mix(in srgb, var(--stream-monaco-editor-fg) 9%, transparent);
1046
+ --stream-monaco-pane-divider: var(--stream-monaco-panel-border);
1047
+ --stream-monaco-line-number: color-mix(in srgb, var(--stream-monaco-editor-fg) 34%, transparent);
1048
+ --stream-monaco-line-number-active: color-mix(in srgb, var(--stream-monaco-editor-fg) 46%, transparent);
1049
+ --stream-monaco-line-number-left: calc(
1050
+ var(--stream-monaco-gutter-marker-width) + var(--stream-monaco-gutter-gap)
1051
+ );
1052
+ --stream-monaco-line-number-width: 36px;
1053
+ --stream-monaco-line-number-align: center;
1054
+ --stream-monaco-original-margin-width: calc(
1055
+ var(--stream-monaco-line-number-left) +
1056
+ var(--stream-monaco-line-number-width)
1057
+ );
1058
+ --stream-monaco-original-scrollable-left: var(
1059
+ --stream-monaco-original-margin-width
1060
+ );
1061
+ --stream-monaco-original-scrollable-width: calc(
1062
+ 100% - var(--stream-monaco-original-margin-width)
1063
+ );
1064
+ --stream-monaco-modified-margin-width: calc(
1065
+ var(--stream-monaco-line-number-left) +
1066
+ var(--stream-monaco-line-number-width)
1067
+ );
1068
+ --stream-monaco-modified-scrollable-left: var(
1069
+ --stream-monaco-modified-margin-width
1070
+ );
1071
+ --stream-monaco-modified-scrollable-width: calc(
1072
+ 100% - var(--stream-monaco-modified-margin-width)
1073
+ );
1074
+ --stream-monaco-panel-bg:
1075
+ linear-gradient(
1076
+ 180deg,
1077
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 97%, white 3%) 0%,
1078
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 92%, var(--stream-monaco-editor-fg) 8%) 100%
1079
+ );
1080
+ --stream-monaco-panel-bg-soft: color-mix(in srgb, var(--stream-monaco-editor-bg) 94%, var(--stream-monaco-editor-fg) 6%);
1081
+ --stream-monaco-panel-bg-strong: color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%);
1082
+ --stream-monaco-gutter-bg:
1083
+ linear-gradient(
1084
+ 180deg,
1085
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 92%, var(--stream-monaco-editor-fg) 8%) 0%,
1086
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%) 100%
1087
+ );
1088
+ --stream-monaco-gutter-guide: color-mix(in srgb, var(--stream-monaco-editor-fg) 14%, transparent);
1089
+ --stream-monaco-surface: color-mix(in srgb, var(--stream-monaco-unchanged-bg) 76%, var(--stream-monaco-editor-bg) 24%);
1090
+ --stream-monaco-surface-hover: color-mix(in srgb, var(--stream-monaco-unchanged-bg) 64%, var(--stream-monaco-editor-bg) 36%);
677
1091
  --stream-monaco-surface-soft: color-mix(in srgb, var(--stream-monaco-unchanged-bg) 55%, transparent);
678
- --stream-monaco-border: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 20%, transparent);
679
- --stream-monaco-border-strong: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 34%, transparent);
680
- --stream-monaco-muted: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 72%, transparent);
681
- --stream-monaco-accent-soft: color-mix(in srgb, var(--stream-monaco-focus) 18%, transparent);
1092
+ --stream-monaco-border: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 18%, transparent);
1093
+ --stream-monaco-border-strong: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 30%, transparent);
1094
+ --stream-monaco-muted: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 70%, transparent);
1095
+ --stream-monaco-added-fg: color-mix(in srgb, var(--vscode-diffEditorGutter-insertedLineBackground, #14b8a6) 78%, #0f766e 22%);
1096
+ --stream-monaco-added-line: color-mix(in srgb, var(--vscode-diffEditor-insertedLineBackground, #ddfbe8) 88%, var(--stream-monaco-editor-bg) 12%);
1097
+ --stream-monaco-added-inline: color-mix(in srgb, var(--vscode-diffEditor-insertedTextBackground, #baf5d1) 92%, var(--stream-monaco-editor-bg) 8%);
1098
+ --stream-monaco-added-border: color-mix(in srgb, var(--stream-monaco-added-fg) 24%, transparent);
1099
+ --stream-monaco-added-outline: var(--stream-monaco-added-border);
1100
+ --stream-monaco-added-inline-border: var(--stream-monaco-added-border);
1101
+ --stream-monaco-added-line-shadow:
1102
+ inset 4px 0 0 var(--stream-monaco-added-fg),
1103
+ inset 0 0 0 1px var(--stream-monaco-added-outline);
1104
+ --stream-monaco-added-line-fill:
1105
+ linear-gradient(
1106
+ 90deg,
1107
+ color-mix(in srgb, var(--stream-monaco-added-line) 94%, var(--stream-monaco-editor-bg) 6%) 0%,
1108
+ color-mix(in srgb, var(--stream-monaco-added-line) 82%, transparent) 100%
1109
+ );
1110
+ --stream-monaco-added-gutter:
1111
+ linear-gradient(
1112
+ 90deg,
1113
+ var(--stream-monaco-added-fg) 0 4px,
1114
+ color-mix(in srgb, var(--stream-monaco-added-line) 82%, transparent) 4px 100%
1115
+ );
1116
+ --stream-monaco-removed-fg: color-mix(in srgb, var(--vscode-diffEditorGutter-removedLineBackground, #f43f5e) 74%, #dc2626 26%);
1117
+ --stream-monaco-removed-line: color-mix(in srgb, var(--vscode-diffEditor-removedLineBackground, #fde8ec) 88%, var(--stream-monaco-editor-bg) 12%);
1118
+ --stream-monaco-removed-inline: color-mix(in srgb, var(--vscode-diffEditor-removedTextBackground, #fecdd6) 92%, var(--stream-monaco-editor-bg) 8%);
1119
+ --stream-monaco-removed-border: color-mix(in srgb, var(--stream-monaco-removed-fg) 24%, transparent);
1120
+ --stream-monaco-removed-outline: var(--stream-monaco-removed-border);
1121
+ --stream-monaco-removed-inline-border: var(--stream-monaco-removed-border);
1122
+ --stream-monaco-removed-line-shadow:
1123
+ inset 4px 0 0 var(--stream-monaco-removed-fg),
1124
+ inset 0 0 0 1px var(--stream-monaco-removed-outline);
1125
+ --stream-monaco-removed-line-fill:
1126
+ linear-gradient(
1127
+ 90deg,
1128
+ color-mix(in srgb, var(--stream-monaco-removed-line) 94%, var(--stream-monaco-editor-bg) 6%) 0%,
1129
+ color-mix(in srgb, var(--stream-monaco-removed-line) 82%, transparent) 100%
1130
+ );
1131
+ --stream-monaco-removed-gutter:
1132
+ linear-gradient(
1133
+ 90deg,
1134
+ var(--stream-monaco-removed-fg) 0 4px,
1135
+ color-mix(in srgb, var(--stream-monaco-removed-line) 82%, transparent) 4px 100%
1136
+ );
1137
+ scrollbar-width: none;
1138
+ color-scheme: light;
1139
+ }
1140
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark {
1141
+ --stream-monaco-frame-border: color-mix(in srgb, var(--stream-monaco-editor-fg) 16%, transparent);
1142
+ --stream-monaco-frame-shadow: 0 30px 60px -42px rgb(2 6 23 / 0.78);
1143
+ --stream-monaco-panel-border: color-mix(in srgb, var(--stream-monaco-editor-fg) 15%, transparent);
1144
+ --stream-monaco-pane-divider: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1145
+ --stream-monaco-panel-bg:
1146
+ linear-gradient(
1147
+ 180deg,
1148
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 94%, black 6%) 0%,
1149
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 82%, var(--stream-monaco-editor-fg) 18%) 100%
1150
+ );
1151
+ --stream-monaco-panel-bg-soft: color-mix(in srgb, var(--stream-monaco-editor-bg) 86%, var(--stream-monaco-editor-fg) 14%);
1152
+ --stream-monaco-panel-bg-strong: color-mix(in srgb, var(--stream-monaco-editor-bg) 78%, var(--stream-monaco-editor-fg) 22%);
1153
+ --stream-monaco-gutter-bg:
1154
+ linear-gradient(
1155
+ 180deg,
1156
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, black 16%) 0%,
1157
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 76%, var(--stream-monaco-editor-fg) 24%) 100%
1158
+ );
1159
+ --stream-monaco-gutter-guide: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1160
+ --stream-monaco-surface: color-mix(in srgb, var(--stream-monaco-editor-bg) 91%, var(--stream-monaco-unchanged-fg) 9%);
1161
+ --stream-monaco-surface-hover: color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, var(--stream-monaco-unchanged-fg) 16%);
1162
+ --stream-monaco-surface-soft: color-mix(in srgb, var(--stream-monaco-editor-bg) 78%, var(--stream-monaco-unchanged-fg) 22%);
1163
+ --stream-monaco-border: color-mix(in srgb, var(--stream-monaco-editor-fg) 22%, transparent);
1164
+ --stream-monaco-border-strong: color-mix(in srgb, var(--stream-monaco-editor-fg) 30%, transparent);
1165
+ --stream-monaco-muted: color-mix(in srgb, var(--stream-monaco-editor-fg) 72%, transparent);
1166
+ --stream-monaco-added-fg: color-mix(in srgb, var(--vscode-diffEditorGutter-insertedLineBackground, #2dd4bf) 88%, #99f6e4 12%);
1167
+ --stream-monaco-added-line: color-mix(in srgb, var(--vscode-diffEditor-insertedLineBackground, rgb(16 185 129 / 0.24)) 54%, var(--stream-monaco-editor-bg) 46%);
1168
+ --stream-monaco-added-inline: color-mix(in srgb, var(--vscode-diffEditor-insertedTextBackground, rgb(45 212 191 / 0.26)) 62%, var(--stream-monaco-editor-bg) 38%);
1169
+ --stream-monaco-added-border: color-mix(in srgb, var(--stream-monaco-added-fg) 32%, transparent);
1170
+ --stream-monaco-added-outline: color-mix(in srgb, var(--stream-monaco-added-fg) 20%, transparent);
1171
+ --stream-monaco-added-inline-border: color-mix(in srgb, var(--stream-monaco-added-fg) 26%, transparent);
1172
+ --stream-monaco-added-line-shadow:
1173
+ inset 4px 0 0 var(--stream-monaco-added-fg),
1174
+ inset 0 0 0 1px var(--stream-monaco-added-outline);
1175
+ --stream-monaco-added-line-fill:
1176
+ linear-gradient(
1177
+ 90deg,
1178
+ color-mix(in srgb, var(--stream-monaco-added-line) 96%, var(--stream-monaco-editor-bg) 4%) 0%,
1179
+ color-mix(in srgb, var(--stream-monaco-added-line) 74%, transparent) 100%
1180
+ );
1181
+ --stream-monaco-added-gutter:
1182
+ linear-gradient(
1183
+ 90deg,
1184
+ var(--stream-monaco-added-fg) 0 4px,
1185
+ color-mix(in srgb, var(--stream-monaco-added-line) 74%, transparent) 4px 100%
1186
+ );
1187
+ --stream-monaco-removed-fg: color-mix(in srgb, var(--vscode-diffEditorGutter-removedLineBackground, #fb7185) 86%, #fecdd3 14%);
1188
+ --stream-monaco-removed-line: color-mix(in srgb, var(--vscode-diffEditor-removedLineBackground, rgb(244 63 94 / 0.22)) 54%, var(--stream-monaco-editor-bg) 46%);
1189
+ --stream-monaco-removed-inline: color-mix(in srgb, var(--vscode-diffEditor-removedTextBackground, rgb(251 113 133 / 0.24)) 62%, var(--stream-monaco-editor-bg) 38%);
1190
+ --stream-monaco-removed-border: color-mix(in srgb, var(--stream-monaco-removed-fg) 32%, transparent);
1191
+ --stream-monaco-removed-outline: color-mix(in srgb, var(--stream-monaco-removed-fg) 20%, transparent);
1192
+ --stream-monaco-removed-inline-border: color-mix(in srgb, var(--stream-monaco-removed-fg) 26%, transparent);
1193
+ --stream-monaco-removed-line-shadow:
1194
+ inset 4px 0 0 var(--stream-monaco-removed-fg),
1195
+ inset 0 0 0 1px var(--stream-monaco-removed-outline);
1196
+ --stream-monaco-removed-line-fill:
1197
+ linear-gradient(
1198
+ 90deg,
1199
+ color-mix(in srgb, var(--stream-monaco-removed-line) 96%, var(--stream-monaco-editor-bg) 4%) 0%,
1200
+ color-mix(in srgb, var(--stream-monaco-removed-line) 74%, transparent) 100%
1201
+ );
1202
+ --stream-monaco-removed-gutter:
1203
+ linear-gradient(
1204
+ 90deg,
1205
+ var(--stream-monaco-removed-fg) 0 4px,
1206
+ color-mix(in srgb, var(--stream-monaco-removed-line) 74%, transparent) 4px 100%
1207
+ );
1208
+ color-scheme: dark;
1209
+ }
1210
+ .stream-monaco-diff-root::-webkit-scrollbar {
1211
+ width: 0;
1212
+ height: 0;
1213
+ display: none;
1214
+ }
1215
+ .stream-monaco-diff-root .monaco-diff-editor {
1216
+ overflow: hidden;
1217
+ background: var(--stream-monaco-panel-bg);
1218
+ box-shadow: var(--stream-monaco-frame-shadow);
1219
+ }
1220
+ .stream-monaco-diff-root .monaco-diff-editor.side-by-side .editor.original .scrollbar.vertical,
1221
+ .stream-monaco-diff-root .monaco-diff-editor.side-by-side .editor.modified .scrollbar.vertical {
1222
+ display: none !important;
1223
+ }
1224
+ .stream-monaco-diff-root .monaco-diff-editor.side-by-side {
1225
+ background:
1226
+ radial-gradient(circle at top center, color-mix(in srgb, var(--stream-monaco-editor-bg) 82%, white 18%) 0%, transparent 44%),
1227
+ var(--stream-monaco-panel-bg);
1228
+ }
1229
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor.side-by-side {
1230
+ background:
1231
+ radial-gradient(circle at top center, color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, black 12%) 0%, transparent 48%),
1232
+ var(--stream-monaco-panel-bg);
1233
+ }
1234
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original,
1235
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified {
1236
+ background:
1237
+ linear-gradient(
1238
+ 180deg,
1239
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 98%, white 2%) 0%,
1240
+ var(--stream-monaco-editor-bg) 100%
1241
+ );
1242
+ }
1243
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .editor.original,
1244
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .editor.modified {
1245
+ background:
1246
+ linear-gradient(
1247
+ 180deg,
1248
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 94%, black 6%) 0%,
1249
+ var(--stream-monaco-editor-bg) 100%
1250
+ );
1251
+ }
1252
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .monaco-editor-background,
1253
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin,
1254
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin-view-overlays,
1255
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin-view-zones,
1256
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .lines-content,
1257
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .monaco-editor-background,
1258
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin,
1259
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin-view-overlays,
1260
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin-view-zones,
1261
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .lines-content {
1262
+ background: var(--stream-monaco-editor-bg) !important;
1263
+ }
1264
+ .stream-monaco-diff-root .monaco-diff-editor.side-by-side .editor.modified {
1265
+ box-shadow: none;
1266
+ border-left: 1px solid var(--stream-monaco-pane-divider);
1267
+ }
1268
+ .stream-monaco-diff-root .monaco-diff-editor.side-by-side .editor.original {
1269
+ box-shadow: none;
1270
+ border-right: 1px solid var(--stream-monaco-pane-divider);
1271
+ }
1272
+ .stream-monaco-diff-root .monaco-diff-editor .gutter {
1273
+ background: var(--stream-monaco-gutter-bg);
1274
+ border-inline: 1px solid var(--stream-monaco-pane-divider);
1275
+ }
1276
+ .stream-monaco-diff-root .monaco-diff-editor .gutter .background {
1277
+ left: 50%;
1278
+ width: 1px;
1279
+ border-left: 0 !important;
1280
+ background: var(--stream-monaco-gutter-guide);
1281
+ }
1282
+ .stream-monaco-diff-root .monaco-diff-editor .gutter .buttons .monaco-toolbar .monaco-action-bar .actions-container {
1283
+ border-radius: 999px;
1284
+ border: 1px solid var(--stream-monaco-panel-border);
1285
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, var(--stream-monaco-editor-fg) 16%);
1286
+ box-shadow: 0 14px 24px -18px var(--stream-monaco-widget-shadow);
1287
+ }
1288
+ .stream-monaco-diff-root .monaco-diff-editor .gutter .buttons .monaco-toolbar .monaco-action-bar .actions-container .action-item {
1289
+ border-radius: 999px;
1290
+ }
1291
+ .stream-monaco-diff-root .monaco-diff-editor .insert-sign,
1292
+ .stream-monaco-diff-root .monaco-diff-editor .delete-sign {
1293
+ display: none !important;
1294
+ }
1295
+ .stream-monaco-diff-root .monaco-diff-editor .gutter-insert {
1296
+ background: var(--stream-monaco-added-gutter) !important;
1297
+ }
1298
+ .stream-monaco-diff-root .monaco-diff-editor .gutter-delete,
1299
+ .stream-monaco-diff-root .monaco-editor .inline-deleted-margin-view-zone {
1300
+ background: var(--stream-monaco-removed-gutter) !important;
1301
+ }
1302
+ .stream-monaco-diff-root .monaco-editor .line-insert,
1303
+ .stream-monaco-diff-root .monaco-diff-editor .line-insert {
1304
+ background: var(--stream-monaco-added-line-fill) !important;
1305
+ border: 0 !important;
1306
+ box-shadow: var(--stream-monaco-added-line-shadow);
1307
+ }
1308
+ .stream-monaco-diff-root .monaco-editor .line-delete,
1309
+ .stream-monaco-diff-root .monaco-diff-editor .line-delete {
1310
+ background: var(--stream-monaco-removed-line-fill) !important;
1311
+ border: 0 !important;
1312
+ box-shadow: var(--stream-monaco-removed-line-shadow);
1313
+ }
1314
+ .stream-monaco-diff-root .monaco-editor .char-insert,
1315
+ .stream-monaco-diff-root .monaco-diff-editor .char-insert {
1316
+ background: var(--stream-monaco-added-inline) !important;
1317
+ border: 1px solid var(--stream-monaco-added-inline-border) !important;
1318
+ border-radius: 6px;
1319
+ box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--stream-monaco-added-fg) 18%, transparent);
1320
+ }
1321
+ .stream-monaco-diff-root .monaco-editor .char-delete,
1322
+ .stream-monaco-diff-root .monaco-diff-editor .char-delete,
1323
+ .stream-monaco-diff-root .monaco-editor .inline-deleted-text {
1324
+ background: var(--stream-monaco-removed-inline) !important;
1325
+ border: 1px solid var(--stream-monaco-removed-inline-border) !important;
1326
+ border-radius: 6px;
1327
+ box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--stream-monaco-removed-fg) 18%, transparent);
1328
+ }
1329
+ .stream-monaco-diff-root .monaco-editor .inline-deleted-text {
1330
+ text-decoration: none;
1331
+ }
1332
+ .stream-monaco-diff-root .monaco-editor .char-insert.diff-range-empty,
1333
+ .stream-monaco-diff-root .monaco-editor .char-delete.diff-range-empty {
1334
+ min-width: 2px;
1335
+ margin: 0 1px;
1336
+ border-radius: 999px;
1337
+ }
1338
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .line-insert,
1339
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .line-insert,
1340
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .line-delete,
1341
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .line-delete,
1342
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .char-insert,
1343
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .char-insert,
1344
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .char-delete,
1345
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .char-delete,
1346
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .inline-deleted-text,
1347
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .gutter-insert,
1348
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .gutter-delete,
1349
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .inline-deleted-margin-view-zone {
1350
+ background: transparent !important;
1351
+ border-color: transparent !important;
1352
+ box-shadow: none !important;
1353
+ }
1354
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .line-delete.line-numbers,
1355
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .line-delete.line-numbers,
1356
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-editor .line-insert.line-numbers,
1357
+ .stream-monaco-diff-root.stream-monaco-diff-native-stale .monaco-diff-editor .line-insert.line-numbers {
1358
+ color: var(--stream-monaco-line-number) !important;
1359
+ }
1360
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-line-insert,
1361
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-line-insert {
1362
+ background: var(--stream-monaco-added-line-fill) !important;
1363
+ border: 0 !important;
1364
+ box-shadow: var(--stream-monaco-added-line-shadow);
1365
+ }
1366
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-line-delete,
1367
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-line-delete {
1368
+ background: var(--stream-monaco-removed-line-fill) !important;
1369
+ border: 0 !important;
1370
+ box-shadow: var(--stream-monaco-removed-line-shadow);
1371
+ }
1372
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-gutter-insert,
1373
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-gutter-insert {
1374
+ background: var(--stream-monaco-added-gutter) !important;
1375
+ }
1376
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-gutter-delete,
1377
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-gutter-delete {
1378
+ background: var(--stream-monaco-removed-gutter) !important;
1379
+ }
1380
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-line-number-delete,
1381
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-line-number-delete {
1382
+ color: var(--stream-monaco-removed-fg) !important;
1383
+ }
1384
+ .stream-monaco-diff-root .monaco-editor .stream-monaco-fallback-line-number-insert,
1385
+ .stream-monaco-diff-root .monaco-diff-editor .stream-monaco-fallback-line-number-insert {
1386
+ color: var(--stream-monaco-added-fg) !important;
1387
+ }
1388
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .gutter-insert {
1389
+ background:
1390
+ linear-gradient(
1391
+ 90deg,
1392
+ var(--stream-monaco-added-fg) 0 4px,
1393
+ transparent 4px 100%
1394
+ ) !important;
1395
+ }
1396
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .gutter-delete,
1397
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .inline-deleted-margin-view-zone {
1398
+ background:
1399
+ linear-gradient(
1400
+ 90deg,
1401
+ var(--stream-monaco-removed-fg) 0 4px,
1402
+ transparent 4px 100%
1403
+ ) !important;
1404
+ }
1405
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .line-insert,
1406
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .line-insert {
1407
+ background:
1408
+ color-mix(in srgb, var(--stream-monaco-added-line) 34%, transparent) !important;
1409
+ box-shadow: none !important;
1410
+ }
1411
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .line-delete,
1412
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .line-delete {
1413
+ background:
1414
+ color-mix(in srgb, var(--stream-monaco-removed-line) 34%, transparent) !important;
1415
+ box-shadow: none !important;
1416
+ }
1417
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .char-insert,
1418
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .char-insert {
1419
+ background:
1420
+ color-mix(in srgb, var(--stream-monaco-added-inline) 76%, transparent) !important;
1421
+ border: 0 !important;
1422
+ border-bottom: 1px solid
1423
+ color-mix(in srgb, var(--stream-monaco-added-fg) 30%, transparent) !important;
1424
+ box-shadow: inset 0 -1px 0
1425
+ color-mix(in srgb, var(--stream-monaco-added-fg) 26%, transparent);
1426
+ }
1427
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .char-delete,
1428
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-diff-editor .char-delete,
1429
+ .stream-monaco-diff-root.stream-monaco-diff-style-bar .monaco-editor .inline-deleted-text {
1430
+ background:
1431
+ color-mix(in srgb, var(--stream-monaco-removed-inline) 76%, transparent) !important;
1432
+ border: 0 !important;
1433
+ border-bottom: 1px solid
1434
+ color-mix(in srgb, var(--stream-monaco-removed-fg) 30%, transparent) !important;
1435
+ box-shadow: inset 0 -1px 0
1436
+ color-mix(in srgb, var(--stream-monaco-removed-fg) 26%, transparent);
1437
+ }
1438
+ .stream-monaco-diff-root .monaco-diff-editor .diffOverview {
1439
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, var(--stream-monaco-editor-fg) 16%);
1440
+ border-left: 1px solid var(--stream-monaco-panel-border);
1441
+ }
1442
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .diffOverview {
1443
+ background:
1444
+ linear-gradient(
1445
+ 180deg,
1446
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 96%, black 4%) 0%,
1447
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 90%, var(--stream-monaco-editor-fg) 10%) 100%
1448
+ );
1449
+ border-left-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 10%, transparent);
1450
+ box-shadow: inset 1px 0 0 rgb(255 255 255 / 0.03);
1451
+ }
1452
+ .stream-monaco-diff-root .monaco-diff-editor .diffViewport {
1453
+ border-radius: 999px;
1454
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 18%, transparent);
1455
+ }
1456
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .diffViewport {
1457
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 24%, transparent);
1458
+ box-shadow:
1459
+ inset 0 1px 0 rgb(255 255 255 / 0.08),
1460
+ 0 10px 18px -14px rgb(2 6 23 / 0.92);
1461
+ }
1462
+ .stream-monaco-diff-root .monaco-diff-editor .diffViewport:hover {
1463
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 24%, transparent);
1464
+ }
1465
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .diffViewport:hover {
1466
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 31%, transparent);
1467
+ }
1468
+ .stream-monaco-diff-root .monaco-diff-editor .diffViewport:active {
1469
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 32%, transparent);
1470
+ }
1471
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-diff-editor .diffViewport:active {
1472
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 38%, transparent);
1473
+ }
1474
+ .stream-monaco-diff-root .monaco-scrollable-element.modified-in-monaco-diff-editor .slider {
1475
+ border-radius: 999px;
1476
+ }
1477
+ .stream-monaco-diff-root .monaco-editor .line-numbers {
1478
+ color: var(--stream-monaco-line-number) !important;
1479
+ left: var(--stream-monaco-line-number-left) !important;
1480
+ width: var(--stream-monaco-line-number-width) !important;
1481
+ text-align: var(--stream-monaco-line-number-align) !important;
1482
+ }
1483
+ .stream-monaco-diff-root .monaco-editor .line-numbers.active-line-number {
1484
+ color: var(--stream-monaco-line-number-active) !important;
1485
+ }
1486
+ .stream-monaco-diff-root .monaco-editor .line-delete.line-numbers,
1487
+ .stream-monaco-diff-root .monaco-diff-editor .line-delete.line-numbers {
1488
+ color: var(--stream-monaco-removed-fg) !important;
1489
+ }
1490
+ .stream-monaco-diff-root .monaco-editor .line-insert.line-numbers,
1491
+ .stream-monaco-diff-root .monaco-diff-editor .line-insert.line-numbers {
1492
+ color: var(--stream-monaco-added-fg) !important;
1493
+ }
1494
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin,
1495
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin-view-overlays,
1496
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .margin-view-zones {
1497
+ width: var(--stream-monaco-original-margin-width, auto) !important;
1498
+ }
1499
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .current-line {
1500
+ width: var(--stream-monaco-original-margin-width, auto) !important;
1501
+ }
1502
+ .stream-monaco-diff-root .monaco-diff-editor .editor.original .monaco-scrollable-element.editor-scrollable {
1503
+ left: var(--stream-monaco-original-scrollable-left, auto) !important;
1504
+ width: var(--stream-monaco-original-scrollable-width, auto) !important;
1505
+ }
1506
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin,
1507
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin-view-overlays,
1508
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .margin-view-zones {
1509
+ width: var(--stream-monaco-modified-margin-width) !important;
1510
+ }
1511
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .current-line {
1512
+ width: var(--stream-monaco-modified-margin-width) !important;
1513
+ }
1514
+ .stream-monaco-diff-root .monaco-diff-editor .editor.modified .monaco-scrollable-element.editor-scrollable {
1515
+ left: var(--stream-monaco-modified-scrollable-left, var(--stream-monaco-modified-margin-width)) !important;
1516
+ width: var(
1517
+ --stream-monaco-modified-scrollable-width,
1518
+ calc(100% - var(--stream-monaco-modified-margin-width))
1519
+ ) !important;
1520
+ }
1521
+ .stream-monaco-diff-root .monaco-editor .diagonal-fill {
1522
+ opacity: 0.38;
1523
+ background-size: 10px 10px;
682
1524
  }
683
1525
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines-widget {
684
1526
  pointer-events: auto;
685
1527
  box-sizing: border-box;
686
1528
  }
1529
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .diff-hidden-lines-widget,
1530
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .fold-unchanged {
1531
+ display: none !important;
1532
+ }
1533
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .diff-hidden-lines {
1534
+ display: none !important;
1535
+ }
1536
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original {
1537
+ width: 0 !important;
1538
+ min-width: 0 !important;
1539
+ flex: 0 0 0 !important;
1540
+ border: 0 !important;
1541
+ overflow: hidden !important;
1542
+ }
1543
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .monaco-scrollable-element.editor-scrollable {
1544
+ left: 0 !important;
1545
+ width: 0 !important;
1546
+ }
1547
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.modified {
1548
+ left: 0 !important;
1549
+ width: 100% !important;
1550
+ border-left: 0 !important;
1551
+ }
1552
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .gutter-delete,
1553
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .gutter-insert,
1554
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .line-delete,
1555
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .line-insert,
1556
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .line-numbers,
1557
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-diff-editor .editor.original .diagonal-fill {
1558
+ opacity: 0 !important;
1559
+ background: transparent !important;
1560
+ box-shadow: none !important;
1561
+ pointer-events: none !important;
1562
+ }
687
1563
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines {
688
1564
  height: auto;
689
1565
  width: 100%;
690
- transform: translateY(-10px);
691
- padding: 4px 4px 6px;
1566
+ transform: none;
1567
+ padding: 0 8px;
692
1568
  box-sizing: border-box;
693
1569
  }
1570
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-editor .diff-hidden-lines-widget {
1571
+ height: 24px !important;
1572
+ }
1573
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-editor .diff-hidden-lines {
1574
+ height: 24px;
1575
+ padding: 0 8px;
1576
+ }
694
1577
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .top,
695
1578
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .bottom {
696
1579
  display: none !important;
@@ -698,18 +1581,30 @@ var DiffEditorManager = class DiffEditorManager {
698
1581
  }
699
1582
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center {
700
1583
  align-items: center;
701
- gap: 10px;
702
- max-width: calc(100% - 6px);
1584
+ gap: 0;
1585
+ max-width: calc(100% - 4px);
703
1586
  min-height: 32px;
704
1587
  margin: 0 auto;
705
- padding: 4px 10px 4px 8px;
706
- border-radius: 14px;
707
- border: 1px solid var(--stream-monaco-border);
708
- background: linear-gradient(180deg, var(--stream-monaco-surface) 0%, color-mix(in srgb, var(--stream-monaco-surface) 92%, var(--stream-monaco-editor-bg) 8%) 100%);
709
- box-shadow: 0 14px 26px -22px var(--stream-monaco-widget-shadow);
1588
+ padding: 0;
1589
+ border-radius: 12px;
1590
+ border: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 8%, transparent);
1591
+ background: color-mix(
1592
+ in srgb,
1593
+ var(--stream-monaco-editor-bg) 96%,
1594
+ var(--stream-monaco-editor-fg) 4%
1595
+ );
1596
+ box-shadow: 0 18px 28px -28px var(--stream-monaco-widget-shadow);
710
1597
  box-sizing: border-box;
711
1598
  overflow: hidden;
712
- transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
1599
+ transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
1600
+ }
1601
+ .stream-monaco-diff-root.stream-monaco-diff-inline .monaco-editor .diff-hidden-lines .center {
1602
+ min-height: 24px;
1603
+ height: 24px;
1604
+ border-radius: 10px;
1605
+ }
1606
+ .stream-monaco-diff-root.stream-monaco-diff-unchanged-style-simple .monaco-editor .diff-hidden-lines .center {
1607
+ min-height: 28px;
713
1608
  }
714
1609
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-clickable {
715
1610
  cursor: pointer;
@@ -726,27 +1621,47 @@ var DiffEditorManager = class DiffEditorManager {
726
1621
  visibility: hidden;
727
1622
  }
728
1623
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-unchanged-merged-secondary {
729
- padding-left: 10px;
1624
+ padding-left: 0;
1625
+ }
1626
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center,
1627
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge {
1628
+ border-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 16%, transparent);
1629
+ background: color-mix(
1630
+ in srgb,
1631
+ var(--stream-monaco-editor-bg) 88%,
1632
+ var(--stream-monaco-editor-fg) 12%
1633
+ );
1634
+ box-shadow: 0 22px 34px -30px rgb(2 6 23 / 0.92);
730
1635
  }
731
1636
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center:hover,
732
1637
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-focus-within {
733
- background: linear-gradient(180deg, var(--stream-monaco-surface-hover) 0%, color-mix(in srgb, var(--stream-monaco-surface-hover) 92%, var(--stream-monaco-editor-bg) 8%) 100%);
734
- border-color: var(--stream-monaco-border-strong);
735
- box-shadow: 0 18px 30px -24px var(--stream-monaco-widget-shadow);
736
- transform: translateY(-1px);
1638
+ background: color-mix(
1639
+ in srgb,
1640
+ var(--stream-monaco-editor-bg) 94%,
1641
+ var(--stream-monaco-editor-fg) 6%
1642
+ );
1643
+ border-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1644
+ box-shadow: 0 18px 30px -28px var(--stream-monaco-widget-shadow);
1645
+ }
1646
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center:hover,
1647
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center.stream-monaco-focus-within,
1648
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:hover,
1649
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:focus-visible,
1650
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
1651
+ background: color-mix(
1652
+ in srgb,
1653
+ var(--stream-monaco-editor-bg) 82%,
1654
+ var(--stream-monaco-editor-fg) 18%
1655
+ );
1656
+ border-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 22%, transparent);
1657
+ box-shadow: 0 24px 36px -30px rgb(2 6 23 / 0.94);
737
1658
  }
738
1659
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-unchanged-merged-secondary .stream-monaco-unchanged-primary {
739
1660
  display: none !important;
740
1661
  }
741
1662
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-primary,
742
1663
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-primary {
743
- display: flex;
744
- align-items: center;
745
- flex: 0 0 auto;
746
- width: auto !important;
747
- min-width: max-content;
748
- overflow: visible;
749
- justify-content: flex-start !important;
1664
+ display: none !important;
750
1665
  }
751
1666
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-primary {
752
1667
  width: 100% !important;
@@ -764,7 +1679,7 @@ var DiffEditorManager = class DiffEditorManager {
764
1679
  border-radius: 999px;
765
1680
  text-decoration: none;
766
1681
  color: inherit;
767
- background: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 12%, transparent);
1682
+ background: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 10%, var(--stream-monaco-editor-bg) 90%);
768
1683
  border: 1px solid color-mix(in srgb, var(--stream-monaco-unchanged-fg) 10%, transparent);
769
1684
  font-size: 11px;
770
1685
  font-weight: 700;
@@ -787,8 +1702,8 @@ var DiffEditorManager = class DiffEditorManager {
787
1702
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-expand:hover,
788
1703
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-expand:focus-visible,
789
1704
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-expand:hover {
790
- background: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 18%, transparent);
791
- border-color: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 22%, transparent);
1705
+ background: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 14%, var(--stream-monaco-editor-bg) 86%);
1706
+ border-color: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 18%, transparent);
792
1707
  transform: translateY(-1px);
793
1708
  }
794
1709
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-expand:hover {
@@ -800,28 +1715,38 @@ var DiffEditorManager = class DiffEditorManager {
800
1715
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-meta {
801
1716
  display: flex;
802
1717
  align-items: center;
803
- gap: 8px;
1718
+ gap: 10px;
804
1719
  min-width: 0;
805
1720
  flex: 1 1 auto;
806
1721
  overflow: hidden;
807
- color: var(--stream-monaco-muted);
1722
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 54%, transparent);
808
1723
  white-space: nowrap;
809
1724
  }
1725
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-meta,
1726
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-meta {
1727
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 78%, transparent);
1728
+ }
810
1729
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-unchanged-merged-secondary .stream-monaco-unchanged-meta {
811
- justify-content: center;
1730
+ justify-content: flex-start;
812
1731
  }
813
1732
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-count,
814
1733
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-count {
815
1734
  display: inline-flex;
816
1735
  align-items: center;
817
1736
  flex: 0 0 auto;
818
- padding: 2px 8px;
819
- border-radius: 999px;
820
- background: var(--stream-monaco-surface-soft);
821
- color: var(--stream-monaco-unchanged-fg);
822
- font-size: 11px;
823
- font-weight: 700;
824
- letter-spacing: 0.01em;
1737
+ padding: 0;
1738
+ border-radius: 0;
1739
+ background: transparent;
1740
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 58%, transparent);
1741
+ font-size: 13px;
1742
+ line-height: 14px;
1743
+ font-weight: 500;
1744
+ letter-spacing: 0;
1745
+ }
1746
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-count,
1747
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-count {
1748
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 92%, transparent);
1749
+ font-weight: 600;
825
1750
  }
826
1751
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-separator {
827
1752
  flex: 0 0 auto;
@@ -851,49 +1776,341 @@ var DiffEditorManager = class DiffEditorManager {
851
1776
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center.stream-monaco-unchanged-merged-secondary .stream-monaco-unchanged-breadcrumb {
852
1777
  display: none;
853
1778
  }
1779
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-meta {
1780
+ justify-content: flex-start;
1781
+ padding: 0 18px 0 16px;
1782
+ }
1783
+ .stream-monaco-diff-root.stream-monaco-diff-unchanged-style-metadata .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-meta {
1784
+ padding: 0 28px;
1785
+ }
1786
+ .stream-monaco-diff-root.stream-monaco-diff-unchanged-style-simple .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-meta {
1787
+ justify-content: center;
1788
+ padding: 0 10px;
1789
+ }
1790
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-separator,
1791
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-breadcrumb,
1792
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-expand {
1793
+ display: none !important;
1794
+ }
854
1795
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-overlay {
855
1796
  position: absolute;
856
1797
  inset: 0;
857
1798
  pointer-events: none;
858
1799
  z-index: 12;
859
1800
  }
1801
+ .stream-monaco-diff-root.stream-monaco-diff-inline .stream-monaco-diff-unchanged-overlay {
1802
+ display: none !important;
1803
+ }
1804
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-overlay [hidden] {
1805
+ display: none !important;
1806
+ }
860
1807
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge {
861
1808
  position: absolute;
862
1809
  display: grid;
863
- grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
1810
+ grid-template-columns: var(--stream-monaco-unchanged-rail-width, 54px) minmax(0, 1fr);
864
1811
  align-items: center;
865
- column-gap: 12px;
1812
+ column-gap: 0;
866
1813
  min-height: 32px;
867
- padding: 4px 12px 4px 10px;
868
- border-radius: 14px;
869
- border: 1px solid color-mix(in srgb, var(--stream-monaco-unchanged-fg) 24%, transparent);
870
- background: linear-gradient(180deg, color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-unchanged-fg) 12%) 0%, color-mix(in srgb, var(--stream-monaco-editor-bg) 94%, var(--stream-monaco-unchanged-fg) 6%) 100%);
871
- box-shadow: 0 14px 26px -22px var(--stream-monaco-widget-shadow);
1814
+ padding: 0;
1815
+ border-radius: 12px;
1816
+ border: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 8%, transparent);
1817
+ background: color-mix(
1818
+ in srgb,
1819
+ var(--stream-monaco-editor-bg) 96%,
1820
+ var(--stream-monaco-editor-fg) 4%
1821
+ );
1822
+ box-shadow: 0 18px 28px -28px var(--stream-monaco-widget-shadow);
872
1823
  box-sizing: border-box;
873
1824
  overflow: hidden;
874
1825
  pointer-events: auto;
875
- transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
1826
+ transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
876
1827
  }
877
- .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge:hover,
878
- .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-focus-visible {
879
- background: linear-gradient(180deg, color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, var(--stream-monaco-unchanged-fg) 16%) 0%, color-mix(in srgb, var(--stream-monaco-editor-bg) 92%, var(--stream-monaco-unchanged-fg) 8%) 100%);
880
- border-color: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 32%, transparent);
881
- box-shadow: 0 18px 30px -24px var(--stream-monaco-widget-shadow);
882
- transform: translateY(-1px);
1828
+ .stream-monaco-diff-root.stream-monaco-diff-side-by-side .stream-monaco-diff-unchanged-bridge {
1829
+ min-height: 24px;
1830
+ border-radius: 10px;
1831
+ }
1832
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge:not(.stream-monaco-diff-unchanged-bridge-metadata):not(.stream-monaco-diff-unchanged-bridge-simple) {
1833
+ border-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 18%, transparent);
1834
+ background:
1835
+ linear-gradient(
1836
+ 180deg,
1837
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 84%, var(--stream-monaco-editor-fg) 16%) 0%,
1838
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%) 100%
1839
+ );
1840
+ box-shadow:
1841
+ inset 0 1px 0 rgb(255 255 255 / 0.03),
1842
+ 0 22px 34px -30px rgb(2 6 23 / 0.92);
1843
+ }
1844
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata {
1845
+ grid-template-columns: minmax(0, 1fr);
1846
+ min-height: 32px;
1847
+ border-radius: 0;
1848
+ border-left: 0;
1849
+ border-right: 0;
1850
+ box-shadow: none;
1851
+ }
1852
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata {
1853
+ border-top: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 14%, transparent);
1854
+ border-bottom: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 14%, transparent);
1855
+ background: color-mix(
1856
+ in srgb,
1857
+ var(--stream-monaco-editor-bg) 92%,
1858
+ var(--stream-monaco-editor-fg) 8%
1859
+ );
1860
+ box-shadow:
1861
+ inset 0 1px 0 rgb(255 255 255 / 0.02),
1862
+ inset 0 -1px 0 rgb(15 23 42 / 0.22);
1863
+ }
1864
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple {
1865
+ grid-template-columns: minmax(0, 1fr);
1866
+ min-height: 28px;
1867
+ border: 0;
1868
+ border-radius: 0;
1869
+ background: transparent;
1870
+ box-shadow: none;
1871
+ }
1872
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple {
1873
+ background: transparent;
883
1874
  }
884
1875
  .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge:focus {
885
1876
  outline: none;
886
1877
  }
887
- .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-meta {
888
- justify-self: center;
1878
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail {
1879
+ display: grid;
1880
+ grid-auto-rows: minmax(0, 1fr);
1881
+ align-self: stretch;
1882
+ min-height: 100%;
1883
+ border-right: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 7%, transparent);
1884
+ background: color-mix(
1885
+ in srgb,
1886
+ var(--stream-monaco-editor-bg) 94%,
1887
+ var(--stream-monaco-editor-fg) 6%
1888
+ );
1889
+ z-index: 1;
1890
+ }
1891
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-rail {
1892
+ border-right-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1893
+ background:
1894
+ linear-gradient(
1895
+ 180deg,
1896
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 82%, var(--stream-monaco-editor-fg) 18%) 0%,
1897
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%) 100%
1898
+ );
1899
+ box-shadow:
1900
+ inset 0 1px 0 rgb(255 255 255 / 0.04),
1901
+ inset -1px 0 0 rgb(15 23 42 / 0.22);
1902
+ }
1903
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-rail {
1904
+ justify-items: stretch;
1905
+ border-right: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 8%, transparent);
1906
+ background: color-mix(
1907
+ in srgb,
1908
+ var(--stream-monaco-editor-bg) 92%,
1909
+ var(--stream-monaco-editor-fg) 8%
1910
+ );
1911
+ border-radius: 10px 0 0 10px;
1912
+ overflow: hidden;
1913
+ box-shadow: inset -1px 0 0 color-mix(in srgb, var(--stream-monaco-editor-fg) 6%, transparent);
1914
+ }
1915
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-rail {
1916
+ border-right-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 14%, transparent);
1917
+ background: color-mix(
1918
+ in srgb,
1919
+ var(--stream-monaco-editor-bg) 80%,
1920
+ var(--stream-monaco-editor-fg) 20%
1921
+ );
1922
+ box-shadow:
1923
+ inset 0 1px 0 rgb(255 255 255 / 0.04),
1924
+ inset -1px 0 0 rgb(15 23 42 / 0.24);
1925
+ }
1926
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal {
1927
+ border-bottom-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
1928
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 68%, transparent);
1929
+ }
1930
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal {
1931
+ appearance: none;
1932
+ display: inline-flex;
1933
+ align-items: center;
889
1934
  justify-content: center;
1935
+ width: 100%;
1936
+ min-height: 15px;
1937
+ padding: 0;
1938
+ border: 0;
1939
+ border-bottom: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 7%, transparent);
1940
+ background: transparent;
1941
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 54%, transparent);
1942
+ cursor: pointer;
1943
+ font: inherit;
1944
+ transition: background-color 0.14s ease, color 0.14s ease;
890
1945
  }
891
- .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-spacer {
892
- display: block;
893
- visibility: hidden;
1946
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-reveal {
894
1947
  width: 100%;
895
- height: 1px;
896
- flex: 0 0 auto;
1948
+ min-width: 100%;
1949
+ margin-left: 0;
1950
+ border-bottom-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 8%, transparent);
1951
+ background: transparent;
1952
+ }
1953
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-reveal:first-child {
1954
+ border-radius: 10px 0 0 0;
1955
+ }
1956
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-reveal:last-child {
1957
+ border-radius: 0 0 0 10px;
1958
+ }
1959
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-reveal:first-child:last-child {
1960
+ border-radius: 10px 0 0 10px;
1961
+ }
1962
+ .stream-monaco-diff-root.stream-monaco-diff-side-by-side .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal {
1963
+ min-height: 12px;
1964
+ }
1965
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal .codicon {
1966
+ font-size: 18px;
1967
+ line-height: 1;
1968
+ }
1969
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:last-child {
1970
+ border-bottom: 0;
1971
+ }
1972
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:hover,
1973
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:focus-visible,
1974
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal.stream-monaco-focus-visible {
1975
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%);
1976
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 68%, transparent);
1977
+ }
1978
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:hover,
1979
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal:focus-visible,
1980
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal.stream-monaco-focus-visible {
1981
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 74%, var(--stream-monaco-editor-fg) 26%);
1982
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 90%, transparent);
1983
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
1984
+ }
1985
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-line-info .stream-monaco-unchanged-reveal {
1986
+ border-bottom-color: color-mix(in srgb, var(--stream-monaco-editor-fg) 14%, transparent);
1987
+ background: transparent;
1988
+ }
1989
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary {
1990
+ appearance: none;
1991
+ display: flex;
1992
+ align-items: center;
1993
+ justify-content: flex-start;
1994
+ min-width: 0;
1995
+ min-height: 30px;
1996
+ padding: 0 18px 0 16px;
1997
+ border: 0;
1998
+ background: transparent;
1999
+ box-sizing: border-box;
2000
+ color: inherit;
2001
+ text-align: left;
2002
+ cursor: pointer;
2003
+ font: inherit;
2004
+ z-index: 1;
2005
+ transition: background-color 0.14s ease;
2006
+ }
2007
+ .stream-monaco-diff-root.stream-monaco-diff-side-by-side .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary {
2008
+ min-height: 22px;
2009
+ }
2010
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-unchanged-summary-metadata {
2011
+ min-height: 30px;
2012
+ padding: 0 28px;
2013
+ cursor: default;
2014
+ pointer-events: none;
2015
+ }
2016
+ .stream-monaco-diff-root.stream-monaco-diff-side-by-side .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-unchanged-summary-metadata {
2017
+ min-height: 22px;
2018
+ }
2019
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-unchanged-summary-simple {
2020
+ justify-content: center;
2021
+ min-height: 28px;
2022
+ padding: 0 10px;
2023
+ cursor: default;
2024
+ pointer-events: none;
2025
+ }
2026
+ .stream-monaco-diff-root.stream-monaco-diff-side-by-side .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-unchanged-summary-simple {
2027
+ min-height: 22px;
2028
+ }
2029
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:hover,
2030
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary:focus-visible,
2031
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
2032
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 91%, var(--stream-monaco-editor-fg) 9%);
2033
+ }
2034
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary:hover,
2035
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary:focus-visible,
2036
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
2037
+ background: transparent;
2038
+ }
2039
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary:hover,
2040
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary:focus-visible,
2041
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
2042
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 96%, transparent);
2043
+ }
2044
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary:hover,
2045
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary:focus-visible,
2046
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
2047
+ background: transparent;
2048
+ }
2049
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary:hover,
2050
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary:focus-visible,
2051
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-metadata .stream-monaco-unchanged-summary.stream-monaco-focus-visible {
2052
+ background: transparent;
2053
+ box-shadow: none;
2054
+ }
2055
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-meta {
2056
+ justify-self: stretch;
2057
+ justify-content: flex-start;
2058
+ }
2059
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-meta.stream-monaco-unchanged-meta-simple {
2060
+ justify-content: center;
2061
+ }
2062
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-metadata-label,
2063
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-metadata-label {
2064
+ display: inline-flex;
2065
+ align-items: center;
2066
+ min-width: 0;
2067
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 60%, transparent);
2068
+ font-size: 13px;
2069
+ line-height: 14px;
2070
+ font-weight: 500;
2071
+ letter-spacing: 0.01em;
2072
+ }
2073
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-metadata-label,
2074
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-metadata-label {
2075
+ color: color-mix(in srgb, var(--stream-monaco-editor-fg) 88%, transparent);
2076
+ font-weight: 550;
2077
+ }
2078
+ .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-simple-bar,
2079
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-simple-bar {
2080
+ width: min(100%, calc(100% - 20px));
2081
+ height: 10px;
2082
+ border-radius: 999px;
2083
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 88%, var(--stream-monaco-editor-fg) 12%);
2084
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7);
2085
+ }
2086
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .monaco-editor .diff-hidden-lines .center .stream-monaco-unchanged-simple-bar,
2087
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-simple-bar {
2088
+ height: 9px;
2089
+ background: linear-gradient(
2090
+ 90deg,
2091
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 78%, var(--stream-monaco-editor-fg) 22%) 0%,
2092
+ color-mix(in srgb, var(--stream-monaco-editor-bg) 72%, var(--stream-monaco-editor-fg) 28%) 100%
2093
+ );
2094
+ box-shadow:
2095
+ inset 0 1px 0 rgb(255 255 255 / 0.04),
2096
+ inset 0 0 0 1px rgb(148 163 184 / 0.06);
2097
+ }
2098
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-pane-divider {
2099
+ position: absolute;
2100
+ top: 0;
2101
+ bottom: 0;
2102
+ left: var(--stream-monaco-unchanged-split-offset, 50%);
2103
+ width: 1px;
2104
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 7%, transparent);
2105
+ pointer-events: none;
2106
+ transform: translateX(-0.5px);
2107
+ }
2108
+ .stream-monaco-diff-root.stream-monaco-diff-appearance-dark .stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-pane-divider {
2109
+ background: color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
2110
+ }
2111
+ .stream-monaco-diff-root .stream-monaco-diff-unchanged-bridge.stream-monaco-diff-unchanged-bridge-simple .stream-monaco-unchanged-pane-divider {
2112
+ top: 8px;
2113
+ bottom: 8px;
897
2114
  }
898
2115
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines-compact {
899
2116
  align-items: center;
@@ -903,7 +2120,7 @@ var DiffEditorManager = class DiffEditorManager {
903
2120
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines-compact .text {
904
2121
  padding: 0 6px;
905
2122
  border-radius: 999px;
906
- background: var(--stream-monaco-surface-soft);
2123
+ background: color-mix(in srgb, var(--stream-monaco-unchanged-fg) 10%, var(--stream-monaco-editor-bg) 90%);
907
2124
  color: var(--stream-monaco-unchanged-fg);
908
2125
  }
909
2126
  .stream-monaco-diff-root .monaco-editor .fold-unchanged {
@@ -915,10 +2132,10 @@ var DiffEditorManager = class DiffEditorManager {
915
2132
  margin-left: 4px;
916
2133
  border-radius: 999px;
917
2134
  color: var(--stream-monaco-unchanged-fg);
918
- background: var(--stream-monaco-surface);
2135
+ background: color-mix(in srgb, var(--stream-monaco-surface) 92%, var(--stream-monaco-editor-bg) 8%);
919
2136
  border: 1px solid var(--stream-monaco-border);
920
- box-shadow: 0 10px 18px -18px var(--stream-monaco-widget-shadow);
921
- opacity: 0.88 !important;
2137
+ box-shadow: 0 12px 20px -18px var(--stream-monaco-widget-shadow);
2138
+ opacity: 0.92 !important;
922
2139
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
923
2140
  }
924
2141
  .stream-monaco-diff-root .monaco-editor .fold-unchanged:hover,
@@ -927,7 +2144,7 @@ var DiffEditorManager = class DiffEditorManager {
927
2144
  transform: translateY(-1px);
928
2145
  background: var(--stream-monaco-surface-hover);
929
2146
  border-color: var(--stream-monaco-border-strong);
930
- box-shadow: 0 14px 24px -18px var(--stream-monaco-widget-shadow);
2147
+ box-shadow: 0 16px 26px -18px var(--stream-monaco-widget-shadow);
931
2148
  }
932
2149
  .stream-monaco-diff-root .monaco-editor .diff-hidden-lines .center:focus,
933
2150
  .stream-monaco-diff-root .monaco-editor .fold-unchanged:focus {
@@ -946,29 +2163,43 @@ var DiffEditorManager = class DiffEditorManager {
946
2163
  display: none;
947
2164
  gap: 6px;
948
2165
  pointer-events: auto;
949
- padding: 4px;
2166
+ padding: 6px;
950
2167
  border-radius: 999px;
951
- background: color-mix(in srgb, #f8f8f8 92%, #000 8%);
952
- border: 1px solid color-mix(in srgb, #ddd 88%, #000 12%);
953
- box-shadow: 0 2px 12px rgb(0 0 0 / 10%);
2168
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 80%, var(--stream-monaco-editor-fg) 20%);
2169
+ border: 1px solid color-mix(in srgb, var(--stream-monaco-editor-fg) 12%, transparent);
2170
+ box-shadow: 0 18px 34px -24px var(--stream-monaco-widget-shadow);
2171
+ backdrop-filter: blur(14px);
954
2172
  }
955
2173
  .stream-monaco-diff-hunk-actions button {
956
2174
  appearance: none;
957
- border: 0;
2175
+ border: 1px solid transparent;
958
2176
  border-radius: 999px;
959
- padding: 3px 9px;
2177
+ padding: 4px 10px;
960
2178
  font-size: 11px;
961
2179
  line-height: 1.35;
962
- background: white;
963
- color: #222;
2180
+ font-weight: 700;
2181
+ background: color-mix(in srgb, var(--stream-monaco-editor-bg) 94%, var(--stream-monaco-editor-fg) 6%);
2182
+ color: var(--stream-monaco-editor-fg);
964
2183
  cursor: pointer;
2184
+ transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
2185
+ }
2186
+ .stream-monaco-diff-hunk-actions button[data-action="revert"] {
2187
+ background: color-mix(in srgb, var(--stream-monaco-removed-line) 78%, var(--stream-monaco-editor-bg) 22%);
2188
+ border-color: var(--stream-monaco-removed-border);
2189
+ color: color-mix(in srgb, var(--stream-monaco-removed-fg) 82%, var(--stream-monaco-editor-fg) 18%);
2190
+ }
2191
+ .stream-monaco-diff-hunk-actions button[data-action="stage"] {
2192
+ background: color-mix(in srgb, var(--stream-monaco-added-line) 78%, var(--stream-monaco-editor-bg) 22%);
2193
+ border-color: var(--stream-monaco-added-border);
2194
+ color: color-mix(in srgb, var(--stream-monaco-added-fg) 82%, var(--stream-monaco-editor-fg) 18%);
965
2195
  }
966
2196
  .stream-monaco-diff-hunk-actions button:hover {
967
- background: #f1f1f1;
2197
+ transform: translateY(-1px);
968
2198
  }
969
2199
  .stream-monaco-diff-hunk-actions button:disabled {
970
2200
  opacity: 0.45;
971
2201
  cursor: default;
2202
+ transform: none;
972
2203
  }
973
2204
  `;
974
2205
  document.head.append(style);
@@ -1034,8 +2265,10 @@ var DiffEditorManager = class DiffEditorManager {
1034
2265
  modified: current.modified,
1035
2266
  modelState: this.cloneSerializableValue(this.diffPersistedUnchangedModelState)
1036
2267
  });
2268
+ this.applyPendingDiffScrollRestore();
1037
2269
  }
1038
2270
  scheduleRestorePersistedDiffUnchangedState() {
2271
+ if (this.diffHideUnchangedRegionsDeferred) return;
1039
2272
  if (!this.diffPersistedUnchangedModelState) return;
1040
2273
  this.rafScheduler.schedule("restore-diff-unchanged-state", () => {
1041
2274
  requestAnimationFrame(() => {
@@ -1043,6 +2276,256 @@ var DiffEditorManager = class DiffEditorManager {
1043
2276
  });
1044
2277
  });
1045
2278
  }
2279
+ clearDeferredDiffUnchangedRegionsIdleTimer() {
2280
+ if (this.diffHideUnchangedRegionsIdleTimer != null) {
2281
+ clearTimeout(this.diffHideUnchangedRegionsIdleTimer);
2282
+ this.diffHideUnchangedRegionsIdleTimer = null;
2283
+ }
2284
+ }
2285
+ clearPendingDiffThemeSync() {
2286
+ if (this.diffThemeSyncRafId != null) {
2287
+ cancelAnimationFrame(this.diffThemeSyncRafId);
2288
+ this.diffThemeSyncRafId = null;
2289
+ }
2290
+ }
2291
+ withLockedDiffScrollPosition(callback) {
2292
+ var _originalEditor$getSc, _modifiedEditor$getSc, _originalEditor$getSc2, _modifiedEditor$getSc2;
2293
+ if (!this.diffEditorView) {
2294
+ callback();
2295
+ return;
2296
+ }
2297
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2298
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2299
+ const originalTop = ((_originalEditor$getSc = originalEditor.getScrollTop) === null || _originalEditor$getSc === void 0 ? void 0 : _originalEditor$getSc.call(originalEditor)) ?? 0;
2300
+ const modifiedTop = ((_modifiedEditor$getSc = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc === void 0 ? void 0 : _modifiedEditor$getSc.call(modifiedEditor)) ?? 0;
2301
+ const originalLeft = ((_originalEditor$getSc2 = originalEditor.getScrollLeft) === null || _originalEditor$getSc2 === void 0 ? void 0 : _originalEditor$getSc2.call(originalEditor)) ?? 0;
2302
+ const modifiedLeft = ((_modifiedEditor$getSc2 = modifiedEditor.getScrollLeft) === null || _modifiedEditor$getSc2 === void 0 ? void 0 : _modifiedEditor$getSc2.call(modifiedEditor)) ?? 0;
2303
+ callback();
2304
+ const restore = () => {
2305
+ var _originalEditor$setSc, _modifiedEditor$setSc, _originalEditor$setSc2, _modifiedEditor$setSc2;
2306
+ (_originalEditor$setSc = originalEditor.setScrollTop) === null || _originalEditor$setSc === void 0 || _originalEditor$setSc.call(originalEditor, originalTop);
2307
+ (_modifiedEditor$setSc = modifiedEditor.setScrollTop) === null || _modifiedEditor$setSc === void 0 || _modifiedEditor$setSc.call(modifiedEditor, modifiedTop);
2308
+ (_originalEditor$setSc2 = originalEditor.setScrollLeft) === null || _originalEditor$setSc2 === void 0 || _originalEditor$setSc2.call(originalEditor, originalLeft);
2309
+ (_modifiedEditor$setSc2 = modifiedEditor.setScrollLeft) === null || _modifiedEditor$setSc2 === void 0 || _modifiedEditor$setSc2.call(modifiedEditor, modifiedLeft);
2310
+ };
2311
+ restore();
2312
+ requestAnimationFrame(restore);
2313
+ }
2314
+ captureDiffScrollPosition() {
2315
+ var _originalEditor$getSc3, _modifiedEditor$getSc3, _originalEditor$getSc4, _modifiedEditor$getSc4;
2316
+ if (!this.diffEditorView) return null;
2317
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2318
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2319
+ return {
2320
+ originalTop: ((_originalEditor$getSc3 = originalEditor.getScrollTop) === null || _originalEditor$getSc3 === void 0 ? void 0 : _originalEditor$getSc3.call(originalEditor)) ?? 0,
2321
+ modifiedTop: ((_modifiedEditor$getSc3 = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc3 === void 0 ? void 0 : _modifiedEditor$getSc3.call(modifiedEditor)) ?? 0,
2322
+ originalLeft: ((_originalEditor$getSc4 = originalEditor.getScrollLeft) === null || _originalEditor$getSc4 === void 0 ? void 0 : _originalEditor$getSc4.call(originalEditor)) ?? 0,
2323
+ modifiedLeft: ((_modifiedEditor$getSc4 = modifiedEditor.getScrollLeft) === null || _modifiedEditor$getSc4 === void 0 ? void 0 : _modifiedEditor$getSc4.call(modifiedEditor)) ?? 0
2324
+ };
2325
+ }
2326
+ captureModifiedViewportAnchor() {
2327
+ var _modifiedEditor$getCo;
2328
+ if (!this.diffEditorView) return null;
2329
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2330
+ const editorRoot = (_modifiedEditor$getCo = modifiedEditor.getContainerDomNode) === null || _modifiedEditor$getCo === void 0 ? void 0 : _modifiedEditor$getCo.call(modifiedEditor);
2331
+ if (!(editorRoot instanceof HTMLElement)) return null;
2332
+ const editorRect = editorRoot.getBoundingClientRect();
2333
+ const anchorNode = Array.from(editorRoot.querySelectorAll(".line-numbers")).map((node) => {
2334
+ var _node$textContent;
2335
+ const lineNumber = Number.parseInt(((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.trim()) || "", 10);
2336
+ const rect = node.getBoundingClientRect();
2337
+ return {
2338
+ node,
2339
+ lineNumber,
2340
+ rect
2341
+ };
2342
+ }).filter(({ lineNumber, rect }) => {
2343
+ return Number.isFinite(lineNumber) && rect.height > 0 && rect.bottom > editorRect.top + 1 && rect.top < editorRect.bottom - 1;
2344
+ }).sort((a, b) => a.rect.top - b.rect.top)[0];
2345
+ if (!anchorNode) return null;
2346
+ return {
2347
+ lineNumber: anchorNode.lineNumber,
2348
+ topOffset: anchorNode.rect.top - editorRect.top
2349
+ };
2350
+ }
2351
+ restoreDiffScrollPosition(position) {
2352
+ if (!this.diffEditorView || !position) return;
2353
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2354
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2355
+ const apply = () => {
2356
+ var _originalEditor$setSc3, _modifiedEditor$setSc3, _originalEditor$setSc4, _modifiedEditor$setSc4;
2357
+ (_originalEditor$setSc3 = originalEditor.setScrollTop) === null || _originalEditor$setSc3 === void 0 || _originalEditor$setSc3.call(originalEditor, position.originalTop);
2358
+ (_modifiedEditor$setSc3 = modifiedEditor.setScrollTop) === null || _modifiedEditor$setSc3 === void 0 || _modifiedEditor$setSc3.call(modifiedEditor, position.modifiedTop);
2359
+ (_originalEditor$setSc4 = originalEditor.setScrollLeft) === null || _originalEditor$setSc4 === void 0 || _originalEditor$setSc4.call(originalEditor, position.originalLeft);
2360
+ (_modifiedEditor$setSc4 = modifiedEditor.setScrollLeft) === null || _modifiedEditor$setSc4 === void 0 || _modifiedEditor$setSc4.call(modifiedEditor, position.modifiedLeft);
2361
+ };
2362
+ apply();
2363
+ requestAnimationFrame(() => {
2364
+ apply();
2365
+ requestAnimationFrame(apply);
2366
+ });
2367
+ }
2368
+ restoreModifiedViewportAnchor(anchor) {
2369
+ var _modifiedEditor$getCo2;
2370
+ if (!this.diffEditorView || !anchor) return;
2371
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2372
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2373
+ const editorRoot = (_modifiedEditor$getCo2 = modifiedEditor.getContainerDomNode) === null || _modifiedEditor$getCo2 === void 0 ? void 0 : _modifiedEditor$getCo2.call(modifiedEditor);
2374
+ if (!(editorRoot instanceof HTMLElement)) return;
2375
+ const apply = () => {
2376
+ var _Array$from$map$find, _modifiedEditor$getSc5, _originalEditor$setSc5, _modifiedEditor$setSc5;
2377
+ const editorRect = editorRoot.getBoundingClientRect();
2378
+ const currentNode = (_Array$from$map$find = Array.from(editorRoot.querySelectorAll(".line-numbers")).map((node) => {
2379
+ var _node$textContent2;
2380
+ const lineNumber = Number.parseInt(((_node$textContent2 = node.textContent) === null || _node$textContent2 === void 0 ? void 0 : _node$textContent2.trim()) || "", 10);
2381
+ return {
2382
+ node,
2383
+ lineNumber
2384
+ };
2385
+ }).find(({ lineNumber }) => lineNumber === anchor.lineNumber)) === null || _Array$from$map$find === void 0 ? void 0 : _Array$from$map$find.node;
2386
+ if (!(currentNode instanceof HTMLElement)) return;
2387
+ const currentTop = currentNode.getBoundingClientRect().top - editorRect.top;
2388
+ const delta = currentTop - anchor.topOffset;
2389
+ if (Math.abs(delta) < .5) return;
2390
+ const nextTop = (((_modifiedEditor$getSc5 = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc5 === void 0 ? void 0 : _modifiedEditor$getSc5.call(modifiedEditor)) ?? 0) + delta;
2391
+ (_originalEditor$setSc5 = originalEditor.setScrollTop) === null || _originalEditor$setSc5 === void 0 || _originalEditor$setSc5.call(originalEditor, nextTop);
2392
+ (_modifiedEditor$setSc5 = modifiedEditor.setScrollTop) === null || _modifiedEditor$setSc5 === void 0 || _modifiedEditor$setSc5.call(modifiedEditor, nextTop);
2393
+ };
2394
+ apply();
2395
+ }
2396
+ scheduleRestoreModifiedViewportAnchor(anchor, durationFrames = 8, delayFrames = 0) {
2397
+ if (!anchor) return;
2398
+ let remainingDelay = Math.max(0, delayFrames);
2399
+ let remainingFrames = Math.max(0, durationFrames);
2400
+ const step = () => {
2401
+ if (remainingDelay > 0) {
2402
+ remainingDelay--;
2403
+ requestAnimationFrame(step);
2404
+ return;
2405
+ }
2406
+ this.restoreModifiedViewportAnchor(anchor);
2407
+ if (remainingFrames <= 0) return;
2408
+ remainingFrames--;
2409
+ requestAnimationFrame(step);
2410
+ };
2411
+ step();
2412
+ }
2413
+ queuePendingDiffScrollRestore(position, budget = 2) {
2414
+ if (!position || budget < 1) {
2415
+ this.pendingDiffScrollRestorePosition = null;
2416
+ this.pendingDiffScrollRestoreBudget = 0;
2417
+ return;
2418
+ }
2419
+ this.pendingDiffScrollRestorePosition = { ...position };
2420
+ this.pendingDiffScrollRestoreBudget = budget;
2421
+ }
2422
+ applyPendingDiffScrollRestore() {
2423
+ if (!this.pendingDiffScrollRestorePosition || this.pendingDiffScrollRestoreBudget < 1) return;
2424
+ this.restoreDiffScrollPosition(this.pendingDiffScrollRestorePosition);
2425
+ this.pendingDiffScrollRestoreBudget -= 1;
2426
+ if (this.pendingDiffScrollRestoreBudget < 1) this.pendingDiffScrollRestorePosition = null;
2427
+ }
2428
+ resolveDiffPresentationEditorOptions(hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption()) {
2429
+ return {
2430
+ readOnly: this.options.readOnly ?? true,
2431
+ lineDecorationsWidth: this.options.lineDecorationsWidth,
2432
+ lineNumbersMinChars: this.options.lineNumbersMinChars,
2433
+ glyphMargin: this.options.glyphMargin,
2434
+ fontFamily: this.options.fontFamily,
2435
+ fontSize: this.options.fontSize,
2436
+ lineHeight: this.options.lineHeight,
2437
+ padding: this.options.padding,
2438
+ renderLineHighlight: this.options.renderLineHighlight,
2439
+ renderLineHighlightOnlyWhenFocus: this.options.renderLineHighlightOnlyWhenFocus,
2440
+ renderOverviewRuler: this.options.renderOverviewRuler,
2441
+ scrollBeyondLastLine: this.options.scrollBeyondLastLine ?? false,
2442
+ scrollbar: {
2443
+ ...defaultScrollbar,
2444
+ ...this.options.scrollbar || {}
2445
+ },
2446
+ hideUnchangedRegions: this.diffHideUnchangedRegionsDeferred ? {
2447
+ ...hideUnchangedRegions,
2448
+ enabled: false
2449
+ } : hideUnchangedRegions
2450
+ };
2451
+ }
2452
+ refreshDiffPresentation() {
2453
+ var _this$diffHeightManag;
2454
+ if (!this.diffEditorView) return;
2455
+ const hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption();
2456
+ const presentationOptions = this.resolveDiffPresentationEditorOptions(hideUnchangedRegions);
2457
+ this.diffHideUnchangedRegionsResolved = hideUnchangedRegions;
2458
+ this.diffUpdateThrottleMs = this.resolveDiffStreamingThrottleMs();
2459
+ if (this.lastContainer) {
2460
+ this.lastContainer.style.maxHeight = this.maxHeightCSS;
2461
+ this.lastContainer.style.removeProperty("--stream-monaco-editor-bg");
2462
+ this.lastContainer.style.removeProperty("--stream-monaco-editor-fg");
2463
+ }
2464
+ this.withLockedDiffScrollPosition(() => {
2465
+ var _this$diffEditorView13;
2466
+ (_this$diffEditorView13 = this.diffEditorView) === null || _this$diffEditorView13 === void 0 || _this$diffEditorView13.updateOptions(presentationOptions);
2467
+ });
2468
+ (_this$diffHeightManag = this.diffHeightManager) === null || _this$diffHeightManag === void 0 || _this$diffHeightManag.update();
2469
+ this.applyDiffRootAppearanceClass();
2470
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
2471
+ this.repositionDiffHunkNodes();
2472
+ }
2473
+ restoreDeferredDiffUnchangedRegions() {
2474
+ this.clearDeferredDiffUnchangedRegionsIdleTimer();
2475
+ if (!this.diffEditorView) return;
2476
+ const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved;
2477
+ if (!(hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled)) return;
2478
+ if (!this.diffHideUnchangedRegionsDeferred) return;
2479
+ this.diffHideUnchangedRegionsDeferred = false;
2480
+ this.withLockedDiffScrollPosition(() => {
2481
+ var _this$diffEditorView14;
2482
+ (_this$diffEditorView14 = this.diffEditorView) === null || _this$diffEditorView14 === void 0 || _this$diffEditorView14.updateOptions({ hideUnchangedRegions });
2483
+ });
2484
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
2485
+ if (this.shouldAutoScrollDiff) {
2486
+ var _this$modifiedModel;
2487
+ this.maybeScrollDiffToBottom((_this$modifiedModel = this.modifiedModel) === null || _this$modifiedModel === void 0 ? void 0 : _this$modifiedModel.getLineCount());
2488
+ }
2489
+ }
2490
+ markDiffStreamingActivity() {
2491
+ const hideUnchangedRegions = this.diffHideUnchangedRegionsResolved;
2492
+ if (!this.diffEditorView || !(hideUnchangedRegions === null || hideUnchangedRegions === void 0 ? void 0 : hideUnchangedRegions.enabled)) return;
2493
+ this.clearDeferredDiffUnchangedRegionsIdleTimer();
2494
+ this.rafScheduler.cancel("restore-diff-unchanged-state");
2495
+ this.diffHideUnchangedRegionsIdleTimer = setTimeout(() => {
2496
+ this.restoreDeferredDiffUnchangedRegions();
2497
+ }, 1800);
2498
+ if (this.diffHideUnchangedRegionsDeferred) return;
2499
+ this.diffHideUnchangedRegionsDeferred = true;
2500
+ this.hideAllDiffUnchangedBridgeEntries();
2501
+ this.withLockedDiffScrollPosition(() => {
2502
+ var _this$diffEditorView15;
2503
+ (_this$diffEditorView15 = this.diffEditorView) === null || _this$diffEditorView15 === void 0 || _this$diffEditorView15.updateOptions({ hideUnchangedRegions: {
2504
+ ...hideUnchangedRegions,
2505
+ enabled: false
2506
+ } });
2507
+ });
2508
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
2509
+ }
2510
+ notifyThemeChange(themeName) {
2511
+ const resolvedThemeName = typeof themeName === "string" ? themeName : themeName === null || themeName === void 0 ? void 0 : themeName.name;
2512
+ if (typeof resolvedThemeName === "string") this.options.theme = resolvedThemeName;
2513
+ this.diffRootAppearanceSignature = null;
2514
+ this.clearPendingDiffThemeSync();
2515
+ if (this.lastContainer) {
2516
+ this.lastContainer.style.removeProperty("--stream-monaco-editor-bg");
2517
+ this.lastContainer.style.removeProperty("--stream-monaco-editor-fg");
2518
+ }
2519
+ const sync = () => {
2520
+ this.diffThemeSyncRafId = null;
2521
+ this.applyDiffRootAppearanceClass();
2522
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction(1);
2523
+ this.repositionDiffHunkNodes();
2524
+ };
2525
+ requestAnimationFrame(() => {
2526
+ this.diffThemeSyncRafId = requestAnimationFrame(sync);
2527
+ });
2528
+ }
1046
2529
  bindPersistOnMouseRelease(bucket, node) {
1047
2530
  this.createDomDisposable(bucket, node, "mousedown", (event) => {
1048
2531
  const mouseEvent = event;
@@ -1071,6 +2554,8 @@ var DiffEditorManager = class DiffEditorManager {
1071
2554
  this.rafScheduler.cancel("patch-diff-unchanged-regions");
1072
2555
  this.rafScheduler.cancel("capture-diff-unchanged-state");
1073
2556
  this.rafScheduler.cancel("restore-diff-unchanged-state");
2557
+ this.clearDeferredDiffUnchangedRegionsIdleTimer();
2558
+ this.diffHideUnchangedRegionsDeferred = false;
1074
2559
  }
1075
2560
  bindFocusVisibleClass(bucket, node) {
1076
2561
  this.createDomDisposable(bucket, node, "focus", () => node.classList.add("stream-monaco-focus-visible"));
@@ -1087,20 +2572,21 @@ var DiffEditorManager = class DiffEditorManager {
1087
2572
  }
1088
2573
  clearDiffUnchangedBridgeOverlay(removeContainer = true) {
1089
2574
  var _this$diffUnchangedBr;
1090
- if (this.lastContainer) {
1091
- const bridgedCenters = this.lastContainer.querySelectorAll(".stream-monaco-unchanged-bridge-source");
1092
- bridgedCenters.forEach((node) => node.classList.remove("stream-monaco-unchanged-bridge-source"));
1093
- }
2575
+ this.clearDiffUnchangedBridgeSources();
1094
2576
  if (this.diffUnchangedBridgeOverlay) this.diffUnchangedBridgeOverlay.replaceChildren();
1095
- if (this.diffUnchangedBridgeDisposables.length > 0) {
1096
- for (const d of this.diffUnchangedBridgeDisposables) try {
1097
- d.dispose();
1098
- } catch {}
1099
- this.diffUnchangedBridgeDisposables.length = 0;
1100
- }
2577
+ if (this.diffUnchangedBridgeOverlay) this.diffUnchangedBridgeOverlay.style.transform = "translate3d(0px, 0px, 0px)";
2578
+ this.diffUnchangedBridgeEntries.clear();
2579
+ this.diffUnchangedBridgePool.length = 0;
2580
+ this.diffUnchangedOverlayScrollTop = 0;
2581
+ this.diffUnchangedOverlayScrollLeft = 0;
1101
2582
  if (removeContainer && ((_this$diffUnchangedBr = this.diffUnchangedBridgeOverlay) === null || _this$diffUnchangedBr === void 0 ? void 0 : _this$diffUnchangedBr.parentElement)) this.diffUnchangedBridgeOverlay.remove();
1102
2583
  if (removeContainer) this.diffUnchangedBridgeOverlay = null;
1103
2584
  }
2585
+ clearDiffUnchangedBridgeSources() {
2586
+ if (!this.lastContainer) return;
2587
+ const bridgedCenters = this.lastContainer.querySelectorAll(".stream-monaco-unchanged-bridge-source");
2588
+ bridgedCenters.forEach((node) => node.classList.remove("stream-monaco-unchanged-bridge-source"));
2589
+ }
1104
2590
  ensureDiffUnchangedBridgeOverlay() {
1105
2591
  if (!this.lastContainer) return null;
1106
2592
  if (!this.diffUnchangedBridgeOverlay) {
@@ -1111,6 +2597,255 @@ var DiffEditorManager = class DiffEditorManager {
1111
2597
  }
1112
2598
  return this.diffUnchangedBridgeOverlay;
1113
2599
  }
2600
+ readDiffUnchangedOverlayScrollState() {
2601
+ var _this$diffEditorView16, _modifiedEditor$getSc6, _modifiedEditor$getSc7;
2602
+ const modifiedEditor = (_this$diffEditorView16 = this.diffEditorView) === null || _this$diffEditorView16 === void 0 ? void 0 : _this$diffEditorView16.getModifiedEditor();
2603
+ return {
2604
+ top: (modifiedEditor === null || modifiedEditor === void 0 || (_modifiedEditor$getSc6 = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc6 === void 0 ? void 0 : _modifiedEditor$getSc6.call(modifiedEditor)) ?? 0,
2605
+ left: (modifiedEditor === null || modifiedEditor === void 0 || (_modifiedEditor$getSc7 = modifiedEditor.getScrollLeft) === null || _modifiedEditor$getSc7 === void 0 ? void 0 : _modifiedEditor$getSc7.call(modifiedEditor)) ?? 0
2606
+ };
2607
+ }
2608
+ syncDiffUnchangedOverlayScrollBaseline() {
2609
+ const overlay = this.diffUnchangedBridgeOverlay;
2610
+ if (overlay) overlay.style.transform = "translate3d(0px, 0px, 0px)";
2611
+ const { top, left } = this.readDiffUnchangedOverlayScrollState();
2612
+ this.diffUnchangedOverlayScrollTop = top;
2613
+ this.diffUnchangedOverlayScrollLeft = left;
2614
+ }
2615
+ applyDiffUnchangedOverlayScrollCompensation() {
2616
+ const overlay = this.diffUnchangedBridgeOverlay;
2617
+ if (!overlay || overlay.hidden) return;
2618
+ const { top, left } = this.readDiffUnchangedOverlayScrollState();
2619
+ const deltaY = this.diffUnchangedOverlayScrollTop - top;
2620
+ const deltaX = this.diffUnchangedOverlayScrollLeft - left;
2621
+ if (Math.abs(deltaY) < .5 && Math.abs(deltaX) < .5) return;
2622
+ overlay.style.transform = `translate3d(${deltaX}px, ${deltaY}px, 0px)`;
2623
+ }
2624
+ resolveDiffUnchangedViewZoneHeight() {
2625
+ switch (this.resolveDiffUnchangedRegionStyleOption()) {
2626
+ case "line-info":
2627
+ case "line-info-basic":
2628
+ case "metadata": return 32;
2629
+ case "simple": return 28;
2630
+ default: return 32;
2631
+ }
2632
+ }
2633
+ collectDiffUnchangedViewZoneIds(editorRoot, scrollTop) {
2634
+ const widgetTopValues = Array.from(editorRoot.querySelectorAll(".diff-hidden-lines-widget")).map((node) => Number.parseFloat(node.style.top || "NaN")).filter((value) => Number.isFinite(value) && value > -1e5);
2635
+ if (widgetTopValues.length === 0) return [];
2636
+ return Array.from(editorRoot.querySelectorAll(".view-zones > div[monaco-view-zone][monaco-visible-view-zone=\"true\"]")).filter((node) => {
2637
+ const zoneTop = Number.parseFloat(node.style.top || "NaN");
2638
+ const currentHeight = Number.parseFloat(node.style.height || "0");
2639
+ return Number.isFinite(zoneTop) && Number.isFinite(currentHeight) && currentHeight > 0 && widgetTopValues.some((widgetTop) => Math.abs(zoneTop - scrollTop - widgetTop) < .5);
2640
+ }).map((node) => node.getAttribute("monaco-view-zone")).filter((value) => Boolean(value));
2641
+ }
2642
+ syncDiffUnchangedViewZoneHeightsForEditor(editor, editorRoot, targetHeight) {
2643
+ var _editor$getScrollTop, _editorInternal$_mode;
2644
+ if (!editor || !(editorRoot instanceof HTMLElement)) return false;
2645
+ const zoneIds = this.collectDiffUnchangedViewZoneIds(editorRoot, ((_editor$getScrollTop = editor.getScrollTop) === null || _editor$getScrollTop === void 0 ? void 0 : _editor$getScrollTop.call(editor)) ?? 0);
2646
+ if (zoneIds.length === 0) return false;
2647
+ const editorInternal = editor;
2648
+ const zones = (_editorInternal$_mode = editorInternal._modelData) === null || _editorInternal$_mode === void 0 || (_editorInternal$_mode = _editorInternal$_mode.view) === null || _editorInternal$_mode === void 0 || (_editorInternal$_mode = _editorInternal$_mode._viewZones) === null || _editorInternal$_mode === void 0 ? void 0 : _editorInternal$_mode._zones;
2649
+ if (!zones) return false;
2650
+ const changedZoneIds = zoneIds.filter((id) => {
2651
+ var _zones$id;
2652
+ const delegate = (_zones$id = zones[id]) === null || _zones$id === void 0 ? void 0 : _zones$id.delegate;
2653
+ return delegate && delegate.heightInPx !== targetHeight;
2654
+ });
2655
+ if (changedZoneIds.length === 0) return false;
2656
+ editor.changeViewZones((accessor) => {
2657
+ for (const id of changedZoneIds) {
2658
+ var _zones$id2;
2659
+ const delegate = (_zones$id2 = zones[id]) === null || _zones$id2 === void 0 ? void 0 : _zones$id2.delegate;
2660
+ if (!delegate) continue;
2661
+ delegate.heightInPx = targetHeight;
2662
+ accessor.layoutZone(id);
2663
+ }
2664
+ });
2665
+ return true;
2666
+ }
2667
+ syncDiffUnchangedViewZoneHeights() {
2668
+ var _originalEditor$getCo, _modifiedEditor$getCo3;
2669
+ if (!this.diffEditorView) return false;
2670
+ const targetHeight = this.resolveDiffUnchangedViewZoneHeight();
2671
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2672
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2673
+ const originalChanged = this.syncDiffUnchangedViewZoneHeightsForEditor(originalEditor, (_originalEditor$getCo = originalEditor.getContainerDomNode) === null || _originalEditor$getCo === void 0 ? void 0 : _originalEditor$getCo.call(originalEditor), targetHeight);
2674
+ const modifiedChanged = this.syncDiffUnchangedViewZoneHeightsForEditor(modifiedEditor, (_modifiedEditor$getCo3 = modifiedEditor.getContainerDomNode) === null || _modifiedEditor$getCo3 === void 0 ? void 0 : _modifiedEditor$getCo3.call(modifiedEditor), targetHeight);
2675
+ return originalChanged || modifiedChanged;
2676
+ }
2677
+ getDiffUnchangedNodeId(node) {
2678
+ const existingId = this.diffUnchangedNodeIds.get(node);
2679
+ if (existingId) return existingId;
2680
+ const nextId = `diff-unchanged-${++this.diffUnchangedNodeIdSequence}`;
2681
+ this.diffUnchangedNodeIds.set(node, nextId);
2682
+ return nextId;
2683
+ }
2684
+ getDiffUnchangedBridgeKey(secondaryNode, primaryNode) {
2685
+ return `${this.getDiffUnchangedNodeId(secondaryNode)}:${this.getDiffUnchangedNodeId(primaryNode)}`;
2686
+ }
2687
+ createDiffUnchangedBridgeEntry(key) {
2688
+ const bridge = document.createElement("div");
2689
+ bridge.className = "stream-monaco-diff-unchanged-bridge";
2690
+ bridge.setAttribute("role", "group");
2691
+ bridge.hidden = true;
2692
+ const summary = document.createElement("button");
2693
+ summary.type = "button";
2694
+ summary.className = "stream-monaco-unchanged-summary";
2695
+ const visualMeta = document.createElement("div");
2696
+ visualMeta.className = "stream-monaco-unchanged-meta";
2697
+ summary.append(visualMeta);
2698
+ const divider = document.createElement("span");
2699
+ divider.className = "stream-monaco-unchanged-pane-divider";
2700
+ divider.setAttribute("aria-hidden", "true");
2701
+ const entry = {
2702
+ key,
2703
+ bridge,
2704
+ rail: null,
2705
+ summary,
2706
+ visualMeta,
2707
+ divider,
2708
+ activate: () => {},
2709
+ topButton: null,
2710
+ bottomButton: null
2711
+ };
2712
+ summary.onclick = (event) => {
2713
+ event.preventDefault();
2714
+ this.activateDiffUnchangedBridgeEntry(entry);
2715
+ };
2716
+ const onWheel = (event) => {
2717
+ var _modifiedEditor$getSc8, _modifiedEditor$getSc9, _originalEditor$setSc6, _modifiedEditor$setSc6;
2718
+ if (!this.diffEditorView) return;
2719
+ if (Math.abs(event.deltaY) < .5 && Math.abs(event.deltaX) < .5) return;
2720
+ event.preventDefault();
2721
+ event.stopPropagation();
2722
+ const originalEditor = this.diffEditorView.getOriginalEditor();
2723
+ const modifiedEditor = this.diffEditorView.getModifiedEditor();
2724
+ const targetScrollTop = (((_modifiedEditor$getSc8 = modifiedEditor.getScrollTop) === null || _modifiedEditor$getSc8 === void 0 ? void 0 : _modifiedEditor$getSc8.call(modifiedEditor)) ?? 0) + event.deltaY;
2725
+ const targetScrollLeft = (((_modifiedEditor$getSc9 = modifiedEditor.getScrollLeft) === null || _modifiedEditor$getSc9 === void 0 ? void 0 : _modifiedEditor$getSc9.call(modifiedEditor)) ?? 0) + event.deltaX;
2726
+ (_originalEditor$setSc6 = originalEditor.setScrollTop) === null || _originalEditor$setSc6 === void 0 || _originalEditor$setSc6.call(originalEditor, targetScrollTop);
2727
+ (_modifiedEditor$setSc6 = modifiedEditor.setScrollTop) === null || _modifiedEditor$setSc6 === void 0 || _modifiedEditor$setSc6.call(modifiedEditor, targetScrollTop);
2728
+ if (Math.abs(event.deltaX) >= .5) {
2729
+ var _originalEditor$setSc7, _modifiedEditor$setSc7;
2730
+ (_originalEditor$setSc7 = originalEditor.setScrollLeft) === null || _originalEditor$setSc7 === void 0 || _originalEditor$setSc7.call(originalEditor, targetScrollLeft);
2731
+ (_modifiedEditor$setSc7 = modifiedEditor.setScrollLeft) === null || _modifiedEditor$setSc7 === void 0 || _modifiedEditor$setSc7.call(modifiedEditor, targetScrollLeft);
2732
+ }
2733
+ this.schedulePatchDiffUnchangedRegionsAfterScroll();
2734
+ };
2735
+ bridge.addEventListener("wheel", onWheel, { passive: false });
2736
+ this.diffUnchangedRegionDisposables.push({ dispose: () => bridge.removeEventListener("wheel", onWheel) });
2737
+ bridge.append(summary, divider);
2738
+ return entry;
2739
+ }
2740
+ acquireDiffUnchangedBridgeEntry(key) {
2741
+ const existing = this.diffUnchangedBridgeEntries.get(key);
2742
+ if (existing) return existing;
2743
+ const entry = this.diffUnchangedBridgePool.pop() ?? this.createDiffUnchangedBridgeEntry(key);
2744
+ entry.key = key;
2745
+ entry.bridge.hidden = false;
2746
+ entry.bridge.removeAttribute("aria-hidden");
2747
+ this.diffUnchangedBridgeEntries.set(key, entry);
2748
+ return entry;
2749
+ }
2750
+ releaseDiffUnchangedBridgeEntry(entry) {
2751
+ if (entry.key) this.diffUnchangedBridgeEntries.delete(entry.key);
2752
+ entry.key = null;
2753
+ entry.bridge.hidden = true;
2754
+ entry.bridge.setAttribute("aria-hidden", "true");
2755
+ this.diffUnchangedBridgePool.push(entry);
2756
+ }
2757
+ hideAllDiffUnchangedBridgeEntries() {
2758
+ for (const entry of Array.from(this.diffUnchangedBridgeEntries.values())) this.releaseDiffUnchangedBridgeEntry(entry);
2759
+ this.clearDiffUnchangedBridgeSources();
2760
+ }
2761
+ schedulePatchDiffUnchangedRegionsAfterInteraction(frames = 1) {
2762
+ this.rafScheduler.schedule("patch-diff-unchanged-regions-after-interaction", () => {
2763
+ let remaining = Math.max(0, frames);
2764
+ const step = () => {
2765
+ if (remaining > 0) {
2766
+ remaining--;
2767
+ requestAnimationFrame(step);
2768
+ return;
2769
+ }
2770
+ this.schedulePatchDiffUnchangedRegions();
2771
+ };
2772
+ step();
2773
+ });
2774
+ }
2775
+ activateDiffUnchangedBridgeEntry(entry) {
2776
+ this.hideAllDiffUnchangedBridgeEntries();
2777
+ entry.activate();
2778
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction();
2779
+ }
2780
+ updateDiffUnchangedBridgeMeta(entry, unchangedRegionStyle, summaryLabel) {
2781
+ this.updateDiffUnchangedMetaNode(entry.visualMeta, unchangedRegionStyle, summaryLabel);
2782
+ }
2783
+ updateDiffUnchangedMetaNode(metaNode, unchangedRegionStyle, summaryLabel) {
2784
+ const lastStyle = metaNode.dataset.style;
2785
+ const lastLabel = metaNode.dataset.label;
2786
+ if (lastStyle === unchangedRegionStyle && lastLabel === summaryLabel) return;
2787
+ metaNode.dataset.style = unchangedRegionStyle;
2788
+ metaNode.dataset.label = summaryLabel;
2789
+ metaNode.replaceChildren();
2790
+ metaNode.classList.toggle("stream-monaco-unchanged-meta-simple", unchangedRegionStyle === "simple");
2791
+ if (unchangedRegionStyle === "simple") {
2792
+ const simpleBar = document.createElement("span");
2793
+ simpleBar.className = "stream-monaco-unchanged-simple-bar";
2794
+ simpleBar.setAttribute("aria-hidden", "true");
2795
+ metaNode.append(simpleBar);
2796
+ return;
2797
+ }
2798
+ const label = document.createElement("span");
2799
+ if (unchangedRegionStyle === "metadata") label.className = "stream-monaco-unchanged-metadata-label";
2800
+ else label.className = "stream-monaco-unchanged-count";
2801
+ label.textContent = summaryLabel;
2802
+ metaNode.append(label);
2803
+ }
2804
+ syncDiffUnchangedRevealButton(entry, slot, handle, direction, label) {
2805
+ const existingButton = entry[slot];
2806
+ const button = existingButton ?? document.createElement("button");
2807
+ if (!existingButton) {
2808
+ button.type = "button";
2809
+ button.className = "stream-monaco-unchanged-reveal";
2810
+ button.innerHTML = `<span class="codicon codicon-chevron-${direction}"></span>`;
2811
+ }
2812
+ button.dataset.direction = direction;
2813
+ button.hidden = !handle;
2814
+ button.disabled = !handle;
2815
+ button.toggleAttribute("aria-hidden", !handle);
2816
+ button.title = handle ? label : "";
2817
+ button.setAttribute("aria-label", handle ? label : "");
2818
+ button.onclick = handle ? (event) => {
2819
+ event.preventDefault();
2820
+ event.stopPropagation();
2821
+ this.hideAllDiffUnchangedBridgeEntries();
2822
+ this.activateDiffUnchangedHandle(handle);
2823
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction();
2824
+ } : null;
2825
+ entry[slot] = button;
2826
+ }
2827
+ syncDiffUnchangedBridgeRail(entry, showTopHandle, topHandle, showBottomHandle, bottomHandle) {
2828
+ if (!entry.rail) {
2829
+ entry.rail = document.createElement("div");
2830
+ entry.rail.className = "stream-monaco-unchanged-rail";
2831
+ }
2832
+ const shouldRenderRail = showTopHandle || showBottomHandle;
2833
+ this.syncDiffUnchangedRevealButton(entry, "topButton", showTopHandle ? topHandle : null, "down", "Reveal more unmodified lines below");
2834
+ this.syncDiffUnchangedRevealButton(entry, "bottomButton", showBottomHandle ? bottomHandle : null, "up", "Reveal more unmodified lines above");
2835
+ entry.rail.hidden = !shouldRenderRail;
2836
+ entry.rail.toggleAttribute("aria-hidden", !shouldRenderRail);
2837
+ entry.rail.classList.toggle("stream-monaco-unchanged-rail-top-only", showTopHandle && !showBottomHandle);
2838
+ entry.rail.classList.toggle("stream-monaco-unchanged-rail-bottom-only", !showTopHandle && showBottomHandle);
2839
+ entry.rail.classList.toggle("stream-monaco-unchanged-rail-both", showTopHandle && showBottomHandle);
2840
+ if (entry.topButton && entry.topButton.parentElement !== entry.rail) entry.rail.append(entry.topButton);
2841
+ if (entry.bottomButton && entry.bottomButton.parentElement !== entry.rail) entry.rail.append(entry.bottomButton);
2842
+ }
2843
+ pruneDiffUnchangedBridgeEntries(visibleKeys) {
2844
+ for (const [key, entry] of Array.from(this.diffUnchangedBridgeEntries)) {
2845
+ if (visibleKeys.has(key)) continue;
2846
+ this.releaseDiffUnchangedBridgeEntry(entry);
2847
+ }
2848
+ }
1114
2849
  dispatchSyntheticMouseDown(node) {
1115
2850
  const view = node.ownerDocument.defaultView;
1116
2851
  if (!view) return;
@@ -1123,14 +2858,152 @@ var DiffEditorManager = class DiffEditorManager {
1123
2858
  clientY: rect.top + rect.height / 2
1124
2859
  }));
1125
2860
  }
2861
+ dispatchSyntheticMouseTap(node) {
2862
+ const view = node.ownerDocument.defaultView;
2863
+ if (!view) return;
2864
+ const rect = node.getBoundingClientRect();
2865
+ const clientX = rect.left + rect.width / 2;
2866
+ const clientY = rect.top + rect.height / 2;
2867
+ node.dispatchEvent(new view.MouseEvent("mousedown", {
2868
+ bubbles: true,
2869
+ cancelable: true,
2870
+ button: 0,
2871
+ clientX,
2872
+ clientY
2873
+ }));
2874
+ node.dispatchEvent(new view.MouseEvent("mouseup", {
2875
+ bubbles: true,
2876
+ cancelable: true,
2877
+ button: 0,
2878
+ clientX,
2879
+ clientY
2880
+ }));
2881
+ }
2882
+ formatDiffUnchangedCountLabel(text) {
2883
+ const match = text.match(/\d+/);
2884
+ const count = match ? Number.parseInt(match[0], 10) : NaN;
2885
+ if (Number.isFinite(count)) return `${count} unmodified ${count === 1 ? "line" : "lines"}`;
2886
+ return text.replace(/hidden/gi, "unmodified");
2887
+ }
2888
+ countDiffLines(startLineNumber, endLineNumber) {
2889
+ return endLineNumber >= startLineNumber ? endLineNumber - startLineNumber + 1 : 0;
2890
+ }
2891
+ measureDiffUnchangedSurroundingLines(primaryNode) {
2892
+ const editorRoot = primaryNode.closest(".editor.modified") ?? primaryNode.closest(".monaco-editor");
2893
+ if (!editorRoot) return {
2894
+ previousVisibleLine: null,
2895
+ nextVisibleLine: null
2896
+ };
2897
+ const widgetRect = primaryNode.getBoundingClientRect();
2898
+ let previousVisibleLine = null;
2899
+ let nextVisibleLine = null;
2900
+ const lineNumberNodes = editorRoot.querySelectorAll(".line-numbers");
2901
+ lineNumberNodes.forEach((node) => {
2902
+ var _node$textContent3;
2903
+ const lineNumber = Number.parseInt(((_node$textContent3 = node.textContent) === null || _node$textContent3 === void 0 ? void 0 : _node$textContent3.trim()) || "", 10);
2904
+ if (!Number.isFinite(lineNumber)) return;
2905
+ const top = node.getBoundingClientRect().top;
2906
+ if (top < widgetRect.top - 1) previousVisibleLine = previousVisibleLine == null ? lineNumber : Math.max(previousVisibleLine, lineNumber);
2907
+ else if (top > widgetRect.bottom + 1) nextVisibleLine = nextVisibleLine == null ? lineNumber : Math.min(nextVisibleLine, lineNumber);
2908
+ });
2909
+ return {
2910
+ previousVisibleLine,
2911
+ nextVisibleLine
2912
+ };
2913
+ }
2914
+ formatDiffMetadataRange(startLineNumber, lineCount) {
2915
+ return `${startLineNumber},${Math.max(0, lineCount)}`;
2916
+ }
2917
+ buildDiffHunkMetadataLabel(change) {
2918
+ var _this$originalModel, _this$modifiedModel2;
2919
+ const contextLineCount = this.resolveDiffHideUnchangedRegionsOption().contextLineCount ?? 3;
2920
+ const originalTotalLines = ((_this$originalModel = this.originalModel) === null || _this$originalModel === void 0 ? void 0 : _this$originalModel.getLineCount()) ?? 0;
2921
+ const modifiedTotalLines = ((_this$modifiedModel2 = this.modifiedModel) === null || _this$modifiedModel2 === void 0 ? void 0 : _this$modifiedModel2.getLineCount()) ?? 0;
2922
+ const originalChangedCount = this.countDiffLines(change.originalStartLineNumber, change.originalEndLineNumber);
2923
+ const modifiedChangedCount = this.countDiffLines(change.modifiedStartLineNumber, change.modifiedEndLineNumber);
2924
+ const originalAnchor = Math.min(Math.max(change.originalStartLineNumber, 1), Math.max(1, originalTotalLines + 1));
2925
+ const modifiedAnchor = Math.min(Math.max(change.modifiedStartLineNumber, 1), Math.max(1, modifiedTotalLines + 1));
2926
+ const originalStart = Math.max(1, originalAnchor - contextLineCount);
2927
+ const modifiedStart = Math.max(1, modifiedAnchor - contextLineCount);
2928
+ const originalEnd = originalChangedCount > 0 ? Math.min(originalTotalLines, change.originalEndLineNumber + contextLineCount) : Math.min(originalTotalLines, originalAnchor + contextLineCount - 1);
2929
+ const modifiedEnd = modifiedChangedCount > 0 ? Math.min(modifiedTotalLines, change.modifiedEndLineNumber + contextLineCount) : Math.min(modifiedTotalLines, modifiedAnchor + contextLineCount - 1);
2930
+ const originalDisplayCount = originalEnd >= originalStart ? originalEnd - originalStart + 1 : 0;
2931
+ const modifiedDisplayCount = modifiedEnd >= modifiedStart ? modifiedEnd - modifiedStart + 1 : 0;
2932
+ return {
2933
+ modifiedStart,
2934
+ originalStart,
2935
+ label: `@@ -${this.formatDiffMetadataRange(originalStart, originalDisplayCount)} +${this.formatDiffMetadataRange(modifiedStart, modifiedDisplayCount)} @@`
2936
+ };
2937
+ }
2938
+ resolveDiffMetadataLabel(primaryNode, pairIndex) {
2939
+ var _metadataEntries$Math;
2940
+ const lineChanges = this.getEffectiveLineChanges();
2941
+ if (lineChanges.length === 0) return null;
2942
+ const metadataEntries = lineChanges.map((change) => this.buildDiffHunkMetadataLabel(change));
2943
+ const { nextVisibleLine } = this.measureDiffUnchangedSurroundingLines(primaryNode);
2944
+ if (nextVisibleLine != null) {
2945
+ const candidateStarts = [nextVisibleLine, nextVisibleLine - 1].filter((value) => value >= 1);
2946
+ for (const candidateStart of candidateStarts) {
2947
+ const matching = metadataEntries.find((entry) => entry.modifiedStart === candidateStart);
2948
+ if (matching) return matching.label;
2949
+ }
2950
+ }
2951
+ return ((_metadataEntries$Math = metadataEntries[Math.min(pairIndex, metadataEntries.length - 1)]) === null || _metadataEntries$Math === void 0 ? void 0 : _metadataEntries$Math.label) ?? null;
2952
+ }
2953
+ activateDiffUnchangedHandle(node) {
2954
+ if (!(node instanceof HTMLElement)) return;
2955
+ this.dispatchSyntheticMouseTap(node);
2956
+ this.scheduleCapturePersistedDiffUnchangedState(1);
2957
+ }
2958
+ resolveDiffUnchangedRevealLayout(primaryNode, countText, pairIndex, pairCount) {
2959
+ var _this$diffEditorView17, _this$diffEditorView18;
2960
+ let showTopHandle = pairCount === 1 || pairIndex > 0;
2961
+ let showBottomHandle = pairCount === 1 || pairIndex < pairCount - 1;
2962
+ const countMatch = countText.match(/\d+/);
2963
+ const hiddenCount = countMatch ? Number.parseInt(countMatch[0], 10) : NaN;
2964
+ if (!Number.isFinite(hiddenCount)) return {
2965
+ showTopHandle,
2966
+ showBottomHandle
2967
+ };
2968
+ const { previousVisibleLine, nextVisibleLine } = this.measureDiffUnchangedSurroundingLines(primaryNode);
2969
+ if (previousVisibleLine == null && nextVisibleLine != null) {
2970
+ showTopHandle = false;
2971
+ showBottomHandle = true;
2972
+ return {
2973
+ showTopHandle,
2974
+ showBottomHandle
2975
+ };
2976
+ }
2977
+ if (nextVisibleLine == null && previousVisibleLine != null) {
2978
+ showTopHandle = true;
2979
+ showBottomHandle = false;
2980
+ return {
2981
+ showTopHandle,
2982
+ showBottomHandle
2983
+ };
2984
+ }
2985
+ if (nextVisibleLine != null && nextVisibleLine - hiddenCount === 1) {
2986
+ showTopHandle = false;
2987
+ showBottomHandle = true;
2988
+ }
2989
+ const modelLineCount = ((_this$diffEditorView17 = this.diffEditorView) === null || _this$diffEditorView17 === void 0 || (_this$diffEditorView17 = _this$diffEditorView17.getModifiedEditor().getModel()) === null || _this$diffEditorView17 === void 0 || (_this$diffEditorView18 = _this$diffEditorView17.getLineCount) === null || _this$diffEditorView18 === void 0 ? void 0 : _this$diffEditorView18.call(_this$diffEditorView17)) ?? null;
2990
+ if (previousVisibleLine != null && modelLineCount != null && previousVisibleLine + hiddenCount === modelLineCount) {
2991
+ showTopHandle = true;
2992
+ showBottomHandle = false;
2993
+ }
2994
+ return {
2995
+ showTopHandle,
2996
+ showBottomHandle
2997
+ };
2998
+ }
1126
2999
  resolveDiffUnchangedMergeRole(node) {
1127
- var _this$diffEditorView, _this$diffEditorView$, _this$diffEditorView$2, _this$diffEditorView2, _this$diffEditorView3, _this$diffEditorView4;
3000
+ var _this$diffEditorView19, _this$diffEditorView20, _this$diffEditorView21, _this$diffEditorView22, _this$diffEditorView23, _this$diffEditorView24;
1128
3001
  const diffRoot = node.closest(".monaco-diff-editor.side-by-side");
1129
3002
  if (!(diffRoot instanceof HTMLElement)) return "none";
1130
3003
  const nodeRect = node.getBoundingClientRect();
1131
3004
  const nodeCenter = nodeRect.left + nodeRect.width / 2;
1132
- const originalHost = (_this$diffEditorView = this.diffEditorView) === null || _this$diffEditorView === void 0 || (_this$diffEditorView$2 = (_this$diffEditorView$ = _this$diffEditorView.getOriginalEditor()).getContainerDomNode) === null || _this$diffEditorView$2 === void 0 ? void 0 : _this$diffEditorView$2.call(_this$diffEditorView$);
1133
- const modifiedHost = (_this$diffEditorView2 = this.diffEditorView) === null || _this$diffEditorView2 === void 0 || (_this$diffEditorView4 = (_this$diffEditorView3 = _this$diffEditorView2.getModifiedEditor()).getContainerDomNode) === null || _this$diffEditorView4 === void 0 ? void 0 : _this$diffEditorView4.call(_this$diffEditorView3);
3005
+ const originalHost = (_this$diffEditorView19 = this.diffEditorView) === null || _this$diffEditorView19 === void 0 || (_this$diffEditorView21 = (_this$diffEditorView20 = _this$diffEditorView19.getOriginalEditor()).getContainerDomNode) === null || _this$diffEditorView21 === void 0 ? void 0 : _this$diffEditorView21.call(_this$diffEditorView20);
3006
+ const modifiedHost = (_this$diffEditorView22 = this.diffEditorView) === null || _this$diffEditorView22 === void 0 || (_this$diffEditorView24 = (_this$diffEditorView23 = _this$diffEditorView22.getModifiedEditor()).getContainerDomNode) === null || _this$diffEditorView24 === void 0 ? void 0 : _this$diffEditorView24.call(_this$diffEditorView23);
1134
3007
  if (originalHost instanceof HTMLElement && modifiedHost instanceof HTMLElement) {
1135
3008
  const originalRect = originalHost.getBoundingClientRect();
1136
3009
  const modifiedRect = modifiedHost.getBoundingClientRect();
@@ -1141,39 +3014,39 @@ var DiffEditorManager = class DiffEditorManager {
1141
3014
  const diffRect = diffRoot.getBoundingClientRect();
1142
3015
  return nodeCenter < diffRect.left + diffRect.width / 2 ? "secondary" : "primary";
1143
3016
  }
1144
- patchDiffUnchangedCenter(node) {
3017
+ patchDiffUnchangedCenter(node, pairIndex = 0) {
1145
3018
  node.classList.add("stream-monaco-clickable");
1146
- node.title = "Click to expand all hidden unchanged lines";
3019
+ node.title = "Click to expand all unmodified lines";
1147
3020
  const mergeRole = this.resolveDiffUnchangedMergeRole(node);
1148
3021
  const shouldUseMergedSecondary = mergeRole === "secondary";
3022
+ const unchangedRegionStyle = this.resolveDiffUnchangedRegionStyleOption();
1149
3023
  node.classList.toggle("stream-monaco-unchanged-merged-secondary", shouldUseMergedSecondary);
1150
3024
  node.classList.toggle("stream-monaco-unchanged-merged-primary", mergeRole === "primary");
1151
3025
  const primary = node.children.item(0);
1152
3026
  const meta = node.children.item(1);
1153
3027
  if (primary instanceof HTMLElement) primary.classList.add("stream-monaco-unchanged-primary");
1154
3028
  if (meta instanceof HTMLElement) {
3029
+ var _countSource$textCont;
1155
3030
  meta.classList.add("stream-monaco-unchanged-meta");
1156
- const metaChildren = Array.from(meta.children);
1157
- metaChildren.forEach((child, index) => {
1158
- if (!(child instanceof HTMLElement)) return;
1159
- child.classList.remove("stream-monaco-unchanged-count", "stream-monaco-unchanged-separator", "stream-monaco-unchanged-breadcrumb");
1160
- if (index === 0) child.classList.add("stream-monaco-unchanged-count");
1161
- else if (child.classList.contains("breadcrumb-item")) child.classList.add("stream-monaco-unchanged-breadcrumb");
1162
- else child.classList.add("stream-monaco-unchanged-separator");
1163
- });
3031
+ const countSource = meta.querySelector(".count") ?? meta.firstElementChild;
3032
+ const countText = this.formatDiffUnchangedCountLabel((countSource === null || countSource === void 0 || (_countSource$textCont = countSource.textContent) === null || _countSource$textCont === void 0 ? void 0 : _countSource$textCont.trim()) || "Unmodified lines");
3033
+ const summaryLabel = unchangedRegionStyle === "metadata" ? this.resolveDiffMetadataLabel(node, pairIndex) ?? countText : countText;
3034
+ this.updateDiffUnchangedMetaNode(meta, unchangedRegionStyle, summaryLabel);
1164
3035
  }
1165
3036
  const action = node.querySelector("a");
1166
3037
  if (action instanceof HTMLElement) {
1167
3038
  action.classList.add("stream-monaco-unchanged-expand");
1168
3039
  action.dataset.streamMonacoLabel = "Expand all";
1169
- action.title = "Expand all hidden lines";
1170
- action.setAttribute("aria-label", "Expand all hidden lines");
3040
+ action.title = "Expand all unmodified lines";
3041
+ action.setAttribute("aria-label", "Expand all unmodified lines");
1171
3042
  action.toggleAttribute("aria-hidden", shouldUseMergedSecondary);
1172
3043
  action.tabIndex = shouldUseMergedSecondary ? -1 : 0;
1173
3044
  if (action.dataset.streamMonacoExpandPatched !== "true") {
1174
3045
  action.dataset.streamMonacoExpandPatched = "true";
1175
3046
  this.createDomDisposable(this.diffUnchangedRegionDisposables, action, "click", () => {
3047
+ this.hideAllDiffUnchangedBridgeEntries();
1176
3048
  this.scheduleCapturePersistedDiffUnchangedState(1);
3049
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction();
1177
3050
  });
1178
3051
  }
1179
3052
  }
@@ -1190,83 +3063,100 @@ var DiffEditorManager = class DiffEditorManager {
1190
3063
  const target = event.target instanceof HTMLElement ? event.target : null;
1191
3064
  if (target === null || target === void 0 ? void 0 : target.closest("a, .breadcrumb-item")) return;
1192
3065
  event.preventDefault();
3066
+ this.hideAllDiffUnchangedBridgeEntries();
1193
3067
  activate();
1194
3068
  this.scheduleCapturePersistedDiffUnchangedState(1);
3069
+ this.schedulePatchDiffUnchangedRegionsAfterInteraction();
1195
3070
  });
1196
3071
  }
1197
3072
  }
1198
- renderMergedDiffUnchangedBridge(secondaryNode, primaryNode) {
1199
- var _countSource$textCont;
1200
- if (!this.lastContainer) return;
3073
+ renderMergedDiffUnchangedBridge(secondaryNode, primaryNode, pairIndex, pairCount) {
3074
+ var _countSource$textCont2, _secondaryNode$closes;
3075
+ if (!this.lastContainer) return null;
1201
3076
  const overlay = this.ensureDiffUnchangedBridgeOverlay();
1202
- if (!overlay) return;
3077
+ if (!overlay) return null;
1203
3078
  const containerRect = this.lastContainer.getBoundingClientRect();
1204
3079
  const secondaryRect = secondaryNode.getBoundingClientRect();
1205
3080
  const primaryRect = primaryNode.getBoundingClientRect();
1206
3081
  const primaryStyle = globalThis.getComputedStyle(primaryNode);
1207
- const primaryAction = primaryNode.querySelector(".stream-monaco-unchanged-expand");
1208
- const primaryActionRect = primaryAction === null || primaryAction === void 0 ? void 0 : primaryAction.getBoundingClientRect();
1209
3082
  const countSource = primaryNode.querySelector(".stream-monaco-unchanged-count") ?? secondaryNode.querySelector(".stream-monaco-unchanged-count");
1210
- const countText = (countSource === null || countSource === void 0 || (_countSource$textCont = countSource.textContent) === null || _countSource$textCont === void 0 ? void 0 : _countSource$textCont.trim()) || "Hidden lines";
3083
+ const countText = this.formatDiffUnchangedCountLabel((countSource === null || countSource === void 0 || (_countSource$textCont2 = countSource.textContent) === null || _countSource$textCont2 === void 0 ? void 0 : _countSource$textCont2.trim()) || "Unmodified lines");
3084
+ const unchangedRegionStyle = this.resolveDiffUnchangedRegionStyleOption();
3085
+ const metadataLabel = unchangedRegionStyle === "metadata" ? this.resolveDiffMetadataLabel(primaryNode, pairIndex) : null;
1211
3086
  const editorSurface = primaryNode.closest(".monaco-editor") ?? primaryNode;
1212
3087
  const editorSurfaceStyle = globalThis.getComputedStyle(editorSurface);
3088
+ const primaryHidden = primaryNode.parentElement;
3089
+ const secondaryHidden = secondaryNode.parentElement;
3090
+ const primaryWidget = primaryHidden === null || primaryHidden === void 0 ? void 0 : primaryHidden.parentElement;
3091
+ const secondaryWidget = secondaryHidden === null || secondaryHidden === void 0 ? void 0 : secondaryHidden.parentElement;
3092
+ const topHandle = (primaryHidden === null || primaryHidden === void 0 ? void 0 : primaryHidden.querySelector(".top")) ?? (secondaryHidden === null || secondaryHidden === void 0 ? void 0 : secondaryHidden.querySelector(".top"));
3093
+ const bottomHandle = (primaryHidden === null || primaryHidden === void 0 ? void 0 : primaryHidden.querySelector(".bottom")) ?? (secondaryHidden === null || secondaryHidden === void 0 ? void 0 : secondaryHidden.querySelector(".bottom"));
3094
+ const { showTopHandle, showBottomHandle } = this.resolveDiffUnchangedRevealLayout(primaryNode, countText, pairIndex, pairCount);
3095
+ const key = this.getDiffUnchangedBridgeKey(secondaryNode, primaryNode);
1213
3096
  secondaryNode.classList.add("stream-monaco-unchanged-bridge-source");
1214
3097
  primaryNode.classList.add("stream-monaco-unchanged-bridge-source");
1215
- const bridge = document.createElement("div");
3098
+ const entry = this.acquireDiffUnchangedBridgeEntry(key);
3099
+ const { bridge, summary, divider } = entry;
1216
3100
  bridge.className = "stream-monaco-diff-unchanged-bridge";
1217
- bridge.tabIndex = 0;
1218
- bridge.setAttribute("role", "button");
1219
- bridge.setAttribute("aria-label", `${countText}. Expand all hidden lines`);
1220
- bridge.title = "Expand all hidden lines";
1221
- bridge.style.left = `${secondaryRect.left - containerRect.left}px`;
1222
- bridge.style.top = `${primaryRect.top - containerRect.top}px`;
1223
- bridge.style.width = `${primaryRect.right - secondaryRect.left}px`;
1224
- bridge.style.height = `${Math.max(secondaryRect.height, primaryRect.height)}px`;
3101
+ bridge.classList.add(`stream-monaco-diff-unchanged-bridge-${unchangedRegionStyle}`);
3102
+ const secondaryAnchorRect = (secondaryWidget === null || secondaryWidget === void 0 ? void 0 : secondaryWidget.getBoundingClientRect()) ?? secondaryRect;
3103
+ const primaryAnchorRect = (primaryWidget === null || primaryWidget === void 0 ? void 0 : primaryWidget.getBoundingClientRect()) ?? primaryRect;
3104
+ const secondaryMargin = (_secondaryNode$closes = secondaryNode.closest(".monaco-editor")) === null || _secondaryNode$closes === void 0 ? void 0 : _secondaryNode$closes.querySelector(".margin");
3105
+ const secondaryMarginRect = secondaryMargin === null || secondaryMargin === void 0 ? void 0 : secondaryMargin.getBoundingClientRect();
3106
+ const lineInfoRailMetrics = unchangedRegionStyle === "line-info" ? this.resolveDiffUnchangedLineInfoRailMetrics(secondaryNode) : null;
3107
+ const bridgeLeftInset = (lineInfoRailMetrics === null || lineInfoRailMetrics === void 0 ? void 0 : lineInfoRailMetrics.leftInset) ?? 0;
3108
+ const bridgeRailWidth = (lineInfoRailMetrics === null || lineInfoRailMetrics === void 0 ? void 0 : lineInfoRailMetrics.width) ?? (secondaryMarginRect === null || secondaryMarginRect === void 0 ? void 0 : secondaryMarginRect.width) ?? null;
3109
+ bridge.style.left = `${secondaryAnchorRect.left - containerRect.left + this.lastContainer.scrollLeft + bridgeLeftInset}px`;
3110
+ bridge.style.top = `${primaryAnchorRect.top - containerRect.top + this.lastContainer.scrollTop}px`;
3111
+ bridge.style.width = `${Math.max(0, primaryAnchorRect.right - secondaryAnchorRect.left - bridgeLeftInset)}px`;
3112
+ bridge.style.height = `${Math.max(secondaryAnchorRect.height, primaryAnchorRect.height)}px`;
1225
3113
  bridge.style.color = primaryStyle.color;
1226
3114
  bridge.style.fontFamily = primaryStyle.fontFamily;
1227
3115
  bridge.style.fontSize = primaryStyle.fontSize;
1228
3116
  bridge.style.lineHeight = primaryStyle.lineHeight;
1229
3117
  bridge.style.setProperty("--stream-monaco-unchanged-fg", primaryStyle.color);
1230
3118
  bridge.style.setProperty("--stream-monaco-editor-bg", editorSurfaceStyle.backgroundColor);
1231
- const visualPrimary = document.createElement("span");
1232
- visualPrimary.className = "stream-monaco-unchanged-primary";
1233
- const visualAction = document.createElement("span");
1234
- visualAction.className = "stream-monaco-unchanged-expand";
1235
- visualAction.dataset.streamMonacoLabel = "Expand all";
1236
- visualAction.setAttribute("aria-hidden", "true");
1237
- visualAction.innerHTML = "<span class=\"codicon codicon-unfold\"></span>";
1238
- visualPrimary.append(visualAction);
1239
- const visualMeta = document.createElement("div");
1240
- visualMeta.className = "stream-monaco-unchanged-meta";
1241
- const visualCount = document.createElement("span");
1242
- visualCount.className = "stream-monaco-unchanged-count";
1243
- visualCount.textContent = countText;
1244
- visualMeta.append(visualCount);
1245
- const spacer = document.createElement("span");
1246
- spacer.className = "stream-monaco-unchanged-spacer";
1247
- spacer.style.width = `${(primaryActionRect === null || primaryActionRect === void 0 ? void 0 : primaryActionRect.width) ?? 102}px`;
1248
- bridge.append(visualPrimary, visualMeta, spacer);
1249
- overlay.append(bridge);
1250
- this.bindFocusVisibleClass(this.diffUnchangedBridgeDisposables, bridge);
1251
- const activate = () => {
3119
+ bridge.style.setProperty("--stream-monaco-unchanged-split-offset", `${Math.max(0, secondaryAnchorRect.width - bridgeLeftInset)}px`);
3120
+ if (bridgeRailWidth) bridge.style.setProperty("--stream-monaco-unchanged-rail-width", `${bridgeRailWidth}px`);
3121
+ else bridge.style.removeProperty("--stream-monaco-unchanged-rail-width");
3122
+ summary.classList.remove("stream-monaco-unchanged-summary-line-info", "stream-monaco-unchanged-summary-line-info-basic", "stream-monaco-unchanged-summary-metadata", "stream-monaco-unchanged-summary-simple");
3123
+ summary.classList.add(`stream-monaco-unchanged-summary-${unchangedRegionStyle}`);
3124
+ const summaryLabel = metadataLabel || countText;
3125
+ const summaryInteractive = unchangedRegionStyle === "line-info" || unchangedRegionStyle === "line-info-basic";
3126
+ summary.disabled = !summaryInteractive;
3127
+ summary.tabIndex = summaryInteractive ? 0 : -1;
3128
+ if (summaryInteractive) {
3129
+ summary.removeAttribute("aria-hidden");
3130
+ summary.setAttribute("aria-label", `${summaryLabel}. Expand all unmodified lines`);
3131
+ summary.title = "Expand all unmodified lines";
3132
+ } else if (unchangedRegionStyle === "simple") {
3133
+ summary.setAttribute("aria-hidden", "true");
3134
+ summary.removeAttribute("aria-label");
3135
+ summary.title = "";
3136
+ } else {
3137
+ summary.removeAttribute("aria-hidden");
3138
+ summary.removeAttribute("aria-label");
3139
+ summary.title = "";
3140
+ }
3141
+ this.updateDiffUnchangedBridgeMeta(entry, unchangedRegionStyle, summaryLabel);
3142
+ if (unchangedRegionStyle === "line-info" || unchangedRegionStyle === "line-info-basic") {
3143
+ this.syncDiffUnchangedBridgeRail(entry, showTopHandle, topHandle ?? null, showBottomHandle, bottomHandle ?? null);
3144
+ if (entry.rail && entry.rail.parentElement !== bridge) bridge.prepend(entry.rail);
3145
+ } else if (entry.rail) {
3146
+ entry.rail.hidden = true;
3147
+ entry.rail.setAttribute("aria-hidden", "true");
3148
+ }
3149
+ entry.activate = () => {
1252
3150
  const action = primaryNode.querySelector("a, button") ?? secondaryNode.querySelector("a, button");
1253
3151
  if (action instanceof HTMLElement) {
1254
3152
  action.click();
1255
3153
  this.scheduleCapturePersistedDiffUnchangedState(1);
1256
3154
  }
1257
3155
  };
1258
- this.createDomDisposable(this.diffUnchangedBridgeDisposables, bridge, "click", (event) => {
1259
- const mouseEvent = event;
1260
- if (mouseEvent.button !== 0) return;
1261
- event.preventDefault();
1262
- activate();
1263
- });
1264
- this.createDomDisposable(this.diffUnchangedBridgeDisposables, bridge, "keydown", (event) => {
1265
- const keyboardEvent = event;
1266
- if (keyboardEvent.key !== "Enter" && keyboardEvent.key !== " ") return;
1267
- keyboardEvent.preventDefault();
1268
- activate();
1269
- });
3156
+ if (summary.parentElement !== bridge) bridge.append(summary);
3157
+ if (divider.parentElement !== bridge) bridge.append(divider);
3158
+ if (bridge.parentElement !== overlay) overlay.append(bridge);
3159
+ return key;
1270
3160
  }
1271
3161
  patchDiffUnchangedFoldGlyph(node) {
1272
3162
  if (node.dataset.streamMonacoFoldGlyphPatched === "true") return;
@@ -1287,8 +3177,10 @@ var DiffEditorManager = class DiffEditorManager {
1287
3177
  }
1288
3178
  scanAndPatchDiffUnchangedRegions() {
1289
3179
  if (!this.lastContainer) return;
3180
+ this.applyDiffRootAppearanceClass();
3181
+ const viewZoneHeightsChanged = this.syncDiffUnchangedViewZoneHeights();
1290
3182
  const centers = this.lastContainer.querySelectorAll(".diff-hidden-lines .center");
1291
- centers.forEach((node) => this.patchDiffUnchangedCenter(node));
3183
+ Array.from(centers).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top).forEach((node, index) => this.patchDiffUnchangedCenter(node, index));
1292
3184
  const partialRevealHandles = this.lastContainer.querySelectorAll(".diff-hidden-lines .top, .diff-hidden-lines .bottom");
1293
3185
  partialRevealHandles.forEach((node) => {
1294
3186
  node.removeAttribute("title");
@@ -1296,25 +3188,34 @@ var DiffEditorManager = class DiffEditorManager {
1296
3188
  node.removeAttribute("role");
1297
3189
  node.removeAttribute("tabindex");
1298
3190
  });
1299
- this.clearDiffUnchangedBridgeOverlay(false);
3191
+ this.clearDiffUnchangedBridgeSources();
1300
3192
  const secondaryCenters = Array.from(centers).filter((node) => node.classList.contains("stream-monaco-unchanged-merged-secondary")).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
1301
3193
  const primaryCenters = Array.from(centers).filter((node) => node.classList.contains("stream-monaco-unchanged-merged-primary")).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
1302
3194
  const pairCount = Math.min(secondaryCenters.length, primaryCenters.length);
3195
+ const visibleKeys = /* @__PURE__ */ new Set();
1303
3196
  for (let i = 0; i < pairCount; i++) {
1304
3197
  const secondaryNode = secondaryCenters[i];
1305
3198
  const primaryNode = primaryCenters[i];
1306
3199
  const topDelta = Math.abs(secondaryNode.getBoundingClientRect().top - primaryNode.getBoundingClientRect().top);
1307
3200
  if (topDelta > 6) continue;
1308
- this.renderMergedDiffUnchangedBridge(secondaryNode, primaryNode);
3201
+ const key = this.renderMergedDiffUnchangedBridge(secondaryNode, primaryNode, i, pairCount);
3202
+ if (key) visibleKeys.add(key);
1309
3203
  }
3204
+ this.pruneDiffUnchangedBridgeEntries(visibleKeys);
3205
+ this.syncDiffUnchangedOverlayScrollBaseline();
1310
3206
  const foldGlyphs = this.lastContainer.querySelectorAll(".fold-unchanged");
1311
3207
  foldGlyphs.forEach((node) => this.patchDiffUnchangedFoldGlyph(node));
3208
+ if (viewZoneHeightsChanged) this.schedulePatchDiffUnchangedRegions();
1312
3209
  }
1313
3210
  schedulePatchDiffUnchangedRegions() {
1314
3211
  this.rafScheduler.schedule("patch-diff-unchanged-regions", () => {
1315
3212
  this.scanAndPatchDiffUnchangedRegions();
1316
3213
  });
1317
3214
  }
3215
+ schedulePatchDiffUnchangedRegionsAfterScroll() {
3216
+ this.applyDiffUnchangedOverlayScrollCompensation();
3217
+ this.schedulePatchDiffUnchangedRegions();
3218
+ }
1318
3219
  setupDiffUnchangedRegionEnhancements() {
1319
3220
  var _globalThis$getComput, _globalThis;
1320
3221
  this.disposeDiffUnchangedRegionEnhancements();
@@ -1323,14 +3224,14 @@ var DiffEditorManager = class DiffEditorManager {
1323
3224
  this.ensureDiffUiStyle();
1324
3225
  const containerStyle = (_globalThis$getComput = (_globalThis = globalThis).getComputedStyle) === null || _globalThis$getComput === void 0 ? void 0 : _globalThis$getComput.call(_globalThis, this.lastContainer);
1325
3226
  if (!containerStyle || containerStyle.position === "static") this.lastContainer.style.position = "relative";
1326
- this.lastContainer.classList.add("stream-monaco-diff-root");
3227
+ this.applyDiffRootAppearanceClass();
1327
3228
  this.schedulePatchDiffUnchangedRegions();
1328
3229
  if (typeof MutationObserver !== "undefined") {
1329
3230
  this.diffUnchangedRegionObserver = new MutationObserver((mutations) => {
1330
3231
  const shouldRepatch = mutations.some((mutation) => {
1331
3232
  const target = mutation.target instanceof HTMLElement ? mutation.target : null;
1332
3233
  if (target === null || target === void 0 ? void 0 : target.closest(".stream-monaco-diff-unchanged-overlay")) return false;
1333
- const changedNodes = [...mutation.addedNodes, ...mutation.removedNodes];
3234
+ const changedNodes = Array.from(mutation.addedNodes).concat(Array.from(mutation.removedNodes));
1334
3235
  if (changedNodes.length > 0 && changedNodes.every((node) => {
1335
3236
  return node instanceof HTMLElement && node.classList.contains("stream-monaco-diff-unchanged-overlay");
1336
3237
  })) return false;
@@ -1345,15 +3246,19 @@ var DiffEditorManager = class DiffEditorManager {
1345
3246
  }
1346
3247
  const originalEditor = this.diffEditorView.getOriginalEditor();
1347
3248
  const modifiedEditor = this.diffEditorView.getModifiedEditor();
1348
- const repatch = () => this.schedulePatchDiffUnchangedRegions();
3249
+ const repatch = () => {
3250
+ this.applyDiffRootAppearanceClass();
3251
+ this.schedulePatchDiffUnchangedRegions();
3252
+ };
1349
3253
  this.diffUnchangedRegionDisposables.push(this.diffEditorView.onDidUpdateDiff(() => {
1350
3254
  repatch();
1351
3255
  this.scheduleRestorePersistedDiffUnchangedState();
1352
3256
  }));
1353
3257
  this.diffUnchangedRegionDisposables.push(originalEditor.onDidLayoutChange(repatch));
1354
3258
  this.diffUnchangedRegionDisposables.push(modifiedEditor.onDidLayoutChange(repatch));
1355
- this.diffUnchangedRegionDisposables.push(originalEditor.onDidScrollChange(repatch));
1356
- this.diffUnchangedRegionDisposables.push(modifiedEditor.onDidScrollChange(repatch));
3259
+ this.diffUnchangedRegionDisposables.push(originalEditor.onDidScrollChange(() => this.schedulePatchDiffUnchangedRegionsAfterScroll()));
3260
+ this.diffUnchangedRegionDisposables.push(modifiedEditor.onDidScrollChange(() => this.schedulePatchDiffUnchangedRegionsAfterScroll()));
3261
+ this.createDomDisposable(this.diffUnchangedRegionDisposables, this.lastContainer, "scroll", () => this.schedulePatchDiffUnchangedRegionsAfterScroll());
1357
3262
  }
1358
3263
  setupDiffHunkInteractions() {
1359
3264
  var _globalThis$getComput2, _globalThis2;
@@ -1379,11 +3284,15 @@ var DiffEditorManager = class DiffEditorManager {
1379
3284
  }));
1380
3285
  this.diffHunkDisposables.push(editor.onMouseLeave(() => this.scheduleHideDiffHunkActions()));
1381
3286
  this.diffHunkDisposables.push(editor.onDidScrollChange(() => this.repositionDiffHunkNodes()));
1382
- this.diffHunkDisposables.push(editor.onDidLayoutChange(() => this.repositionDiffHunkNodes()));
3287
+ this.diffHunkDisposables.push(editor.onDidLayoutChange(() => {
3288
+ this.applyDiffRootAppearanceClass();
3289
+ this.repositionDiffHunkNodes();
3290
+ }));
1383
3291
  };
1384
3292
  bindHover(originalEditor, "original");
1385
3293
  bindHover(modifiedEditor, "modified");
1386
3294
  this.diffHunkDisposables.push(this.diffEditorView.onDidUpdateDiff(() => {
3295
+ this.applyDiffRootAppearanceClass();
1387
3296
  this.diffHunkLineChanges = this.getEffectiveLineChanges();
1388
3297
  if (this.diffHunkActiveChange) this.hideDiffHunkActions();
1389
3298
  }));
@@ -1404,9 +3313,21 @@ var DiffEditorManager = class DiffEditorManager {
1404
3313
  }
1405
3314
  hideDiffHunkActions() {
1406
3315
  this.diffHunkActiveChange = null;
3316
+ this.diffHunkActiveHoverSide = null;
1407
3317
  if (this.diffHunkUpperNode) this.diffHunkUpperNode.style.display = "none";
1408
3318
  if (this.diffHunkLowerNode) this.diffHunkLowerNode.style.display = "none";
1409
3319
  }
3320
+ inferInlineDiffHunkHoverSide(change, event) {
3321
+ var _event$target$positio;
3322
+ const targetElement = event.target.element instanceof HTMLElement ? event.target.element : null;
3323
+ if (targetElement === null || targetElement === void 0 ? void 0 : targetElement.closest(".line-delete, .char-delete, .inline-deleted-text, .inline-deleted-margin-view-zone")) return "upper";
3324
+ if (targetElement === null || targetElement === void 0 ? void 0 : targetElement.closest(".line-insert, .char-insert, .gutter-insert, .view-line")) return "lower";
3325
+ if (!this.hasModifiedLines(change)) return "upper";
3326
+ if (!this.hasOriginalLines(change)) return "lower";
3327
+ const hoverLine = ((_event$target$positio = event.target.position) === null || _event$target$positio === void 0 ? void 0 : _event$target$positio.lineNumber) ?? 0;
3328
+ const modifiedAnchor = Math.max(1, change.modifiedStartLineNumber || change.modifiedEndLineNumber || 1);
3329
+ return hoverLine < modifiedAnchor ? "upper" : "lower";
3330
+ }
1410
3331
  hasOriginalLines(change) {
1411
3332
  return change.originalStartLineNumber > 0 && change.originalEndLineNumber >= change.originalStartLineNumber;
1412
3333
  }
@@ -1441,8 +3362,8 @@ var DiffEditorManager = class DiffEditorManager {
1441
3362
  return best;
1442
3363
  }
1443
3364
  handleDiffHunkMouseMove(side, event) {
1444
- var _event$target$positio;
1445
- const line = (_event$target$positio = event.target.position) === null || _event$target$positio === void 0 ? void 0 : _event$target$positio.lineNumber;
3365
+ var _event$target$positio2;
3366
+ const line = (_event$target$positio2 = event.target.position) === null || _event$target$positio2 === void 0 ? void 0 : _event$target$positio2.lineNumber;
1446
3367
  if (!line) {
1447
3368
  this.scheduleHideDiffHunkActions(120);
1448
3369
  return;
@@ -1454,14 +3375,21 @@ var DiffEditorManager = class DiffEditorManager {
1454
3375
  }
1455
3376
  this.cancelScheduledHideDiffHunkActions();
1456
3377
  this.diffHunkActiveChange = change;
3378
+ this.diffHunkActiveHoverSide = this.isDiffInlineMode() ? this.inferInlineDiffHunkHoverSide(change, event) : null;
1457
3379
  this.repositionDiffHunkNodes();
1458
3380
  }
1459
3381
  isOriginalEditorCollapsed() {
1460
- var _this$diffEditorView$3, _this$diffEditorView$4;
3382
+ var _this$diffEditorView$4, _this$diffEditorView$5;
1461
3383
  if (!this.diffEditorView) return true;
1462
- const info = (_this$diffEditorView$3 = (_this$diffEditorView$4 = this.diffEditorView.getOriginalEditor()).getLayoutInfo) === null || _this$diffEditorView$3 === void 0 ? void 0 : _this$diffEditorView$3.call(_this$diffEditorView$4);
3384
+ const info = (_this$diffEditorView$4 = (_this$diffEditorView$5 = this.diffEditorView.getOriginalEditor()).getLayoutInfo) === null || _this$diffEditorView$4 === void 0 ? void 0 : _this$diffEditorView$4.call(_this$diffEditorView$5);
1463
3385
  return !info || info.width < 24;
1464
3386
  }
3387
+ isDiffInlineMode() {
3388
+ var _this$lastContainer2;
3389
+ const diffRoot = (_this$lastContainer2 = this.lastContainer) === null || _this$lastContainer2 === void 0 ? void 0 : _this$lastContainer2.querySelector(".monaco-diff-editor");
3390
+ if (diffRoot instanceof HTMLElement) return !diffRoot.classList.contains("side-by-side");
3391
+ return this.isOriginalEditorCollapsed();
3392
+ }
1465
3393
  getEditorBySide(side) {
1466
3394
  if (!this.diffEditorView) return null;
1467
3395
  return side === "original" ? this.diffEditorView.getOriginalEditor() : this.diffEditorView.getModifiedEditor();
@@ -1496,8 +3424,37 @@ var DiffEditorManager = class DiffEditorManager {
1496
3424
  const lastColumn = model.getLineMaxColumn(lastLine);
1497
3425
  return new monaco_shim_exports.Range(lastLine, lastColumn, lastLine, lastColumn);
1498
3426
  }
3427
+ applyDiffModelLanguage(models, codeLanguage) {
3428
+ if (!codeLanguage) return;
3429
+ const lang = processedLanguage(codeLanguage);
3430
+ if (!lang) return;
3431
+ if (models.original.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(models.original, lang);
3432
+ if (models.modified.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(models.modified, lang);
3433
+ }
3434
+ restoreDiffViewState(viewState) {
3435
+ if (!this.diffEditorView || !viewState) return;
3436
+ const restore = () => {
3437
+ try {
3438
+ var _this$diffEditorView25;
3439
+ (_this$diffEditorView25 = this.diffEditorView) === null || _this$diffEditorView25 === void 0 || _this$diffEditorView25.restoreViewState(viewState);
3440
+ } catch {}
3441
+ };
3442
+ restore();
3443
+ requestAnimationFrame(restore);
3444
+ }
3445
+ disposePreviousDiffModel(model, owned, nextModel) {
3446
+ if (!model || !owned || model === nextModel) return;
3447
+ model.dispose();
3448
+ }
3449
+ disposePendingPreparedDiffViewModel() {
3450
+ if (!this.pendingPreparedDiffViewModel) return;
3451
+ try {
3452
+ this.pendingPreparedDiffViewModel.dispose();
3453
+ } catch {}
3454
+ this.pendingPreparedDiffViewModel = null;
3455
+ }
1499
3456
  syncDiffKnownValues() {
1500
- var _this$diffEditorView5, _this$diffEditorView6, _this$diffEditorView7, _this$diffHeightManag;
3457
+ var _this$diffEditorView26, _this$diffEditorView27, _this$diffEditorView28, _this$diffHeightManag2;
1501
3458
  if (this.originalModel) this.lastKnownOriginalCode = this.originalModel.getValue();
1502
3459
  if (this.modifiedModel) {
1503
3460
  this.lastKnownModifiedCode = this.modifiedModel.getValue();
@@ -1506,8 +3463,8 @@ var DiffEditorManager = class DiffEditorManager {
1506
3463
  this.lastKnownModifiedDirty = false;
1507
3464
  this._hasScrollBar = false;
1508
3465
  this.cachedComputedHeightDiff = this.computedHeight();
1509
- this.cachedScrollHeightDiff = ((_this$diffEditorView5 = this.diffEditorView) === null || _this$diffEditorView5 === void 0 || (_this$diffEditorView7 = (_this$diffEditorView6 = _this$diffEditorView5.getModifiedEditor()).getScrollHeight) === null || _this$diffEditorView7 === void 0 ? void 0 : _this$diffEditorView7.call(_this$diffEditorView6)) ?? this.cachedScrollHeightDiff;
1510
- (_this$diffHeightManag = this.diffHeightManager) === null || _this$diffHeightManag === void 0 || _this$diffHeightManag.update();
3466
+ this.cachedScrollHeightDiff = ((_this$diffEditorView26 = this.diffEditorView) === null || _this$diffEditorView26 === void 0 || (_this$diffEditorView28 = (_this$diffEditorView27 = _this$diffEditorView26.getModifiedEditor()).getScrollHeight) === null || _this$diffEditorView28 === void 0 ? void 0 : _this$diffEditorView28.call(_this$diffEditorView27)) ?? this.cachedScrollHeightDiff;
3467
+ (_this$diffHeightManag2 = this.diffHeightManager) === null || _this$diffHeightManag2 === void 0 || _this$diffHeightManag2.update();
1511
3468
  }
1512
3469
  applyDefaultDiffHunkAction(context) {
1513
3470
  const { action, side, lineChange } = context;
@@ -1518,8 +3475,7 @@ var DiffEditorManager = class DiffEditorManager {
1518
3475
  if (!hasOriginal) return;
1519
3476
  const text = this.getLinesText(this.originalModel, lineChange.originalStartLineNumber, lineChange.originalEndLineNumber);
1520
3477
  if (!text) return;
1521
- const anchor = hasModified ? lineChange.modifiedStartLineNumber : Math.max(1, lineChange.modifiedStartLineNumber || lineChange.modifiedEndLineNumber || this.modifiedModel.getLineCount());
1522
- const range = this.getInsertRangeBeforeLine(this.modifiedModel, anchor);
3478
+ const range = hasModified ? this.getInsertRangeBeforeLine(this.modifiedModel, lineChange.modifiedStartLineNumber) : this.getInsertRangeAfterLine(this.modifiedModel, Math.max(0, lineChange.modifiedStartLineNumber || lineChange.modifiedEndLineNumber));
1523
3479
  this.modifiedModel.applyEdits([{
1524
3480
  range,
1525
3481
  text,
@@ -1553,7 +3509,7 @@ var DiffEditorManager = class DiffEditorManager {
1553
3509
  if (!hasModified) return;
1554
3510
  const text = this.getLinesText(this.modifiedModel, lineChange.modifiedStartLineNumber, lineChange.modifiedEndLineNumber);
1555
3511
  if (!text) return;
1556
- const anchor = hasOriginal ? lineChange.originalEndLineNumber : Math.max(0, lineChange.originalStartLineNumber - 1);
3512
+ const anchor = hasOriginal ? lineChange.originalEndLineNumber : Math.max(0, lineChange.originalStartLineNumber);
1557
3513
  const range = this.getInsertRangeAfterLine(this.originalModel, anchor);
1558
3514
  this.originalModel.applyEdits([{
1559
3515
  range,
@@ -1562,26 +3518,34 @@ var DiffEditorManager = class DiffEditorManager {
1562
3518
  }]);
1563
3519
  }
1564
3520
  }
1565
- applyDiffHunkAction(side, action) {
3521
+ async applyDiffHunkAction(side, action) {
1566
3522
  if (!this.diffHunkActiveChange || !this.originalModel || !this.modifiedModel) return;
1567
- this.flushOriginalAppendBufferSync();
1568
- this.flushModifiedAppendBufferSync();
1569
- const context = {
1570
- action,
1571
- side,
1572
- lineChange: this.diffHunkActiveChange,
1573
- originalModel: this.originalModel,
1574
- modifiedModel: this.modifiedModel
1575
- };
1576
- let allowDefault = true;
1577
- if (typeof this.options.onDiffHunkAction === "function") try {
1578
- allowDefault = this.options.onDiffHunkAction(context) !== false;
1579
- } catch (error$1) {
1580
- console.warn("onDiffHunkAction callback threw an error:", error$1);
1581
- }
1582
- if (allowDefault) this.applyDefaultDiffHunkAction(context);
1583
- this.syncDiffKnownValues();
1584
- this.hideDiffHunkActions();
3523
+ if (this.diffHunkActionInFlight) return;
3524
+ this.diffHunkActionInFlight = true;
3525
+ this.setDiffHunkNodeEnabled(this.diffHunkUpperNode, false);
3526
+ this.setDiffHunkNodeEnabled(this.diffHunkLowerNode, false);
3527
+ try {
3528
+ this.flushOriginalAppendBufferSync();
3529
+ this.flushModifiedAppendBufferSync();
3530
+ const context = {
3531
+ action,
3532
+ side,
3533
+ lineChange: this.diffHunkActiveChange,
3534
+ originalModel: this.originalModel,
3535
+ modifiedModel: this.modifiedModel
3536
+ };
3537
+ let allowDefault = true;
3538
+ if (typeof this.options.onDiffHunkAction === "function") try {
3539
+ allowDefault = await this.options.onDiffHunkAction(context) !== false;
3540
+ } catch (error$1) {
3541
+ console.warn("onDiffHunkAction callback threw an error:", error$1);
3542
+ }
3543
+ if (allowDefault) this.applyDefaultDiffHunkAction(context);
3544
+ this.syncDiffKnownValues();
3545
+ this.hideDiffHunkActions();
3546
+ } finally {
3547
+ this.diffHunkActionInFlight = false;
3548
+ }
1585
3549
  }
1586
3550
  setDiffHunkNodeEnabled(node, enabled) {
1587
3551
  if (!node) return;
@@ -1591,13 +3555,13 @@ var DiffEditorManager = class DiffEditorManager {
1591
3555
  });
1592
3556
  }
1593
3557
  positionDiffHunkNode(node, side, anchorLine, extraOffsetY = 0) {
1594
- var _editor$getScrollTop;
3558
+ var _editor$getScrollTop2;
1595
3559
  if (!this.diffHunkOverlay) return;
1596
3560
  const editor = this.getEditorBySide(side);
1597
3561
  if (!editor) return;
1598
3562
  const host = editor.getContainerDomNode();
1599
3563
  const line = Math.max(1, anchorLine);
1600
- const rawTop = editor.getTopForLineNumber(line) - (((_editor$getScrollTop = editor.getScrollTop) === null || _editor$getScrollTop === void 0 ? void 0 : _editor$getScrollTop.call(editor)) ?? 0);
3564
+ const rawTop = editor.getTopForLineNumber(line) - (((_editor$getScrollTop2 = editor.getScrollTop) === null || _editor$getScrollTop2 === void 0 ? void 0 : _editor$getScrollTop2.call(editor)) ?? 0);
1601
3565
  const lineHeight = editor.getOption(monaco_shim_exports.editor.EditorOption.lineHeight);
1602
3566
  const nodeWidth = node.offsetWidth || 130;
1603
3567
  const nodeHeight = node.offsetHeight || 30;
@@ -1621,16 +3585,32 @@ var DiffEditorManager = class DiffEditorManager {
1621
3585
  const hasModified = this.hasModifiedLines(change);
1622
3586
  this.setDiffHunkNodeEnabled(this.diffHunkUpperNode, hasOriginal);
1623
3587
  this.setDiffHunkNodeEnabled(this.diffHunkLowerNode, hasModified);
1624
- const originalCollapsed = this.isOriginalEditorCollapsed();
3588
+ const inlineMode = this.isDiffInlineMode();
3589
+ if (inlineMode) {
3590
+ const inlineHoverSide = this.diffHunkActiveHoverSide ?? (hasOriginal && !hasModified ? "upper" : "lower");
3591
+ if (inlineHoverSide === "upper" && hasOriginal) {
3592
+ const upperAnchor = Math.max(1, change.modifiedStartLineNumber - 1 || change.modifiedEndLineNumber || 1);
3593
+ this.positionDiffHunkNode(this.diffHunkUpperNode, "modified", upperAnchor);
3594
+ this.diffHunkLowerNode.style.display = "none";
3595
+ return;
3596
+ }
3597
+ if (hasModified) {
3598
+ const lowerAnchor = Math.max(1, change.modifiedStartLineNumber || change.modifiedEndLineNumber || 1);
3599
+ this.positionDiffHunkNode(this.diffHunkLowerNode, "modified", lowerAnchor);
3600
+ this.diffHunkUpperNode.style.display = "none";
3601
+ return;
3602
+ }
3603
+ this.hideDiffHunkActions();
3604
+ return;
3605
+ }
1625
3606
  if (hasOriginal) {
1626
- const upperSide = originalCollapsed ? "modified" : "original";
1627
- const upperAnchor = originalCollapsed ? Math.max(1, change.modifiedStartLineNumber || change.modifiedEndLineNumber || 1) : change.originalStartLineNumber;
3607
+ const upperSide = "original";
3608
+ const upperAnchor = change.originalStartLineNumber;
1628
3609
  this.positionDiffHunkNode(this.diffHunkUpperNode, upperSide, upperAnchor);
1629
3610
  } else this.diffHunkUpperNode.style.display = "none";
1630
3611
  if (hasModified) {
1631
- const samePane = originalCollapsed;
1632
3612
  const lowerAnchor = change.modifiedStartLineNumber;
1633
- this.positionDiffHunkNode(this.diffHunkLowerNode, "modified", lowerAnchor, samePane ? 32 : 0);
3613
+ this.positionDiffHunkNode(this.diffHunkLowerNode, "modified", lowerAnchor);
1634
3614
  } else this.diffHunkLowerNode.style.display = "none";
1635
3615
  }
1636
3616
  scheduleFlushAppendBufferDiff() {
@@ -1665,10 +3645,11 @@ var DiffEditorManager = class DiffEditorManager {
1665
3645
  const text = this.appendBufferOriginalDiff.join("");
1666
3646
  this.appendBufferOriginalDiff.length = 0;
1667
3647
  if (!text) return;
3648
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
1668
3649
  this.appendToModel(this.originalModel, text);
1669
3650
  }
1670
3651
  computedHeight() {
1671
- var _originalEditor$getMo, _modifiedEditor$getMo, _originalEditor$getSc, _modifiedEditor$getSc;
3652
+ var _originalEditor$getMo, _modifiedEditor$getMo, _originalEditor$getSc5, _modifiedEditor$getSc10;
1672
3653
  if (!this.diffEditorView) return Math.min(1 * 18 + padding, this.maxHeightValue);
1673
3654
  const modifiedEditor = this.diffEditorView.getModifiedEditor();
1674
3655
  const originalEditor = this.diffEditorView.getOriginalEditor();
@@ -1677,15 +3658,16 @@ var DiffEditorManager = class DiffEditorManager {
1677
3658
  const mCount = ((_modifiedEditor$getMo = modifiedEditor.getModel()) === null || _modifiedEditor$getMo === void 0 ? void 0 : _modifiedEditor$getMo.getLineCount()) ?? 1;
1678
3659
  const lineCount = Math.max(oCount, mCount);
1679
3660
  const fromLines = lineCount * lineHeight + padding;
1680
- const scrollH = Math.max(((_originalEditor$getSc = originalEditor.getScrollHeight) === null || _originalEditor$getSc === void 0 ? void 0 : _originalEditor$getSc.call(originalEditor)) ?? 0, ((_modifiedEditor$getSc = modifiedEditor.getScrollHeight) === null || _modifiedEditor$getSc === void 0 ? void 0 : _modifiedEditor$getSc.call(modifiedEditor)) ?? 0);
3661
+ const scrollH = Math.max(((_originalEditor$getSc5 = originalEditor.getScrollHeight) === null || _originalEditor$getSc5 === void 0 ? void 0 : _originalEditor$getSc5.call(originalEditor)) ?? 0, ((_modifiedEditor$getSc10 = modifiedEditor.getScrollHeight) === null || _modifiedEditor$getSc10 === void 0 ? void 0 : _modifiedEditor$getSc10.call(modifiedEditor)) ?? 0);
1681
3662
  const desired = Math.max(fromLines, scrollH);
1682
3663
  return Math.min(desired, this.maxHeightValue);
1683
3664
  }
1684
3665
  isOverflowAutoDiff() {
1685
- return !!this.lastContainer && this.lastContainer.style.overflow === "auto";
3666
+ if (!this.lastContainer) return false;
3667
+ return this.computedHeight() >= this.maxHeightValue - 1;
1686
3668
  }
1687
3669
  shouldPerformImmediateRevealDiff() {
1688
- return this.autoScrollOnUpdate && this.shouldAutoScrollDiff && this.hasVerticalScrollbarModified() && this.isOverflowAutoDiff();
3670
+ return this.autoScrollOnUpdate && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred && this.hasVerticalScrollbarModified() && this.isOverflowAutoDiff();
1689
3671
  }
1690
3672
  suppressScrollWatcherDiff(ms) {
1691
3673
  if (!this.diffScrollWatcher || typeof this.diffScrollWatcher.setSuppressed !== "function") return;
@@ -1806,9 +3788,9 @@ var DiffEditorManager = class DiffEditorManager {
1806
3788
  ticket,
1807
3789
  line
1808
3790
  });
1809
- const strategy = this.revealStrategyOption ?? this.options.revealStrategy ?? "centerIfOutside";
3791
+ const strategy = this.diffHideUnchangedRegionsDeferred ? "bottom" : this.revealStrategyOption ?? this.options.revealStrategy ?? "centerIfOutside";
1810
3792
  const ScrollType = monaco_shim_exports.ScrollType || ((_editor = monaco_shim_exports.editor) === null || _editor === void 0 ? void 0 : _editor.ScrollType);
1811
- const smooth = ScrollType && typeof ScrollType.Smooth !== "undefined" ? ScrollType.Smooth : void 0;
3793
+ const smooth = !this.diffHideUnchangedRegionsDeferred && ScrollType && typeof ScrollType.Smooth !== "undefined" ? ScrollType.Smooth : void 0;
1812
3794
  try {
1813
3795
  const me = this.diffEditorView.getModifiedEditor();
1814
3796
  if (strategy === "bottom") if (typeof smooth !== "undefined") me.revealLine(line, smooth);
@@ -1828,9 +3810,8 @@ var DiffEditorManager = class DiffEditorManager {
1828
3810
  lastRevealLineDiff: this.lastRevealLineDiff
1829
3811
  });
1830
3812
  try {
1831
- var _this$diffEditorView8, _this$diffEditorView9, _this$diffEditorView10;
1832
- this.shouldAutoScrollDiff = true;
1833
- this.lastScrollTopDiff = ((_this$diffEditorView8 = this.diffEditorView) === null || _this$diffEditorView8 === void 0 || (_this$diffEditorView10 = (_this$diffEditorView9 = _this$diffEditorView8.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView10 === void 0 ? void 0 : _this$diffEditorView10.call(_this$diffEditorView9)) ?? this.lastScrollTopDiff;
3813
+ var _this$diffEditorView29, _this$diffEditorView30, _this$diffEditorView31;
3814
+ this.lastScrollTopDiff = ((_this$diffEditorView29 = this.diffEditorView) === null || _this$diffEditorView29 === void 0 || (_this$diffEditorView31 = (_this$diffEditorView30 = _this$diffEditorView29.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView31 === void 0 ? void 0 : _this$diffEditorView31.call(_this$diffEditorView30)) ?? this.lastScrollTopDiff;
1834
3815
  } catch {}
1835
3816
  });
1836
3817
  }
@@ -1848,11 +3829,6 @@ var DiffEditorManager = class DiffEditorManager {
1848
3829
  line,
1849
3830
  ticket
1850
3831
  });
1851
- try {
1852
- var _this$diffEditorView11, _this$diffEditorView12, _this$diffEditorView13;
1853
- this.shouldAutoScrollDiff = true;
1854
- this.lastScrollTopDiff = ((_this$diffEditorView11 = this.diffEditorView) === null || _this$diffEditorView11 === void 0 || (_this$diffEditorView13 = (_this$diffEditorView12 = _this$diffEditorView11.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView13 === void 0 ? void 0 : _this$diffEditorView13.call(_this$diffEditorView12)) ?? this.lastScrollTopDiff;
1855
- } catch {}
1856
3832
  }
1857
3833
  scheduleImmediateRevealAfterLayoutDiff(line) {
1858
3834
  const ticket = ++this.revealTicketDiff;
@@ -1892,7 +3868,11 @@ var DiffEditorManager = class DiffEditorManager {
1892
3868
  const lang = processedLanguage(language) || language;
1893
3869
  this.originalModel = monaco_shim_exports.editor.createModel(originalCode, lang);
1894
3870
  this.modifiedModel = monaco_shim_exports.editor.createModel(modifiedCode, lang);
3871
+ this.originalModelOwned = true;
3872
+ this.modifiedModelOwned = true;
1895
3873
  const hideUnchangedRegions = this.resolveDiffHideUnchangedRegionsOption();
3874
+ this.diffHideUnchangedRegionsResolved = hideUnchangedRegions;
3875
+ this.diffHideUnchangedRegionsDeferred = false;
1896
3876
  this.diffEditorView = monaco_shim_exports.editor.createDiffEditor(container, {
1897
3877
  automaticLayout: true,
1898
3878
  scrollBeyondLastLine: false,
@@ -1916,7 +3896,7 @@ var DiffEditorManager = class DiffEditorManager {
1916
3896
  });
1917
3897
  this.lastKnownOriginalCode = originalCode;
1918
3898
  this.lastKnownModifiedCode = modifiedCode;
1919
- this.diffUpdateThrottleMs = this.diffUpdateThrottleMsOption ?? this.options.diffUpdateThrottleMs ?? 50;
3899
+ this.diffUpdateThrottleMs = this.resolveDiffStreamingThrottleMs();
1920
3900
  this.shouldAutoScrollDiff = !!(this.autoScrollInitial && this.diffAutoScroll);
1921
3901
  if (this.diffScrollWatcher) {
1922
3902
  this.diffScrollWatcher.dispose();
@@ -1952,35 +3932,40 @@ var DiffEditorManager = class DiffEditorManager {
1952
3932
  this.diffHeightManager = createHeightManager(container, () => this.computedHeight());
1953
3933
  this.diffHeightManager.update();
1954
3934
  const initialComputed = this.computedHeight();
1955
- if (initialComputed >= this.maxHeightValue - 1) {
1956
- container.style.height = `${this.maxHeightValue}px`;
1957
- container.style.overflow = "auto";
1958
- }
3935
+ if (initialComputed >= this.maxHeightValue - 1) container.style.height = `${this.maxHeightValue}px`;
1959
3936
  const me = this.diffEditorView.getModifiedEditor();
1960
3937
  this.cachedScrollHeightDiff = ((_me$getScrollHeight2 = me.getScrollHeight) === null || _me$getScrollHeight2 === void 0 ? void 0 : _me$getScrollHeight2.call(me)) ?? null;
1961
3938
  this.cachedLineHeightDiff = ((_me$getOption = me.getOption) === null || _me$getOption === void 0 ? void 0 : _me$getOption.call(me, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
1962
3939
  this.cachedComputedHeightDiff = this.computedHeight();
1963
3940
  const oEditor = this.diffEditorView.getOriginalEditor();
1964
3941
  const mEditor = this.diffEditorView.getModifiedEditor();
3942
+ this.disposeDiffPresentationTracking();
3943
+ this.diffComputedVersions = null;
3944
+ this.diffPresentationDisposables.push(this.diffEditorView.onDidUpdateDiff(() => {
3945
+ this.diffComputedVersions = this.captureCurrentDiffVersions();
3946
+ this.scheduleSyncDiffPresentationDecorations();
3947
+ }));
3948
+ this.diffPresentationDisposables.push(oEditor.onDidChangeModelContent(() => {
3949
+ this.scheduleSyncDiffPresentationDecorations();
3950
+ }));
3951
+ this.diffPresentationDisposables.push(mEditor.onDidChangeModelContent(() => {
3952
+ this.scheduleSyncDiffPresentationDecorations();
3953
+ }));
1965
3954
  (_oEditor$onDidContent = oEditor.onDidContentSizeChange) === null || _oEditor$onDidContent === void 0 || _oEditor$onDidContent.call(oEditor, () => {
1966
3955
  this._hasScrollBar = false;
1967
3956
  this.rafScheduler.schedule("content-size-change-diff", () => {
1968
- var _oEditor$getScrollHei, _oEditor$getOption, _this$diffHeightManag2, _this$diffHeightManag3;
3957
+ var _oEditor$getScrollHei, _oEditor$getOption, _this$diffHeightManag3, _this$diffHeightManag4;
1969
3958
  this.cachedScrollHeightDiff = ((_oEditor$getScrollHei = oEditor.getScrollHeight) === null || _oEditor$getScrollHei === void 0 ? void 0 : _oEditor$getScrollHei.call(oEditor)) ?? this.cachedScrollHeightDiff;
1970
3959
  this.cachedLineHeightDiff = ((_oEditor$getOption = oEditor.getOption) === null || _oEditor$getOption === void 0 ? void 0 : _oEditor$getOption.call(oEditor, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? this.cachedLineHeightDiff;
1971
3960
  this.cachedComputedHeightDiff = this.computedHeight();
1972
- if ((_this$diffHeightManag2 = this.diffHeightManager) === null || _this$diffHeightManag2 === void 0 ? void 0 : _this$diffHeightManag2.isSuppressed()) return;
1973
- (_this$diffHeightManag3 = this.diffHeightManager) === null || _this$diffHeightManag3 === void 0 || _this$diffHeightManag3.update();
3961
+ if ((_this$diffHeightManag3 = this.diffHeightManager) === null || _this$diffHeightManag3 === void 0 ? void 0 : _this$diffHeightManag3.isSuppressed()) return;
3962
+ (_this$diffHeightManag4 = this.diffHeightManager) === null || _this$diffHeightManag4 === void 0 || _this$diffHeightManag4.update();
1974
3963
  const computed$2 = this.computedHeight();
1975
3964
  if (this.lastContainer) {
1976
- const prevOverflow = this.lastContainer.style.overflow;
1977
- const newOverflow = computed$2 >= this.maxHeightValue - 1 ? "auto" : "hidden";
1978
- if (prevOverflow !== newOverflow) {
1979
- this.lastContainer.style.overflow = newOverflow;
1980
- if (newOverflow === "auto" && this.shouldAutoScrollDiff) {
1981
- var _this$modifiedModel;
1982
- this.maybeScrollDiffToBottom((_this$modifiedModel = this.modifiedModel) === null || _this$modifiedModel === void 0 ? void 0 : _this$modifiedModel.getLineCount());
1983
- }
3965
+ this.lastContainer.style.overflow = "hidden";
3966
+ if (computed$2 >= this.maxHeightValue - 1 && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred) {
3967
+ var _this$modifiedModel3;
3968
+ this.maybeScrollDiffToBottom((_this$modifiedModel3 = this.modifiedModel) === null || _this$modifiedModel3 === void 0 ? void 0 : _this$modifiedModel3.getLineCount());
1984
3969
  }
1985
3970
  }
1986
3971
  });
@@ -1988,22 +3973,18 @@ var DiffEditorManager = class DiffEditorManager {
1988
3973
  (_mEditor$onDidContent = mEditor.onDidContentSizeChange) === null || _mEditor$onDidContent === void 0 || _mEditor$onDidContent.call(mEditor, () => {
1989
3974
  this._hasScrollBar = false;
1990
3975
  this.rafScheduler.schedule("content-size-change-diff", () => {
1991
- var _mEditor$getScrollHei, _mEditor$getOption, _this$diffHeightManag4, _this$diffHeightManag5;
3976
+ var _mEditor$getScrollHei, _mEditor$getOption, _this$diffHeightManag5, _this$diffHeightManag6;
1992
3977
  this.cachedScrollHeightDiff = ((_mEditor$getScrollHei = mEditor.getScrollHeight) === null || _mEditor$getScrollHei === void 0 ? void 0 : _mEditor$getScrollHei.call(mEditor)) ?? this.cachedScrollHeightDiff;
1993
3978
  this.cachedLineHeightDiff = ((_mEditor$getOption = mEditor.getOption) === null || _mEditor$getOption === void 0 ? void 0 : _mEditor$getOption.call(mEditor, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? this.cachedLineHeightDiff;
1994
3979
  this.cachedComputedHeightDiff = this.computedHeight();
1995
- if ((_this$diffHeightManag4 = this.diffHeightManager) === null || _this$diffHeightManag4 === void 0 ? void 0 : _this$diffHeightManag4.isSuppressed()) return;
1996
- (_this$diffHeightManag5 = this.diffHeightManager) === null || _this$diffHeightManag5 === void 0 || _this$diffHeightManag5.update();
3980
+ if ((_this$diffHeightManag5 = this.diffHeightManager) === null || _this$diffHeightManag5 === void 0 ? void 0 : _this$diffHeightManag5.isSuppressed()) return;
3981
+ (_this$diffHeightManag6 = this.diffHeightManager) === null || _this$diffHeightManag6 === void 0 || _this$diffHeightManag6.update();
1997
3982
  const computed$2 = this.computedHeight();
1998
3983
  if (this.lastContainer) {
1999
- const prevOverflow = this.lastContainer.style.overflow;
2000
- const newOverflow = computed$2 >= this.maxHeightValue - 1 ? "auto" : "hidden";
2001
- if (prevOverflow !== newOverflow) {
2002
- this.lastContainer.style.overflow = newOverflow;
2003
- if (newOverflow === "auto" && this.shouldAutoScrollDiff) {
2004
- var _this$modifiedModel2;
2005
- this.maybeScrollDiffToBottom((_this$modifiedModel2 = this.modifiedModel) === null || _this$modifiedModel2 === void 0 ? void 0 : _this$modifiedModel2.getLineCount());
2006
- }
3984
+ this.lastContainer.style.overflow = "hidden";
3985
+ if (computed$2 >= this.maxHeightValue - 1 && this.shouldAutoScrollDiff && !this.diffHideUnchangedRegionsDeferred) {
3986
+ var _this$modifiedModel4;
3987
+ this.maybeScrollDiffToBottom((_this$modifiedModel4 = this.modifiedModel) === null || _this$modifiedModel4 === void 0 ? void 0 : _this$modifiedModel4.getLineCount());
2007
3988
  }
2008
3989
  }
2009
3990
  });
@@ -2015,6 +3996,8 @@ var DiffEditorManager = class DiffEditorManager {
2015
3996
  this.maybeScrollDiffToBottom(this.modifiedModel.getLineCount(), this.lastKnownModifiedLineCount ?? void 0);
2016
3997
  this.setupDiffUnchangedRegionEnhancements();
2017
3998
  this.setupDiffHunkInteractions();
3999
+ this.applyDiffRootAppearanceClass();
4000
+ this.scheduleSyncDiffPresentationDecorations();
2018
4001
  return this.diffEditorView;
2019
4002
  }
2020
4003
  updateDiff(originalCode, modifiedCode, codeLanguage) {
@@ -2033,17 +4016,22 @@ var DiffEditorManager = class DiffEditorManager {
2033
4016
  if (this.lastKnownModifiedCode == null) this.lastKnownModifiedCode = this.modifiedModel.getValue();
2034
4017
  const prevO = this.lastKnownOriginalCode;
2035
4018
  const prevM = this.lastKnownModifiedCode;
4019
+ const originalTailAppend = originalCode !== prevO && originalCode.startsWith(prevO) && prevO.length < originalCode.length;
4020
+ const modifiedTailAppend = modifiedCode !== prevM && modifiedCode.startsWith(prevM) && prevM.length < modifiedCode.length;
4021
+ const hasContentChange = originalCode !== prevO || modifiedCode !== prevM;
4022
+ if (originalCode !== prevO || modifiedCode !== prevM) this.markDiffStreamingActivity();
2036
4023
  let didImmediate = false;
2037
- if (originalCode !== prevO && originalCode.startsWith(prevO)) {
4024
+ if (originalTailAppend) {
2038
4025
  this.appendOriginal(originalCode.slice(prevO.length));
2039
4026
  this.lastKnownOriginalCode = originalCode;
2040
4027
  didImmediate = true;
2041
4028
  }
2042
- if (modifiedCode !== prevM && modifiedCode.startsWith(prevM)) {
4029
+ if (modifiedTailAppend) {
2043
4030
  this.appendModified(modifiedCode.slice(prevM.length));
2044
4031
  this.lastKnownModifiedCode = modifiedCode;
2045
4032
  didImmediate = true;
2046
4033
  }
4034
+ if (hasContentChange) this.preserveNativeDiffDecorationsOnStaleAppend = (originalCode === prevO || originalTailAppend) && (modifiedCode === prevM || modifiedTailAppend);
2047
4035
  if (originalCode !== this.lastKnownOriginalCode || modifiedCode !== this.lastKnownModifiedCode) {
2048
4036
  this.pendingDiffUpdate = {
2049
4037
  original: originalCode,
@@ -2060,7 +4048,10 @@ var DiffEditorManager = class DiffEditorManager {
2060
4048
  }
2061
4049
  const prev = this.lastKnownOriginalCode ?? this.originalModel.getValue();
2062
4050
  if (prev === newCode) return;
2063
- if (newCode.startsWith(prev) && prev.length < newCode.length) this.appendOriginal(newCode.slice(prev.length), codeLanguage);
4051
+ const tailAppend = newCode.startsWith(prev) && prev.length < newCode.length;
4052
+ this.markDiffStreamingActivity();
4053
+ this.preserveNativeDiffDecorationsOnStaleAppend = tailAppend;
4054
+ if (tailAppend) this.appendOriginal(newCode.slice(prev.length), codeLanguage);
2064
4055
  else {
2065
4056
  this.flushOriginalAppendBufferSync();
2066
4057
  this.applyMinimalEditToModel(this.originalModel, prev, newCode);
@@ -2075,7 +4066,10 @@ var DiffEditorManager = class DiffEditorManager {
2075
4066
  }
2076
4067
  const prev = this.lastKnownModifiedCode ?? this.modifiedModel.getValue();
2077
4068
  if (prev === newCode) return;
2078
- if (newCode.startsWith(prev) && prev.length < newCode.length) this.appendModified(newCode.slice(prev.length), codeLanguage);
4069
+ const tailAppend = newCode.startsWith(prev) && prev.length < newCode.length;
4070
+ this.markDiffStreamingActivity();
4071
+ this.preserveNativeDiffDecorationsOnStaleAppend = tailAppend;
4072
+ if (tailAppend) this.appendModified(newCode.slice(prev.length), codeLanguage);
2079
4073
  else {
2080
4074
  this.flushModifiedAppendBufferSync();
2081
4075
  const prevAfterFlush = this.modifiedModel.getValue();
@@ -2088,28 +4082,18 @@ var DiffEditorManager = class DiffEditorManager {
2088
4082
  const computed$2 = this.computedHeight();
2089
4083
  if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) {
2090
4084
  this.lastContainer.style.height = `${this.maxHeightValue}px`;
2091
- this.lastContainer.style.overflow = "auto";
4085
+ this.lastContainer.style.overflow = "hidden";
2092
4086
  }
2093
4087
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayoutDiff(newLine);
2094
4088
  else this.maybeScrollDiffToBottom(newLine, prevLine);
2095
- if (this.autoScrollOnUpdate && this.shouldAutoScrollDiff) try {
2096
- var _editor3, _me2$getModel, _me2$getScrollTop;
2097
- const ScrollType = monaco_shim_exports.ScrollType || ((_editor3 = monaco_shim_exports.editor) === null || _editor3 === void 0 ? void 0 : _editor3.ScrollType);
2098
- const immediate = ScrollType && typeof ScrollType.Immediate !== "undefined" ? ScrollType.Immediate : void 0;
2099
- const me2 = this.diffEditorView.getModifiedEditor();
2100
- const targetLine = ((_me2$getModel = me2.getModel()) === null || _me2$getModel === void 0 ? void 0 : _me2$getModel.getLineCount()) ?? newLine;
2101
- if (typeof immediate !== "undefined") me2.revealLine(targetLine, immediate);
2102
- else me2.revealLine(targetLine);
2103
- this.lastRevealLineDiff = targetLine;
2104
- this.shouldAutoScrollDiff = true;
2105
- this.lastScrollTopDiff = ((_me2$getScrollTop = me2.getScrollTop) === null || _me2$getScrollTop === void 0 ? void 0 : _me2$getScrollTop.call(me2)) ?? this.lastScrollTopDiff;
2106
- } catch {}
2107
4089
  }
2108
4090
  }
2109
4091
  this.lastKnownModifiedCode = newCode;
2110
4092
  }
2111
4093
  appendOriginal(appendText, codeLanguage) {
2112
4094
  if (!this.diffEditorView || !this.originalModel || !appendText) return;
4095
+ this.markDiffStreamingActivity();
4096
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
2113
4097
  if (codeLanguage) {
2114
4098
  const lang = processedLanguage(codeLanguage);
2115
4099
  if (lang && this.originalModel.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(this.originalModel, lang);
@@ -2119,6 +4103,8 @@ var DiffEditorManager = class DiffEditorManager {
2119
4103
  }
2120
4104
  appendModified(appendText, codeLanguage) {
2121
4105
  if (!this.diffEditorView || !this.modifiedModel || !appendText) return;
4106
+ this.markDiffStreamingActivity();
4107
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
2122
4108
  if (codeLanguage) {
2123
4109
  const lang = processedLanguage(codeLanguage);
2124
4110
  if (lang && this.modifiedModel.getLanguageId() !== lang) monaco_shim_exports.editor.setModelLanguage(this.modifiedModel, lang);
@@ -2134,6 +4120,104 @@ var DiffEditorManager = class DiffEditorManager {
2134
4120
  if (this.originalModel && this.originalModel.getLanguageId() !== language) monaco_shim_exports.editor.setModelLanguage(this.originalModel, language);
2135
4121
  if (this.modifiedModel && this.modifiedModel.getLanguageId() !== language) monaco_shim_exports.editor.setModelLanguage(this.modifiedModel, language);
2136
4122
  }
4123
+ async setDiffModels(models, options = {}) {
4124
+ var _this$originalModel2, _this$modifiedModel5, _this$diffEditorView$6, _this$diffEditorView$7, _this$diffEditorView$8, _this$diffEditorView$9;
4125
+ if (!this.diffEditorView) return;
4126
+ const transitionRequestId = ++this.diffModelTransitionRequestId;
4127
+ this.preserveNativeDiffDecorationsOnStaleAppend = false;
4128
+ this.disposePendingPreparedDiffViewModel();
4129
+ const nextOriginal = models.original;
4130
+ const nextModified = models.modified;
4131
+ this.applyDiffModelLanguage(models, options.codeLanguage);
4132
+ const currentOriginalValue = this.lastKnownOriginalCode ?? ((_this$originalModel2 = this.originalModel) === null || _this$originalModel2 === void 0 ? void 0 : _this$originalModel2.getValue()) ?? null;
4133
+ const currentModifiedValue = this.lastKnownModifiedCode ?? ((_this$modifiedModel5 = this.modifiedModel) === null || _this$modifiedModel5 === void 0 ? void 0 : _this$modifiedModel5.getValue()) ?? null;
4134
+ const nextOriginalValue = nextOriginal.getValue();
4135
+ const nextModifiedValue = nextModified.getValue();
4136
+ const sameContent = currentOriginalValue === nextOriginalValue && currentModifiedValue === nextModifiedValue;
4137
+ const preserveViewState = options.preserveViewState ?? sameContent;
4138
+ let preparedViewModel = null;
4139
+ if (preserveViewState && sameContent) try {
4140
+ preparedViewModel = this.diffEditorView.createViewModel({
4141
+ original: nextOriginal,
4142
+ modified: nextModified
4143
+ });
4144
+ this.pendingPreparedDiffViewModel = preparedViewModel;
4145
+ await preparedViewModel.waitForDiff();
4146
+ } catch {
4147
+ if (preparedViewModel === this.pendingPreparedDiffViewModel) this.pendingPreparedDiffViewModel = null;
4148
+ try {
4149
+ preparedViewModel === null || preparedViewModel === void 0 || preparedViewModel.dispose();
4150
+ } catch {}
4151
+ preparedViewModel = null;
4152
+ }
4153
+ if (preparedViewModel === this.pendingPreparedDiffViewModel) this.pendingPreparedDiffViewModel = null;
4154
+ if (!this.diffEditorView || this.diffModelTransitionRequestId !== transitionRequestId) {
4155
+ if (preparedViewModel) try {
4156
+ preparedViewModel.dispose();
4157
+ } catch {}
4158
+ return;
4159
+ }
4160
+ const nextModelTarget = preparedViewModel ?? {
4161
+ original: nextOriginal,
4162
+ modified: nextModified
4163
+ };
4164
+ if (!this.originalModel || !this.modifiedModel) {
4165
+ this.diffEditorView.setModel(nextModelTarget);
4166
+ this.originalModel = nextOriginal;
4167
+ this.modifiedModel = nextModified;
4168
+ this.originalModelOwned = false;
4169
+ this.modifiedModelOwned = false;
4170
+ this.syncDiffKnownValues();
4171
+ this.refreshDiffPresentation();
4172
+ return;
4173
+ }
4174
+ this.rafScheduler.cancel("diff");
4175
+ this.pendingDiffUpdate = null;
4176
+ this.flushOriginalAppendBufferSync();
4177
+ this.flushModifiedAppendBufferSync();
4178
+ this.preserveNativeDiffDecorationsOnStaleAppend = false;
4179
+ const currentOriginal = this.originalModel;
4180
+ const currentModified = this.modifiedModel;
4181
+ const shouldRestorePersistedUnchangedState = preserveViewState && !sameContent;
4182
+ const preservedScrollPosition = preserveViewState ? this.captureDiffScrollPosition() : null;
4183
+ const preservedViewportAnchor = preserveViewState && sameContent ? this.captureModifiedViewportAnchor() : null;
4184
+ const viewState = preserveViewState ? this.diffEditorView.saveViewState() : null;
4185
+ this.queuePendingDiffScrollRestore(preservedScrollPosition, shouldRestorePersistedUnchangedState ? 2 : 0);
4186
+ if (shouldRestorePersistedUnchangedState) this.capturePersistedDiffUnchangedState();
4187
+ const applyModelSwap = () => {
4188
+ var _this$diffEditorView32;
4189
+ (_this$diffEditorView32 = this.diffEditorView) === null || _this$diffEditorView32 === void 0 || _this$diffEditorView32.setModel(nextModelTarget);
4190
+ };
4191
+ if (preserveViewState) this.withLockedDiffScrollPosition(applyModelSwap);
4192
+ else applyModelSwap();
4193
+ const previousOriginalOwned = this.originalModelOwned;
4194
+ const previousModifiedOwned = this.modifiedModelOwned;
4195
+ this.originalModel = nextOriginal;
4196
+ this.modifiedModel = nextModified;
4197
+ this.originalModelOwned = false;
4198
+ this.modifiedModelOwned = false;
4199
+ this.lastKnownOriginalCode = nextOriginalValue;
4200
+ this.lastKnownModifiedCode = nextModifiedValue;
4201
+ this.lastKnownModifiedLineCount = nextModified.getLineCount();
4202
+ this.lastKnownModifiedDirty = false;
4203
+ this._hasScrollBar = false;
4204
+ this.cachedScrollHeightDiff = ((_this$diffEditorView$6 = (_this$diffEditorView$7 = this.diffEditorView.getModifiedEditor()).getScrollHeight) === null || _this$diffEditorView$6 === void 0 ? void 0 : _this$diffEditorView$6.call(_this$diffEditorView$7)) ?? null;
4205
+ this.cachedLineHeightDiff = ((_this$diffEditorView$8 = (_this$diffEditorView$9 = this.diffEditorView.getModifiedEditor()).getOption) === null || _this$diffEditorView$8 === void 0 ? void 0 : _this$diffEditorView$8.call(_this$diffEditorView$9, monaco_shim_exports.editor.EditorOption.lineHeight)) ?? null;
4206
+ this.cachedComputedHeightDiff = this.computedHeight();
4207
+ this.diffHunkLineChanges = this.getEffectiveLineChanges();
4208
+ this.hideDiffHunkActions();
4209
+ this.clearDiffUnchangedBridgeOverlay(false);
4210
+ this.syncDiffUnchangedViewZoneHeights();
4211
+ this.diffComputedVersions = null;
4212
+ if (viewState) this.restoreDiffViewState(viewState);
4213
+ this.refreshDiffPresentation();
4214
+ this.scheduleSyncDiffPresentationDecorations();
4215
+ if (shouldRestorePersistedUnchangedState) this.scheduleRestorePersistedDiffUnchangedState();
4216
+ this.applyPendingDiffScrollRestore();
4217
+ if (preservedViewportAnchor) this.scheduleRestoreModifiedViewportAnchor(preservedViewportAnchor);
4218
+ this.disposePreviousDiffModel(currentOriginal, previousOriginalOwned, nextOriginal);
4219
+ this.disposePreviousDiffModel(currentModified, previousModifiedOwned, nextModified);
4220
+ }
2137
4221
  getDiffEditorView() {
2138
4222
  return this.diffEditorView;
2139
4223
  }
@@ -2144,20 +4228,13 @@ var DiffEditorManager = class DiffEditorManager {
2144
4228
  };
2145
4229
  }
2146
4230
  cleanup() {
2147
- this.rafScheduler.cancel("diff");
2148
- this.pendingDiffUpdate = null;
2149
- this.rafScheduler.cancel("appendDiff");
2150
- this.appendBufferDiffScheduled = false;
2151
- this.appendBufferOriginalDiff.length = 0;
2152
- this.appendBufferModifiedDiff.length = 0;
2153
- if (this.appendFlushThrottleTimerDiff != null) {
2154
- clearTimeout(this.appendFlushThrottleTimerDiff);
2155
- this.appendFlushThrottleTimerDiff = null;
2156
- }
2157
- this.rafScheduler.cancel("content-size-change-diff");
2158
- this.rafScheduler.cancel("sync-last-known-modified");
4231
+ this.diffModelTransitionRequestId += 1;
4232
+ this.preserveNativeDiffDecorationsOnStaleAppend = false;
4233
+ this.disposePendingPreparedDiffViewModel();
4234
+ this.clearAsyncWork();
2159
4235
  this.disposeDiffHunkInteractions();
2160
4236
  this.disposeDiffUnchangedRegionEnhancements();
4237
+ this.disposeDiffPresentationTracking();
2161
4238
  if (this.diffScrollWatcher) {
2162
4239
  this.diffScrollWatcher.dispose();
2163
4240
  this.diffScrollWatcher = null;
@@ -2170,51 +4247,37 @@ var DiffEditorManager = class DiffEditorManager {
2170
4247
  this.diffEditorView.dispose();
2171
4248
  this.diffEditorView = null;
2172
4249
  }
2173
- if (this.originalModel) {
2174
- this.originalModel.dispose();
2175
- this.originalModel = null;
2176
- }
2177
- if (this.modifiedModel) {
2178
- this.modifiedModel.dispose();
2179
- this.modifiedModel = null;
2180
- }
4250
+ if (this.originalModel && this.originalModelOwned) this.originalModel.dispose();
4251
+ if (this.modifiedModel && this.modifiedModelOwned) this.modifiedModel.dispose();
4252
+ this.originalModel = null;
4253
+ this.modifiedModel = null;
4254
+ this.originalModelOwned = false;
4255
+ this.modifiedModelOwned = false;
2181
4256
  this.lastKnownOriginalCode = null;
2182
4257
  this.lastKnownModifiedCode = null;
4258
+ this.diffRootAppearanceSignature = null;
2183
4259
  if (this.lastContainer) {
2184
4260
  this.lastContainer.classList.remove("stream-monaco-diff-root");
4261
+ this.lastContainer.classList.remove(...DiffEditorManager.diffLineStyleClasses, ...DiffEditorManager.diffUnchangedRegionStyleClasses, ...DiffEditorManager.diffLayoutModeClasses, ...DiffEditorManager.diffAppearanceClasses);
2185
4262
  this.lastContainer.innerHTML = "";
2186
4263
  this.lastContainer = null;
2187
4264
  }
2188
- if (this.revealDebounceIdDiff != null) {
2189
- clearTimeout(this.revealDebounceIdDiff);
2190
- this.revealDebounceIdDiff = null;
2191
- }
2192
- if (this.revealIdleTimerIdDiff != null) {
2193
- clearTimeout(this.revealIdleTimerIdDiff);
2194
- this.revealIdleTimerIdDiff = null;
2195
- }
2196
- if (this.diffScrollWatcherSuppressionTimer != null) {
2197
- clearTimeout(this.diffScrollWatcherSuppressionTimer);
2198
- this.diffScrollWatcherSuppressionTimer = null;
2199
- }
2200
4265
  this.revealTicketDiff = 0;
2201
4266
  this.lastRevealLineDiff = null;
2202
4267
  this.diffPersistedUnchangedModelState = null;
4268
+ this.pendingDiffScrollRestorePosition = null;
4269
+ this.pendingDiffScrollRestoreBudget = 0;
4270
+ this.diffHideUnchangedRegionsResolved = null;
4271
+ this.diffHideUnchangedRegionsDeferred = false;
2203
4272
  }
2204
4273
  safeClean() {
2205
- this.rafScheduler.cancel("diff");
2206
- this.pendingDiffUpdate = null;
2207
- this.rafScheduler.cancel("appendDiff");
2208
- this.appendBufferDiffScheduled = false;
2209
- this.appendBufferOriginalDiff.length = 0;
2210
- this.appendBufferModifiedDiff.length = 0;
2211
- if (this.appendFlushThrottleTimerDiff != null) {
2212
- clearTimeout(this.appendFlushThrottleTimerDiff);
2213
- this.appendFlushThrottleTimerDiff = null;
2214
- }
4274
+ this.diffModelTransitionRequestId += 1;
4275
+ this.preserveNativeDiffDecorationsOnStaleAppend = false;
4276
+ this.disposePendingPreparedDiffViewModel();
4277
+ this.clearAsyncWork();
2215
4278
  this.hideDiffHunkActions();
2216
- this.cancelScheduledHideDiffHunkActions();
2217
4279
  this.disposeDiffUnchangedRegionEnhancements();
4280
+ this.disposeDiffPresentationTracking();
2218
4281
  if (this.diffScrollWatcher) {
2219
4282
  this.diffScrollWatcher.dispose();
2220
4283
  this.diffScrollWatcher = null;
@@ -2226,23 +4289,10 @@ var DiffEditorManager = class DiffEditorManager {
2226
4289
  this.diffHeightManager.dispose();
2227
4290
  this.diffHeightManager = null;
2228
4291
  }
2229
- if (this.revealDebounceIdDiff != null) {
2230
- clearTimeout(this.revealDebounceIdDiff);
2231
- this.revealDebounceIdDiff = null;
2232
- }
2233
- if (this.revealIdleTimerIdDiff != null) {
2234
- clearTimeout(this.revealIdleTimerIdDiff);
2235
- this.revealIdleTimerIdDiff = null;
2236
- }
2237
- if (this.diffScrollWatcherSuppressionTimer != null) {
2238
- clearTimeout(this.diffScrollWatcherSuppressionTimer);
2239
- this.diffScrollWatcherSuppressionTimer = null;
2240
- }
2241
4292
  this.revealTicketDiff = 0;
2242
4293
  this.lastRevealLineDiff = null;
2243
4294
  this.diffPersistedUnchangedModelState = null;
2244
- this.rafScheduler.cancel("content-size-change-diff");
2245
- this.rafScheduler.cancel("sync-last-known-modified");
4295
+ this.diffHideUnchangedRegionsDeferred = false;
2246
4296
  }
2247
4297
  syncLastKnownModified() {
2248
4298
  if (!this.diffEditorView || !this.lastKnownModifiedDirty) return;
@@ -2281,15 +4331,19 @@ var DiffEditorManager = class DiffEditorManager {
2281
4331
  if (this.lastKnownOriginalCode == null) this.lastKnownOriginalCode = o.getValue();
2282
4332
  if (this.lastKnownModifiedCode == null) this.lastKnownModifiedCode = m.getValue();
2283
4333
  const prevO = this.lastKnownOriginalCode;
4334
+ const originalTailAppend = prevO !== original && original.startsWith(prevO) && prevO.length < original.length;
2284
4335
  if (prevO !== original) {
2285
- if (original.startsWith(prevO) && prevO.length < original.length) this.appendToModel(o, original.slice(prevO.length));
4336
+ if (originalTailAppend) this.appendToModel(o, original.slice(prevO.length));
2286
4337
  else this.applyMinimalEditToModel(o, prevO, original);
2287
4338
  this.lastKnownOriginalCode = original;
2288
4339
  }
2289
4340
  const prevM = m.getValue();
2290
4341
  const prevMLineCount = m.getLineCount();
4342
+ const modifiedTailAppend = prevM !== modified && modified.startsWith(prevM) && prevM.length < modified.length;
4343
+ const hasContentChange = prevO !== original || prevM !== modified;
4344
+ if (hasContentChange) this.preserveNativeDiffDecorationsOnStaleAppend = (prevO === original || originalTailAppend) && (prevM === modified || modifiedTailAppend);
2291
4345
  if (prevM !== modified) {
2292
- if (modified.startsWith(prevM) && prevM.length < modified.length) this.appendToModel(m, modified.slice(prevM.length));
4346
+ if (modifiedTailAppend) this.appendToModel(m, modified.slice(prevM.length));
2293
4347
  else this.applyMinimalEditToModel(m, prevM, modified);
2294
4348
  this.lastKnownModifiedCode = modified;
2295
4349
  const newMLineCount = m.getLineCount();
@@ -2299,7 +4353,7 @@ var DiffEditorManager = class DiffEditorManager {
2299
4353
  const computed$2 = this.computedHeight();
2300
4354
  if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) {
2301
4355
  this.lastContainer.style.height = `${this.maxHeightValue}px`;
2302
- this.lastContainer.style.overflow = "auto";
4356
+ this.lastContainer.style.overflow = "hidden";
2303
4357
  }
2304
4358
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayoutDiff(newMLineCount);
2305
4359
  else this.maybeScrollDiffToBottom(newMLineCount, prevMLineCount);
@@ -2314,6 +4368,7 @@ var DiffEditorManager = class DiffEditorManager {
2314
4368
  const text = this.appendBufferModifiedDiff.join("");
2315
4369
  this.appendBufferModifiedDiff.length = 0;
2316
4370
  if (!text) return;
4371
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
2317
4372
  this.appendToModel(this.modifiedModel, text);
2318
4373
  }
2319
4374
  async flushAppendBufferDiff() {
@@ -2324,7 +4379,10 @@ var DiffEditorManager = class DiffEditorManager {
2324
4379
  if (this.originalModel && this.appendBufferOriginalDiff.length > 0) {
2325
4380
  const oText = this.appendBufferOriginalDiff.join("");
2326
4381
  this.appendBufferOriginalDiff.length = 0;
2327
- if (oText) this.appendToModel(this.originalModel, oText);
4382
+ if (oText) {
4383
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
4384
+ this.appendToModel(this.originalModel, oText);
4385
+ }
2328
4386
  }
2329
4387
  const me = this.diffEditorView.getModifiedEditor();
2330
4388
  const model = me.getModel();
@@ -2373,6 +4431,7 @@ var DiffEditorManager = class DiffEditorManager {
2373
4431
  });
2374
4432
  const lastColumn$1 = model.getLineMaxColumn(prevLine);
2375
4433
  const range$1 = new monaco_shim_exports.Range(prevLine, lastColumn$1, prevLine, lastColumn$1);
4434
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
2376
4435
  model.applyEdits([{
2377
4436
  range: range$1,
2378
4437
  text: part,
@@ -2393,7 +4452,7 @@ var DiffEditorManager = class DiffEditorManager {
2393
4452
  const computed$3 = this.computedHeight();
2394
4453
  if (computed$3 >= this.maxHeightValue - 1 && this.lastContainer) {
2395
4454
  this.lastContainer.style.height = `${this.maxHeightValue}px`;
2396
- this.lastContainer.style.overflow = "auto";
4455
+ this.lastContainer.style.overflow = "hidden";
2397
4456
  }
2398
4457
  if (shouldImmediate$1) this.scheduleImmediateRevealAfterLayoutDiff(newLine$1);
2399
4458
  else this.maybeScrollDiffToBottom(newLine$1, prevLine);
@@ -2411,6 +4470,7 @@ var DiffEditorManager = class DiffEditorManager {
2411
4470
  prevLine = model.getLineCount();
2412
4471
  const lastColumn = model.getLineMaxColumn(prevLine);
2413
4472
  const range = new monaco_shim_exports.Range(prevLine, lastColumn, prevLine, lastColumn);
4473
+ this.preserveNativeDiffDecorationsOnStaleAppend = true;
2414
4474
  model.applyEdits([{
2415
4475
  range,
2416
4476
  text,
@@ -2425,23 +4485,10 @@ var DiffEditorManager = class DiffEditorManager {
2425
4485
  if (computed$2 >= this.maxHeightValue - 1 && this.lastContainer) this.lastContainer.style.height = `${this.maxHeightValue}px`;
2426
4486
  if (shouldImmediate) this.scheduleImmediateRevealAfterLayoutDiff(newLine);
2427
4487
  else this.maybeScrollDiffToBottom(newLine, prevLine);
2428
- if (this.autoScrollOnUpdate && this.shouldAutoScrollDiff) try {
2429
- var _editor4, _me2$getModel2, _me2$getScrollTop2;
2430
- const ScrollType = monaco_shim_exports.ScrollType || ((_editor4 = monaco_shim_exports.editor) === null || _editor4 === void 0 ? void 0 : _editor4.ScrollType);
2431
- const immediate = ScrollType && typeof ScrollType.Immediate !== "undefined" ? ScrollType.Immediate : void 0;
2432
- const me2 = this.diffEditorView.getModifiedEditor();
2433
- const targetLine = ((_me2$getModel2 = me2.getModel()) === null || _me2$getModel2 === void 0 ? void 0 : _me2$getModel2.getLineCount()) ?? newLine;
2434
- if (typeof immediate !== "undefined") me2.revealLine(targetLine, immediate);
2435
- else me2.revealLine(targetLine);
2436
- this.lastRevealLineDiff = targetLine;
2437
- this.shouldAutoScrollDiff = true;
2438
- this.lastScrollTopDiff = ((_me2$getScrollTop2 = me2.getScrollTop) === null || _me2$getScrollTop2 === void 0 ? void 0 : _me2$getScrollTop2.call(me2)) ?? this.lastScrollTopDiff;
2439
- } catch {}
2440
4488
  if (suppressedByFlush) watcherApi.setSuppressed(false);
2441
4489
  try {
2442
- var _this$diffEditorView14, _this$diffEditorView15, _this$diffEditorView16;
2443
- this.shouldAutoScrollDiff = true;
2444
- this.lastScrollTopDiff = ((_this$diffEditorView14 = this.diffEditorView) === null || _this$diffEditorView14 === void 0 || (_this$diffEditorView16 = (_this$diffEditorView15 = _this$diffEditorView14.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView16 === void 0 ? void 0 : _this$diffEditorView16.call(_this$diffEditorView15)) ?? this.lastScrollTopDiff;
4490
+ var _this$diffEditorView33, _this$diffEditorView34, _this$diffEditorView35;
4491
+ this.lastScrollTopDiff = ((_this$diffEditorView33 = this.diffEditorView) === null || _this$diffEditorView33 === void 0 || (_this$diffEditorView35 = (_this$diffEditorView34 = _this$diffEditorView33.getModifiedEditor()).getScrollTop) === null || _this$diffEditorView35 === void 0 ? void 0 : _this$diffEditorView35.call(_this$diffEditorView34)) ?? this.lastScrollTopDiff;
2445
4492
  } catch {}
2446
4493
  }
2447
4494
  applyMinimalEditToModel(model, prev, next) {
@@ -2489,6 +4536,9 @@ var EditorManager = class {
2489
4536
  lastKnownCode = null;
2490
4537
  pendingUpdate = null;
2491
4538
  _hasScrollBar = false;
4539
+ updateThrottleMs = 50;
4540
+ lastUpdateFlushTime = 0;
4541
+ updateThrottleTimer = null;
2492
4542
  shouldAutoScroll = true;
2493
4543
  scrollWatcher = null;
2494
4544
  scrollWatcherSuppressionTimer = null;
@@ -2498,6 +4548,7 @@ var EditorManager = class {
2498
4548
  cachedComputedHeight = null;
2499
4549
  cachedLineCount = null;
2500
4550
  lastKnownCodeDirty = false;
4551
+ programmaticContentChangeDepth = 0;
2501
4552
  debug = false;
2502
4553
  measureViewport() {
2503
4554
  var _this$editorView$getL, _this$editorView, _this$editorView$getS, _this$editorView2, _this$editorView$getS2, _this$editorView3;
@@ -2530,7 +4581,7 @@ var EditorManager = class {
2530
4581
  revealStrategyOption;
2531
4582
  revealBatchOnIdleMsOption;
2532
4583
  scrollWatcherSuppressionMs = 500;
2533
- constructor(options, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, revealDebounceMsOption) {
4584
+ constructor(options, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, revealDebounceMsOption, updateThrottleMsOption) {
2534
4585
  this.options = options;
2535
4586
  this.maxHeightValue = maxHeightValue;
2536
4587
  this.maxHeightCSS = maxHeightCSS;
@@ -2539,6 +4590,47 @@ var EditorManager = class {
2539
4590
  this.autoScrollThresholdPx = autoScrollThresholdPx;
2540
4591
  this.autoScrollThresholdLines = autoScrollThresholdLines;
2541
4592
  this.revealDebounceMsOption = revealDebounceMsOption;
4593
+ this.updateThrottleMsOption = updateThrottleMsOption;
4594
+ this.updateThrottleMs = this.updateThrottleMsOption ?? this.options.updateThrottleMs ?? 50;
4595
+ }
4596
+ cancelRafs() {
4597
+ this.rafScheduler.cancel("update");
4598
+ this.rafScheduler.cancel("sync-last-known");
4599
+ this.rafScheduler.cancel("content-size-change");
4600
+ this.rafScheduler.cancel("maybe-scroll");
4601
+ this.rafScheduler.cancel("reveal");
4602
+ this.rafScheduler.cancel("immediate-reveal");
4603
+ this.rafScheduler.cancel("maybe-resume");
4604
+ this.rafScheduler.cancel("append");
4605
+ }
4606
+ clearRevealTimers() {
4607
+ if (this.revealDebounceId != null) {
4608
+ clearTimeout(this.revealDebounceId);
4609
+ this.revealDebounceId = null;
4610
+ }
4611
+ if (this.revealIdleTimerId != null) {
4612
+ clearTimeout(this.revealIdleTimerId);
4613
+ this.revealIdleTimerId = null;
4614
+ }
4615
+ }
4616
+ resetAppendState() {
4617
+ this.appendBufferScheduled = false;
4618
+ this.appendBuffer.length = 0;
4619
+ }
4620
+ clearAsyncWork() {
4621
+ this.cancelRafs();
4622
+ this.pendingUpdate = null;
4623
+ this.lastKnownCodeDirty = false;
4624
+ this.resetAppendState();
4625
+ this.clearRevealTimers();
4626
+ if (this.scrollWatcherSuppressionTimer != null) {
4627
+ clearTimeout(this.scrollWatcherSuppressionTimer);
4628
+ this.scrollWatcherSuppressionTimer = null;
4629
+ }
4630
+ if (this.updateThrottleTimer != null) {
4631
+ clearTimeout(this.updateThrottleTimer);
4632
+ this.updateThrottleTimer = null;
4633
+ }
2542
4634
  }
2543
4635
  initDebugFlag() {
2544
4636
  if (typeof window !== "undefined" && window.__STREAM_MONACO_DEBUG__ !== void 0) {
@@ -2555,6 +4647,14 @@ var EditorManager = class {
2555
4647
  if (!this.debug) return;
2556
4648
  log("EditorManager", ...args);
2557
4649
  }
4650
+ runAsProgrammaticContentChange(fn) {
4651
+ this.programmaticContentChangeDepth += 1;
4652
+ try {
4653
+ return fn();
4654
+ } finally {
4655
+ this.programmaticContentChangeDepth -= 1;
4656
+ }
4657
+ }
2558
4658
  hasVerticalScrollbar() {
2559
4659
  if (!this.editorView) return false;
2560
4660
  if (this._hasScrollBar) return true;
@@ -2781,6 +4881,7 @@ var EditorManager = class {
2781
4881
  });
2782
4882
  });
2783
4883
  this.editorView.onDidChangeModelContent(() => {
4884
+ if (this.programmaticContentChangeDepth > 0) return;
2784
4885
  this.lastKnownCodeDirty = true;
2785
4886
  this.rafScheduler.schedule("sync-last-known", () => this.syncLastKnownCode());
2786
4887
  });
@@ -2875,7 +4976,24 @@ var EditorManager = class {
2875
4976
  code: newCode,
2876
4977
  lang: codeLanguage
2877
4978
  };
2878
- this.rafScheduler.schedule("update", () => this.flushPendingUpdate());
4979
+ this.rafScheduler.schedule("update", () => {
4980
+ if (!this.updateThrottleMs) {
4981
+ this.flushPendingUpdate();
4982
+ return;
4983
+ }
4984
+ const now = Date.now();
4985
+ const since = now - this.lastUpdateFlushTime;
4986
+ if (since >= this.updateThrottleMs) {
4987
+ this.flushPendingUpdate();
4988
+ return;
4989
+ }
4990
+ if (this.updateThrottleTimer != null) return;
4991
+ const wait = this.updateThrottleMs - since;
4992
+ this.updateThrottleTimer = setTimeout(() => {
4993
+ this.updateThrottleTimer = null;
4994
+ this.rafScheduler.schedule("update", () => this.flushPendingUpdate());
4995
+ }, wait);
4996
+ });
2879
4997
  }
2880
4998
  flushPendingUpdate() {
2881
4999
  if (!this.pendingUpdate || !this.editorView) return;
@@ -2883,12 +5001,15 @@ var EditorManager = class {
2883
5001
  if (!model) return;
2884
5002
  const { code: newCode, lang: codeLanguage } = this.pendingUpdate;
2885
5003
  this.pendingUpdate = null;
5004
+ this.lastUpdateFlushTime = Date.now();
2886
5005
  const processedCodeLanguage = processedLanguage(codeLanguage);
2887
5006
  const languageId = model.getLanguageId();
2888
5007
  if (languageId !== processedCodeLanguage) {
2889
5008
  if (processedCodeLanguage) monaco_shim_exports.editor.setModelLanguage(model, processedCodeLanguage);
2890
5009
  const prevLineCount$1 = model.getLineCount();
2891
- model.setValue(newCode);
5010
+ this.runAsProgrammaticContentChange(() => {
5011
+ model.setValue(newCode);
5012
+ });
2892
5013
  this.lastKnownCode = newCode;
2893
5014
  const newLineCount$1 = model.getLineCount();
2894
5015
  this.cachedLineCount = newLineCount$1;
@@ -2901,8 +5022,21 @@ var EditorManager = class {
2901
5022
  }
2902
5023
  return;
2903
5024
  }
2904
- const buffered = this.appendBuffer.length > 0 ? this.appendBuffer.join("") : "";
2905
- const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() + buffered : this.lastKnownCode ?? this.editorView.getValue();
5025
+ let prevCode;
5026
+ if (this.appendBuffer.length > 0) {
5027
+ this.resetAppendState();
5028
+ this.rafScheduler.cancel("append");
5029
+ try {
5030
+ prevCode = model.getValue();
5031
+ this.lastKnownCode = prevCode;
5032
+ } catch {
5033
+ prevCode = this.lastKnownCode ?? "";
5034
+ }
5035
+ } else if (this.lastKnownCode != null) prevCode = this.lastKnownCode;
5036
+ else {
5037
+ prevCode = this.editorView.getValue();
5038
+ this.lastKnownCode = prevCode;
5039
+ }
2906
5040
  if (prevCode === newCode) return;
2907
5041
  if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
2908
5042
  const suffix = newCode.slice(prevCode.length);
@@ -2946,7 +5080,9 @@ var EditorManager = class {
2946
5080
  const changeRatio = maxLen > 0 ? Math.abs(next.length - prev.length) / maxLen : 0;
2947
5081
  if (prev.length + next.length > maxChars || changeRatio > ratio) {
2948
5082
  const prevLineCount = model.getLineCount();
2949
- model.setValue(next);
5083
+ this.runAsProgrammaticContentChange(() => {
5084
+ model.setValue(next);
5085
+ });
2950
5086
  this.lastKnownCode = next;
2951
5087
  const newLineCount = model.getLineCount();
2952
5088
  this.cachedLineCount = newLineCount;
@@ -2965,8 +5101,10 @@ var EditorManager = class {
2965
5101
  text: replaceText,
2966
5102
  forceMoveMarkers: true
2967
5103
  }];
2968
- if (isReadOnly) model.applyEdits(edit);
2969
- else this.editorView.executeEdits("minimal-replace", edit);
5104
+ this.runAsProgrammaticContentChange(() => {
5105
+ if (isReadOnly) model.applyEdits(edit);
5106
+ else this.editorView.executeEdits("minimal-replace", edit);
5107
+ });
2970
5108
  }
2971
5109
  flushAppendBuffer() {
2972
5110
  if (!this.editorView) return;
@@ -2983,19 +5121,20 @@ var EditorManager = class {
2983
5121
  const lastColumn = model.getLineMaxColumn(lastLine);
2984
5122
  const range = new monaco_shim_exports.Range(lastLine, lastColumn, lastLine, lastColumn);
2985
5123
  const isReadOnly = this.editorView.getOption(monaco_shim_exports.editor.EditorOption.readOnly);
2986
- if (isReadOnly) model.applyEdits([{
2987
- range,
2988
- text,
2989
- forceMoveMarkers: true
2990
- }]);
2991
- else this.editorView.executeEdits("append", [{
2992
- range,
2993
- text,
2994
- forceMoveMarkers: true
2995
- }]);
2996
- try {
2997
- this.lastKnownCode = model.getValue();
2998
- } catch {}
5124
+ this.runAsProgrammaticContentChange(() => {
5125
+ if (isReadOnly) model.applyEdits([{
5126
+ range,
5127
+ text,
5128
+ forceMoveMarkers: true
5129
+ }]);
5130
+ else this.editorView.executeEdits("append", [{
5131
+ range,
5132
+ text,
5133
+ forceMoveMarkers: true
5134
+ }]);
5135
+ });
5136
+ if (this.lastKnownCode != null) this.lastKnownCode = this.lastKnownCode + text;
5137
+ else this.lastKnownCode = model.getValue();
2999
5138
  const newLineCount = model.getLineCount();
3000
5139
  if (lastLine !== newLineCount) {
3001
5140
  this.cachedLineCount = newLineCount;
@@ -3020,30 +5159,19 @@ var EditorManager = class {
3020
5159
  getEditorView() {
3021
5160
  return this.editorView;
3022
5161
  }
3023
- cleanup() {
3024
- this.rafScheduler.cancel("update");
3025
- this.rafScheduler.cancel("sync-last-known");
3026
- this.rafScheduler.cancel("content-size-change");
3027
- this.rafScheduler.cancel("maybe-scroll");
3028
- this.rafScheduler.cancel("reveal");
3029
- this.rafScheduler.cancel("immediate-reveal");
3030
- this.rafScheduler.cancel("maybe-resume");
3031
- this.pendingUpdate = null;
3032
- this.rafScheduler.cancel("append");
3033
- this.appendBufferScheduled = false;
3034
- this.appendBuffer.length = 0;
3035
- if (this.revealDebounceId != null) {
3036
- clearTimeout(this.revealDebounceId);
3037
- this.revealDebounceId = null;
3038
- }
3039
- if (this.revealIdleTimerId != null) {
3040
- clearTimeout(this.revealIdleTimerId);
3041
- this.revealIdleTimerId = null;
3042
- }
3043
- if (this.scrollWatcherSuppressionTimer != null) {
3044
- clearTimeout(this.scrollWatcherSuppressionTimer);
3045
- this.scrollWatcherSuppressionTimer = null;
5162
+ setUpdateThrottleMs(ms) {
5163
+ this.updateThrottleMs = ms;
5164
+ if (!this.updateThrottleMs && this.updateThrottleTimer != null) {
5165
+ clearTimeout(this.updateThrottleTimer);
5166
+ this.updateThrottleTimer = null;
5167
+ this.rafScheduler.schedule("update", () => this.flushPendingUpdate());
3046
5168
  }
5169
+ }
5170
+ getUpdateThrottleMs() {
5171
+ return this.updateThrottleMs;
5172
+ }
5173
+ cleanup() {
5174
+ this.clearAsyncWork();
3047
5175
  if (this.editorView) {
3048
5176
  this.editorView.dispose();
3049
5177
  this.editorView = null;
@@ -3064,31 +5192,13 @@ var EditorManager = class {
3064
5192
  }
3065
5193
  }
3066
5194
  safeClean() {
3067
- this.rafScheduler.cancel("update");
3068
- this.pendingUpdate = null;
3069
- this.rafScheduler.cancel("sync-last-known");
5195
+ this.clearAsyncWork();
3070
5196
  if (this.scrollWatcher) {
3071
5197
  try {
3072
5198
  this.scrollWatcher.dispose();
3073
5199
  } catch {}
3074
5200
  this.scrollWatcher = null;
3075
5201
  }
3076
- if (this.revealDebounceId != null) {
3077
- clearTimeout(this.revealDebounceId);
3078
- this.revealDebounceId = null;
3079
- }
3080
- if (this.revealIdleTimerId != null) {
3081
- clearTimeout(this.revealIdleTimerId);
3082
- this.revealIdleTimerId = null;
3083
- }
3084
- if (this.scrollWatcherSuppressionTimer != null) {
3085
- clearTimeout(this.scrollWatcherSuppressionTimer);
3086
- this.scrollWatcherSuppressionTimer = null;
3087
- }
3088
- this.rafScheduler.cancel("maybe-scroll");
3089
- this.rafScheduler.cancel("reveal");
3090
- this.rafScheduler.cancel("immediate-reveal");
3091
- this.rafScheduler.cancel("maybe-resume");
3092
5202
  this._hasScrollBar = false;
3093
5203
  this.shouldAutoScroll = !!this.autoScrollInitial;
3094
5204
  this.lastScrollTop = 0;
@@ -3412,7 +5522,9 @@ let globalAppliedThemeName = null;
3412
5522
  * updateModified: (newCode: string, codeLanguage?: string) => void,
3413
5523
  * appendOriginal: (appendText: string, codeLanguage?: string) => void,
3414
5524
  * appendModified: (appendText: string, codeLanguage?: string) => void,
5525
+ * setDiffModels: (models: DiffModelPair, options?: DiffModelTransitionOptions) => Promise<void>,
3415
5526
  * setTheme: (theme: MonacoTheme) => Promise<void>,
5527
+ * refreshDiffPresentation: () => void,
3416
5528
  * setLanguage: (language: MonacoLanguage) => void,
3417
5529
  * getCurrentTheme: () => string,
3418
5530
  * getEditor: () => typeof monaco.editor,
@@ -3432,7 +5544,9 @@ let globalAppliedThemeName = null;
3432
5544
  * @property {Function} updateModified - 仅更新 Diff 的 modified 内容(增量更新)
3433
5545
  * @property {Function} appendOriginal - 在 Diff 的 original 末尾追加(显式流式场景)
3434
5546
  * @property {Function} appendModified - 在 Diff 的 modified 末尾追加(显式流式场景)
5547
+ * @property {Function} setDiffModels - 切换为一对新的 Diff models;当内容未变化时自动走保留视图状态的无抖动路径
3435
5548
  * @property {Function} setTheme - 切换编辑器主题,返回 Promise,在主题应用完成时 resolve
5549
+ * @property {Function} refreshDiffPresentation - 在不 remount 的情况下,重算 diff chrome / unchanged overlay 的表现层
3436
5550
  * @property {Function} setLanguage - 切换编辑器语言
3437
5551
  * @property {Function} getCurrentTheme - 获取当前主题名称
3438
5552
  * @property {Function} getEditor - 获取 Monaco 的静态 editor 对象(用于静态方法调用)
@@ -3550,12 +5664,14 @@ function useMonaco(monacoOptions = {}) {
3550
5664
  try {
3551
5665
  monaco_shim_exports.editor.setTheme(themeName);
3552
5666
  globalAppliedThemeName = themeName;
5667
+ monacoOptions.theme = themeName;
3553
5668
  } catch {
3554
5669
  try {
3555
5670
  const maybeHighlighter = await registerMonacoThemes(themes, languages$1);
3556
5671
  if (token !== globalThemeRequestSeq) return;
3557
5672
  monaco_shim_exports.editor.setTheme(themeName);
3558
5673
  globalAppliedThemeName = themeName;
5674
+ monacoOptions.theme = themeName;
3559
5675
  await tryLoadAndSetShikiTheme(maybeHighlighter, themeName).catch(() => void 0);
3560
5676
  } catch (err2) {
3561
5677
  console.warn(`Failed to set theme "${themeName}":`, err2);
@@ -3563,6 +5679,11 @@ function useMonaco(monacoOptions = {}) {
3563
5679
  }
3564
5680
  }
3565
5681
  if (token !== globalThemeRequestSeq) return;
5682
+ try {
5683
+ diffMgr === null || diffMgr === void 0 || diffMgr.notifyThemeChange(themeName);
5684
+ } catch (err) {
5685
+ console.warn("diff theme sync threw an error:", err);
5686
+ }
3566
5687
  try {
3567
5688
  if (typeof monacoOptions.onThemeChange === "function") await monacoOptions.onThemeChange(themeName);
3568
5689
  } catch (err) {
@@ -3614,9 +5735,9 @@ function useMonaco(monacoOptions = {}) {
3614
5735
  const ds = monacoOptions.onBeforeCreate(monaco_shim_exports);
3615
5736
  if (ds) disposals.push(...ds);
3616
5737
  }
3617
- const initialThemeName = requestedThemeName ?? monacoOptions.theme ?? globalRequestedThemeName ?? currentTheme.value;
5738
+ const initialThemeName = monacoOptions.theme ?? requestedThemeName ?? globalRequestedThemeName ?? currentTheme.value;
3618
5739
  await ensureThemeRegistered(initialThemeName);
3619
- editorMgr = new EditorManager(monacoOptions, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, monacoOptions.revealDebounceMs);
5740
+ editorMgr = new EditorManager(monacoOptions, maxHeightValue, maxHeightCSS, autoScrollOnUpdate, autoScrollInitial, autoScrollThresholdPx, autoScrollThresholdLines, monacoOptions.revealDebounceMs, updateThrottleMs);
3620
5741
  editorView = await editorMgr.createEditor(container, code, language, initialThemeName);
3621
5742
  if (pendingUpdate && editorMgr) {
3622
5743
  const { code: queuedCode, lang: queuedLang } = pendingUpdate;
@@ -3645,7 +5766,7 @@ function useMonaco(monacoOptions = {}) {
3645
5766
  const ds = monacoOptions.onBeforeCreate(monaco_shim_exports);
3646
5767
  if (ds) disposals.push(...ds);
3647
5768
  }
3648
- const initialThemeName = requestedThemeName ?? monacoOptions.theme ?? globalRequestedThemeName ?? currentTheme.value;
5769
+ const initialThemeName = monacoOptions.theme ?? requestedThemeName ?? globalRequestedThemeName ?? currentTheme.value;
3649
5770
  await ensureThemeRegistered(initialThemeName);
3650
5771
  try {
3651
5772
  monaco_shim_exports.editor.setTheme(initialThemeName);
@@ -3658,6 +5779,23 @@ function useMonaco(monacoOptions = {}) {
3658
5779
  modifiedModel = models.modified;
3659
5780
  return diffEditorView;
3660
5781
  }
5782
+ function clearFallbackAsyncWork() {
5783
+ rafScheduler.cancel("update");
5784
+ rafScheduler.cancel("append");
5785
+ rafScheduler.cancel("reveal");
5786
+ pendingUpdate = null;
5787
+ appendBufferScheduled = false;
5788
+ appendBuffer.length = 0;
5789
+ if (revealDebounceId != null) {
5790
+ clearTimeout(revealDebounceId);
5791
+ revealDebounceId = null;
5792
+ }
5793
+ if (updateThrottleTimer != null) {
5794
+ clearTimeout(updateThrottleTimer);
5795
+ updateThrottleTimer = null;
5796
+ }
5797
+ lastFlushTime = 0;
5798
+ }
3661
5799
  function cleanupEditor() {
3662
5800
  if (editorMgr) {
3663
5801
  editorMgr.cleanup();
@@ -3667,11 +5805,7 @@ function useMonaco(monacoOptions = {}) {
3667
5805
  diffMgr.cleanup();
3668
5806
  diffMgr = null;
3669
5807
  }
3670
- rafScheduler.cancel("update");
3671
- pendingUpdate = null;
3672
- rafScheduler.cancel("append");
3673
- appendBufferScheduled = false;
3674
- appendBuffer.length = 0;
5808
+ clearFallbackAsyncWork();
3675
5809
  if (!editorMgr && editorView) {
3676
5810
  editorView.dispose();
3677
5811
  editorView = null;
@@ -3685,10 +5819,6 @@ function useMonaco(monacoOptions = {}) {
3685
5819
  themeWatcher();
3686
5820
  themeWatcher = null;
3687
5821
  }
3688
- if (updateThrottleTimer != null) {
3689
- clearTimeout(updateThrottleTimer);
3690
- updateThrottleTimer = null;
3691
- }
3692
5822
  diffEditorView = null;
3693
5823
  originalModel = null;
3694
5824
  modifiedModel = null;
@@ -3754,13 +5884,17 @@ function useMonaco(monacoOptions = {}) {
3754
5884
  pendingUpdate = null;
3755
5885
  const processedCodeLanguage = processedLanguage(codeLanguage);
3756
5886
  let prevCode = null;
3757
- if (appendBuffer.length > 0) try {
3758
- prevCode = model.getValue();
3759
- lastKnownCode = prevCode;
3760
- } catch {
3761
- prevCode = "";
3762
- }
3763
- else {
5887
+ if (appendBuffer.length > 0) {
5888
+ appendBuffer.length = 0;
5889
+ appendBufferScheduled = false;
5890
+ rafScheduler.cancel("append");
5891
+ try {
5892
+ prevCode = model.getValue();
5893
+ lastKnownCode = prevCode;
5894
+ } catch {
5895
+ prevCode = lastKnownCode ?? "";
5896
+ }
5897
+ } else {
3764
5898
  prevCode = lastKnownCode;
3765
5899
  if (prevCode == null) try {
3766
5900
  prevCode = model.getValue();
@@ -3877,9 +6011,10 @@ function useMonaco(monacoOptions = {}) {
3877
6011
  }
3878
6012
  function setUpdateThrottleMs(ms) {
3879
6013
  updateThrottleMs = ms;
6014
+ editorMgr === null || editorMgr === void 0 || editorMgr.setUpdateThrottleMs(ms);
3880
6015
  }
3881
6016
  function getUpdateThrottleMs() {
3882
- return updateThrottleMs;
6017
+ return (editorMgr === null || editorMgr === void 0 ? void 0 : editorMgr.getUpdateThrottleMs()) ?? updateThrottleMs;
3883
6018
  }
3884
6019
  function updateDiff(originalCode, modifiedCode, codeLanguage) {
3885
6020
  if (diffMgr) diffMgr.updateDiff(originalCode, modifiedCode, codeLanguage);
@@ -3896,13 +6031,22 @@ function useMonaco(monacoOptions = {}) {
3896
6031
  function appendModified(appendText, codeLanguage) {
3897
6032
  if (diffMgr) diffMgr.appendModified(appendText, codeLanguage);
3898
6033
  }
6034
+ async function setDiffModels(models, options) {
6035
+ if (!diffMgr) return;
6036
+ await diffMgr.setDiffModels(models, options);
6037
+ const activeModels = diffMgr.getDiffModels();
6038
+ originalModel = activeModels.original;
6039
+ modifiedModel = activeModels.modified;
6040
+ }
6041
+ function refreshDiffPresentation() {
6042
+ if (diffMgr) diffMgr.refreshDiffPresentation();
6043
+ }
3899
6044
  return {
3900
6045
  createEditor,
3901
6046
  createDiffEditor,
3902
6047
  cleanupEditor,
3903
6048
  safeClean() {
3904
- rafScheduler.cancel("update");
3905
- pendingUpdate = null;
6049
+ clearFallbackAsyncWork();
3906
6050
  if (editorMgr) try {
3907
6051
  editorMgr.safeClean();
3908
6052
  } catch {}
@@ -3919,7 +6063,9 @@ function useMonaco(monacoOptions = {}) {
3919
6063
  updateModified,
3920
6064
  appendOriginal,
3921
6065
  appendModified,
6066
+ setDiffModels,
3922
6067
  setTheme: setThemeInternal,
6068
+ refreshDiffPresentation,
3923
6069
  setLanguage(language) {
3924
6070
  if (editorMgr) {
3925
6071
  editorMgr.setLanguage(language, languages$1);
@@ -3951,6 +6097,7 @@ function useMonaco(monacoOptions = {}) {
3951
6097
  return diffEditorView;
3952
6098
  },
3953
6099
  getDiffModels() {
6100
+ if (diffMgr) return diffMgr.getDiffModels();
3954
6101
  return {
3955
6102
  original: originalModel,
3956
6103
  modified: modifiedModel