@tangle-network/sandbox-ui 0.134.11 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{WorkflowGraph-Dz6aA2Mp.js → WorkflowGraph-WgonmxDh.js} +809 -58
- package/dist/globals.css +46 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{node-output-CHlf3tni.js → node-output-Bs51H68g.js} +71 -6
- package/dist/styles.css +46 -0
- package/dist/terminal-X6r5pjgv.js +1704 -0
- package/dist/terminal.js +1 -1
- package/dist/{use-pty-session-Bf4hBLXJ.js → use-pty-session-B5Q_i9RI.js} +10 -2
- package/dist/{workbench-QHNLHsoL.js → workbench-BzXAYUId.js} +1 -1
- package/dist/workbench.js +1 -1
- package/dist/workflows.d.ts +17 -3
- package/dist/workflows.js +2 -2
- package/package.json +7 -1
- package/dist/terminal-DmSUfGha.js +0 -203
|
@@ -0,0 +1,1704 @@
|
|
|
1
|
+
import { t as usePtySession } from "./use-pty-session-B5Q_i9RI.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
4
|
+
import "@xterm/xterm/css/xterm.css";
|
|
5
|
+
import { Terminal } from "@xterm/xterm";
|
|
6
|
+
import { FitAddon } from "@xterm/addon-fit";
|
|
7
|
+
import { WebLinksAddon } from "@xterm/addon-web-links";
|
|
8
|
+
//#region node_modules/.pnpm/@xterm+addon-unicode-graphemes@0.4.0/node_modules/@xterm/addon-unicode-graphemes/lib/addon-unicode-graphemes.mjs
|
|
9
|
+
/**
|
|
10
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
11
|
+
* @license MIT
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
14
|
+
* @license MIT
|
|
15
|
+
*
|
|
16
|
+
* Originally forked from (with the author's permission):
|
|
17
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
18
|
+
* http://bellard.org/jslinux/
|
|
19
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
20
|
+
*/
|
|
21
|
+
var be = [
|
|
22
|
+
[768, 879],
|
|
23
|
+
[1155, 1158],
|
|
24
|
+
[1160, 1161],
|
|
25
|
+
[1425, 1469],
|
|
26
|
+
[1471, 1471],
|
|
27
|
+
[1473, 1474],
|
|
28
|
+
[1476, 1477],
|
|
29
|
+
[1479, 1479],
|
|
30
|
+
[1536, 1539],
|
|
31
|
+
[1552, 1557],
|
|
32
|
+
[1611, 1630],
|
|
33
|
+
[1648, 1648],
|
|
34
|
+
[1750, 1764],
|
|
35
|
+
[1767, 1768],
|
|
36
|
+
[1770, 1773],
|
|
37
|
+
[1807, 1807],
|
|
38
|
+
[1809, 1809],
|
|
39
|
+
[1840, 1866],
|
|
40
|
+
[1958, 1968],
|
|
41
|
+
[2027, 2035],
|
|
42
|
+
[2305, 2306],
|
|
43
|
+
[2364, 2364],
|
|
44
|
+
[2369, 2376],
|
|
45
|
+
[2381, 2381],
|
|
46
|
+
[2385, 2388],
|
|
47
|
+
[2402, 2403],
|
|
48
|
+
[2433, 2433],
|
|
49
|
+
[2492, 2492],
|
|
50
|
+
[2497, 2500],
|
|
51
|
+
[2509, 2509],
|
|
52
|
+
[2530, 2531],
|
|
53
|
+
[2561, 2562],
|
|
54
|
+
[2620, 2620],
|
|
55
|
+
[2625, 2626],
|
|
56
|
+
[2631, 2632],
|
|
57
|
+
[2635, 2637],
|
|
58
|
+
[2672, 2673],
|
|
59
|
+
[2689, 2690],
|
|
60
|
+
[2748, 2748],
|
|
61
|
+
[2753, 2757],
|
|
62
|
+
[2759, 2760],
|
|
63
|
+
[2765, 2765],
|
|
64
|
+
[2786, 2787],
|
|
65
|
+
[2817, 2817],
|
|
66
|
+
[2876, 2876],
|
|
67
|
+
[2879, 2879],
|
|
68
|
+
[2881, 2883],
|
|
69
|
+
[2893, 2893],
|
|
70
|
+
[2902, 2902],
|
|
71
|
+
[2946, 2946],
|
|
72
|
+
[3008, 3008],
|
|
73
|
+
[3021, 3021],
|
|
74
|
+
[3134, 3136],
|
|
75
|
+
[3142, 3144],
|
|
76
|
+
[3146, 3149],
|
|
77
|
+
[3157, 3158],
|
|
78
|
+
[3260, 3260],
|
|
79
|
+
[3263, 3263],
|
|
80
|
+
[3270, 3270],
|
|
81
|
+
[3276, 3277],
|
|
82
|
+
[3298, 3299],
|
|
83
|
+
[3393, 3395],
|
|
84
|
+
[3405, 3405],
|
|
85
|
+
[3530, 3530],
|
|
86
|
+
[3538, 3540],
|
|
87
|
+
[3542, 3542],
|
|
88
|
+
[3633, 3633],
|
|
89
|
+
[3636, 3642],
|
|
90
|
+
[3655, 3662],
|
|
91
|
+
[3761, 3761],
|
|
92
|
+
[3764, 3769],
|
|
93
|
+
[3771, 3772],
|
|
94
|
+
[3784, 3789],
|
|
95
|
+
[3864, 3865],
|
|
96
|
+
[3893, 3893],
|
|
97
|
+
[3895, 3895],
|
|
98
|
+
[3897, 3897],
|
|
99
|
+
[3953, 3966],
|
|
100
|
+
[3968, 3972],
|
|
101
|
+
[3974, 3975],
|
|
102
|
+
[3984, 3991],
|
|
103
|
+
[3993, 4028],
|
|
104
|
+
[4038, 4038],
|
|
105
|
+
[4141, 4144],
|
|
106
|
+
[4146, 4146],
|
|
107
|
+
[4150, 4151],
|
|
108
|
+
[4153, 4153],
|
|
109
|
+
[4184, 4185],
|
|
110
|
+
[4448, 4607],
|
|
111
|
+
[4959, 4959],
|
|
112
|
+
[5906, 5908],
|
|
113
|
+
[5938, 5940],
|
|
114
|
+
[5970, 5971],
|
|
115
|
+
[6002, 6003],
|
|
116
|
+
[6068, 6069],
|
|
117
|
+
[6071, 6077],
|
|
118
|
+
[6086, 6086],
|
|
119
|
+
[6089, 6099],
|
|
120
|
+
[6109, 6109],
|
|
121
|
+
[6155, 6157],
|
|
122
|
+
[6313, 6313],
|
|
123
|
+
[6432, 6434],
|
|
124
|
+
[6439, 6440],
|
|
125
|
+
[6450, 6450],
|
|
126
|
+
[6457, 6459],
|
|
127
|
+
[6679, 6680],
|
|
128
|
+
[6912, 6915],
|
|
129
|
+
[6964, 6964],
|
|
130
|
+
[6966, 6970],
|
|
131
|
+
[6972, 6972],
|
|
132
|
+
[6978, 6978],
|
|
133
|
+
[7019, 7027],
|
|
134
|
+
[7616, 7626],
|
|
135
|
+
[7678, 7679],
|
|
136
|
+
[8203, 8207],
|
|
137
|
+
[8234, 8238],
|
|
138
|
+
[8288, 8291],
|
|
139
|
+
[8298, 8303],
|
|
140
|
+
[8400, 8431],
|
|
141
|
+
[12330, 12335],
|
|
142
|
+
[12441, 12442],
|
|
143
|
+
[43014, 43014],
|
|
144
|
+
[43019, 43019],
|
|
145
|
+
[43045, 43046],
|
|
146
|
+
[64286, 64286],
|
|
147
|
+
[65024, 65039],
|
|
148
|
+
[65056, 65059],
|
|
149
|
+
[65279, 65279],
|
|
150
|
+
[65529, 65531]
|
|
151
|
+
];
|
|
152
|
+
var Lt = [
|
|
153
|
+
[68097, 68099],
|
|
154
|
+
[68101, 68102],
|
|
155
|
+
[68108, 68111],
|
|
156
|
+
[68152, 68154],
|
|
157
|
+
[68159, 68159],
|
|
158
|
+
[119143, 119145],
|
|
159
|
+
[119155, 119170],
|
|
160
|
+
[119173, 119179],
|
|
161
|
+
[119210, 119213],
|
|
162
|
+
[119362, 119364],
|
|
163
|
+
[917505, 917505],
|
|
164
|
+
[917536, 917631],
|
|
165
|
+
[917760, 917999]
|
|
166
|
+
];
|
|
167
|
+
var y;
|
|
168
|
+
function Ft(n, e) {
|
|
169
|
+
let t = 0, r = e.length - 1, i;
|
|
170
|
+
if (n < e[0][0] || n > e[r][1]) return !1;
|
|
171
|
+
for (; r >= t;) if (i = t + r >> 1, n > e[i][1]) t = i + 1;
|
|
172
|
+
else if (n < e[i][0]) r = i - 1;
|
|
173
|
+
else return !0;
|
|
174
|
+
return !1;
|
|
175
|
+
}
|
|
176
|
+
var J = class {
|
|
177
|
+
constructor() {
|
|
178
|
+
this.version = "6";
|
|
179
|
+
if (!y) {
|
|
180
|
+
y = /* @__PURE__ */ new Uint8Array(65536), y.fill(1), y[0] = 0, y.fill(0, 1, 32), y.fill(0, 127, 160), y.fill(2, 4352, 4448), y[9001] = 2, y[9002] = 2, y.fill(2, 11904, 42192), y[12351] = 1, y.fill(2, 44032, 55204), y.fill(2, 63744, 64256), y.fill(2, 65040, 65050), y.fill(2, 65072, 65136), y.fill(2, 65280, 65377), y.fill(2, 65504, 65511);
|
|
181
|
+
for (let e = 0; e < be.length; ++e) y.fill(0, be[e][0], be[e][1] + 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
wcwidth(e) {
|
|
185
|
+
return e < 32 ? 0 : e < 127 ? 1 : e < 65536 ? y[e] : Ft(e, Lt) ? 0 : e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141 ? 2 : 1;
|
|
186
|
+
}
|
|
187
|
+
charProperties(e, t) {
|
|
188
|
+
let r = this.wcwidth(e), i = r === 0 && t !== 0;
|
|
189
|
+
if (i) {
|
|
190
|
+
let o = w.extractWidth(t);
|
|
191
|
+
o === 0 ? i = !1 : o > r && (r = o);
|
|
192
|
+
}
|
|
193
|
+
return w.createPropertyValue(0, r, i);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var ve = class {
|
|
197
|
+
constructor() {
|
|
198
|
+
this.listeners = [], this.unexpectedErrorHandler = function(e) {
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
throw e.stack ? ee.isErrorNoTelemetry(e) ? new ee(e.message + `
|
|
201
|
+
|
|
202
|
+
` + e.stack) : /* @__PURE__ */ new Error(e.message + `
|
|
203
|
+
|
|
204
|
+
` + e.stack) : e;
|
|
205
|
+
}, 0);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
addListener(e) {
|
|
209
|
+
return this.listeners.push(e), () => {
|
|
210
|
+
this._removeListener(e);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
emit(e) {
|
|
214
|
+
this.listeners.forEach((t) => {
|
|
215
|
+
t(e);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
_removeListener(e) {
|
|
219
|
+
this.listeners.splice(this.listeners.indexOf(e), 1);
|
|
220
|
+
}
|
|
221
|
+
setUnexpectedErrorHandler(e) {
|
|
222
|
+
this.unexpectedErrorHandler = e;
|
|
223
|
+
}
|
|
224
|
+
getUnexpectedErrorHandler() {
|
|
225
|
+
return this.unexpectedErrorHandler;
|
|
226
|
+
}
|
|
227
|
+
onUnexpectedError(e) {
|
|
228
|
+
this.unexpectedErrorHandler(e), this.emit(e);
|
|
229
|
+
}
|
|
230
|
+
onUnexpectedExternalError(e) {
|
|
231
|
+
this.unexpectedErrorHandler(e);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var St = new ve();
|
|
235
|
+
function te(n) {
|
|
236
|
+
Ut(n) || St.onUnexpectedError(n);
|
|
237
|
+
}
|
|
238
|
+
var me = "Canceled";
|
|
239
|
+
function Ut(n) {
|
|
240
|
+
return n instanceof $ ? !0 : n instanceof Error && n.name === me && n.message === me;
|
|
241
|
+
}
|
|
242
|
+
var $ = class extends Error {
|
|
243
|
+
constructor() {
|
|
244
|
+
super(me), this.name = this.message;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var ee = class n extends Error {
|
|
248
|
+
constructor(e) {
|
|
249
|
+
super(e), this.name = "CodeExpectedError";
|
|
250
|
+
}
|
|
251
|
+
static fromError(e) {
|
|
252
|
+
if (e instanceof n) return e;
|
|
253
|
+
let t = new n();
|
|
254
|
+
return t.message = e.message, t.stack = e.stack, t;
|
|
255
|
+
}
|
|
256
|
+
static isErrorNoTelemetry(e) {
|
|
257
|
+
return e.name === "CodeExpectedError";
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
function ge(n, e) {
|
|
261
|
+
let t = this, r = !1, i;
|
|
262
|
+
return function() {
|
|
263
|
+
if (r) return i;
|
|
264
|
+
if (r = !0, e) try {
|
|
265
|
+
i = n.apply(t, arguments);
|
|
266
|
+
} finally {
|
|
267
|
+
e();
|
|
268
|
+
}
|
|
269
|
+
else i = n.apply(t, arguments);
|
|
270
|
+
return i;
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function Ot(n, e, t = 0, r = n.length) {
|
|
274
|
+
let i = t, o = r;
|
|
275
|
+
for (; i < o;) {
|
|
276
|
+
let f = Math.floor((i + o) / 2);
|
|
277
|
+
e(n[f]) ? i = f + 1 : o = f;
|
|
278
|
+
}
|
|
279
|
+
return i - 1;
|
|
280
|
+
}
|
|
281
|
+
var ne = class ne {
|
|
282
|
+
constructor(e) {
|
|
283
|
+
this._array = e;
|
|
284
|
+
this._findLastMonotonousLastIdx = 0;
|
|
285
|
+
}
|
|
286
|
+
findLastMonotonous(e) {
|
|
287
|
+
if (ne.assertInvariants) {
|
|
288
|
+
if (this._prevFindLastPredicate) {
|
|
289
|
+
for (let r of this._array) if (this._prevFindLastPredicate(r) && !e(r)) throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.");
|
|
290
|
+
}
|
|
291
|
+
this._prevFindLastPredicate = e;
|
|
292
|
+
}
|
|
293
|
+
let t = Ot(this._array, e, this._findLastMonotonousLastIdx);
|
|
294
|
+
return this._findLastMonotonousLastIdx = t + 1, t === -1 ? void 0 : this._array[t];
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
ne.assertInvariants = !1;
|
|
298
|
+
var $e;
|
|
299
|
+
((T) => {
|
|
300
|
+
function n(p) {
|
|
301
|
+
return p < 0;
|
|
302
|
+
}
|
|
303
|
+
T.isLessThan = n;
|
|
304
|
+
function e(p) {
|
|
305
|
+
return p <= 0;
|
|
306
|
+
}
|
|
307
|
+
T.isLessThanOrEqual = e;
|
|
308
|
+
function t(p) {
|
|
309
|
+
return p > 0;
|
|
310
|
+
}
|
|
311
|
+
T.isGreaterThan = t;
|
|
312
|
+
function r(p) {
|
|
313
|
+
return p === 0;
|
|
314
|
+
}
|
|
315
|
+
T.isNeitherLessOrGreaterThan = r, T.greaterThan = 1, T.lessThan = -1, T.neitherLessOrGreaterThan = 0;
|
|
316
|
+
})($e ||= {});
|
|
317
|
+
function et(n, e) {
|
|
318
|
+
return (t, r) => e(n(t), n(r));
|
|
319
|
+
}
|
|
320
|
+
var tt = (n, e) => n - e;
|
|
321
|
+
var M = class M {
|
|
322
|
+
constructor(e) {
|
|
323
|
+
this.iterate = e;
|
|
324
|
+
}
|
|
325
|
+
forEach(e) {
|
|
326
|
+
this.iterate((t) => (e(t), !0));
|
|
327
|
+
}
|
|
328
|
+
toArray() {
|
|
329
|
+
let e = [];
|
|
330
|
+
return this.iterate((t) => (e.push(t), !0)), e;
|
|
331
|
+
}
|
|
332
|
+
filter(e) {
|
|
333
|
+
return new M((t) => this.iterate((r) => e(r) ? t(r) : !0));
|
|
334
|
+
}
|
|
335
|
+
map(e) {
|
|
336
|
+
return new M((t) => this.iterate((r) => t(e(r))));
|
|
337
|
+
}
|
|
338
|
+
some(e) {
|
|
339
|
+
let t = !1;
|
|
340
|
+
return this.iterate((r) => (t = e(r), !t)), t;
|
|
341
|
+
}
|
|
342
|
+
findFirst(e) {
|
|
343
|
+
let t;
|
|
344
|
+
return this.iterate((r) => e(r) ? (t = r, !1) : !0), t;
|
|
345
|
+
}
|
|
346
|
+
findLast(e) {
|
|
347
|
+
let t;
|
|
348
|
+
return this.iterate((r) => (e(r) && (t = r), !0)), t;
|
|
349
|
+
}
|
|
350
|
+
findLastMaxBy(e) {
|
|
351
|
+
let t, r = !0;
|
|
352
|
+
return this.iterate((i) => ((r || $e.isGreaterThan(e(i, t))) && (r = !1, t = i), !0)), t;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
M.empty = new M((e) => {});
|
|
356
|
+
function st(n, e) {
|
|
357
|
+
let t = Object.create(null);
|
|
358
|
+
for (let r of n) {
|
|
359
|
+
let i = e(r), o = t[i];
|
|
360
|
+
o || (o = t[i] = []), o.push(r);
|
|
361
|
+
}
|
|
362
|
+
return t;
|
|
363
|
+
}
|
|
364
|
+
var re = class {
|
|
365
|
+
constructor() {
|
|
366
|
+
this.map = /* @__PURE__ */ new Map();
|
|
367
|
+
}
|
|
368
|
+
add(e, t) {
|
|
369
|
+
let r = this.map.get(e);
|
|
370
|
+
r || (r = /* @__PURE__ */ new Set(), this.map.set(e, r)), r.add(t);
|
|
371
|
+
}
|
|
372
|
+
delete(e, t) {
|
|
373
|
+
let r = this.map.get(e);
|
|
374
|
+
r && (r.delete(t), r.size === 0 && this.map.delete(e));
|
|
375
|
+
}
|
|
376
|
+
forEach(e, t) {
|
|
377
|
+
let r = this.map.get(e);
|
|
378
|
+
r && r.forEach(t);
|
|
379
|
+
}
|
|
380
|
+
get(e) {
|
|
381
|
+
return this.map.get(e) || /* @__PURE__ */ new Set();
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
var _e;
|
|
385
|
+
((Te) => {
|
|
386
|
+
function n(c) {
|
|
387
|
+
return c && typeof c == "object" && typeof c[Symbol.iterator] == "function";
|
|
388
|
+
}
|
|
389
|
+
Te.is = n;
|
|
390
|
+
let e = Object.freeze([]);
|
|
391
|
+
function t() {
|
|
392
|
+
return e;
|
|
393
|
+
}
|
|
394
|
+
Te.empty = t;
|
|
395
|
+
function* r(c) {
|
|
396
|
+
yield c;
|
|
397
|
+
}
|
|
398
|
+
Te.single = r;
|
|
399
|
+
function i(c) {
|
|
400
|
+
return n(c) ? c : r(c);
|
|
401
|
+
}
|
|
402
|
+
Te.wrap = i;
|
|
403
|
+
function o(c) {
|
|
404
|
+
return c || e;
|
|
405
|
+
}
|
|
406
|
+
Te.from = o;
|
|
407
|
+
function* f(c) {
|
|
408
|
+
for (let b = c.length - 1; b >= 0; b--) yield c[b];
|
|
409
|
+
}
|
|
410
|
+
Te.reverse = f;
|
|
411
|
+
function T(c) {
|
|
412
|
+
return !c || c[Symbol.iterator]().next().done === !0;
|
|
413
|
+
}
|
|
414
|
+
Te.isEmpty = T;
|
|
415
|
+
function p(c) {
|
|
416
|
+
return c[Symbol.iterator]().next().value;
|
|
417
|
+
}
|
|
418
|
+
Te.first = p;
|
|
419
|
+
function m(c, b) {
|
|
420
|
+
let g = 0;
|
|
421
|
+
for (let D of c) if (b(D, g++)) return !0;
|
|
422
|
+
return !1;
|
|
423
|
+
}
|
|
424
|
+
Te.some = m;
|
|
425
|
+
function _(c, b) {
|
|
426
|
+
for (let g of c) if (b(g)) return g;
|
|
427
|
+
}
|
|
428
|
+
Te.find = _;
|
|
429
|
+
function* x(c, b) {
|
|
430
|
+
for (let g of c) b(g) && (yield g);
|
|
431
|
+
}
|
|
432
|
+
Te.filter = x;
|
|
433
|
+
function* L(c, b) {
|
|
434
|
+
let g = 0;
|
|
435
|
+
for (let D of c) yield b(D, g++);
|
|
436
|
+
}
|
|
437
|
+
Te.map = L;
|
|
438
|
+
function* O(c, b) {
|
|
439
|
+
let g = 0;
|
|
440
|
+
for (let D of c) yield* b(D, g++);
|
|
441
|
+
}
|
|
442
|
+
Te.flatMap = O;
|
|
443
|
+
function* pe(...c) {
|
|
444
|
+
for (let b of c) yield* b;
|
|
445
|
+
}
|
|
446
|
+
Te.concat = pe;
|
|
447
|
+
function X(c, b, g) {
|
|
448
|
+
let D = g;
|
|
449
|
+
for (let z of c) D = b(D, z);
|
|
450
|
+
return D;
|
|
451
|
+
}
|
|
452
|
+
Te.reduce = X;
|
|
453
|
+
function* F(c, b, g = c.length) {
|
|
454
|
+
for (b < 0 && (b += c.length), g < 0 ? g += c.length : g > c.length && (g = c.length); b < g; b++) yield c[b];
|
|
455
|
+
}
|
|
456
|
+
Te.slice = F;
|
|
457
|
+
function he(c, b = Number.POSITIVE_INFINITY) {
|
|
458
|
+
let g = [];
|
|
459
|
+
if (b === 0) return [g, c];
|
|
460
|
+
let D = c[Symbol.iterator]();
|
|
461
|
+
for (let z = 0; z < b; z++) {
|
|
462
|
+
let xe = D.next();
|
|
463
|
+
if (xe.done) return [g, Te.empty()];
|
|
464
|
+
g.push(xe.value);
|
|
465
|
+
}
|
|
466
|
+
return [g, { [Symbol.iterator]() {
|
|
467
|
+
return D;
|
|
468
|
+
} }];
|
|
469
|
+
}
|
|
470
|
+
Te.consume = he;
|
|
471
|
+
async function K(c) {
|
|
472
|
+
let b = [];
|
|
473
|
+
for await (let g of c) b.push(g);
|
|
474
|
+
return Promise.resolve(b);
|
|
475
|
+
}
|
|
476
|
+
Te.asyncToArray = K;
|
|
477
|
+
})(_e ||= {});
|
|
478
|
+
var Pt = !1;
|
|
479
|
+
var B = null;
|
|
480
|
+
var ie = class ie {
|
|
481
|
+
constructor() {
|
|
482
|
+
this.livingDisposables = /* @__PURE__ */ new Map();
|
|
483
|
+
}
|
|
484
|
+
getDisposableData(e) {
|
|
485
|
+
let t = this.livingDisposables.get(e);
|
|
486
|
+
return t || (t = {
|
|
487
|
+
parent: null,
|
|
488
|
+
source: null,
|
|
489
|
+
isSingleton: !1,
|
|
490
|
+
value: e,
|
|
491
|
+
idx: ie.idx++
|
|
492
|
+
}, this.livingDisposables.set(e, t)), t;
|
|
493
|
+
}
|
|
494
|
+
trackDisposable(e) {
|
|
495
|
+
let t = this.getDisposableData(e);
|
|
496
|
+
t.source || (t.source = (/* @__PURE__ */ new Error()).stack);
|
|
497
|
+
}
|
|
498
|
+
setParent(e, t) {
|
|
499
|
+
let r = this.getDisposableData(e);
|
|
500
|
+
r.parent = t;
|
|
501
|
+
}
|
|
502
|
+
markAsDisposed(e) {
|
|
503
|
+
this.livingDisposables.delete(e);
|
|
504
|
+
}
|
|
505
|
+
markAsSingleton(e) {
|
|
506
|
+
this.getDisposableData(e).isSingleton = !0;
|
|
507
|
+
}
|
|
508
|
+
getRootParent(e, t) {
|
|
509
|
+
let r = t.get(e);
|
|
510
|
+
if (r) return r;
|
|
511
|
+
let i = e.parent ? this.getRootParent(this.getDisposableData(e.parent), t) : e;
|
|
512
|
+
return t.set(e, i), i;
|
|
513
|
+
}
|
|
514
|
+
getTrackedDisposables() {
|
|
515
|
+
let e = /* @__PURE__ */ new Map();
|
|
516
|
+
return [...this.livingDisposables.entries()].filter(([, r]) => r.source !== null && !this.getRootParent(r, e).isSingleton).flatMap(([r]) => r);
|
|
517
|
+
}
|
|
518
|
+
computeLeakingDisposables(e = 10, t) {
|
|
519
|
+
let r;
|
|
520
|
+
if (t) r = t;
|
|
521
|
+
else {
|
|
522
|
+
let p = /* @__PURE__ */ new Map(), m = [...this.livingDisposables.values()].filter((x) => x.source !== null && !this.getRootParent(x, p).isSingleton);
|
|
523
|
+
if (m.length === 0) return;
|
|
524
|
+
let _ = new Set(m.map((x) => x.value));
|
|
525
|
+
if (r = m.filter((x) => !(x.parent && _.has(x.parent))), r.length === 0) throw new Error("There are cyclic diposable chains!");
|
|
526
|
+
}
|
|
527
|
+
if (!r) return;
|
|
528
|
+
function i(p) {
|
|
529
|
+
function m(x, L) {
|
|
530
|
+
for (; x.length > 0 && L.some((O) => typeof O == "string" ? O === x[0] : x[0].match(O));) x.shift();
|
|
531
|
+
}
|
|
532
|
+
let _ = p.source.split(`
|
|
533
|
+
`).map((x) => x.trim().replace("at ", "")).filter((x) => x !== "");
|
|
534
|
+
return m(_, [
|
|
535
|
+
"Error",
|
|
536
|
+
/^trackDisposable \(.*\)$/,
|
|
537
|
+
/^DisposableTracker.trackDisposable \(.*\)$/
|
|
538
|
+
]), _.reverse();
|
|
539
|
+
}
|
|
540
|
+
let o = new re();
|
|
541
|
+
for (let p of r) {
|
|
542
|
+
let m = i(p);
|
|
543
|
+
for (let _ = 0; _ <= m.length; _++) o.add(m.slice(0, _).join(`
|
|
544
|
+
`), p);
|
|
545
|
+
}
|
|
546
|
+
r.sort(et((p) => p.idx, tt));
|
|
547
|
+
let f = "", T = 0;
|
|
548
|
+
for (let p of r.slice(0, e)) {
|
|
549
|
+
T++;
|
|
550
|
+
let m = i(p), _ = [];
|
|
551
|
+
for (let x = 0; x < m.length; x++) {
|
|
552
|
+
let L = m[x];
|
|
553
|
+
L = `(shared with ${o.get(m.slice(0, x + 1).join(`
|
|
554
|
+
`)).size}/${r.length} leaks) at ${L}`;
|
|
555
|
+
let X = st([...o.get(m.slice(0, x).join(`
|
|
556
|
+
`))].map((F) => i(F)[x]), (F) => F);
|
|
557
|
+
delete X[m[x]];
|
|
558
|
+
for (let [F, he] of Object.entries(X)) _.unshift(` - stacktraces of ${he.length} other leaks continue with ${F}`);
|
|
559
|
+
_.unshift(L);
|
|
560
|
+
}
|
|
561
|
+
f += `
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
==================== Leaking disposable ${T}/${r.length}: ${p.value.constructor.name} ====================
|
|
565
|
+
${_.join(`
|
|
566
|
+
`)}
|
|
567
|
+
============================================================
|
|
568
|
+
|
|
569
|
+
`;
|
|
570
|
+
}
|
|
571
|
+
return r.length > e && (f += `
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
... and ${r.length - e} more leaking disposables
|
|
575
|
+
|
|
576
|
+
`), {
|
|
577
|
+
leaks: r,
|
|
578
|
+
details: f
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
ie.idx = 0;
|
|
583
|
+
function Mt(n) {
|
|
584
|
+
B = n;
|
|
585
|
+
}
|
|
586
|
+
if (Pt) {
|
|
587
|
+
let n = "__is_disposable_tracked__";
|
|
588
|
+
Mt(new class {
|
|
589
|
+
trackDisposable(e) {
|
|
590
|
+
let t = (/* @__PURE__ */ new Error("Potentially leaked disposable")).stack;
|
|
591
|
+
setTimeout(() => {
|
|
592
|
+
e[n] || console.log(t);
|
|
593
|
+
}, 3e3);
|
|
594
|
+
}
|
|
595
|
+
setParent(e, t) {
|
|
596
|
+
if (e && e !== k.None) try {
|
|
597
|
+
e[n] = !0;
|
|
598
|
+
} catch {}
|
|
599
|
+
}
|
|
600
|
+
markAsDisposed(e) {
|
|
601
|
+
if (e && e !== k.None) try {
|
|
602
|
+
e[n] = !0;
|
|
603
|
+
} catch {}
|
|
604
|
+
}
|
|
605
|
+
markAsSingleton(e) {}
|
|
606
|
+
}());
|
|
607
|
+
}
|
|
608
|
+
function Ee(n) {
|
|
609
|
+
return B?.trackDisposable(n), n;
|
|
610
|
+
}
|
|
611
|
+
function Ie(n) {
|
|
612
|
+
B?.markAsDisposed(n);
|
|
613
|
+
}
|
|
614
|
+
function ye(n, e) {
|
|
615
|
+
B?.setParent(n, e);
|
|
616
|
+
}
|
|
617
|
+
function Bt(n, e) {
|
|
618
|
+
if (B) for (let t of n) B.setParent(t, e);
|
|
619
|
+
}
|
|
620
|
+
function at(n) {
|
|
621
|
+
if (_e.is(n)) {
|
|
622
|
+
let e = [];
|
|
623
|
+
for (let t of n) if (t) try {
|
|
624
|
+
t.dispose();
|
|
625
|
+
} catch (r) {
|
|
626
|
+
e.push(r);
|
|
627
|
+
}
|
|
628
|
+
if (e.length === 1) throw e[0];
|
|
629
|
+
if (e.length > 1) throw new AggregateError(e, "Encountered errors while disposing of store");
|
|
630
|
+
return Array.isArray(n) ? [] : n;
|
|
631
|
+
} else if (n) return n.dispose(), n;
|
|
632
|
+
}
|
|
633
|
+
function lt(...n) {
|
|
634
|
+
let e = De(() => at(n));
|
|
635
|
+
return Bt(n, e), e;
|
|
636
|
+
}
|
|
637
|
+
function De(n) {
|
|
638
|
+
let e = Ee({ dispose: ge(() => {
|
|
639
|
+
Ie(e), n();
|
|
640
|
+
}) });
|
|
641
|
+
return e;
|
|
642
|
+
}
|
|
643
|
+
var se = class se {
|
|
644
|
+
constructor() {
|
|
645
|
+
this._toDispose = /* @__PURE__ */ new Set();
|
|
646
|
+
this._isDisposed = !1;
|
|
647
|
+
Ee(this);
|
|
648
|
+
}
|
|
649
|
+
dispose() {
|
|
650
|
+
this._isDisposed || (Ie(this), this._isDisposed = !0, this.clear());
|
|
651
|
+
}
|
|
652
|
+
get isDisposed() {
|
|
653
|
+
return this._isDisposed;
|
|
654
|
+
}
|
|
655
|
+
clear() {
|
|
656
|
+
if (this._toDispose.size !== 0) try {
|
|
657
|
+
at(this._toDispose);
|
|
658
|
+
} finally {
|
|
659
|
+
this._toDispose.clear();
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
add(e) {
|
|
663
|
+
if (!e) return e;
|
|
664
|
+
if (e === this) throw new Error("Cannot register a disposable on itself!");
|
|
665
|
+
return ye(e, this), this._isDisposed ? se.DISABLE_DISPOSED_WARNING || console.warn((/* @__PURE__ */ new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!")).stack) : this._toDispose.add(e), e;
|
|
666
|
+
}
|
|
667
|
+
delete(e) {
|
|
668
|
+
if (e) {
|
|
669
|
+
if (e === this) throw new Error("Cannot dispose a disposable on itself!");
|
|
670
|
+
this._toDispose.delete(e), e.dispose();
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
deleteAndLeak(e) {
|
|
674
|
+
e && this._toDispose.has(e) && (this._toDispose.delete(e), ye(e, null));
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
se.DISABLE_DISPOSED_WARNING = !1;
|
|
678
|
+
var N = se;
|
|
679
|
+
var k = class {
|
|
680
|
+
constructor() {
|
|
681
|
+
this._store = new N();
|
|
682
|
+
Ee(this), ye(this._store, this);
|
|
683
|
+
}
|
|
684
|
+
dispose() {
|
|
685
|
+
Ie(this), this._store.dispose();
|
|
686
|
+
}
|
|
687
|
+
_register(e) {
|
|
688
|
+
if (e === this) throw new Error("Cannot register a disposable on itself!");
|
|
689
|
+
return this._store.add(e);
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
k.None = Object.freeze({ dispose() {} });
|
|
693
|
+
var W = class W {
|
|
694
|
+
constructor(e) {
|
|
695
|
+
this.element = e, this.next = W.Undefined, this.prev = W.Undefined;
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
W.Undefined = new W(void 0);
|
|
699
|
+
var Nt = globalThis.performance && typeof globalThis.performance.now == "function";
|
|
700
|
+
var oe = class n {
|
|
701
|
+
static create(e) {
|
|
702
|
+
return new n(e);
|
|
703
|
+
}
|
|
704
|
+
constructor(e) {
|
|
705
|
+
this._now = Nt && e === !1 ? Date.now : globalThis.performance.now.bind(globalThis.performance), this._startTime = this._now(), this._stopTime = -1;
|
|
706
|
+
}
|
|
707
|
+
stop() {
|
|
708
|
+
this._stopTime = this._now();
|
|
709
|
+
}
|
|
710
|
+
reset() {
|
|
711
|
+
this._startTime = this._now(), this._stopTime = -1;
|
|
712
|
+
}
|
|
713
|
+
elapsed() {
|
|
714
|
+
return this._stopTime !== -1 ? this._stopTime - this._startTime : this._now() - this._startTime;
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
var Wt = !1;
|
|
718
|
+
var dt = !1;
|
|
719
|
+
var Vt = !1;
|
|
720
|
+
var Ht;
|
|
721
|
+
((q) => {
|
|
722
|
+
q.None = () => k.None;
|
|
723
|
+
function e(u) {
|
|
724
|
+
if (Vt) {
|
|
725
|
+
let { onDidAddListener: s } = u, l = j.create(), a = 0;
|
|
726
|
+
u.onDidAddListener = () => {
|
|
727
|
+
++a === 2 && (console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"), l.print()), s?.();
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
function t(u, s) {
|
|
732
|
+
return L(u, () => {}, 0, void 0, !0, void 0, s);
|
|
733
|
+
}
|
|
734
|
+
q.defer = t;
|
|
735
|
+
function r(u) {
|
|
736
|
+
return (s, l = null, a) => {
|
|
737
|
+
let d = !1, h;
|
|
738
|
+
return h = u((v) => {
|
|
739
|
+
if (!d) return h ? h.dispose() : d = !0, s.call(l, v);
|
|
740
|
+
}, null, a), d && h.dispose(), h;
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
q.once = r;
|
|
744
|
+
function i(u, s, l) {
|
|
745
|
+
return _((a, d = null, h) => u((v) => a.call(d, s(v)), null, h), l);
|
|
746
|
+
}
|
|
747
|
+
q.map = i;
|
|
748
|
+
function o(u, s, l) {
|
|
749
|
+
return _((a, d = null, h) => u((v) => {
|
|
750
|
+
s(v), a.call(d, v);
|
|
751
|
+
}, null, h), l);
|
|
752
|
+
}
|
|
753
|
+
q.forEach = o;
|
|
754
|
+
function f(u, s, l) {
|
|
755
|
+
return _((a, d = null, h) => u((v) => s(v) && a.call(d, v), null, h), l);
|
|
756
|
+
}
|
|
757
|
+
q.filter = f;
|
|
758
|
+
function T(u) {
|
|
759
|
+
return u;
|
|
760
|
+
}
|
|
761
|
+
q.signal = T;
|
|
762
|
+
function p(...u) {
|
|
763
|
+
return (s, l = null, a) => {
|
|
764
|
+
return x(lt(...u.map((h) => h((v) => s.call(l, v)))), a);
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
q.any = p;
|
|
768
|
+
function m(u, s, l, a) {
|
|
769
|
+
let d = l;
|
|
770
|
+
return i(u, (h) => (d = s(d, h), d), a);
|
|
771
|
+
}
|
|
772
|
+
q.reduce = m;
|
|
773
|
+
function _(u, s) {
|
|
774
|
+
let l, a = {
|
|
775
|
+
onWillAddFirstListener() {
|
|
776
|
+
l = u(d.fire, d);
|
|
777
|
+
},
|
|
778
|
+
onDidRemoveLastListener() {
|
|
779
|
+
l?.dispose();
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
s || e(a);
|
|
783
|
+
let d = new A(a);
|
|
784
|
+
return s?.add(d), d.event;
|
|
785
|
+
}
|
|
786
|
+
function x(u, s) {
|
|
787
|
+
return s instanceof Array ? s.push(u) : s && s.add(u), u;
|
|
788
|
+
}
|
|
789
|
+
function L(u, s, l = 100, a = !1, d = !1, h, v) {
|
|
790
|
+
let E, I, P, Z = 0, G, Ze = {
|
|
791
|
+
leakWarningThreshold: h,
|
|
792
|
+
onWillAddFirstListener() {
|
|
793
|
+
E = u((Rt) => {
|
|
794
|
+
Z++, I = s(I, Rt), a && !P && (Y.fire(I), I = void 0), G = () => {
|
|
795
|
+
let kt = I;
|
|
796
|
+
I = void 0, P = void 0, (!a || Z > 1) && Y.fire(kt), Z = 0;
|
|
797
|
+
}, typeof l == "number" ? (clearTimeout(P), P = setTimeout(G, l)) : P === void 0 && (P = 0, queueMicrotask(G));
|
|
798
|
+
});
|
|
799
|
+
},
|
|
800
|
+
onWillRemoveListener() {
|
|
801
|
+
d && Z > 0 && G?.();
|
|
802
|
+
},
|
|
803
|
+
onDidRemoveLastListener() {
|
|
804
|
+
G = void 0, E.dispose();
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
v || e(Ze);
|
|
808
|
+
let Y = new A(Ze);
|
|
809
|
+
return v?.add(Y), Y.event;
|
|
810
|
+
}
|
|
811
|
+
q.debounce = L;
|
|
812
|
+
function O(u, s = 0, l) {
|
|
813
|
+
return q.debounce(u, (a, d) => a ? (a.push(d), a) : [d], s, void 0, !0, void 0, l);
|
|
814
|
+
}
|
|
815
|
+
q.accumulate = O;
|
|
816
|
+
function pe(u, s = (a, d) => a === d, l) {
|
|
817
|
+
let a = !0, d;
|
|
818
|
+
return f(u, (h) => {
|
|
819
|
+
let v = a || !s(h, d);
|
|
820
|
+
return a = !1, d = h, v;
|
|
821
|
+
}, l);
|
|
822
|
+
}
|
|
823
|
+
q.latch = pe;
|
|
824
|
+
function X(u, s, l) {
|
|
825
|
+
return [q.filter(u, s, l), q.filter(u, (a) => !s(a), l)];
|
|
826
|
+
}
|
|
827
|
+
q.split = X;
|
|
828
|
+
function F(u, s = !1, l = [], a) {
|
|
829
|
+
let d = l.slice(), h = u((I) => {
|
|
830
|
+
d ? d.push(I) : E.fire(I);
|
|
831
|
+
});
|
|
832
|
+
a && a.add(h);
|
|
833
|
+
let v = () => {
|
|
834
|
+
d?.forEach((I) => E.fire(I)), d = null;
|
|
835
|
+
}, E = new A({
|
|
836
|
+
onWillAddFirstListener() {
|
|
837
|
+
h || (h = u((I) => E.fire(I)), a && a.add(h));
|
|
838
|
+
},
|
|
839
|
+
onDidAddFirstListener() {
|
|
840
|
+
d && (s ? setTimeout(v) : v());
|
|
841
|
+
},
|
|
842
|
+
onDidRemoveLastListener() {
|
|
843
|
+
h && h.dispose(), h = null;
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
return a && a.add(E), E.event;
|
|
847
|
+
}
|
|
848
|
+
q.buffer = F;
|
|
849
|
+
function he(u, s) {
|
|
850
|
+
return (a, d, h) => {
|
|
851
|
+
let v = s(new Te());
|
|
852
|
+
return u(function(E) {
|
|
853
|
+
let I = v.evaluate(E);
|
|
854
|
+
I !== K && a.call(d, I);
|
|
855
|
+
}, void 0, h);
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
q.chain = he;
|
|
859
|
+
let K = Symbol("HaltChainable");
|
|
860
|
+
class Te {
|
|
861
|
+
constructor() {
|
|
862
|
+
this.steps = [];
|
|
863
|
+
}
|
|
864
|
+
map(s) {
|
|
865
|
+
return this.steps.push(s), this;
|
|
866
|
+
}
|
|
867
|
+
forEach(s) {
|
|
868
|
+
return this.steps.push((l) => (s(l), l)), this;
|
|
869
|
+
}
|
|
870
|
+
filter(s) {
|
|
871
|
+
return this.steps.push((l) => s(l) ? l : K), this;
|
|
872
|
+
}
|
|
873
|
+
reduce(s, l) {
|
|
874
|
+
let a = l;
|
|
875
|
+
return this.steps.push((d) => (a = s(a, d), a)), this;
|
|
876
|
+
}
|
|
877
|
+
latch(s = (l, a) => l === a) {
|
|
878
|
+
let l = !0, a;
|
|
879
|
+
return this.steps.push((d) => {
|
|
880
|
+
let h = l || !s(d, a);
|
|
881
|
+
return l = !1, a = d, h ? d : K;
|
|
882
|
+
}), this;
|
|
883
|
+
}
|
|
884
|
+
evaluate(s) {
|
|
885
|
+
for (let l of this.steps) if (s = l(s), s === K) break;
|
|
886
|
+
return s;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function c(u, s, l = (a) => a) {
|
|
890
|
+
let a = (...E) => v.fire(l(...E)), d = () => u.on(s, a), h = () => u.removeListener(s, a), v = new A({
|
|
891
|
+
onWillAddFirstListener: d,
|
|
892
|
+
onDidRemoveLastListener: h
|
|
893
|
+
});
|
|
894
|
+
return v.event;
|
|
895
|
+
}
|
|
896
|
+
q.fromNodeEventEmitter = c;
|
|
897
|
+
function b(u, s, l = (a) => a) {
|
|
898
|
+
let a = (...E) => v.fire(l(...E)), d = () => u.addEventListener(s, a), h = () => u.removeEventListener(s, a), v = new A({
|
|
899
|
+
onWillAddFirstListener: d,
|
|
900
|
+
onDidRemoveLastListener: h
|
|
901
|
+
});
|
|
902
|
+
return v.event;
|
|
903
|
+
}
|
|
904
|
+
q.fromDOMEventEmitter = b;
|
|
905
|
+
function g(u) {
|
|
906
|
+
return new Promise((s) => r(u)(s));
|
|
907
|
+
}
|
|
908
|
+
q.toPromise = g;
|
|
909
|
+
function D(u) {
|
|
910
|
+
let s = new A();
|
|
911
|
+
return u.then((l) => {
|
|
912
|
+
s.fire(l);
|
|
913
|
+
}, () => {
|
|
914
|
+
s.fire(void 0);
|
|
915
|
+
}).finally(() => {
|
|
916
|
+
s.dispose();
|
|
917
|
+
}), s.event;
|
|
918
|
+
}
|
|
919
|
+
q.fromPromise = D;
|
|
920
|
+
function z(u, s) {
|
|
921
|
+
return u((l) => s.fire(l));
|
|
922
|
+
}
|
|
923
|
+
q.forward = z;
|
|
924
|
+
function xe(u, s, l) {
|
|
925
|
+
return s(l), u((a) => s(a));
|
|
926
|
+
}
|
|
927
|
+
q.runAndSubscribe = xe;
|
|
928
|
+
class Ct {
|
|
929
|
+
constructor(s, l) {
|
|
930
|
+
this._observable = s;
|
|
931
|
+
this._counter = 0;
|
|
932
|
+
this._hasChanged = !1;
|
|
933
|
+
let a = {
|
|
934
|
+
onWillAddFirstListener: () => {
|
|
935
|
+
s.addObserver(this);
|
|
936
|
+
},
|
|
937
|
+
onDidRemoveLastListener: () => {
|
|
938
|
+
s.removeObserver(this);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
l || e(a), this.emitter = new A(a), l && l.add(this.emitter);
|
|
942
|
+
}
|
|
943
|
+
beginUpdate(s) {
|
|
944
|
+
this._counter++;
|
|
945
|
+
}
|
|
946
|
+
handlePossibleChange(s) {}
|
|
947
|
+
handleChange(s, l) {
|
|
948
|
+
this._hasChanged = !0;
|
|
949
|
+
}
|
|
950
|
+
endUpdate(s) {
|
|
951
|
+
this._counter--, this._counter === 0 && (this._observable.reportChanges(), this._hasChanged && (this._hasChanged = !1, this.emitter.fire(this._observable.get())));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
function _n(u, s) {
|
|
955
|
+
return new Ct(u, s).emitter.event;
|
|
956
|
+
}
|
|
957
|
+
q.fromObservable = _n;
|
|
958
|
+
function yn(u) {
|
|
959
|
+
return (s, l, a) => {
|
|
960
|
+
let d = 0, h = !1, v = {
|
|
961
|
+
beginUpdate() {
|
|
962
|
+
d++;
|
|
963
|
+
},
|
|
964
|
+
endUpdate() {
|
|
965
|
+
d--, d === 0 && (u.reportChanges(), h && (h = !1, s.call(l)));
|
|
966
|
+
},
|
|
967
|
+
handlePossibleChange() {},
|
|
968
|
+
handleChange() {
|
|
969
|
+
h = !0;
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
u.addObserver(v), u.reportChanges();
|
|
973
|
+
let E = { dispose() {
|
|
974
|
+
u.removeObserver(v);
|
|
975
|
+
} };
|
|
976
|
+
return a instanceof N ? a.add(E) : Array.isArray(a) && a.push(E), E;
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
q.fromObservableLight = yn;
|
|
980
|
+
})(Ht ||= {});
|
|
981
|
+
var V = class V {
|
|
982
|
+
constructor(e) {
|
|
983
|
+
this.listenerCount = 0;
|
|
984
|
+
this.invocationCount = 0;
|
|
985
|
+
this.elapsedOverall = 0;
|
|
986
|
+
this.durations = [];
|
|
987
|
+
this.name = `${e}_${V._idPool++}`, V.all.add(this);
|
|
988
|
+
}
|
|
989
|
+
start(e) {
|
|
990
|
+
this._stopWatch = new oe(), this.listenerCount = e;
|
|
991
|
+
}
|
|
992
|
+
stop() {
|
|
993
|
+
if (this._stopWatch) {
|
|
994
|
+
let e = this._stopWatch.elapsed();
|
|
995
|
+
this.durations.push(e), this.elapsedOverall += e, this.invocationCount += 1, this._stopWatch = void 0;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
V.all = /* @__PURE__ */ new Set(), V._idPool = 0;
|
|
1000
|
+
var Ae = V;
|
|
1001
|
+
var ct = -1;
|
|
1002
|
+
var le = class le {
|
|
1003
|
+
constructor(e, t, r = (le._idPool++).toString(16).padStart(3, "0")) {
|
|
1004
|
+
this._errorHandler = e;
|
|
1005
|
+
this.threshold = t;
|
|
1006
|
+
this.name = r;
|
|
1007
|
+
this._warnCountdown = 0;
|
|
1008
|
+
}
|
|
1009
|
+
dispose() {
|
|
1010
|
+
this._stacks?.clear();
|
|
1011
|
+
}
|
|
1012
|
+
check(e, t) {
|
|
1013
|
+
let r = this.threshold;
|
|
1014
|
+
if (r <= 0 || t < r) return;
|
|
1015
|
+
this._stacks || (this._stacks = /* @__PURE__ */ new Map());
|
|
1016
|
+
let i = this._stacks.get(e.value) || 0;
|
|
1017
|
+
if (this._stacks.set(e.value, i + 1), this._warnCountdown -= 1, this._warnCountdown <= 0) {
|
|
1018
|
+
this._warnCountdown = r * .5;
|
|
1019
|
+
let [o, f] = this.getMostFrequentStack(), T = `[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${f}):`;
|
|
1020
|
+
console.warn(T), console.warn(o);
|
|
1021
|
+
let p = new Ce(T, o);
|
|
1022
|
+
this._errorHandler(p);
|
|
1023
|
+
}
|
|
1024
|
+
return () => {
|
|
1025
|
+
let o = this._stacks.get(e.value) || 0;
|
|
1026
|
+
this._stacks.set(e.value, o - 1);
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
getMostFrequentStack() {
|
|
1030
|
+
if (!this._stacks) return;
|
|
1031
|
+
let e, t = 0;
|
|
1032
|
+
for (let [r, i] of this._stacks) (!e || t < i) && (e = [r, i], t = i);
|
|
1033
|
+
return e;
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
le._idPool = 1;
|
|
1037
|
+
var we = le;
|
|
1038
|
+
var j = class n {
|
|
1039
|
+
constructor(e) {
|
|
1040
|
+
this.value = e;
|
|
1041
|
+
}
|
|
1042
|
+
static create() {
|
|
1043
|
+
return new n((/* @__PURE__ */ new Error()).stack ?? "");
|
|
1044
|
+
}
|
|
1045
|
+
print() {
|
|
1046
|
+
console.warn(this.value.split(`
|
|
1047
|
+
`).slice(2).join(`
|
|
1048
|
+
`));
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
var Ce = class extends Error {
|
|
1052
|
+
constructor(e, t) {
|
|
1053
|
+
super(e), this.name = "ListenerLeakError", this.stack = t;
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
var Re = class extends Error {
|
|
1057
|
+
constructor(e, t) {
|
|
1058
|
+
super(e), this.name = "ListenerRefusalError", this.stack = t;
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var Kt = 0;
|
|
1062
|
+
var H = class {
|
|
1063
|
+
constructor(e) {
|
|
1064
|
+
this.value = e;
|
|
1065
|
+
this.id = Kt++;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var zt = 2;
|
|
1069
|
+
var Gt = (n, e) => {
|
|
1070
|
+
if (n instanceof H) e(n);
|
|
1071
|
+
else for (let t = 0; t < n.length; t++) {
|
|
1072
|
+
let r = n[t];
|
|
1073
|
+
r && e(r);
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
var ae;
|
|
1077
|
+
if (Wt) {
|
|
1078
|
+
let n = [];
|
|
1079
|
+
setInterval(() => {
|
|
1080
|
+
n.length !== 0 && (console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"), console.warn(n.join(`
|
|
1081
|
+
`)), n.length = 0);
|
|
1082
|
+
}, 3e3), ae = new FinalizationRegistry((e) => {
|
|
1083
|
+
typeof e == "string" && n.push(e);
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
var A = class {
|
|
1087
|
+
constructor(e) {
|
|
1088
|
+
this._size = 0;
|
|
1089
|
+
this._options = e, this._leakageMon = ct > 0 || this._options?.leakWarningThreshold ? new we(e?.onListenerError ?? te, this._options?.leakWarningThreshold ?? ct) : void 0, this._perfMon = this._options?._profName ? new Ae(this._options._profName) : void 0, this._deliveryQueue = this._options?.deliveryQueue;
|
|
1090
|
+
}
|
|
1091
|
+
dispose() {
|
|
1092
|
+
if (!this._disposed) {
|
|
1093
|
+
if (this._disposed = !0, this._deliveryQueue?.current === this && this._deliveryQueue.reset(), this._listeners) {
|
|
1094
|
+
if (dt) {
|
|
1095
|
+
let e = this._listeners;
|
|
1096
|
+
queueMicrotask(() => {
|
|
1097
|
+
Gt(e, (t) => t.stack?.print());
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
this._listeners = void 0, this._size = 0;
|
|
1101
|
+
}
|
|
1102
|
+
this._options?.onDidRemoveLastListener?.(), this._leakageMon?.dispose();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
get event() {
|
|
1106
|
+
return this._event ??= (e, t, r) => {
|
|
1107
|
+
if (this._leakageMon && this._size > this._leakageMon.threshold ** 2) {
|
|
1108
|
+
let p = `[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;
|
|
1109
|
+
console.warn(p);
|
|
1110
|
+
let m = this._leakageMon.getMostFrequentStack() ?? ["UNKNOWN stack", -1], _ = new Re(`${p}. HINT: Stack shows most frequent listener (${m[1]}-times)`, m[0]);
|
|
1111
|
+
return (this._options?.onListenerError || te)(_), k.None;
|
|
1112
|
+
}
|
|
1113
|
+
if (this._disposed) return k.None;
|
|
1114
|
+
t && (e = e.bind(t));
|
|
1115
|
+
let i = new H(e), o;
|
|
1116
|
+
this._leakageMon && this._size >= Math.ceil(this._leakageMon.threshold * .2) && (i.stack = j.create(), o = this._leakageMon.check(i.stack, this._size + 1)), this._listeners ? this._listeners instanceof H ? (this._deliveryQueue ??= new ke(), this._listeners = [this._listeners, i]) : this._listeners.push(i) : (this._options?.onWillAddFirstListener?.(this), this._listeners = i, this._options?.onDidAddFirstListener?.(this)), this._size++;
|
|
1117
|
+
let T = De(() => {
|
|
1118
|
+
ae?.unregister(T), o?.(), this._removeListener(i);
|
|
1119
|
+
});
|
|
1120
|
+
if (r instanceof N ? r.add(T) : Array.isArray(r) && r.push(T), ae) {
|
|
1121
|
+
let p = (/* @__PURE__ */ new Error()).stack.split(`
|
|
1122
|
+
`).slice(2, 3).join(`
|
|
1123
|
+
`).trim(), m = /(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(p);
|
|
1124
|
+
ae.register(T, m?.[2] ?? p, T);
|
|
1125
|
+
}
|
|
1126
|
+
return T;
|
|
1127
|
+
}, this._event;
|
|
1128
|
+
}
|
|
1129
|
+
_removeListener(e) {
|
|
1130
|
+
if (this._options?.onWillRemoveListener?.(this), !this._listeners) return;
|
|
1131
|
+
if (this._size === 1) {
|
|
1132
|
+
this._listeners = void 0, this._options?.onDidRemoveLastListener?.(this), this._size = 0;
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
let t = this._listeners, r = t.indexOf(e);
|
|
1136
|
+
if (r === -1) throw console.log("disposed?", this._disposed), console.log("size?", this._size), console.log("arr?", JSON.stringify(this._listeners)), /* @__PURE__ */ new Error("Attempted to dispose unknown listener");
|
|
1137
|
+
this._size--, t[r] = void 0;
|
|
1138
|
+
let i = this._deliveryQueue.current === this;
|
|
1139
|
+
if (this._size * zt <= t.length) {
|
|
1140
|
+
let o = 0;
|
|
1141
|
+
for (let f = 0; f < t.length; f++) t[f] ? t[o++] = t[f] : i && (this._deliveryQueue.end--, o < this._deliveryQueue.i && this._deliveryQueue.i--);
|
|
1142
|
+
t.length = o;
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
_deliver(e, t) {
|
|
1146
|
+
if (!e) return;
|
|
1147
|
+
let r = this._options?.onListenerError || te;
|
|
1148
|
+
if (!r) {
|
|
1149
|
+
e.value(t);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
try {
|
|
1153
|
+
e.value(t);
|
|
1154
|
+
} catch (i) {
|
|
1155
|
+
r(i);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
_deliverQueue(e) {
|
|
1159
|
+
let t = e.current._listeners;
|
|
1160
|
+
for (; e.i < e.end;) this._deliver(t[e.i++], e.value);
|
|
1161
|
+
e.reset();
|
|
1162
|
+
}
|
|
1163
|
+
fire(e) {
|
|
1164
|
+
if (this._deliveryQueue?.current && (this._deliverQueue(this._deliveryQueue), this._perfMon?.stop()), this._perfMon?.start(this._size), this._listeners) if (this._listeners instanceof H) this._deliver(this._listeners, e);
|
|
1165
|
+
else {
|
|
1166
|
+
let t = this._deliveryQueue;
|
|
1167
|
+
t.enqueue(this, e, this._listeners.length), this._deliverQueue(t);
|
|
1168
|
+
}
|
|
1169
|
+
this._perfMon?.stop();
|
|
1170
|
+
}
|
|
1171
|
+
hasListeners() {
|
|
1172
|
+
return this._size > 0;
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
var ke = class {
|
|
1176
|
+
constructor() {
|
|
1177
|
+
this.i = -1;
|
|
1178
|
+
this.end = 0;
|
|
1179
|
+
}
|
|
1180
|
+
enqueue(e, t, r) {
|
|
1181
|
+
this.i = 0, this.end = r, this.current = e, this.value = t;
|
|
1182
|
+
}
|
|
1183
|
+
reset() {
|
|
1184
|
+
this.i = this.end, this.current = void 0, this.value = void 0;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
var w = class n {
|
|
1188
|
+
constructor() {
|
|
1189
|
+
this._providers = Object.create(null);
|
|
1190
|
+
this._active = "";
|
|
1191
|
+
this._onChange = new A();
|
|
1192
|
+
this.onChange = this._onChange.event;
|
|
1193
|
+
let e = new J();
|
|
1194
|
+
this.register(e), this._active = e.version, this._activeProvider = e;
|
|
1195
|
+
}
|
|
1196
|
+
static extractShouldJoin(e) {
|
|
1197
|
+
return (e & 1) !== 0;
|
|
1198
|
+
}
|
|
1199
|
+
static extractWidth(e) {
|
|
1200
|
+
return e >> 1 & 3;
|
|
1201
|
+
}
|
|
1202
|
+
static extractCharKind(e) {
|
|
1203
|
+
return e >> 3;
|
|
1204
|
+
}
|
|
1205
|
+
static createPropertyValue(e, t, r = !1) {
|
|
1206
|
+
return (e & 16777215) << 3 | (t & 3) << 1 | (r ? 1 : 0);
|
|
1207
|
+
}
|
|
1208
|
+
dispose() {
|
|
1209
|
+
this._onChange.dispose();
|
|
1210
|
+
}
|
|
1211
|
+
get versions() {
|
|
1212
|
+
return Object.keys(this._providers);
|
|
1213
|
+
}
|
|
1214
|
+
get activeVersion() {
|
|
1215
|
+
return this._active;
|
|
1216
|
+
}
|
|
1217
|
+
set activeVersion(e) {
|
|
1218
|
+
if (!this._providers[e]) throw new Error(`unknown Unicode version "${e}"`);
|
|
1219
|
+
this._active = e, this._activeProvider = this._providers[e], this._onChange.fire(e);
|
|
1220
|
+
}
|
|
1221
|
+
register(e) {
|
|
1222
|
+
this._providers[e.version] = e;
|
|
1223
|
+
}
|
|
1224
|
+
wcwidth(e) {
|
|
1225
|
+
return this._activeProvider.wcwidth(e);
|
|
1226
|
+
}
|
|
1227
|
+
getStringCellWidth(e) {
|
|
1228
|
+
let t = 0, r = 0, i = e.length;
|
|
1229
|
+
for (let o = 0; o < i; ++o) {
|
|
1230
|
+
let f = e.charCodeAt(o);
|
|
1231
|
+
if (55296 <= f && f <= 56319) {
|
|
1232
|
+
if (++o >= i) return t + this.wcwidth(f);
|
|
1233
|
+
let m = e.charCodeAt(o);
|
|
1234
|
+
56320 <= m && m <= 57343 ? f = (f - 55296) * 1024 + m - 56320 + 65536 : t += this.wcwidth(m);
|
|
1235
|
+
}
|
|
1236
|
+
let T = this.charProperties(f, r), p = n.extractWidth(T);
|
|
1237
|
+
n.extractShouldJoin(T) && (p -= n.extractWidth(r)), t += p, r = T;
|
|
1238
|
+
}
|
|
1239
|
+
return t;
|
|
1240
|
+
}
|
|
1241
|
+
charProperties(e, t) {
|
|
1242
|
+
return this._activeProvider.charProperties(e, t);
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
var Ue = 0;
|
|
1246
|
+
var Tt = -3;
|
|
1247
|
+
var S = class {
|
|
1248
|
+
constructor() {
|
|
1249
|
+
this.table = /* @__PURE__ */ new Uint16Array(16);
|
|
1250
|
+
this.trans = /* @__PURE__ */ new Uint16Array(288);
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
var Fe = class {
|
|
1254
|
+
constructor(e, t) {
|
|
1255
|
+
this.tag = 0;
|
|
1256
|
+
this.bitcount = 0;
|
|
1257
|
+
this.destLen = 0;
|
|
1258
|
+
this.sourceIndex = 0;
|
|
1259
|
+
this.source = e, this.dest = t, this.ltree = new S(), this.dtree = new S();
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
var xt = new S();
|
|
1263
|
+
var bt = new S();
|
|
1264
|
+
var Oe = /* @__PURE__ */ new Uint8Array(30);
|
|
1265
|
+
var Pe = /* @__PURE__ */ new Uint16Array(30);
|
|
1266
|
+
var vt = /* @__PURE__ */ new Uint8Array(30);
|
|
1267
|
+
var mt = /* @__PURE__ */ new Uint16Array(30);
|
|
1268
|
+
var jt = new Uint8Array([
|
|
1269
|
+
16,
|
|
1270
|
+
17,
|
|
1271
|
+
18,
|
|
1272
|
+
0,
|
|
1273
|
+
8,
|
|
1274
|
+
7,
|
|
1275
|
+
9,
|
|
1276
|
+
6,
|
|
1277
|
+
10,
|
|
1278
|
+
5,
|
|
1279
|
+
11,
|
|
1280
|
+
4,
|
|
1281
|
+
12,
|
|
1282
|
+
3,
|
|
1283
|
+
13,
|
|
1284
|
+
2,
|
|
1285
|
+
14,
|
|
1286
|
+
1,
|
|
1287
|
+
15
|
|
1288
|
+
]);
|
|
1289
|
+
var ft = new S();
|
|
1290
|
+
var C = /* @__PURE__ */ new Uint8Array(320);
|
|
1291
|
+
function gt(n, e, t, r) {
|
|
1292
|
+
var i = 0, o;
|
|
1293
|
+
for (; i < t; ++i) n[i] = 0;
|
|
1294
|
+
for (i = 0; i < 30 - t; ++i) n[i + t] = i / t | 0;
|
|
1295
|
+
for (o = r, i = 0; i < 30; ++i) e[i] = o, o += 1 << n[i];
|
|
1296
|
+
}
|
|
1297
|
+
function Qt(n, e) {
|
|
1298
|
+
var t = 0;
|
|
1299
|
+
for (; t < 7; ++t) n.table[t] = 0;
|
|
1300
|
+
for (n.table[7] = 24, n.table[8] = 152, n.table[9] = 112, t = 0; t < 24; ++t) n.trans[t] = 256 + t;
|
|
1301
|
+
for (t = 0; t < 144; ++t) n.trans[24 + t] = t;
|
|
1302
|
+
for (t = 0; t < 8; ++t) n.trans[168 + t] = 280 + t;
|
|
1303
|
+
for (t = 0; t < 112; ++t) n.trans[176 + t] = 144 + t;
|
|
1304
|
+
for (t = 0; t < 5; ++t) e.table[t] = 0;
|
|
1305
|
+
for (e.table[5] = 32, t = 0; t < 32; ++t) e.trans[t] = t;
|
|
1306
|
+
}
|
|
1307
|
+
var pt = /* @__PURE__ */ new Uint16Array(16);
|
|
1308
|
+
function Le(n, e, t, r) {
|
|
1309
|
+
var i = 0, o;
|
|
1310
|
+
for (; i < 16; ++i) n.table[i] = 0;
|
|
1311
|
+
for (i = 0; i < r; ++i) n.table[e[t + i]]++;
|
|
1312
|
+
for (n.table[0] = 0, o = 0, i = 0; i < 16; ++i) pt[i] = o, o += n.table[i];
|
|
1313
|
+
for (i = 0; i < r; ++i) e[t + i] && (n.trans[pt[e[t + i]]++] = i);
|
|
1314
|
+
}
|
|
1315
|
+
function Xt(n) {
|
|
1316
|
+
n.bitcount-- || (n.tag = n.source[n.sourceIndex++], n.bitcount = 7);
|
|
1317
|
+
var e = n.tag & 1;
|
|
1318
|
+
return n.tag >>>= 1, e;
|
|
1319
|
+
}
|
|
1320
|
+
function R(n, e, t) {
|
|
1321
|
+
if (!e) return t;
|
|
1322
|
+
for (; n.bitcount < 24;) n.tag |= n.source[n.sourceIndex++] << n.bitcount, n.bitcount += 8;
|
|
1323
|
+
var r = n.tag & 65535 >>> 16 - e;
|
|
1324
|
+
return n.tag >>>= e, n.bitcount -= e, r + t;
|
|
1325
|
+
}
|
|
1326
|
+
function Se(n, e) {
|
|
1327
|
+
for (; n.bitcount < 24;) n.tag |= n.source[n.sourceIndex++] << n.bitcount, n.bitcount += 8;
|
|
1328
|
+
var t = 0, r = 0, i = 0, o = n.tag;
|
|
1329
|
+
do
|
|
1330
|
+
r = 2 * r + (o & 1), o >>>= 1, ++i, t += e.table[i], r -= e.table[i];
|
|
1331
|
+
while (r >= 0);
|
|
1332
|
+
return n.tag = o, n.bitcount -= i, e.trans[t + r];
|
|
1333
|
+
}
|
|
1334
|
+
function qt(n, e, t) {
|
|
1335
|
+
var r = R(n, 5, 257), i = R(n, 5, 1), o = R(n, 4, 4), f = 0, T, p;
|
|
1336
|
+
for (; f < 19; ++f) C[f] = 0;
|
|
1337
|
+
for (f = 0; f < o; ++f) {
|
|
1338
|
+
var m = R(n, 3, 0);
|
|
1339
|
+
C[jt[f]] = m;
|
|
1340
|
+
}
|
|
1341
|
+
for (Le(ft, C, 0, 19), T = 0; T < r + i;) {
|
|
1342
|
+
var _ = Se(n, ft);
|
|
1343
|
+
switch (_) {
|
|
1344
|
+
case 16:
|
|
1345
|
+
var x = C[T - 1];
|
|
1346
|
+
for (p = R(n, 2, 3); p; --p) C[T++] = x;
|
|
1347
|
+
break;
|
|
1348
|
+
case 17:
|
|
1349
|
+
for (p = R(n, 3, 3); p; --p) C[T++] = 0;
|
|
1350
|
+
break;
|
|
1351
|
+
case 18:
|
|
1352
|
+
for (p = R(n, 7, 11); p; --p) C[T++] = 0;
|
|
1353
|
+
break;
|
|
1354
|
+
default: C[T++] = _;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
Le(e, C, 0, r), Le(t, C, r, i);
|
|
1358
|
+
}
|
|
1359
|
+
function ht(n, e, t) {
|
|
1360
|
+
for (;;) {
|
|
1361
|
+
var r = Se(n, e);
|
|
1362
|
+
if (r === 256) return Ue;
|
|
1363
|
+
if (r < 256) n.dest[n.destLen++] = r;
|
|
1364
|
+
else {
|
|
1365
|
+
var i, o, f, T;
|
|
1366
|
+
for (r -= 257, i = R(n, Oe[r], Pe[r]), o = Se(n, t), f = n.destLen - R(n, vt[o], mt[o]), T = f; T < f + i; ++T) n.dest[n.destLen++] = n.dest[T];
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
function Zt(n) {
|
|
1371
|
+
for (var e, t, r; n.bitcount > 8;) n.sourceIndex--, n.bitcount -= 8;
|
|
1372
|
+
if (e = n.source[n.sourceIndex + 1], e = 256 * e + n.source[n.sourceIndex], t = n.source[n.sourceIndex + 3], t = 256 * t + n.source[n.sourceIndex + 2], e !== (~t & 65535)) return Tt;
|
|
1373
|
+
for (n.sourceIndex += 4, r = e; r; --r) n.dest[n.destLen++] = n.source[n.sourceIndex++];
|
|
1374
|
+
return n.bitcount = 0, Ue;
|
|
1375
|
+
}
|
|
1376
|
+
function Yt(n, e) {
|
|
1377
|
+
var t = new Fe(n, e), r, i, o;
|
|
1378
|
+
do {
|
|
1379
|
+
switch (r = Xt(t), i = R(t, 2, 0), i) {
|
|
1380
|
+
case 0:
|
|
1381
|
+
o = Zt(t);
|
|
1382
|
+
break;
|
|
1383
|
+
case 1:
|
|
1384
|
+
o = ht(t, xt, bt);
|
|
1385
|
+
break;
|
|
1386
|
+
case 2:
|
|
1387
|
+
qt(t, t.ltree, t.dtree), o = ht(t, t.ltree, t.dtree);
|
|
1388
|
+
break;
|
|
1389
|
+
default: o = Tt;
|
|
1390
|
+
}
|
|
1391
|
+
if (o !== Ue) throw new Error("Data error");
|
|
1392
|
+
} while (!r);
|
|
1393
|
+
return t.destLen < t.dest.length ? typeof t.dest.slice == "function" ? t.dest.slice(0, t.destLen) : t.dest.subarray(0, t.destLen) : t.dest;
|
|
1394
|
+
}
|
|
1395
|
+
Qt(xt, bt);
|
|
1396
|
+
gt(Oe, Pe, 4, 3);
|
|
1397
|
+
gt(vt, mt, 2, 1);
|
|
1398
|
+
Oe[28] = 0;
|
|
1399
|
+
Pe[28] = 258;
|
|
1400
|
+
var Me = Yt;
|
|
1401
|
+
var We = 11;
|
|
1402
|
+
var U = 5;
|
|
1403
|
+
var Jt = We - U;
|
|
1404
|
+
var $t = 65536 >> We;
|
|
1405
|
+
var tn = (1 << Jt) - 1;
|
|
1406
|
+
var ue = 2;
|
|
1407
|
+
var Be = (1 << U) - 1;
|
|
1408
|
+
var _t = 65536 >> U;
|
|
1409
|
+
var ln = _t + (1024 >> U) + 32;
|
|
1410
|
+
var un = 1 << ue;
|
|
1411
|
+
var dn = new Uint8Array(new Uint32Array([305419896]).buffer)[0] === 18;
|
|
1412
|
+
var Ne = class {
|
|
1413
|
+
constructor(e) {
|
|
1414
|
+
let t = new DataView(e.buffer);
|
|
1415
|
+
this.highStart = t.getUint32(0, !0), this.errorValue = t.getUint32(4, !0);
|
|
1416
|
+
let r = t.getUint32(8, !0);
|
|
1417
|
+
if (e = e.subarray(12), e = Me(e, new Uint8Array(r)), e = Me(e, new Uint8Array(r)), dn) {
|
|
1418
|
+
let i = e.length;
|
|
1419
|
+
for (let o = 0; o < i; o += 4) {
|
|
1420
|
+
let f = e[o];
|
|
1421
|
+
e[o] = e[o + 3], e[o + 3] = f;
|
|
1422
|
+
let T = e[o + 1];
|
|
1423
|
+
e[o + 1] = e[o + 2], e[o + 2] = T;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
this.data = new Uint32Array(e.buffer);
|
|
1427
|
+
}
|
|
1428
|
+
get(e) {
|
|
1429
|
+
let t;
|
|
1430
|
+
return e < 0 || e > 1114111 ? this.errorValue : e < 55296 || e > 56319 && e <= 65535 ? (t = (this.data[e >> U] << ue) + (e & Be), this.data[t]) : e <= 65535 ? (t = (this.data[_t + (e - 55296 >> U)] << ue) + (e & Be), this.data[t]) : e < this.highStart ? (t = this.data[ln - $t + (e >> We)], t = this.data[t + (e >> U & tn)], t = (t << ue) + (e & Be), this.data[t]) : this.data[this.data.length - un];
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
var yt = Ne;
|
|
1434
|
+
var cn = "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";
|
|
1435
|
+
function fn(n) {
|
|
1436
|
+
if (typeof Buffer < "u") return Buffer.from(n, "base64");
|
|
1437
|
+
let e = atob(n), t = new Uint8Array(e.length);
|
|
1438
|
+
for (let r = 0; r < t.length; ++r) t[r] = e.charCodeAt(r);
|
|
1439
|
+
return t;
|
|
1440
|
+
}
|
|
1441
|
+
var pn = new yt(fn(cn));
|
|
1442
|
+
var de = 15;
|
|
1443
|
+
var ce = 0;
|
|
1444
|
+
var hn = 48;
|
|
1445
|
+
var Tn = 4;
|
|
1446
|
+
var Dt = 0;
|
|
1447
|
+
var je = 1;
|
|
1448
|
+
var Qe = 2;
|
|
1449
|
+
var Ge = 3;
|
|
1450
|
+
var xn = 4;
|
|
1451
|
+
var Ve = 5;
|
|
1452
|
+
var He = 6;
|
|
1453
|
+
var Ke = 7;
|
|
1454
|
+
var Et = 8;
|
|
1455
|
+
var ze = 9;
|
|
1456
|
+
var It = 10;
|
|
1457
|
+
var bn = 11;
|
|
1458
|
+
var vn = 32;
|
|
1459
|
+
function Xe(n) {
|
|
1460
|
+
return (n & hn) >> Tn;
|
|
1461
|
+
}
|
|
1462
|
+
function At(n, e) {
|
|
1463
|
+
let t = (n & de) >> ce, r = (e & de) >> ce;
|
|
1464
|
+
return mn(t, r) ? r === Ge ? vn : r + 16 : r - 16;
|
|
1465
|
+
}
|
|
1466
|
+
function mn(n, e) {
|
|
1467
|
+
return n >= Ve && n <= ze && (n == Ve && (e == Ve || e == He || e == Et || e == ze) || (n == Et || n == He) && (e == He || e == Ke) || (n == ze || n == Ke) && e == Ke) || e == Qe || e == It || n == je || e == xn || n == It && e == bn || e == Ge && n == Ge;
|
|
1468
|
+
}
|
|
1469
|
+
function qe(n) {
|
|
1470
|
+
return pn.get(n);
|
|
1471
|
+
}
|
|
1472
|
+
var fe = class fe {
|
|
1473
|
+
constructor(e = !0) {
|
|
1474
|
+
this.ambiguousCharsAreWide = !1;
|
|
1475
|
+
this.version = e ? "15-graphemes" : "15", this.handleGraphemes = e;
|
|
1476
|
+
}
|
|
1477
|
+
charProperties(e, t) {
|
|
1478
|
+
if (e >= 32 && e < 127 && t >> 3 === 0) return fe._plainNarrowProperties;
|
|
1479
|
+
let r = qe(e), i = Xe(r), o = !1;
|
|
1480
|
+
if (i >= 2 ? i = i === 3 || this.ambiguousCharsAreWide || e === 65039 ? 2 : 1 : i = 1, t !== 0) {
|
|
1481
|
+
let f = w.extractWidth(t);
|
|
1482
|
+
this.handleGraphemes ? r = At(w.extractCharKind(t), r) : r = i === 0 ? 1 : 0, o = r > 0, o && (f > i ? i = f : r === 32 && (i = 2));
|
|
1483
|
+
}
|
|
1484
|
+
return w.createPropertyValue(r, i, o);
|
|
1485
|
+
}
|
|
1486
|
+
wcwidth(e) {
|
|
1487
|
+
let t = qe(e), r = Xe(t), i = (t & de) >> ce;
|
|
1488
|
+
return i === Qe || i === je ? 0 : r >= 2 && (r === 3 || this.ambiguousCharsAreWide) ? 2 : 1;
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
fe._plainNarrowProperties = w.createPropertyValue(Dt, 1, !1);
|
|
1492
|
+
var Q = fe;
|
|
1493
|
+
var wt = class {
|
|
1494
|
+
constructor() {
|
|
1495
|
+
this._oldVersion = "";
|
|
1496
|
+
}
|
|
1497
|
+
activate(e) {
|
|
1498
|
+
this._provider15 || (this._provider15 = new Q(!1)), this._provider15Graphemes || (this._provider15Graphemes = new Q(!0));
|
|
1499
|
+
let t = e.unicode;
|
|
1500
|
+
this._unicode = t, t.register(this._provider15), t.register(this._provider15Graphemes), this._oldVersion = t.activeVersion, t.activeVersion = "15-graphemes";
|
|
1501
|
+
}
|
|
1502
|
+
dispose() {
|
|
1503
|
+
this._unicode && (this._unicode.activeVersion = this._oldVersion);
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
//#endregion
|
|
1507
|
+
//#region src/terminal/terminal-view.tsx
|
|
1508
|
+
const DEFAULT_TERMINAL_THEME = {
|
|
1509
|
+
background: "#0c0c0e",
|
|
1510
|
+
foreground: "#d4d4d8",
|
|
1511
|
+
cursor: "#34d399",
|
|
1512
|
+
cursorAccent: "#0c0c0e",
|
|
1513
|
+
selectionBackground: "#7c3aed33",
|
|
1514
|
+
selectionForeground: "#d4d4d8",
|
|
1515
|
+
black: "#18181b",
|
|
1516
|
+
red: "#ef4444",
|
|
1517
|
+
green: "#34d399",
|
|
1518
|
+
yellow: "#fbbf24",
|
|
1519
|
+
blue: "#60a5fa",
|
|
1520
|
+
magenta: "#a78bfa",
|
|
1521
|
+
cyan: "#22d3ee",
|
|
1522
|
+
white: "#d4d4d8",
|
|
1523
|
+
brightBlack: "#52525b",
|
|
1524
|
+
brightRed: "#f87171",
|
|
1525
|
+
brightGreen: "#6ee7b7",
|
|
1526
|
+
brightYellow: "#fde68a",
|
|
1527
|
+
brightBlue: "#93c5fd",
|
|
1528
|
+
brightMagenta: "#c4b5fd",
|
|
1529
|
+
brightCyan: "#67e8f9",
|
|
1530
|
+
brightWhite: "#fafafa"
|
|
1531
|
+
};
|
|
1532
|
+
function TerminalView({ session, apiUrl, token, theme, title = "Terminal", subtitle = "Connected to PTY session", isActive = true, connectionId, incarnationId, control, fontSize = 13 }) {
|
|
1533
|
+
const resolvedTheme = useMemo(() => ({
|
|
1534
|
+
...DEFAULT_TERMINAL_THEME,
|
|
1535
|
+
...theme
|
|
1536
|
+
}), [theme]);
|
|
1537
|
+
const resolvedFontSize = Number.isFinite(fontSize) && fontSize > 0 ? fontSize : 13;
|
|
1538
|
+
const fontSizeRef = useRef(resolvedFontSize);
|
|
1539
|
+
fontSizeRef.current = resolvedFontSize;
|
|
1540
|
+
const containerRef = useRef(null);
|
|
1541
|
+
const termRef = useRef(null);
|
|
1542
|
+
const fitAddonRef = useRef(null);
|
|
1543
|
+
const pendingWritesRef = useRef([]);
|
|
1544
|
+
const writeRafRef = useRef(null);
|
|
1545
|
+
const onData = useCallback((data) => {
|
|
1546
|
+
if (!data) return;
|
|
1547
|
+
pendingWritesRef.current.push(data);
|
|
1548
|
+
if (writeRafRef.current !== null) return;
|
|
1549
|
+
writeRafRef.current = requestAnimationFrame(() => {
|
|
1550
|
+
writeRafRef.current = null;
|
|
1551
|
+
const chunks = pendingWritesRef.current;
|
|
1552
|
+
if (chunks.length === 0) return;
|
|
1553
|
+
pendingWritesRef.current = [];
|
|
1554
|
+
termRef.current?.write(chunks.length === 1 ? chunks[0] : chunks.join(""));
|
|
1555
|
+
});
|
|
1556
|
+
}, []);
|
|
1557
|
+
const usesCallerSession = session !== void 0;
|
|
1558
|
+
const shellSession = usePtySession({
|
|
1559
|
+
enabled: !usesCallerSession,
|
|
1560
|
+
apiUrl,
|
|
1561
|
+
token,
|
|
1562
|
+
onData,
|
|
1563
|
+
connectionId,
|
|
1564
|
+
incarnationId,
|
|
1565
|
+
control
|
|
1566
|
+
});
|
|
1567
|
+
const { isConnected, error, sendCommand, resizeTerminal, reconnect } = session ?? shellSession;
|
|
1568
|
+
const subscribeData = session?.subscribeData;
|
|
1569
|
+
useEffect(() => subscribeData?.(onData), [subscribeData, onData]);
|
|
1570
|
+
useEffect(() => {
|
|
1571
|
+
if (!containerRef.current) return;
|
|
1572
|
+
const term = new Terminal({
|
|
1573
|
+
theme: resolvedTheme,
|
|
1574
|
+
fontFamily: "\"JetBrains Mono\", \"Fira Code\", \"Cascadia Code\", Menlo, monospace",
|
|
1575
|
+
fontSize: fontSizeRef.current,
|
|
1576
|
+
lineHeight: 1.4,
|
|
1577
|
+
cursorBlink: true,
|
|
1578
|
+
cursorStyle: "bar",
|
|
1579
|
+
scrollback: 5e3,
|
|
1580
|
+
convertEol: true,
|
|
1581
|
+
allowProposedApi: true
|
|
1582
|
+
});
|
|
1583
|
+
const fitAddon = new FitAddon();
|
|
1584
|
+
const webLinksAddon = new WebLinksAddon();
|
|
1585
|
+
term.loadAddon(new wt());
|
|
1586
|
+
term.unicode.activeVersion = "15-graphemes";
|
|
1587
|
+
term.loadAddon(fitAddon);
|
|
1588
|
+
term.loadAddon(webLinksAddon);
|
|
1589
|
+
term.open(containerRef.current);
|
|
1590
|
+
let webglAddon = null;
|
|
1591
|
+
let webglCancelled = false;
|
|
1592
|
+
(async () => {
|
|
1593
|
+
try {
|
|
1594
|
+
const mod = await import("@xterm/addon-webgl");
|
|
1595
|
+
if (webglCancelled) return;
|
|
1596
|
+
try {
|
|
1597
|
+
const addon = new mod.WebglAddon();
|
|
1598
|
+
addon.onContextLoss(() => {
|
|
1599
|
+
webglAddon?.dispose();
|
|
1600
|
+
webglAddon = null;
|
|
1601
|
+
});
|
|
1602
|
+
webglAddon = addon;
|
|
1603
|
+
term.loadAddon(addon);
|
|
1604
|
+
} catch {}
|
|
1605
|
+
} catch {}
|
|
1606
|
+
})();
|
|
1607
|
+
requestAnimationFrame(() => {
|
|
1608
|
+
fitAddon.fit();
|
|
1609
|
+
});
|
|
1610
|
+
termRef.current = term;
|
|
1611
|
+
fitAddonRef.current = fitAddon;
|
|
1612
|
+
term.onData((data) => {
|
|
1613
|
+
if (!usesCallerSession && data === "\f") {
|
|
1614
|
+
termRef.current?.clear();
|
|
1615
|
+
sendCommand("\r").catch(console.error);
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
sendCommand(data).catch((err) => {
|
|
1619
|
+
termRef.current?.writeln(`\r\n\x1b[31m${err instanceof Error ? err.message : "Send failed"}\x1b[0m`);
|
|
1620
|
+
});
|
|
1621
|
+
});
|
|
1622
|
+
term.onResize(({ cols, rows }) => {
|
|
1623
|
+
resizeTerminal(cols, rows).catch(console.error);
|
|
1624
|
+
});
|
|
1625
|
+
const ro = new ResizeObserver(() => {
|
|
1626
|
+
requestAnimationFrame(() => {
|
|
1627
|
+
fitAddon.fit();
|
|
1628
|
+
});
|
|
1629
|
+
});
|
|
1630
|
+
ro.observe(containerRef.current);
|
|
1631
|
+
return () => {
|
|
1632
|
+
webglCancelled = true;
|
|
1633
|
+
ro.disconnect();
|
|
1634
|
+
if (writeRafRef.current !== null) {
|
|
1635
|
+
cancelAnimationFrame(writeRafRef.current);
|
|
1636
|
+
writeRafRef.current = null;
|
|
1637
|
+
}
|
|
1638
|
+
pendingWritesRef.current = [];
|
|
1639
|
+
webglAddon?.dispose();
|
|
1640
|
+
term.dispose();
|
|
1641
|
+
termRef.current = null;
|
|
1642
|
+
fitAddonRef.current = null;
|
|
1643
|
+
};
|
|
1644
|
+
}, [
|
|
1645
|
+
sendCommand,
|
|
1646
|
+
resizeTerminal,
|
|
1647
|
+
title,
|
|
1648
|
+
subtitle,
|
|
1649
|
+
usesCallerSession
|
|
1650
|
+
]);
|
|
1651
|
+
useEffect(() => {
|
|
1652
|
+
if (termRef.current) termRef.current.options.theme = resolvedTheme;
|
|
1653
|
+
}, [resolvedTheme]);
|
|
1654
|
+
useEffect(() => {
|
|
1655
|
+
const term = termRef.current;
|
|
1656
|
+
if (!term || term.options.fontSize === resolvedFontSize) return;
|
|
1657
|
+
term.options.fontSize = resolvedFontSize;
|
|
1658
|
+
const rafId = requestAnimationFrame(() => fitAddonRef.current?.fit());
|
|
1659
|
+
return () => cancelAnimationFrame(rafId);
|
|
1660
|
+
}, [resolvedFontSize]);
|
|
1661
|
+
useEffect(() => {
|
|
1662
|
+
if (isConnected && termRef.current) {
|
|
1663
|
+
resizeTerminal(termRef.current.cols, termRef.current.rows).catch(console.error);
|
|
1664
|
+
if (isActive) termRef.current.focus();
|
|
1665
|
+
}
|
|
1666
|
+
}, [
|
|
1667
|
+
isConnected,
|
|
1668
|
+
resizeTerminal,
|
|
1669
|
+
isActive
|
|
1670
|
+
]);
|
|
1671
|
+
useEffect(() => {
|
|
1672
|
+
if (isActive && termRef.current && fitAddonRef.current) setTimeout(() => {
|
|
1673
|
+
fitAddonRef.current?.fit();
|
|
1674
|
+
termRef.current?.focus();
|
|
1675
|
+
}, 50);
|
|
1676
|
+
}, [isActive]);
|
|
1677
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1678
|
+
className: "relative h-full w-full group cursor-text",
|
|
1679
|
+
onClick: () => termRef.current?.focus(),
|
|
1680
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1681
|
+
ref: containerRef,
|
|
1682
|
+
className: "h-full w-full overflow-hidden relative z-0",
|
|
1683
|
+
style: { backgroundColor: resolvedTheme.background }
|
|
1684
|
+
}), (!isConnected || error) && /* @__PURE__ */ jsx("div", {
|
|
1685
|
+
className: "absolute inset-0 flex items-center justify-center bg-surface-container-lowest",
|
|
1686
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1687
|
+
className: "text-center",
|
|
1688
|
+
children: error ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
1689
|
+
className: "text-sm text-[var(--surface-danger-text)] mb-3",
|
|
1690
|
+
children: error
|
|
1691
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1692
|
+
onClick: reconnect,
|
|
1693
|
+
className: "text-sm text-[var(--surface-success-text)] hover:opacity-80 underline cursor-pointer",
|
|
1694
|
+
children: "Retry connection"
|
|
1695
|
+
})] }) : /* @__PURE__ */ jsx("p", {
|
|
1696
|
+
className: "text-[13px] text-muted-foreground",
|
|
1697
|
+
children: "Connecting to terminal..."
|
|
1698
|
+
})
|
|
1699
|
+
})
|
|
1700
|
+
})]
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
//#endregion
|
|
1704
|
+
export { TerminalView as n, DEFAULT_TERMINAL_THEME as t };
|