-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchunk-4CBXRCG6.js
More file actions
7059 lines (7045 loc) · 442 KB
/
chunk-4CBXRCG6.js
File metadata and controls
7059 lines (7045 loc) · 442 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import {
EmbeddedTutorialManager
} from "./chunk-4QI4G4N7.js";
import {
ErrorSnackBar
} from "./chunk-RMPG5AWL.js";
import {
MatSnackBar
} from "./chunk-4ONR2TF5.js";
import {
LOCAL_STORAGE,
WINDOW,
WebContainer,
checkFilesInDirectory,
isIos,
isMobile
} from "./chunk-A6VPSR6T.js";
import {
takeUntilDestroyed,
toObservable
} from "./chunk-7F6UZAKO.js";
import {
BehaviorSubject,
DestroyRef,
Injectable,
Subject,
__commonJS,
__name,
__publicField,
__spreadValues,
__toESM,
computed,
effect,
filter,
inject,
map,
setClassMetadata,
signal,
untracked,
ɵɵdefineInjectable
} from "./chunk-2CX5BJWG.js";
// node_modules/@xterm/xterm/lib/xterm.js
var require_xterm = __commonJS({
"node_modules/@xterm/xterm/lib/xterm.js"(exports, module) {
"use strict";
!(function(e, t) {
if ("object" == typeof exports && "object" == typeof module) module.exports = t();
else if ("function" == typeof define && define.amd) define([], t);
else {
var i = t();
for (var s in i) ("object" == typeof exports ? exports : e)[s] = i[s];
}
})(globalThis, (() => (() => {
"use strict";
var e = { 4567: function(e2, t2, i2) {
var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
var r2, n2 = arguments.length, o2 = n2 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e3, t3, i3, s3);
else for (var a2 = e3.length - 1; a2 >= 0; a2--) (r2 = e3[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t3, i3, o2) : r2(t3, i3)) || o2);
return n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2;
}, r = this && this.__param || function(e3, t3) {
return function(i3, s3) {
t3(i3, s3, e3);
};
};
Object.defineProperty(t2, "__esModule", { value: true }), t2.AccessibilityManager = void 0;
const n = i2(9042), o = i2(9924), a = i2(844), h = i2(4725), c = i2(2585), l = i2(3656);
let d = t2.AccessibilityManager = class extends a.Disposable {
constructor(e3, t3, i3, s3) {
super(), this._terminal = e3, this._coreBrowserService = i3, this._renderService = s3, this._rowColumns = /* @__PURE__ */ new WeakMap(), this._liveRegionLineCount = 0, this._charsToConsume = [], this._charsToAnnounce = "", this._accessibilityContainer = this._coreBrowserService.mainDocument.createElement("div"), this._accessibilityContainer.classList.add("xterm-accessibility"), this._rowContainer = this._coreBrowserService.mainDocument.createElement("div"), this._rowContainer.setAttribute("role", "list"), this._rowContainer.classList.add("xterm-accessibility-tree"), this._rowElements = [];
for (let e4 = 0; e4 < this._terminal.rows; e4++) this._rowElements[e4] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[e4]);
if (this._topBoundaryFocusListener = (e4) => this._handleBoundaryFocus(e4, 0), this._bottomBoundaryFocusListener = (e4) => this._handleBoundaryFocus(e4, 1), this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions(), this._accessibilityContainer.appendChild(this._rowContainer), this._liveRegion = this._coreBrowserService.mainDocument.createElement("div"), this._liveRegion.classList.add("live-region"), this._liveRegion.setAttribute("aria-live", "assertive"), this._accessibilityContainer.appendChild(this._liveRegion), this._liveRegionDebouncer = this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))), !this._terminal.element) throw new Error("Cannot enable accessibility before Terminal.open");
this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityContainer), this.register(this._terminal.onResize(((e4) => this._handleResize(e4.rows)))), this.register(this._terminal.onRender(((e4) => this._refreshRows(e4.start, e4.end)))), this.register(this._terminal.onScroll((() => this._refreshRows()))), this.register(this._terminal.onA11yChar(((e4) => this._handleChar(e4)))), this.register(this._terminal.onLineFeed((() => this._handleChar("\n")))), this.register(this._terminal.onA11yTab(((e4) => this._handleTab(e4)))), this.register(this._terminal.onKey(((e4) => this._handleKey(e4.key)))), this.register(this._terminal.onBlur((() => this._clearLiveRegion()))), this.register(this._renderService.onDimensionsChange((() => this._refreshRowsDimensions()))), this.register((0, l.addDisposableDomListener)(document, "selectionchange", (() => this._handleSelectionChange()))), this.register(this._coreBrowserService.onDprChange((() => this._refreshRowsDimensions()))), this._refreshRows(), this.register((0, a.toDisposable)((() => {
this._accessibilityContainer.remove(), this._rowElements.length = 0;
})));
}
_handleTab(e3) {
for (let t3 = 0; t3 < e3; t3++) this._handleChar(" ");
}
_handleChar(e3) {
this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== e3 && (this._charsToAnnounce += e3) : this._charsToAnnounce += e3, "\n" === e3 && (this._liveRegionLineCount++, 21 === this._liveRegionLineCount && (this._liveRegion.textContent += n.tooMuchOutput)));
}
_clearLiveRegion() {
this._liveRegion.textContent = "", this._liveRegionLineCount = 0;
}
_handleKey(e3) {
this._clearLiveRegion(), new RegExp("\\p{Control}", "u").test(e3) || this._charsToConsume.push(e3);
}
_refreshRows(e3, t3) {
this._liveRegionDebouncer.refresh(e3, t3, this._terminal.rows);
}
_renderRows(e3, t3) {
const i3 = this._terminal.buffer, s3 = i3.lines.length.toString();
for (let r2 = e3; r2 <= t3; r2++) {
const e4 = i3.lines.get(i3.ydisp + r2), t4 = [], n2 = e4?.translateToString(true, void 0, void 0, t4) || "", o2 = (i3.ydisp + r2 + 1).toString(), a2 = this._rowElements[r2];
a2 && (0 === n2.length ? (a2.innerText = "\xA0", this._rowColumns.set(a2, [0, 1])) : (a2.textContent = n2, this._rowColumns.set(a2, t4)), a2.setAttribute("aria-posinset", o2), a2.setAttribute("aria-setsize", s3));
}
this._announceCharacters();
}
_announceCharacters() {
0 !== this._charsToAnnounce.length && (this._liveRegion.textContent += this._charsToAnnounce, this._charsToAnnounce = "");
}
_handleBoundaryFocus(e3, t3) {
const i3 = e3.target, s3 = this._rowElements[0 === t3 ? 1 : this._rowElements.length - 2];
if (i3.getAttribute("aria-posinset") === (0 === t3 ? "1" : `${this._terminal.buffer.lines.length}`)) return;
if (e3.relatedTarget !== s3) return;
let r2, n2;
if (0 === t3 ? (r2 = i3, n2 = this._rowElements.pop(), this._rowContainer.removeChild(n2)) : (r2 = this._rowElements.shift(), n2 = i3, this._rowContainer.removeChild(r2)), r2.removeEventListener("focus", this._topBoundaryFocusListener), n2.removeEventListener("focus", this._bottomBoundaryFocusListener), 0 === t3) {
const e4 = this._createAccessibilityTreeNode();
this._rowElements.unshift(e4), this._rowContainer.insertAdjacentElement("afterbegin", e4);
} else {
const e4 = this._createAccessibilityTreeNode();
this._rowElements.push(e4), this._rowContainer.appendChild(e4);
}
this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener), this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._terminal.scrollLines(0 === t3 ? -1 : 1), this._rowElements[0 === t3 ? 1 : this._rowElements.length - 2].focus(), e3.preventDefault(), e3.stopImmediatePropagation();
}
_handleSelectionChange() {
if (0 === this._rowElements.length) return;
const e3 = document.getSelection();
if (!e3) return;
if (e3.isCollapsed) return void (this._rowContainer.contains(e3.anchorNode) && this._terminal.clearSelection());
if (!e3.anchorNode || !e3.focusNode) return void console.error("anchorNode and/or focusNode are null");
let t3 = { node: e3.anchorNode, offset: e3.anchorOffset }, i3 = { node: e3.focusNode, offset: e3.focusOffset };
if ((t3.node.compareDocumentPosition(i3.node) & Node.DOCUMENT_POSITION_PRECEDING || t3.node === i3.node && t3.offset > i3.offset) && ([t3, i3] = [i3, t3]), t3.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING) && (t3 = { node: this._rowElements[0].childNodes[0], offset: 0 }), !this._rowContainer.contains(t3.node)) return;
const s3 = this._rowElements.slice(-1)[0];
if (i3.node.compareDocumentPosition(s3) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING) && (i3 = { node: s3, offset: s3.textContent?.length ?? 0 }), !this._rowContainer.contains(i3.node)) return;
const r2 = /* @__PURE__ */ __name(({ node: e4, offset: t4 }) => {
const i4 = e4 instanceof Text ? e4.parentNode : e4;
let s4 = parseInt(i4?.getAttribute("aria-posinset"), 10) - 1;
if (isNaN(s4)) return console.warn("row is invalid. Race condition?"), null;
const r3 = this._rowColumns.get(i4);
if (!r3) return console.warn("columns is null. Race condition?"), null;
let n3 = t4 < r3.length ? r3[t4] : r3.slice(-1)[0] + 1;
return n3 >= this._terminal.cols && (++s4, n3 = 0), { row: s4, column: n3 };
}, "r"), n2 = r2(t3), o2 = r2(i3);
if (n2 && o2) {
if (n2.row > o2.row || n2.row === o2.row && n2.column >= o2.column) throw new Error("invalid range");
this._terminal.select(n2.column, n2.row, (o2.row - n2.row) * this._terminal.cols - n2.column + o2.column);
}
}
_handleResize(e3) {
this._rowElements[this._rowElements.length - 1].removeEventListener("focus", this._bottomBoundaryFocusListener);
for (let e4 = this._rowContainer.children.length; e4 < this._terminal.rows; e4++) this._rowElements[e4] = this._createAccessibilityTreeNode(), this._rowContainer.appendChild(this._rowElements[e4]);
for (; this._rowElements.length > e3; ) this._rowContainer.removeChild(this._rowElements.pop());
this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener), this._refreshRowsDimensions();
}
_createAccessibilityTreeNode() {
const e3 = this._coreBrowserService.mainDocument.createElement("div");
return e3.setAttribute("role", "listitem"), e3.tabIndex = -1, this._refreshRowDimensions(e3), e3;
}
_refreshRowsDimensions() {
if (this._renderService.dimensions.css.cell.height) {
this._accessibilityContainer.style.width = `${this._renderService.dimensions.css.canvas.width}px`, this._rowElements.length !== this._terminal.rows && this._handleResize(this._terminal.rows);
for (let e3 = 0; e3 < this._terminal.rows; e3++) this._refreshRowDimensions(this._rowElements[e3]);
}
}
_refreshRowDimensions(e3) {
e3.style.height = `${this._renderService.dimensions.css.cell.height}px`;
}
};
t2.AccessibilityManager = d = s2([r(1, c.IInstantiationService), r(2, h.ICoreBrowserService), r(3, h.IRenderService)], d);
}, 3614: (e2, t2) => {
function i2(e3) {
return e3.replace(/\r?\n/g, "\r");
}
__name(i2, "i");
function s2(e3, t3) {
return t3 ? "\x1B[200~" + e3 + "\x1B[201~" : e3;
}
__name(s2, "s");
function r(e3, t3, r2, n2) {
e3 = s2(e3 = i2(e3), r2.decPrivateModes.bracketedPasteMode && true !== n2.rawOptions.ignoreBracketedPasteMode), r2.triggerDataEvent(e3, true), t3.value = "";
}
__name(r, "r");
function n(e3, t3, i3) {
const s3 = i3.getBoundingClientRect(), r2 = e3.clientX - s3.left - 10, n2 = e3.clientY - s3.top - 10;
t3.style.width = "20px", t3.style.height = "20px", t3.style.left = `${r2}px`, t3.style.top = `${n2}px`, t3.style.zIndex = "1000", t3.focus();
}
__name(n, "n");
Object.defineProperty(t2, "__esModule", { value: true }), t2.rightClickHandler = t2.moveTextAreaUnderMouseCursor = t2.paste = t2.handlePasteEvent = t2.copyHandler = t2.bracketTextForPaste = t2.prepareTextForTerminal = void 0, t2.prepareTextForTerminal = i2, t2.bracketTextForPaste = s2, t2.copyHandler = function(e3, t3) {
e3.clipboardData && e3.clipboardData.setData("text/plain", t3.selectionText), e3.preventDefault();
}, t2.handlePasteEvent = function(e3, t3, i3, s3) {
e3.stopPropagation(), e3.clipboardData && r(e3.clipboardData.getData("text/plain"), t3, i3, s3);
}, t2.paste = r, t2.moveTextAreaUnderMouseCursor = n, t2.rightClickHandler = function(e3, t3, i3, s3, r2) {
n(e3, t3, i3), r2 && s3.rightClickSelect(e3), t3.value = s3.selectionText, t3.select();
};
}, 7239: (e2, t2, i2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.ColorContrastCache = void 0;
const s2 = i2(1505);
t2.ColorContrastCache = class {
constructor() {
this._color = new s2.TwoKeyMap(), this._css = new s2.TwoKeyMap();
}
setCss(e3, t3, i3) {
this._css.set(e3, t3, i3);
}
getCss(e3, t3) {
return this._css.get(e3, t3);
}
setColor(e3, t3, i3) {
this._color.set(e3, t3, i3);
}
getColor(e3, t3) {
return this._color.get(e3, t3);
}
clear() {
this._color.clear(), this._css.clear();
}
};
}, 3656: (e2, t2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.addDisposableDomListener = void 0, t2.addDisposableDomListener = function(e3, t3, i2, s2) {
e3.addEventListener(t3, i2, s2);
let r = false;
return { dispose: /* @__PURE__ */ __name(() => {
r || (r = true, e3.removeEventListener(t3, i2, s2));
}, "dispose") };
};
}, 3551: function(e2, t2, i2) {
var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
var r2, n2 = arguments.length, o2 = n2 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e3, t3, i3, s3);
else for (var a2 = e3.length - 1; a2 >= 0; a2--) (r2 = e3[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t3, i3, o2) : r2(t3, i3)) || o2);
return n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2;
}, r = this && this.__param || function(e3, t3) {
return function(i3, s3) {
t3(i3, s3, e3);
};
};
Object.defineProperty(t2, "__esModule", { value: true }), t2.Linkifier = void 0;
const n = i2(3656), o = i2(8460), a = i2(844), h = i2(2585), c = i2(4725);
let l = t2.Linkifier = class extends a.Disposable {
get currentLink() {
return this._currentLink;
}
constructor(e3, t3, i3, s3, r2) {
super(), this._element = e3, this._mouseService = t3, this._renderService = i3, this._bufferService = s3, this._linkProviderService = r2, this._linkCacheDisposables = [], this._isMouseOut = true, this._wasResized = false, this._activeLine = -1, this._onShowLinkUnderline = this.register(new o.EventEmitter()), this.onShowLinkUnderline = this._onShowLinkUnderline.event, this._onHideLinkUnderline = this.register(new o.EventEmitter()), this.onHideLinkUnderline = this._onHideLinkUnderline.event, this.register((0, a.getDisposeArrayDisposable)(this._linkCacheDisposables)), this.register((0, a.toDisposable)((() => {
this._lastMouseEvent = void 0, this._activeProviderReplies?.clear();
}))), this.register(this._bufferService.onResize((() => {
this._clearCurrentLink(), this._wasResized = true;
}))), this.register((0, n.addDisposableDomListener)(this._element, "mouseleave", (() => {
this._isMouseOut = true, this._clearCurrentLink();
}))), this.register((0, n.addDisposableDomListener)(this._element, "mousemove", this._handleMouseMove.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))), this.register((0, n.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this)));
}
_handleMouseMove(e3) {
this._lastMouseEvent = e3;
const t3 = this._positionFromMouseEvent(e3, this._element, this._mouseService);
if (!t3) return;
this._isMouseOut = false;
const i3 = e3.composedPath();
for (let e4 = 0; e4 < i3.length; e4++) {
const t4 = i3[e4];
if (t4.classList.contains("xterm")) break;
if (t4.classList.contains("xterm-hover")) return;
}
this._lastBufferCell && t3.x === this._lastBufferCell.x && t3.y === this._lastBufferCell.y || (this._handleHover(t3), this._lastBufferCell = t3);
}
_handleHover(e3) {
if (this._activeLine !== e3.y || this._wasResized) return this._clearCurrentLink(), this._askForLink(e3, false), void (this._wasResized = false);
this._currentLink && this._linkAtPosition(this._currentLink.link, e3) || (this._clearCurrentLink(), this._askForLink(e3, true));
}
_askForLink(e3, t3) {
this._activeProviderReplies && t3 || (this._activeProviderReplies?.forEach(((e4) => {
e4?.forEach(((e5) => {
e5.link.dispose && e5.link.dispose();
}));
})), this._activeProviderReplies = /* @__PURE__ */ new Map(), this._activeLine = e3.y);
let i3 = false;
for (const [s3, r2] of this._linkProviderService.linkProviders.entries()) if (t3) {
const t4 = this._activeProviderReplies?.get(s3);
t4 && (i3 = this._checkLinkProviderResult(s3, e3, i3));
} else r2.provideLinks(e3.y, ((t4) => {
if (this._isMouseOut) return;
const r3 = t4?.map(((e4) => ({ link: e4 })));
this._activeProviderReplies?.set(s3, r3), i3 = this._checkLinkProviderResult(s3, e3, i3), this._activeProviderReplies?.size === this._linkProviderService.linkProviders.length && this._removeIntersectingLinks(e3.y, this._activeProviderReplies);
}));
}
_removeIntersectingLinks(e3, t3) {
const i3 = /* @__PURE__ */ new Set();
for (let s3 = 0; s3 < t3.size; s3++) {
const r2 = t3.get(s3);
if (r2) for (let t4 = 0; t4 < r2.length; t4++) {
const s4 = r2[t4], n2 = s4.link.range.start.y < e3 ? 0 : s4.link.range.start.x, o2 = s4.link.range.end.y > e3 ? this._bufferService.cols : s4.link.range.end.x;
for (let e4 = n2; e4 <= o2; e4++) {
if (i3.has(e4)) {
r2.splice(t4--, 1);
break;
}
i3.add(e4);
}
}
}
}
_checkLinkProviderResult(e3, t3, i3) {
if (!this._activeProviderReplies) return i3;
const s3 = this._activeProviderReplies.get(e3);
let r2 = false;
for (let t4 = 0; t4 < e3; t4++) this._activeProviderReplies.has(t4) && !this._activeProviderReplies.get(t4) || (r2 = true);
if (!r2 && s3) {
const e4 = s3.find(((e5) => this._linkAtPosition(e5.link, t3)));
e4 && (i3 = true, this._handleNewLink(e4));
}
if (this._activeProviderReplies.size === this._linkProviderService.linkProviders.length && !i3) for (let e4 = 0; e4 < this._activeProviderReplies.size; e4++) {
const s4 = this._activeProviderReplies.get(e4)?.find(((e5) => this._linkAtPosition(e5.link, t3)));
if (s4) {
i3 = true, this._handleNewLink(s4);
break;
}
}
return i3;
}
_handleMouseDown() {
this._mouseDownLink = this._currentLink;
}
_handleMouseUp(e3) {
if (!this._currentLink) return;
const t3 = this._positionFromMouseEvent(e3, this._element, this._mouseService);
t3 && this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, t3) && this._currentLink.link.activate(e3, this._currentLink.link.text);
}
_clearCurrentLink(e3, t3) {
this._currentLink && this._lastMouseEvent && (!e3 || !t3 || this._currentLink.link.range.start.y >= e3 && this._currentLink.link.range.end.y <= t3) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent), this._currentLink = void 0, (0, a.disposeArray)(this._linkCacheDisposables));
}
_handleNewLink(e3) {
if (!this._lastMouseEvent) return;
const t3 = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
t3 && this._linkAtPosition(e3.link, t3) && (this._currentLink = e3, this._currentLink.state = { decorations: { underline: void 0 === e3.link.decorations || e3.link.decorations.underline, pointerCursor: void 0 === e3.link.decorations || e3.link.decorations.pointerCursor }, isHovered: true }, this._linkHover(this._element, e3.link, this._lastMouseEvent), e3.link.decorations = {}, Object.defineProperties(e3.link.decorations, { pointerCursor: { get: /* @__PURE__ */ __name(() => this._currentLink?.state?.decorations.pointerCursor, "get"), set: /* @__PURE__ */ __name((e4) => {
this._currentLink?.state && this._currentLink.state.decorations.pointerCursor !== e4 && (this._currentLink.state.decorations.pointerCursor = e4, this._currentLink.state.isHovered && this._element.classList.toggle("xterm-cursor-pointer", e4));
}, "set") }, underline: { get: /* @__PURE__ */ __name(() => this._currentLink?.state?.decorations.underline, "get"), set: /* @__PURE__ */ __name((t4) => {
this._currentLink?.state && this._currentLink?.state?.decorations.underline !== t4 && (this._currentLink.state.decorations.underline = t4, this._currentLink.state.isHovered && this._fireUnderlineEvent(e3.link, t4));
}, "set") } }), this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(((e4) => {
if (!this._currentLink) return;
const t4 = 0 === e4.start ? 0 : e4.start + 1 + this._bufferService.buffer.ydisp, i3 = this._bufferService.buffer.ydisp + 1 + e4.end;
if (this._currentLink.link.range.start.y >= t4 && this._currentLink.link.range.end.y <= i3 && (this._clearCurrentLink(t4, i3), this._lastMouseEvent)) {
const e5 = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
e5 && this._askForLink(e5, false);
}
}))));
}
_linkHover(e3, t3, i3) {
this._currentLink?.state && (this._currentLink.state.isHovered = true, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(t3, true), this._currentLink.state.decorations.pointerCursor && e3.classList.add("xterm-cursor-pointer")), t3.hover && t3.hover(i3, t3.text);
}
_fireUnderlineEvent(e3, t3) {
const i3 = e3.range, s3 = this._bufferService.buffer.ydisp, r2 = this._createLinkUnderlineEvent(i3.start.x - 1, i3.start.y - s3 - 1, i3.end.x, i3.end.y - s3 - 1, void 0);
(t3 ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(r2);
}
_linkLeave(e3, t3, i3) {
this._currentLink?.state && (this._currentLink.state.isHovered = false, this._currentLink.state.decorations.underline && this._fireUnderlineEvent(t3, false), this._currentLink.state.decorations.pointerCursor && e3.classList.remove("xterm-cursor-pointer")), t3.leave && t3.leave(i3, t3.text);
}
_linkAtPosition(e3, t3) {
const i3 = e3.range.start.y * this._bufferService.cols + e3.range.start.x, s3 = e3.range.end.y * this._bufferService.cols + e3.range.end.x, r2 = t3.y * this._bufferService.cols + t3.x;
return i3 <= r2 && r2 <= s3;
}
_positionFromMouseEvent(e3, t3, i3) {
const s3 = i3.getCoords(e3, t3, this._bufferService.cols, this._bufferService.rows);
if (s3) return { x: s3[0], y: s3[1] + this._bufferService.buffer.ydisp };
}
_createLinkUnderlineEvent(e3, t3, i3, s3, r2) {
return { x1: e3, y1: t3, x2: i3, y2: s3, cols: this._bufferService.cols, fg: r2 };
}
};
t2.Linkifier = l = s2([r(1, c.IMouseService), r(2, c.IRenderService), r(3, h.IBufferService), r(4, c.ILinkProviderService)], l);
}, 9042: (e2, t2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.tooMuchOutput = t2.promptLabel = void 0, t2.promptLabel = "Terminal input", t2.tooMuchOutput = "Too much output to announce, navigate to rows manually to read";
}, 3730: function(e2, t2, i2) {
var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
var r2, n2 = arguments.length, o2 = n2 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e3, t3, i3, s3);
else for (var a2 = e3.length - 1; a2 >= 0; a2--) (r2 = e3[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t3, i3, o2) : r2(t3, i3)) || o2);
return n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2;
}, r = this && this.__param || function(e3, t3) {
return function(i3, s3) {
t3(i3, s3, e3);
};
};
Object.defineProperty(t2, "__esModule", { value: true }), t2.OscLinkProvider = void 0;
const n = i2(511), o = i2(2585);
let a = t2.OscLinkProvider = class {
constructor(e3, t3, i3) {
this._bufferService = e3, this._optionsService = t3, this._oscLinkService = i3;
}
provideLinks(e3, t3) {
const i3 = this._bufferService.buffer.lines.get(e3 - 1);
if (!i3) return void t3(void 0);
const s3 = [], r2 = this._optionsService.rawOptions.linkHandler, o2 = new n.CellData(), a2 = i3.getTrimmedLength();
let c = -1, l = -1, d = false;
for (let t4 = 0; t4 < a2; t4++) if (-1 !== l || i3.hasContent(t4)) {
if (i3.loadCell(t4, o2), o2.hasExtendedAttrs() && o2.extended.urlId) {
if (-1 === l) {
l = t4, c = o2.extended.urlId;
continue;
}
d = o2.extended.urlId !== c;
} else -1 !== l && (d = true);
if (d || -1 !== l && t4 === a2 - 1) {
const i4 = this._oscLinkService.getLinkData(c)?.uri;
if (i4) {
const n2 = { start: { x: l + 1, y: e3 }, end: { x: t4 + (d || t4 !== a2 - 1 ? 0 : 1), y: e3 } };
let o3 = false;
if (!r2?.allowNonHttpProtocols) try {
const e4 = new URL(i4);
["http:", "https:"].includes(e4.protocol) || (o3 = true);
} catch (e4) {
o3 = true;
}
o3 || s3.push({ text: i4, range: n2, activate: /* @__PURE__ */ __name((e4, t5) => r2 ? r2.activate(e4, t5, n2) : h(0, t5), "activate"), hover: /* @__PURE__ */ __name((e4, t5) => r2?.hover?.(e4, t5, n2), "hover"), leave: /* @__PURE__ */ __name((e4, t5) => r2?.leave?.(e4, t5, n2), "leave") });
}
d = false, o2.hasExtendedAttrs() && o2.extended.urlId ? (l = t4, c = o2.extended.urlId) : (l = -1, c = -1);
}
}
t3(s3);
}
};
function h(e3, t3) {
if (confirm(`Do you want to navigate to ${t3}?
WARNING: This link could potentially be dangerous`)) {
const e4 = window.open();
if (e4) {
try {
e4.opener = null;
} catch {
}
e4.location.href = t3;
} else console.warn("Opening link blocked as opener could not be cleared");
}
}
__name(h, "h");
t2.OscLinkProvider = a = s2([r(0, o.IBufferService), r(1, o.IOptionsService), r(2, o.IOscLinkService)], a);
}, 6193: (e2, t2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.RenderDebouncer = void 0, t2.RenderDebouncer = class {
constructor(e3, t3) {
this._renderCallback = e3, this._coreBrowserService = t3, this._refreshCallbacks = [];
}
dispose() {
this._animationFrame && (this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame), this._animationFrame = void 0);
}
addRefreshCallback(e3) {
return this._refreshCallbacks.push(e3), this._animationFrame || (this._animationFrame = this._coreBrowserService.window.requestAnimationFrame((() => this._innerRefresh()))), this._animationFrame;
}
refresh(e3, t3, i2) {
this._rowCount = i2, e3 = void 0 !== e3 ? e3 : 0, t3 = void 0 !== t3 ? t3 : this._rowCount - 1, this._rowStart = void 0 !== this._rowStart ? Math.min(this._rowStart, e3) : e3, this._rowEnd = void 0 !== this._rowEnd ? Math.max(this._rowEnd, t3) : t3, this._animationFrame || (this._animationFrame = this._coreBrowserService.window.requestAnimationFrame((() => this._innerRefresh())));
}
_innerRefresh() {
if (this._animationFrame = void 0, void 0 === this._rowStart || void 0 === this._rowEnd || void 0 === this._rowCount) return void this._runRefreshCallbacks();
const e3 = Math.max(this._rowStart, 0), t3 = Math.min(this._rowEnd, this._rowCount - 1);
this._rowStart = void 0, this._rowEnd = void 0, this._renderCallback(e3, t3), this._runRefreshCallbacks();
}
_runRefreshCallbacks() {
for (const e3 of this._refreshCallbacks) e3(0);
this._refreshCallbacks = [];
}
};
}, 3236: (e2, t2, i2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.Terminal = void 0;
const s2 = i2(3614), r = i2(3656), n = i2(3551), o = i2(9042), a = i2(3730), h = i2(1680), c = i2(3107), l = i2(5744), d = i2(2950), _ = i2(1296), u = i2(428), f = i2(4269), v = i2(5114), p = i2(8934), g = i2(3230), m = i2(9312), S = i2(4725), C = i2(6731), b = i2(8055), w = i2(8969), y = i2(8460), E = i2(844), k = i2(6114), L = i2(8437), D = i2(2584), R = i2(7399), x = i2(5941), A = i2(9074), B = i2(2585), T = i2(5435), M = i2(4567), O = i2(779);
const _P = class _P extends w.CoreTerminal {
get onFocus() {
return this._onFocus.event;
}
get onBlur() {
return this._onBlur.event;
}
get onA11yChar() {
return this._onA11yCharEmitter.event;
}
get onA11yTab() {
return this._onA11yTabEmitter.event;
}
get onWillOpen() {
return this._onWillOpen.event;
}
constructor(e3 = {}) {
super(e3), this.browser = k, this._keyDownHandled = false, this._keyDownSeen = false, this._keyPressHandled = false, this._unprocessedDeadKey = false, this._accessibilityManager = this.register(new E.MutableDisposable()), this._onCursorMove = this.register(new y.EventEmitter()), this.onCursorMove = this._onCursorMove.event, this._onKey = this.register(new y.EventEmitter()), this.onKey = this._onKey.event, this._onRender = this.register(new y.EventEmitter()), this.onRender = this._onRender.event, this._onSelectionChange = this.register(new y.EventEmitter()), this.onSelectionChange = this._onSelectionChange.event, this._onTitleChange = this.register(new y.EventEmitter()), this.onTitleChange = this._onTitleChange.event, this._onBell = this.register(new y.EventEmitter()), this.onBell = this._onBell.event, this._onFocus = this.register(new y.EventEmitter()), this._onBlur = this.register(new y.EventEmitter()), this._onA11yCharEmitter = this.register(new y.EventEmitter()), this._onA11yTabEmitter = this.register(new y.EventEmitter()), this._onWillOpen = this.register(new y.EventEmitter()), this._setup(), this._decorationService = this._instantiationService.createInstance(A.DecorationService), this._instantiationService.setService(B.IDecorationService, this._decorationService), this._linkProviderService = this._instantiationService.createInstance(O.LinkProviderService), this._instantiationService.setService(S.ILinkProviderService, this._linkProviderService), this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a.OscLinkProvider)), this.register(this._inputHandler.onRequestBell((() => this._onBell.fire()))), this.register(this._inputHandler.onRequestRefreshRows(((e4, t3) => this.refresh(e4, t3)))), this.register(this._inputHandler.onRequestSendFocus((() => this._reportFocus()))), this.register(this._inputHandler.onRequestReset((() => this.reset()))), this.register(this._inputHandler.onRequestWindowsOptionsReport(((e4) => this._reportWindowsOptions(e4)))), this.register(this._inputHandler.onColor(((e4) => this._handleColorEvent(e4)))), this.register((0, y.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)), this.register((0, y.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)), this.register((0, y.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)), this.register((0, y.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)), this.register(this._bufferService.onResize(((e4) => this._afterResize(e4.cols, e4.rows)))), this.register((0, E.toDisposable)((() => {
this._customKeyEventHandler = void 0, this.element?.parentNode?.removeChild(this.element);
})));
}
_handleColorEvent(e3) {
if (this._themeService) for (const t3 of e3) {
let e4, i3 = "";
switch (t3.index) {
case 256:
e4 = "foreground", i3 = "10";
break;
case 257:
e4 = "background", i3 = "11";
break;
case 258:
e4 = "cursor", i3 = "12";
break;
default:
e4 = "ansi", i3 = "4;" + t3.index;
}
switch (t3.type) {
case 0:
const s3 = b.color.toColorRGB("ansi" === e4 ? this._themeService.colors.ansi[t3.index] : this._themeService.colors[e4]);
this.coreService.triggerDataEvent(`${D.C0.ESC}]${i3};${(0, x.toRgbString)(s3)}${D.C1_ESCAPED.ST}`);
break;
case 1:
if ("ansi" === e4) this._themeService.modifyColors(((e5) => e5.ansi[t3.index] = b.channels.toColor(...t3.color)));
else {
const i4 = e4;
this._themeService.modifyColors(((e5) => e5[i4] = b.channels.toColor(...t3.color)));
}
break;
case 2:
this._themeService.restoreColor(t3.index);
}
}
}
_setup() {
super._setup(), this._customKeyEventHandler = void 0;
}
get buffer() {
return this.buffers.active;
}
focus() {
this.textarea && this.textarea.focus({ preventScroll: true });
}
_handleScreenReaderModeOptionChange(e3) {
e3 ? !this._accessibilityManager.value && this._renderService && (this._accessibilityManager.value = this._instantiationService.createInstance(M.AccessibilityManager, this)) : this._accessibilityManager.clear();
}
_handleTextAreaFocus(e3) {
this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D.C0.ESC + "[I"), this.element.classList.add("focus"), this._showCursor(), this._onFocus.fire();
}
blur() {
return this.textarea?.blur();
}
_handleTextAreaBlur() {
this.textarea.value = "", this.refresh(this.buffer.y, this.buffer.y), this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(D.C0.ESC + "[O"), this.element.classList.remove("focus"), this._onBlur.fire();
}
_syncTextArea() {
if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper.isComposing || !this._renderService) return;
const e3 = this.buffer.ybase + this.buffer.y, t3 = this.buffer.lines.get(e3);
if (!t3) return;
const i3 = Math.min(this.buffer.x, this.cols - 1), s3 = this._renderService.dimensions.css.cell.height, r2 = t3.getWidth(i3), n2 = this._renderService.dimensions.css.cell.width * r2, o2 = this.buffer.y * this._renderService.dimensions.css.cell.height, a2 = i3 * this._renderService.dimensions.css.cell.width;
this.textarea.style.left = a2 + "px", this.textarea.style.top = o2 + "px", this.textarea.style.width = n2 + "px", this.textarea.style.height = s3 + "px", this.textarea.style.lineHeight = s3 + "px", this.textarea.style.zIndex = "-5";
}
_initGlobal() {
this._bindKeys(), this.register((0, r.addDisposableDomListener)(this.element, "copy", ((e4) => {
this.hasSelection() && (0, s2.copyHandler)(e4, this._selectionService);
})));
const e3 = /* @__PURE__ */ __name((e4) => (0, s2.handlePasteEvent)(e4, this.textarea, this.coreService, this.optionsService), "e");
this.register((0, r.addDisposableDomListener)(this.textarea, "paste", e3)), this.register((0, r.addDisposableDomListener)(this.element, "paste", e3)), k.isFirefox ? this.register((0, r.addDisposableDomListener)(this.element, "mousedown", ((e4) => {
2 === e4.button && (0, s2.rightClickHandler)(e4, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord);
}))) : this.register((0, r.addDisposableDomListener)(this.element, "contextmenu", ((e4) => {
(0, s2.rightClickHandler)(e4, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord);
}))), k.isLinux && this.register((0, r.addDisposableDomListener)(this.element, "auxclick", ((e4) => {
1 === e4.button && (0, s2.moveTextAreaUnderMouseCursor)(e4, this.textarea, this.screenElement);
})));
}
_bindKeys() {
this.register((0, r.addDisposableDomListener)(this.textarea, "keyup", ((e3) => this._keyUp(e3)), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "keydown", ((e3) => this._keyDown(e3)), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "keypress", ((e3) => this._keyPress(e3)), true)), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionstart", (() => this._compositionHelper.compositionstart()))), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionupdate", ((e3) => this._compositionHelper.compositionupdate(e3)))), this.register((0, r.addDisposableDomListener)(this.textarea, "compositionend", (() => this._compositionHelper.compositionend()))), this.register((0, r.addDisposableDomListener)(this.textarea, "input", ((e3) => this._inputEvent(e3)), true)), this.register(this.onRender((() => this._compositionHelper.updateCompositionElements())));
}
open(e3) {
if (!e3) throw new Error("Terminal requires a parent element.");
if (e3.isConnected || this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"), this.element?.ownerDocument.defaultView && this._coreBrowserService) return void (this.element.ownerDocument.defaultView !== this._coreBrowserService.window && (this._coreBrowserService.window = this.element.ownerDocument.defaultView));
this._document = e3.ownerDocument, this.options.documentOverride && this.options.documentOverride instanceof Document && (this._document = this.optionsService.rawOptions.documentOverride), this.element = this._document.createElement("div"), this.element.dir = "ltr", this.element.classList.add("terminal"), this.element.classList.add("xterm"), e3.appendChild(this.element);
const t3 = this._document.createDocumentFragment();
this._viewportElement = this._document.createElement("div"), this._viewportElement.classList.add("xterm-viewport"), t3.appendChild(this._viewportElement), this._viewportScrollArea = this._document.createElement("div"), this._viewportScrollArea.classList.add("xterm-scroll-area"), this._viewportElement.appendChild(this._viewportScrollArea), this.screenElement = this._document.createElement("div"), this.screenElement.classList.add("xterm-screen"), this.register((0, r.addDisposableDomListener)(this.screenElement, "mousemove", ((e4) => this.updateCursorStyle(e4)))), this._helperContainer = this._document.createElement("div"), this._helperContainer.classList.add("xterm-helpers"), this.screenElement.appendChild(this._helperContainer), t3.appendChild(this.screenElement), this.textarea = this._document.createElement("textarea"), this.textarea.classList.add("xterm-helper-textarea"), this.textarea.setAttribute("aria-label", o.promptLabel), k.isChromeOS || this.textarea.setAttribute("aria-multiline", "false"), this.textarea.setAttribute("autocorrect", "off"), this.textarea.setAttribute("autocapitalize", "off"), this.textarea.setAttribute("spellcheck", "false"), this.textarea.tabIndex = 0, this._coreBrowserService = this.register(this._instantiationService.createInstance(v.CoreBrowserService, this.textarea, e3.ownerDocument.defaultView ?? window, this._document ?? "undefined" != typeof window ? window.document : null)), this._instantiationService.setService(S.ICoreBrowserService, this._coreBrowserService), this.register((0, r.addDisposableDomListener)(this.textarea, "focus", ((e4) => this._handleTextAreaFocus(e4)))), this.register((0, r.addDisposableDomListener)(this.textarea, "blur", (() => this._handleTextAreaBlur()))), this._helperContainer.appendChild(this.textarea), this._charSizeService = this._instantiationService.createInstance(u.CharSizeService, this._document, this._helperContainer), this._instantiationService.setService(S.ICharSizeService, this._charSizeService), this._themeService = this._instantiationService.createInstance(C.ThemeService), this._instantiationService.setService(S.IThemeService, this._themeService), this._characterJoinerService = this._instantiationService.createInstance(f.CharacterJoinerService), this._instantiationService.setService(S.ICharacterJoinerService, this._characterJoinerService), this._renderService = this.register(this._instantiationService.createInstance(g.RenderService, this.rows, this.screenElement)), this._instantiationService.setService(S.IRenderService, this._renderService), this.register(this._renderService.onRenderedViewportChange(((e4) => this._onRender.fire(e4)))), this.onResize(((e4) => this._renderService.resize(e4.cols, e4.rows))), this._compositionView = this._document.createElement("div"), this._compositionView.classList.add("composition-view"), this._compositionHelper = this._instantiationService.createInstance(d.CompositionHelper, this.textarea, this._compositionView), this._helperContainer.appendChild(this._compositionView), this._mouseService = this._instantiationService.createInstance(p.MouseService), this._instantiationService.setService(S.IMouseService, this._mouseService), this.linkifier = this.register(this._instantiationService.createInstance(n.Linkifier, this.screenElement)), this.element.appendChild(t3);
try {
this._onWillOpen.fire(this.element);
} catch {
}
this._renderService.hasRenderer() || this._renderService.setRenderer(this._createRenderer()), this.viewport = this._instantiationService.createInstance(h.Viewport, this._viewportElement, this._viewportScrollArea), this.viewport.onRequestScrollLines(((e4) => this.scrollLines(e4.amount, e4.suppressScrollEvent, 1))), this.register(this._inputHandler.onRequestSyncScrollBar((() => this.viewport.syncScrollArea()))), this.register(this.viewport), this.register(this.onCursorMove((() => {
this._renderService.handleCursorMove(), this._syncTextArea();
}))), this.register(this.onResize((() => this._renderService.handleResize(this.cols, this.rows)))), this.register(this.onBlur((() => this._renderService.handleBlur()))), this.register(this.onFocus((() => this._renderService.handleFocus()))), this.register(this._renderService.onDimensionsChange((() => this.viewport.syncScrollArea()))), this._selectionService = this.register(this._instantiationService.createInstance(m.SelectionService, this.element, this.screenElement, this.linkifier)), this._instantiationService.setService(S.ISelectionService, this._selectionService), this.register(this._selectionService.onRequestScrollLines(((e4) => this.scrollLines(e4.amount, e4.suppressScrollEvent)))), this.register(this._selectionService.onSelectionChange((() => this._onSelectionChange.fire()))), this.register(this._selectionService.onRequestRedraw(((e4) => this._renderService.handleSelectionChanged(e4.start, e4.end, e4.columnSelectMode)))), this.register(this._selectionService.onLinuxMouseSelection(((e4) => {
this.textarea.value = e4, this.textarea.focus(), this.textarea.select();
}))), this.register(this._onScroll.event(((e4) => {
this.viewport.syncScrollArea(), this._selectionService.refresh();
}))), this.register((0, r.addDisposableDomListener)(this._viewportElement, "scroll", (() => this._selectionService.refresh()))), this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer, this.screenElement)), this.register((0, r.addDisposableDomListener)(this.element, "mousedown", ((e4) => this._selectionService.handleMouseDown(e4)))), this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(), this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(), this.options.screenReaderMode && (this._accessibilityManager.value = this._instantiationService.createInstance(M.AccessibilityManager, this)), this.register(this.optionsService.onSpecificOptionChange("screenReaderMode", ((e4) => this._handleScreenReaderModeOptionChange(e4)))), this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer, this._viewportElement, this.screenElement))), this.optionsService.onSpecificOptionChange("overviewRulerWidth", ((e4) => {
!this._overviewRulerRenderer && e4 && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(l.OverviewRulerRenderer, this._viewportElement, this.screenElement)));
})), this._charSizeService.measure(), this.refresh(0, this.rows - 1), this._initGlobal(), this.bindMouse();
}
_createRenderer() {
return this._instantiationService.createInstance(_.DomRenderer, this, this._document, this.element, this.screenElement, this._viewportElement, this._helperContainer, this.linkifier);
}
bindMouse() {
const e3 = this, t3 = this.element;
function i3(t4) {
const i4 = e3._mouseService.getMouseReportCoords(t4, e3.screenElement);
if (!i4) return false;
let s4, r2;
switch (t4.overrideType || t4.type) {
case "mousemove":
r2 = 32, void 0 === t4.buttons ? (s4 = 3, void 0 !== t4.button && (s4 = t4.button < 3 ? t4.button : 3)) : s4 = 1 & t4.buttons ? 0 : 4 & t4.buttons ? 1 : 2 & t4.buttons ? 2 : 3;
break;
case "mouseup":
r2 = 0, s4 = t4.button < 3 ? t4.button : 3;
break;
case "mousedown":
r2 = 1, s4 = t4.button < 3 ? t4.button : 3;
break;
case "wheel":
if (e3._customWheelEventHandler && false === e3._customWheelEventHandler(t4)) return false;
if (0 === e3.viewport.getLinesScrolled(t4)) return false;
r2 = t4.deltaY < 0 ? 0 : 1, s4 = 4;
break;
default:
return false;
}
return !(void 0 === r2 || void 0 === s4 || s4 > 4) && e3.coreMouseService.triggerMouseEvent({ col: i4.col, row: i4.row, x: i4.x, y: i4.y, button: s4, action: r2, ctrl: t4.ctrlKey, alt: t4.altKey, shift: t4.shiftKey });
}
__name(i3, "i");
const s3 = { mouseup: null, wheel: null, mousedrag: null, mousemove: null }, n2 = { mouseup: /* @__PURE__ */ __name((e4) => (i3(e4), e4.buttons || (this._document.removeEventListener("mouseup", s3.mouseup), s3.mousedrag && this._document.removeEventListener("mousemove", s3.mousedrag)), this.cancel(e4)), "mouseup"), wheel: /* @__PURE__ */ __name((e4) => (i3(e4), this.cancel(e4, true)), "wheel"), mousedrag: /* @__PURE__ */ __name((e4) => {
e4.buttons && i3(e4);
}, "mousedrag"), mousemove: /* @__PURE__ */ __name((e4) => {
e4.buttons || i3(e4);
}, "mousemove") };
this.register(this.coreMouseService.onProtocolChange(((e4) => {
e4 ? ("debug" === this.optionsService.rawOptions.logLevel && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents(e4)), this.element.classList.add("enable-mouse-events"), this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."), this.element.classList.remove("enable-mouse-events"), this._selectionService.enable()), 8 & e4 ? s3.mousemove || (t3.addEventListener("mousemove", n2.mousemove), s3.mousemove = n2.mousemove) : (t3.removeEventListener("mousemove", s3.mousemove), s3.mousemove = null), 16 & e4 ? s3.wheel || (t3.addEventListener("wheel", n2.wheel, { passive: false }), s3.wheel = n2.wheel) : (t3.removeEventListener("wheel", s3.wheel), s3.wheel = null), 2 & e4 ? s3.mouseup || (s3.mouseup = n2.mouseup) : (this._document.removeEventListener("mouseup", s3.mouseup), s3.mouseup = null), 4 & e4 ? s3.mousedrag || (s3.mousedrag = n2.mousedrag) : (this._document.removeEventListener("mousemove", s3.mousedrag), s3.mousedrag = null);
}))), this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol, this.register((0, r.addDisposableDomListener)(t3, "mousedown", ((e4) => {
if (e4.preventDefault(), this.focus(), this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection(e4)) return i3(e4), s3.mouseup && this._document.addEventListener("mouseup", s3.mouseup), s3.mousedrag && this._document.addEventListener("mousemove", s3.mousedrag), this.cancel(e4);
}))), this.register((0, r.addDisposableDomListener)(t3, "wheel", ((e4) => {
if (!s3.wheel) {
if (this._customWheelEventHandler && false === this._customWheelEventHandler(e4)) return false;
if (!this.buffer.hasScrollback) {
const t4 = this.viewport.getLinesScrolled(e4);
if (0 === t4) return;
const i4 = D.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + (e4.deltaY < 0 ? "A" : "B");
let s4 = "";
for (let e5 = 0; e5 < Math.abs(t4); e5++) s4 += i4;
return this.coreService.triggerDataEvent(s4, true), this.cancel(e4, true);
}
return this.viewport.handleWheel(e4) ? this.cancel(e4) : void 0;
}
}), { passive: false })), this.register((0, r.addDisposableDomListener)(t3, "touchstart", ((e4) => {
if (!this.coreMouseService.areMouseEventsActive) return this.viewport.handleTouchStart(e4), this.cancel(e4);
}), { passive: true })), this.register((0, r.addDisposableDomListener)(t3, "touchmove", ((e4) => {
if (!this.coreMouseService.areMouseEventsActive) return this.viewport.handleTouchMove(e4) ? void 0 : this.cancel(e4);
}), { passive: false }));
}
refresh(e3, t3) {
this._renderService?.refreshRows(e3, t3);
}
updateCursorStyle(e3) {
this._selectionService?.shouldColumnSelect(e3) ? this.element.classList.add("column-select") : this.element.classList.remove("column-select");
}
_showCursor() {
this.coreService.isCursorInitialized || (this.coreService.isCursorInitialized = true, this.refresh(this.buffer.y, this.buffer.y));
}
scrollLines(e3, t3, i3 = 0) {
1 === i3 ? (super.scrollLines(e3, t3, i3), this.refresh(0, this.rows - 1)) : this.viewport?.scrollLines(e3);
}
paste(e3) {
(0, s2.paste)(e3, this.textarea, this.coreService, this.optionsService);
}
attachCustomKeyEventHandler(e3) {
this._customKeyEventHandler = e3;
}
attachCustomWheelEventHandler(e3) {
this._customWheelEventHandler = e3;
}
registerLinkProvider(e3) {
return this._linkProviderService.registerLinkProvider(e3);
}
registerCharacterJoiner(e3) {
if (!this._characterJoinerService) throw new Error("Terminal must be opened first");
const t3 = this._characterJoinerService.register(e3);
return this.refresh(0, this.rows - 1), t3;
}
deregisterCharacterJoiner(e3) {
if (!this._characterJoinerService) throw new Error("Terminal must be opened first");
this._characterJoinerService.deregister(e3) && this.refresh(0, this.rows - 1);
}
get markers() {
return this.buffer.markers;
}
registerMarker(e3) {
return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + e3);
}
registerDecoration(e3) {
return this._decorationService.registerDecoration(e3);
}
hasSelection() {
return !!this._selectionService && this._selectionService.hasSelection;
}
select(e3, t3, i3) {
this._selectionService.setSelection(e3, t3, i3);
}
getSelection() {
return this._selectionService ? this._selectionService.selectionText : "";
}
getSelectionPosition() {
if (this._selectionService && this._selectionService.hasSelection) return { start: { x: this._selectionService.selectionStart[0], y: this._selectionService.selectionStart[1] }, end: { x: this._selectionService.selectionEnd[0], y: this._selectionService.selectionEnd[1] } };
}
clearSelection() {
this._selectionService?.clearSelection();
}
selectAll() {
this._selectionService?.selectAll();
}
selectLines(e3, t3) {
this._selectionService?.selectLines(e3, t3);
}
_keyDown(e3) {
if (this._keyDownHandled = false, this._keyDownSeen = true, this._customKeyEventHandler && false === this._customKeyEventHandler(e3)) return false;
const t3 = this.browser.isMac && this.options.macOptionIsMeta && e3.altKey;
if (!t3 && !this._compositionHelper.keydown(e3)) return this.options.scrollOnUserInput && this.buffer.ybase !== this.buffer.ydisp && this.scrollToBottom(), false;
t3 || "Dead" !== e3.key && "AltGraph" !== e3.key || (this._unprocessedDeadKey = true);
const i3 = (0, R.evaluateKeyboardEvent)(e3, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
if (this.updateCursorStyle(e3), 3 === i3.type || 2 === i3.type) {
const t4 = this.rows - 1;
return this.scrollLines(2 === i3.type ? -t4 : t4), this.cancel(e3, true);
}
return 1 === i3.type && this.selectAll(), !!this._isThirdLevelShift(this.browser, e3) || (i3.cancel && this.cancel(e3, true), !i3.key || !!(e3.key && !e3.ctrlKey && !e3.altKey && !e3.metaKey && 1 === e3.key.length && e3.key.charCodeAt(0) >= 65 && e3.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = false, true) : (i3.key !== D.C0.ETX && i3.key !== D.C0.CR || (this.textarea.value = ""), this._onKey.fire({ key: i3.key, domEvent: e3 }), this._showCursor(), this.coreService.triggerDataEvent(i3.key, true), !this.optionsService.rawOptions.screenReaderMode || e3.altKey || e3.ctrlKey ? this.cancel(e3, true) : void (this._keyDownHandled = true))));
}
_isThirdLevelShift(e3, t3) {
const i3 = e3.isMac && !this.options.macOptionIsMeta && t3.altKey && !t3.ctrlKey && !t3.metaKey || e3.isWindows && t3.altKey && t3.ctrlKey && !t3.metaKey || e3.isWindows && t3.getModifierState("AltGraph");
return "keypress" === t3.type ? i3 : i3 && (!t3.keyCode || t3.keyCode > 47);
}
_keyUp(e3) {
this._keyDownSeen = false, this._customKeyEventHandler && false === this._customKeyEventHandler(e3) || ((function(e4) {
return 16 === e4.keyCode || 17 === e4.keyCode || 18 === e4.keyCode;
})(e3) || this.focus(), this.updateCursorStyle(e3), this._keyPressHandled = false);
}
_keyPress(e3) {
let t3;
if (this._keyPressHandled = false, this._keyDownHandled) return false;
if (this._customKeyEventHandler && false === this._customKeyEventHandler(e3)) return false;
if (this.cancel(e3), e3.charCode) t3 = e3.charCode;
else if (null === e3.which || void 0 === e3.which) t3 = e3.keyCode;
else {
if (0 === e3.which || 0 === e3.charCode) return false;
t3 = e3.which;
}
return !(!t3 || (e3.altKey || e3.ctrlKey || e3.metaKey) && !this._isThirdLevelShift(this.browser, e3) || (t3 = String.fromCharCode(t3), this._onKey.fire({ key: t3, domEvent: e3 }), this._showCursor(), this.coreService.triggerDataEvent(t3, true), this._keyPressHandled = true, this._unprocessedDeadKey = false, 0));
}
_inputEvent(e3) {
if (e3.data && "insertText" === e3.inputType && (!e3.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
if (this._keyPressHandled) return false;
this._unprocessedDeadKey = false;
const t3 = e3.data;
return this.coreService.triggerDataEvent(t3, true), this.cancel(e3), true;
}
return false;
}
resize(e3, t3) {
e3 !== this.cols || t3 !== this.rows ? super.resize(e3, t3) : this._charSizeService && !this._charSizeService.hasValidSize && this._charSizeService.measure();
}
_afterResize(e3, t3) {
this._charSizeService?.measure(), this.viewport?.syncScrollArea(true);
}
clear() {
if (0 !== this.buffer.ybase || 0 !== this.buffer.y) {
this.buffer.clearAllMarkers(), this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)), this.buffer.lines.length = 1, this.buffer.ydisp = 0, this.buffer.ybase = 0, this.buffer.y = 0;
for (let e3 = 1; e3 < this.rows; e3++) this.buffer.lines.push(this.buffer.getBlankLine(L.DEFAULT_ATTR_DATA));
this._onScroll.fire({ position: this.buffer.ydisp, source: 0 }), this.viewport?.reset(), this.refresh(0, this.rows - 1);
}
}
reset() {
this.options.rows = this.rows, this.options.cols = this.cols;
const e3 = this._customKeyEventHandler;
this._setup(), super.reset(), this._selectionService?.reset(), this._decorationService.reset(), this.viewport?.reset(), this._customKeyEventHandler = e3, this.refresh(0, this.rows - 1);
}
clearTextureAtlas() {
this._renderService?.clearTextureAtlas();
}
_reportFocus() {
this.element?.classList.contains("focus") ? this.coreService.triggerDataEvent(D.C0.ESC + "[I") : this.coreService.triggerDataEvent(D.C0.ESC + "[O");
}
_reportWindowsOptions(e3) {
if (this._renderService) switch (e3) {
case T.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:
const e4 = this._renderService.dimensions.css.canvas.width.toFixed(0), t3 = this._renderService.dimensions.css.canvas.height.toFixed(0);
this.coreService.triggerDataEvent(`${D.C0.ESC}[4;${t3};${e4}t`);
break;
case T.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:
const i3 = this._renderService.dimensions.css.cell.width.toFixed(0), s3 = this._renderService.dimensions.css.cell.height.toFixed(0);
this.coreService.triggerDataEvent(`${D.C0.ESC}[6;${s3};${i3}t`);
}
}
cancel(e3, t3) {
if (this.options.cancelEvents || t3) return e3.preventDefault(), e3.stopPropagation(), false;
}
};
__name(_P, "P");
let P = _P;
t2.Terminal = P;
}, 9924: (e2, t2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.TimeBasedDebouncer = void 0, t2.TimeBasedDebouncer = class {
constructor(e3, t3 = 1e3) {
this._renderCallback = e3, this._debounceThresholdMS = t3, this._lastRefreshMs = 0, this._additionalRefreshRequested = false;
}
dispose() {
this._refreshTimeoutID && clearTimeout(this._refreshTimeoutID);
}
refresh(e3, t3, i2) {
this._rowCount = i2, e3 = void 0 !== e3 ? e3 : 0, t3 = void 0 !== t3 ? t3 : this._rowCount - 1, this._rowStart = void 0 !== this._rowStart ? Math.min(this._rowStart, e3) : e3, this._rowEnd = void 0 !== this._rowEnd ? Math.max(this._rowEnd, t3) : t3;
const s2 = Date.now();
if (s2 - this._lastRefreshMs >= this._debounceThresholdMS) this._lastRefreshMs = s2, this._innerRefresh();
else if (!this._additionalRefreshRequested) {
const e4 = s2 - this._lastRefreshMs, t4 = this._debounceThresholdMS - e4;
this._additionalRefreshRequested = true, this._refreshTimeoutID = window.setTimeout((() => {
this._lastRefreshMs = Date.now(), this._innerRefresh(), this._additionalRefreshRequested = false, this._refreshTimeoutID = void 0;
}), t4);
}
}
_innerRefresh() {
if (void 0 === this._rowStart || void 0 === this._rowEnd || void 0 === this._rowCount) return;
const e3 = Math.max(this._rowStart, 0), t3 = Math.min(this._rowEnd, this._rowCount - 1);
this._rowStart = void 0, this._rowEnd = void 0, this._renderCallback(e3, t3);
}
};
}, 1680: function(e2, t2, i2) {
var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
var r2, n2 = arguments.length, o2 = n2 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e3, t3, i3, s3);
else for (var a2 = e3.length - 1; a2 >= 0; a2--) (r2 = e3[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t3, i3, o2) : r2(t3, i3)) || o2);
return n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2;
}, r = this && this.__param || function(e3, t3) {
return function(i3, s3) {
t3(i3, s3, e3);
};
};
Object.defineProperty(t2, "__esModule", { value: true }), t2.Viewport = void 0;
const n = i2(3656), o = i2(4725), a = i2(8460), h = i2(844), c = i2(2585);
let l = t2.Viewport = class extends h.Disposable {
constructor(e3, t3, i3, s3, r2, o2, h2, c2) {
super(), this._viewportElement = e3, this._scrollArea = t3, this._bufferService = i3, this._optionsService = s3, this._charSizeService = r2, this._renderService = o2, this._coreBrowserService = h2, this.scrollBarWidth = 0, this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._wheelPartialScroll = 0, this._refreshAnimationFrame = null, this._ignoreNextScrollEvent = false, this._smoothScrollState = { startTime: 0, origin: -1, target: -1 }, this._onRequestScrollLines = this.register(new a.EventEmitter()), this.onRequestScrollLines = this._onRequestScrollLines.event, this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15, this.register((0, n.addDisposableDomListener)(this._viewportElement, "scroll", this._handleScroll.bind(this))), this._activeBuffer = this._bufferService.buffer, this.register(this._bufferService.buffers.onBufferActivate(((e4) => this._activeBuffer = e4.activeBuffer))), this._renderDimensions = this._renderService.dimensions, this.register(this._renderService.onDimensionsChange(((e4) => this._renderDimensions = e4))), this._handleThemeChange(c2.colors), this.register(c2.onChangeColors(((e4) => this._handleThemeChange(e4)))), this.register(this._optionsService.onSpecificOptionChange("scrollback", (() => this.syncScrollArea()))), setTimeout((() => this.syncScrollArea()));
}
_handleThemeChange(e3) {
this._viewportElement.style.backgroundColor = e3.background.css;
}
reset() {
this._currentRowHeight = 0, this._currentDeviceCellHeight = 0, this._lastRecordedBufferLength = 0, this._lastRecordedViewportHeight = 0, this._lastRecordedBufferHeight = 0, this._lastTouchY = 0, this._lastScrollTop = 0, this._coreBrowserService.window.requestAnimationFrame((() => this.syncScrollArea()));
}
_refresh(e3) {
if (e3) return this._innerRefresh(), void (null !== this._refreshAnimationFrame && this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));
null === this._refreshAnimationFrame && (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame((() => this._innerRefresh())));
}
_innerRefresh() {
if (this._charSizeService.height > 0) {
this._currentRowHeight = this._renderDimensions.device.cell.height / this._coreBrowserService.dpr, this._currentDeviceCellHeight = this._renderDimensions.device.cell.height, this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;
const e4 = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderDimensions.css.canvas.height);
this._lastRecordedBufferHeight !== e4 && (this._lastRecordedBufferHeight = e4, this._scrollArea.style.height = this._lastRecordedBufferHeight + "px");
}
const e3 = this._bufferService.buffer.ydisp * this._currentRowHeight;
this._viewportElement.scrollTop !== e3 && (this._ignoreNextScrollEvent = true, this._viewportElement.scrollTop = e3), this._refreshAnimationFrame = null;
}
syncScrollArea(e3 = false) {
if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length) return this._lastRecordedBufferLength = this._bufferService.buffer.lines.length, void this._refresh(e3);
this._lastRecordedViewportHeight === this._renderService.dimensions.css.canvas.height && this._lastScrollTop === this._activeBuffer.ydisp * this._currentRowHeight && this._renderDimensions.device.cell.height === this._currentDeviceCellHeight || this._refresh(e3);
}
_handleScroll(e3) {
if (this._lastScrollTop = this._viewportElement.scrollTop, !this._viewportElement.offsetParent) return;
if (this._ignoreNextScrollEvent) return this._ignoreNextScrollEvent = false, void this._onRequestScrollLines.fire({ amount: 0, suppressScrollEvent: true });
const t3 = Math.round(this._lastScrollTop / this._currentRowHeight) - this._bufferService.buffer.ydisp;
this._onRequestScrollLines.fire({ amount: t3, suppressScrollEvent: true });
}
_smoothScroll() {
if (this._isDisposed || -1 === this._smoothScrollState.origin || -1 === this._smoothScrollState.target) return;
const e3 = this._smoothScrollPercent();
this._viewportElement.scrollTop = this._smoothScrollState.origin + Math.round(e3 * (this._smoothScrollState.target - this._smoothScrollState.origin)), e3 < 1 ? this._coreBrowserService.window.requestAnimationFrame((() => this._smoothScroll())) : this._clearSmoothScrollState();
}
_smoothScrollPercent() {
return this._optionsService.rawOptions.smoothScrollDuration && this._smoothScrollState.startTime ? Math.max(Math.min((Date.now() - this._smoothScrollState.startTime) / this._optionsService.rawOptions.smoothScrollDuration, 1), 0) : 1;
}
_clearSmoothScrollState() {
this._smoothScrollState.startTime = 0, this._smoothScrollState.origin = -1, this._smoothScrollState.target = -1;
}
_bubbleScroll(e3, t3) {
const i3 = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;
return !(t3 < 0 && 0 !== this._viewportElement.scrollTop || t3 > 0 && i3 < this._lastRecordedBufferHeight) || (e3.cancelable && e3.preventDefault(), false);
}
handleWheel(e3) {
const t3 = this._getPixelsScrolled(e3);
return 0 !== t3 && (this._optionsService.rawOptions.smoothScrollDuration ? (this._smoothScrollState.startTime = Date.now(), this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop, -1 === this._smoothScrollState.target ? this._smoothScrollState.target = this._viewportElement.scrollTop + t3 : this._smoothScrollState.target += t3, this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0), this._smoothScroll()) : this._clearSmoothScrollState()) : this._viewportElement.scrollTop += t3, this._bubbleScroll(e3, t3));
}
scrollLines(e3) {
if (0 !== e3) if (this._optionsService.rawOptions.smoothScrollDuration) {
const t3 = e3 * this._currentRowHeight;
this._smoothScrollState.startTime = Date.now(), this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop, this._smoothScrollState.target = this._smoothScrollState.origin + t3, this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0), this._smoothScroll()) : this._clearSmoothScrollState();
} else this._onRequestScrollLines.fire({ amount: e3, suppressScrollEvent: false });
}
_getPixelsScrolled(e3) {
if (0 === e3.deltaY || e3.shiftKey) return 0;
let t3 = this._applyScrollModifier(e3.deltaY, e3);
return e3.deltaMode === WheelEvent.DOM_DELTA_LINE ? t3 *= this._currentRowHeight : e3.deltaMode === WheelEvent.DOM_DELTA_PAGE && (t3 *= this._currentRowHeight * this._bufferService.rows), t3;
}
getBufferElements(e3, t3) {
let i3, s3 = "";
const r2 = [], n2 = t3 ?? this._bufferService.buffer.lines.length, o2 = this._bufferService.buffer.lines;
for (let t4 = e3; t4 < n2; t4++) {
const e4 = o2.get(t4);
if (!e4) continue;
const n3 = o2.get(t4 + 1)?.isWrapped;
if (s3 += e4.translateToString(!n3), !n3 || t4 === o2.length - 1) {
const e5 = document.createElement("div");
e5.textContent = s3, r2.push(e5), s3.length > 0 && (i3 = e5), s3 = "";
}
}
return { bufferElements: r2, cursorElement: i3 };
}
getLinesScrolled(e3) {
if (0 === e3.deltaY || e3.shiftKey) return 0;
let t3 = this._applyScrollModifier(e3.deltaY, e3);
return e3.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? (t3 /= this._currentRowHeight + 0, this._wheelPartialScroll += t3, t3 = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1), this._wheelPartialScroll %= 1) : e3.deltaMode === WheelEvent.DOM_DELTA_PAGE && (t3 *= this._bufferService.rows), t3;
}
_applyScrollModifier(e3, t3) {
const i3 = this._optionsService.rawOptions.fastScrollModifier;
return "alt" === i3 && t3.altKey || "ctrl" === i3 && t3.ctrlKey || "shift" === i3 && t3.shiftKey ? e3 * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity : e3 * this._optionsService.rawOptions.scrollSensitivity;
}
handleTouchStart(e3) {
this._lastTouchY = e3.touches[0].pageY;
}
handleTouchMove(e3) {
const t3 = this._lastTouchY - e3.touches[0].pageY;
return this._lastTouchY = e3.touches[0].pageY, 0 !== t3 && (this._viewportElement.scrollTop += t3, this._bubbleScroll(e3, t3));
}
};
t2.Viewport = l = s2([r(2, c.IBufferService), r(3, c.IOptionsService), r(4, o.ICharSizeService), r(5, o.IRenderService), r(6, o.ICoreBrowserService), r(7, o.IThemeService)], l);
}, 3107: function(e2, t2, i2) {
var s2 = this && this.__decorate || function(e3, t3, i3, s3) {
var r2, n2 = arguments.length, o2 = n2 < 3 ? t3 : null === s3 ? s3 = Object.getOwnPropertyDescriptor(t3, i3) : s3;
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o2 = Reflect.decorate(e3, t3, i3, s3);
else for (var a2 = e3.length - 1; a2 >= 0; a2--) (r2 = e3[a2]) && (o2 = (n2 < 3 ? r2(o2) : n2 > 3 ? r2(t3, i3, o2) : r2(t3, i3)) || o2);
return n2 > 3 && o2 && Object.defineProperty(t3, i3, o2), o2;
}, r = this && this.__param || function(e3, t3) {
return function(i3, s3) {
t3(i3, s3, e3);
};
};
Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferDecorationRenderer = void 0;
const n = i2(4725), o = i2(844), a = i2(2585);
let h = t2.BufferDecorationRenderer = class extends o.Disposable {
constructor(e3, t3, i3, s3, r2) {
super(), this._screenElement = e3, this._bufferService = t3, this._coreBrowserService = i3, this._decorationService = s3, this._renderService = r2, this._decorationElements = /* @__PURE__ */ new Map(), this._altBufferIsActive = false, this._dimensionsChanged = false, this._container = document.createElement("div"), this._container.classList.add("xterm-decoration-container"), this._screenElement.appendChild(this._container), this.register(this._renderService.onRenderedViewportChange((() => this._doRefreshDecorations()))), this.register(this._renderService.onDimensionsChange((() => {
this._dimensionsChanged = true, this._queueRefresh();
}))), this.register(this._coreBrowserService.onDprChange((() => this._queueRefresh()))), this.register(this._bufferService.buffers.onBufferActivate((() => {
this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt;
}))), this.register(this._decorationService.onDecorationRegistered((() => this._queueRefresh()))), this.register(this._decorationService.onDecorationRemoved(((e4) => this._removeDecoration(e4)))), this.register((0, o.toDisposable)((() => {
this._container.remove(), this._decorationElements.clear();
})));
}
_queueRefresh() {
void 0 === this._animationFrame && (this._animationFrame = this._renderService.addRefreshCallback((() => {
this._doRefreshDecorations(), this._animationFrame = void 0;
})));
}
_doRefreshDecorations() {
for (const e3 of this._decorationService.decorations) this._renderDecoration(e3);
this._dimensionsChanged = false;
}
_renderDecoration(e3) {
this._refreshStyle(e3), this._dimensionsChanged && this._refreshXPosition(e3);
}
_createElement(e3) {
const t3 = this._coreBrowserService.mainDocument.createElement("div");
t3.classList.add("xterm-decoration"), t3.classList.toggle("xterm-decoration-top-layer", "top" === e3?.options?.layer), t3.style.width = `${Math.round((e3.options.width || 1) * this._renderService.dimensions.css.cell.width)}px`, t3.style.height = (e3.options.height || 1) * this._renderService.dimensions.css.cell.height + "px", t3.style.top = (e3.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.css.cell.height + "px", t3.style.lineHeight = `${this._renderService.dimensions.css.cell.height}px`;
const i3 = e3.options.x ?? 0;
return i3 && i3 > this._bufferService.cols && (t3.style.display = "none"), this._refreshXPosition(e3, t3), t3;
}
_refreshStyle(e3) {
const t3 = e3.marker.line - this._bufferService.buffers.active.ydisp;
if (t3 < 0 || t3 >= this._bufferService.rows) e3.element && (e3.element.style.display = "none", e3.onRenderEmitter.fire(e3.element));
else {
let i3 = this._decorationElements.get(e3);
i3 || (i3 = this._createElement(e3), e3.element = i3, this._decorationElements.set(e3, i3), this._container.appendChild(i3), e3.onDispose((() => {
this._decorationElements.delete(e3), i3.remove();
}))), i3.style.top = t3 * this._renderService.dimensions.css.cell.height + "px", i3.style.display = this._altBufferIsActive ? "none" : "block", e3.onRenderEmitter.fire(i3);
}
}
_refreshXPosition(e3, t3 = e3.element) {
if (!t3) return;
const i3 = e3.options.x ?? 0;
"right" === (e3.options.anchor || "left") ? t3.style.right = i3 ? i3 * this._renderService.dimensions.css.cell.width + "px" : "" : t3.style.left = i3 ? i3 * this._renderService.dimensions.css.cell.width + "px" : "";
}
_removeDecoration(e3) {
this._decorationElements.get(e3)?.remove(), this._decorationElements.delete(e3), e3.dispose();
}
};
t2.BufferDecorationRenderer = h = s2([r(1, a.IBufferService), r(2, n.ICoreBrowserService), r(3, a.IDecorationService), r(4, n.IRenderService)], h);
}, 5871: (e2, t2) => {
Object.defineProperty(t2, "__esModule", { value: true }), t2.ColorZoneStore = void 0, t2.ColorZoneStore = class {
constructor() {
this._zones = [], this._zonePool = [], this._zonePoolIndex = 0, this._linePadding = { full: 0, left: 0, center: 0, right: 0 };
}
get zones() {
return this._zonePool.length = Math.min(this._zonePool.length, this._zones.length), this._zones;
}
clear() {
this._zones.length = 0, this._zonePoolIndex = 0;
}
addDecoration(e3) {
if (e3.options.overviewRulerOptions) {
for (const t3 of this._zones) if (t3.color === e3.options.overviewRulerOptions.color && t3.position === e3.options.overviewRulerOptions.position) {
if (this._lineIntersectsZone(t3, e3.marker.line)) return;
if (this._lineAdjacentToZone(t3, e3.marker.line, e3.options.overviewRulerOptions.position)) return void this._addLineToZone(t3, e3.marker.line);
}
if (this._zonePoolIndex < this._zonePool.length) return this._zonePool[this._zonePoolIndex].color = e3.options.overviewRulerOptions.color, this._zonePool[this._zonePoolIndex].position = e3.options.overviewRulerOptions.position, this._zonePool[this._zonePoolIndex].startBufferLine = e3.marker.line, this._zonePool[this._zonePoolIndex].endBufferLine = e3.marker.line, void this._zones.push(this._zonePool[this._zonePoolIndex++]);
this._zones.push({ color: e3.options.overviewRulerOptions.color, position: e3.options.overviewRulerOptions.position, startBufferLine: e3.marker.line, endBufferLine: e3.marker.line }), this._zonePool.push(this._zones[this._zones.length - 1]), this._zonePoolIndex++;
}
}
setPadding(e3) {
this._linePadding = e3;
}
_lineIntersectsZone(e3, t3) {
return t3 >= e3.startBufferLine && t3 <= e3.endBufferLine;
}
_lineAdjacentToZone(e3, t3, i2) {