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